Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

LWP/HTTP::Request Printing HTTP level

by zer (Deacon)
on Aug 19, 2009 at 19:01 UTC ( [id://789925]=perlquestion: print w/replies, xml ) Need Help??

zer has asked for the wisdom of the Perl Monks concerning the following question:

Good evening,
Is there a way to have the level of http explicitly shown with the request? (ie. HTTP/1.1 HTTP/0.9)
my $ua = LWP::UserAgent->new; my $h = HTTP::Headers->new; $h->header('Content-Type' => 'text/x-json', Accept=>'text/x-json'); my $GetReq = HTTP::Request->new( 'PUT', 'http://localhost:8000/user/', $h, ); print $GetReq->as_string; my $resp = $ua->request($GetReq);
Current output:
PUT http://localhost:8000/user/ Accept: text/json User-Agent: libwww-perl/5.831 Content-Type: text/json
Desired output:
PUT http://localhost:8000/user/ HTTP/1.1 Accept: text/x-json Content-Type: text/x-json

Thank You

Replies are listed 'Best First'.
Re: LWP/HTTP::Request Printing HTTP level
by zwon (Abbot) on Aug 19, 2009 at 20:20 UTC

    Add the following statement

    $GetReq->protocol('HTTP/1.1');
    See protocol method description in HTTP::Message

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://789925]
Approved by almut
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-25 14:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found