From 539b09b819a34b2277173598fe889f673a50c21d Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Wed, 15 Feb 2017 16:03:25 +0100 Subject: [PATCH 1/2] Show how to properly quote the boundery Related to https://github.com/php-http/multipart-stream-builder/pull/28 --- components/multipart-stream-builder.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/multipart-stream-builder.rst b/components/multipart-stream-builder.rst index 54d6534..674b961 100644 --- a/components/multipart-stream-builder.rst +++ b/components/multipart-stream-builder.rst @@ -7,7 +7,7 @@ A multipart stream is a special kind of stream that is used to transfer files ov POST / HTTP/1.1 Host: example.com - Content-Type: multipart/form-data; boundary=578de3b0e3c46 + Content-Type: multipart/form-data; boundary="578de3b0e3c46.2334ba3" --578de3b0e3c46 Content-Disposition: form-data; name="foo" @@ -54,7 +54,7 @@ To build a multipart stream you may use the ``MultipartStreamBuilder``. It is no $request = MessageFactoryDiscovery::find()->createRequest( 'POST', 'http://example.com', - ['Content-Type' => 'multipart/form-data; boundary='.$boundary], + ['Content-Type' => 'multipart/form-data; boundary="'.$boundary.'"'], $multipartStream ); From fefec6d8d6850658f2364ca67c5df931b7ed042a Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Wed, 15 Feb 2017 23:44:28 +0100 Subject: [PATCH 2/2] added the updated boundery everywhere --- components/multipart-stream-builder.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/multipart-stream-builder.rst b/components/multipart-stream-builder.rst index 674b961..2de27e0 100644 --- a/components/multipart-stream-builder.rst +++ b/components/multipart-stream-builder.rst @@ -9,7 +9,7 @@ A multipart stream is a special kind of stream that is used to transfer files ov Host: example.com Content-Type: multipart/form-data; boundary="578de3b0e3c46.2334ba3" - --578de3b0e3c46 + --578de3b0e3c46.2334ba3 Content-Disposition: form-data; name="foo" Content-Length: 15 @@ -23,13 +23,13 @@ A multipart stream is a special kind of stream that is used to transfer files ov  ??? IHDR??? ??? ?????? ???? IDATxc???51?)?:??????IEND?B`? - --578de3b0e3c46 + --578de3b0e3c46.2334ba3 Content-Type: text/plain Content-Disposition: form-data; name="baz" Content-Length: 6 string - --578de3b0e3c46-- + --578de3b0e3c46.2334ba3-- In the request above you see a set of HTTP headers and a body with two streams. The body starts and ends with a "boundary" and it is also this boundary that separates the streams. That boundary also needs to be specified in the ``Content-Type`` header.