malformed header from script?

malformed header from script?

Post by Blake Swens » Fri, 02 Aug 1996 04:00:00



I created a perl script, but no matter what I do, I still get the error from
the http server:
        access to /usr/local/www/cgi-bin/read-data.pl failed
        for dark_star.pbgi.com, reason: malformed header from script

In the process of debugging I eliminated all lines of the script so that the
ENTIRE code looks like:
        #!/usr/bin/perl
        exit;

Yes.. I have tried it with
        print "Content-type: text/html\n";

Still the same error.  What's up with that? The script has 100766 permissions
and the uid has read/execute permissions... this is identical to other
working scripts in the cgi-bin directory.

What is the black magic needed?

(perl 5, FreeBSD 2.01, Apache)

Peace,
Blake

 
 
 

malformed header from script?

Post by Tina Marie Holmb » Fri, 02 Aug 1996 04:00:00



Quote:> Yes.. I have tried it with
>    print "Content-type: text/html\n";
> What is the black magic needed?

  \n

  *silence* Well, *ok* :) - try:

  print "Content-type: text/html\n\n" ;
                                  ^^

  and see if that might not just help a wee bit.

--

<                                                                           >
< " Once the rockets are up, who cares where they come down?                >
<  That's not my department," says Wernher von Braun. " - Lehrer            >

 
 
 

malformed header from script?

Post by Igor Cun » Sat, 03 Aug 1996 04:00:00



>I created a perl script, but no matter what I do, I still get the error from
>the http server:
>    access to /usr/local/www/cgi-bin/read-data.pl failed
>    for dark_star.pbgi.com, reason: malformed header from script
>In the process of debugging I eliminated all lines of the script so that the
>ENTIRE code looks like:
>    #!/usr/bin/perl
>    exit;
>Yes.. I have tried it with
>    print "Content-type: text/html\n";
>Still the same error.  What's up with that? The script has 100766 permissions
>and the uid has read/execute permissions... this is identical to other
>working scripts in the cgi-bin directory.
>What is the black magic needed?
>(perl 5, FreeBSD 2.01, Apache)
>Peace,
>Blake

You do send a blank line to indicate end of header?
 _________________________________________________

|      (o o)      Zagreb CROATIA                  |
|___oo0_(_)_0oo__ will code for food _____________|
 
 
 

malformed header from script?

Post by Richard Tro » Sat, 03 Aug 1996 04:00:00



>I created a perl script, but no matter what I do, I still get the error from
>the http server:
>    access to /usr/local/www/cgi-bin/read-data.pl failed
>    for dark_star.pbgi.com, reason: malformed header from script
>In the process of debugging I eliminated all lines of the script so that the
>ENTIRE code looks like:
>    #!/usr/bin/perl
>    exit;
>Yes.. I have tried it with
>    print "Content-type: text/html\n";
>Still the same error.  What's up with that? The script has 100766 permissions
>and the uid has read/execute permissions... this is identical to other
>working scripts in the cgi-bin directory.
>What is the black magic needed?
>(perl 5, FreeBSD 2.01, Apache)
>Peace,
>Blake

Try:
        print "Content-type: text/html\n\n";

instead of:

        print "Content-type: text/html\n";

HTTP requires a blank line between the end of your headers and the actual
document.  Therefore a single \n does not signal the end of your headers.
Two \n's will.

--
Richard Trott

 
 
 

malformed header from script?

Post by Ken Overto » Sat, 10 Aug 1996 04:00:00


I wonder if anyone else does this in Unix -- I have a number of the CGI
environmental variables set in my shell environment in my login file
(since I use tcsh that's actually .cshrc).  When I want to debug scripts
I just grab the query_string from the form submission, write it to a
file and get the content-length for that query_string.  Then I set the
CONTENT_LENGTH variable in my shell and I can start running the script
at the command line, piping in the query_string from the file I saved.

Does anyone else do this too?  I find it incredibly helpful when I want
to step through or run it interactively.

- kov

--

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


 
 
 

malformed header from script?

Post by Steff Watki » Tue, 13 Aug 1996 04:00:00


: I wonder if anyone else does this in Unix -- I have a number of the CGI
: environmental variables set in my shell environment in my login file
: (since I use tcsh that's actually .cshrc).  When I want to debug scripts
: I just grab the query_string from the form submission, write it to a
: file and get the content-length for that query_string.  Then I set the
: CONTENT_LENGTH variable in my shell and I can start running the script
: at the command line, piping in the query_string from the file I saved.
:
: Does anyone else do this too?  I find it incredibly helpful when I want
: to step through or run it interactively.

Hello Kevin,

 yeah,I do that too.

Another hint for you is to assume (using 'su') the userid that the
webserver runs as (the spawned child process.. the userid set in your
httpd.conf file!).

This will help you find such things as file access permission problems as
well..

Steff

 
 
 

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. FVWM2 compiled?

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

4. 440BX chipset mboards PII 266 mhz underlinux

5. Malformed header in script - HELP

6. WordPerfect -> troff?

7. Malformed header from script??

8. Shiva access connection

9. Error: HTTPd: malformed header from script

10. malformed header from script...

11. Malformed header from this script?

12. malformed header from cgi

13. Malformed header