does a cgi script only serve the cgi or images as well?

does a cgi script only serve the cgi or images as well?

Post by Dan Wilg » Fri, 04 Aug 2000 04:00:00



> So basically, it is getting the cgi script, but doesn't record the images
> that are served via this script. Is there a way around this? Is it possible
> that my images are simply cached by the requesting machine and therfore are
> not served by my server?

Assuming the CGI script is just writing HTML code that includes <IMG> tags,
then either the browser has them cached (as you suspected) or the web server
is set not to log images.

The way to test the browser thing would be a forced reload. In Netscape, you
can do this with Shift-Reload of the page. For IE, the only way I know of is
to quit the program and then purge the cache.


** Remove the REMOVE in my address address to reply reply  **

 
 
 

does a cgi script only serve the cgi or images as well?

Post by Matt » Fri, 04 Aug 2000 04:00:00


It would seem that the images are being cached. DOH! I'm sure there is a way
to prevent this, and the only images I wish to not cache are my ads. What's
the best approach for this?

Thanks

Matt



>> So basically, it is getting the cgi script, but doesn't record the images
>> that are served via this script. Is there a way around this? Is it
possible
>> that my images are simply cached by the requesting machine and therfore
are
>> not served by my server?

>Assuming the CGI script is just writing HTML code that includes <IMG> tags,
>then either the browser has them cached (as you suspected) or the web
server
>is set not to log images.

>The way to test the browser thing would be a forced reload. In Netscape,
you
>can do this with Shift-Reload of the page. For IE, the only way I know of
is
>to quit the program and then purge the cache.


>** Remove the REMOVE in my address address to reply reply  **


 
 
 

does a cgi script only serve the cgi or images as well?

Post by Dan Wilg » Fri, 04 Aug 2000 04:00:00



> It would seem that the images are being cached. DOH! I'm sure there is a way
> to prevent this, and the only images I wish to not cache are my ads. What's
> the best approach for this?

There is no 100% method from preventing all browsers, proxy servers, and
firewalls from cacheing a given file. The "Pragma: no-cache" HTTP header is
supposed to do this, but isn't always obeyed by these clients.

You can, however, trick it into working. For instance, if you just add a ? and
some random number to the URL within the <IMG> tag, then the client should see
this as a different file, but the Web server (Apache at any rate) will treat
this as a parameter being passed to a file which is not a CGI program, and
will therefore just send the file as normal.

So, for instance, this:

  print qq|<img src="myfile.gif">|;

becomes:

  my $random = int(rand(100000));
  print qq|<img src="myfile.gif?$random">|;



> >> So basically, it is getting the cgi script, but doesn't record the images
> >> that are served via this script. Is there a way around this? Is it
> possible
> >> that my images are simply cached by the requesting machine and therfore
> are
> >> not served by my server?

> >Assuming the CGI script is just writing HTML code that includes <IMG> tags,
> >then either the browser has them cached (as you suspected) or the web
> server
> >is set not to log images.

> >The way to test the browser thing would be a forced reload. In Netscape,
> you
> >can do this with Shift-Reload of the page. For IE, the only way I know of
> is
> >to quit the program and then purge the cache.


** Remove the REMOVE in my address address to reply reply  **
 
 
 

does a cgi script only serve the cgi or images as well?

Post by Richard Homolk » Fri, 04 Aug 2000 04:00:00


Quote:> There is no 100% method from preventing all browsers, proxy servers, and
> firewalls from cacheing a given file.

VERY True.  Pain in the ass too.  IE 5 also does caching on Back button
that Netscape and IE 4 doesn't, major pain for what I'm doing.  Busting
caches is a black art

Quote:> The "Pragma: no-cache" HTTP header is
> supposed to do this, but isn't always obeyed by these clients.

Pragma: no-cache is technically a HTTP/1.0 Request header (meant to stop
a Proxy cache from sending a prevously cached response and to force it
to go to the origin server).  Some clients do violate the spec by
allowing Pragma: no-cache in a Response, and use it to mean the response
can't be cached.  Don't rely on this though.

The info about Pragma: being request only came on a search of my caching
problems and MS IE.  IE following standards, who knew?

The cool new HTTP/1.1 headers are Cache-Control: and Expires:.  Much
better defined on what they do, much tighter control over caching.
Check the HTTP/1.1 RFC at ftp://ftp.isi.edu/in-notes/rfc2616.txt

Remember, the client can ignore ALL of this.  Depends on what it wants
to do.  You're at the mercy of the client.

 
 
 

does a cgi script only serve the cgi or images as well?

Post by David Efflan » Sat, 05 Aug 2000 04:00:00



>> There is no 100% method from preventing all browsers, proxy servers, and
>> firewalls from cacheing a given file.
>VERY True.  Pain in the ass too.  IE 5 also does caching on Back button
>that Netscape and IE 4 doesn't, major pain for what I'm doing.  Busting
>caches is a black art

>> The "Pragma: no-cache" HTTP header is
>> supposed to do this, but isn't always obeyed by these clients.
>Pragma: no-cache is technically a HTTP/1.0 Request header (meant to stop
>a Proxy cache from sending a prevously cached response and to force it
>to go to the origin server).  Some clients do violate the spec by
>allowing Pragma: no-cache in a Response, and use it to mean the response
>can't be cached.  Don't rely on this though.

>The info about Pragma: being request only came on a search of my caching
>problems and MS IE.  IE following standards, who knew?

>The cool new HTTP/1.1 headers are Cache-Control: and Expires:.  Much
>better defined on what they do, much tighter control over caching.
>Check the HTTP/1.1 RFC at ftp://ftp.isi.edu/in-notes/rfc2616.txt

The Perl CGI module could easily do this from a script that sends an
image:

use CGI qw/:standard/;
# define $file /sys_path/filename here then:
$len = -s $file;
print header(-type=>'image/gif',-content_length=>$len,-expires=>'now');
# then open and print $file to stdout, using binmode() if Win server.

--

http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/

 
 
 

does a cgi script only serve the cgi or images as well?

Post by Kurt J. Lanz » Sat, 05 Aug 2000 04:00:00



> Hi,

> I have written a basic script that will open header, some content and a
> footer and print each one. Within the header, content and footer are images
> for which I'd like to know how many times they are being served. However, in
> my access_log, all I see is:

> x.x.x.x - - [03/Aug/2000:12:41:16 -0500] "GET
> /cgi-bin/get.cgi?uni=965324155-unb HTTP/1.0" 200 9287
> "http://www.blahxxxxx.com/cgi-bin/uni.cgi?get=965324102-unb" "Mozilla/4.5
> [en] (Win98; U)"

> So basically, it is getting the cgi script, but doesn't record the images
> that are served via this script. Is there a way around this? Is it possible
> that my images are simply cached by the requesting machine and therfore are
> not served by my server?

> Any help is greatly appreciated

> Thanks

> Matt

If your CGI generates output that includes <img> tags to
fetch images, those fetches should also be in the log
file, assuming to browser caching, proxy caching, etc.
If you don't want them cached, read the HTTP specs,
where you find plenty of clues as to how to do this. I'm
just too  damn lazy to look it up for you.
 
 
 

1. /cgi-bin/phf /cgi-bin/test-cgi /cgi-bin/handler

I've been seeing a number of attacks of this sort recently
from various sites in the http logs.  The time correlation
between the logs on various hosts suggests that the attacker
was scanning sequentially upward in IP addresses.  Since all
tcp and udp packets to ports below 1024 except for http,
smtp, and ident are filtered out for most, including the
attacking, sites, I'm not seeing anything else in the logs.

209.61.73.47 - - [04/Jul/1998:07:19:27 -0500] "GET /cgi-bin/phf" 404 -
209.61.73.47 - - [04/Jul/1998:07:19:28 -0500] "GET /cgi-bin/test-cgi" 404 -
209.61.73.47 - - [04/Jul/1998:07:19:28 -0500] "GET /cgi-bin/handler" 404 -

Is this a signature of some known attackware?  If so, what
other attacks accompany these http probes?

--

2. Help: Any problems with 3com 3c509b e/isa card

3. How to serve index.cgi from cgi directory

4. installing Redhat 4.1 problem

5. Serving Images From cgi-bin

6. Problems using bind

7. announce: cgi++ v2.0: a c++ library for cgi script handling

8. / is full

9. Perl CGI script gets CGI params as ARGV arguments under Apache2

10. shell cgi script and mod_perl cgi

11. apache: give /home/mailman/cgi-bin permissions to run cgi-scripts.

12. apache: cgi script not in cgi-bin

13. Using .cgi/.pl to enable CGI script in Apache