in reply to Re: Help building response headers for HTTP proxy request
in thread Help building response headers for HTTP proxy request

Almut,

You are right. I ended up reading in the header file, line by line and splitting on the first colon ':'. Then, I use the take the info left of the colon and pair it with the info to the right. I build a HTTP::Headers object, and assign each left/right pair to the object via:

if ( -f $file_hdr_raw ){ open(RAW, "<$file_hdr_raw") or plog("Can NOT open <$SHA1_file_hdr_r +aw> for reading\n"); my(@lines) = <RAW>; close(RAW); while ( @lines ){ my $line = shift(@lines); my ($key, $value) = split(/:/, $line, 2); $headers->header( $key => $value ); } } # create response my $res = HTTP::Response->new($status_code, $status, $headers, $co +ntent); # send back (short-circuit normal content fetching) $self->proxy()->response($res);

At least I have tested the above, mixed with other code, and it works, well. I turned on the proxy use with Firefox and used a FF plugin to verify I was receiving the complete content of a past header saved off.

Thank you to everyone for their help.