httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Christensen" <dpchr...@holgerdanske.com>
Subject Re: [users@httpd] Debian 3.0r1 Apache 1.3.26 cgi-bin behavior depends on script name and browser (?)
Date Wed, 01 Oct 2003 04:31:15 GMT
users@httpd.apache.org:

Brian Dessent wrote:
> You need to use \r\n for line endings in the HTTP headers, not \n.

Thanks for the reply.  :-)


I already tried newline expansion -- no effect.  I get the same wrong
behavior whether I use my original version of the script:

    dpchrist@d3020g:~/public_html/cgi-bin$ cat intro3.pl
    #!/usr/bin/perl -w
    use strict;

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

    print <<END;
    <html>
    <head><title>My Page Title</title></head>
    <body><p>My page body</p></body>
    </html>
    END
    exit(0);

    dpchrist@d3020g:~/public_html/cgi-bin$ perl intro3.pl
    Content-Type: text/html

    <html>
    <head><title>My Page Title</title></head>
    <body><p>My page body</p></body>
    </html>

Or Paul DuBois' version of the script:

    dpchrist@d3020g:~/public_html/cgi-bin$ mv intro3a.pl intro3.pl
    mv: overwrite `intro3.pl'? y

    dpchrist@d3020g:~/public_html/cgi-bin$ cat intro3.pl
    #! /usr/bin/perl
    # intro3.pl - script to generate a Web page
    print "Content-Type: text/html\n\n";
    print <<END;
    <html>
    <head><title>My Page Title</title></head>
    <body><p>My page body</p></body>
    </html>
    END
    exit (0);

    dpchrist@d3020g:~/public_html/cgi-bin$ perl intro3.pl
    Content-Type: text/html

    <html>
    <head><title>My Page Title</title></head>
    <body><p>My page body</p></body>
    </html>

Or Paul DuBois' version with newline expansion:

    dpchrist@d3020g:~/public_html/cgi-bin$ cp intro3b.pl intro3.pl
    cp: overwrite `intro3.pl'? y

    dpchrist@d3020g:~/public_html/cgi-bin$ cat intro3.pl
    #! /usr/bin/perl
    # intro3.pl - script to generate a Web page
    print "Content-Type: text/html\r\n\r\n";
    print <<END;
    <html>
    <head><title>My Page Title</title></head>
    <body><p>My page body</p></body>
    </html>
    END
    exit (0);

    dpchrist@d3020g:~/public_html/cgi-bin$ perl intro3.pl
    Content-Type: text/html

    <html>
    <head><title>My Page Title</title></head>
    <body><p>My page body</p></body>
    </html>

Or even "Hello, world!" using CGI.pm:

    dpchrist@d3020g:~/public_html/cgi-bin$ cp intro3d.pl intro3.pl
    cp: overwrite `intro3.pl'? y

    dpchrist@d3020g:~/public_html/cgi-bin$ cat intro3.pl
    #!/usr/bin/perl -w
    use strict;

    use CGI;
    my $cgi = new CGI;

    print $cgi->header(),
        $cgi->start_html("My Page Title"),
        $cgi->p("Hello, World!"),
        $cgi->end_html(),
        "\n";

    exit(0);

    dpchrist@d3020g:~/public_html/cgi-bin$ perl intro3.pl
    Content-Type: text/html; charset=ISO-8859-1

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html
            PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
            "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"><head><title
>My Page Title</title>
    </head><body><p>Hello, World!</p></body></html>


As I stated before:

    >> The behavior seems to depend on the script name, not the content.


The problem is the name "intro3.pl".  (And also "intro7.pl", and
probably others that will only occur during a customer demonstration ;-)


> This is exactly the sort of reason why you should always use CGI.pm
> and not try to handle HTTP headers, forms, encoding, etc. with code
> that your write.  It's almost guaranteed that there is always some
> minor thing that will break "home brewed" scripts that is handled
> properly by CGI.pm.

I agree that CGI.pm is safer than trying to generate valid HTML code
using only print(), but the issue at hand is that Mozilla and/or Apache
are trying to download a CGI script named "intro3.pl" rather than doing
what they're supposed to do (Apache executing the script and Mozilla
displaying the output).


If a CGI script outputs rotten content, then Apache should complain,
Mozilla should complain, or the displayed content might be malformed.


I tried killing the server with apachectl and running Apache from the
console with -X and some other options, but I don't know what to look
for in the output (see below).


Any ideas for tracking down where the error is (Apache vs. Mozilla)?


TIA,


David
--
root@d3020g:~# apachectl stop
/usr/sbin/apachectl stop: httpd stopped

root@d3020g:~# apache -X
[Tue Sep 30 21:16:52 2003] [warn] module config_log_module is already
loaded, skipping
[Tue Sep 30 21:16:52 2003] [warn] module mime_module is already loaded,
skipping

[Tue Sep 30 21:16:52 2003] [alert] apache: Could not determine the
server's fully qualified domain name, using 192.168.254.2 for ServerName

root@d3020g:~# apache -X -S
[Tue Sep 30 21:17:53 2003] [warn] module config_log_module is already
loaded, skipping
[Tue Sep 30 21:17:53 2003] [warn] module mime_module is already loaded,
skipping

[Tue Sep 30 21:17:53 2003] [alert] apache: Could not determine the
server's fully qualified domain name, using 192.168.254.2 for ServerName
VirtualHost configuration:

root@d3020g:~# apache -X -L
<Directory (http_core.c)
        Container for directives affecting resources located in the
specified directories
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
</Directory> (http_core.c)
        Marks end of <Directory>
        Allowed in *.conf only inside <Directory>, <Files> or <Location>
<Location (http_core.c)
        Container for directives affecting resources accessed through
the specified URL paths
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
</Location> (http_core.c)
        Marks end of <Location>
        Allowed in *.conf only inside <Directory>, <Files> or <Location>
<VirtualHost (http_core.c)
        Container to map directives to a particular virtual host, takes
one or more host addresses
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
</VirtualHost> (http_core.c)
        Marks end of <VirtualHost>
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
<Files (http_core.c)
        Container for directives affecting files matching specified
patterns
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
</Files> (http_core.c)
        Marks end of <Files>
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
<Limit (http_core.c)
        Container for authentication directives when accessed using
specified HTTP methods
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
</Limit> (http_core.c)
        Marks end of <Limit>
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
<LimitExcept (http_core.c)
        Container for authentication directives to be applied when any
HTTP method other than those specified is used to access the resource
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
</LimitExcept> (http_core.c)
        Marks end of <LimitExcept>
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
<IfModule (http_core.c)
        Container for directives based on existance of specified modules
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
</IfModule> (http_core.c)
        Marks end of <IfModule>
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
<IfDefine (http_core.c)
        Container for directives based on existance of command line
defines
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
</IfDefine> (http_core.c)
        Marks end of <IfDefine>
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
<DirectoryMatch (http_core.c)
        Container for directives affecting resources located in the
specified directories
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
</DirectoryMatch> (http_core.c)
        Marks end of <DirectoryMatch>
        Allowed in *.conf only inside <Directory>, <Files> or <Location>
<LocationMatch (http_core.c)
        Container for directives affecting resources accessed through
the specified URL paths
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
</LocationMatch> (http_core.c)
        Marks end of <LocationMatch>
        Allowed in *.conf only inside <Directory>, <Files> or <Location>
<FilesMatch (http_core.c)
        Container for directives affecting files matching specified
patterns
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
</FilesMatch> (http_core.c)
        Marks end of <FilesMatch>
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
AuthType (http_core.c)
        An HTTP authorization type (e.g., "Basic")
        Allowed in *.conf only inside <Directory>, <Files> or <Location>
and in .htaccess
        when AllowOverride includes AuthConfig
AuthName (http_core.c)
        The authentication realm (e.g. "Members Only")
        Allowed in *.conf only inside <Directory>, <Files> or <Location>
and in .htaccess
        when AllowOverride includes AuthConfig
Require (http_core.c)
        Selects which authenticated users or groups may access a
protected space

        Allowed in *.conf only inside <Directory>, <Files> or <Location>
and in .htaccess
        when AllowOverride includes AuthConfig
Satisfy (http_core.c)
        access policy if both allow and require used ('all' or 'any')
        Allowed in *.conf only inside <Directory>, <Files> or <Location>
and in .htaccess
        when AllowOverride includes AuthConfig
AddDefaultCharset (http_core.c)
        The name of the default charset to add to any Content-Type
without one or 'Off' to disable
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride includes FileInfo
AccessFileName (http_core.c)
        Name(s) of per-directory config files (default: .htaccess)
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
DocumentRoot (http_core.c)
        Root directory of the document tree
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ErrorDocument (http_core.c)
        Change responses for HTTP errors
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride includes FileInfo
AllowOverride (http_core.c)
        Controls what groups of directives can be configured by
per-directory config files
        Allowed in *.conf only inside <Directory>, <Files> or <Location>
Options (http_core.c)
        Set a number of attributes for a given directory
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride includes Options
DefaultType (http_core.c)
        the default MIME type for untypable files
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride includes FileInfo
ServerType (http_core.c)
        'inetd' or 'standalone'
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
Port (http_core.c)
        A TCP port number
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
HostnameLookups (http_core.c)
        "on" to enable, "off" to disable reverse DNS lookups, or
"double" to enable double-reverse DNS lookups
        Allowed in *.conf anywhere
User (http_core.c)
        Effective user id for this server
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
Group (http_core.c)
        Effective group id for this server
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ServerAdmin (http_core.c)
        The email address of the server administrator
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ServerName (http_core.c)
        The hostname of the server
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ServerSignature (http_core.c)
        En-/disable server signature (on|off|email)
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
ServerRoot (http_core.c)
        Common directory of server-related files (logs, confs, etc.)
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ErrorLog (http_core.c)
        The filename of the error log
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
PidFile (http_core.c)
        A file for logging the server process ID
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ScoreBoardFile (http_core.c)
        A file for Apache to maintain runtime process management
information
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
LockFile (http_core.c)
        The lockfile used when Apache needs to lock the accept() call
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
AccessConfig (http_core.c)
        The filename of the access config file
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ResourceConfig (http_core.c)
        The filename of the resource config file
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ServerAlias (http_core.c)
        A name or names alternately used to access the server
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ServerPath (http_core.c)
        The pathname the server can be reached at
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
Timeout (http_core.c)
        Timeout duration (sec)
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
KeepAliveTimeout (http_core.c)
        Keep-Alive timeout duration (sec)
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
MaxKeepAliveRequests (http_core.c)
        Maximum number of Keep-Alive requests per connection, or 0 for
infinite
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
KeepAlive (http_core.c)
        Whether persistent connections should be On or Off
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
IdentityCheck (http_core.c)
        Enable identd (RFC 1413) user lookups - SLOW
        Allowed in *.conf anywhere
ContentDigest (http_core.c)
        whether or not to send a Content-MD5 header with each request
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride includes Options
UseCanonicalName (http_core.c)
        How to work out the ServerName : Port when constructing URLs
        Allowed in *.conf anywhere
StartServers (http_core.c)
        Number of child processes launched at server startup
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
MinSpareServers (http_core.c)
        Minimum number of idle children, to handle request spikes
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
MaxSpareServers (http_core.c)
        Maximum number of idle children
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
MaxServers (http_core.c)
        Deprecated equivalent to MaxSpareServers
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ServersSafetyLimit (http_core.c)
        Deprecated equivalent to MaxClients
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
MaxClients (http_core.c)
        Maximum number of children alive at the same time
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
MaxRequestsPerChild (http_core.c)
        Maximum number of requests a particular child serves before
dying.
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
RLimitCPU (http_core.c)
        Soft/hard limits for max CPU usage in seconds
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
RLimitMEM (http_core.c)
        Soft/hard limits for max memory usage per process
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
RLimitNPROC (http_core.c)
        soft/hard limits for max number of processes per uid
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
BindAddress (http_core.c)
        '*', a numeric IP address, or the name of a host with a unique
IP address
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
Listen (http_core.c)
        A port number or a numeric IP address and a port number
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
SendBufferSize (http_core.c)
        Send buffer size in bytes
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
AddModule (http_core.c)
        The name of a module
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ClearModuleList (http_core.c)
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ThreadsPerChild (http_core.c)
        Number of threads a child creates
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ExcessRequestsPerChild (http_core.c)
        Maximum number of requests a particular child serves after it is
ready to die.
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
ListenBacklog (http_core.c)
        Maximum length of the queue of pending connections, as used by
listen(2)

        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
AcceptFilter (http_core.c)
        Switch AcceptFiltering on/off (default is on).This feature is
currently not compiled in; so this directive is ignored.
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
CoreDumpDirectory (http_core.c)
        The location of the directory Apache changes to before dumping
core
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
Include (http_core.c)
        Name of the config file to be included
        Allowed in *.conf anywhere
LogLevel (http_core.c)
        Level of verbosity in error logging
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
NameVirtualHost (http_core.c)
        A numeric IP address:port, or the name of a host
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
CGICommandArgs (http_core.c)
        Allow or Disallow CGI requests to pass args on the command line
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride includes Options
ServerTokens (http_core.c)
        Tokens displayed in the Server: header - Min[imal], OS,
Prod[uctOnly], Full
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
LimitRequestLine (http_core.c)
        Limit on maximum size of an HTTP request line
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
LimitRequestFieldsize (http_core.c)
        Limit on maximum size of an HTTP request header field
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
LimitRequestFields (http_core.c)
        Limit (0 = unlimited) on max number of header fields in a
request message
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
LimitRequestBody (http_core.c)
        Limit (in bytes) on maximum size of request message body
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride isn't None
ShmemUIDisUser (http_core.c)
        Enable the setting of SysV shared memory scoreboard uid/gid to
User/Group
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
AcceptMutex (http_core.c)
        Serialized Accept Mutex; the methods 'sysvsem' 'fcntl' are
compiled in
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
FileETag (http_core.c)
        Specify components used to construct a file's ETag
        Allowed in *.conf anywhere and in .htaccess
        when AllowOverride includes FileInfo
LoadModule (mod_so.c)
        a module name and the name of a shared object file to load it
from
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
LoadFile (mod_so.c)
        shared object file or library to load into the server at runtime
        Allowed in *.conf only outside <Directory>, <Files> or
<Location>
<Macro (mod_macro.c)
        Beginning of a macro definition section.
        Allowed in *.conf anywhere [no per-dir config] and in .htaccess
        when AllowOverride isn't None
</Macro> (mod_macro.c)
        End of a macro definition section.
        Allowed in *.conf anywhere [no per-dir config] and in .htaccess
        when AllowOverride isn't None
Use (mod_macro.c)
        Use of a macro.
        Allowed in *.conf anywhere [no per-dir config] and in .htaccess
        when AllowOverride isn't None
Error (mod_macro.c)
        Error in a configuration file.
        Allowed in *.conf anywhere [no per-dir config] and in .htaccess
        when AllowOverride isn't None
Warning (mod_macro.c)
        Warning in a configuration file.
        Allowed in *.conf anywhere [no per-dir config] and in .htaccess
        when AllowOverride isn't None


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message