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

World: r3wp

[!Uniserve] Creating Uniserve processes

Graham
9-Mar-2005
[39]
And that is with a block period of 10 seconds.  The greylisting paper 
suggests using 1 hour and I'll try that now.
Pekr
9-Mar-2005
[40]
Graham - what is your experience with Uniserve so far? So far so 
good? :-)
Graham
9-Mar-2005
[41x3]
Good.
Needs more documentation on writing modules .. but dockimbel says 
he will hopefully produce those in the next couple of days.
As he says, it's very easy to write a new service for it.
Will
9-Mar-2005
[44]
Pekr: Uniserve is uberkool!! It is my main webserver since january 
2003. Since then it crashed 2-3 times, not sure it was uni or rebol 
8)
Graham
9-Mar-2005
[45]
what version of rebol are u using?
Will
9-Mar-2005
[46]
/core 2.5.8.2.4
Graham
9-Mar-2005
[47x2]
Does that have the new async core in it?
I can't remember all these numbers ... :(
Will
9-Mar-2005
[49]
no 8(
Graham
9-Mar-2005
[50]
I was getting async read errors, and at least one data type recycle 
error before switching to  2.5.55.3.1
DideC
9-Mar-2005
[51]
Uniserve is not usable with recent async Core. It use the "old" async 
port system.
Graham
9-Mar-2005
[52x2]
so, doc said .. but my smtp service appears to be working ...
dunno what this means ...
JaimeVargas
9-Mar-2005
[54]
Graham, can you encap uniserve scripts?
Graham
9-Mar-2005
[55x3]
I don't see any reason why not ...
need to redefine 'launch back to itself again.
it looks for files in the services directory .. need to change that 
as well I guess
JaimeVargas
9-Mar-2005
[58]
Last I checked uniserve uses a directory structure to handle stuff. 
So I wonder if the encaped app needs to replicate this structure.
DideC
9-Mar-2005
[59]
I just encap Uniserve script 2 weeks ago.

Need some tricks to encap the protocols/services, that normally Uniserve 
loads from disk at startup.
JaimeVargas
9-Mar-2005
[60x2]
Thats what I thought?
DideC, Do you mind sharing?
Graham
9-Mar-2005
[62x3]
Didier, do you have an example of your encapped changes ?
I want to add database storage for my smtp service, and since I use 
odbc, I have to encap to distribute ...otherwise users have to purchase 
command
( and, no, I don't know anything about mysql .. )
DideC
9-Mar-2005
[65]
In short.

Protocols and services (or whatever else) are encapped as data in 
a block! (a cache sort-of).

instead of 'do/'load, you have to use 'do-cache/'load-cache in your 
script.


The cache functions are initialize differently either you are encapping 
or doing the script.
Graham
9-Mar-2005
[66]
if you do cgi, then you have to launch a new version of the encapped 
script for each cgi ?
DideC
9-Mar-2005
[67x4]
Here is an example of a starter that can be used for doing the script 
and to encap it :
Rebol [

 title: "example of starter script that act the same with View after 
 encap"
]

#include %/e/rebol/sdk/source/mezz.r
#include %/e/rebol/sdk/source/prot.r
#include %/e/rebol/sdk/source/view.r

;***** This is the function that make the tricks
#include %uniserve/libs/encap-fs.r 
if not value? 'encap-fs [do %uniserve/libs/encap-fs.r]

set-cache [
	%uniserve/uni-engine.r		[#include %uniserve/uni-engine.r]
	%uniserve/libs/headers.r	[#include %uniserve/libs/headers.r]
	%libs/log.r					[#include %uniserve/libs/log.r]
	%uniserve/protocols/HTTP.r	[#include %uniserve/protocols/HTTP.r]
	
	%your-file.r					[#include %path/to/your-file.r]
	;...
]

;***** Start
do-cache %uniserve/uni-engine.r
do-cache %uniserve/libs/headers.r

UniServe-path: %./uniserve/
logger/level: none


;***** You have to load protocols and services before starting Uniserve
do-cache %uniserve/protocols/HTTP.r

;***** Uniserve Initialise
; Require like this to not loading protocols/services from disk
uniserve/boot/no-loop/with []

;***** Your script initialise
;...
This is a strip down of the script I use for encaping lecture-forum.
I can also doing it with View.
Graham
9-Mar-2005
[71]
where's the encapped version of lecture-forum?
DideC
9-Mar-2005
[72]
Nowhere actually. Just on my disk.
Graham
9-Mar-2005
[73]
o :)
JaimeVargas
9-Mar-2005
[74]
Does encap-fs defines do-cache and set-cache?
DideC
9-Mar-2005
[75x4]
Yes, very short funcs...
encap-fs: context [
	cache: path: none
	root: system/script/path

	get-cache: func [file][
		path: parse file "/"	
		remove-each dir path [dir = ".."]
		file: to-file path	
		either file [
			either file: select cache file [file][load file]			
		][
			make error! join "Cannot access : " file
		]
	]
	
	set 'encap? to-logic select system/components 'decap

	either encap? [
		set 'set-cache func [list [block!] /local bin file][
			cache: list
			;cache: make block! 16
			;parse list [
			;	some [
			;		(bin: no) opt ['binary (bin: yes)]
			;		set file file! (
			;			repend cache [
			;				file
			;				either bin [read/binary file][read file]
			;			]
			;		)
			;	]
			;]
		]
		set 'do-cache func [file [file!]][do get-cache file]
		set 'load-cache func [file [file!]][load first get-cache file]
		set 'read-cache func [file [file!]][]
	][
		set-cache: none
		do-cache: :do
		load-cache: :load
		read-cache: :read
	]
]
Oups, forget the "Rebol [ ]" header
... and to remove the comments
Graham
9-Mar-2005
[79]
encap uses old core though ...
DideC
9-Mar-2005
[80]
I use enface 1.2.48.3.1
Graham
9-Mar-2005
[81]
I must try this out tonight :)
DideC
9-Mar-2005
[82]
Bed time here. I let you play with it.
Take care of paths, it's what doom me to trouble.
JaimeVargas
9-Mar-2005
[83]
Thanks. DideC I been looking for something like this for sometime. 
You should posted to the rebol.org
Graham
10-Mar-2005
[84]
More statistics .. over the last 12 hours, 3400 smtp connections 
from mainly spamming smtp servers.  62 of those were from trusted 
servers, and 37 were caught by spamcop.  21 mails were passed thru, 
but most of these were spam as well.  These ones would be subjected 
to Bayesian analysis etc.
DideC
10-Mar-2005
[85]
Jaime: not my code. Dockimbel's one. I let him do it if he wants.
Graham
11-Mar-2005
[86]
Got a working pop server now for uniserve .. connected to a firebird 
database.

Now to get the smtp service to save files to the database as well.
DideC
11-Mar-2005
[87]
cool
Graham
11-Mar-2005
[88]
I did very little testing so far ..