inconsistent response to http post request in .net proxy

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
 
R

Rob ^_^

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.
 
F

figelwump

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?
 
R

Rob ^_^

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.
 
R

Robert Aldwinckle

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
---
 
J

Joerg Jooss

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top