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
2-May-2011
[10169x2]
Declaring a vhost using an IP address: yes and it is documented in 
the wiki.
onetom: thanks for reporting the cause, I will test that locally 
and see if I can improve the error message for such cases.
onetom
2-May-2011
[10171]
doc: it's not a big problem. red is a higher priority :)
Dockimbel
2-May-2011
[10172]
Sure, but I can multiplex with small Cheyenne fixes as long as it 
doesn't take me too much time.
Maxim
2-May-2011
[10173]
thx
onetom
2-May-2011
[10174x3]
hmm... cheyenne binary and the source works differently w the same 
configfile.
$ cheyenne --version
0.9.20.129
WORKS
latest source doesn't work with the following config:

modules [ internal extapp static action rsp alias ]
globals [ listen [8080]    bind RSP to [ .r ] ]
guan-huat [ debug root-dir %./ alias "/docs" %jsondb/to-json.r ]

im testing w $ curl http://guan-huat:8080/docs/test/1
bind-extern makes no difference
oh, the problem is im getting a 404 if i run the source version of 
cheyenne
Dockimbel
2-May-2011
[10177x3]
Are you using sources v0.9.20.129 too?
Hmm, shouldn't make much differences between revision 129 and latest 
135...
You should search in the Cheyenne console logs for "[HTTPd] Translated 
file:" to see what file Cheyenne is trying to read. That should give 
you a clue about what is causing the difference.
onetom
2-May-2011
[10180x5]
no, v0.9.20.129 is binary
Translated file: %./jsondb/to-json.r
in case of the source version; so there is no differnece there.
http://piratepad.net/KkvkZ9AtME
i put the correct and the incorrect logs here
i pasted the command lines too
it works if i copy over my stuff into cheyenne's dir and start cheyenne.r 
from there
Dockimbel
2-May-2011
[10185x3]
I guess Cheyenne should be able to figure out where are his own files 
if launched from another folder. I need to setup a test configuration 
on my linux box to investigate such case.
But tomorrow, too late now here. ;-)
Got you email, thanks.
onetom
2-May-2011
[10188x2]
i thank u.
it's 6:34 here, but i slept most of the day coz im close to having 
pneumonia again...
onetom
3-May-2011
[10190x2]
hmm... sessions are not persisted anywhere?
anyone wrote some memcached or tmp file storage for sessions?
Dockimbel
3-May-2011
[10192]
They are persisted on disk if you specify in globals section of config 
file:

    persist [sessions]
onetom
3-May-2011
[10193]
noted here: http://cheyenne-server.org/wiki/Config/Persist
is it ok, or there is a better place for it?
Dockimbel
3-May-2011
[10194]
That is the right place, thanks!
onetom
3-May-2011
[10195x2]
how can i implement a login form without sending the password in 
clear text?
should i ask for digest authorization?
Dockimbel
3-May-2011
[10197]
switch to HTTPS.
onetom
3-May-2011
[10198x2]
i can't find the "switch" :) ... i hate this cert and crl based pki 
crap...
any drawback of using http digest, beside not being able to provide 
a nice login page?
Dockimbel
3-May-2011
[10200]
Not AFAIK.
onetom
3-May-2011
[10201]
http://www.berenddeboer.net/rest/authentication.html

this is a nice walkthru of the http auth theory with examples on 
how to do cross browser logout, forgotten password page, auto logout, 
etc etc
Maxim
3-May-2011
[10202x6]
doc, I've been able to add a config for the worker count (min/max) 
within the httpd.cfg file.  it took some doing and a lot of file 
navigation to under the deep secrets of cheyenne's startup processs 
 ;-)
I thought it would have been easy, but it took a bit of doing, since 
the boot process must  *init*  the httpd.r, then setup the config 
and then init the rest.


I could have made it ugly by calling things manually or restarting 
workers, etc... but I ended up adding 2 new options to the uniserve/boot 
spec.


init and no-init which allow us to select what is initialized, without 
knowing the full list of services.
so this code within cheyenne.r:

			shared/pool-start: 	any [
				all [flag? 'debug 0]
				all [flag? 'workers args/workers/1]
				4
			]
			shared/pool-max: 	any [
				all [flag? 'debug 0]
				all [flag? 'workers any [args/workers/2 args/workers/1]]
				8
			]
			shared/job-max: 	1000	;-- CGI/RSP requests queue size


   boot/with/no-wait/no-start [] ; empty block avoids loading modules 
   from disk

----------------------------------------
now becomes:
----------------------------------------


   boot/with/no-wait/no-start [init  [httpd]]   ; empty block avoids 
   loading modules from disk
			shared/pool-start: 	any [
				all [flag? 'debug 0]
				all [flag? 'workers args/workers]
				select services/httpd/conf/globals 'min-workers
				4
			]
			shared/pool-max: 	any [
				all [flag? 'debug 0]
				all [flag? 'workers args/workers]
				select services/httpd/conf/globals 'max-workers
				8
			]
			shared/job-max: 	1000	;-- CGI/RSP requests queue size

   boot/with/no-wait/no-start [no-init [httpd]] ; empty block avoids 
   loading modules from disk
note that this is for a version prior to the latest r135. (I'll update 
the above when I update to r135)
do you want me to commit the changes once I've updated to r135's 
support for min/max workers on the comand-line?
hum... I guess the max workers for debug should be 1  :-/
onetom
4-May-2011
[10208]
Most comments are lies. They don't start out to be lies, but gradually 
the get out of date. You might say that developers should be disciplined 
enough to maintain the comments; but this is not reasonable. Comments 
have no detectable binding to what they describe. If you modify a 
function, you have no way of knowing that 1000 lines above you (or 
perhaps in a different file) there is a comment that contradicts 
what you are doing). So comments slowly degrade and turn into misinformation.

 -- http://www.coderanch.com/t/131147/Agile/Clean-Code-Handbook-Agile-Software

u just demonstrated this principle very well ;)
Geomol
4-May-2011
[10209]
That's an interesting viewpoint. He starts his post with:


I think it would be better if the code were not complex. I think 
it would be better if the code was understandable at a glance. I 
think the effort of writing a comment for complex code is misplaced. 
The effort should be expended on making the code simpler and easier 
to understand.


And we can add: produce the code using a language, that's easy to 
read and understand.
Dockimbel
4-May-2011
[10210]
Max: I am very busy today, I am not sure I will have time to review 
your code now (you should send me a copy of the changed files first 
BTW). As you could see, supporting such feature at the config file 
level is complex because of config file being loaded only when HTTPd 
service starts (for historical reasons). I am not sure that initializing 
the HTTPd service ahead is a clean solution (the boot/ line has become 
a bit hard to read with this /no-start flag that loads and init HTTPd 
service...).


The solution I had in mind was to extract the whole config file loading 
from %HTTPd.r and put it in %cheyenne.r. This is a deep and complex 
change, that is why I was waiting to have enough time to do it in 
a single working session. Anyway, I will examine your solution first.
Maxim
4-May-2011
[10211]
onetom, are you talking about me?   cause there are no comments in 
just about all of the cheyenne code.  this is why its often complicated 
to play into the deeper roots of the app.
onetom
4-May-2011
[10212]
Maxim: i was just talking about the comment rot effect. where is 
the empty block here? :)

     boot/with/no-wait/no-start [no-init [httpd]] ; empty block avoids 
     loading modules from disk
Maxim
4-May-2011
[10213]
ah, actually in my code it was updated  :-)


the post was sent in error, as I was editing it, specifically ... 
editing the comments   :-D
onetom
4-May-2011
[10214x5]
is there a way to show errors as text? somehow it happened to me 
yesterday but no idea how could i achieve it...
(for now im switching to the console each time to see what's the 
error, so it's not a big issue of course...)
how can i define a common layout for my webpages? should i split 
the layout into header and footer and use include explicitely on 
each page?
or make it a webapp and wrap the buffer in the on-page-end event?
hm... daaamn, why is the webapp root-dir is not relative to the vhost 
root-dir? why should i specify a vhost root-dir if i use only webapps 
in it?