troxy: the tracing proxy a simple HTTP proxy server that traces the requests Another Aromatic Productions http://www.aromatic.com/ Copyright (C) 1998 Raffaele Sena (raff@aromatic.com) All rights reserved $Source: /usr/local/cvsroot/troxy/troxy.txt,v $ $Revision: 1.1 $ of $Date: 1998/09/09 08:35:12 $ ----------------------------------------------------------------------- What is it ---------- How many times you found yourself in need to know what your browser was sending out for a request ? Maybe not so many, or maybe, especially if you deal with servers and browsers for hobby or work, more than once. Or maybe you are just curious to see what goes under the hood when you click on a link. In any of these cases, troxy can be the tool for you. troxy, the tracing proxy, is a simple HTTP proxy server written in perl. It wait for HTTP requests on the specified port (default: 8000) and redirect them to the specified server. While doing this, troxy prints out the client request, the server response header and the page content, if declared as text (Content-Type: text/*) Requests are identified by a sequential connection number and they can be intermixed if the client issues them in parallel. How does it work ---------------- The troxy server spawns a new instance of itself for every request, read the request from the client and send it to the server, then read the response from the server and send it to the client. After that the connections with client and server are closed and the instance dies. As said before, the server is very simple. Since it is listening only on one of the two connections, it does not realize when the other goes down (i.e. you stop a request while waiting for the page). But in a controlled environment this is not really a problem. How to use it ------------- Copy the main program and the support library in the same directory and make sure the main program ( troxy.pl ) is executable and the pathname for 'perl' in its first line is correct ( #!/usr/bin/perl ). To run it, simply type 'troxy.pl' at the shell prompt. Also, set the proxy server on the browser you want to trace with an URL that point to the machine where troxy is running and the selected port ( 8000 is the default ). For example, if the machine where the server is running is www.thismachine.com and you use the default port, you will set to configure the HTTP Proxy server on your browser to: 'www.thismachine.com:8000'. If you don't want to use the default port ( 8000 ) you can run troxy with the port you want to use as parameter: troxy.pl 8001 In the previous example troxy will listen on the port 8001 and you will have to set the HTTP Proxy server on your browser to www.thismachine.com:8001. Acknowledgmnts -------------- troxy accesses to client and server using the 'easy_tcp' perl package, written by John Newlin . Thanks to this package, that hides all the complexity of creating the socket connections and spawning new instances of the server, the only thing that remain to do is really just forwording the requests and printing them. A (modified) copy of the package is distributed with this application. Contacts -------- For more information or comments about troxy you can send me an e-mail at raff@aromatic.com. Have fun, Raffaele Sena