ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i need some help. using perl, is there a way to specify an actual hex char to be used in a URL, like 0x20
an HTTP GET that has %20 in the uri is actually three hex chars and is the HTTP equiv of a space. but is there a way to represent a "space" using a hex value of say 0x20 or 0x00?
as example (which doesnt work, the actual GET has "$char" in it).
Code:
#!C:/perl64/bin/perl -w
#use strict;
use warnings;
use LWP::UserAgent [search.cpan.org];
use HTTP::Request [kobesearch.cpan.org];
my $char = "\x20"; # hexadecimal
my $URL = 'http://www.xyz.com/xxx/search/?o=nav&sp=cowboys$charand$charindians';
Last edited by Linux_Kidd; 05-08-2014 at 10:10 PM.
Can you explain in more detail what it is you want to do and why? Certain characters (like space) need to be percent-encoded in the query part of the URL. See this and references therein.
Can you explain in more detail what it is you want to do and why? Certain characters (like space) need to be percent-encoded in the query part of the URL. See this and references therein.
i think you are noting the rules..... doesnt mean i cant send 0x20 instead of 0x25,0x32,0x30
i am investigating a WAF log violation which shows the URL with actual spaces. the WAF itself wont show what the actual space is in hex. for normal URL's using url encoding like %20 the WAF shows these (which are three ascii chars of %, 2, and 0), etc.
i want to be able to send 0x20 instead of using %, etc.
yes, in general thats what i am trying to do. browsers (url encoders in general) will swap out ascii space for %20, etc. i tried %00 and webserver handled it a different way vs using %20, %00 gave http302 while %20 gave http200.
0x00 is null char, which is still 1 byte in the uri.
0x00 or 0x20 is 1 byte in the data, what the app layer does with 0x00 or non 0x20 is TBD.
Last edited by Linux_Kidd; 05-09-2014 at 11:14 AM.
of course i was seeing %, i was using \x25 for the hex char
however, a \x20 simply shows %20 in the get query, looks like the url module is encoding the space char into its HTTP %20 equiv.
URI encoders want to convert any hex 0x20 into three chars of %20, etc. Thats exactly what i am trying to get around. i need a URL encoder that will write the wire exactly as stated, in my case using a single 0x20 hex char for the space, etc.
The client is supposed to URL encode the query string. If you want to do things differently, you'll possibly have to use another (your own?) protocol. Naturally, the thing doing the receiving will have to change as well.
You haven't said what this is for. Perhaps there's a better way to accomplish your end goal.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.