corrupt data provided by litespeed server for PHP $_GET variable

XMB

New Member
#1
i had an error with litespeed server software and this is what application develoer says:

I see that your site is responding 404, however the problem is not with your browser. This is likely a compatibility issue with your "LiteSpeed" server software, with which I am not familiar. Your server appears to provide corrupt data in the PHP $_GET variable and possibly the $_REQUEST['QUERY_STRING'] variable as well.

i cannot post links to show the error
but check illuminatetoday.com/discus and view last post under any thread or forum link in IE browser to know the error
 

NiteWave

Administrator
#2
this may be an IE issue, firefox is fine -- by checking the webpage you referred.

I've simplified the issue as
Not tested with Apache yet. and I'm not sure what's the right solution at the moment. PHP developer may consider this workaround:
when there is # in the value:
$_GET["tid"]="344#pid2106";
ignore #... and treat it as
$_GET["tid"]="344";
 

XMB

New Member
#3
i was using same php scirpt on apache and never had problems
i wonder whats wrong with litespeed and IE combo

however have a look at this
(i still cant post external links)

forums.xmbforum.com/viewthread.php?tid=775806
 

NiteWave

Administrator
#4
ok. the subtle difference between apache and lsws are:

apache:
~>curl -I "http://forums.xmbforum.com/viewthread.php?tid=775806#pid1369843"
HTTP/1.1 200 OK
Date: Fri, 11 Jun 2010 13:04:58 GMT
Server: Apache/2.0.63 (CentOS)
X-Powered-By: PHP/5.2.5
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: xmblva=1276261498; expires=Sat, 11-Jun-2011 13:04:58 GMT; path=/; domain=forums.xmbforum.com
Set-Cookie: xmblvb=1276261498; expires=Fri, 11-Jun-2010 13:14:58 GMT; path=/; domain=forums.xmbforum.com
Set-Cookie: oldtopics=%7C1369843%7C; expires=Fri, 11-Jun-2010 13:14:58 GMT; path=/; domain=forums.xmbforum.com
Connection: close
Content-Type: text/html
lsws:
~>curl -I "http://www.illuminatetoday.com/discus/viewthread.php?tid=344#pid2106"
HTTP/1.1 404 Not Found
Date: Fri, 11 Jun 2010 13:22:49 GMT
Server: LiteSpeed
Connection: close
X-Powered-By: PHP/5.2.13
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
Pragma: no-cache
Content-Type: text/html
Set-Cookie: xmblva=1276262593; expires=Sat, 11-Jun-2011 13:23:13 GMT; path=/discus/; domain=.illuminatetoday.com
Set-Cookie: xmblvb=1276262593; expires=Fri, 11-Jun-2010 13:33:13 GMT; path=/discus/; domain=.illuminatetoday.com
Vary: User-Agent
 

NiteWave

Administrator
#6
worked out a rewrite rule and tested on lsws:
#this acts as a patch to IE
RewriteEngine on
RewriteCond %{QUERY_STRING} (.*)#(.*) [NC]
RewriteRule (.*) $1?%1
description:
(1)when server response to IE browser with header:
Code:
HTTP/1.1 302 Found
Server: LiteSpeed
X-Powered-By: PHP/5.2.13
Location: http://www.illuminatetoday.com/discus/viewthread.php?tid=673#pid4503
note:there is #pid4503 in Location

(2)IE send following Request Header to web server:
Code:
GET http://www.illuminatetoday.com/discus/viewthread.php?tid=673#pid4503 HTTP/1.1
however, firefox will eliminate #pid4503 in URL before send
Code:
GET http://www.illuminatetoday.com/discus/viewthread.php?tid=673 HTTP/1.1
and, if you copy/paste the URL in IE's address bar directly, it'll eliminate #pid4503 as well!

(3)lsws will return
Code:
HTTP/1.1 404 Not Found
apache will eliminate #pid4503 in URL and return result page
http://www.illuminatetoday.com/discus/viewthread.php?tid=673

with the rewrite rule patch, lsws will act like apache, discard #xxx part in URL.
note: discard # and all following characters.
for example: x.php?a=1#222&b=2
will rewrite to x.php?a=1
which apache act in this way as well.
 
Top