Subject: | [PATCH] Incorrect handling of headers |
Hello, I've found out that HTTP::Async doesn't handle headers from HTTP::Headers correctly while composing the request.
HTTP::Headers is super-inteligent about the case of header names - it can deal with mistyped header names like USer-aGENT. BUT it creates a special key called '::std_case' among the legal header names in its internal data structure.
HTTP::Async is behaving a little bit too much low-level when it extracts the headers and, as a consequence, it can send out something like "::std_case: HASH(0x1234567)" among the HTTP headers. (When for example a Cookie header is used). That makes the request illegal and (to give an example) Facebook doesn't like it at all (400 - Bad Request).
The attached patch is pretty straighforward. I hope it will be useful.
Anyway, thank you for a good work. I've been messing with events and threads in the last week (to no good result) and it was HTTP::Async that did the job for me in the end.
Subject: | Async.pm.patch |
*** Async.pm 2013-04-04 14:14:16.000000000 +0200
--- Async.pm.patched 2013-04-04 14:14:04.000000000 +0200
***************
*** 684,690 ****
return 1;
}
! my %headers = %{ $request->{_headers} };
# Decide what to use as the request_uri
my $request_uri = $request_is_to_proxy # is this a proxy request....
--- 684,693 ----
return 1;
}
! my %headers;
! for my $key ($request->{_headers}->header_field_names) {
! $headers{$key} = $request->header($key);
! }
# Decide what to use as the request_uri
my $request_uri = $request_is_to_proxy # is this a proxy request....