I am wondering if there is a straightforward way to use .NET's built in HTTP support to parse arbitrary bytes into nice HTTP requests and responses. For example, I would like to be able to pass in a byte array containing "HTTP/200 OK\r\nContent-Type:...." etc and get out some structure representing the status code, and decoded content.
views:
73answers:
1
+2
Q:
Is there a way to use .NET's built-in HTTP classes to parse "raw" TCP streams as HTTP from memory?
+1
A:
I'm afraid there is not built-in support for this that you can access. This logic is embedded in internals of the HttpWebRequest
-related classes of the .NET Framework.
I think the closest you can get is hosting your own web server through the System.Web.Hosting APIs, but this sounds too heavyweight for what you are describing.
binarycoder
2009-11-24 23:33:04