newlisp as localhost / cgi programming

Started by didi, April 09, 2009, 11:12:58 AM

Previous topic - Next topic

didi

newLISP as localhost and cgi-functions :



With Firefox and Ie8 everything works good , you can send a html-page back via  the ( putpage ... ) command or you can generate a html-page  with  ( print ... ) commands .

Googles Chrome recognizes the direct-print-commands but not the putpage-version.

Apples Safari under Windows XP opens the cgi-file only as a text-file, so that you can only read the source-text .



As a workaround i tried the  "loacation: " command - the simplest version :

( load "cgi.lsp" )
( println "location: http://www.newlisp.org/" )
( println )


But this version doesn't work at all .  I'm clueless .

Damned to learn and use JavaScript ? - or is there another way ...

newdep

#1
Hi didi,



Im not into the exotic html versions anymore , but what do you want

to establish? That the cgi script is loaded during a page refresh or automaticly or during a click on your localhost and connects to newlisp.org?
-- (define? (Cornflakes))

Lutz

#2
You need something like this::


(print "Status: 301 Moved Permanentlyrn")

before the location header. More about HTTP mode here:



http://www.newlisp.org/CodePatterns.html#http_mode">http://www.newlisp.org/CodePatterns.html#http_mode



if you work a lot with Status headers I would also goto the 10.0.3 development version which has some improvements/fixes when using the "Status:" directive.



Also, study the code of the two applications here:



http://www.newlisp.org/index.cgi?Applications">http://www.newlisp.org/index.cgi?Applications



They work both on Apache and both on newLISP server mode when using Firefox, Safari or Opera.

didi

#3
@newdep

The task is to type some data in your browser,  call newLISP as localhost, work with the data and send the result back  to your browser.

I'm working on my ShortNotizer-Application - but somehow on my dream - pure newLISP with any browser as a gui ;)



@Lutz

thanks for your tipps ,  i'll do my best .  

Has someone already tested this apps with google chrome ?

newdep

#4
Im getting this with Chrome ->

This webpage is not available.



The webpage at http://127.0.0.1/ShortNotizerView.cgi">http://127.0.0.1/ShortNotizerView.cgi might be temporarily down or it may have moved permanently to a new web address.



[+]  More information on this error



Error 320 (net::ERR_INVALID_RESPONSE): Unknown error.







I have to refresh 2x to get this ->



http://127.0.0.1/ShortNotizerView.html">http://127.0.0.1/ShortNotizerView.html



ShortNotizer



View



testing

hello

Fri Apr 10 10:57:34 2009



write next

overview



Pressing that URL now directly work instantly.. Strange ;-)
-- (define? (Cornflakes))

didi

#5
@newdep

If you submit the write-form , the cgi is called, this cgi takes the data generates the html page and try to send it via 'putpage' back to the browser .

So you can not call the html directly before it is generated.

It seems that the generating of the page works but direct sending back not .



The Location version would be a workaround to call this generated html on a second way.

didi

#6
With the 10.0.3  nearly all pages work without problems on Safari with Windows XP, only one page is strange,  now looking whats different in the format of the page ..