capture http responses
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Wednesday, January 22, 2003 03:03 PM

how i can write an application in java that capture all the http responses? this appication should be in the proxy. is it posible?

Re: capture http responses

Posted By:   Lasse_Koskela  
Posted On:   Wednesday, January 22, 2003 11:49 PM

This is pretty simple as long as you don't use SSL.


Here is an example context:

- The target service (web site) is running at "http://target:80"

- The proxy service is running at "http://proxy:8080"

- The browser has set its proxy to be "http://proxy:8080"


Now, when the user types in "http://target" in his browser, the browser actually sends the request to "http://proxy:8080". The difference between a regular HTTP request and a proxy HTTP request is in the resource URI:

Normal: GET /index.html HTTP/1.1

Proxy: GET http://target/index.html HTTP/1.1


The proxy software needs to listen to the 8080 port, and upon receiving a valid HTTP proxy request, open a connection to the target host fetching the index.html page, and finally write the index.html page to the original response stream.


It's pretty simple once you get a hold of the concept. I'd suggest you read the HTTP spec from w3.org (the chapters related to proxy).

About | Sitemap | Contact