Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Problem with Apache and CGI returning text/plain

From: rebol665::ifrance::com at: 9-May-2002 15:33

Hi rebollers, I am having problem with the following script. 8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #!d:/rebview/rebol.exe --cgi REBOL [] print "content-type : text/plain^/^/" print "Hello CGI-World!! (text)" 8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The script is short but my problem is a bit longer to explain. This script is installed on a windows 98 machine where both Apache and Personal Web Server (PWS) are installed (only one server is active at a time). The script is called with the following URL from another windows 98 machine: http://192.168.1.51/cgi-bin/cgi-hw-txt.r The problem is : - If Apache is running, I am asked to download the file cgi-hw-txt.r. - If PWS is running, all is correct and I am getting the display of "Hello CGI-World!!!(text)" I have investigated a lot ! These are some fact I have gathered : - If I change text/plain for text/html, and if I delete the space in content-type ( "content-type : text/plain" -> "content-type: text/html") then I am getting a response with Apache. - Apache ACCESS.LOG gives me the following trace in both cases : 192.168.1.52 - - [09/May/2002:11:07:34 +0200] "GET /cgi-bin/cgi-hw-txt.r HTTP/1.1" 200 38 As I understand it, the request is OK (200) and returns 38 bytes. - I have made the following function to test the server from the rebol console: cgi-test: does [ pt: open tcp://192.168.1.51:80 insert pt "GET /cgi-bin/cgi-hw-txt.r HTTP/1.0^/^/" print copy pt close pt ] Here are some results : With "content-type : text/plain", download in IE
>> cgi-test
HTTP/1.1 200 OK Date: Thu, 09 May 2002 13:07:15 GMT Server: Apache/1.3.24 (Win32) content-type : text/plain Connection: close Content-Type: text/plain Hello CGI-World!! (text)
>>
With "content-type: text/plain", download in IE
>> cgi-test
HTTP/1.1 200 OK Date: Thu, 09 May 2002 13:09:06 GMT Server: Apache/1.3.24 (Win32) Connection: close Content-Type: text/plain Hello CGI-World!! (text)
>>
With "content-type: text/html", works in IE
>> cgi-test
HTTP/1.1 200 OK Date: Thu, 09 May 2002 13:09:59 GMT Server: Apache/1.3.24 (Win32) Connection: close Content-Type: text/html Hello CGI-World!! (text)
>>
With "content-type : text/html", download in IE
>> cgi-test
HTTP/1.1 200 OK Date: Thu, 09 May 2002 13:11:21 GMT Server: Apache/1.3.24 (Win32) content-type : text/html Connection: close Content-Type: text/plain Hello CGI-World!! (text)
>>
The conclusion here is that the space after "content-type" seems to be very important. With Apache text/plain text/html space after BAD BAD no space BAD OK The same test performed with PWS gives a very different picture. With PWS text/plain text/html space after OK OK no space BAD OK So if I want a script that runs with both PWS and Apache, I must choose text/html and no space after "content-type". However I am still at a loss regarding Apache and text/plain. Has anyone a brilliant idea ? Patrick