|
JHttpTunnel is the implementation of GNU httptunnel's
protocol in pure Java.
Why JHttpTunnel?
Our initial motivation for developing this stuff was to loose users from
the cage made of HTTP on mobile platform based on J2ME. We have
believed the protocol of GNU httptunnel may be a key for it. GNU httptunnel is
written and maintained by Lars Brinkhoff
and its web page says as follows,
httptunnel creates a bidirectional virtual data connection tunnelled in
HTTP requests. The HTTP requests can be sent via an HTTP proxy if so
desired.
This can be useful for users behind restrictive firewalls. If WWW access
is allowed through a HTTP proxy, it's possible to use httptunnel and, say,
telnet or PPP to connect to a computer outside the firewall.
The protocol of GNU httptunnel has been described in HACKING file included in its distribution archive.
Features
The current JHttpTunnel has the following features.
- JHttpTunnel implements GNU httptunnel's protocol.
The current implementation works with httptunnel 3.0.5.
- JHttpTunnel works on J2SE.
We have confirmed it wroks on J2SE 1.4.
- JHttpTunnel works on J2ME/CLDC/MIDP.
We have confirmed it wroks on the emulator included in Sun's Wireless Toolkit 2.2.
- JHttpTunnel works on J2ME/CLDC/DoJa.
It really works, but it is still immature.
- accessing via HTTP proxy.
We have confirmed Squid has allowed the communication.
- client side code.
- JHttpTunnel is licensed under BSD style license.
How To Use
Suppose your java program has following lines,
Socket socket=new Socket(host, port);
InputStream in=socket.getInputStream();
OutputStream out=socket.getOutputStream();
You can replace them with following lines,
JHttpTunnelClient jhtc=new JHttpTunnelClient(remote_host, remote_port);
//jhtc.setProxy(porxy_host, proxy_port);
jhtc.setInBound(new InBoundSocket());
jhtc.setOutBound(new OutBoundSocket());
jhtc.connect();
InputStream in=jhtc.getInputStream();
OutputStream out=jhtc.getOutputStream();
if you have already run 'hts' of GNU httptunnel on the host 'remote_host' with
following options,
hts -F host:port remote_port
Please refert to JHTC.java, which works
like 'htc' of GNU httptunnel and will be good example to learn how to use JHttpTunnel's API.
SSH Over HttpTunnel in Java
We have enjoyed SSH over HttpTunnel in pure Java by using JSch. Please refer to JSchOverJHttpTunnel.java as an example.
JHttpTunnel for J2ME/CLDC/MIDP
We have confirmed that current version works on J2ME/CLDC/MIDP
environment included in Sun's Wireless Toolkit 2.2.
Use 'com.jcraft.jhttptunnel.InBoundConnection' and
'com.jcraft.jhttptunnel.OutBoundConnection' and then apply the patch
'misc/httptunnel-3.0.5-0.0.3.patch' for GNU HttpTunnel 3.0.5. At present, we have following examples.
- We have succeeded SSH2 remote execution over HttpTunnel
on Wireless Toolkit's emulator.
The source code, jar and jad files for this example is available
at http://j2me.jsch.org/. Befor running this program, you have to run 'hts -F sshdserver:22 8888' on the remote host.
- We have applied our hack to J2MEVNC and it seems it works on the emulator. Here are patch, jad and jar files. Befor running this program, you have to run 'hts -F vncserver:590X 8888' on the remote host.
JHttpTunnel for J2ME/CLDC/DoJa

DoJa is an yet another J2ME/CLDC profile and widely used in Japan.
We have confirmed that JHttpTunnel can establish bi-directional streams
from F900iC to the remote. It is still immature, but if you are interested in this hack, please refer to 'JHttpTunnel for J2ME/CLDC/DoJa' section in README.
Download
TODO
- server side code.
- HTTP-keepalive support on client and server.
Credits and Acknowledgements
- JHttpTunnel is the implementation of GNU httptunnel's protocol.
Without GNU httptunnel developed by Lars Brinkhoff, we had not started this hack.
Comments/suggestions are accepted at
jhttptunnel@jcraft.com.
``SSH is a registered trademark and Secure
Shell is a trademark of SSH Communications Security Corp
(www.ssh.com)''.
|