OT: Getting at client headers from CGIs

Folks:

is there any way to get to the client request headers in a Ruby CGI
script. In particular I’m looking for the If-Modified-Since header,
which I was expecting (under Apache) to turn up in
ENV[‘HTTP_IF_MODIFIED_SINCE’]. However, apparently this isn’t the case
(at least in my configuration). Is there something I can do to get at
this header?

Cheers

Dave

Folks:

is there any way to get to the client request headers in a Ruby CGI
script. In particular I’m looking for the If-Modified-Since header,
which I was expecting (under Apache) to turn up in
ENV[‘HTTP_IF_MODIFIED_SINCE’]. However, apparently this isn’t the case
(at least in my configuration). Is there something I can do to get at
this header?

use NPH(non-parsed-header) CGI.

rename ‘your-script.cgi’ => ‘nph-your-script.cgi’
and CGI#out({‘nph’=>true})

nph-sample.cgi:
#!/usr/local/bin/ruby
require “cgi”
cgi = CGI.new
cgi.out( ‘nph’=>true, ‘type’=>‘text/plain’, ‘Last-Modified’ => Time.now ) {
ENV.sort.collect {|k,v|
“#{k}:#{v}\n”
}.join
}

···


MoonWolf moonwolf@moonwolf.com

ENV['HTTP_IF_MODIFIED_SINCE']. However, apparently this isn't the case
(at least in my configuration). Is there something I can do to get at
this header?

Do the script run with suexec ?

Guy Decoux

It turns out to have been a protocol error on my part. The aggregator I
was using only sends an if-modified-since header if the previous RSS
feed from me contained a last-modified header, and I only generated a
last-modified header if I saw an if-modified-since. I now always
generate a last-modified header, and everything works fine.

Cheers

Dave

···

On Wednesday, Mar 19, 2003, at 04:38 US/Central, ts wrote:

ENV[‘HTTP_IF_MODIFIED_SINCE’]. However, apparently this isn’t the
case
(at least in my configuration). Is there something I can do to get
at
this header?

Do the script run with suexec ?