World: r3wp
[!Cheyenne] Discussions about the Cheyenne Web Server
older newer | first last |
Dockimbel 2-Jun-2007 [858x2] | give me a few minutes, I've reproduce the error here using RT's mysql driver, tracking the cause... |
reproduced | |
Graham 2-Jun-2007 [860] | thax |
Dockimbel 2-Jun-2007 [861x3] | Here's a patched version of do-sql working with /Command DB drivers (paste it in %handlers/RSP.r) : |
set 'do-sql func [[catch] db [word!] data [string! block! word!] /flat /local port][ if not block? databases [ throw make error! "no databases defined!" ] if not pos: find databases :db [ throw make error! rejoin ["database" :db "not defined!"] ] port: pos/2 if any [block? port url? port][ poke pos 2 port: first open port ] either word? data [ db-cache/query db data flat ][ poke response/stats 1 response/stats/1 + 1 either all [flat value? 'send-sql][ send-sql/flat port data ][ either port/handler [ any [ insert port data copy port ] ][ insert port data copy port ] ] ] ] | |
Note that the /FLAT won't work with /Command drivers (I'll add such support in next releases). | |
Graham 2-Jun-2007 [864x3] | Works .. |
I don't know what /Flat does .. so I guess I can do without it :) | |
bed for me ... thanks. | |
Pekr 2-Jun-2007 [867x4] | I don't want to post off-topic here, but as you are here guys - do you think that it would be vital/possible, for R3, to create some DB abstraction schema?Kind of ODBC, JDBC --> RDBC? So that we could use the same syntax and just choose the driver underneath? |
/flat? | |
should provide you with just one block, so youcan use foreach [name last-name whatever][record][do something .... | |
flat - simply - each record is not separate subblock .... | |
Dockimbel 2-Jun-2007 [871x2] | /Command DB API is a de-facto standard. I didn't complied with that standard, just because I found it not handy the db-port / command-port approach ...so my fault ;-) |
...I found the db-port / command-port approach not handy... | |
Robert 2-Jun-2007 [873] | Doc, is possible to integrate a different DB backend? I'm using SQLite now most of the time. Would be cool to use it with Cheyenne as well. |
Dockimbel 2-Jun-2007 [874x2] | You can use it freely with Cheyenne. If it has a standard scheme interface (like sqlbd://), it may work with 'do-sql, otherwise, it's up to you to do the opening/closing part. |
Re: btiffin: I've tried reproducing your problem by matching your config, but without any success (GNU/Linux 2.7.5.4.2 IceWeasel, port 8080, run cheyenne.r off terminal session with rebol -cswq cheyenne.r)... | |
btiffin 2-Jun-2007 [876] | Well that's good news. That probably means it's just some setting, or weirdo config at this end. And thanks for taking the time to try. Knowing that it can work, will give me the incentive to dig in... |
Dockimbel 2-Jun-2007 [877] | start cheyenne.r with -vv (2 v) option and paste here what Cheyenne answers to your attempts to log in http://localhost/testapp |
btiffin 2-Jun-2007 [878x2] | One sec... |
It's not a short paste... [HTTPd] ================== NEW REQUEST ================== [HTTPd] Request Line=>GET /testapp/ HTTP/1.1 [HTTPd] Request Headers=> Host: localhost:8080 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1) Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive [HTTPd] Phase url-to-filename done ( mod-alias ) [HTTPd] Phase url-to-filename done ( mod-rsp ) [HTTPd] Phase url-to-filename done ( mod-fastcgi ) [HTTPd] Phase url-to-filename done ( mod-static ) [HTTPd] Phase access-check done ( mod-action ) [HTTPd] Phase set-mime-type done ( mod-action ) [HTTPd] Phase make-response done ( mod-rsp ) [HTTPd] Response=> HTTP/1.1 302 Moved Temporarily Server: Cheyenne/0.9.11 Connection: close Location: /testapp/login.rsp [HTTPd] Phase logging done ( mod-static ) [HTTPd] Phase clean-up done ( mod-rsp ) [HTTPd] Connection closed [HTTPd] ================== NEW REQUEST ================== / [HTTPd] Request Line=>GET /testapp/login.rsp HTTP/1.1 [HTTPd] Request Headers=> Host: localhost:8080 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1) Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive [HTTPd] Phase url-to-filename done ( mod-alias ) [HTTPd] Phase url-to-filename done ( mod-rsp ) [HTTPd] Phase url-to-filename done ( mod-fastcgi ) [HTTPd] Phase url-to-filename done ( mod-static ) [HTTPd] Phase access-check done ( mod-action ) [HTTPd] Phase set-mime-type done ( mod-action ) [HTTPd] Phase make-response done ( mod-rsp ) [HTTPd] Response=> HTTP/1.1 200 OK Server: Cheyenne/0.9.11 Content-Length: 482 Content-Type: text/html Connection: Keep-Alive Set-Cookie: RSPSID=EISPOMAZTPDFKVIWJAFONZDE; expires=Sat, 02 Jun 2007 11:54:30 GMT; path=/testapp; HttpOnly Pragma: no-cache Cache-Control: no-cache, must-revalidate Expires: Thu, 01 Dec 1994 16:00:00 GMT [HTTPd] Phase logging done ( mod-static ) [HTTPd] Phase clean-up done ( mod-rsp ) [HTTPd] Phase task-done done ( mod-rsp ) [HTTPd] ================== NEW REQUEST ================== \ [HTTPd] Request Line=>POST /testapp/login.rsp HTTP/1.1 [HTTPd] Request Headers=> Host: localhost:8080 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1) Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://localhost:8080/testapp/login.rsp Content-Type: application/x-www-form-urlencoded Content-Length: 23 [HTTPd] Phase url-to-filename done ( mod-alias ) [HTTPd] Phase url-to-filename done ( mod-rsp ) [HTTPd] Phase url-to-filename done ( mod-fastcgi ) [HTTPd] Phase url-to-filename done ( mod-static ) [HTTPd] Posted data=>login=test&pass=letmein [HTTPd] Phase access-check done ( mod-action ) [HTTPd] Phase set-mime-type done ( mod-action ) [HTTPd] Phase make-response done ( mod-rsp ) [HTTPd] Response=> HTTP/1.1 301 Moved Permanently Server: Cheyenne/0.9.11 Connection: close Location: /testapp/ Set-Cookie: RSPSID=YDADUIONKJPHLFBWEDZDFCXN; expires=Sat, 02 Jun 2007 11:54:37 GMT; path=/testapp; HttpOnly [HTTPd] Phase logging done ( mod-static ) [HTTPd] Phase clean-up done ( mod-rsp ) [HTTPd] Phase task-done done ( mod-rsp ) [HTTPd] Connection closed [HTTPd] ================== NEW REQUEST ================== [HTTPd] Request Line=>GET /testapp/ HTTP/1.1 [HTTPd] Request Headers=> Host: localhost:8080 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1) Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://localhost:8080/testapp/login.rsp [HTTPd] Phase url-to-filename done ( mod-alias ) [HTTPd] Phase url-to-filename done ( mod-rsp ) [HTTPd] Phase url-to-filename done ( mod-fastcgi ) [HTTPd] Phase url-to-filename done ( mod-static ) [HTTPd] Phase access-check done ( mod-action ) [HTTPd] Phase set-mime-type done ( mod-action ) [HTTPd] Phase make-response done ( mod-rsp ) [HTTPd] Response=> HTTP/1.1 302 Moved Temporarily Server: Cheyenne/0.9.11 Connection: close Location: /testapp/login.rsp [HTTPd] Phase logging done ( mod-static ) [HTTPd] Phase clean-up done ( mod-rsp ) [HTTPd] Connection closed [HTTPd] ================== NEW REQUEST ================== [HTTPd] Request Line=>GET /testapp/login.rsp HTTP/1.1 [HTTPd] Request Headers=> Host: localhost:8080 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1) Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://localhost:8080/testapp/login.rsp [HTTPd] Phase url-to-filename done ( mod-alias ) [HTTPd] Phase url-to-filename done ( mod-rsp ) [HTTPd] Phase url-to-filename done ( mod-fastcgi ) [HTTPd] Phase url-to-filename done ( mod-static ) [HTTPd] Phase access-check done ( mod-action ) [HTTPd] Phase set-mime-type done ( mod-action ) [HTTPd] Phase make-response done ( mod-rsp ) [HTTPd] Response=> HTTP/1.1 200 OK Server: Cheyenne/0.9.11 Content-Length: 482 Content-Type: text/html Connection: Keep-Alive Set-Cookie: RSPSID=RTJSUKAVYBNOLCJCJBSTNUHP; expires=Sat, 02 Jun 2007 11:54:37 GMT; path=/testapp; HttpOnly Pragma: no-cache Cache-Control: no-cache, must-revalidate Expires: Thu, 01 Dec 1994 16:00:00 GMT [HTTPd] Phase logging done ( mod-static ) [HTTPd] Phase clean-up done ( mod-rsp ) [HTTPd] Phase task-done done ( mod-rsp ) | |
Dockimbel 2-Jun-2007 [880x3] | Your browser is not sending cookies back to Cheyenne. |
That's why it keeps looping on the login page. | |
RSP sessions (and web-apps) require that cookies support be enabled in the browser. | |
btiffin 2-Jun-2007 [883] | Ok, I'll track that down..I've got cookies turned on, accept from all sites.But I'll start looking at other settings. |
Dockimbel 2-Jun-2007 [884] | Strange... |
btiffin 2-Jun-2007 [885x2] | It'll be something simple :) |
Once I get the agenda for IRUA meeting two posted, I'll try it out with Wine and IE. | |
MikeL 2-Jun-2007 [887x2] | i had trouble getting virtual hosts to work with other servers. This works very nicely |
; To add a new virtual host just duplicate and fill the following ; example host : ; ; my.vhost.com [ ; root-dir %/www/ ; documents root directory ; default [...] ; default files ; ] | |
btiffin 2-Jun-2007 [889x2] | Sorry Doc, I'm getting the same failure cases in IE under Wine. But now that I know that you have it working, I'll start poking around and exploring this setup... |
Can I make one suggestion? The clients/rconsole.r prompt should be something like R> instead of >>. I've typed q into the wrong window twice now. :) So I modified my copy of the client. Nice feature by the way. | |
Dockimbel 2-Jun-2007 [891] | You're right, I get caught a few times too :-) |
btiffin 2-Jun-2007 [892] | I've been playing. login.rsp <% user: "test" pass: "letmein" print [<html> <body> <pre>] help request help request/content help session help session/content print [</pre> </body> </html>] in-user: select request/content 'login in-pass: select request/content 'pass if all [user = in-user pass = in-pass][ session/content/login?: yes response/redirect "/testapp" ] %> REQUEST/CONTENT is a block of value: [] Everytime through...first time and after filling in the login form. |
Graham 2-Jun-2007 [893x3] | My working login.rsp script ... <% in-user: select request/content 'login in-pass: select request/content 'pass encoding-salt: to-binary "My encryption string" print [ <p/> "Login is: " in-user " and pass is " in-pass <p/> ] encode-pass: func [ pass [string!] salt [binary!] ] [ checksum/secure append to binary! pass salt ] if all [ in-user in-pass ][ print <pre> qry: rejoin [ {select staffname, sid, fullname from staff where staffname = '} in-user {' and pwd = '} form encode-pass in-pass encoding-salt {'} ] probe qry print </p> sql: do-sql 'remr qry print [ "Query result: " sql ] print </pre> if found? sql/1 [ response/redirect "/testapp/" ] ] %> |
No need to give hint to user that userid or password is incorrect ... ! :) | |
oops .. should add session/content/login?: yes | |
btiffin 2-Jun-2007 [896] | I'm still stuck. Not getting past the login screen at all. Did you modify anything else... httpd.cfg? or app-init.r or ... |
Graham 2-Jun-2007 [897] | nope |
btiffin 2-Jun-2007 [898] | Hmm... request/content is empty on response/redirect "anything" everytime. |
Graham 2-Jun-2007 [899x3] | what does the debug say? |
should there be any content until you have submitted the form? | |
It should be empty first off | |
btiffin 2-Jun-2007 [902] | If I turn on debug in webapp in httpd.cfg I get the Redirection catched everytime. The contents are empty, before and after the "POST", but I'm not sure since the redirect is plopping me back at login.rsp. Even empty when I change the form to method="GET" and hit return... |
Graham 2-Jun-2007 [903] | I'm on win32 at present so can't test it under linux |
btiffin 2-Jun-2007 [904x2] | This change in-user: "test" in-pass: "letmein" if all [user = in-user pass = in-pass][ session/content/login?: yes response/redirect "/testapp/" ] Causes Ice Weasel to catch an "improper redirect" |
I just know this is going to end up being something simple :) | |
Graham 2-Jun-2007 [906x2] | what happens if you just remove the test ? |
and do the redirect ? | |
older newer | first last |