|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-08-26 07:15 UTC] mumu at seznam dot cz
[2011-09-07 15:55 UTC] bjori@php.net
-Assigned To:
+Assigned To: bjori
[2011-09-07 16:18 UTC] bjori@php.net
[2011-09-07 16:19 UTC] bjori@php.net
-Status: Assigned
+Status: Closed
[2011-09-07 16:19 UTC] bjori@php.net
[2012-04-18 09:49 UTC] laruence@php.net
[2012-07-24 23:40 UTC] rasmus@php.net
[2013-11-17 09:36 UTC] laruence@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 22:00:02 2025 UTC |
Description: ------------ HTTP POST is not parsed correctly when the "boundary" parameter of the Content-Type HTTP header is not the last parameter on the line. --- Guessing (might be wrong): In the first case, PHP parses the ";" (and maybe also the rest of the line) after the boundary still as part of the boundary value. As a result, the POST DATA are not "understood" correctly. However, the following parts from RFC 1521 states clearly that ";" could not be part of the boundary: tspecials := "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "\" / <"> / "/" / "[" / "]" / "?" / "=" ; Must be in quoted-string, ; to use within parameter values boundary := 0*69<bchars> bcharsnospace bchars := bcharsnospace / " " bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" / "+" /"_" / "," / "-" / "." / "/" / ":" / "=" / "?" Test script: --------------- Consider the following call to a PHP script running on an Apache server. Connection: Keep-Alive Content-Type: multipart/form-data; boundary=BVoyv; charset=iso-8859-1 Accept: */* Content-Length: 72 Host: example.com Content-Disposition: form-data; name="data" abc --BVoyv-- And a corresponding PHP script: <?php print_r(getallheaders()); print_r($_REQUEST); ?> In this case, the POST data are not seen on the PHP side, as shown on the output: Array ( [Connection] => Keep-Alive [Content-Type] => multipart/form-data; boundary=BVoyv; charset=iso-8859-1 [Accept] => */* [Content-Length] => 72 [Host] => example.com ) Array ( ) However, after changing order of parameters in the Content-Type header to: "Content-Type: multipart/form-data; charset=iso-8859-1; boundary=BVoyv" the script output is as expected (notify appearing of the [data] line): Array ( [Connection] => Keep-Alive [Content-Type] => multipart/form-data; charset=iso-8859-1; boundary=BVoyv [Accept] => */* [Content-Length] => 72 [Host] => example.com ) Array ( [data] => abc ) Expected result: ---------------- Both cases should be equal to each other. Actual result: -------------- In the first case, the "data" parameter is not available to the script.