inconsistent response to http post request in .net proxy

  • Thread starter Thread starter figelwump
  • Start date Start date
F

figelwump

All,

I am writing an HTTP 1.1 compliant proxy in c#.NET, for use as a proxy
server for any web browser (IE, firefox, etc). I've got it working
fine for GET requests. However, when a POST request is issued by IE, I
find that sometimes IE does not render the page, even though my proxy
reports that it successfully sent the response from the server back to
IE. So, in IE a blank page is rendered. If I use a plugin like
IEWatch, it seems to show the correct response headers and content
coming from the proxy.

Additionally, if I step through the proxy with the debugger in Visual
Studio, the problem does not reproduce. This is perplexing because I
am only using the synchronous socket API's in system.net.sockets.
Also, if I issue the same POST request with firefox, the problem does
not reproduce. So it's an issue specific to IE as the client. Any
ideas? Does IE require HTTP connections to be handled in a specific
way? Or perhaps does it expect intermediary proxies to handle
responses in a specific way?

Thanks
 
Hi figelwump,

Can you view the source of the response page?(View>Source menu)
If so it may be you have malformed html in your response page (orphaned
tags, duplicate tag attributes). These have been causing rendering problems
in IE6 SP2 and IE7, but not in other browsers.

Regards.
 
If I view source in IE, I get the following:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html;
charset=utf-8"></HEAD>
<BODY></BODY></HTML>

.... and it's rendered as a blank page, as expected. However, the proxy
reports the contents that it sends back to the client, and that looks
like the correct HTML. So I'm not sure how/where data is getting lost
here?
 
Hi,
Very strange. That is not even about:blank = <html></html>
I am no expert on headers, but since the Get response works and the Post
response doesn't, there must be something different in the headers that are
returned... packet length?
Does the source html even remotely look like your server source?
Doctype,head.... whats missing from the body?

Just some thoughts/guesses.

Regards.
 
All,

I am writing an HTTP 1.1 compliant proxy in c#.NET, for use as a proxy
server for any web browser (IE, firefox, etc). I've got it working
fine for GET requests. However, when a POST request is issued by IE, I
find that sometimes IE does not render the page, even though my proxy
reports that it successfully sent the response from the server back to
IE. So, in IE a blank page is rendered. If I use a plugin like
IEWatch, it seems to show the correct response headers and content
coming from the proxy.
Additionally, if I step through the proxy with the debugger in Visual
Studio, the problem does not reproduce.


If it's a timing problem using a debugger or using a proxy tracer
is going to change the timing. BTW have you tried using FiddlerTool
as your tracer too? Note that it has an option to allow it to be "downstream"
so I think you could chain it in just about wherever you want.

This is perplexing because I
am only using the synchronous socket API's in system.net.sockets.
Also, if I issue the same POST request with firefox, the problem does
not reproduce. So it's an issue specific to IE as the client. Any
ideas?


Yet another undocumented and uncontrollable timeout, plus inappropriate
error recovery for such an event would be my guess.

To test this idea try using a transparent tracer, such as netcap.
Format its .cap files with Ethereal and pay attention to the differences
in timestamps of the packets when it works and contrast those
with the timing when it doesn't.

Does IE require HTTP connections to be handled in a specific
way? Or perhaps does it expect intermediary proxies to handle
responses in a specific way?

Thanks


Analyse what FiddlerTool does, assuming it doesn't exhibit
the problem symtpom?

BTW try the MSDN web forums for IE instead of newsgroups
if you're hoping to catch the attention of responders from MS.


Good luck

Robert Aldwinckle
---
 
Thus wrote (e-mail address removed),
All,

I am writing an HTTP 1.1 compliant proxy in c#.NET, for use as a proxy
server for any web browser (IE, firefox, etc). I've got it working
fine for GET requests. However, when a POST request is issued by IE,
I find that sometimes IE does not render the page, even though my
proxy reports that it successfully sent the response from the server
back to IE. So, in IE a blank page is rendered. If I use a plugin
like IEWatch, it seems to show the correct response headers and
content coming from the proxy.

Additionally, if I step through the proxy with the debugger in Visual
Studio, the problem does not reproduce. This is perplexing because I
am only using the synchronous socket API's in system.net.sockets.
Also, if I issue the same POST request with firefox, the problem does
not reproduce. So it's an issue specific to IE as the client. Any
ideas? Does IE require HTTP connections to be handled in a specific
way? Or perhaps does it expect intermediary proxies to handle
responses in a specific way?

Is your connection handling correct according to RFC 2616 or whatever HTTP
version to want to support? Especially regarding persistent connections?

Cheers,
 
Back
Top