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