File: README

package info (click to toggle)
camlrpc 0.4.1-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,080 kB
  • ctags: 1,474
  • sloc: ml: 11,901; makefile: 592; sh: 345; ansic: 331
file content (52 lines) | stat: -rw-r--r-- 2,251 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
http_tunnel:

This example demonstrates the HTTP tunnel. This tunnel encapsulates
RPC messages as HTTP messages. On the client side, you only need to
install a special connector provided by the module
Rpc_over_http_client (see source client.ml for an example). Note
that the RPC calls MUST be asynchronous (because the module
Rpc_over_http_client does not know when to close the internal HTTP
gateway). 

On the server side, a web server is needed. The HTTP request is
delivered to a normal CGI program, and the CGI decodes the request
and forwards the contained RPC call to the RPC server. The reply
is again encapsulated as HTTP message and sent back. The CGI
is implemented in the module Rpc_over_http_cgiforwarder (see
cgifwd.ml for an example).

After compiling this example, there are three executables:

 - client                  The RPC client
 - cgifwd.cgi              The CGI forwarder to the server
 - server                  The RPC server

You need a web server to run this example. Make sure that you have
a directory <CGIBIN> where you can execute CGIs. Put cgifwd.cgi into
this directory (or make a symlink - check that the web server allows
symlinks in CGI directories!). Let <CGIPATH> the URL path that
accesses the <CGIBIN> directory, i.e. the URL
http://hostname/<CGIPATH>/cgifwd.cgi calls cgifwd.cgi. Check this
by entering the URL into a web browser. If you see the greeting
message "This is cgifwd.cgi!" everything works fine.

Now edit client.ml and change the variable "uri" right at the 
beginning to "http://hostname/<CGIPATH>/cgifwd.cgi". Recompile
the client (make client).

Make sure that the portmapper daemon runs: rpcinfo -p localhost
outputs a table of available RPC services. Start the server:
./server &   The server will appear in the table of RPC services
(program 536871203 version 1 at an arbitrary port).

Now the RPC service will be tunneled over HTTP and routed to this
program: 
./client 56
Result: 57
The RPC service adds 1 to the passed number.

You can install the server on another system, and it is still reachable
even behind a firewall. You can set the proxy to use by the
environment variable http_proxy, e.g.
http_proxy=http://proxy.sub.net:8080
Note that the variable no_proxy is honoured, too.