<?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>3810</bug_id>
          
          <creation_ts>2005-07-02 04:46:27 -0700</creation_ts>
          <short_desc>Less common HTTP status codes cause the code to appear as undefined</short_desc>
          <delta_ts>2019-02-06 09:04:06 -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>DOM</component>
          <version>312.x</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.3</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Henri Sivonen">hsivonen</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>bugs-webkit</cc>
    
    <cc>cdumez</cc>
    
    <cc>dan</cc>
    
    <cc>djt</cc>
    
    <cc>ian</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>13673</commentid>
    <comment_count>0</comment_count>
    <who name="Henri Sivonen">hsivonen</who>
    <bug_when>2005-07-02 04:46:27 -0700</bug_when>
    <thetext>Steps to reproduce:
1) Use XMLHttpRequest to POST a document to a server.
2) Have the server respond with HTTP Status 204 No Content or 201 Created.
3) Inspect the status property of the XMLHttpRequest instance upon readyState == 4.

Actual results:
The status property is undefined.

Expected results:
Expected the status code to be exposed to the script like the more common codes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13923</commentid>
    <comment_count>1</comment_count>
    <who name="Bob Ippolito">bob</who>
    <bug_when>2005-07-04 15:49:44 -0700</bug_when>
    <thetext>It seems that this happens for a simple GET that returns 200 (as a heisenbug).  Even stranger, the status is 
undefined, but the responseText will be there.

Unfortunately I haven&apos;t been able to create a test case, nor can I link to the pages where this happens at 
this time.  Our current workaround is simply to assume 200 if the status was undefined and there is 
responseText.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19142</commentid>
    <comment_count>2</comment_count>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2005-09-08 22:33:11 -0700</bug_when>
    <thetext>A testcase for this would be GREAT. </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22280</commentid>
    <comment_count>3</comment_count>
      <attachid>4409</attachid>
    <who name="Daniel Udey">dan</who>
    <bug_when>2005-10-19 13:08:14 -0700</bug_when>
    <thetext>Created attachment 4409
XMLHttpRequest Status Code Test Case

Here is the HTML for the test case - put this in the same directory as the PHP
file and access via a webserver to test.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22282</commentid>
    <comment_count>4</comment_count>
      <attachid>4410</attachid>
    <who name="Daniel Udey">dan</who>
    <bug_when>2005-10-19 13:20:44 -0700</bug_when>
    <thetext>Created attachment 4410
XMLHttpRequest Status Code Test Case (PHP/HTML)

Here is the test case - extract these files to a web-reachable directory
(requires PHP) and you can test status code responses with it.

You can test this script live at http://sites.darien.ca/temp/php/xmlhttp.html -
this URL should remain active for quite a while (I don&apos;t usually delete
things), but it may be faster/more convenient to run locally. This script
supports all the HTTP/1.1 status codes as found in RFC 2616, Section 10, with
one important exception: no &apos;Location:&apos; header is sent to the browser when an
HTTP code 3xx is sent. This is because Safari will follow the &apos;Location:&apos;
header to whichever other URL is given, and thus there is no point in
redirecting.

Using this script with the stock Tiger Safari, I can reproduce this bug on
response codes 204 and 205 (intermittently), and all response codes 3xx return
&apos;undefined&apos;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26815</commentid>
    <comment_count>5</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2005-12-27 14:22:36 -0800</bug_when>
    <thetext>I&apos;m surprised Alexey hasn&apos;t been all over this bug. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27779</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-01-05 06:45:25 -0800</bug_when>
    <thetext>With ToT, I cannot reproduce this for 200, 204 or 205 (perhaps, as a side effect of the fix in bug 5924). 
The behavior is still largely different, though.

Basically, it seems that Firefox ignores the meaning of many HTTP statuses here (e.g. it still receives the 
response data for 204 No Content or 304 Not Modified responses). OTOH, NSURLConnection doesn&apos;t pass 
the data for 204, and emits an error for 304 - which may be correct.

Are there any cases that should be considered bugs left? Do we need to match Firefox exactly?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33376</commentid>
    <comment_count>7</comment_count>
    <who name="Sen Haerens">sen</who>
    <bug_when>2006-02-19 09:21:33 -0800</bug_when>
    <thetext>(In reply to comment #6)
&gt; NSURLConnection doesn&apos;t pass 
&gt; the data for 204, and emits an error for 304 - which may be correct.

I still think the 304 &quot;not modified&quot; status should be returned. I’m building a dashboard widget that parses static XML files. Upon sending the correct If-None-Match and If-Modified-Since headers the server returns 304 but the XMLHttpRequest status returns undefined so it’s impossible to retrieve the data from cache and save some bandwith.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33385</commentid>
    <comment_count>8</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-02-19 10:18:14 -0800</bug_when>
    <thetext>The current version of the Web Applications spec &lt;http://www.whatwg.org/specs/web-apps/current-work/#scripted-http&gt; says that these conditional headers cannot be overridden. In WebKit, it would be the job of NSURLConnection to automatically cache the responses and to send correct conditional headers. When a 304 response is received, NSURLConnection transparently transforms it into a 200 response.

However, WebKit doesn&apos;t allow NSURLConnection to do the caching, which is a bug according to the next paragraph of the spec. Assuming the spec isn&apos;t about to be changed (it&apos;s a draft with many known issues), this is something that needs to be fixed. Since this is a separate issue, please file a new bug on it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33510</commentid>
    <comment_count>9</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2006-02-20 10:59:23 -0800</bug_when>
    <thetext>7385 is another possible dup.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48186</commentid>
    <comment_count>10</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-07-04 11:35:03 -0700</bug_when>
    <thetext>(In reply to comment #7)
The XMLHttpRequest spec has been changed, now it is specified that If-Modified-Since and other conditional headers can be overridden, and such requests should bypass the cache. Fixed in bug 8210. However, this is not directly related to this bug, which deals with unconditional POST requests.

(In reply to comment #6)
I am now seeing a problem with 204 responses: they seem to be handled correctly, but break further requests (which all start to return 204). This is not a WebKit issue; filed as &lt;rdar://4612890&gt;.

Not passing a 304 response for unconditional requests is &lt;rdar://4457674&gt;.

This leaves us with invalid 3xx responses (lacking Location), for which the status is returned as undefined. I am not sure whether this is something that needs to be fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59531</commentid>
    <comment_count>11</comment_count>
    <who name="David Thorpe">djt</who>
    <bug_when>2007-10-26 04:00:58 -0700</bug_when>
    <thetext>
I&apos;m receiving an exception (INVALID_STATE_ERR: DOM Exception 11) when I try to access the XMLHttpRequest.status method on 303 responses where there is a Location: header returned. I have tried PUT and POST methods. Here is my code:

var theRequest = new XMLHttpRequest();
var theContent = [an xml document as a string];
var theURI = [the URI of the web service endpoint];
try {
  theRequest.open(&quot;POST&quot;,theURI);
  theRequest.setRequestHeader(&apos;Content-Type&apos;, &apos;text/xml&apos;);
  theRequest.setRequestHeader(&apos;X-HTTP-Method-Override&apos;, &apos;PUT&apos;);
  theRequest.send(theContent);
  if(theRequest.status == 204 || theRequest.status == 303 || theRequest.status == 200) {
    return theRequest.responseText;        
  }
} catch(theException) {
  alert(&quot;Exception caught, &quot; + theException);				
}

I&apos;m using Safari Version 3.0.3 (522.12.1) on OS X Tiger 10.4.10. I believe for AJAX purposes 303 responses should be handled correctly when there is a Location: header returned, at the moment the exception is not very useful. Thanks.

David Thorpe djt@mutablelogic.com</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59533</commentid>
    <comment_count>12</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2007-10-26 04:54:34 -0700</bug_when>
    <thetext>(In reply to comment #11)
&gt; I&apos;m receiving an exception (INVALID_STATE_ERR: DOM Exception 11) when I try to
&gt; access the XMLHttpRequest.status method on 303 responses where there is a
&gt; Location: header returned. 

This is expected behavior: you are making an async request, so theRequest.status and theRequest. responseText are not available right after send(). You need to process the results from an onreadystatechange callback.

I&apos;m going to close this bug - most (or all) issues that were originally reported seem to be fixed by now, and keeping it open just adds to confusion.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1503102</commentid>
    <comment_count>13</comment_count>
    <who name="Lucas Forschler">lforschler</who>
    <bug_when>2019-02-06 09:04:06 -0800</bug_when>
    <thetext>Mass moving XML DOM bugs to the &quot;DOM&quot; Component.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4409</attachid>
            <date>2005-10-19 13:08:14 -0700</date>
            <delta_ts>2005-10-19 13:20:44 -0700</delta_ts>
            <desc>XMLHttpRequest Status Code Test Case</desc>
            <filename>xmlhttp-test-case.html</filename>
            <type>text/html</type>
            <size>1281</size>
            <attacher name="Daniel Udey">dan</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBYSFRNTCAxLjAgVHJhbnNpdGlvbmFs
Ly9FTiIKICAgICJodHRwOi8vd3d3LnczLm9yZy9UUi94aHRtbDEvRFREL3hodG1sMS10cmFuc2l0
aW9uYWwuZHRkIj4KCjxodG1sIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hodG1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CjwvaGVhZD4KCjxi
b2R5PgoKPGZvcm0gYWN0aW9uPSIjIiBtZXRob2Q9ImdldCIgb25zdWJtaXQ9InJldHVybiB0ZXN0
UmVzcG9uc2VIZWFkZXIoKTsiPgpSZXNwb25zZSBjb2RlIGRlc2lyZWQ6IDxpbnB1dCB0eXBlPSJ0
ZXh0IiBuYW1lPSJyZXNwb25zZUNvZGUiIGlkPSJyZXNwb25zZSI+PGJyPgpSZXNwb25zZSBjb2Rl
OiA8aW5wdXQgdHlwZT0idGV4dCIgbmFtZSA9IiIgaWQ9InJldHVybmVkUmVzcG9uc2UiPGJyPgo8
dGV4dGFyZWEgY29scz0xMjUgcm93cz0zMCBpZD0icmV0dXJuZWRDb250ZW50Ij48L3RleHRhcmVh
Pgo8L2Zvcm0+Cgo8L2JvZHk+Cgo8L2h0bWw+
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4410</attachid>
            <date>2005-10-19 13:20:44 -0700</date>
            <delta_ts>2005-10-19 13:20:44 -0700</delta_ts>
            <desc>XMLHttpRequest Status Code Test Case (PHP/HTML)</desc>
            <filename>xmlhttp-test-case.zip</filename>
            <type>application/octet-stream</type>
            <size>2362</size>
            <attacher name="Daniel Udey">dan</attacher>
            
              <data encoding="base64">UEsDBBQACAAIAOWAUzMAAAAAAAAAAAAAAAAWABAAeG1saHR0cC10ZXN0LWNhc2UuaHRtbFVYDADa
p1ZDbadWQ/UBAACNlN9P2zAQx5/jv+LmPbTVSEzH9gDElUZBAgkGKpnGHk18bYMSJ4sd2grtf9+5
TUTLAK2Kmvhy38/98Dnxh9PrcfLr5gzmrsjh5sfJ5cUYeCjEz4OxEKfJKdydJ1eXMIz2IamVsZnL
SqNyIc6+cwb043PnqiMhFotFtDiIynomkolYet7QA9rH0G2pI+00HzEWr6Mui9xY+QpneHh4uJFv
nFFpf3eZy3F0d3V5TooJ/m7QOkj831hZjMXmPTnatM4qB25VoeQOl048qEe1sfIRMDZtTO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