2023年05月26日 15:41
Unfortunately for web programmers, browser bugs are not uncommon, and sometimes we have to deal with them; refer to this chapter for some known bugs and how you can work around them.
The following feature/bug mostly affects developers.
Certain browsers will serialize requests to the same URL if accessed from different windows. For example if you have a CGI script that does:
for (1..100) {
print "$$: $_\n";
warn "$$: $_\n";
sleep 1;
}
And two concurrent requests are issued from different windows of the same browser (for those browsers that have this bug/feature), the browser will actually issue only one request and won't run the second request till the first one is finished. The debug printing to the error_log file helps to understand the serialization issue.
Solution? Find a UA that doesn't have this feature, especially if a command line UA will do (LWP comes to mind). As of this writing, opera 6, mozilla 1.0 on linux have this problem, whereas konqueror 3 and lynx don't.
In a URL which contains a query string, if the string has multiple parts separated by ampersands and it contains a key named "reg", for examplehttp://example.com/foo.pl?foo=bar®=foobar
, then some browsers will interpret ® as an SGML entity and encode it as®
. This will result in a corrupted QUERY_STRING.
The behavior is actually correct, and the problem is that you have not correctly encoded your ampersands into entities in your HTML. What you should have in the source of your HTML is http://example.com/foo.pl?foo=bar®=foobar
.
A much better, and recommended solution is to separate parameter pairs with ; instead of&. CGI.pm, Apache::Request
and$r->args()
support a semicolon instead of an ampersand as a separator. So your URI should look like this:http://example.com/foo.pl?foo=bar;reg=foobar
. Note that this is only an issue within HTML documents when you are building your own URLs with query strings. It is not a problem when the URL is the result of submitting a form because the browsers have to get that right. It is also not a problem when typing URLs directly into the address bar of the browser.
Reference: http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2
One problem with publishing 8080 port numbers (or so I have been told) is that IE 4.x has a bug when re-posting data to a non-port-80 URL. It drops the port designator and uses port 80 anyway.
See Publishing Port Numbers other than 80
.
Many users stumble upon a common problem related to MS Internet Explorer: if your error response, such as when usingErrorDocument 500
or$r->custom_response
, is too short (which might often be the case because you aren't very inspired when writing error messages), Internet Explorer completely disregards it and replaces it with its own standard error page, even though everything has been sent correctly by the server and received by the browser.
The solution to this is quite simple: your content needs to be at least 512 bytes. Microsoft describes some solutions to this problem here: http://support.microsoft.com/support/kb/articles/Q294/8/07.ASP
. The easiest solution under Perl is to do something like this:
# write your HTML headers
print "<!-- ", "_" x 513, " -->";
# write out the rest of your HTML
Effectively, your content will be long enough, but the user won't notice any additional content. If you're doing this with static pages, just insert a long enough comment inside your file to make it large enough, which will have the same effect.