eddi: Unbuffered Upload

Beitrag lesen

Re:

Spaß beiseite; wie glaubst Du habe ich sonst diesen Request erzeugt? Das ist der Request meines Browsers an einen Testdämon. Aufgerufen wurde dieser durch senden von Formulardaten.

Dann hält er sich nicht an die Regeln der HTTP-Spec für den Formularversand, die für die Codierung von Dateien in multipart/form-data ausdrücklich auf RFC 2045 verweist.

Lies bitte im ersten verwiesenen Dokument, ob Du dort bei der Header-Erläuterung etwas von Content-Entcoding findest.

Und die bietet nur Quoted Printable und base64 als Optionen an (Abschnitt 6.7 und 6.8 der RFC).

6.1.  Content-Transfer-Encoding Syntax

The Content-Transfer-Encoding field's value is a single token
   specifying the type of encoding, as enumerated below.  Formally:

encoding := "Content-Transfer-Encoding" ":" mechanism

mechanism := "7bit" / "8bit" / "binary" /
                  "quoted-printable" / "base64" /
                  ietf-token / x-token

These values are not case sensitive -- Base64 and BASE64 and bAsE64
   are all equivalent.  An encoding type of 7BIT requires that the body
   is already in a 7bit mail-ready representation.  This is the default
   value -- that is, "Content-Transfer-Encoding: 7BIT" is assumed if the
   Content-Transfer-Encoding header field is not present.

Sieht nach mehr aus, als _nur_ Quoted Printable und base64.

Im Übrigen erachte ich RFC 2388 hier als maßgeblich und in der ist nachzulesen:

3. Definition of multipart/form-data

[...]

Each part may be encoded and the "content-transfer-encoding" header
   supplied if the value of that part does not conform to the default
   encoding.

RFC 2119 -> may

5. MAY   This word, or the adjective "OPTIONAL", mean that an item is
   truly optional.  One vendor may choose to include the item because a
   particular marketplace requires it or because the vendor feels that
   it enhances the product while another vendor may omit the same item.
   An implementation which does not include a particular option MUST be
   prepared to interoperate with another implementation which does
   include the option, though perhaps with reduced functionality. In the
   same vein an implementation which does include a particular option
   MUST be prepared to interoperate with another implementation which
   does not include the option (except, of course, for the feature the
   option provides.)

Ich gestehe Dir aber zu, daß in den RFCs 2045 und 2388 _nicht explizit_ auf RFC 2119 verwiesen wird. Meine hypertolle Buddelschippe (alias Mozilla) hier als nicht standardkonform zu verunglimpfen - wie frech! (Ich hoffe es kommt bei Dir als die sarkastische Übertreibung, die wir im eigentlichen gerade betreiben, auch an ;)

RFC 2045 bestimmt zwar den erheblichen Content-Type es Request-Body, schreibt HTTP aber noch lange nicht vor 7bit-Übertragungen zu nutzen.

Von 7bit-Übertragung hab ich auch nix gesagt, das warst du selbst. Nur davon, dass als Codierung wahlweise base64 oder Quoted Printable zu verwenden ist. Und base64, das ich bei Binärdaten vorziehen würde, bildet nun mal jeweils 3 Byte Originaldaten auf 4 Zeichen Transfer-Stream ab, die dann bei heute üblichen Systemen 4 Bytes sind.
Ergo bläht sich die Datenmenge beim (korrekten) Upload über ein HTML-Formular um etwa 33% gegenüber der ursprünglichen Dateigröße auf.

Zum einen reden die von Dir referenzierten RFCs hier von einer 7bit-Übertragung, zum anderen bräuchte man solche Kodierungen sonst nicht. Das base64 ca 33% mehr hat - dem stimme ich ja gerne zu.

Im Übrigen auch meine Sandkastenförmchen (alias Opera und Konqueror) sollen dann wohl auch nicht standardkonform sein?!

POST / HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686; en) Opera 8.52
Host: 127.0.0.1:1100
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: de,en;q=0.9
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
Expect: 100-continue
Connection: Keep-Alive
Content-Length: 57750
Content-Type: multipart/form-data; boundary=----------eqx0DT3WvH218uVOaBTJRM

------------eqx0DT3WvH218uVOaBTJRM
Content-Disposition: form-data; name="file"; filename="cp"
Content-Type: application/octet-stream

POST / HTTP/1.1
Connection: Keep-Alive
Pragma: no-cache
Cache-control: no-cache
Accept: text/html, image/jpeg, image/png, text/*, image/*, */*
Accept-Encoding: x-gzip, x-deflate, gzip, deflate
Accept-Charset: iso-8859-1, utf-8;q=0.5, *;q=0.5
Accept-Language: de, en
Host: 127.0.0.1:1100
Content-Type: multipart/form-data; boundary=----------2wVLziHtWLWAiGAwA46gbcATx8aFriKudpFcWUT2pyDWELQOQX317DU
Content-Length: 17717

------------2wVLziHtWLWAiGAwA46gbcATx8aFriKudpFcWUT2pyDWELQOQX317DU
Content-Disposition: form-data; name="file"; filename="cat"
Content-Type: application/x-executable

Mach am besten Tests mit Formularen und sende sie an einen Testdämon.

Gruß aus Berlin!
eddi

--
Achte die Kleinigkeiten, aber liebe das Detail!