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

Graham
7-Aug-2009
[5367x3]
So, your comments page has a form on it where the form action is 
itself?
I can't see why there would be much of a delay ... do you have a 
mail server running on localhost?
If you don't want to use email, you can use twitter instead ...
amacleod
7-Aug-2009
[5370]
I just tested it and its seems fast enough....I guess I'm used to 
poor, slow connections with long hangs...	
Thanks for the suggestion Graham.


Its actually better this way as I can now include more info with 
the email such as who is sending it and what the message is...
Dockimbel
8-Aug-2009
[5371x4]
Graham: I need to test it again, my Cheyenne instance was configured 
in debug mode (-w 0), so worker processes were reset after each request.
Ok, now using production mode, I can reproduce the issue. I'll fix 
that asap.
Issue fixed in SVN r5. It was just a typo caused by copy-pasted code.
amacleod: I'm planning to work in the next weeks on integrating an 
async Mail Transfer Agent in Cheyenne, so sending emails will not 
blocks CGI or RSP scripts.
Graham
8-Aug-2009
[5375]
doc, does that include the app-init.r issue?
amacleod
8-Aug-2009
[5376]
Sounds very cool,Doc. Thnks for the info...
Dockimbel
9-Aug-2009
[5377x2]
App-init.r : if you define a word! in a RSP script or in app-init 
event handlers, remember that it will only exists in the worker process 
context where it was called. It won't be defined in the other worker 
processes, so it will likely produce errors in your app. The only 
safe and multiprocess way is to use session object. This means that 
you currently can't have such thing as webapp global words (but you 
can at the session level).


If REBOL had multithreading or, at least, an efficient IPC between 
REBOL processes (like shared memory), you would have such feature 
since the beginning. I was reluctant to extend my custom IPC to allow 
shared global values for RSP script because it would have an impact 
on performances, but maybe the added value worths it and the impact 
might not be so big (basically, a MOLD/LOAD + 2 TCP transfers of 
all shared data for each request). Perhaps, it's time to reconsider 
adding this feature?
Humm, on second though, it might be much more complicated, because 
it would require a synchronization mechanism for value modifications 
between all worker processes (which is very inefficient using TCP 
ports).
Graham
9-Aug-2009
[5379x4]
I've not had any issues before I used virtual web hosts .. and then 
my "global" app-init.r word spilled into the other web hosts
and other webapps
well, for the moment I have fixed the issue by hardcoding the value 
into the rsp pages.
If I used the session object i still have to fetch  the value from 
somewhere
Dockimbel
9-Aug-2009
[5383]
Looking in my RSP engine code, I see that it will run on-application-start 
handler at least once per process to ensure that words defined there 
would be defined in the other processes (forgot about that). Anyway, 
modifications will stay local to the process, so there are unsafe.
Will
9-Aug-2009
[5384]
I use a uniserve tcp caching service when I need synchronized data 
across task-handlers
Will
10-Aug-2009
[5385x3]
Janko: comment out this line in RSP.r
if find request/config 'debug [debug-banner/active?: yes]
you'll have errors reported and no debug bar
Dockimbel
10-Aug-2009
[5388]
Good option :-)
Graham
12-Aug-2009
[5389]
What would cause a browser to complain about a RSP page ... asking 
what to do with it?  As long as Cheyenne is sending the correct content 
header .. there should be no issues, right?
Janko
12-Aug-2009
[5390]
If error happens on compressed page browser (FF) complains about 
wrong compression .. at least in my version
Graham
12-Aug-2009
[5391]
Oh yeah ... seen that.   Just wondering what causes a browser not 
to recognise a RSP page ... perhaps an error in the contents?
Dockimbel
12-Aug-2009
[5392]
Do you have a page online that produces such error so I can test?
Graham
12-Aug-2009
[5393x2]
No, it's a user of mine that is reporting these issues.  I don't 
see them :(
I'm going to use teamviewer next week to see what's going on.
Dockimbel
12-Aug-2009
[5395]
There's a high chance that's related to compression.
Graham
12-Aug-2009
[5396x2]
How to turn off compression?
to see if it fixes the issue?
Janko
12-Aug-2009
[5398]
response/no-compress
Graham
12-Aug-2009
[5399]
ok
Graham
14-Aug-2009
[5400]
If anyone needs it, this is the latest windows binary for cheyenne 
http://accessories.s3.amazonaws.com/cheyenne.exeusing command view
Janko
15-Aug-2009
[5401]
just to say that another cheyenne webapp got public beta release 
yesterday .. it's in my lang. url is http://www.cebelca.biz(thanks 
to Doc for makign cheyenne so good!)
Dockimbel
15-Aug-2009
[5402]
Nice bee. :-)
Janko
15-Aug-2009
[5403]
it's from iStockPhoto
Graham
17-Aug-2009
[5404x3]
I was debugging some rsp code last night, and determined that the 
cause of my problems was that I was using some unitialized variables 
... but this wasn''t obvious because these variables had taken values 
from some one else's rsp session and web app.  To prevent this, apart 
from making sure I initialize my variables correctly, should I wrap 
my code inside an anonymous context ?
I don't know if it makes any difference but it was inside a Rebol 
script that I had executed using *do
Just wondering how easy it would be if when a user requests a resource, 
but their session has timed out, to redirect them to the login page, 
and then forward them onto the resource they were after?
Dockimbel
17-Aug-2009
[5407x3]
*do means "bind to the global context", but even the wrapper DO wouldn't 
help you there. As a rule of thumb, *always* initialize your global 
variables in your RSP script (or at least put them in some local 
context). Never expect that a variable would be available in another 
RSP script unless you put it in session object.
I sometimes use the following safe construct to avoid reloading some 
longer code on each RSP script call : 
<%
	if not value? 'my-object [
		my-object: context [

   ;--loaded on each new worker process only once, then available in 
   global context
			...
		]
	]
%>
Session timeout: you have to save the resource URL somewhere, then 
retrieve it after login and redirect the client there (using a client 
redirect or server-side forward). I don't remember right now the 
implementation detail. BrianH told me once a method that looked good 
to me, but I can't find it right now.
Graham
17-Aug-2009
[5410x2]
The resource url would have to be saved by the cheyenne api .. a 
web app can't save it.
Good point about not reloading if it's already available to the worker 
process.
Will
17-Aug-2009
[5412x3]
actually the resource url is already saved when a session timeout, 
this is the code in mod-rsp.r:
req/out/code: 302
					sessions/set-cookie sess req
					h-store req/out/headers 'Location url
					h-store req/out/headers 'Last-Modified none
					repend sess/vars ['from req/in/url]
					throw true 	; redirects to login page
so the url should be available in session/content/from
I use it this way, after checking for valid user/pass :

any[all[session/exists? 'from t: session/content/from session/remove 
'from t <> "/admin/" t] rejoin [%/admin/ user/prefs/home %.t]
Graham
17-Aug-2009
[5415]
ok. thanks.
Dockimbel
18-Aug-2009
[5416]
Will, thanks, I forgot about 'from being included in mod-rsp.