Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - grable

#1
newLISP in the real world /
June 22, 2005, 03:19:02 AM
Damit, i allways forget to check with IE ;)



Thanks again for letting me know =)



il look into it. heheheh



UPDATE:

   Seems there is some issues with the wiki and the asp syntax,

   but I think ive fixed it now though.
#2
newLISP in the real world /
June 21, 2005, 08:02:29 PM
I setup a small page for future projects and the HTTPD, to stop bothering this forum with my minor updates ;)



http://grable.cjb.net">//http://grable.cjb.net



and downloads have been updated to

http://grable.cjb.net/downloads/grb_httpd.rar">//http://grable.cjb.net/downloads/grb_httpd.rar

http://grable.cjb.net/downloads/moded_wiki.rar">//http://grable.cjb.net/downloads/moded_wiki.rar
#3
newLISP in the real world /
June 21, 2005, 02:52:56 PM
Made the cgi processor take lisp code spaned over multiple statements..



eg:
<% (for (x 0 5 1) %>
<b><%= x %></b><br>
<% ) %>


more like real server pages does it ;)

now, its a little bit slower this way i imagine, since it converts that to several (print) statements and then evals it.



I havent tested it fully, but it works on my small test samples..



anyhow, im updating the downloads with the new code so you can try it for yourself =)



ftp://anonymous@grable.cjb.net/grb_httpd.rar">//ftp://anonymous@grable.cjb.net/grb_httpd.rar

http://grable.cjb.net/grb_httpd.rar">//http://grable.cjb.net/grb_httpd.rar <-- may not be up 24/7



UPDATE:

  allso the wiki needed a minor adjustment.. you can grab it http://grable.cjb.net/moded_wiki.rar">here

or fix it yourself, its just to add 1 line of code



just go to the bottom of the file "index.cgi" and change the code to this
;; take parameter as page name and display it
(set 'link QUERY_STRING)
(if (or (= link "") (not link))
  (display-page "Home")
  (display-page link)
)
(throw) # <--- this line
#4
newLISP in the real world /
June 19, 2005, 02:36:29 PM
QuoteA (happy) IE user say: Thanks


glad to help.. it was stupid of me not to see it earlier ;)



UPDATE:

  yes i know theres alot of them.. atleast you get the latest no?



the modified wiki for grb_httpd works, and its much faster this way than running on the old httpd.



just replace the files in this rar with the ones you got. TAKE BACKUP!!



http://grable.cjb.net/moded_wiki.rar">//http://grable.cjb.net/moded_wiki.rar



or you can test it here:



http://grable.cjb.net:8080">//http://grable.cjb.net:8080
#5
newLISP in the real world /
June 19, 2005, 01:58:24 PM
I just changed the newLISP WIKI to work with the format i use in the modified httpd, wasnt that much to change. so far so good ;)



I just have to test all the functionality in newLISP wiki before i post it.



And i fixed some stuff in the server aswell.



newest version is here:

http://grable.cjb.net/grb_httpd.rar">//http://grable.cjb.net/grb_httpd.rar
#6
newLISP in the real world /
June 19, 2005, 12:44:35 PM
LOL



I forgot to close the socket when done sending data ;) stupid me!



its wierd that this worked on firefox at all! it should atleast have waited for the timeout..



even though i think newLISP/exe's closes open sockets on exit.



but now it works atleast ;) so all you happy IE users can use this shit to.
#7
newLISP in the real world /
June 19, 2005, 12:29:16 PM
Yeah. i forgot the extra  for paths ;)



although it ended up in C: on my pc.. lol



yes yes.. i know it has to work in IE as well ;)..

 but for now itl have to be NON-IE only.. cuz i have no clue as to why IE is slow and refuses to work.



i havent changed that much ;) hehehe
#8
newLISP in the real world /
June 19, 2005, 12:10:35 PM
hmmm.. it must be IE ;)  the ppl having trouble with the ftp use IE to .. hehe



have you tried with newLISP's (get-url) ? that should bypass any problems in the browser.
(write-file "c:grb_httpd.rar" (get-url "http://grable.cjb.net/grb_httpd.rar"))
or better yet, switch to firefox perhaps? ;)



or i could just email them to you..



it must be IE's handling of the "application/octet-stream" mime-type or something.. for its the same process in sending a webpage as in sending a file.. its only the Content-Type (mimetype) thats different in the header.



im sorry, but theres not much i can do :(



UPDATE:

  i tested in IE myself now, and the index page was slow as hell, and the download didnt work either :(  so theres defnetly something IE does or doesnt do that firefox and (get-url) does .. il have look into it later.
#9
newLISP in the real world /
June 19, 2005, 11:51:00 AM
Yes, its on the the modified newlisp server.



Wierd, because i have no trouble downloading myself. I even tested a 50 mb file while constantly refreshing the index page, without any problems.



Seems a few ppl have trouble acessing my ftp too :(



What browser are you using? what os??

Myself am on Windows XP and using the latest FireFox..
#10
newLISP in the real world /
June 19, 2005, 09:13:36 AM
Thanks lutz =)



their in the mail...



Since some people are having trouble geting in to my ftp, ive

put the files on the http server as well..



http://grable.cjb.net/grb_httpd.rar">//http://grable.cjb.net/grb_httpd.rar
#11
newLISP in the real world / complete turnaround ;)
June 19, 2005, 07:59:29 AM
I soon found out that having everything in a single process isnt to good either :/



its was a little bit faster then spawning a new process..

bit it could stil only serve 1 client at a time.. so it now spawns

process again ;) LOL



although this time with proper "forking" using (process)

so its can serve many clients.



it sends the "control" code over the commandline, and loads the

html+newlisp template file and runs it... so the control code must send

the result to the client and close the socket. freeing the server up to do other things =)



allmost same interface as before, just removed the HTTPD context from the script

and i removed the old CGI way completly.



heres the updated files:

ftp://anonymous@grable.cjb.net/grb_httpd.lsp">grb_httpd.lsp

ftp://anonymous@grable.cjb.net/index.lsp">index.lsp



go here to test http://grable.cjb.net/">//http://grable.cjb.net/



UPDATE: forks regular file downloads as well, like images/etc.
#12
newLISP in the real world /
June 18, 2005, 06:21:51 AM
QuoteI have problems to access your FTP.

Can you offer another option or send it?


Its in the mail =)



the ftp is on 24/7 so it "should" work.. dunno why you cant get in..



theres no password for anonymous, so the first one should work,

but some browsers may complain so the second one is more "correct".



ftp://anonymous@grable.cjb.net/HTTPD">//ftp://anonymous@grable.cjb.net/HTTPD

ftp://anonymous@grable.cjb.net/HTTPD">//ftp://anonymous:@grable.cjb.net/HTTPD



if anyone else cant get it and wants me to send it, just speak up =)
#13
newLISP in the real world / Cookies!!!
June 17, 2005, 07:34:34 PM
my hacked version of HTTPD now eats cookies =)



i merged the functions from CGI.lsp with HTTPD, so scripts have roughly the same interface.



script interface:
 # variables
HTTPD:QUERY_STRING  = raw query data
HTTPD:POST_STRING    = raw post data
HTTPD:COOKIES_STRING = raw cookies data
HTTPD:CONTENT_TYPE  = content type of script result (text/html is default)
HTTPD:PUT_COOKIE    = raw cookie data to send to client
HTTPD:PARAMS         = query & post data as (key value) pairs
HTTPD:COOKIES        = cookies data as (key value) pairs

# functions
(HTTPD:get-cookie "name")
(HTTPD:set-cookie "name" "value")
(HTTPD:set-cookie-ex "name" "value" "domain" "path")
(HTTPD:get-param "name")


HTTPD now does the same as CGI.lsp, eg it fill the PARAMS and COOKIES for you before execution of the script, allso you can have multiple cookies in one request.





example usage:
<%
(set 'visits (int (HTTPD:get-cookie "VISITS")))
(if (= visits nil) (set 'visits 1))
(HTTPD:set-cookie "VISITS" (+ visits 1))
%>
<html>
<head>
<title>Test Page</title>
</head>
<body>
<h1>Your IP: <%=(first (net-peer HTTPD:connection))%></h1>
<hr>
Number of visits using cookies: <%=visits%><br>
QUERY_STRING: <%=HTTPD:QUERY_STRING%><br>
POST_STRING: <%=HTTPD:POST_STRING%><br>
COOKIES_STRING: <%=HTTPD:COOKIES_STRING%><br>
<form method="POST" action="yourip.lsp?testing">
<input type="text" name="postdata" value="some random data">
<input type="submit">
</form>
</body>
</html>


hope someone else allso finds this useful =) i kinda like having full access to my server, and being able to do whatever i want with it .. hehe



ftp://anonymous@grable.cjb.net/HTTPD">newest version of HTTPD
#14
newLISP in the real world /
June 17, 2005, 06:19:48 PM
Ah.. k.. i was just wondering.. glad i understood it.. hehe


QuoteImagine code in the preprocessed page hangs in a loop, then the httpd server is dead ;)


hehehehe, yeah.. i thought about that, il just have to be very careful ;)



Although an infinite loop could potentialy happen with another process to, since the httpd will wait for its termination anyway.
#15
newLISP in the real world /
June 17, 2005, 05:00:07 PM
Well i think i solved it..  theres realy no need to use env variables when i have acess to the HTTPD context.. to i just put things in HTTPD:QUERY_STRING and HTTPD:POST_STRING when the data is present..



heres the recent examle (and previous url has again been updated)

il probaly revork this code, since it pretty much a hack right now to get it to work properly..


<%
(set 'page-title "Your IP")
%>
<html>
<head>
<title><%=page-title%></title>
</head>
<body>
<h1><%=page-title%>: <%=(first (net-peer HTTPD:connection))%></h1>
<hr>
QUERY_STRING: <%=HTTPD:QUERY_STRING%><br>
POST_STRING: <%=HTTPD:POST_STRING%><br>
<form method="POST" action="yourip.lsp?testing">
<input type="text" name="postdata" value="some random data">
<input type="submit">
</form>
</body>
</html>




btw lutz (the newlisp expert ;) , in the loop of the cgi-put-page that evals embeded parts i do this:
(while ...
   ...
   (context (sym file-name))
   (eval-string ...)
   (context HTTPD)
   ...
)
 ...
(delete (sym file-name))
 is this the correct way to use a context? or should i put it outside of the loop?