Re: POST without Content-Type?

From: Date: Sun, 26 Aug 2001 05:59:48 +0000
Subject: Re: POST without Content-Type?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-64480@lists.php.net to get a copy of this message
Well, first of all, you are using an ancient version of PHP. That message was changed from a fatal error to a warning over a year ago. And if you really want to have PHP accept non-typed POST data, it's an obvious one-line change in main/SAPI.c -Rasmus On Sat, 25 Aug 2001, Chris Maresca wrote: > > All, > > I've been coding a PHP page that listens for a connection from an embedded > device (a piece of hardware) that sends a POST query to Apache (and to my > PHP pages...). > > I've having a problem that I can't seem to solve. The embedded > application does not set a Content-Type header on the POST, so PHP fails > with the following error: > > -- > HTTP/1.1 200 OK > Date: Sun, 26 Aug 2001 05:26:14 GMT > Server: Apache/1.3.12 (Unix) (Red Hat/Linux) PHP/4.0.2 > Connection: close > Content-Type: text/html > > <br> > <b>Fatal error</b>: No content-type in POST request in <b>Unknown</b> > on > line <b>0</b><br> > Connection closed by foreign host. > -- > > The connection that the embedded system makes looks like this: > > -- > POST http://host.mysite.foo/dir/phppage HTTP/1.0 > User-Agent: ImEmbedded > Host: host.mysite.foo > Content-Length: 123 > Pragma: no-cache > Cookie: embeddedsession=myverylongsessionvariablegeneratedbythehardware > > <?xml version="1.0"?> > -- > And below is some XML stuff... > > I've tried setting 'Content-Type' in $HTTP_POST_VARS, using mod_rewrite in > Apache to change the content-type (with the -T flag) and looked at all the > options in php.ini. I'm using PHP 4.0.2 w/Apache 1.3.12 (if you couldn't > tell from the sig above...) > > Nothing works correctly. The mod_rewrite trick would work, but it makes > everthing to that URL text/xml, including the PHP script, which no longer > executes. I look on the mailing lists here and on usenet, but I don't see > a good solution... > > Anyone have any ideas? At this point, I'm thinking of re-writing my code > in Perl or Python since there seems to be no solution to this problem. > > Note that it's PHP that rejects the request, not Apache. I don't see why > a missing content-type should do this. It should just default to > text/plain or something. > > Anyway, thanks for any help. > > Chris. > > -- > chris maresca > internet systems architect -- www.chrismaresca.com > > "linux, only up 138 days, because california has flaky power... " > > > >

« previous php.general (#64480) next »