php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46176 Making POST requests do not always return correct Mime Type
Submitted: 2008-09-25 23:09 UTC Modified: 2008-09-29 00:28 UTC
From: dhendric at adobe dot com Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.2.6 OS: Mac OS X Leopard
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dhendric at adobe dot com
New email:
PHP Version: OS:

 

 [2008-09-25 23:09 UTC] dhendric at adobe dot com
Description:
------------
When using the curl class or the HTTP Request class (Pear) that sends a POST request, some instances return the wrong mime type in the header data. Using linux commands POST and wget return correct mime type in header for the same request.

curl via Mac OS X command line:

deirdra-hendrickss-macbook-pro:~ dhendric$ curl --url "http://s7d4.scene7.com/is/image/sample" -d "fmt=png&req=catalogprops,text" -i
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Last-Modified: Thu, 25 Sep 2008 23:05:41 GMT
ETag: "6d16a6640f1e7e88731e9688556b6596"
Content-Type: text/plain
Content-Length: 466
Expires: Thu, 25 Sep 2008 23:05:43 GMT
Date: Thu, 25 Sep 2008 23:05:43 GMT
Connection: keep-alive


Reproduce code:
---------------
$URL = "http://s7d4.scene7.com/is/image/sample?fmt=png&req=catalogprops,text";
        $c = curl_init();
        curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($c, CURLOPT_POST, true);
        curl_setopt($c, CURLOPT_URL, $URL);
        curl_exec($c);
		echo curl_getinfo($c, CURLINFO_CONTENT_TYPE);
        curl_close($c);

Expected result:
----------------
should echo "text/plain"

Actual result:
--------------
echos "image/jpeg"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-29 00:28 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

According to strace, the server returns Content-Type: image/jpeg as you 
can see from the trace below. cURL simply returns the data it received 
from the server.

recvfrom(3, "HTTP/1.1 200 OK\r\nServer: Apache-Coyote/1.1\r\nLast-
Modified: Mon, 29 Sep 2008 00:27:17 GMT\r\nETag: 
\"e106ca30f6e0a2b31d0fdadbb5b85d7f\"\r\nContent-Type: 
image/jpeg\r\nContent-Length: 271\r\nExpires: Mon, 29 Sep 2008 10:27:17 
GMT\r\nDate: Mon, 29 Sep 2008 00:27:18 GMT\r\nConnection: keep-
alive\r\n\r\n\377\330\377\340\0\20JFIF\0\1\1\0\0\1\0\1\0\0\377\333\0\204
\0\6\4\5\6\5\4\6\6\5\6\7\7\6\10\n\20\n\n\t\t\n\24\16\17\f\20\27\24\30\30
\27\24\26\26\32\35%\37\32\33#\34\26\26 , #&\')*)\31\37-0-
(0%()(\1\7\7\7\n\10\n\23\n\n\23(\32\26\32(((((((((((((("..., 16384, 0, 
NULL, NULL) = 553

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Apr 08 03:01:24 2020 UTC