<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>3565</bug_id>
          
          <creation_ts>2005-06-16 05:25:16 -0700</creation_ts>
          <short_desc>Posting data via XMLHttpRequest doesn&apos;t work (wrong Content-Type)</short_desc>
          <delta_ts>2005-12-26 14:08:32 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>412</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ondra Nekola">ondra</reporter>
          <assigned_to name="Maciej Stachowiak">mjs</assigned_to>
          <cc>ap</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>12232</commentid>
    <comment_count>0</comment_count>
    <who name="Ondra Nekola">ondra</who>
    <bug_when>2005-06-16 05:25:16 -0700</bug_when>
    <thetext>I have s small XML HTTP Request based webapp. It works fine in all major
browsers with exception of Safari.
When I go to the particular Webpage I get the &quot;There was a problem retrieving
the XML data: undefined&quot; error message. On the server side (several servers with
different versions of Jakarta Tomcat servlet container) I can read no data from
the request.

The key function is this one:
function sendRequest(url, data, reqHolder){
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        req = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);
    }
    req.onreadystatechange = reqHolder.processRequest;
    req.open(&quot;POST&quot;, url, true);
    reqHolder.setReq(req);
    //req.setRequestHeader(&apos;If-Modified-Since&apos;, &apos;Wed, 15 Nov 1995 00:00:00 GMT&apos;);
    sent = req.send(data);
    return req;
}

reqHolders look like this:

function Baz(someData){
	var req
	var toProcess = someData
	
	this.setReq = function (aReq) {
		req = aReq;
	}
	this.getReq = function () { 
		return req;
	}
	
	.....

	this.toXmlRequest = function() {
		result = &quot;&lt;foo&gt;\n&quot;
		for (i in toProcess) {
			result += &quot;&lt;bar&gt;&quot;+i+&quot;&lt;/bar&gt;\n&quot;
		}
		result += &quot;&lt;/foo&gt;&quot;
		return result
	}
	
	
	this.processRequest = function () {
		if (req &amp;&amp; req.readyState == 4) {
        	if (req.status == 200) {
	
       			elements = req.responseXML.getElementsByTagName(&quot;blah&quot;)
       			for (q = 0; q &lt; elements.length; q++) {
                          ....
                        }
        	}
	}

	...

}

Tested in Safari 1.2.4 (v125.12) and 2.0 (412)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12964</commentid>
    <comment_count>1</comment_count>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2005-06-23 10:23:25 -0700</bug_when>
    <thetext>reporter, please make a testcase, to ease confirming and testing bugfixes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13479</commentid>
    <comment_count>2</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2005-06-29 01:57:22 -0700</bug_when>
    <thetext>We need steps to reproduce that we can actually follow, in order to make progress on this bug. Either a 
site where we can try specific steps that fail, or a standalone test case (could use a tool like tcpflow to see 
if the POST data is sent or not, or a trivial PHP script or the like could be used to view the post data).
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14365</commentid>
    <comment_count>3</comment_count>
    <who name="Ondra Nekola">ondra</who>
    <bug_when>2005-07-11 04:41:55 -0700</bug_when>
    <thetext>Sorry, I was on holiday, so I was not able to make the testcase. The short
testcase look like this:

File bug.html:
&lt;html&gt;
&lt;head&gt;&lt;/head&gt;
&lt;body&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function write(aText) {
	alert (aText)
}

function sendRequest(url, data, reqHolder){
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest()
    } else if (window.ActiveXObject) {
        req = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;)
    }
    req.onreadystatechange = reqHolder.processRequest
    req.open(&quot;POST&quot;, url, true)
    reqHolder.setReq(req)
    //req.setRequestHeader(&apos;If-Modified-Since&apos;, &apos;Wed, 15 Nov 1995 00:00:00 GMT&apos;);
    sent = req.send(data)
    return req
}

function Baz(someData){
	var req
	var toProcess = someData
	
	this.setReq = function (aReq) {
		req = aReq
	}
	this.getReq = function () { 
		return req
	}
	
	this.toXmlRequest = function() {
		result = &apos;&lt;?xml version=&quot;1.0&quot;?&gt;\n&apos;
		result += &quot;&lt;foo&gt;\n&quot;
		for (i in toProcess) {
			result += &quot;&lt;bar&gt;&quot;+i+&quot;&lt;/bar&gt;\n&quot;
		}
		result += &quot;&lt;/foo&gt;&quot;
		write(&quot;I will send: &quot; + result)
		return result
	}
	
	this.processRequest = function () {
		if (req &amp;&amp; req.readyState == 4) {
        	if (req.status == 200) {
        		elements = req.responseXML.getElementsByTagName(&quot;bar&quot;)
        		write (&quot;Received: &quot; + elements.length + &quot; bar elements&quot;)
        	}
        }
	}
}

aReqHolder = new Baz([&quot;1&quot;, &quot;2&quot;, &quot;three&quot;, 4])
sendRequest(&quot;http://myserver:8080/servlet/Echo&quot;, aReqHolder.toXmlRequest(),
aReqHolder)
&lt;/script&gt;

&lt;/body&gt;

You can run it against any http echo server. I can&apos;t make any public for you :(
If you want to create a new one as a java servlet, you can use something like this:
/*
 * XmlrpcServlet.java
 *
 * Created on 8. &amp;#65533;&amp;#65533;jen 2002, 11:35
 */

package gdjweb.servlet;

import gdjweb.core.Core;

import java.io.IOException;
import java.io.InputStream;
import java.io.Writer;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.misuzilla.text.Punycode;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;

import domains.Domain;
import domains.DomainStatus;

public class EchoServlet extends HttpServlet {

    private static final Log log = LogFactory.getLog(EchoServlet.class);

    ServletContext           app;
    boolean                  initialised;
    Core                     core;

    /** Initializes the servlet.
     */
    @Override
    public void init(ServletConfig config) throws ServletException {
        super.init(config);
        app = config.getServletContext();
    }


    /** Processes requests for both HTTP &lt;code&gt;GET&lt;/code&gt; and &lt;code&gt;POST&lt;/code&gt;
methods.
     * @param request servlet request
     * @param response servlet response
     * @throws IOException 
     */
    protected void processRequest(HttpServletRequest request,
HttpServletResponse response) {

        response.setHeader(&quot;Pragma&quot;, &quot;no-cache&quot;);
        response.setContentType(&quot;text/xml&quot;);

        try {
            InputStream is = request.getInputStream();
            Writer w = response.getWriter();
            int aByte;
            while ((aByte = is.read()) &gt;=0) {
                w.write(aByte);
                System.out.write(aByte);
            }
            System.out.println();
            System.out.flush();
            w.flush();
        }
        catch (Throwable e) {
            log.error(&quot;Chyba: &quot; + e, e);
        }
    }

    /** Handles the HTTP &lt;code&gt;GET&lt;/code&gt; method.
     * @param request servlet request
     * @param response servlet response
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, java.io.IOException {
        processRequest(request, response);
    }

    /** Handles the HTTP &lt;code&gt;POST&lt;/code&gt; method.
     * @param request servlet request
     * @param response servlet response
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, java.io.IOException {
        processRequest(request, response);
    }

    /** Returns a short description of the servlet.
     */
    @Override
    public String getServletInfo() {
        return &quot;Echo&quot;;
    }

}

-------------------------------------------
Testing:
In other browsers (Fire Fox for example) I will see the message &quot;I will send:
&lt;....&gt;&quot;
In the log of the server I see the received xml and then a new browser message
appears, that tells, that 4 bar elements were received.
In Safari no data come to server.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23075</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2005-10-27 13:24:15 -0700</bug_when>
    <thetext>This test case works for me in both Safari 2.0.1/10.4.2 and ToT. Here is the captured traffic for ToT 
(2.0.1 is similar, but includes a weird If-Modified-Since header):

POST / HTTP/1.1
Accept: */*
Accept-Language: ru-ru
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; ru-ru) AppleWebKit/420+ (KHTML, like Gecko) 
Safari/412.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 86
Connection: keep-alive
Host: server.com

&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;foo&gt;
&lt;bar&gt;0&lt;/bar&gt;
&lt;bar&gt;1&lt;/bar&gt;
&lt;bar&gt;2&lt;/bar&gt;
&lt;bar&gt;3&lt;/bar&gt;
&lt;/foo&gt;
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23510</commentid>
    <comment_count>5</comment_count>
    <who name="Sulka Haro">sulka</who>
    <bug_when>2005-11-02 00:33:25 -0800</bug_when>
    <thetext>Hi! I can confirm the bug exists, and here&apos;s data on what&apos;s wrong with Safari&apos;s behavior.

Safari has two bugs related to this:

1) The Content-Type of the request is currently set to &quot;application/x-www-form-urlencoded&quot;. All other 
browsers set it to &quot;text/xml&quot;. This causes the parsing behavior of Safari&apos;s POST to be quite different 
from other browsers.

2) The end of line character Safari uses is different from other browsers so parsing for the POST 
parameters fails.

For a discussion about this, see http://jira.atlassian.com/browse/JRA-8354

Please up the priority on this, if the blog post about better AJAX support was indeed true, this is one of 
the biggest blockers in that regard.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23518</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2005-11-02 03:19:14 -0800</bug_when>
    <thetext>Confirming the Content-Type difference between Firefox 1.0.6 and Safari 2.0.2. It&apos;s pretty easy to work 
around, though:
try {
   req.setRequestHeader(&apos;Content-Type&apos;,&apos;text/xml&apos;);
} catch (error) {};

I am not sure if the end-of-line issue in POSTed parameters is valid, but it appears to be out of scope of 
this bug. Here, both Firefox and Safari use LF in serialized XML.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23569</commentid>
    <comment_count>7</comment_count>
    <who name="Dylan Etkin">dylan</who>
    <bug_when>2005-11-02 14:31:38 -0800</bug_when>
    <thetext>I tried setting the content type of the XMLHTTPRequest with
req.setRequestHeader(&apos;Content-Type&apos;,&apos;text/xml&apos;); but is seemed to make no
difference, when I examined the Content-Type on the sent request it was still
application/x-www-form-urlencoded.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23597</commentid>
    <comment_count>8</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2005-11-02 21:10:32 -0800</bug_when>
    <thetext>(In reply to comment #7)

Hmm, that&apos;s quite strange - worked for me in Safari 2.0.2. Actually, I have now found a hint on Wikipedia 
advising the same, so it must have worked before, as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26360</commentid>
    <comment_count>9</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2005-12-22 02:33:08 -0800</bug_when>
    <thetext>(In reply to comment #7)
For the workaround to work, setRequestHeader() should be called after open() (and before send()).

Still a bug that needs to be fixed, of course.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26365</commentid>
    <comment_count>10</comment_count>
      <attachid>5219</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2005-12-22 05:29:56 -0800</bug_when>
    <thetext>Created attachment 5219
proposed fix</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26366</commentid>
    <comment_count>11</comment_count>
      <attachid>5219</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2005-12-22 05:32:30 -0800</bug_when>
    <thetext>Comment on attachment 5219
proposed fix

Default Content-Type to application/xml (match Firefox); encode the request
body using a correct codec if a charset was specified.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26367</commentid>
    <comment_count>12</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2005-12-22 06:27:08 -0800</bug_when>
    <thetext>Concerning overriding headers via setRequestHeader, see also:
https://bugzilla.mozilla.org/show_bug.cgi?id=302809
https://bugzilla.mozilla.org/show_bug.cgi?id=302263
https://bugzilla.mozilla.org/show_bug.cgi?id=308484</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26368</commentid>
    <comment_count>13</comment_count>
      <attachid>5219</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2005-12-22 06:36:28 -0800</bug_when>
    <thetext>Comment on attachment 5219
proposed fix

ap and I talked over IRC.  ap noted that there could be security concerns wrt
our setRequestHeader support on XMLHTTPRequest.  He was able to convince me
however that this patch does not introduce any additional security risk, mearly
adds support for respecting content-type headers which one was already able to
set.

ap agreed to file additional bugs on the subject.

The patch itself appeared to me to be technically sound.

The FireFox bugs in question are:
https://bugzilla.mozilla.org/show_bug.cgi?id=302809
https://bugzilla.mozilla.org/show_bug.cgi?id=302263
https://bugzilla.mozilla.org/show_bug.cgi?id=308484</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>5219</attachid>
            <date>2005-12-22 05:29:56 -0800</date>
            <delta_ts>2005-12-22 06:36:28 -0800</delta_ts>
            <desc>proposed fix</desc>
            <filename>XMLHttpRequestContentTypePatch.txt</filename>
            <type>text/plain</type>
            <size>6207</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">SW5kZXg6IENoYW5nZUxvZwo9PT09PT09PT09PT09PT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WNlIEtKUyB7CiAgICAgdm9pZCBzZW5kKGNvbnN0IFFTdHJpbmcmIF9ib2R5
KTsKICAgICB2b2lkIGFib3J0KCk7CiAgICAgdm9pZCBzZXRSZXF1ZXN0SGVhZGVyKGNvbnN0IFFT
dHJpbmcmIG5hbWUsIGNvbnN0IFFTdHJpbmcgJnZhbHVlKTsKKyAgICBRU3RyaW5nIGdldFJlcXVl
c3RIZWFkZXIoY29uc3QgUVN0cmluZyYgbmFtZSkgY29uc3Q7CiAgICAgSlNWYWx1ZSAqZ2V0QWxs
UmVzcG9uc2VIZWFkZXJzKCkgY29uc3Q7CiAgICAgUVN0cmluZyBnZXRSZXNwb25zZUhlYWRlcihj
b25zdCBRU3RyaW5nJiBuYW1lKSBjb25zdDsKICAgICBib29sIHJlc3BvbnNlSXNYTUwoKSBjb25z
dDsKICAgICAKKyAgICBzdGF0aWMgUVN0cmluZyBnZXRTcGVjaWZpY0hlYWRlcihjb25zdCBRU3Ry
aW5nJiBoZWFkZXJzLCBjb25zdCBRU3RyaW5nJiBuYW1lKTsKKwogICAgIHZvaWQgY2hhbmdlU3Rh
dGUoWE1MSHR0cFJlcXVlc3RTdGF0ZSBuZXdTdGF0ZSk7CiAKICAgICBzdGF0aWMgUVB0ckRpY3Q8
IFFQdHJEaWN0PFhNTEh0dHBSZXF1ZXN0PiA+ICZyZXF1ZXN0c0J5RG9jdW1lbnQoKTsK
</data>
<flag name="review"
          id="1066"
          type_id="1"
          status="+"
          setter="eric"
    />
          </attachment>
      

    </bug>

</bugzilla>