Re: Re: PHP 4.0 Bug #4439 Updated: PHP doesn't handle content-transfer-encoding header on form-based file upload
| From: | Ragnar Kjørstad | Date: | Mon, 31 Jul 2000 19:40:17 +0000 |
| Subject: | Re: Re: PHP 4.0 Bug #4439 Updated: PHP doesn't handle content-transfer-encoding header on form-based file upload | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-27099@lists.php.net to get a copy of this message | ||
On Mon, Jul 31, 2000 at 12:19:56PM -0700, Rasmus Lerdorf wrote:
> > > Is this a PHP issue or a cURL issue - does anyone want to test this out?
> > >
> > > Full Bug description available at: Ô9ž'
> > > W¬µ‡ñŒGš‡ http://bugs.php.net/?id=4439
> >
> > According the the curl developer, it was a php-bug. I also detected a
> > simular problem (the result is different, but they both seem to be
> > caused by invalid assumptions in the parsing-code).
> >
> > When I send the following http request: (only relevant part)
> > POST /login.php HTTP/1.0
> > User-Agent: Lynx/2.8.3dev.18 libwww-FM/2.14
> > Content-type: multipart/form-data; boundary=xnyLAaB03X
> > Content-length: 610
> >
> > --xnyLAaB03X
> > Content-Disposition: form-data; name=input
> > Content-Type: text/plain; charset=iso-8859-1
> >
> > yes
> > --xnyLAaB03X--
>
> Whatever is sending that is not MIME compliant. Double quotes are not
> optional in the Content-Disposition header. ie. it should be:
>
> Content-Disposition: form-data; name="input"
It was lynx. I'll look into fixing that. The TCP stream of curl is
however:
POST /upload.php HTTP/1.0
User-Agent: curl/5.4 (i686-pc-linux-gnu)
Content-Length: 472
Content-Type: multipart/form-data; boundary=curlun9KjnFydhDcJ7+nYkNuqv4rJDU
--curlun9KjnFydhDcJ7+nYkNuqv4rJDU
Content-Disposition: form-data; name="tittel"
test
--curlun9KjnFydhDcJ7+nYkNuqv4rJDU
Content-Disposition: form-data; name="file"; filename="test.gif"
Content-Type: image/gif
Content-Transfer-Encoding: binary
GIF89a
.....binary.data......
--curlun9KjnFydhDcJ7+nYkNuqv4rJDU
Content-Disposition: form-data; name="upload"
yes
--curlun9KjnFydhDcJ7+nYkNuqv4rJDU--
The problem is that the result file contains:
"ontent-Transfer-Encoding: binary
GIF89a
.....binary.data......"
So my guess is that the parsing code assumes Content-Type is the last
header and is followed by two newlines...
--
Ragnar Kjorstad