Skip to content

Commit d8a5ecd

Browse files
Nyholmdbu
authored andcommitted
Show how to properly quote the boundery (#175)
Show how to properly quote the boundery Related to php-http/multipart-stream-builder#28
1 parent 49dc8db commit d8a5ecd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

components/multipart-stream-builder.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ A multipart stream is a special kind of stream that is used to transfer files ov
77
88
POST / HTTP/1.1
99
Host: example.com
10-
Content-Type: multipart/form-data; boundary=578de3b0e3c46
10+
Content-Type: multipart/form-data; boundary="578de3b0e3c46.2334ba3"
1111
12-
--578de3b0e3c46
12+
--578de3b0e3c46.2334ba3
1313
Content-Disposition: form-data; name="foo"
1414
Content-Length: 15
1515
@@ -23,13 +23,13 @@ A multipart stream is a special kind of stream that is used to transfer files ov
2323

2424
???
2525
IHDR??? ??? ?????? ???? IDATxc???51?)?:??????IEND?B`?
26-
--578de3b0e3c46
26+
--578de3b0e3c46.2334ba3
2727
Content-Type: text/plain
2828
Content-Disposition: form-data; name="baz"
2929
Content-Length: 6
3030
3131
string
32-
--578de3b0e3c46--
32+
--578de3b0e3c46.2334ba3--
3333
3434
3535
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.
@@ -54,7 +54,7 @@ To build a multipart stream you may use the ``MultipartStreamBuilder``. It is no
5454
$request = MessageFactoryDiscovery::find()->createRequest(
5555
'POST',
5656
'http://example.com',
57-
['Content-Type' => 'multipart/form-data; boundary='.$boundary],
57+
['Content-Type' => 'multipart/form-data; boundary="'.$boundary.'"'],
5858
$multipartStream
5959
);
6060

0 commit comments

Comments
 (0)