I'd like to get the raw http request from a client so I can capture it
- warts and all.
I know it's possible to access the attributes from within a request
using request.env (e.g. request.env["HTTP_ACCEPT"] to get the accept
header). However, I want the actual raw header sent to the server so I
can accurately spoof the client. Building a request from the various
request.env attributes may miss things (like whether the client
incorrently sends "user_agent" or "user-agent") as I assume it does
some housekeeping (plus there could be linefeed issues etc that i'd
like to capture). In essence I want the raw!
I believe it is possible to access what is sent to WebBrick through
the doGet function, but is it possible to abstract it so it'll work on
any server environment and can I get direct access to the header
directly from my application code?
As I said, your help was really appreciated, but I think I still have
an issue.
After some further investigation it looks like request.env accesses
the CGI environment variables (a la http://hoohoo.ncsa.uiuc.edu/cgi/env.html).
I need access to the originating HTTP request sent to the server... I
wonder if anyone out there knows a way to get access to this? I know
that in php it is possible using apache_request_headers();