[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] I'll give you eggnog for any help. :)



Matthew,

There are some problems with your HTTP header. This might or might not
be the problem.

It's not complete enough to be a complete header. You send complete HTTP
headers with scripts that have names that begin with 'nph-' as in
'nph-count.pl'. If your CGI program begins with 'nph-', you should send
(at least) the minimum components of a complete header:

HTTP/1.0 200 OK
Server: NSCA/1.4.2
Content-type: text/html

Another nit: The header needs to be correct. (Your server might be using
HTTP/1.1, in which case, your header is wrong.) The following code
generates more portable content (but doesn't work on the Mac, I think. .
. I don't use scripts that request non-parsed headers in my Mac CGI programs):

#!perl
$crlf = "\x0D\x0A";
print "$ENV('SERVER_PROTOCOL') 200 OK$crlf";
print "Server: $ENV('SERVER_SOFTWARE')$crlf";
print "Content-type: text/html$crlf$crlf";

Note that I use "\x0D\x0A" instead of "\n" in order to conform to the
HTTP specifications (RFC1945 HTTP 1.0, RFC2068 HTTP 1.1).

It contains too much information to be a standard header. If your
script's name does not begin with 'nph-', then your sending the
'HTTP/1.0 200 OK' line duplicates a similar line the server is also
sending. Your browser might be getting confused. Try removing the first
header line and see if that helps.

Also, the W3C has asked Web developers to add an additional line after
the Content-type line: Content-language. I would replace your code that
generates the HTTP header with this:

print "Content-type: text/html\x0D\x0A";
print "Content-language: en-us\x0D\x0A\x0D\x0A";

Robert

Matthew Phillips wrote:
> Is there any logic problems with this code? there are no syntax problems.
> I am trying to append to a file name-value pairs. It works on my iMac
> WebStar configuration but not at work (NT Server IIS/Apache).
> 
> #code
> use CGI;
> 
> print "HTTP/1.0 200 OK\n";
> print "Content-type: text/html\n\n";
> 
> # Reading
> open(IN, "test.out") or die "Can't open: $!";
> $cgi = new CGI(IN);
> # Writing
> $cgi = new CGI;
> open(OUT, ">>test.out") or die "Can't open: $!";
> $cgi->save(OUT);
> close OUT;
> 
> matt
> www.psychosphere.net



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch