From: Krause F. <Fel...@de...> - 2013-07-24 06:09:24
|
> Something like that should work - but you should remove the line that prints > "HTTP/1.1 200 OK". This isn't necessary in any Webmin CGI script, as the > webserver adds that line. The "500 Bad Header" error happens if your script's > output doesn't start with valid HTTP headers. I changed it to: my $CRFL = "\x0d\x0a"; my $client = HTTP::Client->new(); my $content = $client->get("http://127.0.0.1:8888/io"); print "Date: " + time2str(localtime) + $CRLF; print "Content-Type: text/json; Charset=iso-8859-1$CRLF"; print "Content-Length: " + length($content); print "$CRLF$CRLF$content"; I get the same 500 error. Afaik these are the only required headers for a http response. Do I need to add others to make it work? Is there a log where Webmin tells me what it doesn't like about my headers? (The action log is empty.) I would look what a normal index.cgi outputs, but I cannot execute it directly from the command line (it says that WEBMIN_CONFIG is not set). Regards, Felix |