Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #15574

Re: XMLHttpRequest: POST with Data

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.teledata-fn.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="UTF-8"
Message-ID <7781613.3ztUY42lFh@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Organization PointedEars Software (PES)
Date Sun, 26 Aug 2012 19:15:48 +0200
User-Agent KNode/4.4.11
Content-Transfer-Encoding 8Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: XMLHttpRequest: POST with Data
Newsgroups comp.lang.javascript
References <429d38h112ptste9sp22ks8sqk9cgumo7r@4ax.com> <k16d9n$tqa$1@speranza.aioe.org> <4919648.gLsDIqzOUs@PointedEars.de> <k1af83$q69$1@speranza.aioe.org> <2094311.UPhlsrQmMF@PointedEars.de> <k1d9g5$2jn$2@speranza.aioe.org>
Followup-To comp.lang.javascript
MIME-Version 1.0
Lines 91
NNTP-Posting-Date 26 Aug 2012 19:15:50 CEST
NNTP-Posting-Host 4290864c.newsspool3.arcor-online.net
X-Trace DXC=;b=jb=<6J9RU6b:FjPaGjQMcF=Q^Z^V3X4Fo<]lROoRQ8kF<OcfhCO[Vji1_n_VeiYDZm8W4\YJN\T<8F<]0D<`YkKaJRTB^N:^E<N>\0W\g?_
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.javascript:15574

Followups directed to: comp.lang.javascript

Show key headers only | View raw


Christoph Becker wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Per section 4.3, RFC 2616 (HTTP/1.1) mandates that the message body must
>> contain only ASCII octets.
> 
> I was not able to find the restriction on ASCII. RFC2616, section 7.2
> mandates, that the entity-body has to contain OCTETs, where OCTET is
> defined in section 2.2 as "any 8-bit sequence of data".

I stand corrected.  However, section 19.3 alludes [1] to what is known as 
the "be conservative in what you do, liberal in what to accept from others" 
paradigm of the Internet ("Postel's law") [2].  Not knowing over which lines 
the HTTP message will be transmitted, and what the capabilities of the 
involved software are, it appears to be prudent to choose (the characters 
in) US-ASCII as the lowest common denominator.

When discussing character encoding, it should also be mentioned that not 
even choosing a specific Unicode encoding such as UTF-8 ensures 
compatibility.  The Macintosh operating system is known to use the more 
versatile, but in terms of memory footprint more expensive, character 
composition feature of Unicode, while other systems tend not to; as a 
result, the same character may be encoded using the same Unicode encoding in 
a different way and may need to be normalized in order to be compatible) 
[3].  This applies in particular to a Content Management System where some 
authors might use a Macintosh computer, while other authors and most 
visitors would not.  It should be investigated whether this applies to the 
implementations of the encodeURI() and encodeURIComponent() methods as well; 
ECMAScript, 5.1 Edition [4], do not mandate normalization before percent-
encoding.  (I have developed a novel approach [5] that is applicable to the 
ECMAScript Support Matrix [6] and similar kinds of research, and is going to 
help there.)

> So for POST requests, when the Content-Type is text/plain (e.g. by using
> <form enctype="text/plain">) even non-ASCII characters in the body can be
> sent directly. But not all server side "languages" will handle this (e.g.
> PHP will not fill in the $_POST variable).

PHP is not supposed to fill the $_POST array then; there are no parameters.  
Indeed, apparently there is no trivial way, if any, to retrieve the message 
body with PHP then; at least the input does not show up anywhere in 
phpinfo().

> So it seems this is the reason, why one should use Content-Type
> application/x-www-form-urlencoded, which requires percent-
> encoding of the request body.

I do not think so.  Instead, in addition to the reason I mentioned above, 
enctype="text/plain" is not mentioned in HTML 4.01 (but not forbidden by it 
either) [7], so it is unsurprising that some server-side applications with a 
longer development history would not support it.

Incidentally, the current HTML5 Working Draft places more constraints there, 
specifying "text/plain" as one of only three media types that are to be 
supported there. [8]  So apparently there are some, probably newer, server-
side applications that support it.


PointedEars
___________
[1] Fielding, R. et al. (1999-06). RFC 2616: Hypertext Transfer Protocol --
    HTTP/1.1.  §19.3: Tolerant Applications.
    <http://tools.ietf.org/html/rfc2616#section-19.3>
[2] Postel, Jon (ed.) (1980-01). RFC 761: Transmission Control Protocol.
    <http://tools.ietf.org/html/rfc761>
[3] Wikipedia contributors (2012-06-12). Wikipedia: Combining character.
    Retrieved 2012-08-26. <http://en.wikipedia.org/wiki/Combining_character>
[4] Ecma International (2011-06). Standard ECMA-262. 5.1 Edition.
    ECMAScript Language Specification (HTML rendering).
    §15.1.3: URI Handling Function Properties.
    <http://ecma-international.org/ecma-262/5.1/#sec-15.1.3>
[5] Lahn, Thomas (2012-03-12). Features von ECMAScript-basierten
    Programmiersprachen – Eine vergleichende Analyse (“Features of
    ECMAScript-based programming languages – A comparative analysis”).
    BSc SUPSI in Computer Science. Fernfachhochschule Schweiz
    (Swiss Distance-Learning University of Applied Sciences).
[6] Lahn, Thomas (2012-07-31). ECMAScript Support Matrix –
    There Is No Javascript. <http://PointedEars.de/es-matrix>
[7] Raggett, Dave, et al. (ed.). HTML 4.01 Specification.
    W3C Recommendation 24 December 1999. §17.3: The FORM element. 
    <http://www.w3.org/TR/1999/
     REC-html401-19991224/interact/forms.html#edef-FORM>
[8] Hickson, Ian (ed.). HTML5 – A vocabulary and associated APIs for
    HTML and XHTML. W3C Working Draft, 29 March 2012.
    §4.10.3 The form element. <http://www.w3.org/TR/html5/
    attributes-common-to-form-controls.html#attr-fs-enctype>
-- 
    realism:    HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness:    XHTML 1.1 as application/xhtml+xml
                                                    -- Bjoern Hoehrmann

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

XMLHttpRequest: POST with Data Gene Wirchenko <genew@ocis.net> - 2012-08-23 15:00 -0700
  Re: XMLHttpRequest: POST with Data "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-08-23 22:48 +0000
    Re: XMLHttpRequest: POST with Data Gene Wirchenko <genew@ocis.net> - 2012-08-23 16:40 -0700
      Re: XMLHttpRequest: POST with Data "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-08-26 20:39 +0000
  Re: XMLHttpRequest: POST with Data Christoph Becker <cmbecker69@gmx.de> - 2012-08-24 01:11 +0200
    Re: XMLHttpRequest: POST with Data Gene Wirchenko <genew@ocis.net> - 2012-08-23 16:42 -0700
      Re: XMLHttpRequest: POST with Data Christoph Becker <cmbecker69@gmx.de> - 2012-08-24 02:54 +0200
        Re: XMLHttpRequest: POST with Data Gene Wirchenko <genew@ocis.net> - 2012-08-23 19:04 -0700
          Re: XMLHttpRequest: POST with Data Tim Streater <timstreater@greenbee.net> - 2012-08-24 08:57 +0100
    Re: XMLHttpRequest: POST with Data Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-25 12:02 +0200
      Re: XMLHttpRequest: POST with Data Christoph Becker <cmbecker69@gmx.de> - 2012-08-25 14:09 +0200
        Re: XMLHttpRequest: POST with Data Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-25 15:20 +0200
          Re: XMLHttpRequest: POST with Data Christoph Becker <cmbecker69@gmx.de> - 2012-08-26 15:49 +0200
            Re: XMLHttpRequest: POST with Data Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-26 19:15 +0200
              Re: XMLHttpRequest: POST with Data Stefan Weiss <krewecherl@gmail.com> - 2012-08-26 19:54 +0200
                Re: XMLHttpRequest: POST with Data Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-26 21:43 +0200
              Re: XMLHttpRequest: POST with Data Christoph Becker <cmbecker69@gmx.de> - 2012-08-26 23:42 +0200
  Re: XMLHttpRequest: POST with Data Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-24 02:55 +0000
  Re: XMLHttpRequest: POST with Data "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2012-08-23 19:28 -0700
  Re: XMLHttpRequest: POST with Data "Tom de Neef" <tdeneef@qolor.nl> - 2012-08-24 15:58 +0200
  Re: XMLHttpRequest: POST with Data Ross McKay <au.org.zeta.at.rosko@invalid.invalid> - 2012-08-26 08:38 +1000
  Re: XMLHttpRequest: POST with Data Mike Winter <usenet@michael-winter.me.invalid> - 2012-08-26 14:59 +0100

csiph-web