i may have found the problem in LFCdhtml.js.
it has code to check if the request is a POST and doesn't have "content-type" 
header set:

===
if (method_$0 == "POST" && headers_$2["content-type"] == null) {
headers_$2["content-type"] = "application/x-www-form-urlencoded"
};
===

however, my code is setting "Content-Type" header:

===
                        setHeader('Content-Type', 
'application/x-www-form-urlencoded; charset=UTF-8');
===

my server sees the two HTTP headers and is combining them most likely.

the bug is that LFCdhtml.js is not treating HTTP header field name as 
case-insensitive:

  http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html

my patch consists of lower-casing the setHeader implementation in LFCdhtml.js:

===
--- LFCdhtml.js 2010-10-22 08:21:57.000000000 -0700
+++ LFCdhtml-new.js     2012-02-28 18:01:23.000000000 -0800
@@ -6494,7 +6494,7 @@
 }},"setHeader",function($0,$1){
 if(!this.headers){
 this.headers=new (lz.Param)()
-};this.headers.setValue($0,$1)
+};this.headers.setValue($0.toLowerCase(),$1)
 },"getRequestHeaderParams",function(){
 return this.headers
 },"clearRequestHeaderParams",function(){
===

i will be filling a bug on this issue.

thanks,
augusto.

On Feb 28, 2012, at 5:21 PM, augusto callejas wrote:

> hi-
> 
> i have code below that performs a POST request, where i'm setting the 
> Content-Type HTTP header.
> 
> ===
>        <dataset name="stopWS" querytype="POST" type="http" 
> datafromchild="true" proxied="false" queuerequests="true">
>                <method name="doRequest">
>                        setHeader('Content-Type', 
> 'application/x-www-form-urlencoded; charset=UTF-8');
>                        super.doRequest();
>                </method>
>        </dataset>
> ===
> 
> ===
>                                        stopWS.setAttribute('src', 
> '/api/stop');
>                                        stopWS.doRequest();
> ===
> 
> i'm seeing two different values in the HTTP request header Content-Type on 
> the server, depending on the version of the client:
> 
> swf8: application/x-www-form-urlencoded; charset=UTF-8
> html5: application/x-www-form-urlencoded; charset=UTF-8 
> application/x-www-form-urlencoded
> 
> the html5 version of my app is appending "application/x-www-form-urlencoded" 
> to the Content-Type header.
> this appears to be a bug, correct?
> 
> thanks,
> augusto.
> 
> ps: i'm running openlaszlo 4.9 in proxied mode.

Reply via email to