On 1 Jul 2009, at 10:50, Mark Smith wrote:
In fact, I'd recommend the curl method, as it seems like the libUrl
method doesn't seem to get all the headers, anyway.
For this url: "http://marksmith.on-rev.com/msbass/instruments.html"
the liburl method got:
HTTP/1.1 200 OK
Date: Wed, 01 Jul 2009 09:46:17 GMT
Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-
rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Connection: close
Content-Type: text/html;charset=ISO-8859-1
whereas the curl method got:
HTTP/1.1 200 OK
Date: Wed, 01 Jul 2009 09:49:05 GMT
Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-
rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Last-Modified: Fri, 17 Apr 2009 14:22:33 GMT
ETag: "c0c0087-2150-e956bc40"
Accept-Ranges: bytes
Content-Length: 8528
Content-Type: text/html
Dave (Cragg) - is there a better way to do a HEAD request using
libUrl?
I tried your method (urlHead function) and it returned a full set of
headers:
HTTP/1.1 200 OK
Date: Wed, 01 Jul 2009 11:35:42 GMT
Server: Apache
Last-Modified: Sun, 26 Apr 2009 21:55:28 GMT
ETag: "32224e1-19ca-49aab400"
Accept-Ranges: bytes
Content-Length: 6602
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
Just a couple of points about the function. You should probably add a
"Connection: close" header. In this case it didn't matter as the
server closed the connection anyway. But with other servers, it may
cause a timeout as libUrl thinks it's handling a GET request and will
try to read from the socket while it is open.
You should perhaps also set libUrlFollowHttpRedirects to false. This
isn't so clean as you can't get the current state of the redirect
setting, and restore it later.
And unlike other libUrl calls, you should ignore "the result" on this.
It will always indicate an error.
Things would be better if HEAD were handled properly so we didn't have
to use workarounds such as these.
Cheers
Dave
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution