Re: writing a proxy ..
- From: tom fredriksen <tom@xxxxxxxxxx>
- Date: Sun, 19 Feb 2006 19:01:21 +0100
ebrahimbandookwala@xxxxxxxxx wrote:
I replaced most of the readLine() 's except one ( while reading from
the browser .. to get the destination address ) but I convert it to
bytes and then write it to the server ... So now I do get a reply from
the browser but I get a BAD REQUEST.
I dont quite understand your code, To clear things up, is this code for an http proxy? if so why does the request originate with the proxy and where does your browser come into it. Can you explain the architecture of this thing, I usually expect there to be a Client (C) talking to a Proxy (P) which relays the request to a Server (S). P rewrites the request to fit its policy and to adhere to the HTTP rfc and it also does this with any replies. To me it does not seem to be that way it works on your system?
I get this output
Starting THREAD ...
www.google.com
GET http://www.google.com/ig HTTP/1.0
Accept: */*
Accept-Language: en-us
Pragma: no-cache
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
..NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0;
Google-TR-3-GT)
Host: www.google.com
----------------: ----------
Cookie: IGPC=ET=Qa_2N5OUcWs:AF=0;
IGAT=PS=H4sIAAAAAAAAADO0SkvMKU5VMLJSqja0tKhVUjC2MgAAeL9uBRUAAAA;
GTZ=300;
PREF=ID=0992c2ff8ad2a631:TB=2:TM=1139960996:LM=1140017106:GM=1:S=-znwij1AWilXrWPa;
testcookie=; rememberme=true;
GPC=FW=0:GHV=2:SG=0:TS=0:TV=0:SIG=37mjM_cqX81gLHy3; TZ=300
Now Reading...
I can understand you are getting a bad request, because this does not look much like a proper HTTP request, even if its proxied. I have no idea what the stuff after the "---:---" is.
What I suggest is that you use a network sniffer to read the raw tcp packets sent to the proxy from the browser, and from the proxy to the server. This way you can see what is the original request and how your server is modifying it, and finally what the responses are.
But before doing this I recommend you do the same thing for a pure request from the browser to a server, without a proxy or anything you have produced in between. That way you can see what the real data is supposed to look like. You could, if you want set up an apache proxy to study how that looks like as well. But I recommend reading the rfc's in any case.
/tom
.
- Follow-Ups:
- Re: writing a proxy ..
- From: ebby83
- Re: writing a proxy ..
- References:
- writing a proxy ..
- From: ebby83
- Re: writing a proxy ..
- From: tom fredriksen
- Re: writing a proxy ..
- From: ebrahimbandookwala
- writing a proxy ..
- Prev by Date: Re: FTP client with proxy tunnel
- Next by Date: Re: NullPointerException vs '= null' check
- Previous by thread: Re: writing a proxy ..
- Next by thread: Re: writing a proxy ..
- Index(es):
Relevant Pages
|