Forum

/ Home \ \ Subjects /



Subject: problem with cache (!)

20/01/2008 06:19 xod:
Hello, I have this problem with a .bat script as my CGI test script. For hours I`ve tried lots of things to make the client receive and show the actual updated .bat output, but I only succeded once.
What do you think is the problem, as I don`t know much about http (yet), I mean is there supposed to be some http key/tag with some kind of date to let the browser to decide to reload everything from server or from cache ? hmm
20/01/2008 08:09 xod:
Just to clraify a bit.

I have made the following settings in shttps:
1. Assosiated the extension ".bat" with "C:\WINDOWS\system32\CMD.exe"
2. Associated the extension ".bat" with MIME Type "text/html"

The .bat script contains:

@echo off

rem CGI headers
echo Content-Type: text/html
echo.

rem CGI body
echo ^<HTML^>^<BODY^>
echo Contents of my D:\Media\Video\ folder
echo.
dir D:\Media\Video
echo.
echo Likey ? lol
echo.
echo ^</BODY^>^</HTML^>

But when I request 127.0.0.1/cgi-bin/SayHi.bat .. the browser pops up a download dialog window for SayHi.bat, do you have any idea ?
20/01/2008 22:20 Max:
For disable caching the script must say
Pragma: no-cache
or
Cache-Control: no-cache
in HTTP control header.

You may not add MIME type for .bat, it is senseless.
CGI return MIME type in "Content-Type:" header field.

If browser don`t detect the output as html, you may try to save it, and look what is there. Probably empty line before Content-Type: text/html.

Also you may try to check it with SSI
<!--#include virtual="/cgi-bin/SayHi.bat" -->

20/01/2008 23:42 xod:
Even though I got some help in an IRC room, thank you!
20/01/2008 05:09 xod:
Just to clraify a bit.

I have made the following settings in shttps:
1. Assosiated the extension ".bat" with "C:\WINDOWS\system32\CMD.exe"
2. Associated the extension ".bat" with MIME Type "text/html"

The .bat script contains:

@echo off

rem CGI headers
echo Content-Type: text/html
echo.

rem CGI body
echo ^<HTML^>^<BODY^>
echo Contents of my D:\Media\Video\ folder
echo.
dir D:\Media\Video
echo.
echo Likey ? lol
echo.
echo ^</BODY^>^</HTML^>

But when I request 127.0.0.1/cgi-bin/SayHi.bat .. the browser pops up a download dialog window for SayHi.bat, do you have any idea ?

User: Password: New user:   Save password: