----- Original Message -----
From: "Dan Steinman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 17, 2002 2:54 PM
Subject: Re: [Dynapi-Dev] IOElement - POST & GET calls added


<SNIP>

> We could also distribute some prebuilt server scripts (PHP and ASP) for
>examples.  Like one for retreiving the contents of a URL (from another
>server) as a >JavaScript variable.  We could also encapsulate an http
>post/get call into a server script, so that you can post to another server,
>and recieve the results from that >server as a JavaScript variable also.
>This functionality would allow you to avoid the security violation of
>obtaining data from a different server through JavaScript.
>

FYI, A while back I knocked up a PERL piece for proxying remote XMLHttp POST
calls via localdomain
to avoid those darn security restrictions involved when using Moz/MSIE5+'s
XMLHttp components via script.
I am going to bundle this with my own Soya API further on as an add-on for
the XML-RPC client class,
but if anyone else might have use for it /borrow ideas from it, you are
welcome..

http://www.saltstorm.net/downloads/rpcproxy/rpcproxy-1.55.zip
I am not a PERL guru, so improvments/suggestions etc. are welcome.


Currently the script is written for xml-rpc transactions, but it could be
modified to deliver
text/html / application/x-javascript pretty easily. I intend to re-write it
as a module
further on and bring in some decent OO and a serializer method, so that you
could specify
how the response should be presented to the requesting client.
html/xml/js/as-is etc.
That way anyone could adopt it the way they want.
Ideally when this script has matured into a module, such thing could be
shared
as a middleware used for remote HTTP ops among our APIs

There are a couple o goodies baked in such as on-the-fly gzip compression
of the response and 99% compliant NCSA trafficlogging. (a.k.a Apache style)

Further, I implemented restrictions of what remote URLs that can be proxied,
to avoid a malicious user from using the script as an anonymous proxy.

Requests headers are proxied as-is both ways except for the gzip related
ones,
client -> remote server & remote server -> client.

A real-life example transaction:
B = browser
R = rpcproxy at localdomain
S = remote HTTP server

 [B] xmlhttp POST req, Content-length : 92 bytes ...>
   |
 [R] routed as-is ... >
   |
 [S] responds to POST, Content-length : 64920 bytes ...>
   |
 [R] gzips incoming data 64920->4993 bytes ...>
   |
 [B] client automatically gunzips and parses xml-data.

If logging is turned on, the example would end up logged as.
www.local.tld - - [04/sep/2001:13:18:08 +0200] "POST
http://www.oreillynet.com/meerkat/xml-rpc/server.php";
200 92/64920->4993
"http://www.local.tld/lib-soya/examples/XML.RPCClient.html#12256";
"Soya/1.0.0-b2"

programatically this would be achieved with :
# var sRPCService = 'http://www.oreillynet.com/meerkat/xml-rpc/server.php';
# var sRPCProxy = 'http://www.local.tld/cgi-bin/rpcproxy.cgi';
#
# var oXMLHTTP = (typeof ActiveXObject != 'undefined') ?
#  new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest();
#
# oXMLHTTP.open('POST', sRPCProxy, false);
# oXMLHTTP.setRequestHeader('X-Proxy-Request', sRPCService);
# oXMLHTTP.setRequestHeader('X-Compress-Response', 'gzip');
# oXMLHTTP.send([object XMLDomDocument]);
#
# var oXMLDOM = oXMLHTTP.responseXML;
# // ... do stuff with incoming oXMLDOM ...

I have an example of rpcproxy being used in a real-life situation, but
I am in the works of re-organizing my site, so you cant get to it right now.
However, another example of accessing meerkat via rpcproxy is
available here: http://www.vcdn.org/Public/XMLRPC/meerkat.php


regards,
Thomas.
___________________________________________________
 [EMAIL PROTECTED]  ������������������������������������
 http://www.jet.st | http://www.saltstorm.net
________________________________S_a_l_t_s_t_o_r_m____



_________________________________________s_p_r_a_y_
H�r b�rjar Internet!
Skaffa gratis e-mail och gratis Internet p� http://www.spray.se

Nu kan du lagra dina filer och dokument p� n�tet. http://www.spray.se/sprayspace


_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[email protected]/

Reply via email to