I want to read the file into a variable and just use something like the following to set up for returning to client.$res->headers($header_file_content);
Then write the method, or use this one...
# in whatever package... package HTTP::Response; sub headers { my $obj = shift; my $arg = shift || die "no file nor string, aborted"; my $fh; { no warnings 'io'; # stat might be unsuccessful open $fh, "<", -f $arg ? $arg: \$arg; } while( <$fh>) { chomp; my ($k,$v) = split/:\s+/,$_,2; $obj->header(lc $k, $v); } } package whatever; # back to whatever package
...which you can pass a file name or a string containing header lines.
In reply to Re: Help building response headers for HTTP proxy request
by shmem
in thread Help building response headers for HTTP proxy request
by r1n0
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |