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

Dockimbel
7-May-2011
[10321]
Where => From where
onetom
7-May-2011
[10322x3]
REBOL []  do %../lib/obj.r  probe to-object [a: 1]
this is my test.r file and im calling it from a webapp
from the root of a webapp
Dockimbel
7-May-2011
[10325]
Ok. Will test that case locally later tonight, dinner time now.
onetom
7-May-2011
[10326x2]
cool, thx, i'll be here!
i want cheyenne to be less sucky, really. it's one of the nicest 
rebol projects and it's a shame if i can break it every second day... 
makes me not very proud of it... :/
Dockimbel
7-May-2011
[10328x2]
There are countless ways to break one's code using REBOL scripts. 
;-)
Also, about using plain REBOL scripts in RSP engine, it was a last 
year request from Carl, it wasn't part of my planned feature list 
to support, so it can cause new issues that I have not forseen when 
building the RSP engine. You are the first one to report me issues 
with such scripts, so I guess nobody except you and Carl are using 
this approach. Anyway, your reports are helping me make it more reliable.
onetom
7-May-2011
[10330x3]
until yesterday the very same script was within <% %> tags actually 
and this effect was still observable.

just the latest svn version didn't accept the tags in a .r file anymore, 
that's why im showing it as a REBOL[] script.

otherwise, i was just following common sense and trying to get things 
done in an ultra primitive way :)
the script worked and still works as a CGI script btw, so i bravely 
switched over to the RSP handler as it's been suggested on the "Basics" 
documentation page and i was using the very same unless value? 'my-object 
pattern to load my libs.
what does "run Cheyenne with a non-persistent? worker." mean, btw? 
-w 0?
Dockimbel
7-May-2011
[10333x6]
Yes, it means starting it with -w 0.
It works here in a vhost (not in a webapp) using:

%obj.r  => REBOL [] to-object: func [a [block!]][context a]
%test.r => REBOL []  do %../libs/obj.r  probe to-object [a: 1]

Testing within a webapp now...
>> read http://localhost/test.r
== "make object! [^/    a: 1^/]"
From a webapp, it works ok too:

%libs/obj.r  => REBOL [] to-object: func [a [block!]][context a]

%www/testapp/test.r => REBOL []  do %../libs/obj.r  probe to-object 
[a: 1]

>> read http://localhost/testapp/test.r
== "make object! [^/    a: 1^/]"
I have disabled the 'auth keyword from /testapp webapp to do this 
test, to avoid being redirected to a login page.
I have run the tests using -w 1, using -w 0, I get a "to-object has 
no value" error.
onetom
7-May-2011
[10339]
(im not sure im following u, but i guess u r logging for urself mostly)
Dockimbel
7-May-2011
[10340x2]
Basically, your issue is related to the Cheyenne "debug" mode that 
restart all workers after each request. In normal mode (persistant 
workers), it should work fine.
I am investigating now how Cheyenne's debug mode can causes that 
issue in such case.
onetom
7-May-2011
[10342]
im running with -w 1. is it debug mode too?
Dockimbel
7-May-2011
[10343x4]
No.
I can't get the error here using -w 1, only using -w 0.
Can you show me the content of %obj.r from : do %../lib/obj.r?
New Cheyenne revision: 138


FIX: RSP code binding issue with nested DO calls (thanks to Tamas 
Herman for
reporting it).


Please pay attention that this fix is really deep in RSP engine, 
I have tested it with all my RSP apps, but regressions are not excluded. 
Be sure to report me any odd changes in your app behaviour after 
upgrading to r138.
GrahamC
7-May-2011
[10347]
Dunno if this is relevant .. but I tend to use 'do* instead of 'do
Dockimbel
7-May-2011
[10348]
do* == do/global == native 'do

There are cases where you want to bind your code to global context, 
so you will use 'do/global. For all other cases, you should just 
use 'do (especially now that nested 'do should to be fixed).
GrahamC
7-May-2011
[10349x3]
my meaning being that 'do did not work as I expected ...
I should go back and see if this new build fixes the issues I've 
had
OTOH, if it's working .. don't touch it!
onetom
7-May-2011
[10352x2]
just for the sake of test, it would be valuable if u could try your 
'do* code using 'do
since we dont have automated tests for this - i guess - at least 
lets do some manual tests
GrahamC
7-May-2011
[10354]
Anyway, thanks for examining this .. I just avoided the issue!
onetom
7-May-2011
[10355]
i was going around it too, by putting my DOs into on-app-start, but 
hey, for rapid development, such basics should work too
GrahamC
7-May-2011
[10356x3]
I was putting my stuff into app-init.r as well but found it did not 
work
So, I was defining my odbc sources there but they were being overwritten
So, now I load the db from a disk file each time ...
onetom
7-May-2011
[10359x2]
:) im loading my db from files too...
on each request actually
GrahamC
7-May-2011
[10361x2]
I have mutiple users using a web app on different ports.  Each has 
their own vhost, and their own pages but to keep things simple, each 
web app is the same.  I include a config file each time a rsp page 
is loaded with the db definition instead of in the app-init.r where 
it did not work
When I included the definitions in the app-init, users would access 
other users' db!
Kaj
7-May-2011
[10363x4]
Data wants to be free
Switching away from root is impossible when the RSP module is disabled:
7-May-2011/20:07:17+2:00 : make object! [
    code: 311
    type: 'script
    id: 'invalid-path
    arg1: 'mod-rsp
    arg2: none
    arg3: none

    near: [if exists? file: service/mod-list/mod-rsp/sessions/ctx-file 
    [try-chown file uid gid]]
    where: 'set-process-to
]
from crash.log
Dockimbel
8-May-2011
[10367x2]
Kaj: pushed a fix for that in r139.
When I included the definitions in the app-init, users would access 
other users' db!
 

Have you used session variables to store user-specific data? Everything 
else is unsafe.
Kaj
8-May-2011
[10369x2]
Thanks, nice turnaround :-)
Next problem when trying to switch away from root: