I need to use Scheme or Common Lisp for writing CGI scripts to process the XSL/XML protocols of a law firm. I started with Stalin, since it is easier to compile. The resulting exec files work perfectly well, and have small foot prints. However, the Stalin community does not seem to be very active. Besides this, Stalin is very slow to compile, and does not provide an interpreter. Therefore, I decided to switch to Gambit, Bigloo or SBCL. Gambit has the advantage of providing native infix notation. However, it is not working in most commercial servers that the law firm uses. I am using the following command line to create the exec files: $ ./gsc -exe gambtest.scm Where gambtest.scm contains the following lines: (display "Content-type: text/html")(newline)(newline)(display "<html> <body> <h1>Hello from Gambit</h1> </body></html>" )(newline) It generates an executable file that works perfectly well in my machine, but not in the servers that host the pages of the law firm. $ ./gambtest Content-type: text/html <html> <body> <h1>Hello from Gambit</h1> </body></html> For reasons that I cannot fathom, the law firm uses many hosting providers. I also tried to use Gambit as a scripting language. The result is the same. In the case of Bigloo, the problem lies in the fact that it uses dynamic libraries incompatible with the server. I cannot understand why this happens, since Stalin works even when linked to dynamic libraries. By the way, I prefer the scripting solution, since the static exec files are very large. I installed gambit in the hosting provider, making sure that both gsi and gsi-script have permission to execute. I also tested the scripts with Dorai Sitaram's Scheme in Common Lisp to make sure that everything is working fine. Here is the script (that works in my machine): #! ./gsi-script -:d- (display "Content-type: text/html")(newline)(newline)(display "<html> <body> <h1>Hello from Gambit</h1> </body></html>" )(newline)
Here is the message that I get from Hostgator both for the scripting version and the compiled version: Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, webmaster@advogadosmg.org and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log.Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 mod_fcgid/2.3.6 FrontPage/5.0.2.2635 mod_bwlimited/1.4 mod_auth_passthrough/2.1 Server at advogadosmg.org Port 80
Afficher les réponses par date
On 2011-12-13, at 2:16 PM, Eduardo Costa wrote:
#! ./gsi-script -:d-
(display "Content-type: text/html") (newline) (newline) (display "<html>
<body> <h1>Hello from Gambit</h1> </body> </html>" ) (newline)
Here is the message that I get from Hostgator both for the scripting version and the compiled version:
It is very probable that the current-directory that is in effect when the CGI script is executed is **not** the one that contains the gsi-script executable.
Please:
1) figure out where the gsi-script executable is on the **server** machine (for example, /usr/bin/gsi-script)
2) put the complete path of the gsi-script executable in the first line of your script, i.e.
#! /usr/bin/gsi-script -:d- ...
An alternative that might work on the server is to use
#! /usr/bin/env gsi-script -:d-
This assumes that the PATH is properly setup on the server.
Marc
2011/12/13 Eduardo Costa edu500ac@yahoo.com
Therefore, I decided to switch to Gambit, Bigloo or SBCL.
Maybe you should consider also Chicken: www.call-cc.org. Chicken has many modules. Some are buggy but most work right out of the box. Last week I had to write a HTTP server which acts as a XML transformer between a client talking HTTP and a server talking HTTPS. It took me less than a week to finish the daemon with all the Unix goodies: syslog, fork, signals etc. Calling continuations in signal handlers is really funny. I have no idea how this works but it seems to.
Here is the script (that works in my machine):
#! ./gsi-script -:d-
(display "Content-type: text/html") (newline) (newline) (display "<html> <body> <h1>Hello from Gambit</h1> </body>
</html>" ) (newline)
The server encountered an internal error or misconfiguration and was unable to complete your request.
HTTP headers must be delimited with CRNL. The same applies to CGI programs. You should not rely on newline, because it is likely that it does different things on different systems. This would be a valid response on every machine:
(display "Content-type: text/html\r\n") (display "\r\n") (display "<html><body>hello</body></html>")
But if you need the best CGI support you should probably use Perl instead: http://search.cpan.org/~lds/CGI.pm-3.43/CGI.pm
Hallo,
On Wed, Dec 14, 2011 at 10:55 AM, Vok Vojwo ceving@gmail.com wrote:
But if you need the best CGI support you should probably use Perl instead: http://search.cpan.org/~lds/CGI.pm-3.43/CGI.pm _______________________________________________
Or he could stab himself in the eye. :)
CGI ought to be the simplest protocol ever, you should get this running fast. Check:
* Try to run your app individually as to doublecheck that it outputs the right thing (=right function) * Try another CGI app as to doublecheck your app outputs the same thing as the other app (=ensure sufficient protocol conformance for this one) * Check so that you output the right type of newline expected by the caller and output by the test app, check with a hex editor - \n only or \r\n ? (=") * Insert a force-output call somewhere maybe * Make it log its executions to some file so you know it actually got run and how far
When it spins, let the ml know how you got it there
2011/12/13 Eduardo Costa edu500ac@yahoo.com
I need to use Scheme or Common Lisp for writing CGI scripts to process the XSL/XML protocols of a law firm. I started with Stalin, since it is easier to compile. The resulting exec files work perfectly well, and have small foot prints. However, the Stalin community does not seem to be very active. Besides this, Stalin is very slow to compile, and does not provide an interpreter. Therefore, I decided to switch to Gambit, Bigloo or SBCL.
Gambit has the advantage of providing native infix notation. However, it is not working in most commercial servers that the law firm uses. I am using the following command line to create the exec files:
$ ./gsc -exe gambtest.scm
Where gambtest.scm contains the following lines:
(display "Content-type: text/html") (newline) (newline) (display "<html>
<body> <h1>Hello from Gambit</h1> </body> </html>" ) (newline)
It generates an executable file that works perfectly well in my machine, but not in the servers that host the pages of the law firm.
$ ./gambtest Content-type: text/html
<html> <body> <h1>Hello from Gambit</h1> </body> </html>
For reasons that I cannot fathom, the law firm uses many hosting providers. I also tried to use Gambit as a scripting language. The result is the same. In the case of Bigloo, the problem lies in the fact that it uses dynamic libraries incompatible with the server. I cannot understand why this happens, since Stalin works even when linked to dynamic libraries. By the way, I prefer the scripting solution, since the static exec files are very large.
I installed gambit in the hosting provider, making sure that both gsi and gsi-script have permission to execute. I also tested the scripts with Dorai Sitaram's Scheme in Common Lisp to make sure that everything is working fine. Here is the script (that works in my machine):
#! ./gsi-script -:d-
(display "Content-type: text/html") (newline) (newline) (display "<html>
<body> <h1>Hello from Gambit</h1> </body> </html>" ) (newline)
Here is the message that I get from Hostgator both for the scripting version and the compiled version:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@advogadosmg.org and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 mod_fcgid/2.3.6 FrontPage/5.0.2.2635 mod_bwlimited/1.4 mod_auth_passthrough/2.1 Server at advogadosmg.org Port 80
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list