Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

malformed header from script

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
Criena
Smarty Rookie


Joined: 29 Jul 2003
Posts: 5

PostPosted: Tue Jul 29, 2003 11:40 pm    Post subject: malformed header from script Reply with quote

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
View user's profile Send private message
CirTap
Smarty Pro


Joined: 04 Jun 2003
Posts: 106

PostPosted: Sat Aug 09, 2003 2:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
Criena
Smarty Rookie


Joined: 29 Jul 2003
Posts: 5

PostPosted: Sat Aug 09, 2003 4:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
CirTap
Smarty Pro


Joined: 04 Jun 2003
Posts: 106

PostPosted: Sat Aug 09, 2003 8:38 pm    Post subject: Reply with quote

hmm.. suspicious Smile
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
View user's profile Send private message
Criena
Smarty Rookie


Joined: 29 Jul 2003
Posts: 5

PostPosted: Sat Aug 09, 2003 9:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Sat Aug 09, 2003 11:44 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sun Aug 10, 2003 8:25 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Criena
Smarty Rookie


Joined: 29 Jul 2003
Posts: 5

PostPosted: Sun Aug 10, 2003 5:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sun Aug 10, 2003 9:40 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
CirTap
Smarty Pro


Joined: 04 Jun 2003
Posts: 106

PostPosted: Wed Aug 13, 2003 11:06 am    Post subject: Reply with quote

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 Wink

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Aug 13, 2003 11:20 am    Post subject: Reply with quote

http://marc.theaimsgroup.com/?l=smarty-cvs&m=106055087322512&w=2

but it's better if you test RC-1.
2.6.0-final may contain bugs that *you* didn't find if you only let others do the dirty work. Wink
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CirTap
Smarty Pro


Joined: 04 Jun 2003
Posts: 106

PostPosted: Wed Aug 13, 2003 4:27 pm    Post subject: Reply with quote

messju wrote:
2.6.0-final may contain bugs that *you* didn't find if you only let others do the dirty work. Wink

I can live with that, and that I don't apear in the credits then <gg>
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Aug 13, 2003 4:34 pm    Post subject: Reply with quote

hmm, do i have to expect legal consequences if the NEWS file reads like:
Quote:
Fixed compile-path issue not found by CirTap (messju)


??? Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CirTap
Smarty Pro


Joined: 04 Jun 2003
Posts: 106

PostPosted: Wed Aug 13, 2003 5:03 pm    Post subject: Reply with quote

naah.. not for this single line.
I'd only bother my lawyers if you
preg_replace("/^Fixed (.*)/", "Fixed \\1 not found by CirTap", $news); Very Happy
and of course you could add:
Fixed class declaration in example code for objects in advanced features found by CirTap Cool

Just downloaded RC1 to stress my dev-server and test and report bugs, bugs, bugs ... Twisted Evil

Have fun <g>,
CirTap
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP