Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Retrieving the Date Header with https-access2
hoyhoy
3/28/2006 11:14:00 PM
I've been trying to figure out how to retrieve a http head request
date using http-access2.
I thought this could work:
h = HTTPAccess2::Client.new()
res = h.head('
http://involutio...
)
print response.header['date'],"\n"
However, that seems to be returning Time.now. Any suggestions?
FYI, you can view a http request by doing the following:
telnet involution.com 80
Trying 69.58.21.60...
Connected to involution.com.
Escape character is '^]'.
HEAD / HTTP/1.0
HTTP/1.1 200 OK
-----> Date: Tue, 28 Mar 2006 23:01:47 GMT <------- Date Header ----X
Server: Apache/2.0.52 (Red Hat)
Cache-Control: no-cache
Set-Cookie: _session_id=670e36e364a03785011afbfafbc15fde; path=/
Connection: close
Content-Type: text/html; charset=UTF-8
I'm looking at trying to find a way to see what time the server thinks
it is to do some time zone correction foo.
Regards,
Tony
http://invo...
1 Answer
Dimitri Aivaliotis
3/29/2006 9:26:00 AM
0
On 3/29/06, hoyhoy@gmail.com <hoyhoy@gmail.com> wrote:
> I've been trying to figure out how to retrieve a http head request
> date using http-access2.
>
> I thought this could work:
>
> h = HTTPAccess2::Client.new()
> res = h.head('
http://involutio...
)
> print response.header['date'],"\n"
^^^^^^^^^
maybe that typo has something to do with your getting Time.now.
It's retrieved correctly here:
h = HTTPAccess2::Client.new()
res = h.head('
http://involutio...
)
puts res.header['date']
=> Wed, 29 Mar 2006 09:20:17 GMT
Time.now
=> Wed Mar 29 11:20:50 CEST 2006
require 'pp'
pp res
<snip>
@header_item=
[["Date", "Wed, 29 Mar 2006 09:20:17 GMT"],
["Server", "Apache/2.0.52 (Red Hat)"],
["X-Powered-By", "PHP/4.3.9"],
["X-Pingback", "
http://involution.com/xmlrpc...
],
["Connection", "close"],
["Content-Type", "text/html; charset=UTF-8"]],
</snip>
- Dimitri
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Retrieving the Date Header with https-access2
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password