Annotation of 2006/webapi/XMLHttpRequest/Overview.html, revision 1.277
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.234 avankest 488: name <code>readystatechange</code>, which does not bubble and is not
489: cancelable, and which uses the <code>Event</code> interface, is to be
1.270 avankest 490: dispatched at the <a
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>
520: attribute <a href="#function">Function</a> <a href="#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>
623: <td><dfn id=onreadystatechange><code>onreadystatechange</code></dfn>
624:
625: <td><code>readystatechange</code>
626: </table>
627:
1.250 avankest 628: <h3 id=states><span class=secno>3.5. </span>States</h3>
1.205 avankest 629:
1.270 avankest 630: <p>The <a href="#xmlhttprequest"><code>XMLHttpRequest</code></a> object can
1.225 avankest 631: be in several states. The <dfn id=readystate><code>readyState</code></dfn>
632: attribute, on getting, <em class=ct>must</em> return the current state,
633: which <em class=ct>must</em> be one of the following values:
1.205 avankest 634:
635: <dl>
1.277 ! avankest 636: <dt><dfn id=dom-xmlhttprequest-unsent
! 637: title=dom-XMLHttpRequest-UNSENT><code>UNSENT</code></dfn> (numeric value
! 638: 0)
1.125 avankest 639:
1.205 avankest 640: <dd>
641: <p>The object has been constructed.
642:
1.277 ! avankest 643: <dt><dfn id=dom-xmlhttprequest-opened
! 644: title=dom-XMLHttpRequest-OPENED><code>OPENED</code></dfn> (numeric value
! 645: 1)
1.205 avankest 646:
647: <dd>
1.275 avankest 648: <p>The <a href="#dom-xmlhttprequest-open"><code>open()</code></a> method
649: has been successfully invoked. During this state request headers can be
650: set using <a
651: href="#dom-xmlhttprequest-setrequestheader"><code>setRequestHeader()</code></a>
652: and the request can be made using the <a
1.276 avankest 653: href="#dom-xmlhttprequest-send"><code
654: title=dom-XMLHttpRequest-send>send()</code></a> method.
1.89 avankest 655:
1.277 ! avankest 656: <dt><dfn id="dom-xmlhttprequest-headers_received"
! 657: title="dom-XMLHttpRequest-HEADERS_RECEIVED"><code>HEADERS_RECEIVED</code></dfn>
! 658: (numeric value 2)
1.89 avankest 659:
1.205 avankest 660: <dd>
1.259 avankest 661: <p>All redirects (if any) have been followed and all HTTP headers of the
662: final response have been received. Several response members of the
1.205 avankest 663: object are now available.
1.91 avankest 664:
1.277 ! avankest 665: <dt><dfn id=dom-xmlhttprequest-loading
! 666: title=dom-XMLHttpRequest-LOADING><code>LOADING</code></dfn> (numeric
! 667: value 3)
1.112 avankest 668:
1.205 avankest 669: <dd>
670: <p>The <a href="#response-entity-body">response entity body</a> is being
671: received.
1.91 avankest 672:
1.277 ! avankest 673: <dt><dfn id=dom-xmlhttprequest-done
! 674: title=dom-XMLHttpRequest-DONE><code>DONE</code></dfn> (numeric value 4)
1.119 avankest 675:
1.205 avankest 676: <dd>
677: <p>The data transfer has been completed or something went wrong during
678: the transfer (e.g. infinite redirects).
679: </dl>
1.116 avankest 680:
1.277 ! avankest 681: <p>The <a href="#dom-xmlhttprequest-opened"
! 682: title=dom-XMLHttpRequest-OPENED>OPENED</a> state has an associated <dfn
! 683: id=send-flag><code>send()</code> flag</dfn> that indicates whether the <a
! 684: href="#dom-xmlhttprequest-send"><code
1.276 avankest 685: title=dom-XMLHttpRequest-send>send()</code></a> method has been invoked.
686: It can be either true or false and has an initial value of false.
1.205 avankest 687:
1.277 ! avankest 688: <p>The <a href="#dom-xmlhttprequest-done"
! 689: title=dom-XMLHttpRequest-DONE>DONE</a> state has an associated <dfn
! 690: id=error-flag>error flag</dfn> that indicates some type of network error
! 691: or abortion. It can be either true or false and has an initial value of
! 692: false.
1.205 avankest 693:
1.250 avankest 694: <h3 id=request><span class=secno>3.6. </span>Request</h3>
1.112 avankest 695:
1.270 avankest 696: <p>The <a href="#xmlhttprequest"><code>XMLHttpRequest</code></a> object
1.225 avankest 697: holds the following request metadata variables:
1.112 avankest 698:
1.206 avankest 699: <dl>
700: <dt>The <dfn id=asynchronous-flag>asynchronous flag</dfn>
701:
1.271 avankest 702: <dd>True when <a href="#fetch" title=fetch>fetching</a> is done
703: asychronously. False when fetching is done synchronously.
1.206 avankest 704:
705: <dt>The <dfn id=request-method>request method</dfn>
706:
707: <dd>The method used in the request.
708:
709: <dt>The <dfn id=request-url>request URL</dfn>
710:
711: <dd>The <a href="#url">URL</a> used in the request.
712:
713: <dt>The <dfn id=request-username>request username</dfn>
714:
715: <dd>The username used in the request or null if there is no username.
716:
717: <dt>The <dfn id=request-password>request password</dfn>
718:
719: <dd>The password used in the request or null if there is no password.
1.112 avankest 720:
1.206 avankest 721: <dt>The <dfn id=author-request-headers>author request headers</dfn>
1.112 avankest 722:
1.206 avankest 723: <dd>A list consisting of HTTP header name/value pairs to be used in the
724: request.
1.112 avankest 725:
1.206 avankest 726: <dt>The <dfn id=request-entity-body>request entity body</dfn>
1.112 avankest 727:
1.206 avankest 728: <dd>The <a href="#entity-body">entity body</a> used in the request.
729: </dl>
1.205 avankest 730:
1.250 avankest 731: <h4 id=the-open-method><span class=secno>3.6.1. </span>The <code
1.205 avankest 732: title="">open()</code> method</h4>
733:
1.274 avankest 734: <dl class=domintro>
1.275 avankest 735: <dt><var title="">client</var> . <a href="#dom-xmlhttprequest-open"><code
1.274 avankest 736: title=open>open(<var>method</var>, <var title="">url</var>,
737: <var>async</var>, <var>user</var>, <var>password</var>)</code></a>
738:
739: <dd>
740: <p>Sets the <a href="#request-method">request method</a>, <a
741: href="#request-url">request URL</a>, <a
742: href="#asynchronous-flag">asynchronous flag</a>, <a
743: href="#request-username">request username</a>, and <a
744: href="#request-password">request password</a>.
745: </dl>
746:
1.275 avankest 747: <p>When the <dfn id=dom-xmlhttprequest-open
748: title=open><code>open(<var>method</var>, <var title="">url</var>,
749: <var>async</var>, <var>user</var>, <var>password</var>)</code></dfn>
750: method is invoked, the user agent <em class=ct>must</em> run these steps
751: (unless otherwise indicated):
1.112 avankest 752:
1.205 avankest 753: <ol>
754: <li>
1.270 avankest 755: <p>If the <a href="#xmlhttprequest"><code>XMLHttpRequest</code></a>
1.225 avankest 756: object has an associated <a
1.205 avankest 757: href="#xmlhttprequest-document"><code>XMLHttpRequest</code>
758: <code>Document</code></a> run these substeps:</p>
1.112 avankest 759:
1.205 avankest 760: <ol>
761: <li>
762: <p>If the <a
763: href="#xmlhttprequest-document"><code>XMLHttpRequest</code>
764: <code>Document</code></a> is not <a href="#fully-active">fully
765: active</a> raise an <code>INVALID_STATE_ERR</code> exception and
766: terminate the overall set of steps.
767:
768: <li>
769: <p>Let <a href="#xmlhttprequest-base-url"><code>XMLHttpRequest</code>
770: base URL</a> be the <a href="#document-base-url">document base URL</a>
771: of the <a href="#xmlhttprequest-document"><code>XMLHttpRequest</code>
772: <code>Document</code></a>.
773:
774: <li>
775: <p>Let <a href="#xmlhttprequest-origin"><code>XMLHttpRequest</code>
776: origin</a> be the <a href="#origin">origin</a> of the <a
777: href="#xmlhttprequest-document"><code>XMLHttpRequest</code>
778: <code>Document</code></a>.
779: </ol>
1.112 avankest 780:
781: <li>
1.258 avankest 782: <p>If any code point in <var>method</var> is higher than U+00FF LATIN
1.260 avankest 783: SMALL LETTER Y WITH DIAERESIS or after <span title="deflate a DOMString
784: into an byte sequence">deflating</span> <var>method</var> it does not
785: match the <a href="#method-token">Method token</a> production raise a
786: <code>SYNTAX_ERR</code> exception and terminate these steps. Otherwise
787: let <var>method</var> be the result of <span title="deflate a DOMString
788: into an byte sequence">deflating</span> <var>method</var>.
1.258 avankest 789: </li>
790: <!-- This sounds lame, but it works. -->
1.91 avankest 791:
792: <li>
1.258 avankest 793: <p>If <var>method</var> is a case-insensitive match for
794: <code>CONNECT</code>, <code>DELETE</code>, <code>GET</code>,
795: <code>HEAD</code>, <code>OPTIONS</code>, <code>POST</code>,
796: <code>PUT</code>, <code>TRACE</code>, or <code>TRACK</code> subtract
797: 0x20 from each byte in the range 0x61 (ASCII a) to 0x7A (ASCII z).</p>
1.205 avankest 798:
799: <p class=note>If it does not match any of the above, it is passed through
800: <em>literally</em>, including in the final request.</p>
801: </li>
802: <!-- WebKit (and supposedly Gecko) also uppercase: COPY, INDEX, LOCK,
803: M-POST, MKCOL, MOVE, PROPFIND, PROPPATCH, and UNLOCK. -->
1.89 avankest 804:
1.205 avankest 805: <li>
1.258 avankest 806: <p>If <var>method</var> is a case-sensitive match for
1.261 avankest 807: <code>CONNECT</code>, <code>TRACE</code>, or <code>TRACK</code> raise a
1.270 avankest 808: <a href="#security-err"><code>SECURITY_ERR</code></a> exception and
1.261 avankest 809: terminate these steps.</p>
1.164 avankest 810:
1.205 avankest 811: <p class=note>Allowing these methods poses a security risk. [<cite><a
812: href="#ref-httpverbsec">HTTPVERBSEC</a></cite>]</p>
1.89 avankest 813:
1.91 avankest 814: <li>
1.205 avankest 815: <p>Let <var title="">url</var> be a <a href="#url">URL</a>.
1.89 avankest 816:
817: <li>
1.205 avankest 818: <p>Let <a href="#url-character-encoding">URL character encoding</a> of
819: <var title="">url</var> be UTF-8.
1.89 avankest 820:
821: <li>
1.257 avankest 822: <p><a href="#resolve-a-url" title="Resolve a URL">Resolve</a> <var
823: title="">url</var> relative to the <a
1.205 avankest 824: href="#xmlhttprequest-base-url"><code>XMLHttpRequest</code> base
825: URL</a>. If the algorithm returns an error raise a
826: <code>SYNTAX_ERR</code> exception and terminate these steps.
827: </li>
828: <!-- Presto and Gecko override the encoding. WebKit does not. Trident
829: does not support non-ASCII URLs. This matters for the <query> component,
830: see HTML5. -->
1.129 avankest 831:
1.205 avankest 832: <li>
1.270 avankest 833: <p>Drop <a href="#url-fragment"><code><fragment></code></a> from <var
1.205 avankest 834: title="">url</var>.
1.89 avankest 835:
836: <li>
1.270 avankest 837: <p>If <var title="">url</var> contains an unsupported <a
838: href="#url-scheme"><code><scheme></code></a> raise a
1.205 avankest 839: <code>NOT_SUPPORTED_ERR</code> and terminate these steps.
1.89 avankest 840:
1.205 avankest 841: <li>
1.270 avankest 842: <p>If the <code>"user:password"</code> format in the <a
843: href="#userinfo"><code>userinfo</code></a> production is not supported
844: for the relevant scheme and <var title="">url</var> contains this format
845: raise a <code>SYNTAX_ERR</code> and terminate these steps.
1.2 avankest 846:
1.205 avankest 847: <li>
848: <p>If <var title="">url</var> contains the <code>"user:password"</code>
849: format let <var>temp user</var> be the user part and <var>temp
850: password</var> be the password part.
1.2 avankest 851:
1.205 avankest 852: <li>
853: <p>If <var title="">url</var> just contains the <code>"user"</code>
854: format let <var>temp user</var> be the user part.
1.2 avankest 855:
1.205 avankest 856: <li>
857: <p>If the <a href="#origin">origin</a> of <var title="">url</var> is not
858: <a href="#same-origin">same origin</a> with the <a
1.261 avankest 859: href="#xmlhttprequest-origin"><code>XMLHttpRequest</code> origin</a>
1.270 avankest 860: raise a <a href="#security-err"><code>SECURITY_ERR</code></a> exception
1.261 avankest 861: and terminate these steps.
1.2 avankest 862:
1.205 avankest 863: <li>
864: <p>Let <var>async</var> be the value of the <var>async</var> argument or
1.271 avankest 865: true if it was omitted.
1.2 avankest 866:
1.205 avankest 867: <li>
868: <p>If the <var>user</var> argument was not omitted follow these sub
869: steps:</p>
1.2 avankest 870:
1.60 avankest 871: <ol>
872: <li>
1.205 avankest 873: <p>If the syntax of <var>user</var> does not match the syntax specified
874: by the relevant authentication scheme, raise a <code>SYNTAX_ERR</code>
875: exception and terminate the overall set of steps.
1.157 avankest 876:
877: <li>
1.241 avankest 878: <p>If <var>user</var> is null let <var>temp user</var> be null.
1.2 avankest 879:
1.60 avankest 880: <li>
1.205 avankest 881: <p>Otherwise let <var>temp user</var> be <var>user</var>.
882: </ol>
1.184 avankest 883:
1.205 avankest 884: <p class=note>These steps override anything that may have been set by the
885: <var title="">url</var> argument.</p>
1.157 avankest 886:
1.205 avankest 887: <li>
888: <p>If the <var>password</var> argument was not omitted follow these sub
889: steps:</p>
1.2 avankest 890:
1.205 avankest 891: <ol>
1.60 avankest 892: <li>
1.205 avankest 893: <p>If the syntax of <var>password</var> does not match the syntax
894: specified by the relevant authentication scheme, raise a
895: <code>SYNTAX_ERR</code> exception and terminate the overall set of
896: steps.
1.192 avankest 897:
898: <li>
1.241 avankest 899: <p>If <var>password</var> is null let <var>temp password</var> be null.
1.2 avankest 900:
1.60 avankest 901: <li>
1.205 avankest 902: <p>Otherwise let <var>temp password</var> be <var>password</var>.
903: </ol>
1.102 avankest 904:
1.205 avankest 905: <p class=note>These steps override anything that may have been set by the
906: <var title="">url</var> argument.</p>
1.2 avankest 907:
1.205 avankest 908: <li>
909: <p><a href="#abort-send-algorithm" title="abort send()">Abort the
910: <code>send()</code> algorithm</a>.
1.2 avankest 911:
1.205 avankest 912: <li>
913: <p>The user agent <em class=ct>should</em> cancel any network activity
914: for which the object is responsible.
915: </li>
916: <!-- we can hardly require it... -->
1.24 avankest 917:
1.205 avankest 918: <li>
1.254 avankest 919: <p>If there are any <a href="#task" title=task>tasks</a> from the
920: object's <a
921: href="#xmlhttprequest-task-source"><code>XMLHttpRequest</code> task
922: source</a> in one of the <a href="#task-queues">task queues</a>, then
923: remove those tasks.
924:
925: <li>
1.205 avankest 926: <p>Set variables associated with the object as follows:</p>
1.70 avankest 927:
1.205 avankest 928: <ul>
1.60 avankest 929: <li>
1.205 avankest 930: <p>Set the <a href="#send-flag"><code>send()</code> flag</a> to false.
1.60 avankest 931:
932: <li>
1.205 avankest 933: <p>Set <a href="#response-entity-body">response entity body</a> to
934: null.
1.60 avankest 935:
936: <li>
1.205 avankest 937: <p>Empty the list of <a href="#author-request-headers">author request
938: headers</a>.</p>
1.17 avankest 939:
1.60 avankest 940: <li>
1.205 avankest 941: <p>Set the <a href="#request-method">request method</a> to
942: <var>method</var>.
1.17 avankest 943:
1.60 avankest 944: <li>
1.205 avankest 945: <p>Set the <a href="#request-url">request URL</a> to <var
946: title="">url</var>.
1.17 avankest 947:
1.60 avankest 948: <li>
1.205 avankest 949: <p>Set the <a href="#request-username">request username</a> to
950: <var>temp user</var>.
1.17 avankest 951:
1.60 avankest 952: <li>
1.205 avankest 953: <p>Set the <a href="#request-password">request password</a> to
954: <var>temp password</var>.
1.17 avankest 955:
1.60 avankest 956: <li>
1.271 avankest 957: <p>Set the <a href="#asynchronous-flag">asynchronous flag</a> to the
958: value of <var>async</var>.
1.205 avankest 959: </ul>
1.44 avankest 960:
1.205 avankest 961: <li>
1.277 ! avankest 962: <p>Switch the the state to <a href="#dom-xmlhttprequest-opened"
! 963: title=dom-XMLHttpRequest-OPENED>OPENED</a>.
1.176 avankest 964:
1.205 avankest 965: <li>
966: <p><a href="#dispatch-readystatechange-event">Dispatch a
967: <code>readystatechange</code> event</a>.
968: </ol>
1.22 avankest 969:
1.205 avankest 970: <p class=note>A future version or extension of this specification will
971: define a way of doing cross-origin requests.
1.24 avankest 972:
1.250 avankest 973: <h4 id=the-setrequestheader-method><span class=secno>3.6.2. </span>The
1.248 avankest 974: <code title="">setRequestHeader()</code> method</h4>
1.275 avankest 975:
976: <dl class=domintro>
977: <dt><var title="">client</var> . <code>setRequestHeader(<var
978: title="">header</var>, <var title="">value</var>)</code>
979:
980: <dd>
981: <p>Appends an header to the list of <a
982: href="#author-request-headers">author request headers</a> or if the
983: header is already in the <a href="#author-request-headers">author
984: request headers</a> its value appended to.</p>
985: <!-- XXX should mention when it throws? -->
986: </dl>
1.205 avankest 987:
988: <p>As indicated in the algorithm below certain headers cannot be set and
989: are left up to the user agent. In addition there are certain other headers
990: the user agent will take control of if they are not set by the author as
1.276 avankest 991: indicated at the end of the <a href="#dom-xmlhttprequest-send"><code
992: title=dom-XMLHttpRequest-send>send()</code></a> method section.
1.205 avankest 993:
1.270 avankest 994: <p class=note>The <a
1.275 avankest 995: href="#dom-xmlhttprequest-setrequestheader"><code>setRequestHeader()</code></a>
996: method appends a value if the HTTP header given as argument is already
997: part of the <a href="#author-request-headers">author request headers</a>
998: list.
999:
1000: <p>When the <dfn id=dom-xmlhttprequest-setrequestheader
1001: title=setrequestheader><code>setRequestHeader(<var title="">header</var>,
1002: <var title="">value</var>)</code></dfn> method is invoked, the user agent
1003: <em class=ct>must</em> run these steps:
1.6 avankest 1004:
1.205 avankest 1005: <ol>
1006: <li>
1.277 ! avankest 1007: <p>If the state is not <a href="#dom-xmlhttprequest-opened"
! 1008: title=dom-XMLHttpRequest-OPENED>OPENED</a> raise an
! 1009: <code>INVALID_STATE_ERR</code> exception and terminate these steps.
1.47 avankest 1010:
1.205 avankest 1011: <li>
1012: <p>If the <a href="#send-flag"><code>send()</code> flag</a> is true raise
1013: an <code>INVALID_STATE_ERR</code> exception and terminate these steps.
1.60 avankest 1014:
1.205 avankest 1015: <li>
1.258 avankest 1016: <p>If any code point in <var>header</var> is higher than U+00FF LATIN
1.260 avankest 1017: SMALL LETTER Y WITH DIAERESIS or after <span title="deflate a DOMString
1018: into an byte sequence">deflating</span> <var>header</var> it does not
1019: match the <a href="#field-name">field-name</a> production raise a
1.258 avankest 1020: <code>SYNTAX_ERR</code> exception and terminate these steps. Otherwise
1.260 avankest 1021: let <var>header</var> be the result of <span title="deflate a DOMString
1022: into an byte sequence">deflating</span> <var>header</var>.
1.258 avankest 1023: </li>
1024: <!-- This sounds lame, but it works. -->
1.6 avankest 1025:
1.205 avankest 1026: <li>
1.258 avankest 1027: <p>If any code point in <var>value</var> is higher than U+00FF LATIN
1.260 avankest 1028: SMALL LETTER Y WITH DIAERESIS or after <span title="deflate a DOMString
1029: into an byte sequence">deflating</span> <var>value</var> it does not
1030: match the <a href="#field-value">field-value</a> production raise a
1.258 avankest 1031: <code>SYNTAX_ERR</code> exception and terminate these steps. Otherwise
1.260 avankest 1032: let <var>value</var> be the result of <span title="deflate a DOMString
1033: into an byte sequence">deflating</span> <var>value</var>.</p>
1.258 avankest 1034: <!-- This sounds lame, but it works. -->
1.205 avankest 1035: <p class=note>The empty string is legal and represents the empty header
1036: value.</p>
1.71 avankest 1037:
1.205 avankest 1038: <li>
1.261 avankest 1039: <p>Terminate these steps if <var>header</var> is a case-insensitive match
1040: for one of the following headers:</p>
1.179 avankest 1041:
1.205 avankest 1042: <ul>
1043: <li><code>Accept-Charset</code>
1.60 avankest 1044:
1.205 avankest 1045: <li><code>Accept-Encoding</code>
1.34 avankest 1046:
1.205 avankest 1047: <li><code>Connection</code>
1.34 avankest 1048:
1.205 avankest 1049: <li><code>Content-Length</code>
1.177 avankest 1050:
1.205 avankest 1051: <li><code>Cookie</code>
1.69 avankest 1052:
1.205 avankest 1053: <li><code>Cookie2</code>
1.34 avankest 1054:
1.205 avankest 1055: <li><code>Content-Transfer-Encoding</code>
1.177 avankest 1056:
1.205 avankest 1057: <li><code>Date</code>
1.177 avankest 1058:
1.205 avankest 1059: <li><code>Expect</code>
1.69 avankest 1060:
1.205 avankest 1061: <li><code>Host</code>
1.69 avankest 1062:
1.205 avankest 1063: <li><code>Keep-Alive</code>
1.34 avankest 1064:
1.205 avankest 1065: <li><code>Referer</code>
1.34 avankest 1066:
1.205 avankest 1067: <li><code>TE</code>
1.34 avankest 1068:
1.205 avankest 1069: <li><code>Trailer</code>
1.34 avankest 1070:
1.205 avankest 1071: <li><code>Transfer-Encoding</code>
1.34 avankest 1072:
1.205 avankest 1073: <li><code>Upgrade</code>
1.34 avankest 1074:
1.205 avankest 1075: <li><code>User-Agent</code>
1.34 avankest 1076:
1.205 avankest 1077: <li><code>Via</code>
1078: </ul>
1.69 avankest 1079:
1.258 avankest 1080: <p>… or if the start of <var>header</var> is a case-insensitive
1081: match for <code>Proxy-</code> or <code>Sec-</code> (including when
1.205 avankest 1082: <var>header</var> is just <code>Proxy-</code> or <code>Sec-</code>).</p>
1083:
1084: <p class=note>The above headers are not allowed to be set as they are
1085: better controlled by the user agent as it knows best what value they
1.261 avankest 1086: ought to have. Header names starting with <code>Sec-</code> are not
1.205 avankest 1087: allowed to be set to allow new headers to be minted in the future that
1.270 avankest 1088: are guaranteed not to come from <a
1089: href="#xmlhttprequest"><code>XMLHttpRequest</code></a>. (Older clients
1090: would however still be vulnerable as they allow such headers to be set.)</p>
1.185 avankest 1091:
1.205 avankest 1092: <li>
1093: <p>If <var>header</var> is not in the <a
1094: href="#author-request-headers">author request headers</a> list append
1095: <var>header</var> with its associated <var>value</var> to the list and
1096: terminate these steps.
1.6 avankest 1097:
1.205 avankest 1098: <li>
1099: <p>If <var>header</var> is in the <a
1100: href="#author-request-headers">author request headers</a> list either
1101: use multiple headers, combine the values or use a combination of those
1102: (section 4.2, RFC 2616). [<cite><a
1.250 avankest 1103: href="#rfc-rfc2616">RFC2616</a></cite>]
1.205 avankest 1104: </li>
1105: <!-- XXX it seems UAs always combine the values -->
1106: </ol>
1.18 avankest 1107:
1.276 avankest 1108: <p class=note>See also the <a href="#dom-xmlhttprequest-send"><code
1109: title=dom-XMLHttpRequest-send>send()</code></a> method regarding user
1110: agent header handling for caching, authentication, proxies, and cookies.
1.47 avankest 1111:
1.205 avankest 1112: <div class=example>
1113: <pre><code>// The following script:
1.18 avankest 1114: var client = new XMLHttpRequest();
1115: client.open('GET', 'demo.cgi');
1116: client.setRequestHeader('X-Test', 'one');
1117: client.setRequestHeader('X-Test', 'two');
1118: client.send();
1119:
1120: // ...would result in the following header being sent:
1121: ...
1122: X-Test: one, two
1.60 avankest 1123: ...</code></pre>
1.205 avankest 1124: </div>
1.6 avankest 1125:
1.250 avankest 1126: <h4 id=the-send-method><span class=secno>3.6.3. </span>The <code
1.205 avankest 1127: title="">send()</code> method</h4>
1.276 avankest 1128:
1129: <dl class=domintro>
1130: <dt><var title="">client</var> . <a href="#dom-xmlhttprequest-send"><code
1131: title=dom-XMLHttpRequest-send>send(<var title="">data</var>)</code></a>
1132:
1133: <dd>
1134: <p>Initiates the request. The optional argument provides the <a
1135: href="#request-entity-body">request entity body</a>.
1136: </dl>
1137: <!-- XXX throws?! -->
1.205 avankest 1138:
1.275 avankest 1139: <p>When the <dfn id=dom-xmlhttprequest-send
1.276 avankest 1140: title=dom-XMLHttpRequest-send><code>send(<var>data</var>)</code></dfn>
1141: method is invoked, the user agent <em class=ct>must</em> run the following
1142: steps (unless otherwise noted). This algorithm gets aborted when the <a
1.275 avankest 1143: href="#dom-xmlhttprequest-open"><code>open()</code></a> or <a
1144: href="#dom-xmlhttprequest-abort"><code>abort()</code></a> method is
1145: invoked. When the <dfn id=abort-send-algorithm title="abort
1146: send()"><code>send()</code> algorithm is aborted</dfn> the user agent <em
1147: class=ct>must</em> terminate the algorithm after finishing the step it is
1148: on.
1.205 avankest 1149:
1150: <p class=note>The <code title="">send()</code> algorithm can only be
1151: aborted when the <a href="#asynchronous-flag">asynchronous flag</a> is
1152: true and only after the method call has returned.
1.60 avankest 1153:
1.205 avankest 1154: <ol>
1155: <li>
1.277 ! avankest 1156: <p>If the state is not <a href="#dom-xmlhttprequest-opened"
! 1157: title=dom-XMLHttpRequest-OPENED>OPENED</a> raise an
! 1158: <code>INVALID_STATE_ERR</code> exception and terminate these steps.
1.60 avankest 1159:
1.205 avankest 1160: <li>
1161: <p>If the <a href="#send-flag"><code>send()</code> flag</a> is true raise
1162: an <code>INVALID_STATE_ERR</code> exception and terminate these steps.
1.60 avankest 1163:
1.205 avankest 1164: <li>
1165: <p>If the <span>request method is <code>GET</code> or <code>HEAD</code>
1.241 avankest 1166: act as if <var>data</var> is null.</span></p>
1.203 avankest 1167:
1.241 avankest 1168: <p>If the <var>data</var> argument has been omitted or is null, do not
1169: include a <a href="#request-entity-body">request entity body</a> and go
1170: to the next step.</p>
1.234 avankest 1171:
1.250 avankest 1172: <p>Otherwise, let <var>encoding</var> be null, <var>mime type</var> be
1173: null, and then follow these rules:</p>
1.205 avankest 1174:
1175: <dl class=switch>
1.250 avankest 1176: <dt>If <var>data</var> is a <code>Document</code>
1.205 avankest 1177:
1178: <dd>
1.234 avankest 1179: <p>Let <var>encoding</var> be the <a
1180: href="#preferred-mime-name">preferred MIME name</a> of the <a
1.246 avankest 1181: href="#document-character-encoding" title="document's character
1.234 avankest 1182: encoding">character encoding</a> of <var>data</var>. If
1183: <var>encoding</var> is UTF-16 change it to UTF-8.</p>
1184:
1.250 avankest 1185: <p>Let <var>mime type</var> be "<code>application/xml;charset=</code>"
1186: followed by <var>encoding</var>.</p>
1.234 avankest 1187:
1188: <p>Let the <a href="#request-entity-body">request entity body</a> be
1.270 avankest 1189: the result of getting the <a href="#dom-innerhtml"><code
1190: title=dom-innerHTML>innerHTML</code></a> attribute on <var>data</var>
1191: <a href="#dfn-obtain-unicode" title="convert a DOMString to a sequence
1192: of Unicode characters">converted to Unicode</a> and encoded as
1193: <var>encoding</var>. Re-raise any exception this raises.</p>
1.210 avankest 1194:
1.235 avankest 1195: <p class=note>In particular, if the document cannot be serialized an
1.219 avankest 1196: <code>INVALID_STATE_ERR</code> exception is raised.</p>
1197:
1.205 avankest 1198: <p class=note>Subsequent changes to the <code>Document</code> have no
1199: effect on what is submitted.</p>
1.239 avankest 1200:
1.250 avankest 1201: <dt>If <var>data</var> is a <code>DOMString</code>
1.239 avankest 1202:
1203: <dd>
1.250 avankest 1204: <p>Let <var>encoding</var> be UTF-8.</p>
1205:
1206: <p>Let <var>mime type</var> be "<code>text/plain;charset=UTF-8</code>".</p>
1207:
1.239 avankest 1208: <p>Let the <a href="#request-entity-body">request entity body</a> be
1209: <var>data</var> <a href="#dfn-obtain-unicode" title="convert a
1210: DOMString to a sequence of Unicode characters">converted to
1.250 avankest 1211: Unicode</a> and encoded as UTF-8.</p>
1.205 avankest 1212: </dl>
1.103 avankest 1213:
1.270 avankest 1214: <p>If a <code>Content-Type</code> header is set using <a
1.275 avankest 1215: href="#dom-xmlhttprequest-setrequestheader"><code>setRequestHeader()</code></a>
1216: whose value is a <a href="#valid-mime-type">valid MIME type</a> and has
1217: a <code>charset</code> parameter whose value is not a case-insensitive
1.258 avankest 1218: match for <var>encoding</var>, and <var>encoding</var> is not null, set
1219: all the <code>charset</code> parameters of the <code>Content-Type</code>
1220: header to <var>encoding</var>.</p>
1.234 avankest 1221:
1.270 avankest 1222: <p>If no <code>Content-Type</code> header has been set using <a
1.275 avankest 1223: href="#dom-xmlhttprequest-setrequestheader"><code>setRequestHeader()</code></a>
1224: and <var>mime type</var> is not null set a <code>Content-Type</code>
1225: request header with as value <var>mime type</var>.</p>
1.238 avankest 1226: <!-- reminder: if we ever change this to always include charset it has
1227: to be included as the first parameter for compatibility reasons -->
1228:
1.167 avankest 1229:
1.205 avankest 1230: <li>
1231: <p>If the <a href="#asynchronous-flag">asynchronous flag</a> is false
1232: release the <a href="#storage-mutex">storage mutex</a>.
1.60 avankest 1233:
1.205 avankest 1234: <li>
1235: <p>Set the <a href="#error-flag">error flag</a> to false.
1.164 avankest 1236:
1.205 avankest 1237: <li>
1.213 avankest 1238: <p>If the <a href="#asynchronous-flag">asynchronous flag</a> is true run
1239: these substeps:</p>
1240:
1241: <ol>
1242: <li>
1.219 avankest 1243: <p>Set the <a href="#send-flag"><code>send()</code> flag</a> to true.
1244:
1245: <li>
1.213 avankest 1246: <p><a href="#dispatch-readystatechange-event">Dispatch a
1247: <code>readystatechange</code> event</a>.</p>
1248:
1249: <p class=note>The state does not change. The event is dispatched for
1250: historical reasons.</p>
1251:
1252: <li>
1.276 avankest 1253: <p>Return the <a href="#dom-xmlhttprequest-send"><code
1254: title=dom-XMLHttpRequest-send>send()</code></a> method call, but
1255: continue running the steps in this algorithm.
1.213 avankest 1256: </ol>
1257:
1258: <li>
1.263 avankest 1259: <p><a href="#fetch">Fetch</a> the <a href="#request-url">request URL</a>
1260: from <i title="">origin</i> <a
1.262 avankest 1261: href="#xmlhttprequest-origin"><code>XMLHttpRequest</code> origin</a>,
1262: with the <i title="">synchronous flag</i> set if the <a
1263: href="#asynchronous-flag">asynchronous flag</a> is false, using HTTP
1.213 avankest 1264: method <a href="#request-method">request method</a>, user <a
1265: href="#request-username">request username</a> (if non-null) and password
1266: <a href="#request-password">request password</a> (if non-null), taking
1267: into account the <a href="#request-entity-body">request entity body</a>,
1268: list of <a href="#author-request-headers">author request headers</a> and
1269: the rules listed at the end of this section.</p>
1270:
1.226 avankest 1271: <dl class=switch>
1.205 avankest 1272: <dt>If the <a href="#asynchronous-flag">asynchronous flag</a> is false
1.195 avankest 1273:
1.205 avankest 1274: <dd>
1.213 avankest 1275: <p>While making the request also follow the <a
1.221 avankest 1276: href="#same-origin-request-event-rules">same-origin request event
1277: rules</a>.</p>
1.213 avankest 1278: <!--
1.250 avankest 1279: This cannot involve any task queue whatsoever because that would
1280: mean other tasks on the task queue might get processed as well
1281: which is counter to the whole idea of doing things synchronous.
1282: -->
1.213 avankest 1283:
1.276 avankest 1284: <p class=note>The <a href="#dom-xmlhttprequest-send"><code
1285: title=dom-XMLHttpRequest-send>send()</code></a> method call will now
1286: be returned by virtue of this algorithm ending.</p>
1.205 avankest 1287:
1288: <dt>If the <a href="#asynchronous-flag">asynchronous flag</a> is true
1289:
1290: <dd>
1.250 avankest 1291: <p><span>Make progress notifications</span>.</p>
1292:
1293: <p><span>Make upload progress notifications</span>.</p>
1294:
1.213 avankest 1295: <p>While processing the request, as data becomes available and when the
1.250 avankest 1296: user interferes with the request, <a href="#queue-a-task" title="queue
1.257 avankest 1297: a task">queue tasks</a> to update the <a
1298: href="#response-entity-body">response entity body</a> and follow the
1299: <a href="#same-origin-request-event-rules">same-origin request event
1.256 avankest 1300: rules</a>.</p>
1.205 avankest 1301: </dl>
1302: </ol>
1.124 avankest 1303:
1.205 avankest 1304: <hr>
1305:
1.229 avankest 1306: <p>If the user agent allows the end user to configure a proxy it <em
1.250 avankest 1307: class=ct>should</em> modify the request appropriately; i.e., connect to
1308: the proxy host instead of the origin server, modify the
1.214 avankest 1309: <code>Request-Line</code> and send <code>Proxy-Authorization</code>
1310: headers as specified.
1311:
1.264 avankest 1312: <hr>
1313:
1314: <p>If the user agent supports HTTP Authentication and <code
1315: title=http-authorization>Authorization</code> is not in the list of <a
1.220 avankest 1316: href="#author-request-headers">author request headers</a>, it <em
1.270 avankest 1317: class=ct>should</em> consider requests originating from the <a
1318: href="#xmlhttprequest"><code>XMLHttpRequest</code></a> object to be part
1319: of the protection space that includes the accessed URIs and send <code
1.264 avankest 1320: title=http-authorization>Authorization</code> headers and handle <code>401
1321: Unauthorized</code> requests appropriately.
1322:
1323: <p>If authentication fails, <code
1324: title=http-authorization>Authorization</code> is not in the list of <a
1325: href="#author-request-headers">author request headers</a>, <a
1326: href="#request-username">request username</a> is null, and <a
1327: href="#request-password">request password</a> is null, user agents <em
1328: class=ct>should</em> prompt the end user for their username and password.
1329:
1330: <p>If authentication fails, <code
1331: title=http-authorization>Authorization</code> is not in the list of <a
1332: href="#author-request-headers">author request headers</a>, <a
1333: href="#request-username">request username</a> is non-null, and <a
1334: href="#request-password">request password</a> is non-null, user agents <em
1335: class=ct>must not</em> prompt the end user for their username and
1336: password. [<cite><a href="#ref-rfc2617">RFC2617</a></cite>]
1.214 avankest 1337:
1.271 avankest 1338: <p class=note>End users are not prompted if username/password are provided
1.275 avankest 1339: through the <a href="#dom-xmlhttprequest-open"><code>open()</code></a> API
1340: so that authors can implement their own user interface.
1.214 avankest 1341:
1.264 avankest 1342: <hr>
1343:
1.214 avankest 1344: <p>If the user agent supports HTTP State Management it <em
1345: class=ct>should</em> persist, discard and send cookies (as received in the
1346: <code>Set-Cookie</code> and <code>Set-Cookie2</code> response headers, and
1347: sent in the <code>Cookie</code> header) as applicable. [<cite><a
1.232 avankest 1348: href="#ref-cookies">COOKIES</a></cite>]
1.214 avankest 1349:
1.264 avankest 1350: <hr>
1351:
1.214 avankest 1352: <p>If the user agent implements a HTTP cache it <em class=ct>should</em>
1.270 avankest 1353: respect <code>Cache-Control</code> request headers set by the <a
1.275 avankest 1354: href="#dom-xmlhttprequest-setrequestheader"><code>setRequestHeader()</code></a>
1355: (e.g., <code>Cache-Control: no-cache</code> bypasses the cache). It <em
1.214 avankest 1356: class=ct>must not</em> send <code>Cache-Control</code> or
1.229 avankest 1357: <code>Pragma</code> request headers automatically unless the end user
1.214 avankest 1358: explicitly requests such behavior (e.g. by (force-)reloading the page).
1359:
1360: <p>For <code>304 Not Modified</code> responses that are a result of a user
1361: agent generated conditional request the user agent <em class=ct>must</em>
1362: act as if the server gave a <code>200 OK</code> response with the
1.270 avankest 1363: appropriate content. The user agent <em class=ct>must</em> allow <a
1.275 avankest 1364: href="#dom-xmlhttprequest-setrequestheader"><code>setRequestHeader()</code></a>
1365: to override automatic cache validation by setting request headers (e.g.
1.250 avankest 1366: <code>If-None-Match</code> or <code>If-Modified-Since</code>), in which
1367: case <code>304 Not Modified</code> responses <em class=ct>must</em> be
1368: passed through. [<cite><a href="#rfc-rfc2616">RFC2616</a></cite>]
1.214 avankest 1369:
1.264 avankest 1370: <hr>
1371:
1.214 avankest 1372: <p>If the user agent implements server-driven content-negotiation it <em
1373: class=ct>should</em> set <code>Accept-Encoding</code> and
1.233 avankest 1374: <code>Accept-Charset</code> headers as appropriate. For
1375: <code>Accept</code> and <code>Accept-Language</code> the user agent <em
1376: class=ct>must</em> follow these constraints:
1377:
1378: <ul>
1379: <li>
1380: <p>Both headers <em class=ct>must not</em> be modified if they are
1.270 avankest 1381: already set through <a
1.275 avankest 1382: href="#dom-xmlhttprequest-setrequestheader"><code>setRequestHeader()</code></a>.
1.233 avankest 1383:
1384: <li>
1.270 avankest 1385: <p>If not set through <a
1.275 avankest 1386: href="#dom-xmlhttprequest-setrequestheader"><code>setRequestHeader()</code></a>
1.257 avankest 1387: <code>Accept-Language</code> <em class=ct>should</em> be set as
1.233 avankest 1388: appropriate.
1389:
1390: <li>
1.270 avankest 1391: <p>If not set through <a
1.275 avankest 1392: href="#dom-xmlhttprequest-setrequestheader"><code>setRequestHeader()</code></a>
1.233 avankest 1393: <code>Accept</code> <em class=ct>must</em> be set with as value
1394: <code>*/*</code>.
1395: </ul>
1396:
1397: <p>Responses <em class=ct>must</em> have the content-encodings
1.250 avankest 1398: automatically decoded. [<cite><a href="#rfc-rfc2616">RFC2616</a></cite>]
1.214 avankest 1399:
1.264 avankest 1400: <hr>
1401:
1.214 avankest 1402: <p>Besides the <a href="#author-request-headers">author request headers</a>
1403: user agents <em class=ct>should not</em> include additional request
1404: headers other than those mentioned above or other than those authors are
1.270 avankest 1405: not allowed to set using <a
1.275 avankest 1406: href="#dom-xmlhttprequest-setrequestheader"><code>setRequestHeader()</code></a>.
1407: This ensures that authors have a reasonably predictable API.
1.214 avankest 1408:
1.250 avankest 1409: <h4 id=infrastructure-for-the-send-method><span class=secno>3.6.4.
1.214 avankest 1410: </span>Infrastructure for the <code title="">send()</code> method</h4>
1411:
1.221 avankest 1412: <p>The <dfn id=same-origin-request-event-rules>same-origin request event
1413: rules</dfn> are as follows:
1.205 avankest 1414:
1415: <dl class=switch>
1416: <dt>If the response is an HTTP redirect
1417:
1418: <dd>
1.259 avankest 1419: <p>If the <a href="#origin">origin</a> of the <a href="#url">URL</a>
1420: conveyed by the <code title=http-location>Location</code> header is <a
1421: href="#same-origin">same origin</a> with the <a
1422: href="#xmlhttprequest-origin"><code>XMLHttpRequest</code> origin</a> and
1423: the redirect does not violate infinite loop precautions, transparently
1424: follow the redirect while observing the <a
1.221 avankest 1425: href="#same-origin-request-event-rules">same-origin request event
1426: rules</a>.</p>
1.205 avankest 1427:
1.250 avankest 1428: <p>Otherwise, this is a <a href="#network-error">network error</a>.</p>
1429:
1.205 avankest 1430: <p class=note>HTTP places requirements on the user agent regarding the
1.206 avankest 1431: preservation of the <a href="#request-method">request method</a> and <a
1432: href="#request-entity-body">request entity body</a> during redirects,
1.229 avankest 1433: and also requires end users to be notified of certain kinds of automatic
1.205 avankest 1434: redirections.</p>
1435: <!-- XXX HTTP needs fixing here -->
1436:
1.229 avankest 1437: <dt>If the end user cancels the download
1.205 avankest 1438:
1.215 avankest 1439: <dd>
1440: <p>This is an <a href="#abort-error">abort error</a>.
1.119 avankest 1441:
1.216 avankest 1442: <dt>In case of network errors
1443:
1.215 avankest 1444: <dd>
1445: <p>In case of DNS errors, TLS negotiation failure, or other type of
1446: network errors, this is a <a href="#network-error">network error</a>. Do
1.229 avankest 1447: not request any kind of end user interaction.</p>
1.205 avankest 1448:
1.215 avankest 1449: <p class=note>This does not include HTTP responses that indicate some
1450: type of error, such as HTTP status code 410.</p>
1.119 avankest 1451:
1.215 avankest 1452: <dt>Once all HTTP headers have been received and the <a
1.259 avankest 1453: href="#asynchronous-flag">asynchronous flag</a> is true (and this is not
1454: an HTTP redirect)
1.60 avankest 1455:
1.215 avankest 1456: <dd>
1.277 ! avankest 1457: <p><a href="#switch-headers-received">Switch to the
! 1458: dom-XMLHttpRequest-HEADERS_RECEIVED</a>.
1.60 avankest 1459:
1.222 avankest 1460: <dt>Once the first byte (or more) of the <a
1461: href="#response-entity-body">response entity body</a> has been received
1462: and the <a href="#asynchronous-flag">asynchronous flag</a> is true
1463:
1464: <dt>If there is no <a href="#response-entity-body">response entity
1465: body</a> and the <a href="#asynchronous-flag">asynchronous flag</a> is
1.215 avankest 1466: true
1.19 avankest 1467:
1.222 avankest 1468: <dd>
1.277 ! avankest 1469: <p><a href="#switch-loading">Switch to the
! 1470: dom-XMLHttpRequest-LOADING</a>.
1.222 avankest 1471:
1472: <dt>Once the whole <a href="#response-entity-body">response entity
1473: body</a> has been received
1474:
1475: <dt>If there is no <a href="#response-entity-body">response entity
1.226 avankest 1476: body</a> and the <a href="#asynchronous-flag">asynchronous flag</a> is
1.277 ! avankest 1477: false or the state is <a href="#dom-xmlhttprequest-loading"
! 1478: title=dom-XMLHttpRequest-LOADING>LOADING</a>
1.185 avankest 1479:
1.215 avankest 1480: <dd>
1.277 ! avankest 1481: <p><a href="#switch-done">Switch to the dom-XMLHttpRequest-DONE</a>.
1.215 avankest 1482: </dl>
1.6 avankest 1483:
1.215 avankest 1484: <hr>
1.6 avankest 1485:
1.215 avankest 1486: <p>When something is said to be a <dfn id=network-error>network error</dfn>
1.270 avankest 1487: run the <a href="#request-error">request error</a> steps for exception <a
1488: href="#network-err"><code>NETWORK_ERR</code></a>.
1.62 avankest 1489:
1.243 avankest 1490: <p>When something is said to be an <dfn id=abort-error>abort error</dfn>
1.270 avankest 1491: run the <a href="#request-error">request error</a> steps for exception <a
1492: href="#abort-err"><code>ABORT_ERR</code></a>.
1.84 avankest 1493:
1.244 avankest 1494: <p>When something is said to be a <dfn id=request-error>request error</dfn>
1495: for exception <var>exception</var> run these steps:
1.60 avankest 1496:
1.256 avankest 1497: <ol>
1498: <li>
1499: <p>The user agent <em class=ct>should</em> cancel any network activity
1500: for which the object is responsible.
1501:
1502: <li>
1503: <p>If there are any <a href="#task" title=task>tasks</a> from the
1504: object's <a
1505: href="#xmlhttprequest-task-source"><code>XMLHttpRequest</code> task
1506: source</a> in one of the <a href="#task-queues">task queues</a>, then
1507: remove those tasks.
1.252 avankest 1508:
1.215 avankest 1509: <li>
1510: <p>Set the <a href="#response-entity-body">response entity body</a> to
1511: null.
1.205 avankest 1512:
1.215 avankest 1513: <li>
1.256 avankest 1514: <p>Empty the list of <a href="#author-request-headers">author request
1515: headers</a>.
1.205 avankest 1516:
1.215 avankest 1517: <li>
1.256 avankest 1518: <p>Set the the <a href="#error-flag">error flag</a> to true.
1.205 avankest 1519:
1.215 avankest 1520: <li>
1.277 ! avankest 1521: <p>Switch the state to <a href="#dom-xmlhttprequest-done"
! 1522: title=dom-XMLHttpRequest-DONE>DONE</a>.
1.205 avankest 1523:
1.215 avankest 1524: <li>
1525: <p>If the <a href="#asynchronous-flag">asynchronous flag</a> is false
1.243 avankest 1526: raise an <var>exception</var> exception and terminate the overall set of
1527: steps.
1.205 avankest 1528:
1.215 avankest 1529: <li>
1.251 avankest 1530: <p><a href="#dispatch-readystatechange-event">Dispatch a
1.250 avankest 1531: <code>readystatechange</code> event</a>.</p>
1532:
1533: <p class=note>At this point it is clear that the <a
1534: href="#asynchronous-flag">asynchronous flag</a> is true.</p>
1.205 avankest 1535:
1.215 avankest 1536: <li>
1.250 avankest 1537: <p>Terminate the overall algorithm.
1.215 avankest 1538: </ol>
1.6 avankest 1539:
1.250 avankest 1540: <p class=note>A future version of this specification will dispatch an
1.275 avankest 1541: <code>error</code>/<a
1542: href="#dom-xmlhttprequest-abort"><code>abort</code></a> event here as
1.250 avankest 1543: well. (Depending on the type of error.)
1.6 avankest 1544:
1.215 avankest 1545: <hr>
1.2 avankest 1546:
1.215 avankest 1547: <p>When it is said to <dfn id=switch-headers-received>switch to the
1.277 ! avankest 1548: dom-XMLHttpRequest-HEADERS_RECEIVED</dfn> run these steps:
1.60 avankest 1549:
1.215 avankest 1550: <ol>
1551: <li>
1.277 ! avankest 1552: <p>Switch the state to <a href="#dom-xmlhttprequest-headers_received"
! 1553: title="dom-XMLHttpRequest-HEADERS_RECEIVED">HEADERS_RECEIVED</a>.
1.125 avankest 1554:
1.215 avankest 1555: <li>
1.251 avankest 1556: <p><a href="#dispatch-readystatechange-event">Dispatch a
1.215 avankest 1557: <code>readystatechange</code> event</a>.
1558: </ol>
1.205 avankest 1559:
1.277 ! avankest 1560: <p>When it is said to <dfn id=switch-loading>switch to the
! 1561: dom-XMLHttpRequest-LOADING</dfn> run these steps:
1.205 avankest 1562:
1.215 avankest 1563: <ol>
1564: <li>
1.277 ! avankest 1565: <p>Switch the state to <a href="#dom-xmlhttprequest-loading"
! 1566: title=dom-XMLHttpRequest-LOADING>LOADING</a>.
1.17 avankest 1567:
1.215 avankest 1568: <li>
1.251 avankest 1569: <p><a href="#dispatch-readystatechange-event">Dispatch a
1.215 avankest 1570: <code>readystatechange</code> event</a>.
1571: </ol>
1.205 avankest 1572:
1.277 ! avankest 1573: <p>When it is said to <dfn id=switch-done>switch to the
! 1574: dom-XMLHttpRequest-DONE</dfn> run these steps:
1.218 avankest 1575:
1576: <ol>
1577: <li>
1.257 avankest 1578: <p>If the <a href="#asynchronous-flag">asynchronous flag</a> is false
1579: update the <a href="#response-entity-body">response entity body</a>.
1580:
1581: <li>
1.277 ! avankest 1582: <p>Switch the state to <a href="#dom-xmlhttprequest-done"
! 1583: title=dom-XMLHttpRequest-DONE>DONE</a>.
1.218 avankest 1584:
1585: <li>
1.250 avankest 1586: <p><a href="#dispatch-readystatechange-event">Dispatch a
1.218 avankest 1587: <code>readystatechange</code> event</a>.
1588: </ol>
1589:
1.250 avankest 1590: <h4 id=the-abort-method><span class=secno>3.6.5. </span>The <code
1.205 avankest 1591: title="">abort()</code> method</h4>
1592:
1.275 avankest 1593: <p>When the <dfn id=dom-xmlhttprequest-abort><code>abort()</code></dfn>
1594: method is invoked, the user agent <em class=ct>must</em> run these steps
1595: (unless otherwise noted):
1.205 avankest 1596:
1597: <ol>
1598: <li>
1599: <p><a href="#abort-send-algorithm" title="abort send()">Abort the
1600: <code>send()</code> algorithm</a>.
1.202 avankest 1601:
1.205 avankest 1602: <li>
1603: <p>The user agent <em class=ct>should</em> cancel any network activity
1604: for which the object is responsible.
1.254 avankest 1605:
1606: <li>
1607: <p>If there are any <a href="#task" title=task>tasks</a> from the
1608: object's <a
1609: href="#xmlhttprequest-task-source"><code>XMLHttpRequest</code> task
1610: source</a> in one of the <a href="#task-queues">task queues</a>, then
1611: remove those tasks.
1.205 avankest 1612:
1613: <li>
1614: <p>Set the <a href="#response-entity-body">response entity body</a> to
1615: null.
1616:
1617: <li>
1.254 avankest 1618: <p>Empty the list of <a href="#author-request-headers">author request
1619: headers</a>.
1.205 avankest 1620:
1621: <li>
1.254 avankest 1622: <p>Set the <a href="#error-flag">error flag</a> to true.
1.205 avankest 1623:
1624: <li>
1.277 ! avankest 1625: <p>If the state is <a href="#dom-xmlhttprequest-unsent"
! 1626: title=dom-XMLHttpRequest-UNSENT>UNSENT</a>, <a
! 1627: href="#dom-xmlhttprequest-opened"
! 1628: title=dom-XMLHttpRequest-OPENED>OPENED</a> with the <a
! 1629: href="#send-flag"><code>send()</code> flag</a> being false, or <a
! 1630: href="#dom-xmlhttprequest-done" title=dom-XMLHttpRequest-DONE>DONE</a>
! 1631: go to the next step.</p>
1.205 avankest 1632:
1633: <p>Otherwise run these substeps:</p>
1634:
1635: <ol>
1.202 avankest 1636: <li>
1.277 ! avankest 1637: <p>Switch the state to <a href="#dom-xmlhttprequest-done"
! 1638: title=dom-XMLHttpRequest-DONE>DONE</a>.
1.77 avankest 1639:
1640: <li>
1.205 avankest 1641: <p>Set the <a href="#send-flag"><code>send()</code> flag</a> to false.
1.77 avankest 1642:
1643: <li>
1.205 avankest 1644: <p><a href="#dispatch-readystatechange-event">Dispatch a
1645: <code>readystatechange</code> event</a>.
1.60 avankest 1646: </ol>
1.17 avankest 1647:
1.252 avankest 1648: <p class=note>A future version of this specification will dispatch an
1649: <code title=abort-event>abort</code> event here.</p>
1.220 avankest 1650:
1.205 avankest 1651: <li>
1.277 ! avankest 1652: <p>Switch the state to <a href="#dom-xmlhttprequest-unsent"
! 1653: title=dom-XMLHttpRequest-UNSENT>UNSENT</a>.</p>
1.205 avankest 1654:
1655: <p class=note>No <code>readystatechange</code> event is dispatched.</p>
1656: </ol>
1657:
1.250 avankest 1658: <h3 id=response><span class=secno>3.7. </span>Response</h3>
1.205 avankest 1659:
1.250 avankest 1660: <h4 id=the-status-attribute><span class=secno>3.7.1. </span>The <code
1.205 avankest 1661: title="">status</code> attribute</h4>
1662:
1.275 avankest 1663: <p>The <dfn id=dom-xmlhttprequest-status><code>status</code></dfn>
1664: attribute <em class=ct>must</em> return the result of running these steps:
1.224 avankest 1665:
1666: <ol>
1667: <li>
1.277 ! avankest 1668: <p>If the state is <a href="#dom-xmlhttprequest-unsent"
! 1669: title=dom-XMLHttpRequest-UNSENT>UNSENT</a> or <a
! 1670: href="#dom-xmlhttprequest-opened"
! 1671: title=dom-XMLHttpRequest-OPENED>OPENED</a> return 0 and terminate these
! 1672: steps.
1.224 avankest 1673:
1674: <li>
1.241 avankest 1675: <p>If the <a href="#error-flag">error flag</a> is true return 0 and
1676: terminate these steps.
1.224 avankest 1677:
1678: <li>
1679: <p>Return the HTTP status code.
1680: </ol>
1.205 avankest 1681:
1.250 avankest 1682: <h4 id=the-statustext-attribute><span class=secno>3.7.2. </span>The <code
1.205 avankest 1683: title="">statusText</code> attribute</h4>
1684:
1.275 avankest 1685: <p>The <dfn id=dom-xmlhttprequest-statustext><code>statusText</code></dfn>
1686: attribute <em class=ct>must</em> return the result of running these steps:
1.224 avankest 1687:
1688: <ol>
1689: <li>
1.277 ! avankest 1690: <p>If the state is <a href="#dom-xmlhttprequest-unsent"
! 1691: title=dom-XMLHttpRequest-UNSENT>UNSENT</a> or <a
! 1692: href="#dom-xmlhttprequest-opened"
! 1693: title=dom-XMLHttpRequest-OPENED>OPENED</a> return the empty string and
! 1694: terminate these steps.
1.224 avankest 1695:
1696: <li>
1697: <p>If the <a href="#error-flag">error flag</a> is true return the empty
1698: string and terminate these steps.
1699:
1700: <li>
1701: <p>Return the HTTP status text.
1702: </ol>
1.205 avankest 1703:
1.250 avankest 1704: <h4 id=the-getresponseheader-method><span class=secno>3.7.3. </span>The
1.205 avankest 1705: <code title="">getResponseHeader()</code> method</h4>
1706:
1.275 avankest 1707: <p>When the <dfn id=dom-xmlhttprequest-getresponseheader
1.205 avankest 1708: title=getresponseheader><code>getResponseHeader(<var>header</var>)</code></dfn>
1.219 avankest 1709: is invoked, the user agent <em class=ct>must</em> run these steps:
1.205 avankest 1710:
1711: <ol>
1712: <li>
1.277 ! avankest 1713: <p>If the state is <a href="#dom-xmlhttprequest-unsent"
! 1714: title=dom-XMLHttpRequest-UNSENT>UNSENT</a> or <a
! 1715: href="#dom-xmlhttprequest-opened"
! 1716: title=dom-XMLHttpRequest-OPENED>OPENED</a> return null and terminate
! 1717: these steps.
1.205 avankest 1718:
1719: <li>
1.241 avankest 1720: <p>If the <a href="#error-flag">error flag</a> is true return null and
1721: terminate these steps.
1.205 avankest 1722:
1723: <li>
1.258 avankest 1724: <p>If any code point in <var>header</var> is higher than U+00FF LATIN
1725: SMALL LETTER Y WITH DIAERESIS return null and terminate these steps.
1726:
1727: <li>
1.260 avankest 1728: <p>Let <var>header</var> be the result of <span title="deflate a
1729: DOMString into an byte sequence">deflating</span> <var>header</var>.
1.258 avankest 1730: </li>
1731: <!-- This sounds lame, but it works. -->
1.205 avankest 1732:
1733: <li>
1.258 avankest 1734: <p>If <var>header</var> is a case-insensitive match for
1735: <code>Set-Cookie</code> or <code>Set-Cookie2</code> return null and
1.205 avankest 1736: terminate these steps.
1737:
1738: <li>
1.258 avankest 1739: <p>If <var>header</var> is a case-insensitive match for multiple HTTP
1.260 avankest 1740: response headers, return the <span title="inflate an byte sequence into
1741: a DOMString">inflated</span> values of these headers as a single
1742: concatenated string separated from each other by a U+002C COMMA U+0020
1743: SPACE character pair and terminate these steps.
1.258 avankest 1744:
1745: <li>
1746: <p>If <var>header</var> is a case-insensitive match for a single HTTP
1.260 avankest 1747: response header, return the <span title="inflate an byte sequence into a
1748: DOMString">inflated</span> value of that header and terminate these
1749: steps.
1.205 avankest 1750:
1751: <li>
1.241 avankest 1752: <p>Return null.
1.205 avankest 1753: </ol>
1754:
1755: <div class=example>
1.252 avankest 1756: <p>For the following script:</p>
1757:
1758: <pre><code>var client = new XMLHttpRequest();
1759: client.open("GET", "unicorns-are-teh-awesome.txt", true);
1.6 avankest 1760: client.send();
1.16 avankest 1761: client.onreadystatechange = function() {
1.252 avankest 1762: if(this.readyState == 2) {
1763: print(client.getResponseHeader("Content-Type"));
1764: }
1765: }</code></pre>
1766:
1767: <p>The <code>print()</code> function will get to process something like:</p>
1.1 avankest 1768:
1.252 avankest 1769: <pre><code>text/plain; charset=UTF-8</code></pre>
1.205 avankest 1770: </div>
1771:
1.250 avankest 1772: <h4 id=the-getallresponseheaders-method><span class=secno>3.7.4. </span>The
1.205 avankest 1773: <code title="">getAllResponseHeaders()</code> method</h4>
1.2 avankest 1774:
1.205 avankest 1775: <p>When the <dfn
1.275 avankest 1776: id=dom-xmlhttprequest-getallresponseheaders><code>getAllResponseHeaders()</code></dfn>
1777: method is invoked, the user agent <em class=ct>must</em> run the following
1778: steps:
1.6 avankest 1779:
1.205 avankest 1780: <ol>
1781: <li>
1.277 ! avankest 1782: <p>If the state is <a href="#dom-xmlhttprequest-unsent"
! 1783: title=dom-XMLHttpRequest-UNSENT>UNSENT</a> or <a
! 1784: href="#dom-xmlhttprequest-opened"
! 1785: title=dom-XMLHttpRequest-OPENED>OPENED</a> return the empty string and
! 1786: terminate these steps.
1.205 avankest 1787:
1788: <li>
1789: <p>If the <a href="#error-flag">error flag</a> is true return the empty
1790: string and terminate these steps.
1791:
1792: <li>
1.258 avankest 1793: <p>Return all the HTTP headers, excluding headers that are a
1794: case-insensitive match for <code>Set-Cookie</code> or
1.260 avankest 1795: <code>Set-Cookie2</code>, <span title="inflate an byte sequence into a
1796: DOMString">inflated</span>, as a single string, with each header line
1797: separated by a U+000D CR U+000A LF pair, excluding the status line, and
1798: with each header name and header value separated by a U+003A COLON
1799: U+0020 SPACE pair.
1.205 avankest 1800: </ol>
1801:
1802: <div class=example>
1.252 avankest 1803: <p>For the following script:</p>
1804:
1805: <pre><code>var client = new XMLHttpRequest();
1806: client.open("GET", "narwhals-too.txt", true);
1.205 avankest 1807: client.send();
1808: client.onreadystatechange = function() {
1809: if(this.readyState == 2) {
1810: print(this.getAllResponseHeaders());
1811: }
1.252 avankest 1812: }</code></pre>
1813:
1814: <p>The <code>print()</code> function will get to process something like:</p>
1.205 avankest 1815:
1.252 avankest 1816: <pre><code>Date: Sun, 24 Oct 2004 04:58:38 GMT
1.205 avankest 1817: Server: Apache/1.3.31 (Unix)
1818: Keep-Alive: timeout=15, max=99
1819: Connection: Keep-Alive
1820: Transfer-Encoding: chunked
1821: Content-Type: text/plain; charset=utf-8</code></pre>
1822: </div>
1823:
1.250 avankest 1824: <h4 id=response-entity-body0><span class=secno>3.7.5. </span>Response
1.248 avankest 1825: Entity Body</h4>
1.250 avankest 1826:
1827: <p>The <dfn id=response-mime-type>response MIME type</dfn> is the MIME type
1828: the <code>Content-Type</code> header contains without any parameters or
1829: null if the header could not be parsed properly or was omitted. The <dfn
1830: id=override-mime-type>override MIME type</dfn> is always null. <dfn
1831: id=final-mime-type>Final MIME type</dfn> is the override MIME type unless
1832: that is null in which case it is the response MIME type.
1833:
1834: <p>The <dfn id=response-charset>response charset</dfn> is the value of the
1835: <code>charset</code> parameter of the <code>Content-Type</code> header or
1836: null if there was no <code>charset</code> parameter or if the header could
1837: not be parsed properly or was omitted. The <dfn
1838: id=override-charset>override charset</dfn> is always null. <dfn
1839: id=final-charset>Final charset</dfn> is the override charset unless that
1840: is null in which case it is the response charset.
1841:
1842: <p class=note><a href="#override-mime-type">Override MIME type</a> and <a
1843: href="#override-charset">override charset</a> are introduced here solely
1844: to make editing several levels of XMLHttpRequest simultaneously somewhat
1845: easier. Apologies for any confusion they might cause.
1846:
1847: <hr>
1.205 avankest 1848:
1849: <p>The <dfn id=response-entity-body>response entity body</dfn> is the
1.257 avankest 1850: fragment of the <a href="#entity-body">entity body</a> of the response
1.277 ! avankest 1851: received so far (<a href="#dom-xmlhttprequest-loading"
! 1852: title=dom-XMLHttpRequest-LOADING>LOADING</a>) or the complete entity body
! 1853: of the response (<a href="#dom-xmlhttprequest-done"
! 1854: title=dom-XMLHttpRequest-DONE>DONE</a>). If the response does not have an
! 1855: entity body the response entity body is null.
1.257 avankest 1856:
1857: <p class=note>The <a href="#response-entity-body">response entity body</a>
1.276 avankest 1858: is updated as part of the <a href="#dom-xmlhttprequest-send"><code
1859: title=dom-XMLHttpRequest-send>send()</code></a> algorithm.
1.205 avankest 1860:
1861: <hr>
1862:
1863: <p>The <dfn id=text-response-entity-body>text response entity body</dfn> is
1864: a <code>DOMString</code> representing the <a
1.250 avankest 1865: href="#response-entity-body">response entity body</a>. The text response
1866: entity body is the return value of the following algorithm:
1.205 avankest 1867:
1868: <ol>
1869: <li>
1.250 avankest 1870: <p>If the response entity body is null return the empty string and
1871: terminate these steps.</p>
1872:
1873: <li>
1874: <p>Let <var>charset</var> be the <a href="#final-charset">final
1875: charset</a>.
1.205 avankest 1876:
1877: <li>
1.250 avankest 1878: <p>Let <var>mime</var> be the <a href="#final-mime-type">final MIME
1879: type</a>.
1.205 avankest 1880:
1881: <li>
1.250 avankest 1882: <p>If <var>charset</var> is null and <var>mime</var> is null,
1.205 avankest 1883: <code>text/xml</code>, <code>application/xml</code> or ends in <code
1.250 avankest 1884: title="">+xml</code> use the rules set forth in the XML specifications
1885: to determine the character encoding. Let <var>charset</var> be the
1886: determined character encoding.
1.205 avankest 1887:
1888: <li>
1.250 avankest 1889: <p>If <var>charset</var> is null and <var>mime</var> is
1890: <code>text/html</code> follow the rules set forth in the HTML
1891: specification to determine the character encoding. Let
1.205 avankest 1892: <var>charset</var> be the determined character encoding. [<cite><a
1893: href="#ref-html5">HTML5</a></cite>]
1894:
1895: <li>
1896: <p>If <var>charset</var> is null then, for each of the rows in the
1897: following table, starting with the first one and going down, if the
1898: first bytes of <var>bytes</var> match the bytes given in the first
1899: column, then let <var>charset</var> be the encoding given in the cell in
1900: the second column of that row. If there is no match <var>charset</var>
1901: remains null.</p>
1902:
1903: <table>
1904: <thead>
1905: <tr>
1906: <th>Bytes in Hexadecimal
1907:
1908: <th>Description
1909:
1.239 avankest 1910: <tbody>
1.205 avankest 1911: <tr>
1912: <td>FE FF
1913:
1914: <td>UTF-16BE BOM
1915:
1916: <tr>
1917: <td>FF FE
1918:
1919: <td>UTF-16LE BOM
1920:
1921: <tr>
1922: <td>EF BB BF
1923:
1.239 avankest 1924: <td>UTF-8 BOM
1.205 avankest 1925: </table>
1926:
1927: <li>
1928: <p>If <var>charset</var> is null let <var>charset</var> be UTF-8.
1929:
1930: <li>
1931: <p>Return the result of decoding the response entity body using
1932: <var>charset</var>. Replace bytes or sequences of bytes that are not
1.250 avankest 1933: valid accordng to the <var>charset</var> with a single U+FFFD
1.205 avankest 1934: REPLACEMENT CHARACTER character.
1935: </ol>
1936:
1937: <p class=note>Authors are strongly encouraged to encode their resources
1938: using UTF-8.
1939:
1940: <hr>
1941:
1.250 avankest 1942: <p>The <dfn id=document-response-entity-body>document response entity
1943: body</dfn> is either a <code>Document</code> representing the <a
1944: href="#response-entity-body">response entity body</a> or null. The
1945: document response entity body is the return value of the following
1946: algorithm:
1.89 avankest 1947:
1.205 avankest 1948: <ol>
1949: <li>
1950: <p>If the <a href="#response-entity-body">response entity body</a> is
1.241 avankest 1951: null terminate these steps and return null.
1.6 avankest 1952:
1.205 avankest 1953: <li>
1.250 avankest 1954: <p>If <a href="#final-mime-type">final MIME type</a> is not null,
1955: <code>text/xml</code>, <code>application/xml</code>, and does not end in
1956: <code title="">+xml</code> terminate these steps and return null.
1.12 avankest 1957:
1.205 avankest 1958: <li>
1.268 avankest 1959: <p>Let <var>document</var> be a <a
1960: href="#cookie-free-document-object">cookie-free <code>Document</code>
1961: object</a> that represents the result of parsing the response entity
1962: body into a document tree following the rules from the XML
1963: specifications. If this fails (unsupported character encoding, namespace
1964: well-formedness error et cetera) terminate these steps return null.
1965: [<cite><a href="#ref-xml">XML</a></cite>]</p>
1.6 avankest 1966:
1.205 avankest 1967: <p class=note>Scripts in the resulting document tree will not be
1968: executed, resources referenced will not be loaded and no associated XSLT
1969: will be applied.</p>
1.76 avankest 1970:
1.205 avankest 1971: <li>
1.250 avankest 1972: <p>Return <var>document</var>.
1.205 avankest 1973: </ol>
1.76 avankest 1974:
1.250 avankest 1975: <h4 id=the-responsetext-attribute><span class=secno>3.7.6. </span>The <code
1.205 avankest 1976: title="">responseText</code> attribute</h4>
1.12 avankest 1977:
1.275 avankest 1978: <p>The <dfn
1979: id=dom-xmlhttprequest-responsetext><code>responseText</code></dfn>
1980: attribute <em class=ct>must</em> return the result of running these steps:
1.6 avankest 1981:
1.205 avankest 1982: <ol>
1983: <li>
1.277 ! avankest 1984: <p>If the state is not <a href="#dom-xmlhttprequest-loading"
! 1985: title=dom-XMLHttpRequest-LOADING>LOADING</a> or <a
! 1986: href="#dom-xmlhttprequest-done" title=dom-XMLHttpRequest-DONE>DONE</a>
1.205 avankest 1987: return the empty string and terminate these steps.
1.12 avankest 1988:
1.205 avankest 1989: <li>
1990: <p>Return the <a href="#text-response-entity-body">text response entity
1991: body</a>.
1992: </ol>
1.2 avankest 1993:
1.250 avankest 1994: <h4 id=the-responsexml-attribute><span class=secno>3.7.7. </span>The <code
1.205 avankest 1995: title="">responseXML</code> attribute</h4>
1.2 avankest 1996:
1.275 avankest 1997: <p>The <dfn
1998: id=dom-xmlhttprequest-responsexml><code>responseXML</code></dfn> attribute
1999: <em class=ct>must</em> return the result of running these steps:
1.2 avankest 2000:
1.205 avankest 2001: <ol>
2002: <li>
1.277 ! avankest 2003: <p>If the state is not <a href="#dom-xmlhttprequest-done"
! 2004: title=dom-XMLHttpRequest-DONE>DONE</a> return null and terminate these
! 2005: steps.
1.2 avankest 2006:
1.205 avankest 2007: <li>
1.250 avankest 2008: <p>Return the <a href="#document-response-entity-body">document response
2009: entity body</a>.
1.205 avankest 2010: </ol>
1.2 avankest 2011:
1.250 avankest 2012: <h2 id=exceptions><span class=secno>4. </span>Exceptions</h2>
1.33 avankest 2013:
1.139 avankest 2014: <p>Several algorithms in this specification may result in an exception
2015: being thrown. These exceptions are all part of the group
1.186 avankest 2016: <code>ExceptionCode</code> and use the <code>DOMException</code> object,
1.139 avankest 2017: which is defined in DOM Level 3 Core. In addition this specification
2018: extends the <code>ExceptionCode</code> group with several new constants as
1.146 avankest 2019: indicated below. [<cite><a href="#ref-dom3core">DOM3Core</a></cite>]
1.139 avankest 2020:
1.194 avankest 2021: <p class=note>Thus, exceptions used by this specification and not defined
2022: in this section are defined by DOM Level 3 Core.
2023:
1.34 avankest 2024: <pre
1.139 avankest 2025: class=idl>const unsigned short <a href="#security-err">SECURITY_ERR</a> = 18;
1.200 avankest 2026: const unsigned short <a href="#network-err">NETWORK_ERR</a> = 19;
2027: const unsigned short <a href="#abort-err">ABORT_ERR</a> = 20;</pre>
1.33 avankest 2028:
1.139 avankest 2029: <p>The <dfn id=security-err><code>SECURITY_ERR</code></dfn> exception is
2030: raised if an attempt is made to perform an operation or access some data
2031: in a way that would be a security risk or a violation of the user agent's
2032: security policy.</p>
2033: <!-- http://lists.w3.org/Archives/Public/public-webapi/2006May/0027.html -->
2034:
1.35 avankest 2035: <p>The <dfn id=network-err><code>NETWORK_ERR</code></dfn> exception is
1.139 avankest 2036: raised when a network error occurs in synchronous requests.
1.122 avankest 2037:
1.139 avankest 2038: <p>The <dfn id=abort-err><code>ABORT_ERR</code></dfn> exception is raised
1.122 avankest 2039: when the user aborts a request in synchronous requests.
2040:
1.242 avankest 2041: <p class=note>These exceptions will be folded into an update of DOM Level 3
2042: Core in due course, as they are appropriate for other API specifications
1.200 avankest 2043: as well.
2044:
1.31 avankest 2045: <h2 class=no-num id=notcovered>Not in this Specification</h2>
2046:
1.144 avankest 2047: <p><em>This section is non-normative.</em>
1.31 avankest 2048:
1.73 avankest 2049: <p>This specification does not include the following features which are
2050: being considered for a future version of this specification:
1.31 avankest 2051:
2052: <ul>
2053: <li><code>load</code> event and <code>onload</code> attribute;
2054:
2055: <li><code>error</code> event and <code>onerror</code> attribute;
2056:
2057: <li><code>progress</code> event and <code>onprogress</code> attribute;
2058:
2059: <li><code title="">abort</code> event and <code>onabort</code> attribute;
2060:
2061: <li>Timers have been suggested, perhaps an <code>ontimeout</code>
2062: attribute;
2063:
2064: <li>Property to disable following redirects;
2065:
1.32 avankest 2066: <li><code title="">responseXML</code> for <code>text/html</code>
2067: documents;
1.31 avankest 2068:
1.205 avankest 2069: <li>Cross-origin <code title="">XMLHttpRequest</code>;
1.42 avankest 2070:
1.88 avankest 2071: <li><code>responseBody</code> to deal with byte streams;
1.42 avankest 2072:
1.115 avankest 2073: <li><code>overrideMimeType</code> to fix up MIME types;
2074:
1.88 avankest 2075: <li><code>getRequestHeader()</code> and
2076: <code>removeRequestHeader()</code>.
1.31 avankest 2077: </ul>
2078:
1.250 avankest 2079: <h2 class=no-num id=references>References</h2>
1.2 avankest 2080:
1.178 avankest 2081: <p>Unless marked "Non-normative" these references are normative.
2082:
1.7 avankest 2083: <dl>
1.232 avankest 2084: <dt>[<dfn id=ref-cookies>COOKIES</dfn>]
1.205 avankest 2085:
1.273 avankest 2086: <dd><cite><a
2087: href="http://tools.ietf.org/html/draft-ietf-httpstate-cookie">HTTP State
2088: Management Mechanism</a></cite> (work in progress), A. Barth. IETF.
1.205 avankest 2089:
1.156 avankest 2090: <dt>[<dfn id=ref-dom2events>DOM2Events</dfn>]
2091:
2092: <dd><cite><a href="http://www.w3.org/TR/DOM-Level-2-Events/">Document
1.272 avankest 2093: Object Model (DOM) Level 2 Events Specification</a></cite>, T. Pixley.
2094: W3C.
1.156 avankest 2095:
1.146 avankest 2096: <dt>[<dfn id=ref-dom3core>DOM3Core</dfn>]
1.2 avankest 2097:
1.15 avankest 2098: <dd><cite><a href="http://www.w3.org/TR/DOM-Level-3-Core">Document Object
2099: Model (DOM) Level 3 Core Specification</a></cite>, A. Le Hors, P. Le
1.272 avankest 2100: Hégaret, L. Wood, G. Nicol, J. Robie, M. Champion, S. Byrne. W3C.
1.2 avankest 2101:
1.39 avankest 2102: <dt>[<dfn id=ref-ecmascript>ECMAScript</dfn>]
1.18 avankest 2103:
2104: <dd><cite><a
2105: href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript
1.272 avankest 2106: Language Specification</a></cite>. ECMA.
1.18 avankest 2107:
1.146 avankest 2108: <dt>[<dfn id=ref-html5>HTML5</dfn>]
1.143 avankest 2109:
1.252 avankest 2110: <dd><cite><a href="http://www.w3.org/html/wg/html5/">HTML5</a></cite>
1.272 avankest 2111: (work in progress), I. Hickson. W3C.
1.172 avankest 2112:
2113: <dd><cite><a
1.252 avankest 2114: href="http://www.whatwg.org/specs/html5/current-work/">HTML5</a></cite>
1.272 avankest 2115: (work in progress), I. Hickson. WHATWG.
1.18 avankest 2116:
1.199 avankest 2117: <dt>[<dfn id=ref-httpverbsec>HTTPVERBSEC</dfn>]
2118:
2119: <dd>(Non-normative) <cite><a
2120: href="http://www.kb.cert.org/vuls/id/867593">Multiple vendors' web
2121: servers enable HTTP TRACE method by default</a></cite>, US-CERT.
2122:
2123: <dd>(Non-normative) <cite><a
2124: href="http://www.kb.cert.org/vuls/id/288308">Microsoft Internet
2125: Information Server (IIS) vulnerable to cross-site scripting via HTTP
2126: TRACK method</a></cite>, US-CERT.
2127:
2128: <dd>(Non-normative) <cite><a
2129: href="http://www.kb.cert.org/vuls/id/150227">HTTP proxy default
2130: configurations allow arbitrary TCP connections</a></cite>, US-CERT.
2131:
1.250 avankest 2132: <dt>[<dfn id=ref-rfc2046>RFC2046</dfn>]
2133:
2134: <dd><cite><a href="http://ietf.org/rfc/rfc2046">Multipurpose Internet Mail
2135: Extensions (MIME) Part Two: Media Types</a></cite>, N. Freed, N.
1.272 avankest 2136: Borenstein. IETF.
1.250 avankest 2137:
1.146 avankest 2138: <dt>[<dfn id=ref-rfc2119>RFC2119</dfn>]
1.15 avankest 2139:
1.118 avankest 2140: <dd><cite><a href="http://ietf.org/rfc/rfc2119">Key words for use in RFCs
1.272 avankest 2141: to Indicate Requirement Levels</a></cite>, S. Bradner. IETF.
1.15 avankest 2142:
1.250 avankest 2143: <dt>[<dfn id=rfc-rfc2616>RFC2616</dfn>]
1.15 avankest 2144:
2145: <dd><cite><a href="http://ietf.org/rfc/rfc2616">Hypertext Transfer
2146: Protocol -- HTTP/1.1</a></cite>, R. Fielding, J. Gettys, J. Mogul, H.
1.272 avankest 2147: Frystyk, L. Masinter, P. Leach, T. Berners-Lee. IETF.
1.15 avankest 2148:
1.39 avankest 2149: <dt>[<dfn id=ref-rfc2617>RFC2617</dfn>]
1.15 avankest 2150:
2151: <dd><cite><a href="http://ietf.org/rfc/rfc2617">HTTP Authentication: Basic
1.93 avankest 2152: and Digest Access Authentication</a></cite>, P. Hallam-Baker, J.
1.272 avankest 2153: Hostetler, S. Lawrence, P. Leach, A. Luotonen, L. Stewart. IETF.
1.2 avankest 2154:
1.39 avankest 2155: <dt>[<dfn id=ref-rfc3986>RFC3986</dfn>]
1.2 avankest 2156:
1.15 avankest 2157: <dd><cite><a href="http://ietf.org/rfc/rfc3986">Uniform Resource
2158: Identifier (URI): Generic Syntax</a></cite>, T. Berners-Lee, R. Fielding,
1.272 avankest 2159: L. Masinter. IETF.
1.188 avankest 2160:
1.250 avankest 2161: <dt>[<dfn id=ref-rfc3987>RFC3987</dfn>]
2162:
2163: <dd><cite><a href="http://ietf.org/rfc/rfc3987">Internationalized Resource
1.272 avankest 2164: Identifiers (IRIs)</a></cite>, M. Duerst, M. Suignard. IETF.
1.250 avankest 2165:
1.205 avankest 2166: <dt>[<dfn id=ref-webidl>WebIDL</dfn>]
1.182 avankest 2167:
1.201 avankest 2168: <dd><cite><a href="http://dev.w3.org/2006/webapi/WebIDL/">Web
1.272 avankest 2169: IDL</a></cite> (work in progress), C. McCormack. W3C.</dd>
1.252 avankest 2170: <!-- XXX add Sam -->
1.182 avankest 2171:
1.43 avankest 2172: <dt>[<dfn id=ref-xml>XML</dfn>]
2173:
2174: <dd><cite><a href="http://www.w3.org/TR/xml/">Extensible Markup Language
1.272 avankest 2175: (XML) 1.0</a></cite>, T. Bray, J. Paoli, C. Sperberg-McQueen, E. Maler,
2176: F. Yergeau. W3C.
1.43 avankest 2177:
1.272 avankest 2178: <dd><cite><a href="http://www.w3.org/TR/xml-names/">Namespaces in
2179: XML</a></cite>, T. Bray, D. Hollander, A. Layman, R. Tobin, H. S.
2180: Thompson. W3C.
1.2 avankest 2181: </dl>
2182:
1.131 avankest 2183: <h2 class=no-num id=acknowledgments>Acknowledgments</h2>
1.2 avankest 2184:
1.164 avankest 2185: <p>The editor would like to thank Addison Phillips, Ahmed Kamel, Alex
2186: Hopmann, Alex Vincent, Alexey Proskuryakov, Asbjørn Ulsberg, Boris
2187: Zbarsky, Björn Höhrmann, Cameron McCormack, Christophe Jolif,
1.250 avankest 2188: Charles McCathieNevile, Dan Winship, David Andersson, David
2189: Håsäther, David Levin, Dean Jackson, Denis Sureau, Doug
2190: Schepers, Douglas Livingstone, Elliotte Harold, Eric Lawrence, Erik
2191: Dahlström, Geoffrey Sneddon, Gideon Cohn, Gorm Haug Eriksen,
2192: Håkon Wium Lie, Hallvord R. M. Steen, Huub Schaeks, Ian Davis, Ian
2193: Hickson, Ivan Herman, Jeff Walden, Jens Lindström, Jim Deegan, Jim
2194: Ley, Joe Farro, Jonas Sicking, Julian Reschke, Karl Dubost, Lachlan Hunt,
2195: Maciej Stachowiak, Magnus Kristiansen, Marc Hadley, Marcos Caceres, Mark
1.272 avankest 2196: Baker, Mark Birbeck, Mark Nottingham, Mark S. Miller, Martin Hassman,
2197: Mohamed Zergaoui, Olli Pettay, Pawel Glowacki, Peter Michaux, Philip
2198: Taylor, Robin Berjon, Rune Halvorsen, Ruud Steltenpool, Simon Pieters,
2199: Stewart Brodie, Sunava Dutta, Thomas Roessler, Tom Magliery, and Zhenbin
2200: Xu for their contributions to this specification.
1.2 avankest 2201:
2202: <p>Special thanks to the Microsoft employees who first implemented the
1.144 avankest 2203: <code title="">XMLHttpRequest</code> interface, which was first widely
2204: deployed by the Windows Internet Explorer browser.
1.2 avankest 2205:
1.56 avankest 2206: <p>Special thanks also to the WHATWG for drafting an initial version of
1.131 avankest 2207: this specification in their Web Applications 1.0 document (now renamed to
1.252 avankest 2208: HTML5). [<cite><a href="#ref-html5">HTML5</a></cite>]
1.2 avankest 2209:
2210: <p>Thanks also to all those who have helped to improve this specification
2211: by sending suggestions and corrections. (Please, keep bugging us with your
2212: issues!)
Webmaster