Re: [PHP-DEV] Re: PHP 4.0 Bug #4439 Updated: PHP doesn't handle content-transfer-encoding header on form-based file upload From: Ragnar Kjørstad (ragnark <email protected>)
Date: 07/31/00

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: 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

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>