This post covers a proxy model for serving HTTP over ION-DTN.
The scripts are an imperfect proof of concept.
The proxies were only designed with GET requests in mind.
Other HTTP verbs may work, but POST and PUT will almost certainly fail.
The proxy scripts have a mechanism to simulate transmission delay.
The proxy model looks like this.
See the previous post for a description of the symbolic notation used.
Simulated Transmission Delay
Both proxies rely on the same script to simulate transmission delay.
This script encapsulates delay functionality and defines delay time in one place.
The delay time is one way trip time in seconds.
Set delay to 0 to disable simulated delay.
The following script can be used to test the delay simulation.
The following commands can be used to run the test delay script.
δ Web Server
Start a web server on 0.0.0.0:4000 or use the following single file JSON/HTTP date server.
γ Forward Proxy
The forward proxy looks like this.
Note that it patches the request header host field to match the host and port nc uses to connect.
The connection header is patched so that the browser will close the connection.
The scripts are not very smart.
They blindly hold ports open and expect files to be sent and received in the correct order.
β Reverse Proxy
The following script can be used to test the forward proxy one request at a time.
This script simulates delay.
This is the request file used by the single request script.
Note that the file needs to end with a double newline.
Run the single request script in the current shell to display an increasing request number with each request.
The reverse proxy accepts external connections in a loop with nc.
Received requests are sent to the forward proxy before waiting for a response.
This response is returned to the client.
This script assumes the request ends when it receives a blank line.
This will not work for POST or PUT requests.
Starting the Proxy Scripts
The scripts need to be started in the correct order.
α Web Browser
These proxies should serve web pages over ION-DTN.
The browser can handle modest delays, but will time out eventually.
curl will happily wait for a long time unless the –connect-timeout or –max-time options are passed to it.
If pages stop loading, the following can be used to restart the proxies in the correct order.
If a hello world test fails, ION needs to be restarted.