Dear Ben,
i have still not managed to reproduce an error. I have extended
the hello-world.cgi script to include an image (see below) and tested
this from the main www folder (R1) and from a mapped cgi-bin
folder (R2) with a configuration without "allowstaticresources" set (C1)
and once with this parameter set (C2).
The results:
- The main request of the script returns always the expected HTML
code with the HTML content type
- The image is shown in most cases
R1+C1: yes
R1+C2: yes
R2+C1: no
R2+C2: yes
- When the image requests returns success (200), the image mime type
is correctly set. When the image request fails, a 404 error with the
error page is returned
All this is with NaviServer 4.99.18 on macOS.
Do you get on your platform different results for these tests?
-g
REQUEST R1: http://localhost:8100/hello-world.cgi
REQUEST R2: http://localhost:8100/cgi-bin/hello-world.cgi
CONFIG C1:
ns_section "ns/server/${server}/module/nscgi" {
ns_param map "GET /*.cgi"
ns_param map "GET /cgi-bin /usr/local/cgi-bin"
ns_param map "GET /awstats /opt/local/libexec/w3m/cgi-bin"
ns_param Interps cgi
}
CONFIG C2
ns_section "ns/server/${server}/module/nscgi" {
ns_param map "GET /*.cgi"
ns_param map "GET /cgi-bin /usr/local/cgi-bin"
ns_param map "GET /awstats /opt/local/libexec/w3m/cgi-bin"
ns_param Interps cgi
ns_param allowstaticresources true
}
====== SCRIPT hello.cgi ======================================
puts "HTTP/1.0 200 OK
Date: Monday, 06-Nov-95 17:50:15 GMT
Content-Type: text/html
<html>
<body>
Hello World <img src='DotLrnLogo.gif'>
</body>
"
==============================================================
On 01.03.19 14:04, Ben Brink via naviserver-devel wrote:
Hi Gustaf,
Thank you for the example and the info in thread:
https://openacs.org/forums/message-view?message_id=4268249#msg_4268538
Your test case works so I'll debug the legacy scripts.
Still, static files are returned without a content-type value, and
without content.
The ns_param allowstaticresources does not change this, whether
omitted, or set to true or false. For example, if allowstaticresources
is true, and content/file is:
test6.txt
==================================================================
Hello World
==================================================================
or any *.gif or *.png file.
Static content is returned as expected when not in cgi-bin.
The legacy perl cgi scripts I'm testing produce the same results ie no
content and no content type, which is why I decided to test static files.
For static content, the log shows errors like:
Debug(cgi): nscgi: interp '(null)' exec '/usr/local/cgi-bin/test6.txt'
Error: exec /usr/local/cgi-bin/test4.txt: execve() failed: Unknown
error 1275110264
Debug(cgi): nscgi: execute cgi script in directory
'/usr/local/cgi-bin' returned pid -3
Error: waitpid(-3) failed: No child processes
Error: nscgi: wait for /usr/local/cgi-bin/test4.txt failed: No child
processes
..when debug logging is invoked nscgi in section of config.tcl using:
ns_logctl severity Debug(pl) on
ns_logctl severity Debug(cgi) on
cheers,
Ben
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel