You have to patch the request prototype and hook into the _addHeaderLine.
It's not hard, but it's a bit hacky.
var http = require('http')
, req = http.IncomingMessage.prototype;
var _addHeaderLine = req._addHeaderLine;
//Patch ServerRequest to save unmodified copy of headers
req._addHeaderLine = function(field, value) {
var list = this.complete ?
(this.allTrailers || (this.allTrailers = {})) :
(this.allHeaders || (this.allHeaders = {}));
if (field in list) {
list[field].push(value);
} else {
list[field] = [value];
}
_addHeaderLine.call(this, field, value);
};
Then you can access the unmodified headers in req.allHeaders. To put them
back together obviously, just do req.allHeaders.join('\r\n').
Hope this helps.
On Thursday, May 31, 2012 9:07:14 AM UTC+10, CoolAJ86 wrote:
>
> I'm working on a debugging tool and want to show the actual raw http
> headers (with original case, position, \r\n etc).
>
> Is there any way to go about that without implementing my own http server
> with the tcp library?
>
> AJ ONeal
>
On Thursday, May 31, 2012 9:07:14 AM UTC+10, CoolAJ86 wrote:
>
> I'm working on a debugging tool and want to show the actual raw http
> headers (with original case, position, \r\n etc).
>
> Is there any way to go about that without implementing my own http server
> with the tcp library?
>
> AJ ONeal
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en