|
|

02-12-2010, 04:01 PM
|
|
Member
|
|
Join Date: Nov 2006
Posts: 13
|
|
[RESOLVED] PHP5 - Linklok IPN 503 error
This is a persistent problem I'm getting with Linklok IPN.
Linklok is a small PHP script that serves files outside the webroot to users who authenticate via a embedded token in the URL.
I've reproduced the relevant portion of the code here:
PHP Code:
function xfpassthru($file)
{
global $downloadbuffer;
if ($downloadbuffer>0)
{
while(!feof($file))
{
print(fread($file, $downloadbuffer));
ob_flush();
flush();
sleep(1);
}
fclose($file);
}
else
@fpassthru($file);
}
When Litespeed is just restarted, everything works fine. However, after it's been running a while with multiple users accessing other portions of the site, we start getting 503 errors when file downloads are attempted (this is a 19meg file). The server does not auto attempt a restart when this happens. Once this error occurs, no more downloads are possible (all 503).
This problem does not occur in Apache. We are using LSWS enterprise 4.12 and both Apache and LSWS are using the same version of PHP5.
For now I'm running Apache in parallel JUST to support this script, on port 79. I can't figure out how to run LSWS on a negative port offset (it refuses this as a parameter) and some ISPs view sub-80 http ports as unsafe and refuse connections.
Last edited by NiteWave; 02-24-2010 at 05:29 PM..
|

02-13-2010, 07:29 PM
|
|
LiteSpeed Staff
|
|
Join Date: Sep 2009
Posts: 2,218
|
|
php stream files is not efficient.
if you can make use of litespeed's "Internal Redirect"(http://www.litespeedtech.com/support...ernal_redirect) feature in the script, will improve a lot. faster and use less resource(mem/cpu/process). And, the issue you reported may be gone.
this is not a direct reply to your issue, rather 's a comment. FYI.
|

02-15-2010, 09:29 AM
|
|
Member
|
|
Join Date: Nov 2006
Posts: 13
|
|
Quote:
Originally Posted by NiteWave
php stream files is not efficient.
if you can make use of litespeed's "Internal Redirect"( http://www.litespeedtech.com/support...ernal_redirect) feature in the script, will improve a lot. faster and use less resource(mem/cpu/process). And, the issue you reported may be gone.
this is not a direct reply to your issue, rather 's a comment. FYI.
|
Thanks, didn't know litespeed had this feature. I'll mod the script and see if litespeed prefers that.
EDIT:
Ok tried it out, since I'm using PHP I have to use
Code:
$header="X-LiteSpeed-Location: /".$link;
header($header);
However, this does not work, it doesn't even return an error. Did this feature make it into the Litespeed PHP5 binary build?
I checked against a normal "Location :/".$link header and that worked just fine, however, it's doing a normal redirect in this case because I have a rewrite condition on the link which gives a 403 error and that is triggered. Could someone on Litespeed verify if this special header is in the PHP5 binary build for Litespeed? I built this using my Cpanel/Apache config and everything else works fine.
Last edited by chernann; 02-15-2010 at 10:15 AM..
|

02-15-2010, 12:24 PM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,585
|
|
|
It is a LiteSpeed internal feature. Only need the "X-LiteSpeed-location" header.
Maybe you can try a simple test script, see if it works.
the $link should be a URL different from the request URL, otherwise, it will become a loop redirect.
|

02-22-2010, 10:57 PM
|
|
Member
|
|
Join Date: Nov 2006
Posts: 13
|
|
I got it to work, but can't seem to get the redirect working properly. Anything that correctly creates a 403 also causes the redirect to 403.
eg. my url is http://abc.com/1234/file.zip
According to the wiki I am supposed to be matching for 1234/ to 403, and because litespeed is handling the redirect it should bypass this htaccess rule. However it still gives me a 403 error.
|

02-23-2010, 02:53 AM
|
|
LiteSpeed Staff
|
|
Join Date: Sep 2009
Posts: 2,218
|
|
I just did test on localhost(4.0.13 standard version), it's working as expected.
rewrite rule:
Quote:
RewriteCond %{ORG_REQ_URI} ^/a/block/
RewriteRule ^/a/block/ - [R=403,F]
|
/a/b/test.php
Quote:
<?php
header("X-LiteSpeed-Location: /a/block/test.html");
?>
|
when access directly:
Code:
http://localhost/a/block/test.html
403 Forbidden
when access via
Code:
http://localhost/a/b/test.php
output content of /a/block/test.html
|
| Thread Tools |
|
|
| Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 12:52 PM.
|
|