Header Fixing Proxy
|Top | Amiga | Aweb||Contact|
AWeb has a few problems with currently used HTTP headers. Specifically AWeb does not pay attention to Cache-control headers. Usually Cache-control headers are used to prevent user agents and proxy servers from cacheing a page. One of the only ways to stop AWeb from caching a page is to use an Expires header setting the page expiry in the past.
AWeb provides a filter plugin system which allows a plugin to read the incomming data stream and make any modifications necessary. A filter plugin is would seem ideally suited to finding Cache-control headers and replacing them with Expires headers. However the filter plugin framework does not allow modification of headers so a plugin cannot do this.
With plugins unsuitable, the only way to get to the HTTP headers is with an external proxy program
I searched freshmeat and found a large number of proxies, both sophisticated and simple. I found micro_proxy, a very simple proxy. It is written in C for Unix which should make porting to the Amiga fairly simple.
I have modified this proxy to filter the http headers. When it finds a Cache-Control header, it removes any existing Expires header, and adds another one which expires in the past. This also solves the redirect bug in many cases. Specifically, groups.yahoo.com and trademe.co.nz now do not have trouble with logging in.
I have ported it to the Amiga. You will need ixemul to run the proxy. I currently run it on my linux machine as it is faster, and if it crashes, it isn't a big deal. The amiga version hasn't had much testing. The amiga binary is in the amiga directory in the archvie. I may port it to a native amiga application if anyone actually wants to use it on a regular basis, or you could do it yourself. You would just have to open the native amiga socket.library and use it's functions rather than the ixemu ones.
This proxy is designed to be called by Inetd. Inetd is part of you TCP/IP stack and listens for incomming connections and when it recieves one, it starts the relevant program and connects it to the correct client. To make the proxy work you must first configure your TCP/IP stack to start the proxy.
Create a new service. I called mine "awebproxy". You must choose an unused port number. Traditionally www proxies run on port 8080, so you might want to choose that one. Select the TCP protocol.
Add your service to the inetd. Enter the name of your service into the inetd configuration and select the awebproxy program as the server. You probably want to enter the same name again (micro_proxy) for the cli name. Currently there are no arguments. It shouldn't matter which user you run it as. Select the TCP protocol and "stream" and "no wait"
Finally you must configure aweb to talk to the proxy. Select the Proxy Tab in Network Settings. Enter "http://localhost:8080" into the http proxy box. If you chose a port other than 8080 then enter that instead. If you are using the proxy on a remote machine, then ether it's name rather than localhost.
Download. The Current version is 0.91
The proxy runs from inetd so there is significant overhead starting the program. This doesn't seem to be a problem for my pentium 100. This might be a problem when running on slower Amigas.
Headers longer than 10kB will be truncated, and could confuse the server
Memory allocation isn't brilliant, lots of small allocations are made. This isn't an issue for a Unix machine but could cause memory fragmentation on an Amiga.
No modifications to SSL headers are performed.
No security. If you don't have a firewall, or some other method (like in your TCP/IP stack) to prevent people on the internet from connecting to the proxy, then I might be encouraged to do some simple authentication.
Improve filtering options. Currently the only rule is hard coded into the program. If more rules are needed then I will write a simple configuration file. This will further slow down program startup. If you know of any other headers that could be massaged by this program, then please contact me.
Modify the html body. I don't know if this is needed, but it would be possible to fix things in the html.
Modify to run as a daemon, improving performance
copyright 2001 Tom Parker - last modified 13 Apr 2001