httpd
httpd
I might be having a related problem. The httpd documentation for Windows says "In the file 'httpd' line 140/41 should be changed." though it doesn't say to what. Line 140 is: "\r\n\r\n")) and line 141 is a blank line. I don't see any nearby code that might need changing.
httpd
Emacs has the line
(define (log-request request)
Don't see anything to change here.
The only code I can see a change to is line 127 that starts with a comment.
I changed this to Linux line for the Linux box because it was defaulted to Win32.
(define (log-request request)
Don't see anything to change here.
The only code I can see a change to is line 127 that starts with a comment.
I changed this to Linux line for the Linux box because it was defaulted to Win32.
httpd
its the line 159/160:
<pre>
(set 'procStr (append "./" fileName " > /tmp/pcgi" )) ;; for LINUX
(set 'procStr (append "newlisp ./" fileName " > /tmp/pcgi" )) ;; for Win32
</pre>
One of the lines should be commented out. The line numbers in the header have not been updated as they should. I will change that today on the file posted on ther site.
Lutz
<pre>
(set 'procStr (append "./" fileName " > /tmp/pcgi" )) ;; for LINUX
(set 'procStr (append "newlisp ./" fileName " > /tmp/pcgi" )) ;; for Win32
</pre>
One of the lines should be commented out. The line numbers in the header have not been updated as they should. I will change that today on the file posted on ther site.
Lutz
in Windows/XP (what I am running) it works on:
IE 6.0 (Mandelbrot sometimes doesn't work)
OPERA 6.0
MOZILLA 6.1
The cgi for the read-rocess.lsp example works, if you change "ls -l" to "dir" . The mandelbrot.lsp example works sometimes not on IE but alwyas on OPERA and MOZILLA.
I still have issues handling (save and evaluate in the IDe) files over a certain size, which is the reason I am now handling the POST method from editor-fram.html as enctype="multipart/form-data". Perhaps somebody with more HTML knowledge knows how to get this part working for all type sizes and browsers. This seems *not* to be an issue with the newLISP httpd, as I have the same issues running newlisp-IDE-1.6.tgz at my ISP with APACHE httpd and on BSD.
Lutz
IE 6.0 (Mandelbrot sometimes doesn't work)
OPERA 6.0
MOZILLA 6.1
The cgi for the read-rocess.lsp example works, if you change "ls -l" to "dir" . The mandelbrot.lsp example works sometimes not on IE but alwyas on OPERA and MOZILLA.
I still have issues handling (save and evaluate in the IDe) files over a certain size, which is the reason I am now handling the POST method from editor-fram.html as enctype="multipart/form-data". Perhaps somebody with more HTML knowledge knows how to get this part working for all type sizes and browsers. This seems *not* to be an issue with the newLISP httpd, as I have the same issues running newlisp-IDE-1.6.tgz at my ISP with APACHE httpd and on BSD.
Lutz
I've finally got it working on Windows!
I made a directory called "tmp" under the directory "test" that I was using as the root directory in the httpd call
newlisp httpd 80 /test
No avail!
Then I changed where output from the program is redirected from "/tmp/pcgi" to the file "pcgi" in the current directory. Works fine! for some reasong it can't find the directory "tmp?"
Eddie
I made a directory called "tmp" under the directory "test" that I was using as the root directory in the httpd call
newlisp httpd 80 /test
No avail!
Then I changed where output from the program is redirected from "/tmp/pcgi" to the file "pcgi" in the current directory. Works fine! for some reasong it can't find the directory "tmp?"
Eddie
I should have noticed the semicolons in the listing, Lutz. Sorry. Fortunately, the default is set correctly for Windows users like me.
But the problem remains: I get an "Error: 400 Cannot handle request" in the left frame when trying to use the IDE. The server itself is functional, it will serve the html in the editor frame, but there seems to be something wrong with the cgi in the file frame. I've set the Path environment variable in the control panel, and tried substituting the full path for the "." in the command line, but no luck. On my machine, the command is:
newlisp httpd 8080 \newlisp\ide\public_html
and I've created a tmp directory in public_html and in system root, "just in case".
But the problem remains: I get an "Error: 400 Cannot handle request" in the left frame when trying to use the IDE. The server itself is functional, it will serve the html in the editor frame, but there seems to be something wrong with the cgi in the file frame. I've set the Path environment variable in the control panel, and tried substituting the full path for the "." in the command line, but no luck. On my machine, the command is:
newlisp httpd 8080 \newlisp\ide\public_html
and I've created a tmp directory in public_html and in system root, "just in case".
in your case it seems to get stuck in '(process-http-request request)' . In the beginning of the httpd programs do:
(define debug-flag true)
Then you can observe what kind of request httpd receives. The error message you are receiving indicates, that for some reason it receives an invalid request type, not GET, POST or HEAD
Lutz
(define debug-flag true)
Then you can observe what kind of request httpd receives. The error message you are receiving indicates, that for some reason it receives an invalid request type, not GET, POST or HEAD
Lutz
The client requests three GETs:
GET / HTTP/1.1
GET /file-frame.cgi?name=data/ HTTP/1.1
GET /editor-frame-new.html HTTP/1.1
I confirmed this with a (print buff) in net-server-accept. The problem seems to be html-error 400 in execute-file rather than in process-http-request. I think I've tried all possible variations of c:\\temp\\pcgi but nothing seems to get written to disk, and buffer always comes up nil.
GET / HTTP/1.1
GET /file-frame.cgi?name=data/ HTTP/1.1
GET /editor-frame-new.html HTTP/1.1
I confirmed this with a (print buff) in net-server-accept. The problem seems to be html-error 400 in execute-file rather than in process-http-request. I think I've tried all possible variations of c:\\temp\\pcgi but nothing seems to get written to disk, and buffer always comes up nil.
I had a similar problem on the win2000 machine in the business office.
In
(define (execute-file fileName data)
Try changing
(set 'procStr (append "newlisp ." fileName "> /tmp/pcgi"))
to
(set 'procStr (append "newlisp " fileName " > pcgi"))
and change
(set 'buffer (read-file "/tmp/pcgi"))
to
(set 'buffer (read-file "pcgi"))
Eddie
In
(define (execute-file fileName data)
Try changing
(set 'procStr (append "newlisp ." fileName "> /tmp/pcgi"))
to
(set 'procStr (append "newlisp " fileName " > pcgi"))
and change
(set 'buffer (read-file "/tmp/pcgi"))
to
(set 'buffer (read-file "pcgi"))
Eddie
Thanks Eddie, but it still isn't working.
I understand that this part of the code creates a string, newlisp file-frame.cgi > c:\temp\pcgi (or whatever) to be used along with another string name=data/ as arguments for the next term write-process. The strings are created, but the pcgi file is not. This string of code will create a pcgi file when keyed from the command line, but will not create the file from inside the program.
I understand that this part of the code creates a string, newlisp file-frame.cgi > c:\temp\pcgi (or whatever) to be used along with another string name=data/ as arguments for the next term write-process. The strings are created, but the pcgi file is not. This string of code will create a pcgi file when keyed from the command line, but will not create the file from inside the program.
There shouldn't be a need to tweak the CGI generating statement. I would start over and do exactly what's recommended in the README file of the newlisp-IDE-1.6.tgz package. All problems I have seen, always boiled down to one of the following:
- no c:\tmp or /tmp directory present
- wrong permissions (on UNIX OS's)
- newlisp executable not in PATH
- make sure, that 'write-process' or 'exec' (the same thing) works on your OS installation; try (write-process "dir") or (exec "dir") from the command line of the newlisp executable (not from the tk-frontend)
The default in line 159/160 done for Win32 does also work on UNIX. If it still doesn't work, enable debugging with "(set 'debug-flag true)" and post the output on the board, so we can look at it.
Lutz
- no c:\tmp or /tmp directory present
- wrong permissions (on UNIX OS's)
- newlisp executable not in PATH
- make sure, that 'write-process' or 'exec' (the same thing) works on your OS installation; try (write-process "dir") or (exec "dir") from the command line of the newlisp executable (not from the tk-frontend)
The default in line 159/160 done for Win32 does also work on UNIX. If it still doesn't work, enable debugging with "(set 'debug-flag true)" and post the output on the board, so we can look at it.
Lutz
Ryon:
Are you using Windows 2000 or XP? If so, are you logged in as an Administrator or a User? This may be far fetched as I'm not that good with Windows stuff, but I think that you have to have rights set to write to some directories in those OSs. If you log in as Administrator you should be able to write to the c:\tmp directory.
Eddie
Are you using Windows 2000 or XP? If so, are you logged in as an Administrator or a User? This may be far fetched as I'm not that good with Windows stuff, but I think that you have to have rights set to write to some directories in those OSs. If you log in as Administrator you should be able to write to the c:\tmp directory.
Eddie
Lutz, I think your last suggestion exposes the problem:
- make sure, that 'write-process' or 'exec' (the same thing) works on your OS installation; try (write-process "dir") or (exec "dir") from the command line of the newlisp executable (not from the tk-frontend)
(write-process "dir") from the command line returns "String expected in function write-process". and (exec "dir") returns "Invalid function".
Your documentation shows that two arguments are required for the write-process function, so this may not be the best test of the function, but this is exactly where I had trouble as shown in my previous posting. There are two strings at that point in the httpd code, and they do produce results if typed in from the command line, but nothing when run in place in the program. The documentation for write-process is very terse, and I don't understand it. Hence my posting.
The DOS box is not cut and paste, so I hope there are no transposition errors in this debug listing:
newlisp httpd 8080 c:\newlisp\public_html
Server started listening on port: 8080
Root directory: c:\newlisp\public_html
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */*
Accept-Language: en-us
Accept_Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Host: localhost:8080
Connection: Keep-Alive
Thu Oct 10 12:08:44 2002 127.0.0.1 GET / HTTP/1.1
GET /file-frame.cgi?name=data/ HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */*
Referer: http://localhost:8080/
Accept-Language: en-us
Accept_Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Host: localhost:8080
Connection: Keep-Alive
Thu Oct 10 12:08:44 2002 127.0.0.1 GET /file-frame.cgi?name=data/ HTTP/1.1
newlisp .file-frame.cgi > tmp/pcgi
GET /editor-frame-new.html HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */*
Referer: http://localhost:8080/
Accept-Language: en-us
Accept_Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Host: localhost:8080
Connection: Keep-Alive
Thu Oct 10 12:08:44 2002 127.0.0.1 GET /editor-frame-new.html HTTP/1.1
- make sure, that 'write-process' or 'exec' (the same thing) works on your OS installation; try (write-process "dir") or (exec "dir") from the command line of the newlisp executable (not from the tk-frontend)
(write-process "dir") from the command line returns "String expected in function write-process". and (exec "dir") returns "Invalid function".
Your documentation shows that two arguments are required for the write-process function, so this may not be the best test of the function, but this is exactly where I had trouble as shown in my previous posting. There are two strings at that point in the httpd code, and they do produce results if typed in from the command line, but nothing when run in place in the program. The documentation for write-process is very terse, and I don't understand it. Hence my posting.
The DOS box is not cut and paste, so I hope there are no transposition errors in this debug listing:
newlisp httpd 8080 c:\newlisp\public_html
Server started listening on port: 8080
Root directory: c:\newlisp\public_html
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */*
Accept-Language: en-us
Accept_Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Host: localhost:8080
Connection: Keep-Alive
Thu Oct 10 12:08:44 2002 127.0.0.1 GET / HTTP/1.1
GET /file-frame.cgi?name=data/ HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */*
Referer: http://localhost:8080/
Accept-Language: en-us
Accept_Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Host: localhost:8080
Connection: Keep-Alive
Thu Oct 10 12:08:44 2002 127.0.0.1 GET /file-frame.cgi?name=data/ HTTP/1.1
newlisp .file-frame.cgi > tmp/pcgi
GET /editor-frame-new.html HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */*
Referer: http://localhost:8080/
Accept-Language: en-us
Accept_Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Host: localhost:8080
Connection: Keep-Alive
Thu Oct 10 12:08:44 2002 127.0.0.1 GET /editor-frame-new.html HTTP/1.1
since version 6.5.18 'write-process' and 'read-process' are collapsed in to 'exec', all three functions point to the same function, which works like the old 'read-process' when given one parameter and which works like 'write-process' when given two parameters.
try everything again using a newer version (the last official newLISP is 6.5.23) and use together with newlisp-IDE-1.6.tgz.
Put 'debug-flag' mode back into nil:
(set 'debug-flag nil)
But change in line 162
(if debug-flag (println proc-str))
to:
(println proc-str " " data)
On my WinXP machine I see the following:
Wed Oct 09 15:33:08 2002 127.0.0.1 GET / HTTP/1.1
Wed Oct 09 15:33:08 2002 127.0.0.1 GET /file-frame.cgi?name=data/ HTTP/1.1
newlisp ./file-frame.cgi > /tmp/pcgi name=data/
The last line is the contents of 'proc-str' and 'data'. What happens here is the following: the program 'newlisp' will be executed taking the file: 'file-frame.cgi' as the program file, the string 'name=data/' is the query string which is used as STDIN from the 'read-line' statement inside the program in file-frame.cgi. The output of the whole process is written to the file '/tmp/pcgi' where it is picked up later and send back by the hhtpd webserver to the remote browser.
Hope this was not to confusing :-)
Lutz
try everything again using a newer version (the last official newLISP is 6.5.23) and use together with newlisp-IDE-1.6.tgz.
Put 'debug-flag' mode back into nil:
(set 'debug-flag nil)
But change in line 162
(if debug-flag (println proc-str))
to:
(println proc-str " " data)
On my WinXP machine I see the following:
Wed Oct 09 15:33:08 2002 127.0.0.1 GET / HTTP/1.1
Wed Oct 09 15:33:08 2002 127.0.0.1 GET /file-frame.cgi?name=data/ HTTP/1.1
newlisp ./file-frame.cgi > /tmp/pcgi name=data/
The last line is the contents of 'proc-str' and 'data'. What happens here is the following: the program 'newlisp' will be executed taking the file: 'file-frame.cgi' as the program file, the string 'name=data/' is the query string which is used as STDIN from the 'read-line' statement inside the program in file-frame.cgi. The output of the whole process is written to the file '/tmp/pcgi' where it is picked up later and send back by the hhtpd webserver to the remote browser.
Hope this was not to confusing :-)
Lutz
We all knew I was doing something wrong, but what? Well, it turns out I had the 6.5.8 version of newLISP installed. I did an "upgrade" recently, and must have installed this older version instead of the newly-downloaded one. I am embarrassed and sorry for the trouble this has caused!!! The IDE works just fine now.
httpd
I am glad you found the problem Ryon.
Lutz
Lutz