PDA

View Full Version : Problem with Server Response in FF3 (not FF2)



Strangeplant
08-18-2008, 02:54 PM
Hi everyone,

I have this problem that has surfaced in FF3 and IE7, but did not exist before with FF2 and IE6, but with the new update to FF2, it doesn't work in FF2 properly (see below).

1. First I build an array of possible images.
2. Then I query the server to see if the files exist.
3. Then I eliminate elements of the array for missing images.

The problem seems to be in the browser accesptiing a server reply - I know the reply is sent from sniffing the transactions on the internet. My code is this:

// Correct imagelink array for any missing elements //
for (m=imagetotl-1;m>=3;m--) {
testExists(imagelink[m]);
if(nB) {
imagetotl--;
for (n=m;n<=imagetotl+1;n++) {
imagelink[n]=imagelink[n+1];
}
}
}

function testExists(imagepath) {
req = getreq();
req.onreadystatechange = imagexists;
req.open("HEAD", imagepath, false);
req.send(null);
// alert("tested "+imagepath); (note that if this is uncommented, if works fine)
}

function imagexists() {
if(req.readyState == 4) {
if(req.status == 200)
{
// image exists
nB=false;
}
else
{
// image doesn't exist
nB=true;
}
}
}

function getreq() { // returns false if exists
if(window.ActiveXObject) { // if IE
try {
return new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
return new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
return;
}
}
} else if(window.XMLHttpRequest) { // if Mozilla, Safari, etc.
return new XMLHttpRequest();
}
}
Now, I found a recent webpost at http://www.mail-archive.com/users@cocoon.apache.org/msg42938.html that says the 'HEAD' requests don't work anymore, and to use 'GET'.....well that doesn't seem to work either in my case. That is unless I add the alert (which I don't want to do, but it makes it work for the recent FF2 update and in FF3.)

How do I solve this problem? What is going on?

Strangeplant
08-19-2008, 01:20 PM
I have searched on the web, finding a very few recent threads about how FF3 breaks Ajax (XMLHttpRequest method). Apparently, the accept character method is different than FF2. If I have it right, FF2, IE6, IE7 accepts a response in utf-8, but I may be backwards on that, so it could be ISO-8859-1. Doing a trace on what the server sends back to FF3 from the GET request, it reads:
Host: bla.bla.bla.bla
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://bla.bla.bla.bla.php
Cookie: SESSION=eiqm0d1c4dqd84ol6rcps8jdd3; saveit_0=5; saveit_1=5; saveit_2=8; PHPSESSID=eiqm0d1c4dqd84ol6rcps8jdd3


16:46:20.154731 IP bla.bla.bla.bla.http > bla.bla.bla.bla.4731: . 69700:72620(2920) ack 1119 win 7696
E.....@.@....J.$.J.'.P.{'...ya..P...7b..HTTP/1.1 200 OK
Date: Mon, 18 Aug 2008 20:46:20 GMT
Server: Apache
Last-Modified: Mon, 21 Jul 2008 16:34:35 GMT
ETag: "14e81cb-15a49-4528b485f9cc0"
Accept-Ranges: bytes
Content-Length: 88649
Keep-Alive: timeout=25, max=199
Connection: Keep-Alive
Content-Type: image/jpegand FF3 cannot interpret the result.

The server response from FF2, following the GET request is:
Host: bla.bla.bla.bla
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 Firefox/2.0.0.16
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://bla.bla.bla.bla.php
Cookie: SESSION=dpc0ouv4vbl58o4ooe8eu6eqk2; saveit_0=5; saveit_1=5; saveit_2=8; PHPSESSID=dpc0ouv4vbl58o4ooe8eu6eqk2


16:44:24.924927 IP bla.bla.bla.bla.http > bla.bla.bla.bla.dsatp: . 159640:162560(2920) ack 3044 win 11430
E...6.@.@....J.$.J.E.P.? .t....!P.,.7...HTTP/1.1 200 OK
Date: Mon, 18 Aug 2008 20:44:24 GMT
Server: Apache
Last-Modified: Tue, 10 Jun 2008 19:10:37 GMT
ETag: "d00017-d8f4-44f54aee60540"
Accept-Ranges: bytes
Content-Length: 55540
Keep-Alive: timeout=25, max=196
Connection: Keep-Alive
Content-Type: image/jpegSo, the server responses are the same, and I take this to mean that I need to decode the response IF it goes to FF3. Now the question is how in the world do I control that? I have found a web discussion thread that is totally out of my league at: http://www.west-wind.com/WebLog/posts/276057.aspx and another with a discussion of a solution at: http://echo.nextapp.com/site/node/5230This last one talks about "modify the method parseRequestDocument of SynchronizeService", but what is that????? This is way out of my league in doing that. And I'm thinking that if I were to sucessuflly change the server response, I would then be breaking all other browsers. (The server IT guy thinks it must be my code, but it has worked just fine for more than two years.....). Please, someone show me the light.

Strangeplant
08-21-2008, 12:33 PM
Has anyone else had a problem of an Ajax response in the new FF3? I'm wondering if the problem can be fixed by a different configuration of the Apache2 server. Does anyone know about server configuration mods for changing language response (utf-8 vs ISO-8859-1)? I'm not an IT person, and the one in charge of the server cannot offer suggestions.

Thanks