LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Bug Reports > Headers not being sent correctly

Reply
 
Thread Tools Display Modes
  #1  
Old 10-29-2005, 11:27 PM
matt matt is offline
Member
 
Join Date: Oct 2005
Location: San Francisco
Posts: 37
Default Headers not being sent correctly

Okay, I just ran into this today after somebody left a comment about it:

http://akismet.com/blog/2005/10/data...ve/#comment-22

You can see the problem by trying to parse any RSS feed on wordpress.com, example:

http://feedvalidator.org/check.cgi?u....com%2Ffeed%2F

All of the headers are being sent with header() inside the PHP script. They're running a standard version of the latest SVN checkout of WordPress.

Does lsphp need headers sent in a special way?
Reply With Quote
  #2  
Old 10-30-2005, 04:46 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
Hi Matt,

Thank you for the bug report.

Did some investigation with lynx, when I do "lynx --mime_header http://matt.wordpress.com/feed/", the header looks like:

Code:
HTTP/1.0 200 OK
X-totalblogs: 14127
X-rootblog: http://wordpress.com/
X-created-on: 2005-07-20 19:50:09
x-db: 207.7.108.198
X-Pingback: http://matt.wordpress.com/xmlrpc.php
Last-Modified: Tue, 25 Oct 2005 23:26:01 GMT
ETag: "deca730f620152cfa102d56d2237361e"
OK
Content-type: text/xml; charset=UTF-8
Server: LiteSpeed
Date: Mon, 31 Oct 2005 00:33:04 GMT
Connection: close

<?xml version="1.0" encoding="UTF-8"?>

...
There is an extra "OK" below ETag header, I will try to duplicate this with PHP's header() function, it will be great if you can give me an example.

Thanks,
George
Reply With Quote
  #3  
Old 10-30-2005, 05:44 PM
matt matt is offline
Member
 
Join Date: Oct 2005
Location: San Francisco
Posts: 37
Here is a list of header calls that could have been triggered on that page:

Code:
wp-includes/wpmu-functions.php&#58;301&#58;     header&#40; "X-totalblogs&#58; " . get_blog_count&#40;&#41; &#41;;
wp-includes/wpmu-functions.php&#58;302&#58;     header&#40; "X-rootblog&#58; http&#58;//" . $current_site->domain . $current_site->path &#41;;
wp-includes/wpmu-functions.php&#58;303&#58;     header&#40; "X-created-on&#58; " . $current_blog->registered &#41;;
wp-includes/wpmu-functions.php&#58;306&#58;             header&#40; "X-wpmu-date&#58; $WPMU_date" &#41;;
wp-includes/wp-db.php&#58;504&#58;      header&#40; 'Content-Type&#58; text/html; charset=utf-8'&#41;;
wp-includes/pluggable-functions.php&#58;157&#58;                header&#40;'Location&#58; ' . get_settings&#40;'siteurl'&#41; . '/wp-login.php?redirect_to=' . urlencode&#40;$_SERVER&#91;'REQUEST_URI'&#93;&#41;&#41;;
wp-includes/pluggable-functions.php&#58;170&#58;                header&#40;"Refresh&#58; 0;url=$location"&#41;;
wp-includes/pluggable-functions.php&#58;172&#58;                header&#40;"Location&#58; $location"&#41;;
wp-includes/classes.php&#58;1495&#58;           @header&#40;'X-Pingback&#58; '. get_bloginfo&#40;'pingback_url'&#41;&#41;;
wp-includes/classes.php&#58;1497&#58;                   status_header&#40; 404 &#41;;
wp-includes/classes.php&#58;1499&#58;                   @header&#40;'Content-type&#58; ' . get_option&#40;'html_type'&#41; . '; charset=' . get_option&#40;'blog_charset'&#41;&#41;;
wp-includes/classes.php&#58;1507&#58;                   @header&#40;"Last-Modified&#58; $wp_last_modified"&#41;;
wp-includes/classes.php&#58;1508&#58;                   @header&#40;"ETag&#58; $wp_etag"&#41;;
wp-includes/classes.php&#58;1524&#58;                           status_header&#40; 304 &#41;;
wp-includes/classes.php&#58;1587&#58;                   status_header&#40; 404 &#41;;
wp-includes/classes.php&#58;1589&#58;                   status_header&#40; 200 &#41;;
wp-includes/functions.php&#58;2059&#58;         @header&#40;"Status&#58; $header $text"&#41;;
wp-includes/functions.php&#58;2062&#58;                 @header&#40;$text, TRUE, $header&#41;;
wp-includes/functions.php&#58;2064&#58;                 @header&#40;"HTTP/1.x $header $text"&#41;;
wp-includes/functions.php&#58;2069&#58; @ header&#40;'Expires&#58; Wed, 11 Jan 1984 05&#58;00&#58;00 GMT'&#41;;
wp-includes/functions.php&#58;2070&#58; @ header&#40;'Last-Modified&#58; ' . gmdate&#40;'D, d M Y H&#58;i&#58;s'&#41; . ' GMT'&#41;;
wp-includes/functions.php&#58;2071&#58; @ header&#40;'Cache-Control&#58; no-cache, must-revalidate, max-age=0'&#41;;
wp-includes/functions.php&#58;2072&#58; @ header&#40;'Pragma&#58; no-cache'&#41;;
wp-rss2.php&#58;8&#58;header&#40;'Content-type&#58; text/xml; charset=' . get_settings&#40;'blog_charset'&#41;, true&#41;;
I suspect it might be related to the status header function, which is this:

Code:
function status_header&#40; $header &#41; &#123;
	if &#40; 200 == $header &#41;
		$text = 'OK';
	elseif &#40; 301 == $header &#41;
		$text = 'Moved Permanently';
	elseif &#40; 302 == $header &#41;
		$text = 'Moved Temporarily';
	elseif &#40; 304 == $header &#41;
		$text = 'Not Modified';
	elseif &#40; 404 == $header &#41;
		$text = 'Not Found';
	elseif &#40; 410 == $header &#41;
		$text = 'Gone';

	if &#40; preg_match&#40;'/cgi/',php_sapi_name&#40;&#41;&#41; &#41; &#123;
		@header&#40;"Status&#58; $header $text"&#41;;
	&#125; else &#123;
		if &#40; version_compare&#40;phpversion&#40;&#41;, '4.3.0', '>='&#41; &#41;
			@header&#40;$text, TRUE, $header&#41;;
		else
			@header&#40;"HTTP/1.x $header $text"&#41;;
	&#125;
&#125;
Thanks for your help with this.
Reply With Quote
  #4  
Old 10-30-2005, 05:47 PM
matt matt is offline
Member
 
Join Date: Oct 2005
Location: San Francisco
Posts: 37
Okay I just confirmed that commenting out the call to status_header( 200 ); in classes.php stops the problem.
Reply With Quote
  #5  
Old 10-31-2005, 09:06 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
Thank you for the update.

The issue is that,
Code:
@header&#40;"OK", TRUE, 200&#41;;
is used when call "status_header( 200 )", and this will add a header only contains "OK\n" in the response header, then LSWS just append this line to the response header list when receive this line.

We add some validation check to remove those kind of header unless it starts with a white space character (for multi line response header) in next release.

I might be wrong as I am not a PHP coder, I think the header generation code should use the CGI style "Status:..." or HTTP style "HTTP/1.x ...", not only the status text, as it is not a valid header. :-)
Reply With Quote
  #6  
Old 10-31-2005, 12:08 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
please give 2.1.5 a try, should be fixed. http://www.litespeedtech.com/package...6-linux.tar.gz
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ProxyPass dlhhyct Feedback/Feature Requests 27 10-15-2008 12:04 PM
Context-level problems setting custom HTTP headers Marcus Install/Configuration 3 04-03-2007 09:35 PM
Headers always no-store, no-cache etc for PHP files? pcguru PHP 3 01-17-2007 11:30 AM
Headers Content-Type settings? Auz Install/Configuration 3 02-14-2006 10:54 AM
Non-parsed headers? satang Bug Reports 8 07-12-2004 05:27 PM


All times are GMT -7. The time now is 05:24 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.