View previous topic :: View next topic |
Author |
Message |
Criena Smarty Rookie
Joined: 29 Jul 2003 Posts: 5
|
Posted: Tue Jul 29, 2003 11:40 pm Post subject: malformed header from script |
|
|
Hi.
I'm using smarty by cgi and get the following error after pushing the refresh button: Code: | malformed header from script. Bad header=HTTP/1.1 304 Not Modified: ... |
Is it a bug?
Regards,
Criena _________________ "Don't Panic!"
(The Hitch Hikers Guide to the Galaxies) |
|
Back to top |
|
CirTap Smarty Pro
Joined: 04 Jun 2003 Posts: 106
|
Posted: Sat Aug 09, 2003 2:50 pm Post subject: |
|
|
Hi,
well there is obviously some bug, somewhere, the question is: who's causing it.
I doubt it's Smarty - alone.
You either have some prepend-file creating wrong header() data, you may have some plugin installed which changes the header (eg. the DOCTYPE plugin sends the content-type and encoding settings via header()), your .htaccess file may redirect to some cgi that's not responding with a 20x, or an ErrorDocument directive for 304 is defined pointing to a (buggy) cgi/php as well, a php.ini settings may be currupted ...
There are too many possible reasons for the malformed header to appear-
Try to break down your script, search for any header() statements and make sure they are 100% correct (semicolos, kommas, whitespaces, \n) , consult the RFC if in doubt or ask some HTTP/Apache/IIS(?) guru for help if you send some custom HTTP headers and status response codes.
Check your .htaccess and check your server's log files, whitch script/file was running last.
Test the scripts on different servers if possible (linux/win).
If you use rewrites and have access to the https conf, raise the debug level for mod_rewrite to find out, what your server is doing.
Happy debugging,
CirTap |
|
Back to top |
|
Criena Smarty Rookie
Joined: 29 Jul 2003 Posts: 5
|
Posted: Sat Aug 09, 2003 4:21 pm Post subject: |
|
|
Perhaps it is a bug.
I changed "Smarty.class.php/1121" (version 2.5.0) to "header("Status: 304 Not Modified");" and it worked.
I've send a bug report to smarty-dev. Let's see.
Criena _________________ "Don't Panic!"
(The Hitch Hikers Guide to the Galaxies) |
|
Back to top |
|
CirTap Smarty Pro
Joined: 04 Jun 2003 Posts: 106
|
Posted: Sat Aug 09, 2003 8:38 pm Post subject: |
|
|
hmm.. suspicious
To me, this response header looks ok for a HTTP 1/1 connection and so far Smarty 2.5.0 worked great on any Apache/OS combi and with all HTTP 1.1 browsers I have used so far.
But you're possibly right with the missing 'Status: ' message.
Maybe your browser sent a HTTP 1.0 request in which case the HTTP/1.1 response might be the problem -- it's very unlikely, but your server can handle HTTP 1.1, right?
Just curious: What' do you get with your browser/server from this:
[php:1:b5ad2b21a4]<?php
echo $_SERVER["SERVER_PROTOCOL"]; // should be 'HTTP/1.1'
phpinfo();
?>[/php:1:b5ad2b21a4]
CirTap |
|
Back to top |
|
Criena Smarty Rookie
Joined: 29 Jul 2003 Posts: 5
|
Posted: Sat Aug 09, 2003 9:56 pm Post subject: |
|
|
Yes, the output was HTTP/1.1.
I get the server error with "every" brower (IE and Mozilla) under "every" os (Win2k and Linux).
I don't think that it is a problem of the browser.
Criena _________________ "Don't Panic!"
(The Hitch Hikers Guide to the Galaxies) |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Sat Aug 09, 2003 11:44 pm Post subject: |
|
|
What server are you running? _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sun Aug 10, 2003 8:25 am Post subject: |
|
|
i think this is a bug. i can confirm this misbehaviour and i can confirm your fix (changing the header to say "Status:..." instead of "HTTP/1.1...") fixes it.
does anybody know how the header-handling has to be for other sapi-modules than apache or cgi? i'd hate fixing it and in a week another person with a another server has nearly the same problem. |
|
Back to top |
|
Criena Smarty Rookie
Joined: 29 Jul 2003 Posts: 5
|
Posted: Sun Aug 10, 2003 5:22 pm Post subject: |
|
|
AZTEK wrote: | What server are you running? |
I'm running Apache on both machines (php by module and php by cgi)
messju wrote: | does anybody know how the header-handling has to be for other sapi-modules than apache or cgi? i'd hate fixing it and in a week another person with a another server has nearly the same problem. |
I don't know. But I heard that the problem with cgi is, that it is an additional level between php and the webserver and it needs this "Status: " to know that it has to forward the header to the server.
Perhaps this helps you a little bit. Maybe every api which acts as an additional level needs some special handling like cgi.
Regards,
Criena _________________ "Don't Panic!"
(The Hitch Hikers Guide to the Galaxies) |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sun Aug 10, 2003 9:40 pm Post subject: |
|
|
okay, i committed a fix. i tested
- apache cgi
- apache dso
- apache2 filter
- thttpd
they all run fine now.
thanks for reporting this.
geetings
messju |
|
Back to top |
|
CirTap Smarty Pro
Joined: 04 Jun 2003 Posts: 106
|
Posted: Wed Aug 13, 2003 11:06 am Post subject: |
|
|
Quote: | okay, i committed a fix |
nice, and how does it look like? I don't want to wait for "2.6 final" or install the CVS/RC *, if it's a one-liner I could add myself -- temporarily
How 'bout an initial "Status: 202", to tell Apache 'you're done'?
I had to add this on top of a php-script handling ErrorDocument 404, when a .php files was requested that didn't exist. Apache came up with a 500 before and the 202 resolved this.
CirTap |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
|
Back to top |
|
CirTap Smarty Pro
Joined: 04 Jun 2003 Posts: 106
|
Posted: Wed Aug 13, 2003 4:27 pm Post subject: |
|
|
messju wrote: | 2.6.0-final may contain bugs that *you* didn't find if you only let others do the dirty work. |
I can live with that, and that I don't apear in the credits then <gg> |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Aug 13, 2003 4:34 pm Post subject: |
|
|
hmm, do i have to expect legal consequences if the NEWS file reads like:
Quote: | Fixed compile-path issue not found by CirTap (messju) |
??? |
|
Back to top |
|
CirTap Smarty Pro
Joined: 04 Jun 2003 Posts: 106
|
Posted: Wed Aug 13, 2003 5:03 pm Post subject: |
|
|
naah.. not for this single line.
I'd only bother my lawyers if you
preg_replace("/^Fixed (.*)/", "Fixed \\1 not found by CirTap", $news);
and of course you could add:
Fixed class declaration in example code for objects in advanced features found by CirTap
Just downloaded RC1 to stress my dev-server and test and report bugs, bugs, bugs ...
Have fun <g>,
CirTap |
|
Back to top |
|
|