create new tag
, view all tags

SID-01935: mod_perl sometimes returns - did not send an HTTP header

Status: Asked Asked TWiki version: 6.0.0 Perl version: 5.10
Category: CategoryAPI Server OS: RHEL6 Last update: 2 years ago

With mod_perl enabled for view and viewauth we see big improvement in the time to load a page. However sometimes the page returns just the page source and the apache error log shows messages like:

[warn] /twiki/bin/viewauth/TWiki/TWikiVariables did not send an HTTP header [error] malformed header from script. Bad header=i/TWikiVariables: viewauth

This is reproducable on pages that use the SEARCH variable and the TWikiVariables page always fails.

Anyone had similar experiences?

What is the solution?

Thanks in advance Pete

-- Peter Jones - 2014-06-18

Discussion and Answer

I have no TWiki site running under mod_perl so I do not know. FYI, Hideyo-san likes to run TWiki under Fast CGI, and he runs a very large TWiki.

-- Peter Thoeny - 2014-06-18

Pure guess: Maybe the content length is not correct on the pages that fail? Docs: http://perl.apache.org/docs/general/correct_headers/correct_headers.html

-- Peter Thoeny - 2014-06-18

Maybe this helps in debugging: http://www.rexswain.com/httpview.html

-- Peter Thoeny - 2014-06-18

I am running TWiki 6.0.0 under mod_perl, but no such problem so far. The symptoms suggest that "something" spits out some text, maybe a warning or an error message, before the headers (in particular the Content-Type) are built. So, the first line(s) of the output might contain a hint what's going wrong.

Things I'd investigate in such a situation are:

  • The mod_perl startup script. "Harmless" warnings in that script may become fatal later.
  • The grep related settings in /bin/configure. SEARCH greps explicitly, and TWikiVariables greps under the hood.

-- Harald Jörg - 2014-06-28

mod_perl sometimes does this if the code sending the headers is not a separate print statement from the code that sends the body.



print $headers; print $body;


print $headers . $body;

Some apache magic takes place intercepting the "print" stuff to figure out headers, which gets confused if it's all coming at once...

-- TWiki Guest - 2014-08-25

That is interesting info. Can you provide a source for this?

-- Peter Thoeny - 2014-08-25

No, that's not "Apache magic" or anything like that... It's called "bad programming", and happened to me too. If you put them separated in the code, there's a probability that you're sending one part to the browser and not the other, what generates this error.

-- TWiki Guest - 2015-11-14

Thanks for the feedback TWikiGuest.


On another note, you can help the community with a patch, or even with pointers to more details.

-- Peter Thoeny - 2015-11-14

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
Status Asked
Title mod_perl sometimes returns - did not send an HTTP header
SupportCategory CategoryAPI
TWiki version 6.0.0
Server OS RHEL6
Web server apache
Perl version 5.10
Browser & version Firefox
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2015-11-14 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.