Malformed header from this script?

Malformed header from this script?

Post by Michael Fu » Fri, 28 Mar 1997 04:00:00



    [cc to author]


>Apache give me the error message

>access to /usr/lib/cgi-bin/search_library.cgi failed for
>keng-ppp.hybrid.com, reason: malformed header from script. Bad header=

>when I try to run this script:
>#!/bin/bash
>#
># search_library.cgi - searches files for matching keywords using
># ISINDEX.
>#
>echo "Content-type: text/html"
>echo " "

      ^^^

The end of your headers needs to be a blank line, not a line with
a blank.  Try this:

    echo "Content-type: text/html"
    echo
    # rest of stuff

Hope this helps.
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/

 
 
 

Malformed header from this script?

Post by Ken Gaugle » Sat, 29 Mar 1997 04:00:00


Apache give me the error message

access to /usr/lib/cgi-bin/search_library.cgi failed for
keng-ppp.hybrid.com, reason: malformed header from script. Bad header=

when I try to run this script:

#!/bin/bash
#
# search_library.cgi - searches files for matching keywords using
# ISINDEX.
#
echo "Content-type: text/html"
echo " "
#
# Check the number of cammand-line arguments by using '$#".
# If '$#' is zero, display the ISINDEX page.  If '$#' is
# greater than zero, process the keywords that have been passed
# to the program
#
if [ $# -eq 0 ]
then

        echo "<TITLE>Welcome to the Library</TITLE>"
        echo "<HEAD>"
        echo "<ISINDEX>"
        echo "</HEAD>"

        echo "<BODY>"
....... and so on.  If I run this script from the command line it
seems to generate reasonable output:

Content-type: text/html

<TITLE>Welcome to the Library</TITLE>
<HEAD>
<ISINDEX>
</HEAD>
<BODY>
<H1>Welcome to the Library</H1>
Enter search terms in the field above.
Separate multiple keywords with spaces
</BODY>

Can anyone suggest what I should check to figure out why this script
is misbehaving?

Thanks!


 
 
 

Malformed header from this script?

Post by Jon Bloo » Sat, 29 Mar 1997 04:00:00



> Apache give me the error message
[snip]
> echo "Content-type: text/html"
> echo " "

Change the line that reads:
echo " "
to read:
echo ""

Apache wants to see an *empty line* at the end of the headers.

Jon
--
Jon Bloom

 
 
 

1. Help: Apache: cgi script - malformed header from script

Trying to get simple cgi to work...

I've written a simple shell script to output some basic html, but when I run
it I get this error message in the error log:

  malformed header from script. Bad header=<HTML>

I've looked in the FAQ and it's helpful in the sense that it states:
"the server was expecting a complete set of HTTP headers (one or more followed
by a blank line), and didn't get them."

Unfortunately, I don't know what an http header is or looks like, and the
Apache documentation isn't helpful in this respect. My shell script simply
wrties to stdout:

<html>
<title> a title </title>
<body>
some text
</body>
</html>

Also...

I've added a "ScriptLog logs/cgi_log" entry to the httpd.conf file, but there's
no output there (yes I've restarted the server). I've even touched the file so
that it exists (with the same permissions as the other log files) but no joy.


crashes when I open this newsgroup.

Alistair.

2. 2.5.70bk - drivers/net/sk98lin/skge.c to pci style init

3. Server Error:malformed header from script..Apache

4. Open Source mailing list archive

5. malformed header from script?

6. Printing problems (yes, I FAQ'd!)

7. Malformed header in script - HELP

8. new Adaptec AAR-2400 IDE RAID drivers?

9. Malformed header from script??

10. Error: HTTPd: malformed header from script

11. malformed header from script...

12. malformed header from cgi

13. Malformed header