perl5-http: no escape characters

From: Martin Herrman (m.herrman_at_student.tue.nl)
Date: 04/29/04

  • Next message: Matt S Trout: "Re: Is Perl *that* good? (was: How's ruby compare to it older brother python)"
    Date: Thu, 29 Apr 2004 22:10:37 +0200
    
    

    Dear Perl-freaks,

    I'm a newbee to Perl programming. For a course on security I want to
    submit a HTML form (using the POST method) with a field's value
    (without the double quotes) : "value'". When I use a standard browser, the
    browser sends "value\'" instead of "value'".

    So I thought a perl script could be a solution and after studying some
    tutorials, I came up with this:

    #!/usr/bin/perl
    use LWP::UserAgent;
    use HTTP::Request;
    use HTTP::Response;
    use HTTP::Headers;

    use strict;
    use warnings;

    my $browser = LWP::USerAgent->new();
    $browser->timeout(10);
    $browser->agent('Mozilla/bla bla bla');
    $browser->from('unknown@hotmail.com');
    my $respons = $browser->post('http://www.url.to/form.php',[field1 =>
    'value1', field2 => 'value2',]);
    if ($response->is_error()) {printf "%s\n", $response->status_line;}
    my $contents = $response->content();
    printf "%s\n",$contents;

    It works, except that it also adds the escape characters :-) So I searched
    in the .pm files and in Common.pm I found a line (#127):

    $k =~ s/([\\\"])/\\$1/g; # escape quotes and backslashes

    It is in the subroutine 'form_data' (which I'm not using I *guess*). I
    removed the line (it looks like it only changes a variable), but that
    doesn't stop adding the escape characters.

    Does one of you know where I should make any changes to stop adding escape
    characters?

    much thanks in advance!

    Martin


  • Next message: Matt S Trout: "Re: Is Perl *that* good? (was: How's ruby compare to it older brother python)"