You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Douglas W. Goodall" <do...@mac.com> on 2016/02/15 03:44:31 UTC
[users@httpd] image display error with stock icon
I have written a very simple pair of cgi scripts in python that display a toggle switch either
in the up position, or in the down position. When you click on the switch, it toggles between
the two and switches between the images appropriately. At least that is what it is supposed
to do.
The problem presented itself as the switch always being in the down position, no matter
how I toggled and switched between the cgi scripts.
Here is the down
and here is the up.
I checked in the browser debugger and the cgi scripts were trying to send the proper images.
I tried the in the Mac OS X based Safari and Chrome and had identical results.
When I eventually gave up and used different switch images, the problem went away, so it
is my best guess that there is something pathological about the binary contents of the images
making the Web Server send a cached version of the down switch image instead of the up
switch image that is needed.
Re: [users@httpd] image display error with stock icon
Posted by "Douglas W. Goodall" <do...@mac.com>.
Thanks for responding Chris.
The URL names are:
https://goodall.us.com/img/switch-up.jpg <https://goodall.us.com/img/switch-up.jpg>
https://goodall.us.com/img/switch-dn.jpg <https://goodall.us.com/img/switch-dn.jpg>
When I converted them to text strings for inclusion in the python source, it looked like the first half of the
image file is near identical.. I can spot differences down about half way by eye. I can understand if the web
server digested the first 1k of the image they might seem identical. I guess a switch would be the pathological
case because the outside would be identical, and somewhere inside the action would move one way or
another.
I used the demo mode in chrome and looked at the url of the img src, and while it said switch-up, the tool-tip
image that came up was the down switch. Then I converted the image files to text for inclusion in the
python in case that would help and it did not.
Here are my simplified test files.
[root@cloud-goodall-us-com html]# cat images.py
#!/usr/bin/python
# /var/www/html/images.py 2/13/2016 dwg - #
############################################################
SWITCHDN = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QCARXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAKgAgAEAAAAAQAAACCgAwAEAAAAAQAAAB4AAAAA/9sAQwABAQEBAQEBAQEBAQEBAQEBAQE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+J/iPqvhH9n/wAYeG/Fvi4/B3xf4f8AGXg6y/tzUfjZ4k07To4NS8N6fbXkkWgSyXmnNcwSFblra9tANj//2Q=="
#######
# eof #
#######
[root@cloud-goodall-us-com html]# cat state0.cgi
#!/usr/bin/python
# /var/www/html/state0.cgi 2/13/2016 dwg - #
############################################################
import os
import sys
import sysconfig
import images
print("Content-type: text/html\n\n")
import cgi,cgitb
cgitb.enable()
print("<!DOCTYPE html>\n")
print("<html>\n")
print(" <head>\n")
print(" </head>\n")
print(" <body>\n")
print("<a href=\"https://goodall.us.com/state1.cgi\"><img src=\""+images.SWITCHDN+"\"></a>")
print(" </body>\n")
print("</html>\n")
[root@cloud-goodall-us-com html]# cat state1.cgi
#!/usr/bin/python
# /var/www/html/state0.cgi 2/13/2016 dwg - #
############################################################
import os
import sys
import sysconfig
import images
print("Content-type: text/html\n\n")
import cgi,cgitb
cgitb.enable()
print("<!DOCTYPE html>\n")
print("<html>\n")
print(" <head>\n")
print(" </head>\n")
print(" <body>\n")
print("<a href=\"https://goodall.us.com/state0.cgi\"><img src=\""+images.SWITCHUP+"\"></a>")
print(" </body>\n")
print("</html>\n")
> On Feb 14, 2016, at 7:29 PM, Christopher Schultz <ch...@christopherschultz.net> wrote:
>
> Douglas,
>
> On 2/14/16 9:44 PM, Douglas W. Goodall wrote:
>> I have written a very simple pair of cgi scripts in python that display
>> a toggle switch either
>> in the up position, or in the down position. When you click on the
>> switch, it toggles between
>> the two and switches between the images appropriately. At least that is
>> what it is supposed
>> to do.
>>
>> The problem presented itself as the switch always being in the down
>> position, no matter
>> how I toggled and switched between the cgi scripts.
>>
>> Here is the down
>> and here is the up.
>>
>> I checked in the browser debugger and the cgi scripts were trying to
>> send the proper images.
>> I tried the in the Mac OS X based Safari and Chrome and had identical
>> results.
>>
>> When I eventually gave up and used different switch images, the problem
>> went away, so it
>> is my best guess that there is something pathological about the binary
>> contents of the images
>> making the Web Server send a cached version of the down switch image
>> instead of the up
>> switch image that is needed.
>
> If the URL of the switch image the same in both cases (e.g.
> /images/switch_state.cgi)?
>
> If so, you may be dealing with browser caching. Use the usual cadre of
> response headers to instruct the client not to cache the response.
>
> If not, then the problem may still be a cached image, possibly from a
> time where the URL pointed to the wrong image.
>
> Using Chrome's dev tools, you can see exactly what the client HTTP
> request and server HTTP response look like. That may help find out
> what's going on.
>
> -chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
Re: [users@httpd] image display error with stock icon
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Douglas,
On 2/14/16 9:44 PM, Douglas W. Goodall wrote:
> I have written a very simple pair of cgi scripts in python that display
> a toggle switch either
> in the up position, or in the down position. When you click on the
> switch, it toggles between
> the two and switches between the images appropriately. At least that is
> what it is supposed
> to do.
>
> The problem presented itself as the switch always being in the down
> position, no matter
> how I toggled and switched between the cgi scripts.
>
> Here is the down
> and here is the up.
>
> I checked in the browser debugger and the cgi scripts were trying to
> send the proper images.
> I tried the in the Mac OS X based Safari and Chrome and had identical
> results.
>
> When I eventually gave up and used different switch images, the problem
> went away, so it
> is my best guess that there is something pathological about the binary
> contents of the images
> making the Web Server send a cached version of the down switch image
> instead of the up
> switch image that is needed.
If the URL of the switch image the same in both cases (e.g.
/images/switch_state.cgi)?
If so, you may be dealing with browser caching. Use the usual cadre of
response headers to instruct the client not to cache the response.
If not, then the problem may still be a cached image, possibly from a
time where the URL pointed to the wrong image.
Using Chrome's dev tools, you can see exactly what the client HTTP
request and server HTTP response look like. That may help find out
what's going on.
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org