Skip Menu |

This queue is for tickets about the IO-Lambda CPAN distribution.

Report information
The Basics
Id: 62669
Status: resolved
Priority: 0/
Queue: IO-Lambda

People
Owner: Nobody in particular
Requestors: MITHALDU [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.20
Fixed in: (no value)



Subject: IO::Lambda::HTTP does not seem to be able to handle POST requests
When trying to use IO::Lambda::HTTP to POST requests at urls, i only get error messages back. Lighttpd claims "400 malformed request", while google.com claims "411 content-length required. Looking at things with wireshark gave this: LWP::Useragent : ..)..m..7..=..E....y@........jJ}Mc@..P|x.@....P...c...POST / HTTP/1.1..TE: deflate,gzip;q=0.3..Connection: TE, close..Host: google.com..User-Agent: AssetManager/1.0..Content-Length: 5..Content- Type: application/x-www-form-urlencoded....id=34 IO::Lambda::HTTP : ..)..m..7..=..E.....@........jJ}Mc@..P.b./.5q.P...c...POST http:// google.com..User-Agent: AssetManager/1.0..Content-Length: 5..Content- Type: application/x-www-form-urlencoded....id=34 From that it seems that it simply omits the entire HTTP type header up until the Host: directive.
Seems that the POST request was done using HTTP 0.9, is that intentional? Or indeed the module ignores protocol('HTTP/1.1') and other headers? Because if I take f.ex. eg/http-redirect.pl, and add $r-> headers-> header( 'Content-Length' => 0), there (yes, IO-Lambda doesn't fill these for you), google responds with error 405, not 411 , says POST inappropriate for URL, but Host: string is actually present in the http dump. Can you give a small script reproducing the problem?
Sorry, i forgot to add this. Here's the script i was running: https:// gist.github.com/661230
Seems that this code for ( @chain ) { $_-> protocol('HTTP/1.1'); $_-> headers-> header('Host' => $_-> uri->host); } if added after line 24, does the thing. Is that a suitable solution? BTW, I've tried with HTTP 0.9 manually, eve-metrics.com doesn't support that anyway, even with GETs.
ps - don't know if you've seen it already, but there exists a standard IO::Lambda::par() function for parallel execution with max lambdas
assuming the patch solves the problem, I'm closing the ticket