| 1 |
Things to do, in a slightly random order: |
| 2 |
|
| 3 |
* Error detection. |
| 4 |
|
| 5 |
Maybe HTTP over TCP isn't all that reliable? Especially |
| 6 |
considering that there's a proxy in the middle. |
| 7 |
|
| 8 |
Detect lost connections and reconnect. Checksum data. Retransmit |
| 9 |
lost data. Etc etc. |
| 10 |
|
| 11 |
This is a big project, but it would be nice to have a reliable |
| 12 |
transport layer (I THINK it's called "transport layer"). |
| 13 |
|
| 14 |
>> Actually, it seems reliable enough. |
| 15 |
|
| 16 |
* Actually use the #defines in config.h |
| 17 |
|
| 18 |
What good is autoconf if you don't use what it generates for you? |
| 19 |
|
| 20 |
>> Getting better. |
| 21 |
|
| 22 |
* Handling of TUNNEL_OPEN in the server. |
| 23 |
|
| 24 |
Come up with something useful to put in the auth_data section |
| 25 |
of a TUNNEL_OPEN request. |
| 26 |
|
| 27 |
* Adhere to Content-Length, even when doing a tunnel_close(). |
| 28 |
|
| 29 |
For now, Content-Length is adhered to strictly everywhere except |
| 30 |
in tunnel_close(). tunnel_close() could, optionally, send |
| 31 |
padding after the close request. |
| 32 |
|
| 33 |
>> Done, but it's not optional. Yet. Should it be? |
| 34 |
|
| 35 |
* Auto-detect proxy PUT/POST buffering. |
| 36 |
|
| 37 |
Idea: make a second HTTP GET request that will be used to send |
| 38 |
ACKs to the client when HTTP PUT/POST data arrives. If data is |
| 39 |
sent in a PUT/POST reqest and the ACK channel is silent, pad the |
| 40 |
PUT/POST data until ACK arrives. |
| 41 |
|
| 42 |
* Remove busy poll loops. |
| 43 |
|
| 44 |
I wrote then that way only because I wanted fast results. |
| 45 |
I didn't intend them to be that way forever. I promise! |
| 46 |
|
| 47 |
Instead, use select() or poll() with nice timeouts. |
| 48 |
|
| 49 |
>> Done for the server. Remaining: don't use blocking |
| 50 |
read()s, buffer data until a complete request is received. |
| 51 |
|
| 52 |
>> Done for the client. |
| 53 |
|
| 54 |
* Make client and server not fork? |
| 55 |
|
| 56 |
>> Done for the server. |
| 57 |
|
| 58 |
>> Done for the client. |
| 59 |
|
| 60 |
* Multiplex data channels in the tunnel. |
| 61 |
|
| 62 |
>> Perhaps in external programs. |
| 63 |
>> See Port forwarding. |
| 64 |
|
| 65 |
* Socket-to-device and device-to-socket gateways. |
| 66 |
|
| 67 |
>> External programs. |
| 68 |
>> See Port forwarding. |
| 69 |
|
| 70 |
* CGI-to-hts gateway. |
| 71 |
|
| 72 |
If the HTTP tunnel is to connect to an already existing HTTP |
| 73 |
server, there could be a CGI program relaying tunnel traffic |
| 74 |
to hts. |
| 75 |
|
| 76 |
* tunnel_write () always tries to write all the data, regardless of |
| 77 |
wheter O_NONLBOCK is set or not. |
| 78 |
|
| 79 |
Is this a problem? |
| 80 |
|
| 81 |
* Use zlib for compression. |
| 82 |
|
| 83 |
Note that padding can't be compressed. |
| 84 |
|
| 85 |
* Port forwarding. |
| 86 |
|
| 87 |
'htf --port 23 --destination my.site.org:23' waits for a connection |
| 88 |
on local port 23, and talks to htfmux using a small protocol. |
| 89 |
|
| 90 |
htfmux waits for connections and talks to htc trough a pseudo-tty. |
| 91 |
|
| 92 |
htfmux reads data from all its connections and multiplexes it over |
| 93 |
the tunnel. Yet another protocol for this. |
| 94 |
|
| 95 |
In the other end, hts talks to htdemux, which handles the other half |
| 96 |
of port forwarding. |
| 97 |
|
| 98 |
Why separate htf and hftmux? Because there is only one instance |
| 99 |
of hftmux running. To add or remove a new port forwarding, just |
| 100 |
run a new htf or kill an already running one. This could also |
| 101 |
be accomplished with hftmux re-reading a configuration file |
| 102 |
every time it gets a SIGHUP. |
| 103 |
|
| 104 |
Either way is possible. Implement one and see if someone hacks |
| 105 |
up something better. |
| 106 |
|
| 107 |
* Use 'Connection: keep-alive'. |
| 108 |
|
| 109 |
Keep the connection alive instead of closing it down efter every |
| 110 |
HTTP request. |
| 111 |
|
| 112 |
* Threading. |
| 113 |
|
| 114 |
Separate thread for device/port input and tunnel input. |
| 115 |
|
| 116 |
* --paranoid switch. |
| 117 |
|
| 118 |
Make the data look like HTML code! |
| 119 |
|
| 120 |
* protocol abstraction |
| 121 |
|
| 122 |
From: Raphael Manfredi <[email protected]> |
| 123 |
Date: Tue, 17 Aug 1999 16:36:43 +0200 |
| 124 |
|
| 125 |
Rename httptunnel as "xtptunnel" :-) |
| 126 |
|
| 127 |
Why limit yourself to http? Why not also allow ftptunnel? |
| 128 |
|
| 129 |
xts -t ftp .... <=> xtc -t ftp .... |
| 130 |
xtc -t http ... <=> xtc -t http .... |
| 131 |
|
| 132 |
If the "tunnel_*" routines are made "generic" in their signature, one could |
| 133 |
imagine to put them all in a stucture: |
| 134 |
|
| 135 |
struct xtp { |
| 136 |
/* open routine pointer */ |
| 137 |
/* read routine pointer */ |
| 138 |
/* write routine pointer */ |
| 139 |
/* close routine pointer */ |
| 140 |
} xtp; |
| 141 |
|
| 142 |
Then one would get one xtp "driving" structure per protocol type. The |
| 143 |
code would get much more modular, and extensible, and common code could |
| 144 |
get factored out, leaving only protocol-specific idiosyncracies in the |
| 145 |
driving routines. |
| 146 |
|
| 147 |
This kind of design looks like a filesystem stack: on top of it, VFS, a |
| 148 |
virtual file system, and underneath, specific "drivers" for low-level |
| 149 |
routines for UFS, NFS, CDFS, etc... |
| 150 |
|
| 151 |
The FTP proxy must allow PUT requests to go through for this to work on |
| 152 |
top of FTP, but it might be useful when an HTTP proxy filters http URLs |
| 153 |
(making it impossible to connect to the remote server at some *.dhis.org site, |
| 154 |
e.g.), and don't filter FTP ones. |