Last post Nov 01, 2010 06:27 AM by ryanthemadone
Oct 31, 2010 04:54 PM|ryanthemadone|LINK
I'm in a situation where a GET request is made of my server without any content-length header. After the GET request is sent the client then sends a small chunk of data (8 bytes to be exact). It's imperative to note that this data is not meant to be treated
as a request body. For this reason asp.net/iis ignores it. I cannot read it and the input stream says it has a length of 0. This is the correct behaviour!
What I need to do is somehow hook into the request processing pipeline early enough to read this data and somehow append it to the request (Items?) I don't know how to do this 'correctly'. I figure I should probably create an IHttpModule to check if the
request is of the type that will have this data, then somehow read it.
How would I go about this? How would I be able to read this information in from the stream? I've tried adding an event handler to HttpApplication.BeginRequest but everything I try to read the stream fails.
I've read that I could potentially add a custom header using reflection (this would allow me to add a content-length header) but this feels nasty and hacky - I presume there's just a place where I can hook in and handle the reading of the stream before passing
it on for further processing.
I'm in desperate need of your help!
Nov 01, 2010 12:05 AM|krisrajz|LINK
To understand what data is sent and what you receive in response to get requests, checkout the handy TCP/IP tool ... try google search
This will really help you to understand what header has and what body has ...
All the best
Nov 01, 2010 06:27 AM|ryanthemadone|LINK
Hi thanks for your response. I've already used several tools to ascertain what headers are sent, the http requests look like this:
GET /demo HTTP/1.1
Sec-WebSocket-Key2: 12998 5 Y3 1 .P00
Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5
As you can see we have a body, but no content length header.