Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Apache loads wrong image when using CGI

39 views
Skip to first unread message

Andreas Micheler

unread,
Jun 5, 2006, 7:59:37 PM6/5/06
to
Hi all,

I'm using Apache-2.2.2 on XP and trying out CGI scripting with my Logo
interpreter aUCBLogo-4.7.

It works nearly fine, but sometimes, when I run a CGI animation,
Thunderbird loads a wrong (older) image rather than loading the newly
generated one. This already happens when only one CGI script is running.

What can I do about it?

Thanks for any hints,
Andreas

--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.

HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html

Andreas Micheler

unread,
Jun 5, 2006, 7:40:39 PM6/5/06
to
Message has been deleted

Andreas Micheler

unread,
Jun 5, 2006, 9:55:10 PM6/5/06
to
Hi,

maybe it helps to see the Logo source code of the simple script:

#!C:/aucblogo-4.7-VC5/Logo/Release/aucblogo.exe
to cgitest2
setWriter "stdout
(type [|Content-type: text/html; charset=iso-8859-1

|])
catch "error
[ changeDir "|C:/aucblogo|
userproc
[|C:/Programme/Apache2.2/htdocs/|]
BitAnd getProcessID 63
]
err=error
if err != [] [print err]
bye
end

to userproc dname fname
request_method=getEnv "REQUEST_METHOD
query_string =getenv "QUERY_STRING
content_length=getenv "CONTENT_LENGTH

;request_method="GET
;query_string ="|heading=10&time=1234|
;content_length=getenv "CONTENT_LENGTH
;print query_string

if (empty? request_method) or2 empty? query_string
[ goto "nix
]

query_length=0
if request_method==" [stop]

if request_method=="GET
[ if query_string==" [stop]
ifelse content_length=="
[ query_length=count query_string
][ query_length=Int content_length
]
]
if request_method=="POST
[ if content_length==0 [stop]
query_length=Int content_length
setReader "stdin
query_string=readRawLine
setReader []
close path
]
maxArgs=10
name=Array maxArgs
value=Array maxArgs
for [i 1 maxArgs]
[ name.i=[]
value.i=[]
]
end_value=0
argCount=1
while [end_value < query_length]
[ start_name=end_value+1
end_name=start_name
while [end_name<query_length and2 query_string.end_name !="|=|]
[ end_name=end_name+1
]
name.argCount=Items start_name end_name-1 query_string
name.argCount=decode_string name.argCount

start_value=end_name+1
end_value=start_value
while [end_value<query_length and2 query_string.end_value !="|&|]
[ end_value=end_value+1
]
value.argCount=Items start_value end_value query_string
value.argCount=decode_string value.argCount

argCount=argCount+1
]
argCount=argCount-1
for [i 1 maxArgs]
[ if not empty? name.i
[ make word "% name.i value.i
]
]

Tag "nix
if not name? "%heading [%heading=0]

hideTurtle
load "tree.lg
setHeading %heading
tree
showTurtle
setSaveSize [400 300]
saveScreen (word dname fname "|.png|)

setWriter "stdout
(type "|
<HTML>
<Head>
<meta http-equiv="refresh" content="0;
URL=cgitest2.lg?heading=|
mod %heading+10 360 "|&time=| TimeFine "|">
</Head>
<Body>
<H1>Aha,</H1>
<H2>soso,</H2>
<H3>blabla.</H3>
|
[This is process number\ ] GetProcessId "|.
</br>|)
if name? "argCount
[ for [i 1 argCount]
[ (type name.i "|=| value.i)
if i<argCount [type "\ ]
]
]
(type "|</br>
<Image src="| word fname "|.png">
</Body>
</HTML>
|
)
setWriter []
end

to decode_string str
length=count str
outpos=1
for [i 1 length 1]
[ ifelse str.i == "|&|
[; str.outpos="| |
; outpos=outpos+1
][ ifelse str.i == "%
[ i=i+1 ch1=uppercase str.i
i=i+1 ch2=uppercase str.i
str.outpos=toInt word ch1 ch2 16
outpos=outpos+1
][ str.outpos=str.i
outpos=outpos+1
]
]
]
print str
output items 1 outpos-1 str
end

Thanks,

Andreas Micheler

unread,
Jun 11, 2006, 10:37:55 PM6/11/06
to
I wrote:
> It works nearly fine, but sometimes, when I run a CGI animation,
> Thunderbird loads a wrong (older) image rather than loading the newly
> generated one. This already happens when only one CGI script is running.

Ooops, I meant Firefox instead of Thunderbird of course!
But does it matter since this list seems very dead?

Si Ballenger

unread,
Jun 12, 2006, 12:50:52 AM6/12/06
to

passme

On Mon, 12 Jun 2006 04:37:55 +0200, Andreas Micheler
<Andreas....@Student.Uni-Augsburg.de> wrote:

>I wrote:
>> It works nearly fine, but sometimes, when I run a CGI animation,
>> Thunderbird loads a wrong (older) image rather than loading the newly
>> generated one. This already happens when only one CGI script is running.
>
>Ooops, I meant Firefox instead of Thunderbird of course!
>But does it matter since this list seems very dead?

You probably need to explain how your "CGI animation" is supposed
to work. I've seen some setups wheren if an image download fails,
the brouser will no longer try to get a new image.

Andreas Micheler

unread,
Jun 12, 2006, 4:04:20 AM6/12/06
to
Si Ballenger schrieb:

> passme
>
> On Mon, 12 Jun 2006 04:37:55 +0200, Andreas Micheler
> <Andreas....@Student.Uni-Augsburg.de> wrote:
>
>> I wrote:
>>> It works nearly fine, but sometimes, when I run a CGI animation,
>>> Thunderbird loads a wrong (older) image rather than loading the newly
>>> generated one. This already happens when only one CGI script is running.
>> Ooops, I meant Firefox instead of Thunderbird of course!
>> But does it matter since this list seems very dead?
>
> You probably need to explain how your "CGI animation" is supposed
> to work. I've seen some setups wheren if an image download fails,
> the brouser will no longer try to get a new image.

Ok, I'll try.
In my Logo "script" program I generate a HTML page,
like almost any CGI program does.
There I use a <META ...> tag to force loading of the next frame.
The Logo program also generates the image for each frame,
and as far as I can see,
this saveScreen does write the correct image to the file,
even before it writes the HTML output to stdout.
It just happens that some of the images won't show up,
instead some old images are shown.
I suspect there's some cache,
either of the browser or of Apache,
which thinks the image need not be loaded again,
since I use the numbers 0..63 with a .png extension for the filenames.

Can this Cache be disabled?
I've tried with 0 MB cache size in Firefox, but it doesn't help.

Has anyone a hint for me?

Thanks,
Andreas

Andreas Micheler

unread,
Jun 13, 2006, 5:15:12 PM6/13/06
to
Hi,

I now have a partial solution to my problem:

I finally found out how to disable the cache of Firefox,
by typing "about:config" into the address bar,
and in the long config list disabling all cache things.
This I found after hours of googling.
With Internet Explorer it was pretty easy,
I found a option to disable the cache in one of the dialogs.

Cheers,

0 new messages