Re: Capturing server response

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Solutio at Gmail wrote:
Gotcha. I haven't had to do that before, but I am sure I will figure that out. We will try this solution as well as setting up a proxy, to see which will have the least impact on the overall performance. Thanks heaps.

If you need more specific help with mod_perl, I suggest to try the mod_perl list. You will find subscription information at "http://perl.apache.org";.

By the way, if you go here :
http://perl.apache.org/docs/2.0/user/handlers/filters.html#Setting_the_Content_Length_Header_in_Request_Output_Filters
you should find an example that is just about what you need.
As shown, it modifies the Content-Length header, but you would just need to modify this section in the example :
     if ($seen_eos) {
          my $len = length $data;
          $filter->r->headers_out->set('Content-Length', $len);
          $filter->print($data) if $data;
      }..

to do something like
     if ($seen_eos) {
          my $r_headers = $filter->r->headers_out;
	  (log the headers) + (log $data)
          $filter->print($data) if $data; # pass the data further
      }..

This is not the most efficient way, and ok only as long as your response data is not too large (because it buffers it all) but if this is your first try at mod_perl, it would be an easy starting point.

In various places there, it is mentioned that a Request output filter (as opposed to a Connection output filter, which is harder to write) has no access to the HTTP response headers. That is true in the sense that the response headers do not really pass through the filter as data (only the response body does). But it still /can/ get the response headers (to log them e.g.) via $filter->r->headers_out().


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux