[BACK] Return to Overview.src.html CVS log [TXT] [DIR] Up to [Public] / 2006 / webapi / XMLHttpRequest

Annotation of 2006/webapi/XMLHttpRequest/Overview.src.html, revision 1.260

1.248 avankest 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
1.1 avankest 2: <html lang="en-US">
 3: <head>
1.207 avankest 4:  <title>XMLHttpRequest</title>
1.16 avankest 5:  <style type="text/css">
1.117 avankest 6:  pre.idl { border:solid thin; background:#eee; color:#000; padding:0.5em }
1.16 avankest 7:  pre.idl :link, pre.idl :visited { color:inherit; background:transparent }
1.58 avankest 8:  pre code { color:inherit; background:transparent }
1.16 avankest 9:  div.example { margin-left:1em; padding-left:1em; border-left:double; color:#222; background:#fcfcfc }
1.89 avankest 10:  .note { margin-left:2em; font-weight:bold; font-style:italic; color:#008000 }
1.16 avankest 11:  p.note::before { content:"Note: " }
1.203 avankest 12:  .XXX { padding:.5em; border:solid #f00 }
 13:  p.XXX::before { content:"Issue: " }
1.119 avankest 14:  dl.switch { padding-left:2em }
1.248 avankest 15:  dl.switch > dt { text-indent:-1.5em }
 16:  dl.switch > dt:before { content:'21円AA'; padding:0 0.5em 0 0; display:inline-block; width:1em; text-align:right; line-height:0.5em }
1.16 avankest 17:  em.ct { text-transform:lowercase; font-variant:small-caps; font-style:normal }
 18:  dfn { font-weight:bold; font-style:normal }
 19:  code { color:orangered }
 20:  code :link, code :visited { color:inherit }
1.203 avankest 21:  hr:not(.top) { display:block; background:none; border:none; padding:0; margin:2em 0; height:auto }
 22:  table { border-collapse:collapse; border-style:hidden hidden none hidden }
 23:  table thead { border-bottom:solid }
 24:  table tbody th:first-child { border-left:solid }
 25:  table td, table th { border-left:solid; border-right:solid; border-bottom:solid thin; vertical-align:top; padding:0.2em }
1.16 avankest 26:  </style>
1.147 avankest 27:  <link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS]">
1.1 avankest 28: </head>
 29: <body>
 30:  <div class="head">
 31:  <p><a href="http://www.w3.org/"><img height="48" width="72" alt="W3C" src="http://www.w3.org/Icons/w3c_home"></a></p>
1.12 avankest 32: 
1.229 avankest 33:  <h1 class="head" id="the-xmlhttprequest-object">XMLHttpRequest</h1>
1.248 avankest 34:  
1.12 avankest 35: 
1.149 avankest 36:  <h2 class="no-num no-toc" id="w3c-doctype">[LONGSTATUS] [DATE: 3 August 2002]</h2>
1.12 avankest 37: 
1.1 avankest 38:  <dl>
1.10 avankest 39:   <dt>This Version:</dt>
1.246 avankest 40:   <dd><a href="[VERSION]/">http://www.w3.org/TR/[YEAR]/ED-XMLHttpRequest-[CDATE]/</a></dd>
1.14 avankest 41: 
1.10 avankest 42:   <dt>Latest Version:</dt>
1.1 avankest 43:   <dd><a href="http://www.w3.org/TR/XMLHttpRequest/">http://www.w3.org/TR/XMLHttpRequest/</a></dd>
1.203 avankest 44: 
1.189 avankest 45:   <dt>Latest Editor Version:</dt>
 46:   <dd><a href="http://dev.w3.org/2006/webapi/XMLHttpRequest/">http://dev.w3.org/2006/webapi/XMLHttpRequest/</a></dd>
1.14 avankest 47: 
1.10 avankest 48:   <dt>Previous Versions:</dt>
1.248 avankest 49:   
1.231 avankest 50:   <dd><a href="http://www.w3.org/TR/2009/WD-XMLHttpRequest-20090820/">http://www.w3.org/TR/2009/WD-XMLHttpRequest-20090820/</a></dd>
1.173 avankest 51:   <dd><a href="http://www.w3.org/TR/2008/WD-XMLHttpRequest-20080415/">http://www.w3.org/TR/2008/WD-XMLHttpRequest-20080415/</a></dd>
1.154 avankest 52:   <dd><a href="http://www.w3.org/TR/2007/WD-XMLHttpRequest-20071026/">http://www.w3.org/TR/2007/WD-XMLHttpRequest-20071026/</a></dd>
1.133 avankest 53:   <dd><a href="http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070618/">http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070618/</a></dd>
1.58 avankest 54:   <dd><a href="http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070227/">http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070227/</a></dd>
1.22 avankest 55:   <dd><a href="http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060927/">http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060927/</a></dd>
1.1 avankest 56:   <dd><a href="http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060619/">http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060619/</a></dd>
 57:   <dd><a href="http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060405/">http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060405/</a></dd>
1.248 avankest 58:   
 59:   
1.14 avankest 60: 
1.1 avankest 61:   <dt>Editor:</dt>
 62:   <dd><a href="http://annevankesteren.nl/">Anne van Kesteren</a>
 63:   (<a href="http://www.opera.com/">Opera Software ASA</a>)
 64:   &lt;<a href="mailto:annevk@opera.com">annevk@opera.com</a>&gt;</dd>
 65:  </dl>
1.14 avankest 66: 
1.1 avankest 67:  <p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
1.229 avankest 68:  &copy; 2009
1.51 avankest 69:  <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>&reg;</sup>
 70:  (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
 71:  <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
 72:  <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
 73:  <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
 74:  <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
 75:  and
 76:  <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
 77:  use</a> rules apply.</p>
1.1 avankest 78:  </div>
1.12 avankest 79: 
1.1 avankest 80:  <hr>
1.12 avankest 81: 
1.1 avankest 82:  <h2 class="no-num no-toc" id="specabstract">Abstract</h2>
1.10 avankest 83: 
1.248 avankest 84:  
 85:  
1.229 avankest 86:  <p>The XMLHttpRequest specification defines an API
1.207 avankest 87:  that provides scripted client functionality for transferring data between
 88:  a client and a server.</p>
1.248 avankest 89:  
1.12 avankest 90: 
1.1 avankest 91:  <h2 class="no-num no-toc" id="sotd">Status of this Document</h2>
1.12 avankest 92: 
1.1 avankest 93:  <p><em>This section describes the status of this document at the time of its
1.36 avankest 94:  publication. Other documents may supersede this document. A list of current
 95:  W3C publications and the latest revision of this technical report can be
 96:  found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a>
1.117 avankest 97:  at http://www.w3.org/TR/.</em></p>
1.36 avankest 98: 
1.248 avankest 99:  <p>This is the [DATE: 3 August 2002] <!--Last Call Working Draft-->[LONGSTATUS] of
 100:  XMLHttpRequest. Please send comments to
 101:  <a href="mailto:public-webapps@w3.org?subject=[XHR]%20">public-webapps@w3.org</a>
1.207 avankest 102:  (<a href="http://lists.w3.org/Archives/Public/public-webapps/">archived</a>)
1.248 avankest 103:  with <samp>[XHR]</samp> at the start of the subject line.</p>
1.51 avankest 104: 
1.47 avankest 105:  <p>This document is produced by the
1.248 avankest 106:  <a href="http://www.w3.org/2008/webapps/">Web Applications</a> (WebApps) Working Group.
 107:  The WebApps Working Group is part of the
1.207 avankest 108:  <a href="http://www.w3.org/2006/rwc/Activity">Rich Web Clients Activity</a>
1.248 avankest 109:  in the W3C <a href="http://www.w3.org/Interaction/">Interaction Domain</a>.</p>
1.12 avankest 110: 
1.1 avankest 111:  <p>This document was produced by a group operating under the
1.248 avankest 112:  <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004
 113:  W3C Patent Policy</a>. W3C maintains a
1.207 avankest 114:  <a rel="disclosure" href="http://www.w3.org/2004/01/pp-impl/42538/status">public
1.248 avankest 115:  list of any patent disclosures</a> made in connection with the deliverables of
 116:  the group; that page also includes instructions for disclosing a patent. An
 117:  individual who has actual knowledge of a patent which the individual believes
 118:  contains
1.36 avankest 119:  <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
 120:  Claim(s)</a> must disclose the information in accordance with
 121:  <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
 122:  6 of the W3C Patent Policy</a>.</p>
1.12 avankest 123: 
1.248 avankest 124:  <p>Publication as a Working Draft does not imply endorsement by the W3C
 125:  Membership. This is a draft document and may be updated, replaced or
 126:  obsoleted by other documents at any time. It is inappropriate to cite this
 127:  document as other than work in progress.</p>
1.207 avankest 128: 
 129: 
1.1 avankest 130:  <h2 class="no-num no-toc" id="toc">Table of Contents</h2>
1.21 avankest 131: 
1.1 avankest 132:  <!--toc-->
1.12 avankest 133: 
1.207 avankest 134: 
 135: 
1.1 avankest 136:  <h2 id="introduction">Introduction</h2>
1.12 avankest 137: 
1.1 avankest 138:  <p><em>This section is non-normative.</em></p>
1.12 avankest 139: 
1.183 avankest 140:  <p>The <code>XMLHttpRequest</code> object implements an interface exposed
 141:  by a scripting engine that allows scripts to perform HTTP client
 142:  functionality, such as submitting form data or loading data from a
 143:  server. It is the ECMAScript HTTP API.</p>
1.24 avankest 144: 
1.1 avankest 145:  <p>The name of the object is <code>XMLHttpRequest</code> for compatibility
1.183 avankest 146:  with the Web, though each component of this name is potentially
 147:  misleading. First, the object supports any text based format, including
 148:  XML. Second, it can be used to make requests over both HTTP and HTTPS
 149:  (some implementations support protocols in addition to HTTP and HTTPS, but
 150:  that functionality is not covered by this specification). Finally, it
 151:  supports "requests" in a broad sense of the term as it pertains to HTTP;
 152:  namely all activity involved with HTTP requests or responses for the
 153:  defined HTTP methods.</p>
1.12 avankest 154: 
1.14 avankest 155:  <div class="example">
1.250 avankest 156:  <p>Some simple code to do something with data from an XML document
 157:  fetched over the network:</p>
1.16 avankest 158: 
1.58 avankest 159:  <pre><code>function test(data) {
1.14 avankest 160: // taking care of data
 161: }
 162: 
 163: function handler() {
1.117 avankest 164: if(this.readyState == 4 &amp;&amp; this.status == 200) {
1.14 avankest 165:  // so far so good
1.117 avankest 166:  if(this.responseXML != null &amp;&amp; this.responseXML.getElementById('test').firstChild.data)
 167:   // success!
1.14 avankest 168:  test(this.responseXML.getElementById('test').firstChild.data);
 169:  else
 170:  test(null);
1.117 avankest 171: } else if (this.readyState == 4 &amp;&amp; this.status != 200) {
1.14 avankest 172:  // fetched the wrong page or network error...
 173:  test(null);
 174: }
 175: }
1.12 avankest 176: 
1.14 avankest 177: var client = new XMLHttpRequest();
 178: client.onreadystatechange = handler;
1.250 avankest 179: client.open("GET", "unicorn.xml");
1.58 avankest 180: client.send();</code></pre>
1.16 avankest 181: 
1.56 avankest 182:  <p>If you just want to log a message to the server:</p>
1.16 avankest 183: 
1.58 avankest 184:  <pre><code>function log(message) {
1.14 avankest 185: var client = new XMLHttpRequest();
1.56 avankest 186: client.open("POST", "/log");
1.57 avankest 187: client.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
1.14 avankest 188: client.send(message);
1.58 avankest 189: }</code></pre>
1.16 avankest 190: 
1.14 avankest 191:  <p>Or if you want to check the status of a document on the server:</p>
1.16 avankest 192: 
1.58 avankest 193:  <pre><code>function fetchStatus(address) {
1.14 avankest 194: var client = new XMLHttpRequest();
 195: client.onreadystatechange = function() {
 196:  // in case of network errors this might not give reliable results
 197:  if(this.readyState == 4)
 198:  returnStatus(this.status);
 199: }
 200: client.open("HEAD", address);
 201: client.send();
1.58 avankest 202: }</code></pre>
1.14 avankest 203:  </div>
1.12 avankest 204: 
1.203 avankest 205: 
 206: 
1.248 avankest 207: 
 208:  <h2 id="conformance">Conformance Criteria</h2>
1.12 avankest 209: 
1.27 avankest 210:  <p>Everything in this specification is normative except for diagrams,
 211:  examples, notes and sections marked non-normative.</p>
1.12 avankest 212: 
1.1 avankest 213:  <p>The key words <em class="ct">must</em>, <em class="ct">must not</em>,
1.259 avankest 214:  <em class="ct">should</em>, <em class="ct">should not</em>, and
 215:  <em class="ct">may</em> in this document are to be interpreted as
 216:  described in RFC 2119. [<cite><span>RFC2119</span></cite>]</p>
1.12 avankest 217: 
1.1 avankest 218:  <p>This specification defines the following classes of products:</p>
1.12 avankest 219: 
1.1 avankest 220:  <dl>
1.74 avankest 221:  <dt><dfn id="conforming-user-agent">Conforming user agent</dfn></dt>
1.24 avankest 222: 
1.74 avankest 223:  <dd>
 224:   <p>A user agent <em class="ct">must</em> behave as described in this
1.106 avankest 225:   specification in order to be considered conformant.</p>
1.95 avankest 226: 
1.248 avankest 227:   
1.224 avankest 228:   <p>If the user agent is not a <span>conforming XML user agent</span> the
 229:   <span>XML response entity body</span> <em class="ct">must</em> (always)
1.239 avankest 230:   be null.</p>
1.248 avankest 231:   
1.140 avankest 232: 
 233:   <p>User agents <em class="ct">may</em> implement algorithms given in
 234:   this specification in any way desired, so long as the end result is
 235:   indistinguishable from the result that would be obtained by the
 236:   specification's algorithms.</p>
1.110 avankest 237: 
1.95 avankest 238:   <p class="note">This specification uses both the terms "conforming user
 239:   agent(s)" and "user agent(s)" to refer to this product class.</p>
1.74 avankest 240:  </dd>
1.248 avankest 241:  
1.94 avankest 242:  <dt><dfn id="conforming-xml-user-agent">Conforming XML user agent</dfn></dt>
1.110 avankest 243: 
1.224 avankest 244:  <dd><p>An XML user agent <em class="ct">must</em> be a
 245:  <span>conforming user agent</span> and <em class="ct">must</em> be a
 246:  conforming XML processor that reports violations of
 247:  namespace well-formedness. [<cite><span>XML</span></cite>]</p></dd>
1.248 avankest 248:  
1.1 avankest 249:  </dl>
1.32 avankest 250: 
1.153 avankest 251:  <h3 id="dependencies">Dependencies</h3>
1.33 avankest 252: 
1.29 avankest 253:  <p>This specification relies on several underlying specifications.</p>
1.248 avankest 254: 
1.29 avankest 255:  <dl>
1.248 avankest 256:  
 257: 
1.29 avankest 258:  <dt>DOM</dt>
1.33 avankest 259: 
1.155 avankest 260:  <dd><p>A <span title="conforming user agent">conforming user agent</span>
1.176 avankest 261:  <em class="ct">must</em> support at least the subset of the functionality
1.182 avankest 262:  defined in DOM Events and DOM Core that this specification relies upon,
 263:  such as various exceptions and <code>EventTarget</code>.
1.155 avankest 264:  [<cite><span>DOM2Events</span></cite>]
 265:  [<cite><span>DOM3Core</span></cite>]</p></dd>
1.29 avankest 266: 
1.250 avankest 267:  <dt>HTML5</dt>
1.161 avankest 268: 
 269:  <dd>
1.189 avankest 270:   <p>A <span>conforming user agent</span> <em class="ct">must</em> support
1.250 avankest 271:   at least the subset of the functionality defined in HTML5 that
1.197 avankest 272:   this specification relies upon, such as the basics of the
 273:   <code>Window</code> object and serializing a <code>Document</code>
 274:   object. [<cite><span>HTML5</span></cite>]</p>
1.161 avankest 275: 
 276:   <p class="note">The
 277:   <a href="http://www.w3.org/TR/2006/WD-Window-20060407/">Window Object
 278:   1.0</a> draft is not referenced normatively as it appears to be no
1.250 avankest 279:   longer maintained and HTML5 defines the <code>Window</code> object in
 280:   more detail. This specification already depends on HTML5 for other
 281:   reasons so there is not much additional overhead because of this.</p>
1.161 avankest 282: 
1.29 avankest 283:  <dt>HTTP</dt>
1.33 avankest 284: 
1.248 avankest 285:  <dd><p>A <span title="conforming user agent">conforming user agent</span>
 286:  <em class="ct">must</em> support some version of the HTTP protocol.
 287:  Requirements regarding HTTP are made throughout the specification.
 288:  [<cite><span>RFC2616</span></cite>]</p></dd>
1.189 avankest 289: 
1.181 avankest 290:  <dt>Web IDL</dt>
1.203 avankest 291: 
1.248 avankest 292:  <dd><p>A <span>conforming user agent</span> <em class="ct">must</em> also
 293:  be a conforming implementation of the IDL fragments in this
 294:  specification, as described in the Web IDL specification.
1.181 avankest 295:  [<cite><span>WebIDL</span></cite>]
1.248 avankest 296: 
 297:  
1.29 avankest 298:  </dl>
1.12 avankest 299: 
1.157 avankest 300: 
1.153 avankest 301:  <h3 id="terminology">Terminology</h3>
1.209 avankest 302: 
1.233 avankest 303:  <p><dfn id="dfn-obtain-unicode">convert a DOMString to a sequence of Unicode characters</dfn>
 304:  is defined by the Web IDL specification.
 305:  [<cite><span>WebIDL</span></cite>]</p>
1.248 avankest 306:  
1.200 avankest 307:  <p>The terms and algorithms
1.257 avankest 308:  <dfn id="url-fragment"><code>&lt;fragment></code></dfn>,
 309:  <dfn id="url-scheme"><code>&lt;scheme></code></dfn>,
1.203 avankest 310:  <dfn id="document-base-url">document base URL</dfn>,
1.244 avankest 311:  <dfn id="document-character-encoding">document's character encoding</dfn>,
1.205 avankest 312:  <dfn id="event-handler-attributes-0">event handler attributes</dfn>,
1.203 avankest 313:  <dfn id="event-handler-event-type">event handler event type</dfn>,
1.260 ! avankest 314:  <dfn id="fetch">fetch</dfn>,
1.203 avankest 315:  <dfn id="fully-active">fully active</dfn>,
1.206 avankest 316:  <dfn id="function"><code>Function</code></dfn>,
1.225 avankest 317:  <dfn id="dom-innerhtml" title="dom-innerHTML"><code>innerHTML</code></dfn>,
1.200 avankest 318:  <dfn id="origin">origin</dfn>,
1.232 avankest 319:  <dfn id="preferred-mime-name">preferred MIME name</dfn>,
1.203 avankest 320:  <dfn id="resolve-a-url">resolve a URL</dfn>,
 321:  <dfn id="same-origin">same origin</dfn>,
 322:  <dfn id="storage-mutex">storage mutex</dfn>,
 323:  <dfn id="task">task</dfn>,
 324:  <dfn id="task-source">task source</dfn>,
1.252 avankest 325:  <dfn id="task-queues">task queues</dfn>,
1.203 avankest 326:  <dfn id="url">URL</dfn>,
1.232 avankest 327:  <dfn id="url-character-encoding">URL character encoding</dfn>,
 328:  <dfn id="queue-a-task">queue a task</dfn>, and
 329:  <dfn id="valid-mime-type">valid MIME type</dfn>
1.250 avankest 330:  are defined by the HTML5 specification.
1.157 avankest 331:  [<cite><span>HTML5</span></cite>]</p>
1.210 avankest 332: 
1.203 avankest 333:  <p>The term <dfn id="entity-body">entity body</dfn> is used as described
 334:  in RFC 2616. <dfn id="method-token">Method token</dfn> is used as
 335:  described in section 5.1.1 of RFC 2616. <dfn><code>field-name</code></dfn>
 336:  and <dfn><code>field-value</code></dfn> are used as described in section
 337:  4.2 of RFC 2616. [<cite><span>RFC2616</span></cite>]</p>
1.218 avankest 338: 
1.258 avankest 339:  <p>To <dfn>deflate a DOMString into a byte sequence</dfn> means to create
 340:  a sequence of bytes such that the <var title="">n</var>th byte of the
 341:  sequence is equal to the low-order byte of the <var title="">n</var>th
 342:  code point in the original DOMString.</p>
 343: 
 344:  <p>To <dfn>inflate a byte sequence into a DOMString</dfn> means to create
 345:  a DOMString such that the <var title="">n</var>th code point has 0x00 as
 346:  the high-order byte and the <var title="">n</var>th byte of the byte
 347:  sequence as the low-order byte.</p>
1.256 avankest 348: 
1.203 avankest 349:  <p><dfn><code>userinfo</code></dfn> is used as described in section 3.2.1
 350:  of RFC 3986. [<cite><span>RFC3986</span></cite>]</p>
 351: 
 352:  <p>To <dfn id="dispatch-readystatechange-event">dispatch a
 353:  <code>readystatechange</code> event</dfn> means that an event with the
1.232 avankest 354:  name <code>readystatechange</code>, which does not bubble and is not
 355:  cancelable, and which uses the <code>Event</code> interface, is to be
 356:  dispatched at the <code>XMLHttpRequest</code> object.</p>
1.80 avankest 357: 
1.248 avankest 358:  
 359: 
1.153 avankest 360:  <h3 id="extensibility">Extensibility</h3>
1.12 avankest 361: 
1.250 avankest 362:  <p>User agents, Working Groups, and other interested parties are
 363:  <em>strongly encouraged</em> to discuss extensions on a relevant public
 364:  forum, preferably
 365:  <a href="mailto:public-webapps@w3.org">public-webapps@w3.org</a>. If this
 366:  is for some reason not possible prefix the extension in some way and start
 367:  the prefix with an uppercase letter. E.g. if company Foo wants to add a
 368:  private method <code>bar()</code> it could be named <code>FooBar()</code>
 369:  to prevent clashes with a potential future standardized
 370:  <code>bar()</code>.</p>
1.12 avankest 371: 
1.153 avankest 372: 
1.223 avankest 373:  <h2>The <code title="">XMLHttpRequest</code> Interface</h2>
1.12 avankest 374: 
1.58 avankest 375:  <p>The <code>XMLHttpRequest</code> object can be used by scripts to
1.22 avankest 376:  programmatically connect to their originating server via HTTP.</p>
1.12 avankest 377: 
1.228 avankest 378:  <pre class="idl">[NoInterfaceObject]
 379: interface <dfn id="xmlhttprequesteventtarget">XMLHttpRequestEventTarget</dfn> : EventTarget {
 380:  // for future use
 381: };
 382: 
1.240 avankest 383: [<span title="dom-XMLHttpRequest">Constructor</span>]
1.228 avankest 384: interface <dfn id="xmlhttprequest">XMLHttpRequest</dfn> : <span>XMLHttpRequestEventTarget</span> {
1.206 avankest 385:  // <a href="#event-handler-attributes">event handler attributes</a>
 386:      attribute <span>Function</span> <span>onreadystatechange</span>;
1.58 avankest 387: 
1.205 avankest 388:  // <a href="#states">states</a>
1.71 avankest 389:  const unsigned short <span title="UNSENT state">UNSENT</span> = 0;
1.134 avankest 390:  const unsigned short <span title="OPENED state">OPENED</span> = 1;
1.123 avankest 391:  const unsigned short <span title="HEADERS_RECEIVED state">HEADERS_RECEIVED</span> = 2;
1.86 avankest 392:  const unsigned short <span title="LOADING state">LOADING</span> = 3;
1.117 avankest 393:  const unsigned short <span title="DONE state">DONE</span> = 4;
1.70 avankest 394:  readonly attribute unsigned short <span>readyState</span>;
1.58 avankest 395: 
1.205 avankest 396:  // <a href="#request">request</a>
1.226 avankest 397:  void <span>open</span>(DOMString <var>method</var>, DOMString <var title="">url</var>);
 398:  void <span>open</span>(DOMString <var>method</var>, DOMString <var title="">url</var>, boolean <var>async</var>);
1.228 avankest 399:  void <span>open</span>(DOMString <var>method</var>, DOMString <var title="">url</var>, boolean <var>async</var>, DOMString? <var>user</var>);
 400:  void <span>open</span>(DOMString <var>method</var>, DOMString <var title="">url</var>, boolean <var>async</var>, DOMString? <var>user</var>, DOMString? <var>password</var>);
1.226 avankest 401:  void <span>setRequestHeader</span>(DOMString <var>header</var>, DOMString <var>value</var>);
1.70 avankest 402:  void <span>send</span>();
1.226 avankest 403:  void <span>send</span>(Document <var>data</var>);
1.228 avankest 404:  void <span>send</span>([AllowAny] DOMString? <var>data</var>);
1.70 avankest 405:  void <span>abort</span>();
1.58 avankest 406: 
1.205 avankest 407:  // <a href="#response">response</a>
1.203 avankest 408:  readonly attribute unsigned short <span>status</span>;
 409:  readonly attribute DOMString <span>statusText</span>;
1.226 avankest 410:  DOMString <span>getResponseHeader</span>(DOMString <var>header</var>);
1.70 avankest 411:  DOMString <span>getAllResponseHeaders</span>();
 412:  readonly attribute DOMString <span>responseText</span>;
 413:  readonly attribute Document <span>responseXML</span>;
1.228 avankest 414: };</pre>
1.8 avankest 415: 
1.235 avankest 416:  <!-- XXX domintro boxes; HTML5-style -->
 417: 
1.124 avankest 418: 
1.203 avankest 419:  <h3>Origin and Base URL</h3>
 420: 
 421:  <p>Each <code>XMLHttpRequest</code> object has an associated
 422:  <dfn id="xmlhttprequest-origin"><code>XMLHttpRequest</code> origin</dfn>
 423:  and an
 424:  <dfn id="xmlhttprequest-base-url"><code>XMLHttpRequest</code> base URL</dfn>.
 425: 
 426:  <p>This specification defines their values when the global object is
 427:  represented by the <code>Window</code> object. When the
1.246 avankest 428:  <code>XMLHttpRequest</code> object is used in other contexts their values
1.203 avankest 429:  will have to be defined as appropriate for that context. That is
 430:  considered to be out of scope for this specification.</p>
 431: 
 432:  <hr>
 433: 
 434:  <p>In environments where the global object is represented by the
 435:  <code>Window</code> object the <code>XMLHttpRequest</code> object has an
 436:  associated
 437:  <dfn id="xmlhttprequest-document"><code>XMLHttpRequest</code> <code>Document</code></dfn>
 438:  which is the <code>Document</code> object associated with the
 439:  <code>Window</code> object for which the <code>XMLHttpRequest</code>
 440:  interface object was created.</p>
 441: 
 442:  <p class="note">The
 443:  <span><code>XMLHttpRequest</code> <code>Document</code></span> is used to
 444:  determine the <span><code>XMLHttpRequest</code> origin</span> and
 445:  <span><code>XMLHttpRequest</code> base URL</span> at a later stage.</p>
 446: 
 447: 
 448:  <h3>Task Sources</h3>
1.218 avankest 449: 
1.251 avankest 450:  <p>The <span>task source</span> used by this specification is the
 451:  <dfn><code>XMLHttpRequest</code> task source</dfn>.</p>
1.203 avankest 452: 
 453: 
1.211 avankest 454:  <h3 id="constructors">Constructors</h3>
1.203 avankest 455: 
 456:  <p>When the
1.240 avankest 457:  <dfn id="dom-xmlhttprequest" title="dom-XMLHttpRequest"><code title="">XMLHttpRequest()</code></dfn>
1.203 avankest 458:  constructor is invoked, the user agent <em class="ct">must</em> return a
 459:  new <code>XMLHttpRequest</code> object.</p>
 460: 
 461: 
1.205 avankest 462:  <h3 id="event-handler-attributes">Event Handler Attributes</h3>
 463: 
1.248 avankest 464:  
 465: 
1.205 avankest 466:  <p>The following is the
 467:  <span title="event handler attributes">event handler attribute</span> (and
 468:  its corresponding <span>event handler event type</span>) that
 469:  <em class="ct">must</em> be supported as DOM attribute by the
 470:  <code>XMLHttpRequest</code> object:</p>
 471: 
 472:  <table>
 473:  <thead>
 474:   <tr>
 475:   <th><span title="event handler attributes">event handler attribute</span>
 476:   <th><span>event handler event type</span>
 477:  <tbody>
 478:   <tr>
 479:   <td><dfn id="onreadystatechange"><code>onreadystatechange</code></dfn>
 480:   <td><code>readystatechange</code></td>
 481:  </table>
 482: 
 483: 
 484:  <h3 id="states">States</h3>
1.203 avankest 485: 
 486:  <p>The <code>XMLHttpRequest</code> object can be in several states. The
 487:  <dfn id="readystate"><code>readyState</code></dfn> attribute, on getting,
 488:  <em class="ct">must</em> return the current state, which
 489:  <em class="ct">must</em> be one of the following values:</p>
 490: 
 491:  <dl>
 492:  <dt><dfn id="unsent-state" title="UNSENT state"><code>UNSENT</code></dfn>
 493:  (numeric value 0)</dt>
 494:  <dd><p>The object has been constructed.</p></dd>
 495: 
 496:  <dt><dfn id="opened-state" title="OPENED state"><code>OPENED</code></dfn>
 497:  (numeric value 1)</dt>
 498:  <dd><p>The <code>open()</code> method has been successfully invoked.
 499:  During this state request headers can be set using
 500:  <code>setRequestHeader()</code> and the request can be made using the
 501:  <code>send()</code> method.</p></dd>
 502: 
 503:  <dt><dfn id="headers-received-state" title="HEADERS_RECEIVED state"><code>HEADERS_RECEIVED</code></dfn>
 504:  (numeric value 2)</dt>
1.257 avankest 505:  <dd><p>All redirects (if any) have been followed and all HTTP headers of
 506:  the final response have been received. Several response members of the
 507:  object are now available.</p></dd>
1.203 avankest 508: 
 509:  <dt><dfn id="loading-state" title="LOADING state"><code>LOADING</code></dfn>
 510:  (numeric value 3)</dt>
 511:  <dd><p>The <span>response entity body</span> is being received.</p></dd>
 512: 
 513:  <dt><dfn id="done-state" title="DONE state"><code>DONE</code></dfn>
 514:  (numeric value 4)</dt>
 515:  <dd><p>The data transfer has been completed or something went wrong
 516:  during the transfer (e.g. infinite redirects).</p></dd>
 517:  </dl>
 518: 
 519:  <p>The <span title="OPENED state">OPENED</span> state has an associated
 520:  <dfn id="send-flag"><code>send()</code> flag</dfn> that indicates whether
 521:  the <code>send()</code> method has been invoked. It can be either true
 522:  or false and has an initial value of false.</p>
 523: 
 524:  <p>The <span title="DONE state">DONE</span> state has an associated
 525:  <dfn id="error-flag">error flag</dfn> that indicates some type of network
 526:  error or abortion. It can be either true or false and has an initial value
 527:  of false.</p>
 528: 
 529: 
1.205 avankest 530:  <h3 id="request">Request</h3>
1.203 avankest 531: 
 532:  <p>The <code>XMLHttpRequest</code> object holds the following request
 533:  metadata variables:</p>
 534: 
1.204 avankest 535:  <dl>
 536:  <dt>The <dfn>asynchronous flag</dfn></dt>
 537:  <dd>A flag that is either true or false that indicates whether the
 538:  request is done asynchronously.</dd>
 539: 
 540:  <dt>The <dfn>request method</dfn></dt>
 541:  <dd>The method used in the request.</dd>
 542: 
 543:  <dt>The <dfn>request URL</dfn></dt>
 544:  <dd>The <span>URL</span> used in the request.</dd>
1.218 avankest 545: 
1.204 avankest 546:  <dt>The <dfn>request username</dfn></dt>
 547:  <dd>The username used in the request or null if there is no
 548:  username.</dd>
1.218 avankest 549: 
1.204 avankest 550:  <dt>The <dfn>request password</dfn></dt>
 551:  <dd>The password used in the request or null if there is no
 552:  password.</dd>
1.218 avankest 553: 
1.204 avankest 554:  <dt>The <dfn id="author-request-headers">author request headers</dfn></dt>
 555:  <dd>A list consisting of HTTP header name/value pairs to be used in the
 556:  request.</p>
1.203 avankest 557: 
1.204 avankest 558:  <dt>The <dfn>request entity body</dfn></dt>
1.218 avankest 559:  <dd>The <span>entity body</span> used in the request.</dd>
1.248 avankest 560:  
 561:  
1.204 avankest 562:  </dl>
1.203 avankest 563: 
1.248 avankest 564:  
 565: 
1.203 avankest 566: 
 567:  <h4>The <code title="">open()</code> method</h4>
1.88 avankest 568: 
1.203 avankest 569:  <p>When the <dfn id="open" title="open"><code>open(<var>method</var>,
 570:  <var title="">url</var>, <var>async</var>, <var>user</var>,
 571:  <var>password</var>)</code></dfn> method is invoked, the user agent
1.217 avankest 572:  <em class="ct">must</em> run these steps (unless otherwise indicated):</p>
1.90 avankest 573: 
1.88 avankest 574:  <ol>
1.203 avankest 575:  <li>
 576:   <p>If the <code>XMLHttpRequest</code> object has an associated
 577:   <span><code>XMLHttpRequest</code> <code>Document</code></span> run
 578:   these substeps:</p>
1.90 avankest 579: 
1.203 avankest 580:   <ol>
 581:   <li><p>If the
 582:   <span><code>XMLHttpRequest</code> <code>Document</code></span> is not
 583:   <span>fully active</span> raise an <code>INVALID_STATE_ERR</code>
 584:   exception and terminate the overall set of steps.</p></li>
 585: 
 586:   <li><p>Let <span><code>XMLHttpRequest</code> base URL</span> be the
 587:   <span>document base URL</span> of the
 588:   <span><code>XMLHttpRequest</code> <code>Document</code></span>.</p></li>
 589: 
 590:   <li><p>Let <span><code>XMLHttpRequest</code> origin</span> be the
 591:   <span>origin</span> of the
 592:   <span><code>XMLHttpRequest</code> <code>Document</code></span>.</p></li>
 593:   </ol>
 594:  </li>
1.90 avankest 595: 
1.256 avankest 596:  <li><p>If any code point in <var>method</var> is higher than
 597:  U+00FF LATIN SMALL LETTER Y WITH DIAERESIS or after
 598:  <span title="deflate a DOMString into an byte sequence">deflating</span>
 599:  <var>method</var> it does not match the
1.210 avankest 600:  <span>Method token</span> production raise a <code>SYNTAX_ERR</code>
1.256 avankest 601:  exception and terminate these steps. Otherwise let <var>method</var> be
 602:  the result of
 603:  <span title="deflate a DOMString into an byte sequence">deflating</span>
 604:  <var>method</var>.</p></li> <!-- This sounds lame, but it works. -->
1.118 avankest 605: 
1.115 avankest 606:  <li>
1.256 avankest 607:   <p>If <var>method</var> is a case-insensitive match for
1.203 avankest 608:   <code>CONNECT</code>, <code>DELETE</code>, <code>GET</code>,
 609:   <code>HEAD</code>, <code>OPTIONS</code>, <code>POST</code>,
 610:   <code>PUT</code>, <code>TRACE</code>, or <code>TRACK</code>
1.256 avankest 611:   subtract 0x20 from each byte in the range 0x61 (ASCII a) to
 612:   0x7A (ASCII z).</p>
1.118 avankest 613: 
1.203 avankest 614:   <p class="note">If it does not match any of the above, it is passed
 615:   through <em>literally</em>, including in the final request.</p>
1.115 avankest 616:  </li>
1.203 avankest 617:  <!-- WebKit (and supposedly Gecko) also uppercase: COPY, INDEX, LOCK,
 618:  M-POST, MKCOL, MOVE, PROPFIND, PROPPATCH, and UNLOCK. -->
1.118 avankest 619: 
1.111 avankest 620:  <li>
1.256 avankest 621:   <p>If <var>method</var> is a case-sensitive match for
1.259 avankest 622:   <code>CONNECT</code>, <code>TRACE</code>, or <code>TRACK</code> raise a
 623:   <code>SECURITY_ERR</code> exception and terminate these steps.</p>
1.117 avankest 624: 
1.203 avankest 625:   <p class="note">Allowing these methods poses a security risk.
 626:   [<cite><span>HTTPVERBSEC</span></cite>]</p>
1.111 avankest 627:  </li>
 628: 
1.203 avankest 629:  <li><p>Let <var title="">url</var> be a <span>URL</span>.</p></li>
 630: 
1.209 avankest 631:  <li><p>Let <span>URL character encoding</span> of <var title="">url</var>
 632:  be UTF-8.</p></li>
1.113 avankest 633: 
1.255 avankest 634:  <li><p><span title="Resolve a URL">Resolve</span> <var title="">url</var>
1.203 avankest 635:  relative to the <span><code>XMLHttpRequest</code> base URL</span>.
 636:  If the algorithm returns an error raise a <code>SYNTAX_ERR</code>
 637:  exception and terminate these steps.</p></li>
 638: 
 639:  <!-- Presto and Gecko override the encoding. WebKit does not. Trident
 640:  does not support non-ASCII URLs. This matters for the <query> component,
 641:  see HTML5. -->
 642: 
 643:  <li><p>Drop <code>&lt;fragment></code> from <var title="">url</var>.</p></li>
 644: 
 645:  <li><p>If <var title="">url</var> contains an unsupported <code>&lt;scheme></code>
 646:  raise a <code>NOT_SUPPORTED_ERR</code> and terminate these
 647:  steps.</p></li>
 648: 
 649:  <li><p>If the <code>"user:password"</code> format in the
 650:  <code>userinfo</code> production is not supported for the relevant scheme
 651:  and <var title="">url</var> contains this format raise a
 652:  <code>SYNTAX_ERR</code> and terminate these steps.</p></li>
 653: 
 654:  <li><p>If <var title="">url</var> contains the <code>"user:password"</code>
 655:  format let <var>temp user</var> be the user part and
 656:  <var>temp password</var> be the password part.</p></li>
 657: 
 658:  <li><p>If <var title="">url</var> just contains the <code>"user"</code>
 659:  format let <var>temp user</var> be the user part.</p></li>
 660: 
1.248 avankest 661:  
1.203 avankest 662:  <li><p>If the <span>origin</span> of <var title="">url</var> is not
 663:  <span>same origin</span> with the
1.259 avankest 664:  <span><code>XMLHttpRequest</code> origin</span> raise a
 665:  <code>SECURITY_ERR</code> exception and terminate these steps.</p></li>
1.248 avankest 666:  
 667:  
1.203 avankest 668: 
1.211 avankest 669:  <li><p>Let <var>async</var> be the value of the <var>async</var> argument
 670:  or <code>true</code> if it was omitted.</p></li>
1.203 avankest 671: 
 672:  <li>
 673:   <p>If the <var>user</var> argument was not omitted follow these sub
 674:   steps:</p>
1.90 avankest 675: 
1.203 avankest 676:   <ol>
 677:   <li><p>If the syntax of <var>user</var> does not match the syntax
 678:   specified by the relevant authentication scheme, raise a
 679:   <code>SYNTAX_ERR</code> exception and terminate the overall set of
 680:   steps.</p></li>
1.163 avankest 681: 
1.239 avankest 682:   <li><p>If <var>user</var> is null let <var>temp user</var>
1.203 avankest 683:   be null.</p></li>
1.90 avankest 684: 
1.203 avankest 685:   <li><p>Otherwise let <var>temp user</var> be <var>user</var>.</p></li>
 686:   </ol>
1.88 avankest 687: 
1.203 avankest 688:   <p class="note">These steps override anything that may have been set by
 689:   the <var title="">url</var> argument.</p>
 690:  </li>
1.88 avankest 691: 
1.128 avankest 692:  <li>
1.203 avankest 693:   <p>If the <var>password</var> argument was not omitted follow these sub
 694:   steps:</p>
 695: 
 696:   <ol>
 697:   <li><p>If the syntax of <var>password</var> does not match the syntax
 698:   specified by the relevant authentication scheme, raise a
 699:   <code>SYNTAX_ERR</code> exception and terminate the overall set of
 700:   steps.</p></li>
1.167 avankest 701: 
1.239 avankest 702:   <li><p>If <var>password</var> is null let
1.203 avankest 703:   <var>temp password</var> be null.</p></li>
 704: 
 705:   <li><p>Otherwise let <var>temp password</var> be
 706:   <var>password</var>.</p></li>
 707:   </ol>
 708: 
 709:   <p class="note">These steps override anything that may have been set by
 710:   the <var title="">url</var> argument.</p>
1.128 avankest 711:  </li>
1.88 avankest 712: 
1.203 avankest 713:  <li><p><span title="abort send()">Abort the <code>send()</code> algorithm</span>.</p></li>
 714: 
 715:  <li><p>The user agent <em class="ct">should</em> cancel any network
 716:  activity for which the object is responsible.</p></li>
 717:  <!-- we can hardly require it... -->
 718: 
1.252 avankest 719:  <li><p>If there are any <span title="task">tasks</span> from the object's
 720:  <span><code>XMLHttpRequest</code> task source</span> in one of the
 721:  <span>task queues</span>, then remove those tasks.</p></li>
 722: 
1.203 avankest 723:  <li>
 724:   <p>Set variables associated with the object as follows:</p>
 725: 
 726:   <ul>
 727:   <li><p>Set the <span><code>send()</code> flag</span> to false.</p></li>
 728: 
 729:   <li><p>Set <span>response entity body</span> to null.</p></li>
 730: 
 731:   <li><p>Empty the list of <span>author request headers</span>.</p>
 732: 
 733:   <li><p>Set the <span>request method</span> to <var>method</var>.</p></li>
 734: 
 735:   <li><p>Set the <span>request URL</span> to <var title="">url</var>.</p></li>
1.58 avankest 736: 
1.203 avankest 737:   <li><p>Set the <span>request username</span> to <var>temp user</var>.</p></li>
1.12 avankest 738: 
1.203 avankest 739:   <li><p>Set the <span>request password</span> to <var>temp password</var>.</p></li>
1.12 avankest 740: 
1.203 avankest 741:   <li><p>Set the <span>asynchronous flag</span> to true if <var>async</var> is
 742:   <code>true</code>. Otherwise set it to false.</p></li>
 743:   </ul>
 744:  </li>
1.58 avankest 745: 
1.203 avankest 746:  <li><p>Switch the the state to
 747:  <span title="OPENED state">OPENED</span>.</p></li>
1.58 avankest 748: 
1.203 avankest 749:  <li><p><span>Dispatch a <code>readystatechange</code> event</span>.</p></li>
 750:  </ol>
1.248 avankest 751:  
 752:  
1.203 avankest 753:  <p class="note">A future version or extension of this specification will
 754:  define a way of doing cross-origin requests.</p>
1.248 avankest 755:  
1.58 avankest 756: 
1.14 avankest 757: 
1.203 avankest 758:  <h4>The <code title="">setRequestHeader()</code> method</h4>
1.12 avankest 759: 
1.235 avankest 760:  <!-- XXX domintro authors
1.203 avankest 761:  The <code>setRequestHeader()</code> method can be used to set new request
1.184 avankest 762:   headers and append to request headers already in the list.</p>
1.203 avankest 763:  -->
1.45 avankest 764: 
1.203 avankest 765:  <p>As indicated in the algorithm below certain headers cannot be set and
 766:  are left up to the user agent. In addition there are certain other headers
 767:  the user agent will take control of if they are not set by the author as
 768:  indicated at the end of the <code>send()</code> method section.</p>
 769: 
 770:  <p class="note">The <code>setRequestHeader()</code> method appends a
 771:  value if the HTTP header given as argument is already part of the
 772:  <span>author request headers</span> list.</p>
 773: 
1.248 avankest 774:  
 775: 
1.203 avankest 776:  <p>When the
 777:  <dfn id="setrequestheader" title="setrequestheader"><code>setRequestHeader(<var>header</var>,
 778:  <var>value</var>)</code></dfn> method is invoked, the user agent
1.259 avankest 779:  <em class="ct">must</em> run these steps:</p>
1.14 avankest 780: 
1.203 avankest 781:  <ol>
 782:  <li><p>If the state is not <span title="OPENED state">OPENED</span> raise
 783:  an <code>INVALID_STATE_ERR</code> exception and terminate these
 784:  steps.</p></li>
 785: 
 786:  <li><p>If the <span><code>send()</code> flag</span> is true raise an
 787:  <code>INVALID_STATE_ERR</code> exception and terminate these
 788:  steps.</p></li>
 789: 
1.256 avankest 790:  <li><p>If any code point in <var>header</var> is higher than
 791:  U+00FF LATIN SMALL LETTER Y WITH DIAERESIS or after
 792:  <span title="deflate a DOMString into an byte sequence">deflating</span>
 793:  <var>header</var> it does not match the
 794:  <span>field-name</span> production raise a <code>SYNTAX_ERR</code>
 795:  exception and terminate these steps. Otherwise let <var>header</var> be
 796:  the result of
 797:  <span title="deflate a DOMString into an byte sequence">deflating</span>
 798:  <var>header</var>.</p></li> <!-- This sounds lame, but it works. -->
1.203 avankest 799: 
 800:  <li>
1.256 avankest 801:   <p>If any code point in <var>value</var> is higher than
 802:   U+00FF LATIN SMALL LETTER Y WITH DIAERESIS or after
 803:   <span title="deflate a DOMString into an byte sequence">deflating</span>
 804:   <var>value</var> it does not match the
 805:   <span>field-value</span> production raise a <code>SYNTAX_ERR</code>
 806:   exception and terminate these steps. Otherwise let <var>value</var> be
 807:   the result of
 808:   <span title="deflate a DOMString into an byte sequence">deflating</span>
 809:   <var>value</var>.</p> <!-- This sounds lame, but it works. -->
1.203 avankest 810: 
 811:   <p class="note">The empty string is legal and represents the empty
 812:   header value.</p>
 813:  </li>
 814: 
 815:  <li>
1.259 avankest 816:   <p>Terminate these steps if <var>header</var> is a case-insensitive
 817:   match for one of the following headers:</p>
1.203 avankest 818: 
 819:   <ul>
 820:   <li><code>Accept-Charset</code></li>
 821:   <li><code>Accept-Encoding</code></li>
 822:   <li><code>Connection</code></li>
 823:   <li><code>Content-Length</code></li>
 824:   <li><code>Cookie</code></li>
 825:   <li><code>Cookie2</code></li>
 826:   <li><code>Content-Transfer-Encoding</code></li>
 827:   <li><code>Date</code></li>
 828:   <li><code>Expect</code></li>
 829:   <li><code>Host</code></li>
 830:   <li><code>Keep-Alive</code></li>
 831:   <li><code>Referer</code></li>
 832:   <li><code>TE</code></li>
 833:   <li><code>Trailer</code></li>
 834:   <li><code>Transfer-Encoding</code></li>
 835:   <li><code>Upgrade</code></li>
 836:   <li><code>User-Agent</code></li>
 837:   <li><code>Via</code></li>
 838:   </ul>
1.96 avankest 839: 
1.256 avankest 840:   <p>&hellip; or if the start of <var>header</var> is a case-insensitive
 841:   match for <code>Proxy-</code> or <code>Sec-</code> (including when
 842:   <var>header</var> is just <code>Proxy-</code> or <code>Sec-</code>).</p>
1.203 avankest 843: 
 844:   <p class="note">The above headers are not allowed to be set as they are
 845:   better controlled by the user agent as it knows best what value they
1.259 avankest 846:   ought to have. Header names starting with <code>Sec-</code> are not
1.203 avankest 847:   allowed to be set to allow new headers to be minted in the future that
 848:   are guaranteed not to come from <code>XMLHttpRequest</code>. (Older
 849:   clients would however still be vulnerable as they allow such headers to
 850:   be set.)</p>
 851:  </li>
1.14 avankest 852: 
1.203 avankest 853:  <li><p>If <var>header</var> is not in the
 854:  <span>author request headers</span> list append <var>header</var> with
 855:  its associated <var>value</var> to the list and terminate these
 856:  steps.</p></li>
 857: 
 858:  <li><p>If <var>header</var> is in the <span>author request headers</span>
 859:  list either use multiple headers, combine the values or use a combination
 860:  of those (section 4.2, RFC 2616).
 861:  [<cite><span>RFC2616</span></cite>]</p></li>
 862:  <!-- XXX it seems UAs always combine the values -->
 863:  </ol>
1.45 avankest 864: 
1.203 avankest 865:  <p class="note">See also the <code>send()</code> method regarding user
 866:  agent header handling for caching, authentication, proxies, and
 867:  cookies.</p>
1.14 avankest 868: 
1.203 avankest 869:  <div class="example">
 870:  <pre><code>// The following script:
1.14 avankest 871: var client = new XMLHttpRequest();
 872: client.open('GET', 'demo.cgi');
 873: client.setRequestHeader('X-Test', 'one');
 874: client.setRequestHeader('X-Test', 'two');
 875: client.send();
 876: 
 877: // ...would result in the following header being sent:
 878: ...
 879: X-Test: one, two
1.58 avankest 880: ...</code></pre>
1.203 avankest 881:  </div>
1.255 avankest 882: 
1.248 avankest 883:  
1.218 avankest 884: 
1.203 avankest 885: 
 886:  <h4>The <code title="">send()</code> method</h4>
1.12 avankest 887: 
1.235 avankest 888:  <!-- XXX domintro
1.203 avankest 889:  <p>The <code>send()</code> method initiates the request and its optional
1.204 avankest 890:  argument provides the <span>request entity body</span>.</p>
1.235 avankest 891:  -->
1.203 avankest 892: 
 893:  <p>When the
 894:  <dfn id="send" title="send"><code>send(<var>data</var>)</code></dfn>
 895:  method is invoked, the user agent <em class="ct">must</em> run the
 896:  following steps (unless otherwise noted). This algorithm gets aborted when
 897:  the <code>open()</code> or <code>abort()</code> method is invoked. When
 898:  the
 899:  <dfn title="abort send()" id="abort-send-algorithm"><code>send()</code> algorithm is aborted</dfn>
 900:  the user agent <em class="ct">must</em> terminate the algorithm after
 901:  finishing the step it is on.</p>
 902: 
 903:  <p class="note">The <code title="">send()</code> algorithm can only be
 904:  aborted when the <span>asynchronous flag</span> is true and only after the
 905:  method call has returned.</p>
1.181 avankest 906: 
1.203 avankest 907:  <ol>
 908:  <li><p>If the state is not <span title="OPENED state">OPENED</span> raise
 909:  an <code>INVALID_STATE_ERR</code> exception and terminate these
 910:  steps.</p></li>
 911: 
 912:  <li><p>If the <span><code>send()</code> flag</span> is true raise an
 913:  <code>INVALID_STATE_ERR</code> exception and terminate these
 914:  steps.</p></li>
1.58 avankest 915: 
1.203 avankest 916:  <li>
 917:   <p>If the <span>request method</var> is <code>GET</code> or
1.239 avankest 918:   <code>HEAD</code> act as if <var>data</var> is null.</p>
1.232 avankest 919:   
 920:   <p>If the <var>data</var> argument has been omitted or is
1.239 avankest 921:   null, do not include a <span>request entity body</span>
1.232 avankest 922:   and go to the next step.</p>
1.248 avankest 923: 
 924:   <p>Otherwise, let <var>encoding</var> be null, <var>mime type</var> be
 925:   null, and then follow these rules:</p>
1.203 avankest 926: 
 927:   <dl class="switch">
1.248 avankest 928:   
 929:   
 930:   <dt>If <var>data</var> is a <code>Document</code>
1.203 avankest 931: 
 932:   <dd>
1.232 avankest 933:    <p>Let <var>encoding</var> be the <span>preferred MIME name</span> of
 934:    the
 935:    <span title="document's character encoding">character encoding</span>
 936:    of <var>data</var>. If <var>encoding</var> is UTF-16 change it to
 937:    UTF-8.</p>
 938:    
1.248 avankest 939:    <p>Let <var>mime type</var> be "<code>application/xml;charset=</code>"
 940:    followed by <var>encoding</var>.</p>
1.232 avankest 941: 
 942:    <p>Let the <span>request entity body</span> be the result of getting
 943:    the <code title="dom-innerHTML">innerHTML</code> attribute on
1.233 avankest 944:    <var>data</var>
 945:    <span title="convert a DOMString to a sequence of Unicode characters">converted to Unicode</span>
 946:    and encoded as <var>encoding</var>. Re-raise any exception this
 947:    raises.</p>
1.218 avankest 948: 
1.233 avankest 949:    <p class="note">In particular, if the document cannot be serialized an
1.217 avankest 950:    <code>INVALID_STATE_ERR</code> exception is raised.</p>
 951: 
1.203 avankest 952:    <p class="note">Subsequent changes to the <code>Document</code> have
 953:    no effect on what is submitted.</p>
 954:   </dd>
1.237 avankest 955: 
1.248 avankest 956:   <dt>If <var>data</var> is a <code>DOMString</code></dt>
1.237 avankest 957: 
1.248 avankest 958:   <dd>
 959:    <p>Let <var>encoding</var> be UTF-8.</p>
 960:    
 961:    <p>Let <var>mime type</var> be "<code>text/plain;charset=UTF-8</code>".</p>
 962: 
 963:    <p>Let the <span>request entity body</span> be <var>data</var>
 964:    <span title="convert a DOMString to a sequence of Unicode characters">converted to Unicode</span>
 965:    and encoded as UTF-8.</p>
 966:   </dd>
 967: 
 968:   
1.203 avankest 969:   </dl>
1.58 avankest 970: 
1.232 avankest 971:   <p>If a <code>Content-Type</code> header is set using
1.248 avankest 972:   <code>setRequestHeader()</code> whose value is a
 973:   <span>valid MIME type</span> and has a <code>charset</code>
1.256 avankest 974:   parameter whose value is not a case-insensitive match for
 975:   <var>encoding</var>, and <var>encoding</var> is not null, set all the
 976:   <code>charset</code> parameters of the <code>Content-Type</code> header
 977:   to <var>encoding</var>.</p>
1.232 avankest 978: 
 979:   <p>If no <code>Content-Type</code> header has been set using
1.248 avankest 980:   <code>setRequestHeader()</code> and <var>mime type</var> is not null set
 981:   a <code>Content-Type</code> request header with as value
 982:   <var>mime type</var>.</p>
1.236 avankest 983: 
 984:   <!-- reminder: if we ever change this to always include charset it has
 985:   to be included as the first parameter for compatibility reasons -->
1.203 avankest 986:  </li>
1.202 avankest 987: 
1.203 avankest 988:  <li><p>If the <span>asynchronous flag</span> is false release the
 989:  <span>storage mutex</span>.</p></li>
1.103 avankest 990: 
1.248 avankest 991:  
 992: 
1.203 avankest 993:  <li><p>Set the <span>error flag</span> to false.</p></li>
1.218 avankest 994: 
1.248 avankest 995:  
 996: 
1.211 avankest 997:  <li>
 998:   <p>If the <span>asynchronous flag</span> is true run these substeps:</p>
1.218 avankest 999: 
1.211 avankest 1000:   <ol>
1.217 avankest 1001:   <li><p>Set the <span><code>send()</code> flag</span> to true.</p></li>
 1002: 
1.211 avankest 1003:   <li>
 1004:    <p><span>Dispatch a <code>readystatechange</code> event</span>.</p>
1.145 avankest 1005: 
1.211 avankest 1006:    <p class="note">The state does not change. The event is dispatched for
 1007:    historical reasons.</p>
 1008:   </li>
 1009: 
1.248 avankest 1010:   
 1011: 
1.211 avankest 1012:   <li><p>Return the <code>send()</code> method call, but continue running
 1013:   the steps in this algorithm.</p></li>
 1014:   </ol>
 1015:  </li>
1.218 avankest 1016: 
1.203 avankest 1017:  <li>
1.248 avankest 1018:   
1.211 avankest 1019: 
1.260 ! avankest 1020:    <p><span>Fetch</span> <span>request URL</span> from
 ! 1021:    <i title="">origin</i>
 ! 1022:    <span><code>XMLHttpRequest</code> origin</span>, with the
 ! 1023:    <i title="">synchronous flag</i> set if the
 ! 1024:    <span>asynchronous flag</span> is false, using HTTP method
1.248 avankest 1025:    <span>request method</span>, user <span>request username</span> (if
 1026:    non-null) and password <span>request password</span> (if non-null),
 1027:    taking into account the <span>request entity body</span>, list of
 1028:    <span>author request headers</span> and the rules listed at the end of
 1029:    this section.</p>
 1030: 
 1031:    <dl class="switch">
 1032:    <dt>If the <span>asynchronous flag</span> is false</dt>
 1033:    <dd>
 1034:     <p>While making the request also follow the
 1035:     <span>same-origin request event rules</span>.</p>
 1036: 
 1037:     <!--
 1038:     This cannot involve any task queue whatsoever because that would
 1039:     mean other tasks on the task queue might get processed as well
 1040:     which is counter to the whole idea of doing things synchronous.
 1041:     -->
 1042: 
 1043:     <p class="note">The <code>send()</code> method call will now be
 1044:     returned by virtue of this algorithm ending.</p>
 1045:    </dd>
 1046: 
 1047:    <dt>If the <span>asynchronous flag</span> is true</dt>
 1048:    <dd>
 1049:     <p><span>Make progress notifications</span>.</p>
 1050: 
 1051:     <p><span>Make upload progress notifications</span>.</p>
 1052: 
 1053:     <p>While processing the request, as data becomes available and when
 1054:     the user interferes with the request,
1.255 avankest 1055:     <span title="queue a task">queue tasks</span> to update the
 1056:     <span>response entity body</span> and follow the
1.254 avankest 1057:     <span>same-origin request event rules</span>.</p>
1.248 avankest 1058:    </dd>
 1059:    </dl>
 1060:   
1.203 avankest 1061:  </li>
 1062:  </ol>
1.60 avankest 1063: 
1.203 avankest 1064:  <hr>
 1065: 
1.227 avankest 1066:  <p>If the user agent allows the end user to configure a proxy it
1.248 avankest 1067:  <em class="ct">should</em> modify the request appropriately; i.e., connect
 1068:  to the proxy host instead of the origin server, modify the
 1069:  <code>Request-Line</code> and send <code>Proxy-Authorization</code>
 1070:  headers as specified.</p>
1.212 avankest 1071: 
1.218 avankest 1072:  <p>If the user agent supports HTTP Authentication and
 1073:  <code>Authorization</code> is not in the list of
 1074:  <span>author request headers</span>, it <em class="ct">should</em>
 1075:  consider requests originating from the <code>XMLHttpRequest</code> object
 1076:  to be part of the protection space that includes the accessed URIs and
 1077:  send <code>Authorization</code> headers and handle
 1078:  <code>401 Unauthorized</code> requests appropriately. If authentication
1.247 avankest 1079:  fails, and <span>request username</span> and <span>request password</span>
1.227 avankest 1080:  are both null, user agents <em class="ct">should</em> prompt the end user
 1081:  for credentials. If authentication fails, and
 1082:  <span>request username</span> and <span>request password</span> are
 1083:  provided, user agents <em class="ct">must not</em> prompt the end user for
 1084:  credentials. [<cite><span>RFC2617</span></cite>]</p>
1.212 avankest 1085: 
1.227 avankest 1086:  <p class="note">End users are not prompted if credentials are provided
1.212 avankest 1087:  through the <code>open()</code> API so that authors can implement their
 1088:  own user interface.</p>
 1089: 
 1090:  <p>If the user agent supports HTTP State Management it
 1091:  <em class="ct">should</em> persist, discard and send cookies (as received
 1092:  in the <code>Set-Cookie</code> and <code>Set-Cookie2</code> response
 1093:  headers, and sent in the <code>Cookie</code> header) as applicable.
 1094:  [<cite><span>COOKIES</span></cite>]</p>
 1095: 
 1096:  <p>If the user agent implements a HTTP cache it <em class="ct">should</em>
1.248 avankest 1097:  respect <code>Cache-Control</code> request headers set by the
 1098:  <code>setRequestHeader()</code> (e.g., <code>Cache-Control:
 1099:  no-cache</code> bypasses the cache). It <em class="ct">must not</em> send
1.212 avankest 1100:  <code>Cache-Control</code> or <code>Pragma</code> request headers
1.227 avankest 1101:  automatically unless the end user explicitly requests such behavior
1.212 avankest 1102:  (e.g. by (force-)reloading the page).</p>
 1103: 
 1104:  <p>For <code>304 Not Modified</code> responses that are a result of a
 1105:  user agent generated conditional request the user agent
 1106:  <em class="ct">must</em> act as if the server gave a <code>200 OK</code>
 1107:  response with the appropriate content. The user agent
 1108:  <em class="ct">must</em> allow <code>setRequestHeader()</code> to
1.248 avankest 1109:  override automatic cache validation by setting request headers (e.g.
 1110:  <code>If-None-Match</code> or <code>If-Modified-Since</code>), in which
1.212 avankest 1111:  case <code>304 Not Modified</code> responses <em class="ct">must</em> be
 1112:  passed through. [<cite><span>RFC2616</span></cite>]</p>
 1113: 
 1114:  <p>If the user agent implements server-driven content-negotiation
 1115:  it <em class="ct">should</em> set <code>Accept-Encoding</code> and
1.231 avankest 1116:  <code>Accept-Charset</code> headers as appropriate. For
 1117:  <code>Accept</code> and <code>Accept-Language</code> the user agent
 1118:  <em class="ct">must</em> follow these constraints:</p>
 1119: 
 1120:  <ul>
 1121:  <li><p>Both headers <em class="ct">must not</em> be modified if they are
 1122:  already set through <code>setRequestHeader()</code>.</p></li>
1.255 avankest 1123: 
1.231 avankest 1124:  <li><p>If not set through <code>setRequestHeader()</code>
1.255 avankest 1125:  <code>Accept-Language</code> <em class="ct">should</em> be set as
1.231 avankest 1126:  appropriate.</p></li>
 1127: 
 1128:  <li><p>If not set through <code>setRequestHeader()</code>
 1129:  <code>Accept</code> <em class="ct">must</em> be set with as value
 1130:  <code>*/*</code>.</p></li>
 1131:  </ul>
 1132: 
 1133:  <p>Responses <em class="ct">must</em> have the content-encodings
 1134:  automatically decoded. [<cite><span>RFC2616</span></cite>]</p>
1.212 avankest 1135: 
 1136:  <p>Besides the <span>author request headers</span> user agents
 1137:  <em class="ct">should not</em> include additional request headers other
1.248 avankest 1138:  than those mentioned above or other than those authors are not allowed to
 1139:  set using <code>setRequestHeader()</code>. This ensures that authors have
 1140:  a reasonably predictable API.</p>
1.218 avankest 1141: 
1.212 avankest 1142: 
 1143:  <h4>Infrastructure for the <code title="">send()</code> method</h4>
1.216 avankest 1144: 
1.219 avankest 1145:  <p>The <dfn>same-origin request event rules</dfn> are as follows:</p>
1.118 avankest 1146: 
1.203 avankest 1147:  <dl class="switch">
 1148:  <dt>If the response is an HTTP redirect</dt>
 1149:  <dd>
1.248 avankest 1150:   
1.257 avankest 1151:   <p>If the <span>origin</span> of the <span>URL</span> conveyed by the
 1152:   <code title="http-location">Location</code> header is
 1153:   <span>same origin</span> with the
 1154:   <span><code>XMLHttpRequest</code> origin</span> and the redirect does
 1155:   not violate infinite loop precautions, transparently follow the redirect
 1156:   while observing the <span>same-origin request event rules</span>.</p>
1.248 avankest 1157:   
 1158:   <p>Otherwise, this is a <span>network error</span>.</p>
 1159:   
 1160:   
1.203 avankest 1161: 
 1162:   <p class="note">HTTP places requirements on the user agent regarding the
1.204 avankest 1163:   preservation of the <span>request method</span> and
1.248 avankest 1164:   <span>request entity body</span> during redirects, and also requires end
 1165:   users to be notified of certain kinds of automatic redirections.</p>
1.203 avankest 1166:   <!-- XXX HTTP needs fixing here -->
1.213 avankest 1167:  </dd>
1.121 avankest 1168: 
1.227 avankest 1169:  <dt>If the end user cancels the download</dt>
1.213 avankest 1170:  <dd><p>This is an <span>abort error</span>.</p></dd>
1.60 avankest 1171: 
1.214 avankest 1172:  <dt>In case of network errors</dt>
1.213 avankest 1173:  <dd>
 1174:   <p>In case of DNS errors, TLS negotiation failure, or other type of
 1175:   network errors, this is a <span>network error</span>. Do not request any
1.227 avankest 1176:   kind of end user interaction.</p>
1.121 avankest 1177: 
1.213 avankest 1178:   <p class="note">This does not include HTTP responses that indicate
 1179:   some type of error, such as HTTP status code 410.</p>
 1180:  </dd>
1.60 avankest 1181: 
1.248 avankest 1182:  
 1183: 
1.213 avankest 1184:  <dt>Once all HTTP headers have been received and the
1.257 avankest 1185:  <span>asynchronous flag</span> is true (and this is not an HTTP
 1186:  redirect)</dt>
1.213 avankest 1187:  <dd><p><span>Switch to the HEADERS_RECEIVED state</span>.</p></dd>
1.186 avankest 1188: 
1.220 avankest 1189:  <dt>Once the first byte (or more) of the
 1190:  <span>response entity body</span> has been received and the
 1191:  <span>asynchronous flag</span> is true</dt>
 1192:  <dt>If there is no <span>response entity body</span> and the
1.213 avankest 1193:  <span>asynchronous flag</span> is true</dt>
1.215 avankest 1194:  <dd><p><span>Switch to the LOADING state</span>.</p></dd>
1.220 avankest 1195:  
 1196:  <dt>Once the whole <span>response entity body</span> has been
 1197:  received</dt>
1.224 avankest 1198:  <dt>If there is no <span>response entity body</span> and the
 1199:  <span>asynchronous flag</span> is false or the state is
1.221 avankest 1200:  <span title="LOADING state">LOADING</span></dt>
1.220 avankest 1201:  <dd><p><span>Switch to the DONE state</span>.</p></dd>
1.213 avankest 1202:  </dl>
1.218 avankest 1203: 
1.248 avankest 1204:  
 1205: 
1.213 avankest 1206:  <hr>
1.218 avankest 1207: 
1.241 avankest 1208:  <p>When something is said to be a <dfn>network error</dfn> run the
 1209:  <span>request error</span> steps for exception
 1210:  <code>NETWORK_ERR</code>.</p>
 1211: 
 1212:  <p>When something is said to be an <dfn>abort error</dfn> run the
 1213:  <span>request error</span> steps for exception
 1214:  <code>ABORT_ERR</code>.</p>
1.60 avankest 1215: 
1.248 avankest 1216:  
 1217: 
1.242 avankest 1218:  <p>When something is said to be a <dfn>request error</dfn> for
1.248 avankest 1219:  exception <var>exception</var> run these
 1220:  steps:</p>
1.12 avankest 1221: 
1.213 avankest 1222:  <ol>
1.254 avankest 1223:  <li><p>The user agent <em class="ct">should</em> cancel any network
 1224:  activity for which the object is responsible.</p></li>
 1225: 
 1226:  <li><p>If there are any <span title="task">tasks</span> from the object's
 1227:  <span><code>XMLHttpRequest</code> task source</span> in one of the
 1228:  <span>task queues</span>, then remove those tasks.</p></li>
1.250 avankest 1229: 
1.213 avankest 1230:  <li><p>Set the <span>response entity body</span> to null.</p></li>
1.203 avankest 1231: 
1.254 avankest 1232:  <li><p>Empty the list of <span>author request headers</span>.</p></li>
 1233: 
1.213 avankest 1234:  <li><p>Set the the <span>error flag</span> to true.</p></li>
1.12 avankest 1235: 
1.213 avankest 1236:  <li><p>Switch the state to <span title="DONE state">DONE</span>.</p></li>
1.203 avankest 1237: 
1.241 avankest 1238:  <li><p>If the <span>asynchronous flag</span> is false raise an
 1239:  <var>exception</var> exception and terminate the overall set of
1.213 avankest 1240:  steps.</p></li>
1.203 avankest 1241: 
1.248 avankest 1242:  <li>
1.249 avankest 1243:   <p><span>Dispatch a <code>readystatechange</code> event</span>.</p>
1.248 avankest 1244: 
 1245:   <p class="note">At this point it is clear that the
 1246:   <span>asynchronous flag</span> is true.</p>
 1247:  </li>
 1248: 
 1249:  
1.203 avankest 1250: 
1.248 avankest 1251:  <li><p>Terminate the overall algorithm.</p></li>
1.213 avankest 1252:  </ol>
1.203 avankest 1253: 
1.248 avankest 1254:  
 1255:  <p class="note">A future version of this specification will dispatch an
 1256:  <code>error</code>/<code>abort</code> event here as well. (Depending on
 1257:  the type of error.)</p>
 1258:  
1.203 avankest 1259: 
1.213 avankest 1260:  <hr>
1.203 avankest 1261: 
1.213 avankest 1262:  <p>When it is said to
 1263:  <dfn id="switch-headers-received">switch to the HEADERS_RECEIVED state</dfn>
 1264:  run these steps:</p>
1.203 avankest 1265: 
1.213 avankest 1266:  <ol>
 1267:  <li><p>Switch the state to <span title="HEADERS_RECEIVED state">HEADERS_RECEIVED</span>.</p></li>
1.203 avankest 1268: 
1.249 avankest 1269:  <li><p><span>Dispatch a <code>readystatechange</code> event</span>.</p></li>
1.213 avankest 1270:  </ol>
1.218 avankest 1271: 
1.213 avankest 1272:  <p>When it is said to
 1273:  <dfn id="switch-loading">switch to the LOADING state</dfn> run these
 1274:  steps:</p>
1.218 avankest 1275: 
1.213 avankest 1276:  <ol>
 1277:  <li><p>Switch the state to <span title="LOADING state">LOADING</span>.</p></li>
1.203 avankest 1278: 
1.249 avankest 1279:  <li><p><span>Dispatch a <code>readystatechange</code> event</span>.</p></li>
1.213 avankest 1280:  </ol>
1.218 avankest 1281: 
1.216 avankest 1282:  <p>When it is said to
 1283:  <dfn id="switch-done">switch to the DONE state</dfn> run these steps:</p>
1.218 avankest 1284: 
1.216 avankest 1285:  <ol>
1.255 avankest 1286:  <li><p>If the <span>asynchronous flag</span> is false update the
 1287:  <span>response entity body</span>.</p></li>
 1288: 
1.216 avankest 1289:  <li><p>Switch the state to <span title="DONE state">DONE</span>.</p></li>
 1290: 
1.248 avankest 1291:  <li><p><span>Dispatch a <code>readystatechange</code> event</span>.</p></li>
 1292: 
1.220 avankest 1293:  
1.216 avankest 1294:  </ol>
1.218 avankest 1295: 
1.248 avankest 1296:  
 1297: 
1.203 avankest 1298: 
 1299:  <h4>The <code title="">abort()</code> method</h4>
 1300: 
 1301:  <p>When the <dfn id="abort"><code>abort()</code></dfn> method is invoked,
1.217 avankest 1302:  the user agent <em class="ct">must</em> run these steps (unless otherwise
 1303:  noted):</p>
1.12 avankest 1304: 
1.203 avankest 1305:  <ol>
 1306:  <li><p><span title="abort send()">Abort the <code>send()</code> algorithm</span>.</p></li>
 1307: 
 1308:  <li><p>The user agent <em class="ct">should</em> cancel any network
 1309:  activity for which the object is responsible.</p></li>
1.252 avankest 1310: 
 1311:  <li><p>If there are any <span title="task">tasks</span> from the object's
 1312:  <span><code>XMLHttpRequest</code> task source</span> in one of the
 1313:  <span>task queues</span>, then remove those tasks.</p></li>
1.203 avankest 1314: 
 1315:  <li><p>Set the <span>response entity body</span> to null.</p></li>
 1316: 
1.252 avankest 1317:  <li><p>Empty the list of <span>author request headers</span>.</p></li>
 1318: 
1.203 avankest 1319:  <li><p>Set the <span>error flag</span> to true.</p></li>
 1320: 
 1321:  <li>
 1322:   <p>If the state is <span title="UNSENT state">UNSENT</span>,
 1323:   <span title="OPENED state">OPENED</span> with the
 1324:   <span><code>send()</code> flag</span> being false, or
 1325:   <span title="DONE state">DONE</span> go to the next step.</p>
1.12 avankest 1326: 
1.203 avankest 1327:   <p>Otherwise run these substeps:</p>
1.58 avankest 1328: 
 1329:   <ol>
1.203 avankest 1330:   <li><p>Switch the state to <span title="DONE state">DONE</span>.</p></li>
1.170 avankest 1331: 
1.203 avankest 1332:   <li><p>Set the <span><code>send()</code> flag</span> to false.</p></li>
1.96 avankest 1333: 
1.203 avankest 1334:   <li><p><span>Dispatch a <code>readystatechange</code> event</span>.</p></li>
1.248 avankest 1335: 
 1336:   
1.58 avankest 1337:   </ol>
1.250 avankest 1338: 
1.248 avankest 1339:   
1.250 avankest 1340:   <p class="note">A future version of this specification will dispatch an
 1341:   <code title="abort-event">abort</code> event here.</p>
1.248 avankest 1342:   
1.203 avankest 1343:  </li>
 1344: 
 1345:  <li>
 1346:   <p>Switch the state to <span title="UNSENT state">UNSENT</span>.</p>
 1347: 
 1348:   <p class="note">No <code>readystatechange</code> event is dispatched.</p>
 1349:  </li>
 1350:  </ol>
 1351: 
 1352: 
 1353: 
1.205 avankest 1354:  <h3 id="response">Response</h3>
1.203 avankest 1355: 
 1356:  <h4>The <code title="">status</code> attribute</h4>
 1357: 
 1358:  <p>The <dfn id="status"><code>status</code></dfn> attribute
1.222 avankest 1359:  <em class="ct">must</em> return the result of running these steps:</p>
1.226 avankest 1360: 
1.222 avankest 1361:  <ol>
 1362:  <li><p>If the state is <span title="UNSENT state">UNSENT</span> or
1.239 avankest 1363:  <span title="OPENED state">OPENED</span> return 0 and terminate these
1.222 avankest 1364:  steps.</p></li>
 1365: 
1.239 avankest 1366:  <li><p>If the <span>error flag</span> is true return 0 and terminate
 1367:  these steps.</p></li>
1.222 avankest 1368:  
 1369:  <li><p>Return the HTTP status code.</p></li>
1.248 avankest 1370:  </ol> 
1.203 avankest 1371: 
 1372: 
 1373:  <h4>The <code title="">statusText</code> attribute</h4>
 1374: 
 1375:  <p>The <dfn id="statustext"><code>statusText</code></dfn> attribute
1.222 avankest 1376:  <em class="ct">must</em> return the result of running these steps:</p>
 1377:  
 1378:  <ol>
 1379:  <li><p>If the state is <span title="UNSENT state">UNSENT</span> or
1.239 avankest 1380:  <span title="OPENED state">OPENED</span> return the empty string and
 1381:  terminate these steps.</p></li>
1.222 avankest 1382: 
 1383:  <li><p>If the <span>error flag</span> is true return the empty string and
 1384:  terminate these steps.</p></li>
 1385:  
 1386:  <li><p>Return the HTTP status text.</p></li>
 1387:  </ol>
1.203 avankest 1388: 
 1389: 
 1390:  <h4>The <code title="">getResponseHeader()</code> method</h4>
 1391: 
 1392:  <p>When the
 1393:  <dfn id="getresponseheader" title="getresponseheader"><code>getResponseHeader(<var>header</var>)</code></dfn>
1.217 avankest 1394:  is invoked, the user agent <em class="ct">must</em> run these steps:</p>
1.203 avankest 1395: 
 1396:  <ol>
 1397:  <li><p>If the state is <span title="UNSENT state">UNSENT</span> or
1.239 avankest 1398:  <span title="OPENED state">OPENED</span> return null and terminate these
1.203 avankest 1399:  steps.</p></li>
 1400: 
1.239 avankest 1401:  <li><p>If the <span>error flag</span> is true return null
1.203 avankest 1402:  and terminate these steps.</p></li>
 1403: 
1.256 avankest 1404:  <li><p>If any code point in <var>header</var> is higher than
 1405:  U+00FF LATIN SMALL LETTER Y WITH DIAERESIS return null and terminate
 1406:  these steps.</p></li>
 1407:  
 1408:  <li><p>Let <var>header</var> be the result of
 1409:  <span title="deflate a DOMString into an byte sequence">deflating</span>
 1410:  <var>header</var>.</p></li> <!-- This sounds lame, but it works. -->
 1411: 
 1412:  <li><p>If <var>header</var> is a case-insensitive match for
 1413:  <code>Set-Cookie</code> or <code>Set-Cookie2</code> return null and
 1414:  terminate these steps.</p></li>
1.203 avankest 1415: 
1.256 avankest 1416:  <li><p>If <var>header</var> is a case-insensitive match for multiple HTTP
 1417:  response headers, return the
 1418:  <span title="inflate an byte sequence into a DOMString">inflated</span>
 1419:  values of these headers as a single concatenated string separated from
 1420:  each other by a U+002C COMMA U+0020 SPACE character pair and terminate
 1421:  these steps.</p></li>
1.203 avankest 1422: 
1.256 avankest 1423:  <li><p>If <var>header</var> is a case-insensitive match for a single HTTP
 1424:  response header, return the
 1425:  <span title="inflate an byte sequence into a DOMString">inflated</span>
 1426:  value of that header and terminate these steps.</p></li>
1.203 avankest 1427: 
1.239 avankest 1428:  <li><p>Return null.</p></li>
1.203 avankest 1429:  </ol>
 1430: 
1.248 avankest 1431:  
 1432: 
1.203 avankest 1433:  <div class="example">
1.250 avankest 1434:  
 1435:  <p>For the following script:</p>
 1436: 
 1437:  <pre><code>var client = new XMLHttpRequest();
 1438: client.open("GET", "unicorns-are-teh-awesome.txt", true);
1.5 avankest 1439: client.send();
1.12 avankest 1440: client.onreadystatechange = function() {
1.250 avankest 1441:  if(this.readyState == 2) {
 1442:   print(client.getResponseHeader("Content-Type"));
 1443:  }
 1444: }</code></pre>
 1445: 
 1446:  <p>The <code>print()</code> function will get to process something
 1447:  like:</p>
1.5 avankest 1448: 
1.250 avankest 1449:  <pre><code>text/plain; charset=UTF-8</code></pre>
1.203 avankest 1450:  </div>
1.12 avankest 1451: 
 1452: 
1.203 avankest 1453:  <h4>The <code title="">getAllResponseHeaders()</code> method</h4>
1.14 avankest 1454: 
1.203 avankest 1455:  <p>When the
 1456:  <dfn id="getallresponseheaders"><code>getAllResponseHeaders()</code></dfn>
 1457:  method is invoked, the user agent <em class="ct">must</em> run the
 1458:  following steps:</p>
1.58 avankest 1459: 
1.203 avankest 1460:  <ol>
 1461:  <li><p>If the state is <span title="UNSENT state">UNSENT</span> or
1.239 avankest 1462:  <span title="OPENED state">OPENED</span> return the empty string and
 1463:  terminate these steps.</p></li>
1.203 avankest 1464: 
 1465:  <li><p>If the <span>error flag</span> is true return the empty string and
 1466:  terminate these steps.</p></li>
 1467: 
1.256 avankest 1468:  <li><p>Return all the HTTP headers, excluding headers that are a
 1469:  case-insensitive match for <code>Set-Cookie</code> or
 1470:  <code>Set-Cookie2</code>,
 1471:  <span title="inflate an byte sequence into a DOMString">inflated</span>,
 1472:  as a single string, with each header line
 1473:  separated by a U+000D CR U+000A LF pair, excluding the status line, and
1.203 avankest 1474:  with each header name and header value separated by a
 1475:  U+003A COLON U+0020 SPACE pair.</p></li>
 1476:  </ol>
1.58 avankest 1477: 
1.250 avankest 1478:  
 1479: 
1.203 avankest 1480:  <div class="example">
1.250 avankest 1481:  <p>For the following script:</p>
 1482:  
 1483:  <pre><code>var client = new XMLHttpRequest();
 1484: client.open("GET", "narwhals-too.txt", true);
1.5 avankest 1485: client.send();
1.12 avankest 1486: client.onreadystatechange = function() {
1.179 avankest 1487: if(this.readyState == 2) {
1.203 avankest 1488:  print(this.getAllResponseHeaders());
1.12 avankest 1489: }
1.250 avankest 1490: }</code></pre>
 1491: 
 1492:  <p>The <code>print()</code> function will get to process something
 1493:  like:</p>
1.1 avankest 1494: 
1.250 avankest 1495:  <pre><code>Date: 2004年10月24日 04:58:38 GMT
1.203 avankest 1496: Server: Apache/1.3.31 (Unix)
 1497: Keep-Alive: timeout=15, max=99
 1498: Connection: Keep-Alive
 1499: Transfer-Encoding: chunked
 1500: Content-Type: text/plain; charset=utf-8</code></pre>
 1501:  </div>
 1502: 
1.250 avankest 1503: 
1.203 avankest 1504: 
 1505:  <h4>Response Entity Body</h4>
 1506: 
1.248 avankest 1507:  <p>The <dfn id="response-mime-type">response MIME type</dfn> is the MIME
 1508:  type the <code>Content-Type</code> header contains without any
 1509:  parameters or null if the header could not be parsed properly or was
 1510:  omitted. The <dfn id="override-mime-type">override MIME type</dfn> is
 1511:  always null. <dfn id="final-mime-type">Final MIME type</dfn> is the
 1512:  override MIME type unless that is null in which case it is the response
 1513:  MIME type.</p>
 1514: 
 1515:  <p>The <dfn id="response-charset">response charset</dfn> is the value of
 1516:  the <code>charset</code> parameter of the <code>Content-Type</code> header
 1517:  or null if there was no <code>charset</code> parameter or if
 1518:  the header could not be parsed properly or was omitted. The
 1519:  <dfn id="override-charset">override charset</dfn> is always null.
 1520:  <dfn id="final-charset">Final charset</dfn> is the override charset unless
 1521:  that is null in which case it is the response charset.</p>
1.250 avankest 1522: 
1.248 avankest 1523:  
 1524:  <p class="note"><span>Override MIME type</span> and
 1525:  <span>override charset</span> are introduced here solely to make editing
 1526:  several levels of XMLHttpRequest simultaneously somewhat easier. Apologies
 1527:  for any confusion they might cause.</p>
 1528:  
1.250 avankest 1529: 
1.248 avankest 1530:  <hr>
 1531: 
1.203 avankest 1532:  <p>The <dfn id="response-entity-body">response entity body</dfn> is the
1.255 avankest 1533:  fragment of the <span>entity body</span> of the response received so far
 1534:  (<span title="LOADING state">LOADING</span>) or the complete entity body
 1535:  of the response (<span title="DONE state">DONE</span>). If the response
 1536:  does not have an entity body the response entity body is null.</p>
 1537: 
 1538:  <p class="note">The <span>response entity body</span> is updated as part
 1539:  of the <code>send()</code> algorithm.</p>
1.250 avankest 1540: 
1.203 avankest 1541:  <hr>
 1542: 
 1543:  <p>The <dfn id="text-response-entity-body">text response entity body</dfn>
1.248 avankest 1544:  is a <code>DOMString</code> representing the <span>response entity
 1545:  body</span>. The text response entity body is the return value of the
1.203 avankest 1546:  following algorithm:</p>
 1547: 
 1548:  <ol>
1.248 avankest 1549:  <li><p>If the response entity body is null return the empty string and
 1550:  terminate these steps.</p>
 1551: 
 1552:  <li><p>Let <var>charset</var> be the <span>final charset</span>.</p></li>
1.203 avankest 1553: 
1.248 avankest 1554:  <li><p>Let <var>mime</var> be the <span>final MIME type</span>.</p></li>
1.203 avankest 1555: 
1.248 avankest 1556:  <li><p>If <var>charset</var> is null and <var>mime</var> is null,
1.203 avankest 1557:  <code>text/xml</code>, <code>application/xml</code> or ends in
1.248 avankest 1558:  <code title="">+xml</code> use the rules set forth in the XML
 1559:  specifications to determine the character encoding. Let
 1560:  <var>charset</var> be the determined character encoding.</p></li>
 1561: 
 1562:  <li><p>If <var>charset</var> is null and <var>mime</var> is
 1563:  <code>text/html</code> follow the rules set forth in the HTML
 1564:  specification to determine the character encoding. Let
1.203 avankest 1565:  <var>charset</var> be the determined character encoding.
 1566:  [<cite><span>HTML5</span></cite>]</p></li>
 1567: 
 1568:  <li>
 1569:   <p>If <var>charset</var> is null then, for each of the rows in the
 1570:   following table, starting with the first one and going down, if the first
 1571:   bytes of <var>bytes</var> match the bytes given in the first column, then
 1572:   let <var>charset</var> be the encoding given in the cell in the second
 1573:   column of that row. If there is no match <var>charset</var> remains
 1574:   null.</p>
 1575: 
 1576:   <table>
 1577:   <thead>
 1578:    <tr>
 1579:    <th>Bytes in Hexadecimal
 1580:    <th>Description
1.237 avankest 1581:   <tbody>
1.203 avankest 1582:    <tr>
 1583:    <td>FE FF
 1584:    <td>UTF-16BE BOM
 1585:    <tr>
 1586:    <td>FF FE
 1587:    <td>UTF-16LE BOM
 1588:    <tr>
 1589:    <td>EF BB BF
1.237 avankest 1590:    <td>UTF-8 BOM
1.203 avankest 1591:   </table>
 1592:  </li>
 1593: 
 1594:  <li><p>If <var>charset</var> is null let <var>charset</var> be
 1595:  UTF-8.</p></li>
 1596: 
 1597:  <li><p>Return the result of decoding the response entity body using
 1598:  <var>charset</var>. Replace bytes or sequences of bytes that are not
1.248 avankest 1599:  valid accordng to the <var>charset</var> with a single
 1600:  U+FFFD REPLACEMENT CHARACTER character.</p></li>
1.203 avankest 1601:  </ol>
 1602: 
 1603:  <p class="note">Authors are strongly encouraged to encode their resources
 1604:  using UTF-8.</p>
1.248 avankest 1605:  
1.203 avankest 1606:  <hr>
 1607: 
1.248 avankest 1608:  <p>The <dfn id="document-response-entity-body">document response entity
 1609:  body</dfn> is either a <code>Document</code> representing the
 1610:  <span>response entity body</span> or null. The document
 1611:  response entity body is the return value of the following algorithm:</p>
1.12 avankest 1612: 
1.203 avankest 1613:  <ol>
 1614:  <li><p>If the <span>response entity body</span> is null terminate these
1.239 avankest 1615:  steps and return null.</p></li>
1.12 avankest 1616: 
1.248 avankest 1617:  <li><p>If <span>final MIME type</span> is not null,
 1618:  <code>text/xml</code>,
 1619:  <code>application/xml</code>, and does not end in
 1620:  <code title="">+xml</code> terminate these steps and return
 1621:  null.</li>
 1622: 
 1623:  
1.203 avankest 1624: 
 1625:  <li>
1.248 avankest 1626:   <p>Let <var>document</var> be an object implementing the
 1627:   <code>Document</code> interface that represents the result of parsing
 1628:   the response entity body into a document tree following the rules from
 1629:   the XML specifications. If this fails (unsupported character encoding,
 1630:   namespace well-formedness error et cetera) terminate these steps return
 1631:   null. [<cite><span>XML</span></cite>]</p>
 1632: 
 1633:   <p class="note">Scripts in the resulting document tree will not be executed,
 1634:   resources referenced will not be loaded and no associated XSLT will be
 1635:   applied.</p>
1.203 avankest 1636:  </li>
1.88 avankest 1637: 
1.248 avankest 1638:  
 1639: 
 1640:  <li><p>Return <var>document</var>.</p></li>
1.203 avankest 1641:  </ol>
1.12 avankest 1642: 
 1643: 
1.248 avankest 1644:  
 1645: 
 1646: 
1.203 avankest 1647:  <h4>The <code title="">responseText</code> attribute</h4>
1.12 avankest 1648: 
1.203 avankest 1649:  <p>The <dfn id="responsetext"><code>responseText</code></dfn> attribute
1.217 avankest 1650:  <em class="ct">must</em> return the result of running these steps:</p>
1.79 avankest 1651: 
1.203 avankest 1652:  <ol>
1.248 avankest 1653:  <li><p>If the state is not <span title="LOADING state">LOADING</span> or
 1654:  <span title="DONE state">DONE</span> return the empty string and
1.203 avankest 1655:  terminate these steps.</p></li>
1.75 avankest 1656: 
1.203 avankest 1657:  <li><p>Return the <span>text response entity body</span>.</p></li>
 1658:  </ol>
1.12 avankest 1659: 
 1660: 
1.203 avankest 1661:  <h4>The <code title="">responseXML</code> attribute</h4>
1.12 avankest 1662: 
1.203 avankest 1663:  <p>The <dfn id="responsexml"><code>responseXML</code></dfn> attribute
1.217 avankest 1664:  <em class="ct">must</em> return the result of running these steps:</p>
1.12 avankest 1665: 
1.203 avankest 1666:  <ol>
 1667:  <li><p>If the state is not <span title="DONE state">DONE</span> return
1.239 avankest 1668:  null and terminate these steps.</p></li>
1.12 avankest 1669: 
1.248 avankest 1670:  <li><p>Return the <span>document response entity body</span>.</p></li>
1.203 avankest 1671:  </ol>
1.121 avankest 1672: 
1.248 avankest 1673:  
 1674: 
1.12 avankest 1675: 
1.240 avankest 1676:  <h2 id="exceptions">Exceptions</h2>
1.24 avankest 1677: 
1.138 avankest 1678:  <p>Several algorithms in this specification may result in an exception
 1679:  being thrown. These exceptions are all part of the group
1.185 avankest 1680:  <code>ExceptionCode</code> and use the <code>DOMException</code> object,
1.138 avankest 1681:  which is defined in DOM Level 3 Core. In addition this specification
 1682:  extends the <code>ExceptionCode</code> group with several new
 1683:  constants as indicated below. [<cite><span>DOM3Core</span></cite>]</p>
1.203 avankest 1684: 
1.193 avankest 1685:  <p class="note">Thus, exceptions used by this specification and not
 1686:  defined in this section are defined by DOM Level 3 Core.</p>
1.31 avankest 1687: 
1.138 avankest 1688:  <pre class="idl">const unsigned short <span>SECURITY_ERR</span> = 18;
1.199 avankest 1689: const unsigned short <span>NETWORK_ERR</span> = 19;
 1690: const unsigned short <span>ABORT_ERR</span> = 20;</pre>
1.31 avankest 1691: 
1.138 avankest 1692:  <p>The <dfn id="security-err"><code>SECURITY_ERR</code></dfn> exception is
 1693:  raised if an attempt is made to perform an operation or access some data
 1694:  in a way that would be a security risk or a violation of the user agent's
 1695:  security policy.</p>
 1696: 
 1697:  <!-- http://lists.w3.org/Archives/Public/public-webapi/2006May/0027.html -->
 1698: 
1.33 avankest 1699:  <p>The <dfn id="network-err"><code>NETWORK_ERR</code></dfn> exception is
1.138 avankest 1700:  raised when a network error occurs in synchronous requests.</p>
1.121 avankest 1701: 
1.138 avankest 1702:  <p>The <dfn id="abort-err"><code>ABORT_ERR</code></dfn> exception is
 1703:  raised when the user aborts a request in synchronous requests.</p>
1.248 avankest 1704:  
 1705:  
1.203 avankest 1706: 
1.240 avankest 1707:  <p class="note">These exceptions will be folded into an update of
1.199 avankest 1708:  DOM Level 3 Core in due course, as they are appropriate for other API
 1709:  specifications as well.</p>
1.121 avankest 1710: 
1.248 avankest 1711:  
1.29 avankest 1712:  <h2 class="no-num" id="notcovered">Not in this Specification</h2>
 1713: 
1.143 avankest 1714:  <p><em>This section is non-normative.</em></p>
1.29 avankest 1715: 
1.72 avankest 1716:  <p>This specification does not include the following features which are
 1717:  being considered for a future version of this specification:</p>
1.29 avankest 1718: 
 1719:  <ul>
 1720:  <li><code>load</code> event and <code>onload</code> attribute;</li>
 1721:  <li><code>error</code> event and <code>onerror</code> attribute;</li>
 1722:  <li><code>progress</code> event and <code>onprogress</code> attribute;</li>
 1723:  <li><code title="">abort</code> event and <code>onabort</code> attribute;</li>
 1724:  <li>Timers have been suggested, perhaps an <code>ontimeout</code>
 1725:   attribute;</li>
 1726:  <li>Property to disable following redirects;</li>
1.30 avankest 1727:  <li><code title="">responseXML</code> for <code>text/html</code>
 1728:  documents;</li>
1.203 avankest 1729:  <li>Cross-origin <code title="">XMLHttpRequest</code>;</li>
1.87 avankest 1730:  <li><code>responseBody</code> to deal with byte streams;</li>
1.114 avankest 1731:  <li><code>overrideMimeType</code> to fix up MIME types;</li>
1.87 avankest 1732:  <li><code>getRequestHeader()</code> and
 1733:  <code>removeRequestHeader()</code>.</li>
1.29 avankest 1734:  </ul>
1.248 avankest 1735:  
1.29 avankest 1736: 
1.203 avankest 1737: 
1.248 avankest 1738:  
 1739: 
1.203 avankest 1740: 
1.248 avankest 1741:  <h2 class="no-num" id="references">References</h2>
1.203 avankest 1742: 
1.177 avankest 1743:  <p>Unless marked "Non-normative" these references are normative.</p>
1.11 avankest 1744: 
1.6 avankest 1745:  <dl>
1.230 avankest 1746:  <dt>[<dfn id="ref-cookies">COOKIES</dfn>]</dt>
1.203 avankest 1747:  <dd><cite><a href="http://ietf.org/rfc/rfc2109">HTTP State Management
 1748:  Mechanism</a></cite>, D. Kristol, L. Montulli, editors. IETF, February
 1749:  1997.</dd>
 1750:  <dd><cite><a href="http://ietf.org/rfc/rfc2965">HTTP State Management
 1751:  Mechanism</a></cite>, D. Kristol, L. Montulli, editors. IETF, October
1.218 avankest 1752:  2000.</dd>
1.211 avankest 1753: 
1.203 avankest 1754:  <!-- XXX These specs do not match reality. Also, the latter obsoletes the
 1755:  former -->
 1756: 
1.248 avankest 1757:  
 1758: 
1.155 avankest 1759:  <dt>[<dfn id="ref-dom2events">DOM2Events</dfn>]</dt>
 1760:  <dd><cite><a href="http://www.w3.org/TR/DOM-Level-2-Events/">Document
1.160 avankest 1761:  Object Model (DOM) Level 2 Events Specification</a></cite>, T. Pixley,
 1762:  editor. W3C, November 2000.</dd>
1.155 avankest 1763: 
1.145 avankest 1764:  <dt>[<dfn id="ref-dom3core">DOM3Core</dfn>]</dt>
1.11 avankest 1765:  <dd><cite><a href="http://www.w3.org/TR/DOM-Level-3-Core">Document Object
1.92 avankest 1766:  Model (DOM) Level 3 Core Specification</a></cite>, A. Le Hors, P. Le
1.139 avankest 1767:  H&eacute;garet, L. Wood, G. Nicol, J. Robie, M. Champion, S. Byrne,
 1768:  editors. W3C, April 2004.</dd>
1.11 avankest 1769: 
1.117 avankest 1770:  <dt>[<dfn id="ref-ecmascript">ECMAScript</dfn>]</dt>
1.92 avankest 1771:  <dd><cite><a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript
1.248 avankest 1772:  Language Specification</a></cite>, Third Edition. ECMA, December
 1773:  1999.</dd>
 1774:  
 1775:  
1.171 avankest 1776: 
1.145 avankest 1777:  <dt>[<dfn id="ref-html5">HTML5</dfn>]</dt>
1.250 avankest 1778:  <dd><cite><a href="http://www.w3.org/html/wg/html5/">HTML5</a></cite>
 1779:  (work in progress), I. Hickson, D. Hyatt, editors. W3C, 2010.</dd>
 1780:  <dd><cite><a href="http://www.whatwg.org/specs/html5/current-work/">HTML5</a></cite>
 1781:  (work in progress), I. Hickson, editor. WHATWG, 2010.</dd>
1.198 avankest 1782: 
 1783:  <dt>[<dfn id="ref-httpverbsec">HTTPVERBSEC</dfn>]</dt>
1.248 avankest 1784:  <dd>(Non-normative)
 1785:  <cite><a href="http://www.kb.cert.org/vuls/id/867593">Multiple vendors'
 1786:  web servers enable HTTP TRACE method by default</a></cite>, US-CERT.</dd>
 1787:  <dd>(Non-normative)
 1788:  <cite><a href="http://www.kb.cert.org/vuls/id/288308">Microsoft Internet
 1789:  Information Server (IIS) vulnerable to cross-site scripting via HTTP
 1790:  TRACK method</a></cite>, US-CERT.</dd>
 1791:  <dd>(Non-normative)
 1792:  <cite><a href="http://www.kb.cert.org/vuls/id/150227">HTTP proxy default
 1793:  configurations allow arbitrary TCP connections</a></cite>, US-CERT.</dd>
 1794: 
 1795:  
 1796: 
 1797:  <dt>[<dfn id="ref-rfc2046">RFC2046</dfn>]</dt>
 1798:  <dd><cite><a href="http://ietf.org/rfc/rfc2046">Multipurpose Internet Mail
 1799:  Extensions (MIME) Part Two: Media Types</a></cite>, N. Freed, N.
 1800:  Borenstein, editors. IETF, November 1996.</dd>
1.198 avankest 1801: 
1.145 avankest 1802:  <dt>[<dfn id="ref-rfc2119">RFC2119</dfn>]</dt>
1.117 avankest 1803:  <dd><cite><a href="http://ietf.org/rfc/rfc2119">Key words for use in RFCs to
 1804:  Indicate Requirement Levels</a></cite>, S. Bradner. IETF, March 1997.</dd>
1.12 avankest 1805: 
1.248 avankest 1806:  <dt>[<dfn id="rfc-rfc2616">RFC2616</dfn>]</dt>
1.11 avankest 1807:  <dd><cite><a href="http://ietf.org/rfc/rfc2616">Hypertext Transfer Protocol
1.92 avankest 1808:  -- HTTP/1.1</a></cite>, R. Fielding, J. Gettys, J. Mogul, H. Frystyk, L.
 1809:  Masinter, P. Leach, T. Berners-Lee, editors. IETF, June 1999.</dd>
1.12 avankest 1810: 
1.37 avankest 1811:  <dt>[<dfn id="ref-rfc2617">RFC2617</dfn>]</dt>
1.11 avankest 1812:  <dd><cite><a href="http://ietf.org/rfc/rfc2617">HTTP Authentication: Basic
1.92 avankest 1813:  and Digest Access Authentication</a></cite>, P. Hallam-Baker, J.
 1814:  Hostetler, S. Lawrence, P. Leach, A. Luotonen, L. Stewart, editors. IETF,
 1815:  June 1999.</dd>
1.12 avankest 1816: 
1.37 avankest 1817:  <dt>[<dfn id="ref-rfc3986">RFC3986</dfn>]</dt>
1.11 avankest 1818:  <dd><cite><a href="http://ietf.org/rfc/rfc3986">Uniform Resource Identifier
1.92 avankest 1819:  (URI): Generic Syntax</a></cite>, T. Berners-Lee, R. Fielding, L. Masinter,
 1820:  editors. IETF, January 2005.</dd>
1.184 avankest 1821: 
1.248 avankest 1822:  <dt>[<dfn id=ref-rfc3987>RFC3987</dfn>]</dt>
 1823:  <dd><cite><a href="http://ietf.org/rfc/rfc3987">Internationalized
 1824:  Resource Identifiers (IRIs)</a></cite>, M. Duerst, M. Suignard, editors.
 1825:  IETF, January 2005. L. Masinter, editors. IETF, January 2005.</dd>
 1826: 
1.203 avankest 1827:  <dt>[<dfn id="ref-webidl">WebIDL</dfn>]</dt>
1.200 avankest 1828:  <dd><cite><a href="http://dev.w3.org/2006/webapi/WebIDL/">Web
1.250 avankest 1829:  IDL</a></cite> (work in progress), C. McCormack, editor. W3C, 2010.</dd> <!-- XXX add Sam -->
1.181 avankest 1830: 
1.92 avankest 1831:  <dt>[<dfn id="ref-xml">XML</dfn>]</dt>
 1832:  <dd><cite><a href="http://www.w3.org/TR/xml/">Extensible Markup Language
1.203 avankest 1833:  (XML) 1.0 (Fifth Edition)</a></cite>, T. Bray, J. Paoli, C.
 1834:  Sperberg-McQueen, E. Maler, F. Yergeau, editors. W3C, November 2008.</dd>
1.92 avankest 1835:  <dd><cite><a href="http://www.w3.org/TR/xml-names/">Namespaces in XML
1.256 avankest 1836:  (Third Edition)</a></cite>, T. Bray, D. Hollander, A. Layman, R. Tobin,
 1837:  H. S. Thompson, editors. W3C, December 2009.</dd>
1.1 avankest 1838:  </dl>
1.11 avankest 1839: 
1.203 avankest 1840: 
 1841: 
1.130 avankest 1842:  <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
1.11 avankest 1843: 
1.159 avankest 1844:  <p>The editor would like to thank
1.12 avankest 1845: 
1.163 avankest 1846:  Addison Phillips,
1.159 avankest 1847:  Ahmed Kamel,
 1848:  Alex Hopmann,
 1849:  Alex Vincent,
 1850:  Alexey Proskuryakov,
 1851:  Asbj&oslash;rn Ulsberg,
 1852:  Boris Zbarsky,
 1853:  Bj&ouml;rn H&ouml;hrmann,
 1854:  Cameron McCormack,
 1855:  Christophe Jolif,
 1856:  Charles McCathieNevile,
 1857:  Dan Winship,
1.248 avankest 1858:  David Andersson,
1.159 avankest 1859:  David H&aring;s&auml;ther,
1.248 avankest 1860:  David Levin,
1.159 avankest 1861:  Dean Jackson,
 1862:  Denis Sureau,
 1863:  Doug Schepers,
 1864:  Douglas Livingstone,
 1865:  Elliotte Harold,
 1866:  Eric Lawrence,
1.196 avankest 1867:  Erik Dahlstr&ouml;m,
1.163 avankest 1868:  Geoffrey Sneddon,
1.159 avankest 1869:  Gideon Cohn,
 1870:  Gorm Haug Eriksen,
1.247 avankest 1871:  H&aring;kon Wium Lie,
1.159 avankest 1872:  Hallvord R. M. Steen,
1.247 avankest 1873:  Huub Schaeks,
1.159 avankest 1874:  Ian Davis,
 1875:  Ian Hickson,
 1876:  Ivan Herman,
 1877:  Jeff Walden,
 1878:  Jens Lindstr&ouml;m,
 1879:  Jim Deegan,
 1880:  Jim Ley,
 1881:  Joe Farro,
 1882:  Jonas Sicking,
 1883:  Julian Reschke,
 1884:  Karl Dubost,
1.175 avankest 1885:  Lachlan Hunt,
1.159 avankest 1886:  Maciej Stachowiak,
 1887:  Magnus Kristiansen,
 1888:  Marc Hadley,
 1889:  Marcos Caceres,
 1890:  Mark Baker,
1.203 avankest 1891:  Mark Birbeck,
1.159 avankest 1892:  Mark Nottingham,
1.248 avankest 1893:  Martin Hassman,
1.159 avankest 1894:  Mohamed Zergaoui,
1.256 avankest 1895:  Olli Pettay,
1.159 avankest 1896:  Pawel Glowacki,
1.231 avankest 1897:  Peter Michaux,
1.159 avankest 1898:  Robin Berjon,
1.248 avankest 1899:  Rune Halvorsen,
1.159 avankest 1900:  Ruud Steltenpool,
 1901:  Simon Pieters,
 1902:  Stewart Brodie,
 1903:  Sunava Dutta,
1.186 avankest 1904:  Thomas Roessler,
1.203 avankest 1905:  Tom Magliery, and
1.159 avankest 1906:  Zhenbin Xu
1.181 avankest 1907: 
1.159 avankest 1908:  for their contributions to this specification.</p>
1.12 avankest 1909: 
1.1 avankest 1910:  <p>Special thanks to the Microsoft employees who first implemented the
1.143 avankest 1911:  <code title="">XMLHttpRequest</code> interface, which was first widely
 1912:  deployed by the Windows Internet Explorer browser.</p>
1.12 avankest 1913: 
1.143 avankest 1914:  <p>Special thanks also to the WHATWG for drafting an initial version of
 1915:  this specification in their Web Applications 1.0 document (now renamed to
1.250 avankest 1916:  HTML5). [<cite><span>HTML5</span></cite>]</p>
1.12 avankest 1917: 
1.143 avankest 1918:  <p>Thanks also to all those who have helped to improve this specification
 1919:  by sending suggestions and corrections. (Please, keep bugging us with your
1.22 avankest 1920:  issues!)</p>
1.1 avankest 1921: </body>
 1922: </html>
1.211 avankest 1923: 

Webmaster

AltStyle によって変換されたページ (->オリジナル) /