getheaders & curl returning different OK response codes

204 views
Skip to first unread message

Anjanesh

unread,
Mar 13, 2013, 7:00:38 AM3/13/13
to gs-dis...@googlegroups.com
I'm not sure if this is a google storage issue.

I have a php snippet that does this :

<?php
$headers = get_headers($img);
print_r($headers);
?>

php getheaders.php 
Array
(
    [0] => HTTP/1.0 200 OK
    [1] => Server: HTTP Upload Server Built on Mar 6 2013 16:24:27 (1362615867)
    [2] => Date: Wed, 13 Mar 2013 10:46:01 GMT
    [3] => Cache-Control: public,max-age=31536000, no-transform
    [4] => Expires: Thu, 13 Mar 2014 10:46:01 GMT
    [5] => Last-Modified: Fri, 01 Mar 2013 07:48:12 GMT
    [6] => ETag: "940e5e58c533c9a7158132babd0be43b"
    [7] => x-goog-generation: 1362124092818000
    [8] => x-goog-metageneration: 1
    [9] => Content-Type: image/jpeg
    [10] => Content-Language: en
    [11] => x-goog-hash: md5=lA5eWMUzyacVgTK6vQvkOw==
    [12] => Accept-Ranges: bytes
    [13] => Content-Length: 24977
    [14] => Vary: Origin
)

But on using curl :

HTTP/1.1 200 OK
Server: HTTP Upload Server Built on Mar 6 2013 16:24:27 (1362615867)
Date: Wed, 13 Mar 2013 10:46:11 GMT
Cache-Control: public,max-age=31536000, no-transform
Expires: Thu, 13 Mar 2014 10:46:11 GMT
Last-Modified: Fri, 01 Mar 2013 07:48:12 GMT
ETag: "940e5e58c533c9a7158132babd0be43b"
x-goog-generation: 1362124092818000
x-goog-metageneration: 1
Content-Type: image/jpeg
Content-Language: en
x-goog-hash: md5=lA5eWMUzyacVgTK6vQvkOw==
Accept-Ranges: bytes
Content-Length: 24977
Vary: Origin

How is that getheaders() returned "HTTP/1.0 200 OK" while curl returned "HTTP/1.1 200 OK" ? Im on Ubuntu 12.10.

Google Cloud Storage Team

unread,
Mar 14, 2013, 5:44:52 PM3/14/13
to gs-discussion
Hello Anjanesh,

The HTTP version in use in this case is based on the HTTP version sent by the client.  The fact that the PHP code resulted in an HTTP/1.0 response merely indicates that PHP made an HTTP 1.0 request, wherease curl made an HTTP 1.1 request. 

In this particular case, though, it looks like you want to be making a HEAD request, so you'll want to use the php function http_head, rather than the get_headers function you're currently using. I hope this helps. 

Benson
Google Cloud Storage Team



--
You received this message because you are subscribed to the Google Groups "Google Cloud Storage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gs-discussio...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages