"Eduardo M. Cavalcanti" <[EMAIL PROTECTED]> writes:

> If one try to set a header like this:
> $the_request->headers->header(REMOTE_ADDR=>'234.234.234.234');

Why do you want to do this?  Fool some CGI script?

> A header REMOTE-ADDR is created. The underscore is substituted with an hifen.
> 
> Setting $HTTP::Headers::TRANSLATE_UNDERSCORE = 0 solves the problem,
> but if the HTTP::Header object has already been created the assignment
> does not have effect and the problem remains. So the following results
> in a REMOTE-ADDR header (with undesired hifen).
> 
> $save_translate = $HTTP::Headers::TRANSLATE_UNDERSCORE;
> $HTTP::Headers::TRANSLATE_UNDERSCORE = 0;
> $the_request->headers->header(REMOTE_ADDR=>'234.234.234.234');
> $HTTP::Headers::TRANSLATE_UNDERSCORE = $save_translate;

local is your fried:

{
   local $HTTP::Headers::TRANSLATE_UNDERSCORE = 0;
   $the_request->headers->header(REMOTE_ADDR=>'234.234.234.234');
}

> Setting $HTTP::Headers::TRANSLATE_UNDERSCORE before creating request
> objects solves the problem but causes collateral effects since libwww
> counts on the underscore translation to operate correctly. (A
> Content-Type header would be created as Content_Type)

Those cases where LWP itself use '_'-header-names should be fixed.

> Direct manipulation of an HTTP::Header object is not feasible because
> there are scoped lexicals used in the internal representation of a
> header (my $standard_case).

I did not understand this.

Regards,
Gisle

Reply via email to