/
880.txt
80 lines (62 loc) · 4.13 KB
/
880.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
* 仕様書
[REFS[
- [8] [CITE@en[XMLHttpRequest Standard]] ([TIME[2018-04-17 18:43:05 +09:00]]) <https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send>
]REFS]
* 歴史
[1] [CITE[Hawk's W3 Laboratory : XML : XMLHttpRequestについて]] ([TIME[2009-01-04 12:58:40 +09:00]] 版) <http://web.archive.org/web/20060901145130/www.hawk.34sp.com/stdpls/xml/xmlhttprequest.html>
>
引数として指定可能なオブジェクトはブラウザ毎に異なりますが、多くのブラウザで少なくとも文字列とDOMDocumentが指定可能なようです。
>
以下は各ブラウザ共通の挙動です。
- 文字列はUTF-8でエンコードされる。Content-Typeヘッダを書き換えて明示的にエンコーディング指定を行っても無効になる(IE/Geckoの場合。Operaではそもそも指定不可)。
- 適切な値のContent-Lengthヘッダが自動的に送信される。
>
ブラウザ毎に異なるのはデフォルトの Content-Type の扱いです。
>
,IE(MSXML) ,送信されない
,Gecko ,text/xml
,Opera ,text/xml; charset=utf-8
,KHTML ,text/plain
>
IE(MSXML)の挙動はHTTPクライアントとしてどうなんだという気がしますが…もちろんsetRequestHeaderを使って明示的に指定することは出来ます。
;;[2] [CODE(HTTP)@en[[[Content-Type]]]] は省略可能だから問題はない (ただし[[既定値]]が
[CODE(HTTP)@en[[[text/plain]]; [[charset]]=[[iso-8859-1]]]] なのは問題)。
>DOMDocumentを指定した場合、基本的にはDOMDocumentの”文字列表現”が送信されます。以下がその際に用いられる文字エンコーディングと、送信される文字列と同等の文字列を取得するための方法です。
>
,- ,文字エンコーディング ,文字列表現の出所
,IE(MSXML) ,XML宣言のencoding指定に従う デフォルトはUTF-8 ,DOMDocumentのxmlプロパティ(推測)
,Gecko ,UTF-8 ,XMLSerializer.serializeToString(DOMDocument)
,Opera ,UTF-8 ,DOMDocument.documentElement.outerHTML(推測)
,KHTML ,UTF-8 ,不明
>
Operaが送信するのはルート要素以下らしく、XML宣言などは含まれません。またGecko/KHTML/OperaではHTML DOMDocument(つまり window.document)も指定できます。
[3] [CITE[Refactor send() in terms of Fetch · 82e602e · whatwg/xhr]]
( ([TIME[2014-07-01 09:41:36 +09:00]] 版))
<https://github.com/whatwg/xhr/commit/82e602e4507c19802c373bf19f5e956973f1c6c3>
[4] [CITE@en[Allow developers to opt-out of sync XHR with feature policy · Issue #178 · whatwg/xhr]]
([TIME[2018-03-03 12:50:54 +09:00]])
<https://github.com/whatwg/xhr/issues/178>
[5] [CITE@en[Integrate feature policy by clelland · Pull Request #177 · whatwg/xhr]]
([TIME[2018-03-03 12:52:25 +09:00]])
<https://github.com/whatwg/xhr/pull/177>
[6] [CITE@en[Feature proposal: sync-xhr · Issue #126 · WICG/feature-policy]]
([TIME[2018-03-03 12:55:51 +09:00]])
<https://github.com/WICG/feature-policy/issues/126>
[7] [CITE@en[Define Content-Type manipulation in terms of MIME Sniffing]]
([[annevk]]著, [TIME[2018-04-16 18:51:34 +09:00]])
<https://github.com/whatwg/xhr/commit/edc6f8f16f58d201afb49e40ca166b8bc1ae74a3>
[9] [CITE@en[Fix send() charset overriding to use new MIME type infrastructure · Issue #188 · whatwg/xhr]]
([TIME[2018-04-17 23:08:38 +09:00]])
<https://github.com/whatwg/xhr/issues/188>
[10] [CITE@en[Define Content-Type manipulation in terms of MIME Sniffing by annevk · Pull Request #176 · whatwg/xhr]]
([TIME[2018-04-17 23:09:16 +09:00]])
<https://github.com/whatwg/xhr/pull/176>
[11] [CITE@en[Editorial: rewrite send()'s body/content-type processing]]
([[domenic]]著, [TIME[2018-04-24 00:09:11 +09:00]])
<https://github.com/whatwg/xhr/commit/f47bbab42dabe1f52e5e9f1ed1fa6df06a6eb310>
[12] [CITE@en[Editorial: less-confusing content-type manipulation algorithm for send() · Issue #197 · whatwg/xhr]]
([TIME[2018-04-24 16:16:12 +09:00]])
<https://github.com/whatwg/xhr/issues/197>
[13] [CITE@en[Editorial: rewrite send()'s body/content-type processing by domenic · Pull Request #205 · whatwg/xhr]]
([TIME[2018-04-24 16:16:30 +09:00]])
<https://github.com/whatwg/xhr/pull/205>