[Laszlo-checkins] r10215 - in openlaszlo/branches/4.1: . WEB-INF/lps/lfc/data WEB-INF/lps/lfc/kernel/swf test/lfc/data
max@openlaszlo.org
max at openlaszlo.org
Thu Jul 3 17:11:00 PDT 2008
Author: max
Date: 2008-07-03 17:10:58 -0700 (Thu, 03 Jul 2008)
New Revision: 10215
Added:
openlaszlo/branches/4.1/test/lfc/data/echobody.jsp
Modified:
openlaszlo/branches/4.1/
openlaszlo/branches/4.1/WEB-INF/lps/lfc/data/LzDataset.lzs
openlaszlo/branches/4.1/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs
openlaszlo/branches/4.1/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
openlaszlo/branches/4.1/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as
openlaszlo/branches/4.1/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs
openlaszlo/branches/4.1/test/lfc/data/alldata.lzx
openlaszlo/branches/4.1/test/lfc/data/testgetmethod.lzx
openlaszlo/branches/4.1/test/lfc/data/testgetmethodsolo.lzx
openlaszlo/branches/4.1/test/lfc/data/testpostmethod.lzx
openlaszlo/branches/4.1/test/lfc/data/testpostmethodsolo.lzx
openlaszlo/branches/4.1/test/lfc/data/testsetheaders-solo.lzx
Log:
Merged revisions 10211 via svnmerge from
http://svn.openlaszlo.org/openlaszlo/trunk
.......
r10211 | hqm | 2008-07-03 16:53:23 -0700 (Thu, 03 Jul 2008) | 43 lines
Change 20080703-hqm-j by hqm at badtzmaru.home on 2008-07-03 13:15:44 EDT
in /Users/hqm/openlaszlo/trunk4
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: fix for SOLO POST bug
New Features:
Bugs Fixed: LPP-6586
Technical Reviewer: max
QA Reviewer: pbr
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
+ The code in LZHTTPDataProvider was sending all POST data through
LZHTTPLoader API, but SWF8 cannot really post raw data in SOLO mode,
it treats it like XML and will escape '&' and '<' chars.
Fix is to add a flag, "hasquerydata", that is set as an option of the LzHTTPLoader,
to give it a hint as to how to POST the data. If it is query data, send it using the
Flash LoadVars.sendAndLoad API. If it is "raw", send it using the XML.sendAndLoad (which
is better than nothing).
+ fixed regression test to more carefully look at echoed data from server
+ fixed regression where SWF media loads are always proxied, regardless of canvas.proxied setting
Tests:
test/lfc/data/alldata.lzx (swf, dhtml)
calendar (solo,proxied)
amazon (solo swf,proxied)
+ use "net" debug tab in Firebug to make sure SOLO image loads are not proxied via server
.......
Property changes on: openlaszlo/branches/4.1
___________________________________________________________________
Name: svnmerge-integrated
- /openlaszlo/branches/devildog:1-8432 /openlaszlo/branches/pagan-deities:1-7955,8825 /openlaszlo/branches/paperpie:1-6504,6506-6574,6576-7135,7137-7235 /openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497,6509,6661,7097,7872 /openlaszlo/trunk:1-10153,10183,10209-10210
+ /openlaszlo/branches/devildog:1-8432 /openlaszlo/branches/pagan-deities:1-7955,8825 /openlaszlo/branches/paperpie:1-6504,6506-6574,6576-7135,7137-7235 /openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497,6509,6661,7097,7872 /openlaszlo/trunk:1-10153,10183,10209-10211
Modified: openlaszlo/branches/4.1/WEB-INF/lps/lfc/data/LzDataset.lzs
===================================================================
--- openlaszlo/branches/4.1/WEB-INF/lps/lfc/data/LzDataset.lzs 2008-07-04 00:10:18 UTC (rev 10214)
+++ openlaszlo/branches/4.1/WEB-INF/lps/lfc/data/LzDataset.lzs 2008-07-04 00:10:58 UTC (rev 10215)
@@ -742,8 +742,9 @@
// the DataRequest.postbody field to the lzpostbody value.
//
if (this.querytype.toUpperCase() == "POST") {
- var lzpostbody = null;
+ var lzpostbody = this.postbody;
if (dreq.queryparams) {
+ // a "lzpostbody" arg overrides postbody, for back compatibility
lzpostbody = dreq.queryparams.getValue('lzpostbody');
}
// If there is a lzpostbody query arg, we are going to remove
@@ -757,7 +758,9 @@
//
if (lzpostbody != null) {
dreq.postbody = lzpostbody;
- dreq.queryparams.remove('lzpostbody');
+ if (dreq.queryparams && dreq.queryparams['lzpostbody']) {
+ dreq.queryparams.remove('lzpostbody');
+ }
}
}
Modified: openlaszlo/branches/4.1/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs
===================================================================
--- openlaszlo/branches/4.1/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs 2008-07-04 00:10:18 UTC (rev 10214)
+++ openlaszlo/branches/4.1/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs 2008-07-04 00:10:58 UTC (rev 10215)
@@ -148,6 +148,10 @@
var cachebreak = "__lzbc__="+(new Date()).getTime();
+ // Default assume we are posting query data (key-value pairs)
+ var hasquerydata = true;
+
+
var postbody = dreq.postbody;
if (postbody == null && qparams != null) {
var names = qparams.getNames();
@@ -158,8 +162,14 @@
}
postbody = q;
+ } else {
+ //We are asking the swf8 runtime to treat this as raw data, as best it can
+ hasquerydata = false;
}
+ tloader.setOption('hasquerydata', hasquerydata);
+
+
var lzurl = new LzURL(dreq.src);
// For GET requests, merge in params data with URL query
@@ -337,7 +347,6 @@
var postbody:String;
var proxied:Boolean;
var proxyurl:String;
-
var multirequest:Boolean = false;
var queuerequests:Boolean = false;
Modified: openlaszlo/branches/4.1/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
===================================================================
--- openlaszlo/branches/4.1/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as 2008-07-04 00:10:18 UTC (rev 10214)
+++ openlaszlo/branches/4.1/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as 2008-07-04 00:10:58 UTC (rev 10215)
@@ -132,6 +132,7 @@
var xmlrequestobj = new XML();
xmlrequestobj.cache = this.options.cacheable;
+ xmlrequestobj.hasquerydata = this.options.hasquerydata;
if (typeof(lzloader.timeout) != 'undefined') {
xmlrequestobj.timeout = lzloader.timeout;
Modified: openlaszlo/branches/4.1/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as
===================================================================
--- openlaszlo/branches/4.1/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as 2008-07-04 00:10:18 UTC (rev 10214)
+++ openlaszlo/branches/4.1/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as 2008-07-04 00:10:58 UTC (rev 10215)
@@ -418,8 +418,6 @@
}
-
-
/**
* @access private
*/
@@ -493,7 +491,6 @@
lvar[key] = pdata[key];
}
-
lvar.sendAndLoad(reqstr , loadobj, "POST" );
} else {
// SOLO request:
@@ -507,7 +504,13 @@
lvar.addRequestHeader(header, headers[header]);
}
var lzpostbody = loadobj.rawpostbody;
- if (lzpostbody != null) {
+ var hasquerydata = loadobj.hasquerydata; // boolean
+ if (lzpostbody != null && !hasquerydata) {
+ // This is supposed to be a "raw" data post. The best
+ // we can do is to use XML.sendAndLoad, with a Flash
+ // XML Text node as the data. This will still
+ // XML-escape it, but it's as close as we can get to POSTing
+ // raw data.
var xmlraw = new XML();
var tnode = xmlraw.createTextNode(lzpostbody);
xmlraw.appendChild(tnode);
@@ -516,6 +519,12 @@
}
xmlraw.sendAndLoad(reqstr, loadobj);
} else {
+ var content = loadobj.rawpostbody;
+ // Copy the postbody data onto the LoadVars, it will be POST'ed
+ var pdata = LzParam.parseQueryString(content);
+ for ( var key in pdata) {
+ lvar[key] = pdata[key];
+ }
lvar.sendAndLoad(reqstr , loadobj , "POST");
}
} else {
Modified: openlaszlo/branches/4.1/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs
===================================================================
--- openlaszlo/branches/4.1/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs 2008-07-04 00:10:18 UTC (rev 10214)
+++ openlaszlo/branches/4.1/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs 2008-07-04 00:10:58 UTC (rev 10215)
@@ -328,7 +328,11 @@
}
lmv.lzt = o.lzt;
- o.proxyurl = canvas.getProxyURL(o.url);
+ if (o.proxied) {
+ o.proxyurl = canvas.getProxyURL(o.url);
+ } else {
+ o.proxyurl = null;
+ }
if (typeof(o.proxied) != undefined && o.proxied != null) {
lmv.proxied = o.proxied;
@@ -357,6 +361,7 @@
LzLoader.debugLoadObj(o);
}
this.initializeRequestObj(o);
+
LzLoadQueue.enqueueRequest( o );
// We should probably be passing something other than the obj itself to
// the onrequest event
Modified: openlaszlo/branches/4.1/test/lfc/data/alldata.lzx
===================================================================
--- openlaszlo/branches/4.1/test/lfc/data/alldata.lzx 2008-07-04 00:10:18 UTC (rev 10214)
+++ openlaszlo/branches/4.1/test/lfc/data/alldata.lzx 2008-07-04 00:10:58 UTC (rev 10215)
@@ -26,8 +26,8 @@
<include href="testput.lzx"/>
<!-- <include href="testrawpost-solo.lzx"/> -->
<include href="testheaderresponse.lzx"/>
- <include href="testclientcachebreaker.lzx"/>
<include href="sendheaders.lzx"/>
+ <include href="testclientcachebreaker.lzx"/>
<TestSuite>
<TestDatanode/>
@@ -58,7 +58,6 @@
<TestClientCacheBreaker/>
-
</TestSuite>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
Copied: openlaszlo/branches/4.1/test/lfc/data/echobody.jsp (from rev 10211, openlaszlo/trunk/test/lfc/data/echobody.jsp)
Modified: openlaszlo/branches/4.1/test/lfc/data/testgetmethod.lzx
===================================================================
--- openlaszlo/branches/4.1/test/lfc/data/testgetmethod.lzx 2008-07-04 00:10:18 UTC (rev 10214)
+++ openlaszlo/branches/4.1/test/lfc/data/testgetmethod.lzx 2008-07-04 00:10:58 UTC (rev 10215)
@@ -47,9 +47,10 @@
<method name="doIt" args="dp">
<![CDATA[
- var resp = dp.xpathQuery( '/echo/data/text()');
- assertTrue( resp.indexOf("617-987-1234") > 0);
- assertTrue( resp.indexOf("67 Clyde Street") > 0);
+ var phone = dp.xpathQuery( '/echo/phone/text()');
+ assertEquals( "617-987-1234", phone );
+ var addr = dp.xpathQuery( '/echo/address/text()');
+ assertEquals( "67 Clyde Street", addr);
]]>
</method>
</class>
Modified: openlaszlo/branches/4.1/test/lfc/data/testgetmethodsolo.lzx
===================================================================
--- openlaszlo/branches/4.1/test/lfc/data/testgetmethodsolo.lzx 2008-07-04 00:10:18 UTC (rev 10214)
+++ openlaszlo/branches/4.1/test/lfc/data/testgetmethodsolo.lzx 2008-07-04 00:10:58 UTC (rev 10215)
@@ -1,7 +1,7 @@
<library>
<include href="lzunit/lzunit.lzx" />
- <dataset name="dsgetsolo_" src="http:echo.jsp"
+ <dataset name="dsgetsolo_" src="http:echobody.jsp"
getresponseheaders="true" proxied="false"
timeout="120000"/>
@@ -47,9 +47,13 @@
<method name="doIt" args="dp">
<![CDATA[
- var resp = dp.xpathQuery( '/echo/data/text()');
- assertTrue( resp.indexOf("617-987-1234") > 0);
- assertTrue( resp.indexOf("67 Clyde Street") > 0);
+ var phone = dp.xpathQuery( '/echo/phone/text()');
+ assertEquals( "617-987-1234", phone );
+ var addr = dp.xpathQuery( '/echo/address/text()');
+ assertEquals( "67 Clyde Street", addr);
+ var method = dp.xpathQuery( '/echo/method/@type');
+ assertEquals( "GET", method);
+
]]>
</method>
</class>
Modified: openlaszlo/branches/4.1/test/lfc/data/testpostmethod.lzx
===================================================================
--- openlaszlo/branches/4.1/test/lfc/data/testpostmethod.lzx 2008-07-04 00:10:18 UTC (rev 10214)
+++ openlaszlo/branches/4.1/test/lfc/data/testpostmethod.lzx 2008-07-04 00:10:58 UTC (rev 10215)
@@ -1,7 +1,7 @@
<library>
<include href="lzunit/lzunit.lzx" />
- <dataset name="dsget_post_prox" src="http:echo.jsp"
+ <dataset name="dsget_post_prox" src="http:echobody.jsp"
getresponseheaders="true" proxied="false"
timeout="120000"/>
@@ -21,7 +21,7 @@
<method name="sendit">
dsget_post_prox.setQueryParam("address", "67 Clyde Street");
dsget_post_prox.setQueryParam("phone", "617-987-1234");
- dsget_post_prox.setQueryType("GET");
+ dsget_post_prox.setQueryType("POST");
dsget_post_prox.doRequest();
</method>
@@ -47,9 +47,13 @@
<method name="doIt" args="dp">
<![CDATA[
- var resp = dp.xpathQuery( '/echo/data/text()');
- assertTrue( resp.indexOf("617-987-1234") > 0);
- assertTrue( resp.indexOf("67 Clyde Street") > 0);
+ var phone = dp.xpathQuery( '/echo/phone/text()');
+ assertEquals( "617-987-1234", phone );
+ var addr = dp.xpathQuery( '/echo/address/text()');
+ assertEquals( "67 Clyde Street", addr);
+
+ var method = dp.xpathQuery( '/echo/method/@type');
+ assertEquals( "POST", method);
]]>
</method>
</class>
Modified: openlaszlo/branches/4.1/test/lfc/data/testpostmethodsolo.lzx
===================================================================
--- openlaszlo/branches/4.1/test/lfc/data/testpostmethodsolo.lzx 2008-07-04 00:10:18 UTC (rev 10214)
+++ openlaszlo/branches/4.1/test/lfc/data/testpostmethodsolo.lzx 2008-07-04 00:10:58 UTC (rev 10215)
@@ -1,7 +1,7 @@
<library>
<include href="lzunit/lzunit.lzx" />
- <dataset name="dsget_post_solo" src="http:echo.jsp"
+ <dataset name="dsget_post_solo" src="http:echobody.jsp"
getresponseheaders="true" proxied="false"
timeout="120000"/>
@@ -21,7 +21,7 @@
<method name="sendit">
dsget_post_solo.setQueryParam("address", "67 Clyde Street");
dsget_post_solo.setQueryParam("phone", "617-987-1234");
- dsget_post_solo.setQueryType("GET");
+ dsget_post_solo.setQueryType("POST");
dsget_post_solo.doRequest();
</method>
@@ -47,9 +47,12 @@
<method name="doIt" args="dp">
<![CDATA[
- var resp = dp.xpathQuery( '/echo/data/text()');
- assertTrue( resp.indexOf("617-987-1234") > 0);
- assertTrue( resp.indexOf("67 Clyde Street") > 0);
+ var phone = dp.xpathQuery( '/echo/phone/text()');
+ assertEquals( "617-987-1234", phone );
+ var addr = dp.xpathQuery( '/echo/address/text()');
+ assertEquals( "67 Clyde Street", addr);
+ var method = dp.xpathQuery( '/echo/method/@type');
+ assertEquals( "POST", method);
]]>
</method>
</class>
Modified: openlaszlo/branches/4.1/test/lfc/data/testsetheaders-solo.lzx
===================================================================
--- openlaszlo/branches/4.1/test/lfc/data/testsetheaders-solo.lzx 2008-07-04 00:10:18 UTC (rev 10214)
+++ openlaszlo/branches/4.1/test/lfc/data/testsetheaders-solo.lzx 2008-07-04 00:10:58 UTC (rev 10215)
@@ -20,11 +20,12 @@
<method name="sendit">
Debug.write("testsetheaders.lzx sending edata_solo");
+ edata_solo.setQueryParam("flash", "has some bugs");
+ edata_solo.setQueryType("POST");
+
edata_solo.setHeader("content-type", "pink-elephants/xml");
edata_solo.setHeader("my-personal-header", "vanilla/with-chocolate-syrup");
edata_solo.setHeader("my-other-personal-header", "milk chocolate with almonds");
- edata_solo.setQueryParam("flash", "has some bugs");
- edata_solo.setQueryType("POST");
edata_solo.doRequest();
</method>
More information about the Laszlo-checkins
mailing list