https://issues.apache.org/bugzilla/show_bug.cgi?id=51720

             Bug #: 51720
           Summary: Content-Type header is not parsed correctly on HTTP
                    POST request
           Product: Apache httpd-2
           Version: 2.2.14
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: All
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified


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 respond of the script 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
)

However, both cases should be equal to each other.

Guessing (might be wrong):
In the first case, Apache 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 thet ";" 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 / "'" / "(" / ")" / "+" /"_"
                 / "," / "-" / "." / "/" / ":" / "=" / "?"

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to