开发者

Is there a way to use .NET's built-in HTTP classes to parse "raw" TCP streams as HTTP from memory?

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 开发者_如何学Csome structure representing the status code, and decoded content.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜