[nycphp-talk] persnickety problem while (reverse) proxying JPSpan (AJAX library)
Greg Rundlett
greg.rundlett at gmail.com
Tue Aug 2 16:13:57 EDT 2005
I'm wondering if anyone has insight into this problem....
I have JPSpan setup to run (within a Horde installation), and reverse
proxied through another server (giving external users access to the
application by way of the proxy server). When I am not using the
proxy, a simple "HelloWorld" test succeeds. However, when the proxy
is used, I get the following error:
Server_Error: syntax error
The client was helloworld calling sayhello
The response was
new Function("var t1 = \'Hello Greg\';return t1;");
The strange part is that the response is perfectly valid JS code, and
can be eval'd in the JavaScript console just fine. I am under the
impression, and you can verify for me, that this is what JPSpanServer
is supposed to return. I was unsure about where the escaped single
quotes were coming from, and so I turned off magic_quotes_gpc on the
proxy server and restarted, but that had no effect. It is entirely
possible that the magic_quotes are introduced somewhere in the Horde
Framework, but seems irrelevant since the server response is valid JS
code even when the single quotes are escaped. I'm still confused why
this is getting reported as a syntax error.
Is there a method in PostOffice that I could use to inspect the return
response of a successful sayhello call? -- simply to compare it with
the error version?
I have been running through the examples to note any change in
behavior between the straight version, and the proxied version. I
discovered another bizarre issue: The
/lib/jpspan/examples/testclient.php works fine when requested
directly, but when proxied, the closing tags of some of the xml.js
content are missing.
For example, the '</r>' in line 782 of http://pastebin.com/327779 or
in more detail: the attached diff compares the output of
testclient.php (normal) and testclient.php (proxied). NOTE that this
case does not involve Horde in any way, so it certainly isn't due to
namespace collisions.
I have reviewed my mod_proxy_html rules, and there is nothing that
resembles the transformation taking place; leaving me with absolutely
no explanation.
proxy rules (real name was changed to 'appAliasFoo' to protect the innocent :-)
ProxyHTMLURLMap / /appAliasFoo/ c
ProxyHTMLURLMap /appAliasFoo /appAliasFoo c
# This handles the ab theme graphics
ProxyHTMLURLMap '= \'/autobuilder/' '= \'/appAliasFoo/autobuilder/' Rh
# A rewrite rule that ignores links, and targets js
ProxyHTMLURLMap '= \'/themes/graphics/([^./]+)\.png' '=
\'/appAliasFoo/themes/graphics/$1.png' R
# A rewrite rule that tries to take care of the dynamically
generated js of the treemenu
# This rule does not impact the embedded js loaded by
javascript.php, so a hack was put into tree.js
#ProxyHTMLURLMap '/themes/graphics/tree/([^.]+)\.png'
'/appAliasFoo/themes/graphics/tree/$1.png' R
# The following rule interferred with administration.png when
the trailing / was left out
ProxyHTMLURLMap /admin/ /appAliasFoo/admin/ h
ProxyHTMLURLMap /services/ /appAliasFoo/services/ h
ProxyHTMLURLMap /login.php /appAliasFoo/login.php h
I don't know that there is any bug in JPSpan, but I'm at my wits end
in trying to figure out what is causing this not to work.
Thanks for your help.
testclient.php.diff
1,5c1
< <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
< <html>
< <head>
< <title> HttpClient Test Page </title>
< <style type="text/css">
---
> <html><head><title> HttpClient Test Page </title><style type="text/css">
84,85c80
< </style>
< <script type="text/javascript">
---
> </style><script type="text/javascript">
782c777
< return '<?xml version="1.0"
encoding="UTF-8"?><r>'+this.Serialize.serialize(data)+'</r>';
---
> return '<?xml version="1.0" encoding="UTF-8"?><r>'+this.Serialize.serialize(data)+'';
795c790
< return '<s>'+v.replace(/&/g, '&').replace(/</g, '<')+'</s>';
---
> return '<s>'+v.replace(/&/g, '&').replace(/, '<')+'';
816c811
< a += '<e k="'+i+'">'+Serializer.serialize(v[i])+'</e>';
---
> a += '<e k="'+i+'">'+Serializer.serialize(v[i])+'';
824c819
< a += '<e k="'+prop+'">'+Serializer.serialize(v[prop])+'</e>';
---
> a += '<e k="'+prop+'">'+Serializer.serialize(v[prop])+'';
826c821
< return '<a>'+a+'</a>';
---
> return '<a>'+a+'';
832c827
< o += '<e k="'+prop+'">'+Serializer.serialize(v[prop])+'</e>';
---
> o += '<e k="'+prop+'">'+Serializer.serialize(v[prop])+'';
834c829
< return '<o c="'+cname.toLowerCase()+'">'+o+'</o>';
---
> return '<o c="'+cname.toLowerCase()+'">'+o+'';
1054,1055c1049,1050
< var serverUrl =
"http://ab.dev.savaje.com/autobuilder/lib/jpspan/examples/printrresponse.php";
< var requestUrl =
"http://ab.dev.savaje.com/autobuilder/lib/jpspan/examples/printrresponse.php?rencoding=xml";
---
> var serverUrl = "/ab-dev/autobuilder/lib/jpspan/examples/printrresponse.php";
> var requestUrl = "/ab-dev/autobuilder/lib/jpspan/examples/printrresponse.php?rencoding=xml";
1131c1126
< echo("<pre>"+var_dump(result)+"</pre>");
---
> echo("<pre>"+var_dump(result)+"");
1143c1138
< echo("<pre>"+var_dump(result)+"</pre>");
---
> echo("<pre>"+var_dump(result)+"");
1165c1160
< echo('<pre>'+c.call(r)+'</pre>');
---
> echo('<pre>'+c.call(r)+'');
1180c1175
< echo('<pre>'+c.call(r)+'</pre>');
---
> echo('<pre>'+c.call(r)+'');
1195c1190
< echo('<pre>'+c.call(r)+'</pre>');
---
> echo('<pre>'+c.call(r)+'');
1314,1317c1309
< </script>
< </head>
< <body>
< <div id="Header">
---
> </script></head><body><div id="Header">
1319,1321c1311
< </div>
< <div id="Content">
<
---
> </div><div id="Content">
1325,1326c1315
< </div>
< <div id="Menu">
---
> </div><div id="Menu">
1328,1329d1316
< <form>
< <acronym title="Encoding for request">Encoding</acronym>: <select
onChange="setREncoding(this.options[selectedIndex].value);"><option>xml</option><option>php</option></select>
1330a1318,1319
> <form>
> <acronym title="Encoding for request">Encoding</acronym>: <select onchange="setREncoding(this.options[selectedIndex].value);"><option>xml</option><option>php</option></select>
1337a1327
>
1342d1331
<
1348a1338
>
1352d1341
<
1359a1349
>
1363,1366c1353
<
< </div>
< </body>
< </html>
\ No newline at end of file
---
> </div></body></html>
\ No newline at end of file
--
Greg Rundlett
Release Engineering Team
SavaJe Technologies
(978) 259-2029
[random sig fortune]
Our informal mission is to improve the love life of operators worldwide.
-- Peter Behrendt, president of Exabyte
More information about the talk
mailing list