When an image on a page is requested and fails (503 for example), Privoxy returns an HTML error summary page to the browser. This causes an unintended side-effect in Opera, and I'm sure other browsers as well. In Opera, right-clicking an image gives you a context-menu with items relating to interacting with an image (Reload Image, Copy Image URL, etc). When the image fails to load however, since Privoxy returns HTML, Opera treats it as an HTML document and displays the context menu as if you had right clicked on the document background. The problem with this is that you cannot use the Reload Image item that's found on the context menu of images. So the only way to retry loading the image is to refresh the whole page. Is there any way to force privoxy to *not* send HTML error pages to the browser?
I've attached a screenshot showing the context menus for both a properly loaded image and an image that failed with a 503. The menu that opens when right clicking the failed image does have a "Reload" option, but that's to reload the entire page rather than just that one failed image.
Menu comparison
Please have a look at the documentation:
http://www.privoxy.org/user-manual/actions-file.html#BLOCK
http://www.privoxy.org/user-manual/actions-file.html#HANDLE-AS-IMAGE
Privoxy already uses URL-based heuristics to detect image requests.
Additionally some browsers set an appropriate Accept header when requesting images and Privoxy's image-request client-header tagger is supposed to detect this.
From your descriptions it sounds like the tagger might not work with Opera (assuming it's enabled), but it's possible that it could be improved.
I tried handle-as-image, but the result was the same. And reading the documentation seemed to confirm that it would have no effect in this case, because it implies that it only works when the url is blocked with +block, rather than just failing to download. Maybe I should note, I have *all* of the default included actions and filters disabled and use only the ones I write myself.
Checking the headers in Opera Dragonfly, I see:
Request
GET http://www.whateversite.com/503failimage.jpg HTTP/1.0
Host: whateversite.com
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Response
HTTP/1.0 503 Connect failed
Content-Length: 7853
Content-Type: text/html
Cache-Control: no-cache
Pragma: no-cache
One thing to note, while Opera is waiting for a response from the server, I can right click on the image placeholder and I get the appropriate image context menu. But as soon as it fails and Privoxy returns the HTML 503 error summary page the menu changes to the document background context menu.
OK, I don't know why I didn't try this before... But while bypassing Privoxy, if an image fails with a 404 the result is the same as before. But if the error is a 503 then I can still right-click the image placeholder and get the right context menu. But, there is a feature in Opera that automatically retries interrupted/unloaded images that now works with Privoxy out of the loop. I think it's confused when Privoxy returns a full HTML error page.
You are right that handle-as-image currently only affects Privoxy's error message in case of blocks. I missed that you were talking about real errors.
Most error messages are generated from templates. If you empty the templates, Privoxy shouldn't send HTML to the client (when using templates). This will not affect the Content-Type, but maybe Opera doesn't care about this.
While it would be possible to let handle-as-image affect all of Privoxy's CGI messages, I'm don't think that would be a good default and I'm not sure if it's worth an additional option.
I temporarily renamed the templates folder, and tried again. This time Privoxy returned a different error page in place of the image, "500 Internal Privoxy Error", "Could not load template file connect-failed or one of its included components.". I do like the error summary pages though, I'd like to leave them in place anyway.
I was looking through previous tracker items here, and I found one from just a few months ago about automatically retrying on 503 errors. You explained how to do that using server-header-tagger, redirect, and fast-redirect. This could be a partial workaround to the problem (to make Opera automatically retry rather than waiting for me to right click and Reload until it works), but I'm unsure how to implement your suggestion. All of the actions I've worked with so far are plain filters and client-header-filters, I don't understand the documentation descriptions and examples for the other actions, particularly the server-header-tagger.
Instead of renaming the template directory, you should empty the actual template files.
While Privoxy will complain about missing templates, it should accept empty ones.
IIRC the support request you found about retrying in case of 503 was about error messages coming from the server. Privoxy doesn't apply taggers to its own headers so I don't see a way to leverage them in your situation.