"malformed header from script"

So, in testing simplyXiangqi, I found I was getting error pages when I tried certain actions. The actions seemed to happen okay, but I got the standard Rail ‘Application Error’.

Looking in the logs, I was getting an error ‘malformed header from script’. ‘Curious’, I thought. The full error was of the form:
malformed header from script. Bad header=isRed = 1:
/home/simplyxi/public_html/dispatch.cgi

It seemed to me that part of my code was appearing as a header when the page was returned.

Eventually, I figured it out. My code still had ‘puts()’ calls in it. I’d added these for debugging during development on WebBrick. In WebBrick, the strings output by ‘puts()’ were written to the command window WebBrick was running under. On my Apache installation, though, this was output as a header. Consequently, I got errors.

I removed the ‘puts’ calls, and it all worked fine.

Comments from my old blog:

Thanks, buddy. Saved my sorry ass. 🙂

By Magnus Bergmark at 18:07:07 Saturday 29th September 2007

Advertisement
"malformed header from script"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.