r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!Cheyenne] Discussions about the Cheyenne Web Server

btiffin
2-Jun-2007
[886]
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
[906x3]
what happens if you just remove the test ?
and do the redirect ?
session/content/login?: yes
response/redirect "/testapp/"
btiffin
2-Jun-2007
[909x3]
I was just going to try that... I started up cheyenne with -vvv this 
time  :)
Ice weasel caught improper redirect...
Changed to

response/redirect "/show.rsp"  (out of the testapp dir, to www/show.rsp) 

No request variables,
no session...
Dockimbel
2-Jun-2007
[912]
Brian: are you using a local proxy or special plugins for Ice weasel 
?
btiffin
2-Jun-2007
[913x2]
Nope...never with the plugins  :)  Well except flash.
I know that this is going to be a  DOH!  when it starts working :) 
 Something my eye
isn't catching...
Dockimbel
2-Jun-2007
[915]
try with : http://localhost/manual.rsp(manualy starting the session, 
then see the /show.rsp)
btiffin
2-Jun-2007
[916x2]
Tried a few times.   Start Session, redisplays as Start Session... 
 I've plopped a few
help lines in the manual.rsp.
I've  enpro 'ed cheyenne.r  same fail cases...
Will
2-Jun-2007
[918]
tryed on port 8080 or 80? do other website write cookie in your browser 
and you can see them?
btiffin
2-Jun-2007
[919x2]
Yep.  Lots of cookies.  :)
I'm going to config for port 80 and try from root....
Will
2-Jun-2007
[921]
tray removing this line at the end of mod-rsp: insert tail out "; 
HttpOnly"
Dockimbel
2-Jun-2007
[922]
I've only tested as root on my linux virtual box.
btiffin
2-Jun-2007
[923x3]
Same fail cases from root...I'm going back to user mode.  :)
I'm about to try Will's last suggestion
I'm going to try some REBOL code I can execute to get out of 'browser' 
mysteries.

raw-http type stuff, for tests...one minute (or two)
Will
2-Jun-2007
[926x2]
then I would say use any tool that permit you to see the header request/response, 
look closely what working websites sen in the response header for 
set-cookie change the mod-rsp to send the same apart from the RSPSID=xxx 
, eg remove path and expiration date
sen=send
btiffin
2-Jun-2007
[928]
Cool.  Thanks for the tip...
Will
2-Jun-2007
[929]
the cookie must be set, otherwise maybe the browser has special rules 
for order of headers (shouldn't), on wine what version of window 
and IE did u try?
btiffin
2-Jun-2007
[930]
Umm, I'll have to look at the wine and Ie versions...one sec
Will
2-Jun-2007
[931]
did you try only on localhost ? can you add something like "127.0.0.1 
domain.local" in your /etc/hosts file and in the http.cfg add a corresponding 
domain preference
btiffin
2-Jun-2007
[932]
Sorry gentlemen, I'm being dragged away for a bit.  Thanks for all 
the help.  Should be

back within the hour, but please don't waste any more time on my 
account.  I'll pester
people with more info shortly  :)
Will
2-Jun-2007
[933]
look at the headers first there must be a difference between what 
cheyenne and other webservers send, or maybe the problem is localhost, 
or the headers orders, in your case ;-)
Dockimbel
2-Jun-2007
[934]
Good point Will, this looks like a domain mismatch between the browser 
and the server (that would explain why the session cookies are not 
sent back to the server).
btiffin
2-Jun-2007
[935]
Hello again.  Tried the following...

dev [
    root-dir %www/
    default [%dev.rsp %dev.cgi %dev.html]
]

added to httpd.cfg  (dev is  192.168.1.102 in /etc/hosts)

%dev.rsp is
<html>
<head>
	<title> Manual Sessions</title>
</head>
<body>
<img src="logo.png">
<center>
<h2>Manual session mode</h2>


<% help session  help request session/start  help session response/redirect 
"show.rsp" %>
 
<BR><BR>Your ID is :  <%=session/id%><BR><BR>

<a href="show.rsp">Test RSP script</a>
</center>
</body>
</html> 

%raw.r is
REBOL []

port: open tcp://dev:8080
insert port {GET / HTTP/1.1
Host: dev:8080
User-Agent: REBOL/Core
Connection: close

}
result: copy port
close port
print result