Forum OpenACS Q&A: ns_httpopen and headers

Collapse
Posted by Simon Carstensen on
I am trying to grab a page with the following command:

set f [util_httpget "http://www.foobar.com" "If-Modified-Since: Tue, 14 Jan 2003 21:38:55 GMT"]

which in turns calls

ns_httpopen GET "http://www.foobar.com" "If-Modified-Since: Tue, 14 Jan 2003 21:38:55 GMT" "30"

which gives me this error:

invalid set id: "If-Modified-Since: Tue, 14 Jan 2003 21:38:55 GMT"
    while executing
"ns_set size $rqset"
    invoked from within
"ns_httpopen GET "http://www.scripting.com" "If-Modified-Since: Tue, 14 Jan 2003 21:38:55 GMT" "30""

I realize the trouble must be with the If-Modified-Since header parameter. Does anyone know how to specify this parameter correctly? /Simon

Collapse
Posted by David Walker on
set myheaders [ns_set create]
ns_set put $myheaders "If-Modified-Since" "Tue, 14 Jan 2003 21:38:55 GMT"

ns_write [util_httpget "http://www.foobar.com" $myheaders]