Re: [AOLSERVER] config file example of multihome config?
Dnia 30-04-2006 o 00:42:30 John Buckman [EMAIL PROTECTED] napisał: I'm struggling to configure AOLserver to support multiple web sites, with independent TCP/IP addresses. Can someone attach a config file example of multihoming? The config file seems to support it, but there are both server-specific and global mentions of TCP/IP address and port #, so it's quite unclear how to transfer the sample config file into one that's multihome capable. Notice you need to specify nssock multiple times and you need to configure each of it's instances. ns_section ns/server/$server/modules ns_paramnssock1 nssock.so ns_paramnssock2 nssock.so ns_section ns/server/$server/module/nssock1 ns_paramPort 80 ns_paramHostname www1.something.com ns_paramAddress 10.0.0.1 ns_section ns/server/$server/module/nssock2 ns_paramPort 80 ns_paramHostname www2.something.com ns_paramAddress 10.0.0.2 Of course ports may also differ. -- Wojciech Kocjan [EMAIL PROTECTED] -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
[AOLSERVER] Design for a framework
Hello everyone, Lately I've been wondering about a new framework for AOLserver web applications. Term package below is used to describe on-demand loaded Tcl code, where one package usually serves one application, where usually one application resides per one domain. The previous model is currently used in production on servers that handle many (about 100) domains and about the same number of packages and web applications. Previously (with 3.4) I've been using the following: 1/ code that allowed dynamic loading of packages; The code that was contained in it's own namespace and was loaded/unloaded on demand with reloading on changes. 2/ nsdqe provided session handling - setting the cookie and using ns_set for data plus serialization to harddrive This was handling all the session stuff plus logging in/logging out. 3/ nscache and similar code to handle cache'ing This seems to work ok, but for generic approach what I really lack is an OO - ie so that someone could develop a generic ecommerce class and inherit for specific implementations. This can be done writing plain procs and passing proper args/configuration variables, but I find this task a job for actual OO. This also has a downside that ns_cache cannot actually cache Tcl_Obj so if I would get a result from the db this would get serialized to a string and deserialized on first use. I did develop some cache mechanism that does deepcopy of the objects and then caches the Tcl_Obj themselves for each thread, this improved the speed a lot. Right now I'm wondering the pros and cons of the following solution (using 4.0.10, 8.4.12, thread 2.6.3 and some other extensions). 1/ similar code, but one that would initialize a separate thread for each package and load all the neccessary code in there - the package code would be Itcl classes and plain Tcl code (in the future this could use VFS and maybe tbcload to allow redistribution of the code) 2/ session mechanism (which would require sessions to initialize main website engine) that would create instance of an application object per each session - so that each user would be an instance 3/ most data would be cached using Tcl_Objs (maybe even not using nscache) 4/ Background jobs could also use the same thread, using common non-AOLserver methods (after/fileevent etc) The objects would allow serialization/deserialization by supplying name-value data that would be saved by the session manager. Session would only allow X number of concurrent sessions and serialize+delete the oldest ones when new ones need to be created. Pros: * much better app designing framework * using event loop for packages * one thread per package would solve most multi user scenarios Cons: * any change in the package code would require serializing all instances and reloading the package (but it's not common to experiment with * non-session aware browsers will not be able to use most of the functionality (some functionality could be done by supplying a generic instance for all non-session aware) * it would be easy to do a DoS by generating a lot of sessions (since serialization/deserialization would take a lot of time) * sync DB operations could cause a freeze for many customers (especially with long lasting queries) Any comments on this? -- Wojciech Kocjan [EMAIL PROTECTED] -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Bind -B option
Dnia 20-03-2006 o 05:54:56 JM [EMAIL PROTECTED] napisał: Hi All, Im trying to bind 2 IPs (1 private and 1 public), but for some reason it wont work.. ns_param address$address what IP will I place here? or do i have to place both? You will need to: ns_section ns/server/$server/modules ns_paramnssock0nssock.so ns_paramnssock1nssock.so ns_section ns/server/$server/module/nssock0 ns_paramPort 80 ns_paramHostname www.public.dns.name ns_paramAddress 62.1.2.3 ns_section ns/server/$server/module/nssock1 ns_paramPort 80 ns_paramHostname www.private.dns.name ns_paramAddress 192.168.0.1 -- Wojciech Kocjan [EMAIL PROTECTED] -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Help, read blocks when using openssl
Dnia 25-10-2005 o 22:23:51 Ron Emerick [EMAIL PROTECTED] napisał: # establish connection set fds [ns_openssl_sockopen $host $port set r [lindex $fds 0] set w [lindex $fds 1] # send request puts $w $httprequest\n\n flush $w while {[set line [string trim [gets $r]]] != } { lappend headers $line } #set content_len from http headers Just guessing here, but this is probably needed: fconfigure $r -translation binary set out [read $r $content_len] close $r close $w -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] AOLserver Wiki is now running MediaWiki!
Dnia 07-10-2005 o 09:42:00 Daniël Mantione [EMAIL PROTECTED] napisał: Op Thu, 6 Oct 2005, schreef Dossy Shiobara: I'd like to hear what people think now that the wiki is running MediaWiki. Will this encourage you to use it more? Less? You should convince the Wikipedia-developers to port it to AOLServer native; the performance of AOLServer would be a big help to their overloaded server farm :) Seriously, the actual Wiki used doesn't matter much to me. While MediaWiki is certainly a lot more advanced than WiKit; WiKit is Tcl, MediaWiki is PHP. It ain't good for the Tcl programming language if one of its killer apps is dumped. I wouldn't consider WiKit dumped. It's just serving a different purpose than MediaWiki. WiKit is a raw, easy to install application that doesn't require much. MediaWiki is probably the opposite. If you really want to, you can assemble a team of developers and do a Wiki for AOLserver (it would also work with TclHttpd and emulation layers with minor or no changes). I don't think anything except a good HTML editor (which is quite standard nowadays) and a file manager is really needed. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] FW: [Tcl-announce] Tcl/Tk 8.4.11 Release Announcement
Dossy Shiobara napisał(a): Interesting -- I honestly don't know the finer details, but I know that on (not sure which, but) Solaris or Linux, it won't even compile. It sure didn't compile on: SunOS mars 5.7 Generic_106541-37 sun4u sparc SUNW,Ultra-4 -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Module help
Andrew Piskorski napisał(a): On Thu, Jun 30, 2005 at 08:40:38AM +0100, Bas Scheffers wrote: I have my own perfectlty working Tcl version of it, the reason I wanted a C based version is so I can call it from other C modules, namely my You can call Tcl from C (with Ns_TclEval, probably other ways too). I've done that in the past, and would normally recommend sticking with it unless and until it turns out to be too slow, or otherwise problematic. E.g., I started using Ns_TclEval to do nsv operations (nsv_set, nsv_get, etc.) from C, inside my own little C wrapper functions. Then some 6+ months later it turned out I sometimes needed to do nsv operations inside C loops, for which Ns_TclEval was too slow. So I changed my wrapper function to do everything in C rather than calling Ns_TclEval, which wasn't too hard. Of course you meant Tcl_EvalObjv()? -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
[AOLSERVER] Help in upgrading to 3.5
Hello, I just downloaded Tcl 8.4.9, compiled (--enable-threads) and AOLserver 3.5.11, since I want to switch to 3.4 or 4.0. I would have switched to 4.0, but we also use mysql, which does not seem to compile against 4.0.10 that I have. The issue is that from time to time AOLserver starts (3.4.2 has never made any problems) and sometimes it does not. It just prints this: [20/May/2005:11:18:30][1622.1024][-main-] Notice: random: generating 1 seeds When I break with GDB it claims that it is waiting for a signal in NotifierCreateProc. Can anyone tell me how do I deal with it? -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Help in upgrading to 3.5
Dossy Shiobara napisa(a): On 2005.05.20, Wojciech Kocjan [EMAIL PROTECTED] wrote: I just downloaded Tcl 8.4.9, compiled (--enable-threads) and AOLserver 3.5.11, since I want to switch to 3.4 or 4.0. First, you want to use /either/ Tcl 8.4.6 or Tcl 8.4.9.1 -- versions between 8.4.7 and 8.4.9 had a memory leak that's been fixed in 8.4.9.1. Ok, well once I get it up and running, then I'll work on correct versions. I remember that from this mailing list, though. I would have switched to 4.0, but we also use mysql, which does not seem to compile against 4.0.10 that I have. nsmysql can definitely be used with AOLserver 4.0 -- what OS/platform version are you trying to compile on, and what error are you getting? Sorry, I just had so much fighting over different AOLs that I messed things up. It did compile, and I switched to AOLserver 4.0.10 with Tcl It just prints this: [20/May/2005:11:18:30][1622.1024][-main-] Notice: random: generating 1 seeds When I break with GDB it claims that it is waiting for a signal in NotifierCreateProc. Can anyone tell me how do I deal with it? No idea ... I don't think I've ever seen that in my logs, but it's been so long since I've ran 3.4 or 3.5. Ok, well I switched to 4.0. It now starts up fine, but I am getting to a point where the system just hangs after some hours of testing. This is almost identical to the 3.5 issue, except in a different place (didn't gdb it though). It seems to lock completely, and I can only kill it with SIGKILL, it ignores SIGTERM or SIGINT. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Mass Virtual Hosting system for AolServer 4.0.x?
Xavier Beaudouin napisa(a): This is exactly what I was looking for... I just need to adapt it for LDAP and SQL... and add a callback to auto garbage collector old database stuff to get a TTL for cached hosts :) Well why don't you just change the cache type to timing out, just switch from Ns_CacheCreateSz() to Ns_CacheCreate() and it should work. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
[AOLSERVER] Cache timeout handling in 3.x
Hello, I've noticed that in 3.4.2 (the code is quite different in 4.0, so it's hard to say how it handles that), the cache mechanism tends to update expiration date when I call Ns_CacheCreateEntry on an existing entry. I wanted to have a cache that expires after at most 15 minutes, because I have data that can be changed from time to time, but is constantly requested by most webpages. After doing some testing it seemed to me that fetching the data (doing [ns_cache eval]) made the expiration date refresh and I wasn't able to do the following: catch {ns_cache create x -timeout 1}; set j 0; for {set i 0} {$i50} {incr i} {ns_cache eval x a {incr j}; after 700}; set j j was always '1', instead of about 20-30. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Mass Virtual Hosting system for AolServer 4.0.x?
Xavier Beaudouin napisa(a): Well why don't you just change the cache type to timing out, just switch from Ns_CacheCreateSz() to Ns_CacheCreate() and it should work. Thanks for the advice... :) Now I just need to code the ldap part :) How did googling 'tcl ldap' end up? I remember there is an LDAP interface, but not sure about one for AOLserver. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Mass Virtual Hosting system for AolServer 4.0.x?
Xavier Beaudouin napisa(a): Please tell me how http request is handled by aolserver, in which files I have to dig and how can I add it nicely to, I hope, integrate this functionality on next aolserver version if it is possible... ? Well, you can have a look at nsdqe (not really sure where you'd find it (www.zoro2.org/nsdqe-1.0.tar.gz is where I put it temporarily). This is my module which does a pretty funky thing - it uses Tcl for fetching virtualhost's root directory and then caches it. Once you update the database all you do is 'dqe_vh flush' so that the cache is flushed. I consider that quite effective and you can write any Tcl proc to do massive vhosting. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] The 'weird 0 length problems' revisited
Bernd Eidenschink napisa(a): It's similar the same like in this original thread: http://www.mail-archive.com/aolserver@listserv.aol.com/msg05617.html Every piece of content goes (finally) through ns_returnfile or ns_return (or rl_returnz). The most interesting thing is that after browsing through all the 0 length files are dynamic and bound through ns_register_proc or using filters. None of over 5000 entries were static files, although some of them were returned through ns_returnfile. On one bad day we had about 3.5% served 0-byte-requests. My average of empty files is about 0,5%. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Support for non-HTTP protocols
Jim Wilcoxson wrote: IMO it is not scalable to use connection servicing threads to spool output when the size of the output exceeds the socket buffer capacity. Doing I/O with non-blocking, event-driven threads also helps prevent DOS attacks. The trade-off is in memory usage: when a connection service thread does an ns_return, and the output exceeds the socket buffer size, you need to hang onto the buffer in memory somewhere while it is spooled by the HTTP I/O driver. The advantage is that the connection service thread can be off handling another request, but there is also a new resource to manage: spooled output buffers. For returning files, you can always work the way [fcopy] does - leave the fp open and when the socket is writable, read some more and send it. This wouldn't be too resource consuming. I've never seen too many HTML files above 100K (20s on a 57k6 modem anyone? :), usually the largest ones are static files. On average, my dynamic HTML code is usually 20-30K at most. The problem could be with people storing files as BLOBs, but then again they have to be read into memory and sent back to the client now as well... So this doesn't change much. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] ad_conn url cuts off after th #
Tracy Adams wrote: Any idea how to reference the COMPLETE URL? The # is cut by the browser. [EMAIL PROTECTED]:~$ netcat -l -p 8080 195.82.181.6 GET /test/a HTTP/1.1 Host: dq.pl:8080 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl-PL; rv:1.5) Gecko/20031007 MultiZilla/1.6.3.0d Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1 Accept-Language: pl,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive This is the url I entered in the browser. http://dq.pl:8080/test/a#b -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] SQLite
Bas Scheffers wrote: Hi, Has anyone done any work in integrating SQLite with the ns_db api? Might be an interesting project for 2 reasons: 1) There will be a simple DB again right out of the box, like the Illustra days and 2) it will be easy to write smaller, packaged apps that run out of the box on a plain vanilla AOLserver install, probably attracting new souls to the cause. Yes, I did that some time ago. It works, should be quite stable and handles schema changes without throwing an error (that is a quick hack involving doing all the query, storing it in memory and sending rows back without querying SQLite). I also did code to call Tcl functions from within SQLite. Unfortunately, I am low on time and C skills, otherwise I would give it a go soon myself... I put up my attempts on www.zoro2.org/_chwilowe/nssqlite-beta.tar.gz - if anyone would like to write some docs or something, please do so. ps. PHP5 also has sqlite. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] SQLite
Dossy wrote: Two people consitutes wide interest? :-) Two people asked. I wonder how many people would really be interested in nssqlite. If Wojciech doesn't want to support or maintain it, then yes, we can import it into SF CVS to make sure it's got a permanent place to live. But, it depends on what license he released the code under whether we're allowed to do so or not. Right, I never did write any license I release it on ;) It can be any licence that doesn't imply licensing issues on sqlite itself (so I guess GPL is out of question :-). Also I can support it if there is any interest. I did that as an experiment, never commented or documented anything, so it is far from being a nice package. Should I take some time to document things, clear the code up and do something about it? Is there any wide interest in using SQLite in AOLserver? BTW it also supports Tcl functions, I just don't remember how does it work :-) func_tcl.c has something to say on it ;) -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] SQLite
Andrew Piskorski wrote: If Wojciech doesn't want to support or maintain it, then yes, we can import it into SF CVS to make sure it's got a permanent place to Even if, hopefully, he does want to maintain it! Yes, as I said before - I can. I'd need to clean up the code, but when I tested it against 2.8.3, it was pretty stable (no memory leaks and a very nice speed). live. But, it depends on what license he released the code under whether we're allowed to do so or not. Oh, right, he didn't include any license in that beta tarball. Wojciech, could you tell us please if/how you want to license your code, if you'd like it kept in SourceForge CVS or not, etc.? Ok, I'll clean things up, license it as BSD. Does anyone know if sqlite 3.0.2 is stable or development release? I could try and adapt things to SQLite 3 since it looks like it supports datatypes. Anyone here is experienced with SQLite 3? (I use SQLite 2 extensively, but never dared to upgrade to 3.0 :) -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Virtual hosting under 4.x and default Host: header
Dossy wrote: How do people feel about this? Is glob matching wanted enough to incur that per-request cost -- only if you're configured for software virtual hosting, of course. Actually, my company is using a different approach to vhosting (I do this for docroot, but this method could be used here as well). We call Tcl proc for determining vhost-docroot relation. Since it would be WAY too slow to call Tcl proc on every connection, we have an Ns_Cache for storing docroots. There's almost no impact, except for a very small memory consumption. If one would cry over locking, then I suggest a two-level cache - per-thread one (no locking, more memory consumption) and global one. ps. This way we could even use a Tcl proc to resolve vhost-server. By default it would read nssock/servers section of the configuration. Tcl+cache should be faster than globbing on every request :) -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] DOC: How to set up Wikit under AOLserver
Dossy wrote: This might be useful for anyone not wanting to install cgi etc. and is a nice alternative to running in local mode (where external links don't work and the font is too small). Ah, yes. Since the Wikit documentation already covers the many non-AOLserver ways of running it, I didn't think it was really necessary to repeat that stuff (like running Wikit with the built-in wikihttpd). Try writing a handler that passes the request to a wikit running on another port. For example: proc ns_pass_request {localPrefix destPrefix} { set url $destPrefix[string range [ns_conn url] \ [string length $localPrefix] end] set data [ns_httpget $url] ns_return 200 text/html $data } ns_register_proc GET /wikit ns_pass_request \ /wikit/ http://localhost:8765/ This is just a short example, a proper one would pass both GET and POST correctly :-) -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Deallocating cache entries that contain dynamic allocations
David Pautler wrote: Ns_CacheCreateEntry http://aolserver.com/docs/devel/c/api/c-ch19.htm#536071 does not take a parameter indicating the expected size of the cache entry. Does this answer your question? Ns_CacheSetValueSz Overview Set value of cache entry and adjust cache size Syntax void Ns_CacheSetValueSz ( Ns_Entry* entry, void* value, size_t size ); -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Expect in AOLserver?
Andrew Piskorski wrote: I have an Expect script which I'm exec'ing from AOLserver. This works, and the inefficiency of forking doesn't really matter in this case. But it's annoying, as it means I can only communicate with the Expect script via command line arguments and stdin/stdout/stderr. I'd much rather just have the Expect Tcl API directly available in AOLserver. But is that in fact feasible? Is there any version of Expect which can be dynamically loaded into AOLserver (or plain tclsh for that matter), via 'package require', the modules list in AOLserver's config file, or some other such mechanism? For AOLserver 3.3, or 4.0? My guess is that you really should separate expect scripts from AOLserver. If you really have to, you can create a separate thread, communicate with it and have it do all the expect commands (to avoid some of thread safety :). Although it would be better to spawn another process and communicate via tcp/ip or perhaps using http (tclhttpd+expect should work quite nice :). I usually work with a separate thread, for example my antivirus scanner has a separate thread, which does [open |mks32] and communicates with it. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
[AOLSERVER] SQLite driver (was) Re: Are the weekly chats officially dead?
Roberto Mello wrote: - An SQLite driver (hopefully I'll get that working soon). This one is actually tricky. In order to use SQLite in production enviroment, you need to catch SQLITE_SCHEMA errors and reeval the query. If you want to experiment, here's my beta driver - http://www.zoro2.org/_chwilowe/nssqlite-beta.tar.gz It seems to work stable on my laptop... Even has no problems when another thread is doing CREATE TABLE/DROP TABLE - try doing the same with your driver ;-) It works faster than nsmysql, at least for me... The main problem is date/time/datetime... Yuck. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] SQLite driver (was) Re: Are the weekly chats officially dead?
Dossy wrote: On 2003.07.31, Wojciech Kocjan [EMAIL PROTECTED] wrote: It works faster than nsmysql, at least for me... The main problem is date/time/datetime... Yuck. Not to get all defensive, but are you saying the nssqlite driver is faster than the nsmysql driver, or that SQLite is faster than MySQL for what you're doing? No no no. I'm saying that SQLite is faster than mySQL. However, I did speed the driver up by some percentage (before that, SQLite+nssqlite it was comparable to mySQL+nsmysql :-). If the driver itself is faster, I'm curious how you did it. If SQLite is faster than MySQL for the operations you're interested in, well, that's not too surprising ... I'd have to do some heavy load testing to get some better idea whether it makes sense to use SQLite... Has anyone done it? -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Are the weekly chats officially dead?
Roberto Mello wrote: - Readline support for nscp. That would be quite hard, since readline also has to guess the terminal type and so on. Wouldn't it be much better to write nscp client in Tcl+readline or even Tk. I have a pretty generic ztelnet module, which I use to connect. It's pretty old and nasty, but proved that writing a quite simple socket/ssl connecting tool is pretty easy. Then adding command history ... and things would start working pretty well. Tk could also allow editing multiline commands - using [info complete]. I often do nested foreach loops so checking completeness helps me a lot. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Does AOLserver support Tcl VFS? Starpacks? [incr Tcl]?
Jeff Hobbs wrote: Greg Wolff wrote: Why do we need a MetaKit db driver? Eh, who said anything about needing one? It would be nice to have a db driver for metakit though. Not really, since db drivers are SQL based and MetaKit isn't. If someone wants an embedded database, then SQLite would be much better, and I'm working on nssqlite at the moment (including Tcl function support). The hardest part is working around SQLITE_SCHEMA error, which occurs on almost every database schema change done by any other thread/process. This requires either doing double Ns_StrDup+Ns_Free calls or messing inside Ns_Set structures... With double strdup, speed of usual operations is similar to mySQL 3.23. And using Ns_Set internals speeds the driver up at about 5-10%, depending on result size. I've tested it on from 10 to 100k entries (which isn't too much for a db, but many web applications do not require more :-). The AOLserver would clearly need the VFS for adp and tcl files. But if the database application were something like BerkeleyDB, which is thread safe and 2-phase-commit etc., then why use MetaKit as the *application* database? And who said we would? Metakit is a requirement for starpacks in general at this time, so you would need it one way or the other. Since it is already there, you could use it for other stuff. I'd actually advice considering SQLite for small and medium application database, especially if it is currently using mySQL. Despite the name and size, it has some quite powerful features - triggers, foreign keys and references, ability to run Tcl commands and many other things. The main disadvantage for many is that it is typeless - this is a PITA when working with DATE/TIME/DATETIME fields. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] weird 0 length problems
It seems that the problem still remains (and is even more interesting). After reading nssock sources, I realized that my checking if NS_CONN_CLOSED flag is set would not make things any better - since after doing close(), connPtr-socket is set to INVALID_SOCKET (to avoid writing to invalid streams, probably). Also, I noted that (very rarely) my email messages seem to arrive blank. Since I do [catch] around most smtp::sendmessage statements, the logs do not show any error messsages. But my guess is that something (probably not AOLserver itself) is doing close() or shutdown() on invalid sockets, which causes the problems. This can't be any Tcl code, since Tcl only allows closing channels created by Tcl. Another question that comes to my mind. I do Ns_RegisterFilter on NS_FILTER_PRE_AUTH, that occasianally does Ns_ConnRedirect() and returns NS_FILTER_RETURN. Could this cause any problems? - in theory, it does about the same. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] weird 0 length problems
Dossy wrote: I've been wondering about this and decided to review some of the code that is called in my AOLserver. There seems to be a wrong manner of coding that sometimes there is somefile.adp which does % ns_returnredirect /someotherfile.adp %. It does not always call ns_adp_(abort|break) - this is a big simplification. Anyway, what I guess is that first the redirect is sent, and then the adp handler tries to returns the rest of the ADP file. The problem could be (I'm only guessing :) that this could happen: thread1: 1/ accept() returns a new socket (ID=3) 2/ ns_returnredirect sends the response and closes socket 3 3/ parser returns the response (to socket 3) and closes the connection thread2: 1/ accept() returns a new socket (ID=3) 2/ something returns the response and closes the connection If thread1's 3/ would execute between thread2's 1/ and 2/, this could cause the socket being closed with 0 length result and similar problems. I've read 3.4.2 code and it seems that Ns_ConnClose sets NS_CONN_CLOSED flag, however no other function even uses the flag. I want to work around the problem by adding a sanity check on the NS_CONN_CLOSED flag, so that I can see if this is the problem. Are there any side effects I can encounter by checking this flag? ps. The situation is far more complicated. I do ns_register_url and then do ns_return 200 text/html [ns_adp_parse -file /somefile.adp] and then I cannot simply do ns_adp_break/ns_adp_abort - this throws an error. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] weird 0 length problems
Wojciech Kocjan wrote: From what I'm logging, AOLserver seems to get correct data to Ns_ConnReturnData(). I've nailed down the problem to Ns_WriteConn() not returning NS_OK. And that is caused by (*connPtr-drvPtr-writeProc) returning -1, don't exactly know why. I guess I should look at nssock module now? Ok, got to ns_sock, which calls Ns_SockSend(), where send() return EPIPE (32). This is very very weird. Ok, I'm not going to try deeper (in the kernel source :-). Could anybody please tell my when send() can return EPIPE error? -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] weird 0 length problems
Zoran Vasiljevic wrote: On Monday 07 July 2003 11:45, you wrote: Ok, I'm not going to try deeper (in the kernel source :-). Could anybody please tell my when send() can return EPIPE error? When writing to sock and nobody's listening on the other end. Zoran Ok, then why does mozilla/ie show up an empty page (some IE probably show http headers at that moment - i mainly use mozilla so I haven't seen that :). Also, that shouldn't happen with ab. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
[AOLSERVER] weird 0 length problems
Hello. My AOLserver is getting a lot (about 50) requests that it serves with Content-length of 0. Most of the times, people just do reload and it serves the exact page correctly. It happens very rarely (50 times for about 20 000 requests). I'm wondering how to find the bug, since I use much C code and even more Tcl code of my own. Also, I noticed that this happens only to dynamic pages - either ADP or registered using ns_register_proc. I doubt if anyone had similar problems, so I'm wondering on how to track down the problem with this bug. Here's a sample from nslog access file: XX.XX.XX.XX - - [06/Jul/2003:09:30:00 +0200] GET /popup/14 HTTP/1.0 200 0 http://www.enposi.pl/produkty/Dyktafony; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) XX.XX.XX.XX - - [06/Jul/2003:09:30:02 +0200] GET /popup/14 HTTP/1.0 200 2873 http://www.enposi.pl/produkty/Dyktafony; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Linux 2.2.20, AOLserver 3.4.2, Tcl 8.3.4. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] weird 0 length problems
Dossy wrote: On 2003.07.06, Wojciech Kocjan [EMAIL PROTECTED] wrote: My AOLserver is getting a lot (about 50) requests that it serves with Content-length of 0. Most of the times, people just do reload and it serves the exact page correctly. It happens very rarely (50 times for about 20 000 requests). Do you have any errors in the server.log that correspond to the 0 byte requests? No. That's what I thought of first. Perhaps there's a bug /somewhere/ that only sporadically causes a Tcl error that goes uncaught. I doubt it. Too much dynamic pages cause this error. Do you have an errorpage defined? No. When I develop and Tcl throws an error, I see 500 internal error. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] weird 0 length problems
Jim Wilcoxson wrote: The thing is I can't reproduce it, even when doing ab on both the same host and another one on a 100MBit LAN. I've hit about 3k hits and nothing. You are sending concurrent requests, right? I've tried from -c 5 to -c 20, on both machines (so that gives from 10 to 40 concurrent requests). -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Native drivers for SAP DB and/or Firebird
Radu-Mihail Obada wrote: Hey everyone, Just curious if there are any native drivers for SAP DB and/or Firebird, cause I'm intending to deploy a three-tier solution based on (preferably) a SAP DB backend (or Firebird, for that matter). SAPDB uses ODBC as *native* api, so you should probably ask about ODBC drivers. I'm not an expert on those, however, so I won't help you much. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Ns_TclAllocateInterp(), Ns_TclDeAllocateInterp() and nscp
Ok, I've narrowed down the problem. I'm calling Ns_TclAllocateInterp() from a callback in SQLite. I want to write SQLite functions using Tcl, which should be pretty easy. The problem is that I do not know the Tcl_Interp that called 'ns_db select'. Things get complicated when current thread has no connection (otherwise I can get an interp using Ns_ConnGetInterp()). Anyway, the problem is that Ns_TclDeAllocateInterp() does cleaning up, which also happens to delete all connection handles and local variables. Here's an example: test8008:nscp 1 set h [ns_db gethandle sqlite]; set s [ns_db select $h SELECT 1]; while {[ns_db getrow $h $s]} {} ns_set free $s test8008:nscp 2 set h [ns_db gethandle sqlite]; set s [ns_db select $h SELECT NOW()]; while {[ns_db getrow $h $s]} {} ns_set free $s could not allocate 1 handle from pool sqlite So the real question is do I always have to call Ns_TclDeAllocateInterp? From the 3.4.2 sources it seems that it only does some cleaning up, so there shouldn't be any problems and there aren't any refcount checks. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] Bytecode-compiled Tcl question
Alexander Leykekh wrote: You cannot share Tcl objects across threads - not even lists, ints and strings. I had no idea... How should I deal with that string object's garbage collection? Perhaps I shouldn't call Tcl_IncrRefCount on it and that's enough to prevent a leak. Actually, if you don't call IncrRefCount, you will probably get some error somewhere - since refcount can't go to -1, at least in debugging mode in Tcl 8.4. If you don't DecrRefCount, you will leak, but probably be ok. Another question: is it OK to share Tcl interps between threads? No. It is not OK - an interp (as well as any Tcl_Obj) is bound to a thread (note - Tcl_Obj is bound to a thread, not an interp :). If you really need to execute bytecode, then consider: 1/ using a separate thread only to create and delete Tcl_Obj - this should work a bit better, but not sure if it will work now and if it will fail in future Tcl releases (this is very tricky) 2/ using a separate thread to evaluate the bytecode - when using Tcl 8.3.4 and 8.4.x, you can easily use Tcl_Async* to communicate between threads. It's not hard, the only problem is that you cannot send (well, sometimes you can, but it's a hack and shouldn't *ever* be done) Tcl_Obj across threads, so it will cause a large slowdown if you plan on working with larger (over 1000 elements) lists. Otherwise, you'll be ok by using Tcl_GetStringFromObj(), cloning and sending that. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] aolserver + php
Micha Nasiadka wrote: is segfaulting, while trying to use phpmyadmin, so I think it's something linked to mysql connectivity from php. Tried changing stacksize, tried even the devel versions of php, no luck. Can anybody help? What did you set your stacksize to? I believe it was 512*1024. What version of linux are you running.. at one point one of the up2date upgrades on one of the dns libraries on redhat caused serious memory issues and caused segfaulting on dns lookups especially with php running FreeBSD 5.0-RELEASE it is. And php works fine, if I don't use mysql functions from it. Seems I've got to send a bug report to php.net ;) Just a quick thought. Perhaps do a ldd on mysql.so in php, libphp4.so and libmysqlclient (the one used in mysql.so). -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
[AOLSERVER] sqlite and AOLserver
Hello. I've been wondering if anyone has tried to use SQlite with AOLserver. I've noticed that, when compiled with threads enabled, it should be thread-safe: SQLITE_BUSY This return code indicates that another program or thread has the database locked. [cut]. Locking in SQLite is on the entire database. This of course means that if I get SQLITE_BUSY, I should just wait for some time and try the query/exec again. If noone has tried to write sqlite driver for nsdb, then where can I read more on how to write one myself? sqlite api seems pretty straightforward. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] Bytecode-compiled Tcl question
Alexander Leyke wrote: Hello, I am getting a SIGABRT when evaluating string objects in AOLserver 4.0 b6. The pseudocode is: [cut] Tcl_DecrRefCount (obj) /* NOTE: this statement happens later, and in a different thread */ You cannot share Tcl objects across threads - not even lists, ints and strings. -- WK -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] AOLserver Improvment Proposal
Tomasz Kosiak wrote: Few days ago there was a post from Jerry Asher titled [AOLSERVER] virtual hosting options and a fantasy mentioning my proposals. I would like to present them fully to the public. This indeed is a big problem, even bigger since from what I see every company using AOLserver for multiple websites is using custom solutions. I'll investigate your patches later and see what I think of those. For now, here's my story :-) I also came upon such problems, however I've decided not to patch the core in any way (at least not for these problems :). I've came up with a couple of solutions, that really make my life easier: 1/ virtualhosting (some of you may know my module called nssmartvh): I've worked out some C code that calls Tcl for host-docroot conversion (so that writing custom schemes is not hard at all). This allows me to do simple mappings like: www.mobile-netsport.pl - /var/www/stable/mobile-netsport www.dq-e.com - /var/www/stable/dq-e I've also done an external config file which holds all the rules of host-docroot conversion. This allows me to work on *.dqe/*.adp files and static files. 2/ custom urlspace and mod_rewrite like module This one is coded in C, and works in two parts: 2.1/ url_rewrite: This part allows me to rewrite paths to files (in url2file) based on uri and host. For example I can do this: test.mobile-netsport.pl/ - /var/www/stable/mobile-netsport/test.adp test.mobile-netsport.pl/* - /var/www/stable/mobile-netsport/* 2.2/ url_filter redirect This one is the trickiest part. It allows me to redirect requests based on host and uri: For example for dq-e.com /test can be rewritten to /test/index.adp It can also be used a substitute to 'index.php/1'-like urls. 2.3/ tcl_obj aware cache'ing Since my company uses db caching extensively, I've decided to write nscache-clone, which would allow storing lists in some tcl-neutral way (similar to tsv in thread extension) so that it can be shared between threads and not stored as a string. It uses two-level cache - one global which stores data in a custom way and thread-local caches which store data s Tcl_Objs with refcount=1 (Tcl_DecrRefCount() is done when an entry is flushed so it does not leak memory). 2.4/ session support C+Tcl code for storing sessions with built-in authentication and user related code. All of this is available at www.dq-e.com/nsdqe/nsdqe1.0.tar.gz 2.1 and 2.2 all consider the same problem as Tomasz mentioned - AOLserver does not handle real vhosting well. I agree that his improvements should be done - though I think they should be done as other commands and work on domain groups - something similar to tags in Tk's canvas/text. I also think that some standard modules should be bundled with AOLserver - session management, rewrites (those can be quite easily be written in Tcl, but it all takes time :). I also think that AOLserver should include some code to manage multiple code bases - something between package require and modules/tcl/; a code that can be dropped when idle to save memory. -- WK (written at Stardate 57189.5) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram I. To remove yourself from this list: Send a message to [EMAIL PROTECTED] with the following text in the BODY of your message: signoff aolserver II. For a complete list of listserv options please visit: http://listserv.aol.com/ III. For more AOLserver information please visit: http://www.aolserver.com/
Re: [AOLSERVER] Tcl bytecode caching for Tcl pages
Bas Scheffers wrote: Makes sense. So what is cleared up in the interpreter after each request? Looking at the slides, there is a command table and a variable table. Looking at Wojciech's post, it seems any procedures created/packages loaded in the current interpreter stay there, is that correct? From what I noticed, procs stay, variables not, however nothing outside global namespace is cleaned up. This is imho good, since packages can store data in namespaced variables. I think it would be reasonable to develop some package loading/saving feature. I could code one (better one than I have now) in C (speed issues), but never had the time. My current ns_pkg is at www.nsstuff.zoro.tcl.pl, if anyone's interested. And what about variables, are they preserved as well or cleared out? Is there ane special consideration for any namespace variables? (ie: $::foo::bar) This one showed that no namespaced variables are cleaned up by AOLserver % namespace eval z {} % ::a %=[info exists ::a]%BR ::z::a %=[info exists ::z::a]%BR % set ::a b % % set ::z::a b % After about 100 requests the results were: ::a 0 ::z::a 1 (at the beginning it was 0 0) -- WK (written at Stardate 57153.5) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram I. To remove yourself from this list: Send a message to [EMAIL PROTECTED] with the following text in the BODY of your message: signoff aolserver II. For a complete list of listserv options please visit: http://listserv.aol.com/ III. For more AOLserver information please visit: http://www.aolserver.com/
Re: [AOLSERVER] Tcl bytecode caching for Tcl pages
Bas Scheffers wrote: Cool. Question still remains which is faster, cached .tcl pages or a heavy master interpreter. Would be interesting to see. May have a play with that over the next few weeks. I played a bit with bytecode speed issues on AOLserver as well. Tested on 3.4.2 with 8.3.4. First of all, only using libtbcload.so and bytecompiling most of my modules/tcl/, I managed to get a 10% better performance using ab. This needs to do more testing, since I guess it only matters if you start enough threads. Also, I figured out a solution that I am quite happy about. I host many sites written for AOLserver in Tcl. The solution I used was to write a command (for now Tcl, but it could be rewritten to C :), for example 'ns_pkg load somepkg'. It checked if somepkg is loaded, if so, if mtimes match (if something is modified, directory's mtime is changed :), if they match, it does nothing. Otherwise it loads the package (only in current interpreter). It also counts bytes and has a limit of loaded packages - if the limit is reached, some unused packages are removed. Removing means namespace delete, since every package must be in a namespace. The solution proved to be pretty good. It could use bytecode compiling when it is loaded in 1 interpreter, but it works pretty quick without it. The main problem is memory... It consumes a lot more than without it. -- WK (written at Stardate 57153.3) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram I. To remove yourself from this list: Send a message to [EMAIL PROTECTED] with the following text in the BODY of your message: signoff aolserver II. For a complete list of listserv options please visit: http://listserv.aol.com/ III. For more AOLserver information please visit: http://www.aolserver.com/
[AOLSERVER] Weird SEGV
I just got a very weird SEGV, which is caused from time to time by a Tcl-only script. Any ideas what this could be? AOLserver is 3.4.2-dq4 (Tcl8.3.4 and some minor modifications - no important changes from 3.4.2 expect 8.3.4 I suppose). #0 0x080cb369 in Tcl_NextHashEntry (searchPtr=0xbc7ff884) at ./../generic/tclHash.c:279 #1 0x080cb30a in Tcl_FirstHashEntry (tablePtr=0x88b3cc0, searchPtr=0xbc7ff884) at ./../generic/tclHash.c:239 #2 0x0808f7a4 in FreeSets (arg=0x88b3cc0) at tclset.c:909 #3 0x08086d05 in CleanupData (tdPtr=0x87868f0) at tclinit.c:1358 #4 0x08085814 in Ns_TclDeAllocateInterp (interp=0x0) at tclinit.c:446 #5 0x0807f394 in NsConnThread (arg=0x8791990) at serv.c:700 #6 0x0811dbe1 in NsThreadMain (arg=0x86c0818) at thread.c:228 #7 0x40027d53 in pthread_start_thread () from /lib/libpthread.so.0 #8 0x40027d99 in pthread_start_thread_event () from /lib/libpthread.so.0 -- WK (written at Stardate 57112.0) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] Need pointer to docs please
Michael Teter wrote: I'm looking at Aolserver, and I can't seem to find documentation on session management. AOLserver has no native sessions, but I wrote a C module that does this (among other things): http://www.dq-e.com/nsdqe/nsdqe1.0.tar.gz It works that it does not force you to accept cookies - if you won't accept it at the first time, it won't send it again. -- WK (written at Stardate 57021.3) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] Rewrite URL module ready for review
Tom Jackson wrote: Rob Mayoff's original nsrewrite module now has documentation on use. I would like to add this to the list of AOLserver modules available from SourceForge, assuming there is interest. Anyone wishing to review the files in this module can visit the temporary home at: Here's something also worth interesting: http://www.dq-e.com/nsdqe/nsdqe-1.0.tar.gz (no HTML page about it at the moment, sorry) Besides nssmartvh-like vhosting, it also has filters, which allow doing cool stuff like rewriting /getpdf/somefile.pdf to /__tcl/getpdf/somefile.pdf I use it along with a module that adds ns_register_proc to __tcl, which calls a .tcl file in the webroot directory (which is hostname-dependant :)... It also features neat stuff like sessions written in C and some other utilities. -- WK (written at Stardate 56997.9) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] How to remove unsafe commands?
Bernd Eidenschink wrote: Well, the line above, if uncommented, creates a (big) file which holds all procs sourced in after startup. Is it a bad idea, maybe before use on the production system, to let AOLserver create the file, byte compile the procs, adding load libtbcload... and sourcing this file instead of running through the process every time? No, it's not a bad idea. What do you mean? What exactly are you trying to achieve? Would that help speed up things? About 10% in thread initialization, yes - this is what I got after using tbcload in initialization of my custom modules. The main idea, however, was to hide the Tcl code used in AOLserver, since it was designed so that it would run on other servers... This won't, however, be noticable under normal or heavy load, since threads are initialized as rarely as possible, and procs are bytecompiled internally during their first execution (or even when calling the 'proc' command - don't remember :). Would it hide all procs from the info vars/procs/body... command to make it (more) difficult to inspect vars, procs and environment at runtime? You can inspect vars, procs and environment if you have the 'info' command. You could, however, rewrite info not to report some things. It is a bad idea, however, to do so. If you want to host AOLserver based webpages, then you could consider this solution: 1/ write custom ADP parser that (or use nsdqe which calls Tcl command to parse ADPs - www.zoro2.org/dqe-1.0.tar.gz) will switch % some stuff % to 'slaveeval {some stuff}' or %=$a% to slaveeval {ns_puts -nonewline $a}. 2/ write slaveeval to determine which slave interpreter to use (I would use [ns_url2file /] :), then if it's not in this thread, create it. 3/ thread creation is a very hard thing to do - you could set up some security policies - ie which interpreters can use db pools, write/read files and so on. You could consider using interp create -safe and then write your own open/file/info and so on to provide things. This would get a *lot* easier with Tcl 8.4 and it's file nativename... -- WK (written at Stardate 56912.4) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] ns_socklistencallback
Tom Jackson wrote: David Walker wrote: I want to support a reasonable number of concurrent connections. I am running a tcl based SMTP filter/server based on the smtpd in tcllib. I am converting it to run within AOLServer. Can ns_socklistencallback push the conn to another thread or will I have to use ns_socklisten, ns_sockaccept, and ns_thread? I thought that ns_socklistencallback provided a separate thread for each connection, maybe that isn't true, but it should still be able to handle multiple connections at the same time. Did you do testing that indicated otherwise? It does not unless you patch it. I have my AOLserver (3.4.2-dq4) patched against that (and switched Tcl to 8.3.4). It is available from www.dq-e.com/aolserver/ in case somebody's interested. If you really need separate processing threads, I have used two threadpools, using Rob Mayoff's dqd_threadpool module. From what I've tested, it looks like ns_thread begindetached actually grabs available threads from the pool... So using thread 2.5 (once Zoran gets it done) to implement thread pools inside AOLserver would be like reinventing the wheel. I even tested it with gdb+nscp: dq:nscp 1 time {ns_thread begindetached {ns_sleep 1}; ns_sleep 2} 10 And gdb running 'dq' AOLserver did not notice any new threads. The thing I miss most, however, is that there is no SSL equivalent that would be creating threads on every accepted connection. One pool is for worker threads, and one (with one thread) serialized access to a single fd. You have multiple fds, so you probably don't need the second pool. Actually, why the second pool? I once used a master thread and slave threads. I hope, someday, we will have a module that generalizes the ns_conn module: allowing optional url support, but not specific to the http protocol. For lack of a better name I'm using ns_tcp and ns_udp. So the day someone invents the next great protocol, AOLserver will be the programming environment of choice. Dream on ;-) -- WK (written at Stardate 56909.3) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] using aolserver for mail
Gabriel Ricard wrote: Ok, this may be a totally crazy idea that's completely unnecessary, but here it goes: It's necessary - I've never seen any smtpd that would have Tcl embedded :( Exim has Perl. We should have Tcl! :-) I want to have a high performance mail server that's easy to configure for use in our system at work. Currently we're bound to apache/php and such and our mail server is Exim. Exim is a great mailserver, but it's not terribly fast, at least in our setup, for delivering large batches of messages. (we send out about 3K email updates in the morning and few hundred every hour or two during the day). I guess it's kind of like the Apache of mail servers. It can do lots of stuff, and it performs well, but it's a PITA to setup. Exim is quite cool, but handling outgoing mail ... PITA ... :) So, what I'd really like is a multi-threaded mailserver, that is simple to setup, can interface with code (to handle email sent to certain addresses), and can talk to our database (currently MySQL). Now, thinking about it, that's exactly what AOLServer does for HTTP traffic, so why can't I use AOLServer for my SMTP traffic as well? I could have a module that maintains a pool of threads to handle mail, it can authenticate or grab aliases and domains from my database, and I can even setup special email addresses to handle bounces with a tcl proc. H. Kind of a cool team project, when you think of it. Could work either using Thread extension or AOLserver :) So, has this been done already? Or even thought of? Is it possible? We use some of it internally - www.dq-e.com/nsmail :) It's more of a POP3 server, but I guess it could be expanded to handle SMTP as well. It's not exactly what you thought. We use exim to deliver outgoing email and a transport for delivering email to AOLserver - it leaves a file in /usr/local/aolserver/mail/incoming and sends out a HTTP request for http://localhost:8008/nsmail/notify to deliver the email:) Or am I just nuts? Thought about it some year ago :) Ended up with an exim+AOLserver hybrid. -- WK (written at Stardate 56882.9) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] nsopenssl issue you need to be aware of
Scott S. Goodwin wrote: The nsopenssl module should *not* be loaded more than one time in a server. I have received reports of corrupted data being received when the receiving SSL server has more than one copy of nsopenssl loaded, while using the ns_httpspost command. Other nsopenssl Tcl and C API commands are probably affected. Could you add a feature to bind to every address parameter? I load nsopenssl twice to bind to two addresses. -- WK (written at Stardate 56816.9) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] nsopenssl issue you need to be aware of
David Walker wrote: If nsopenssl is the only SSL on that box you should be able to use 0.0.0.0 and bind to all addresses. Apache binds to one IP and AOLserver binds to two IPs. I'll just switch to iptables' redirection for now... -- WK (written at Stardate 56816.9) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] read nsd command line from nsd.tcl?
Andrew Piskorski wrote: Is there any good way to access the command line that AOLserver started with from the context of the nsd.tcl config file? It would be nice to be able to set different config settings based on nsd command line options. I'm only guessing, but have you tried 'env' variable or command? It should be helpful to pass arguments to the AOLserver. Also, you could write a config that uses some variables defined in another config. ie set ip 1.2.3.4 set host zoro2.pl source /root/realconfig.tcl where in realconfig.tcl you would do ns_section .../nssock ns_param address $ip -- WK (written at Stardate 56810.9) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] [ANNOUNCE] nsdqe pre-release 0.9
Hello again. I resent the code (www.zoro2.org/dqe-0.9.tar.gz). There were two bugs I found just today (that's what happens when I do things in a hurry :). If anyone has downloaded it and it either crashed or dqe_enc didn't work, please download again and recompile. Hope I'm not trashing the mailing list :) -- WK (written at Stardate 56750.5) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] Two modules for AOLServer available
Roberto Mello wrote: Wow, this flurry of modules for AOLserver is fantastic! Keep'em coming, and thanks for your contributions. I'm on my way with a quite useful module myself. This will take a week or two, as I want to clean up the code a bit - it was used internally for now. It will allow some of these: - host based vhosting and file aliasing - file/socket detaching (*HARDCODED* - Tcl =8.4 checking will be added in the near future) - i18n support (Utf-8 and other encodings handling) - Tcl based ADP parsing (I'm using it for all of my dynamic pages!) - URL based statistics - mostly for testing benchmarking dynamic pages - async handlers (allows Tcl_Async*() based multithreaded communication) (*REQUIRES* Tcl 8.3.4 or 8.4) - misc utilities I guess the most important part will be the new vhosting and Tcl based ADP parsing. On Sat, Sep 28, 2002 at 03:23:50PM -0400, Vlad Seryakov wrote: Hello, I have two modules for Aolserver: nsmain - IMAP interface, can be used as IMAP client That's excellent. Out of curiosity, why nsmain instead of something like nsimap? I second that question :-) nssnmp - SNMP interface, can be used AS SNMP client, supports ICMP as well Hmm, I can see all sorts of interesting applications for this. Again, out of curiosity, what have you een using it in production for? Could you add some DNS support as well? I use scotty for SNMP, ICMP and DNS, but would gladly move to a NS based library. -- WK (written at Stardate 56745.0) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
[AOLSERVER] NTPL on Linux
Hi. I've just read some text about Ulrich Drepper's new implementation of posix threads on Linux. It's not stable, but still did anyone test it? I read it can start and stop 100k threads in 2 seconds on an x86 box. It requires 2.5.36 kernel, glibc 2.3 beta and gcc 3.2, so I can't test it on any of my boxes - don't have a testing machine at the moment and I don't want to make my laptop too unstable... I'm just wondering if anyone has tried AOLserver on it, if it runs, causes problems and/or SEGV. Also I'm wondering if it will speed things up on higher loads - does AOLserver 3.x rotate threads after some requests? Wouldn't make too much sense to me. Also, how often does AOLserver begin new threads? -- WK (written at Stardate 56728.4) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
[AOLSERVER] Potential problems using open |?
Hi. Our company runs one AOLserver instance which is mainly used (almost no HTTP requests) for handling email messages. We want to use mks_vir (a virus software very popular in Poland), which we would use doing set handle [open |mks32 --filelist-on-stdin a+] and then send the actual filename upon receiving an email (which is actually sent via a temporary file - so we would just send mks the filename). I'm however wondering about possible problems with fork'ing the mks process? Some memory issues? Potential problems? -- WK (written at Stardate 56684.6) Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
[AOLSERVER] Ns_TclEnterSet() question
Hello. I'm writing a C-Tcl application, where I'd like to exchange data from C to Tcl. I want to have some sets, which will store session data (actually, not exactly, but close :). I want to store them in C, but sometimes make them acccessible from Tcl - for connection time. Which flags should I give so that at close, AOLserver will Ns_TclFreeSet() but not the actual Ns_Set? Or do I have to register a Ns_AtClose() and free Ns_TclFreeSet() every set I've created? (this won't be too hard, I guess, but still I'd rather not reinvent the wheel) -- WK Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
[AOLSERVER] If anybody's interested - AOLserver/3.4.2-dq4 available for download
Hello. If anybody's interested, my company has finally produced an usable version of AOLserver, based on 3.4.2. The version includes: - Tcl 8.3.4 (many thanks to Zoran Vasiljevic) - tclsock.patch - allows writing mulithreaded tcp daemons - tclsock.patch bugfix, which caused SEGV when a detached thread tried to access already freed memory - a patch to nsd/binder.c and nsd/listen.c that allows listening to addresses other than 0.0.0.0 using ns_socklistencallback It's available for download at www.dq-e.com/aolserver -- WK Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] 28,000 hits per second, how many servers of what kind again?
Peter M. Jansson wrote: The big secret to tuning AOLserver is that there isn't much to tune. There's minimal gain to be made by increasing the transmission buffer sizes in nssock, and you can play with the MaxThreads, increasing it until contention begins to dominate your timing. I've never tuned my AOLserver and it works fine for high load (we get that from time to time). Most people I've encountered trying to tune AOLserver are saddled with slow applications which really don't respond to tuning. For this I've written a small benchmarking module. I've rewritten the adp parser to add something like '% adpbenchmark begin %' at the beginning of the file, then registered a trace filter and used Ns_GetTime+Ns_DiffTime to get the time difference. In order not to overload the memory, I used Ns_CacheCreateSz() and used it for storing data on files - it is 1MB size and each entry is 24 bytes long. This helps in checking which dynamic pages require a lot of time to render them. A bit offtopic, but how do I register any filter that is called *before* a request is parsed and evaluated? I tried pre_auth and trace with % ns_sleep 2 % but the time difference was not even near 1s :( -- WK Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] file upload vulnerability in AOLserver
Tom Jackson wrote: Details, including potential replacement functions which block the vulnerability can be found under http://zmbh.com/aolserver-vulnerability/ Have you (or anyone) tested it for potential incompatibility and/or problems? -- WK Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] New module for AOLServer : share TCL channels across interpreters
Jean-Fabrice RABAUTE wrote: This module allows you to open a channel (socket or file) and detach it to the current interpreter that it becomes global and can be used with all the scripts. [cut] So I can do ns_thread begindetached, then do socket -server ... (not the ns_socklistencallback) and then transfer it to another thread? :-) For example can I use 10 threads in 'vwait forever' loop and transfer channels across these threads without problems? This is very important to me because my AOLserver sometimes handles over 200 connections and I want to have some threads managing them (but not 200 :-). Does it work on 3.4.2 and Tcl 8.3? To finish, just a question : Is there a graphic module (in C ot TCL) for AOLServer to manipulate images (create on the fly, draw, automatic resize, automatic thumbnail creation, etc...), like the one in PHP with GD ? If not I will perhaps try to plug the GD Graphic Library as an AOLServer C module. nsgd. I use it to render PNG server statistics for over 6 months. It is a conversion of the tcl gd library. -- WK Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] Prospective user needs a nudge in the right direction
Glen Lee Edwards wrote: I've been using Apache but am shopping around. I have several IP addresses on one machine. Can I install AOL server for testing purposes, and run it concurrently with Apache, but bind it to listen to an IP address that Apache isn't listening to? Yes. Use Listen with Apache (and bind the addresses you don't want to use for AOLserver), and nssock from AOLserver (it normally binds to just one IP address). I'd like to run it for a time to see if it's going to work with my current setup. I could move the virtual domains over gradually if I can run Apache and AOLserver simultaneously. Then you'll probably need a vhosting module. Try www.nsstuff.zoro.tcl.pl and see nssmartvh. It's a bit tricky to set up, but seems to work fine for a year or so for me... Will AOLserver work with PHP? Either as CGI or as a module. It should work without bigger problems once set up. If not, are there any MyPHPNuke-type forums that will work with the AOLserver? www.openacs.org -- WK Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] Virtual Hosting in AOLserver
You might want to use my module: http://www.nsstuff.zoro.tcl.pl/project.h2x?pr=nssmartvh I remember it had no docs some time ago, but now I fixed the problem. ÕÅÏþº£ wrote: Hi,all, I want to install another website to my aolserver. How can i config the sample-config.tcl in my aolserver and how can i do to avoid affect to the original one? Thanks a lot. -- WK Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram
Re: [AOLSERVER] AOLServer corrupting Form data
Hello. I have the same problem here in Poland. I wrote a quickhack that does the trick in C. It creates ns_utf8 Tcl command which I use to convert from external to utf and back. I use this way: Instead of set text [ns_queryget text] I use set text [ns_utf8 eu [ns_queryget text]] Now it is utf-8 encoded (not with the proper encoding though - I should use iso8859-2 :), so Tcl can safely operate on these strings. For example set subtext [string range $text 1 end] Then, when I want to return it to the browser: %=[ns_utf8 ue $subtext]% Note that you'd not be able to do this properly for non-latin text without ns_utf8... Also, when AOLserver will finally handle utf-8 correctly, you can just write a dummy proc ns_utf8 {mode text} {return $text} It's a quickhack, but works well. -- WK Data typing is an illusion. Everything is a sequence of bytes. -Todd Coram #ifndef USE_TCL8X #define USE_TCL8X #endif #include ns.h #include tcl.h int Ns_ModuleVersion = 1; static int main_tcl_command (ClientData dummy, Tcl_Interp *interp,int objc, Tcl_Obj *CONST objv[]) { char *cmd; char *v; int l; Tcl_DString ds; Tcl_Obj *rc; Tcl_Encoding te; if (objc!=3) { return TCL_ERROR; } if ((te=Tcl_GetEncoding(interp,NULL))==NULL) { return TCL_ERROR; } Tcl_DStringInit(ds); cmd=Tcl_GetString(objv[1]); v=Tcl_GetStringFromObj(objv[2],l); if (!strcmp(cmd,eu)) { Tcl_ExternalToUtfDString(te,v,l,ds); } else { Tcl_UtfToExternalDString(te,v,l,ds); } Tcl_FreeEncoding(te); if ((rc=Tcl_NewStringObj(Tcl_DStringValue(ds),Tcl_DStringLength(ds)))!=NULL) { Tcl_SetObjResult(interp, rc); Tcl_DStringFree(ds); return TCL_OK; } else { Tcl_DStringFree(ds); return TCL_ERROR; } } int ns_utf8_tcl(Tcl_Interp *i, void *c) { Tcl_CreateObjCommand(i, ns_utf8, main_tcl_command, NULL, NULL); return TCL_OK; } Ns_ModuleInit(char *hServer, char *hModule) { Ns_TclInitInterps(hServer,ns_utf8_tcl,NULL); return NS_OK; }
Re: [AOLSERVER] nsv API in C ?
You should use the following: static int BB_NsvSet(const char *nsvString, const char *keyString, const char *valueString) { Tcl_Obj *o[4]; o[0]=Tcl_NewStringObj(nsv_set,7); o[1]=Tcl_NewStringObj(nsvString,-1); o[2]=Tcl_NewStringObj(keyString,-1); o[3]=Tcl_NewStringObj(valueString,-1); Tcl_IncrRefCount(o[0]); Tcl_IncrRefCount(o[1]); Tcl_IncrRefCount(o[2]); Tcl_IncrRefCount(o[3]); Tcl_EvalObjv(interp,4,o[0],0); Tcl_DecrRefCount(o[0]); Tcl_DecrRefCount(o[1]); Tcl_DecrRefCount(o[2]); Tcl_DecrRefCount(o[3]); } This one uses Tcl objects (it won't work with 7.6 Tcl :), the main advantage is that it will set strings with quotes - like BB_NsvSet(a,b,\); Your code will fail with this one. Don't know about speed performance though. Andrew Piskorski wrote: Folks, has anyone implemented a C NSV API, or does anyone plan to? Clearly the right thing to do would be to move the functinality in aolserver/nsd/tclvar.c into C API functions, and re-implement the nsv Tcl commands to that C API. But since I needed to use some nsv commands from C, and I was in a hurry, I just kludged up my own C NSV functions using Ns_TclEval, like the example below. So has anybody done this in a less kludgy fashion? Also, any guesses as to what sort of performance hit I'm taking by using Ns_TclEval? static int BB_NsvSet(const char *nsvString, const char *keyString, const char *valueString) { static const char func_name[] = BB_NsvSet; Ns_DString dsScript; Ns_DString dsResult; int rc; Ns_DStringInit(dsScript); Ns_DStringInit(dsResult); /* * The key and value may each have embedded whitespace, as we are * surronding them with double quotes. But we asumme that the nsv * array name will always be one word. */ Ns_DStringVarAppend(dsScript, nsv_set , nsvString, , \, keyString, \, , \, valueString, \, NULL); rc = Ns_TclEval(dsResult, NULL, dsScript.string); Ns_DStringFree(dsScript); Ns_DStringFree(dsResult); return rc; } -- Andrew Piskorski [EMAIL PROTECTED] http://www.piskorski.com -- WK UTF-8 has a certain purity in that it equally annoys every nation, and is nobody's default encoding. -- Andy Robinson
[AOLSERVER] ns/server/${server}/tcl - statlevel
Hello. I've been wondering if someone uses 'statlevel' on development machines and if it's stable. I had some problems running it - SEGVs from time to time, mostly when using upvar - but still it was nice to have some statistics about command usage... Anyone had any experiences with statlevel? -- WK UTF-8 has a certain purity in that it equally annoys every nation, and is nobody's default encoding. -- Andy Robinson
Re: [AOLSERVER] libtbcload question
I wrote znamespace.tcl which replaces _ns_getinit. It's efficient especially if most of your modules are to be bytecompiled. I noticed about 5% gain in speed when testing with ab. You also might want to write a wrapper function tbcload::bceval to rename itself, load tbcload.so and call tbcload::bceval again : This should work. And no, you probably cannot simply convert tbcload into nstbc.so - I tried, fought for 2 weeks with no result :( Bernd Eidenschink wrote: Hi, I'm trying to find the correct place to load libtbcload, the library to load .tbc files along with three tbc files. Should I place load/source in /modules/tcl/namespace.tcl e.g. in _ns_getinit? This works, but I don't know if that's a good idea or if it is efficient; and it is called after my modules are already loaded. If I write a file with load libtbcload and want all the other modules+tbc files be sourced before _ns_getinit is called, the server starts but on the first request it breaks with the called a copy of a compiled script message. Regards, Bernd. -- WK UTF-8 has a certain purity in that it equally annoys every nation, and is nobody's default encoding. -- Andy Robinson
Re: [AOLSERVER] metakit with aolserver
Maybe for now you should try the following code: proc req_mk4tcl {} { if {[lsearch [info loaded] *mk4tcl.so*]0} { load /usr/local/aolserver/lib/mk4tcl.so } } And then you can load 'plain' Tcl extensions. Just put req_mk4tcl before any of your code that uses metakit. This is a little awful, but will get you started in 5 minutes. You may then add this command to nsd version of mk4tcl, which you are trying to build. You could just move the Tcl_Create*Command() to the req_mk4tcl (written in C this time), so that it creates commands when neccessary. You will have to use Tcl_SetAllocData() to store whether you already created commands/initialized other data for this interpreter. A little messy, but should work. I for now use libtbcload.so in the way described above - that is I wrote tbcload::bceval which renames itself and loads libtbcload.so and calls tbcload::bceval again :) Messy, but works fine... -- WK Jeff Rogers wrote: On Mon, 1 Apr 2002 22:35:41 +0200, Jean-Claude Wippler [EMAIL PROTECTED] wrote: The segfault is bad of course, but there may be multiple issues here. Note that MK defines a mk::set command. So please change from: namespace eval ::mk {set n [namespace current]} to: namespace eval ::mk {::set n [namespace current]} As I assume that is what you intended? Yep, that certainly makes the error make sense. Qualifying the set command fixes that problem. But AOLServer still doesn't like namespaces. In particular, commands (not procedures) defined in a namespace. They seem to get lost and I haven't yet found a way to get to them through 'namespace import' or anything like that. So I tried an alternate approach, again using renaming: this time, I changed the mk4tcl code to create commands named __mk__file and so forth, then from a startup file create tcl procedures ::mk::file et al. Since they are procedures, they get recreated in the namespace. However, attempting to use them gets back an error Initialization error in dispatcher. I think whats going on here is that mk4tcl creates a bunch of c++ objects on initialization and registers an exit procedure to clean those up when the tcl interpreter is destroyed; however AOLserver creates an interpreter for startup and then destroys it and creates more when necessary, so mk4tcl is left with references to destroyed objects. If this is correct, then either mk4tcl (or the hypothetical aolserver version, ns_metakit) would need to call the initialization procedure for each new interpreter (or otherwise when necessary) or not register the exit procedure. The namespace thing still bugs me tho. -J -- WK UTF-8 has a certain purity in that it equally annoys every nation, and is nobody's default encoding. -- Andy Robinson
[AOLSERVER] nsprofile
Hello. I tried compiling nsprofile-initial, and it crashes endlessly. I wonder if it's a problem that it passes ClientData to Tcl_CreateCommand(), which is freed when deleting an interp. I added several Ns_Log() calls and it seems to get corrupted data for the deletion function. Any ideas why? Anybody tried working with nsprofile? -- WK UTF-8 has a certain purity in that it equally annoys every nation, and is nobody's default encoding. -- Andy Robinson
Re: [AOLSERVER] server reload function
You shouldn't rely on server not being restarted - if you for example need to reboot or need to reload AOLserver for other reasons. If you use C, you need to use Ns_RegisterAtExit(), and in Tcl use ns_atshutdown. Besides just for being more secure you should save your current data from time to time (ie every 15 minutes - depends on how much time it takes to sync the data). I wrote my session code in C, it syncs all the data to disk on exit and every 15 minutes. And as Rob mentioned, it's just plain unsafe - my AOLservers work for weeks w/o problems, but it's not safe to assume it will not crash. -- WK å¼ ææµ· wrote: I have my AOLserver in inittab already. But i should maintain many online user's information and i should not stop the sevice. Thanks.
[AOLSERVER] good freeware benchmarking tool?
I was wondering if any of you know of a good benchmarking tool? I used ab but it sometimes makes big problems with AOLserver - hard to say why, but I often get 'aborted after 10 failures'... I tries siege but it SEGV'ed after about 2 seconds - and I even looked at the README :) Is there good free software you guys are using? :) -- WK
[AOLSERVER] ANN: nssmartvh 2.1
Hello everyone. I just wanted to announce that nssmartvh 2.1 is available for download from http://nsstuff.zoro.tcl.pl/ It now features short HTML docs by Dean Baender and me. -- WK
Re: [AOLSERVER] are nsv_* functions freeing memory ?
This does not make much sense. I called these from nscp: time {nsv_set a b c; nsv_unset a b} 100 for {set i 0} {$i10} {incr i} {nsv_set a b$i c; nsv_unset a b$i} Both of these resulted in nsd processes having the same number of memory as before. I hope this helps a bit :) -- WK Jean-Fabrice RABAUTE wrote: Hi eveybody, I am using extensively the nsv_* functions to save data in the memory for speed purpose (mainly saving big select results). It's working great. The only problem I have is that memory is growing indefinitely ! So I created a daily schedule function to free the memory using the nsv_unset function. There is no impact on the process memory ! It seems to not work at all. Do you have any idea, if it's possible, on how to free shared memory ? Thanks for any tip. Best regards. Jean-Fabrice RABAUTE.
Re: [AOLSERVER] Tcl profiling
Yeap. I thought of using parts of TclX, but it seemed hard to understand exactly what it does :) I understood that it substitutes the command with something from TclX, which calls the command and gets the times. But the code seemed a bit ... unreadable - too much functions for me :) -- WK Jim Wilcoxson wrote: It would be cool if the ns_stats code tracked CPU time and the amount of data a script generated. Jim Hello. I've read a bit of the AOLserver sources again. I've been wondering if someone has used TclX's profiling code in AOLserver. I've read a bit on ns_stats but this is not what I want - TclX measures CPU time as well, which is what I want most. -- WK
Re: [AOLSERVER] Newbie question: virtual host config confusion
Dean Baender wrote: 3. nssmartvh-2.0 ( ) Building nssmartvh-2.0 gives a compiler warning from nssmartvh.c that 'control reaches end of non-void function' in funct 'NsSmartVhCmd'. Not a big deal, just thougth I'd note it. It never bugged me and I guess I didn't pay too much attention to compilation process. But it works fine for me :) The docs are a little non-existant about the syntax of the aolserver-vhosts file. I think it should look like: aolserver-vhosts: hostname vhost doc root Not quite ;) The syntax is a bit nasty: This is how I use it at one host: sre {dq.pl|dataquest.pl /var/www/dataquest/WWW} sre {(**?)(.dq|.dataquest|.com|.net|.art|.org|)(|.pl) /var/www/\\1/WWW} The first one defines that dq.pl or dataquest.pl (and www.dq.pl/www.dataquest.pl [:)] has docroot in /var/www/dataquest/WWW. It is what most people should be happy about - a simple vhost-path method [:)] The second one is quite universal - it says that most domains have docroot in /var/www/domain/WWW - ie www.dq-e.com will have /var/www/dq-e/WWW. Another config: sre {tcl.pl /usr/local/aolserver/htdocs/tcl.pl} sre {test2.tcl.pl /usr/local/aolserver/htdocs/test2.tcl.pl} sre {dataquest.pl /home/d/dquest/public_html} sre {mgid.com.pl /home/m/mgid/public_html} sre {as.tcl.pl /home/w/ws/public_html} xuser {(**).tcl.pl public_html} It defines that 5 domains have these docroots. The last one is cool - it says that www.username.tcl.pl is docrooted to ~username/public_html, also www.something.user.tcl.pl is docrooted to ~user/public_html/something. You might want to read modules/tcl/nssmartvh/init.tcl and the do_sre (it converts the above expressions to regexp) and m_sre.tcl, m_xuser.tcl. Unfortunately I don't have time to focus on the docs part :( But I'm open to help on this matter ;) of course without the and in the file. So I have www.local.example.com /web/servers/server1/vhost/web-main/pages web-test.local.example.com /web/servers/server1/vhost/web-test/pages sre {local.example.com /web/servers/server1/vhost/web-main/pages} sre {web-test.local.example.com /web/servers/server1/vhost/web-test/...} Now the funny thing is that nssmartvh says it's mapping local.example.com-/web/servers/server1/pages and web-test...-/web/servers/server1/pages Try the thingie above. Unfortunately I haven't got the time to document it clearly :( Maybe someone in this group would like to? :) 4. I guess the last vhost option is the nsunix/nsvhr combo, but I haven't tried it yet. It seems like a bit of a heavyweight solution for my very modest needs. And it's probably can be a PITA for 100 vhosts (the system will probably run out of memory/pids :). -- WK
[AOLSERVER] ns_adp_mime
Hello. I've been wondering if ns_adp_mime should work this way: index.adp: % ns_adp_mime text/plain % And then I should get text/plain content. Since I'm not getting it ;) -- WK
Re: [AOLSERVER] ns_adp_mime
Ok, it's ns_adp_mimetype ;) I guess I grepped it wrong since it's undocumented ;) I'll have to browse through nsd/tclcmds.c, there'll probably be a lot more :) Wojciech Kocjan wrote: Hello. I've been wondering if ns_adp_mime should work this way: index.adp: % ns_adp_mime text/plain % And then I should get text/plain content. Since I'm not getting it ;) -- WK
[AOLSERVER] Tcl profiling
Hello. I've read a bit of the AOLserver sources again. I've been wondering if someone has used TclX's profiling code in AOLserver. I've read a bit on ns_stats but this is not what I want - TclX measures CPU time as well, which is what I want most. -- WK
[AOLSERVER] ns_atclose not working?
Hello. I've tested ns_atclose on 2 machines. I tried % ns_atclose {close [open /tmp/xxx w]} % It does not report any errors, however it does not create /tmp/xxx as well :(. From what I understand from the docs, it can be called from ie ADP to set up things that should be done after closing the connection. It's 3.4.2, on 2.2/2.4 Linux, tried wget and IE5. -- WK
Re: [AOLSERVER] ns_atclose not working?
I answered it to myself quite quickly ;) Ns_AdpRequest() (nsdp/adp.c) does not call RunAtClose, which is defined as static (nsd/tclop.c). Is it safe to rename it to NsRunAtClose() in nsd/tclop.c, remove the static part, put the definition into nsd/adp.c and call it from Ns_AdpRequest()? I need to call it from ADP files - not to mention the fact that in modules/tcl/form.tcl ns_atclose is called from a function that *can* be called from ADP pages. -- WK Wojciech Kocjan wrote: Hello. I've tested ns_atclose on 2 machines. I tried % ns_atclose {close [open /tmp/xxx w]} % It does not report any errors, however it does not create /tmp/xxx as well :(. From what I understand from the docs, it can be called from ie ADP to set up things that should be done after closing the connection. It's 3.4.2, on 2.2/2.4 Linux, tried wget and IE5. -- WK
[AOLSERVER] Bugs in ns_dbquotevalue
Hello. Here is what caused problems for me with both mySQL and PostgreSQL: ns_dblist $h "SELECT lower([ns_dbquotevalue {ABC'DEF\'}])" Basically it quoted the string into 'ABC''DEF\'', which is not correct. Also, it does not work correctly for UTF-escapable characters. proc ns_dbquotevalue {val} { set val [string map [list "'" "''" "\\" ""] $val] return "'$val'" } Here's the code I used - it does not handle datatypes, but I never used them anyway :) Any comments on this one? -- WK
Re: [AOLSERVER] Host-Header based Virtual Hosting
Try my nssmartvh module - www.nsstuff.zoro.tcl.pl. It should be what you're looking for - you make a file with directory mappings - if it's not there, DocumentRoot from the config is taken. Owen Ferguson wrote: Hi everybody, I'm trying to install AOLServer and want to use it in a way Apache implements Virtual Hosting: A host header sent by the client is looked up if there's a mapping to a special document root. Then content is returned relative to this document root. Is this possible with AOLServer? I could not find something like that so far in the documentation. I saw something different done by the OpenACS project in TCL: they analyze the request by a given domain and map it to a directory under the one and only document root (no different directories). Will this be possible in AOLServer 4.0? Is it a lot of work to code it into the C library? Thank you, Owen. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx
Re: [AOLSERVER] Porting (aol 2.2 to aol 3.3.1)
I don't know 2.x api but doing Ns_DbBindRow(dbh[0]) might help... David Valentine wrote: I don't know if this is a porting problem, or a c problem. Old server was on a Dec Alpha. Recompiled code is on We have some old code I'm moving up to the latest AOLserver. The old code is trying to convert a string to a float and failing miserably. float north, south, west, east; ... set up select row = Ns_DbSelect(dbh[0], sql); while (Ns_DbGetRow(dbh[0], row) == NS_OK) { Ns_Log(Notice, "west %s",Ns_SetGet(row, "west_bounding_coor")); sscanf(Ns_SetGet(row, "west_bounding_coor"), "%f", west); Ns_Log(Notice, "scanf|w %f", west); } Any ideas? [23/Jan/2002:14:19:14][13069.6][-conn0-] Notice: west -77.14 [23/Jan/2002:14:19:14][13069.6][-conn0-] Notice: scanf|w 26815622266064413695261456349785268634685592916346250057230047013898 0671657261205425483149622997396404232863663078425392745865278450166061972062 208.00
Re: [AOLSERVER] script timeout
The problem is that even if you close the conn, the Tcl interp will go on doing whatever it is doing... Can a thread be forcibly removed by pthread? :) If so, some thread could do that via filters - a queue of what to remove from the system. The problem would be the Tcl interp associated with a thread. I suppose it's nearly impossible to do on a thread-based platform. David Walker wrote: What about using Ns_ConnClose in a scheduled proc that runs every x minutes (or x/2 minutes) and closes conns that have exceeded their time limit? On Thursday 10 January 2002 12:51 pm, you wrote: On Thursday, January 10, 2002, at 12:04 PM, Jim Wilcoxson wrote: It would be really cool if there were a way to set a CPU and/or real time limit for scripts from inside the script, and invoke a proc with args or something, like a signal handler. For hosting, I really wanted to be able to use the rlimit facilities to limit CPU use, but the problem is that rlimit sets per-process limits, and AOLserver is thread-based. What I usually want is to limit the CPU time allowed per-response, but there's no OS-enforceable way to do this without involving all the threads. Back when virtual hosting was part of AOLserver, that would have been unacceptable. If using rlimit is acceptable for you, the limit command in some shells can set a per-process CPU time limit, or you can write a wrapper for AOLserver that calls rlimit before exec-ing AOLserver. In fact, rlimit will deliver a signal to the process when you exceed the soft CPU limit, but it seems to me that you can only contract your CPU limit, you can't expand it, so you couldn't set a recurring limit for requests. Next operating system I write will have per-thread resource controls!
[AOLSERVER] Sharing a socket between C and TCL
Hello. I've written a small C based daemon listening on 999 port. It doesn't do much, but I want to move some of the functions from C to TCL. I'm using Ns_SockListenCallback() and have SOCKET to work with. How do I allow Tcl to use this socket? -- WK
Re: [AOLSERVER] And if you thought nsvhr was an inefficient virtual hosting mechanism...
This is a small ab test on VMware 3.0 on Windows on P3/850 and a P3/600: Server Software:AOLserver/3.4 -- this is the P3/600 Server Hostname:www.zoro.tcl.pl Server Port:80 Document Path: /ab/ab.adp Document Length:12 bytes Concurrency Level: 1 Time taken for tests: 15.304 seconds Complete requests: 1 Failed requests:0 Total transferred: 174 bytes HTML transferred: 12 bytes Requests per second:653.42 Transfer rate: 113.70 kb/s received Server Software:AOLserver/3.4-z1 -- this is the VM machine Server Hostname:www.ab.aol.hesus2.lan Server Port:80 Document Path: /ab.adp Document Length:12 bytes Concurrency Level: 1 Time taken for tests: 28.425 seconds Complete requests: 1 Failed requests:0 Broken pipe errors: 0 Total transferred: 177 bytes HTML transferred: 12 bytes Requests per second:351.80 [#/sec] (mean) Time per request: 2.84 [ms] (mean) Time per request: 2.84 [ms] (mean, across all concurrent requests) Transfer rate: 62.27 [Kbytes/sec] received I guess it isn't that slow. I used to emulate Mac on my Amiga and I learned that emulating can be useful. And I used a VMware Workstation 3.0 trial - and I suppose ESX/GSX servers are optimized for speed and workstation is optimized for desktop performance (after installing vmware_drv.o my XFree4 was almost as fast as on i810.o :). I suppose context switching is the bottleneck with AOLserver, even with threads... When I tried using tcllib's MIME for 15MB mail parsing, the VM Linux was actually faster (!) than real Win2000. About 5% faster. This was a nice thing to see. The PITA for emulating is the hardware required to emulate - like VGA graphics, soundcards and so on. Jerry Asher wrote: VMware is a wonderful product. I am also amazed that these days a company with such a technically hard product, not hardware, to make or support could get funded. That said, I was surprised by their newsletter suggestion this morning: TECH TIP OF THE MONTH: HOSTING SERVICES ON VIRTUAL MACHINES BEHIND VMWARE NAT Our users and staff often discover hints and shortcuts that can help you get the most from VMware products. This month, our tech tip explains how to configure VMware NAT so that your virtual machines can provide network services (such as Web and FTP) on your public network. NAT enables guest operating systems to share the host operating system IP address(es). ... Read more about hosting services on virtual machines behind VMware NAT at: http://vmware1.m0.net/m/s.asp?HB5170575598X1186076X89440X This is not the solution I would choose if I was concerned about performance. I do wonder how well it might work as a chroot alternative. Jerry Jerry Asher [EMAIL PROTECTED] 1678 Shattuck Avenue Suite 161 Tel: (510) 549-2980 Berkeley, CA 94709 Fax: (877) 311-8688
[AOLSERVER] 64k query limit?
Hello. I've hit a major problem. I want to send base64 encoded files through HTTP - the files are from 100 to 10 bytes. When uploading a 80k file, I occured this problem: [06/Jan/2002:20:20:22][1030.19474][-conn1-] Warning: conn: post size 123377 exceeds maxpost limit of 65536 The files are sent using my own software so I'd rather stay with http::formatQuery+base64::encode. I'm porting my piece of software from Apache+mod_dtcl to AOLserver and this makes me a bit annoyed. Can this be somehow omitted? -- WK
Re: [AOLSERVER] 64k query limit?
Yeap, grepped it a minute after posting this one. Mentioned in doc/config.txt or something :) But thanks anyway Jim Wilcoxson wrote: Do this: ns_section ns/server/${servername} ns_param maxpost 131072;# Max bytes on a POST Jim Hello. I've hit a major problem. I want to send base64 encoded files through HTTP - the files are from 100 to 10 bytes. When uploading a 80k file, I occured this problem: [06/Jan/2002:20:20:22][1030.19474][-conn1-] Warning: conn: post size 123377 exceeds maxpost limit of 65536 The files are sent using my own software so I'd rather stay with http::formatQuery+base64::encode. I'm porting my piece of software from Apache+mod_dtcl to AOLserver and this makes me a bit annoyed. Can this be somehow omitted? -- WK
Re: [AOLSERVER] 64k query limit?
Hmmm. I could use an example - the current system works fine with base64, but I will be writing v2 (incompatible with v1, of course :) and could use multipart... -- WK Mike Hoegeman wrote: if you use mime multi-part posts to upload files, you should not have the problem above (if i remember right). posting files using a plain POST directives is'nt really a recommended practice.. we post up big multipart files all the time using the ::http package and it works fine... i can probably dig up an example of how to do it if you need one.. -mike
Re: [AOLSERVER] Dynamic graphing with AOLServer
I use nsgd - it's a port of gdtclft. It renders PNG files, but for noone complains about it - I'd be happier with GIFs, but what the hell. And a good advice, unless you really need to render these graphs every time a user hits your page, make a ns_register_proc and use files for storing graphs - I render each graph only once a day. Besides that, it's quite easy. -- WK Vince Ciganik wrote: I'm going to need to add some reporting with dynamic graphs to our website, currently using AOLServer 3.4.2 and running on Redhat 6.2. Anyone currently doing that using AOLServer? And what would you recommend as to cause the least amount of pain and frustration? I'll just need simple line plots mostly, with perhaps some shaded areas to indicate things "in range". My initial research seems to indicate that i could use gnu plot to generate the graphs and then convert them to images for display on the page. Any other suggestions or pointers? Thanks, Vince
Re: [AOLSERVER] session and url tracking - just a weird thought
First of all, why do I need cookie? My SIDs are 32bytes long so guessing it could be a bit of a PITA. And if someone would sniff the SID, he could set his browser's cookies to send this SID. So I don't understand how cookies might help? [especially that they are sent from a potentially untrusted user] And about relative links, I guess that using BASE HREF=http://www.domain.com/sid0123456789ABCDEF; should solve relative this problem as well :-) Dave Weis wrote: This ends up being quite a pain. My current employer's site works like this, www.businessolver.com. Doing relative links in everything is no fun, especially static html. You do need a cookie along with this method or you are vulnerable to session highjacking. dave On Thu, 27 Dec 2001, Wojciech Kocjan wrote: I realize that this idea is quite weird and probably useless, but what if sessions on AOLserver would be implemented in this weird way: / created/gets (cookie - if available) a SID and redirects to /ssn0123456789abcde/index.adp which is the real page from documentroot this way, tracking sessions can be done via an url - assuming that noone will use [ns_conn urlv|urlc] in unproper way and won't redirect forms/links as /link/to/page.adp. This could be written to handle only /ssn* and / (to get the cookie and/or redirect to session-tracked url). The problem is that this won't work with registered procs and would require distinguishing ADP files and change /directory/ to /directory/index.adp and so on. But it is wort h considering... -- WK -- Dave Weis I believe there are more instances of the abridgement [EMAIL PROTECTED] of the freedom of the people by gradual and silent encroachments of those in power than by violent and sudden usurpations.- James Madison
Re: [AOLSERVER] session and url tracking - just a weird thought
It's about 5 minutes of work for an experienced user - modify /etc/hosts or c:\winnt\hosts.sam to point www.domain.com to localhost and write a small script that'd set a session cookie. Also, my IE5 stores all the cookies as plaintext in this directory: C:\Documents and Settings\zoro\Cookies Besides, AFAIR, some browsers allow modifying cookies - I'm not sure if BrowseX allows setting cookies - if not from GUI then from Tcl. I think that anything the user supplies cannot be trusted and as such sessions are a real problem to make secure. And I'm not sure if path_info works on AOLserver... Haven't tried it. Peter M. Jansson wrote: On Thu, 27 Dec 2001, Wojciech Kocjan wrote: First of all, why do I need cookie? My SIDs are 32bytes long so guessing it could be a bit of a PITA. And if someone would sniff the SID, he could set his browser's cookies to send this SID. So I don't understand how cookies might help? [especially that they are sent from a potentially untrusted user] The one way cookies can help avoid hijacking is in a security-through-obscurity sense, since it's more difficult to set a cookie using the conventional command-line tools, or even through browsers (browsers I use allow viewing and deleting of cookies, but not creation, as far as I know). And about relative links, I guess that using BASE HREF=http://www.domain.com/sid0123456789ABCDEF; should solve relative this problem as well :-) You could also tack the sid on to the end of the url, after the pagename, so that the sid is available as path_info.
Re: [AOLSERVER] session and url tracking - just a weird thought
Hmmm. As I mentioned before, I use 32 bytes long mostly random SessionIDs - that is, there is no ID related to database. The only way to hijack a session is to guess (or probably sniff :) the 32byte ID... I have no idea how to effectively protect against that. Dossy wrote: On 2001.12.27, Wojciech Kocjan [EMAIL PROTECTED] wrote: I think that anything the user supplies cannot be trusted and as such sessions are a real problem to make secure. What about using using symmetric key crypto to encrypt a sequence number that gets stored along with the session ID on the client's machine? This could help defeat replay attacks. Outside of that, there's not much I can think of. -- Dossy -- Dossy Shiobara mail: [EMAIL PROTECTED] Panoptic Computer Network web: http://www.panoptic.com/ He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on. (p. 70)
[AOLSERVER] session and url tracking - just a weird thought
Hello. I realize that this idea is quite weird and probably useless, but what if sessions on AOLserver would be implemented in this weird way: / created/gets (cookie - if available) a SID and redirects to /ssn0123456789abcde/index.adp which is the real page from documentroot this way, tracking sessions can be done via an url - assuming that noone will use [ns_conn urlv|urlc] in unproper way and won't redirect forms/links as /link/to/page.adp. This could be written to handle only /ssn* and / (to get the cookie and/or redirect to session-tracked url). The problem is that this won't work with registered procs and would require distinguishing ADP files and change /directory/ to /directory/index.adp and so on. But it is wort h considering... -- WK
Re: [AOLSERVER] nssession reference implementation available
I've written my own nsession module in C, it uses files as well and handles logins - this is what I needed for my personalization mechanism - when a user logs in, his sid changes to what is currently stored in this user's db, when he logs out, he gets a new sid. This mechanism works for me with mod_dtcl for several months, now I'm finishing up my AOLserver stuff, so I'll just put my nsession somewhere and compare mine with yours. Dossy wrote: All, I've finally gotten around to putting together a reference implementation of nssession (based on the spec. I originally proposed over a year ago). It's currently only available via anonymous CVS, but if you're interested: http://panoptic.com/wiki/aolserver/nssession Any and all feedback is very appreciated. -- Dossy -- Dossy Shiobara mail: [EMAIL PROTECTED] Panoptic Computer Network web: http://www.panoptic.com/ He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on. (p. 70)
Re: [AOLSERVER] nssession reference implementation available
Dossy wrote: On 2001.12.23, Wojciech Kocjan [EMAIL PROTECTED] wrote: I've written my own nsession module in C, it uses files as well and handles logins - this is what I needed for my personalization mechanism My reference implementation of nssession should be close to handling logins. I actually wanted to think it through more before finalizing on an implementation ... Ok, I'll explain how I do it currently with mod_dtcl in detail: 1.1/ when a request comes in, it checks for cookie 'SessionID' - if it exists, and such a session does exist, SID stays the same. 1.2/ otherwise, a new SID is created and the cookie is reset 2/ if a login request comes in (that is, the .ttml page calls ssn::login), it gets the user's SID from user database and sets it to new one (without any merging). 3/ if a logout request comes in, a new SID is created (with no parameters). 4/ is a create_user request comes in, a user is created and current SID is associated with his username. The basic idea is that if someone cares about his session data, he'll log in. If he doesn't have a user, he'll eventually create one. Also, my previous implementation had a cleanup algorithm and expire parameter. The new one is not even close to being final version, so a lot is missing. The problem is that currently I do not even try to check if a user accepts cookies - this can create a mess. I'll try and put it online sometime soon (hey, it's christmas, don't have too much time :). Also, in my previous implementation, there was no nsv/permament storage. My new code uses Ns_Mutex and my own code to store data and has a separate thread for synchronization to disk - if the sessions go above a predefined limit, some of them will be saved on disk. Also, I never used my nsession module, so I suppose it would be wiser to join forces. I need to be able to connect sessions with users and store strings/integers (for now I store fixed size strings - not very efficient but quite fast) and use 32bit checksums for faster searching through data. -- WK
Re: [AOLSERVER] nssession reference implementation available
Dossy wrote: On 2001.12.23, Wojciech Kocjan [EMAIL PROTECTED] wrote: Ok, I'll explain how I do it currently with mod_dtcl in detail: Neat. I've implemented mine very similiarly to yours. Great. No merging when users log in, and logout just expires the session ID cookie. I call mine UID -- I'll probably make the cookie name configurable soon. There's no reason to create a new session ID -- a new one gets created when the user accesses another page since their old session ID cookie was expired. The basic idea is that if someone cares about his session data, he'll log in. If he doesn't have a user, he'll eventually create one. My problem is if the same user logs in from two different places ... how do you merge the two sessions. Maybe that's an application-specific problem and not something you can solve in a general fashion... Hmmm. When a user logs in, he gets a new cookie with a new SID. So both of them send the same SID and both of them will have the same session settings/data. This shouldn't be a problem. I want to implement nsession eval (similar to ns_cache eval) so that data can (but does not have to) be modified by one thread at a time. Also, my previous implementation had a cleanup algorithm and expire parameter. The new one is not even close to being final version, so a lot is missing. Hopefully soon I'll get around to writing a scheduled proc that'll clean up the in-memory session data (held in nsv structures) and an expire proc that purges old session data after inactivity. The problem is that currently I do not even try to check if a user accepts cookies - this can create a mess. No kidding. A new session will be created every time they access a page. Absolutely miserable. How do you deal with that? Actually my code deals with it quite good - a session without any attributes is simply not saved at all - however it does consume memory :( I ran into a browser bug with Netscape ... if your webserver is just foodomain.com (and not www.foodomain.com) Netscape won't let you set a cookie. It looks for two periods in a hostname if it's one of the big 7 TLDs (you know, COM, NET, ORG, etc.) and three periods if it's a ccTLD (.nj.us, .it, etc.) Hmmm, very odd. I mostly use www.domain.pl (even used http://zoro2.org) and NN4 did not make any problems at all for me. but Microsoft Internet Explorer doesn't have this problem (security hole?) ... yet again, why Netscape 4.x sucks so bad ... I use windows and mozilla (that is, mozilla on windows :). I like this browser and with quicklaunch it works quite fast. (Of course, there's no port of MSIE to Linux, argh.) I'm considering buying VMware Workstation - emulating Linux server on a Windows 2000 host. But the price isn't that low :( I'll try and put it online sometime soon (hey, it's christmas, don't have too much time :). I know ... but I'm finding more time now since I'm not working, so I figured I'd take advantage of it. Hehe. I'm always working ;-( Also, in my previous implementation, there was no nsv/permament storage. My new code uses Ns_Mutex and my own code to store data and has a separate thread for synchronization to disk - if the sessions go above a predefined limit, some of them will be saved on disk. Because sessions are mostly read-only (mine are, at least) I have it set so that any writes to session data cause a write to persistent storage. If this poses to be a bottleneck (or a concurrency issue) I'll address it later. I use sessions for about 70% read 30% write. And I want the code to be quite robust (since sessions do not need too many neat features ;-). Hmm. I'd be curious to try some benchmarks of my version (which is pure Tcl) vs. yours in C. A simple helloworld+counter was about 5% slower than a simple hello world when I told ab to send session by hand. btw Do you know any good http benching software that supports cookies in a convenient way? :) I'd be willing to bet that the ability to extend my implementation rapidly will outweigh any performance gains your C implementation might offer. That depends. I learnt that Tcl+C offers the best performance/exdending_speed compromise (I wrote a quite fancy name-based vhosting module that way - it uses tcl to resolve domain-path and caches it - under 1% performance loss to not using the module). Anyway, I assumed that sessions aren't that complex and can be written in pure C. We can bench and compare things if you want to. I'm also curious about the difference in performance. Lets put our heads together, and try getting something that people can start using -- not everyone needs or wants to use ACS ... Definitely so. I tried OpenACS but it looked a bit too complex for me ;-) Besides, I'd like to see some modules that allow half the stuff ACS does - like news, forums, downloads, but as a nice Tcl module - so that I can put something like %=[z.news::latest]% in my code :) -- WK
Re: [AOLSERVER] nssession reference implementation available
Dossy wrote: On 2001.12.23, Wojciech Kocjan [EMAIL PROTECTED] wrote: Hmmm. When a user logs in, he gets a new cookie with a new SID. So both of them send the same SID and both of them will have the same session settings/data. This shouldn't be a problem. I want to implement nsession eval (similar to ns_cache eval) so that data can (but does not have to) be modified by one thread at a time. The problem is that there can be activity BEFORE the user logs in that gets tracked to the anonymous session ... and that will get lost once they log in. I set expires on the cookie to 2 weeks by default. So after logging in the user usually remains logged in as long as he/she visits my site once in a while. That's an idea. Sessions with hitcount 2 don't get saved to persistent storage. Cool! Thanks for the idea. Sounds good. The downside is that an actual anonymous user that only hits the site once (creates a session, then closes their browser or links away from the site) won't get their session saved either. Who cares about them? ;-) I do not want to use sessions to track users Since I'm going through the trouble of creating a new session regardless, I might as well save them anyway, and just clean them up in the expiry process. Doesn't really cost me that much, I don't think. I ran into a browser bug with Netscape ... if your webserver is just foodomain.com (and not www.foodomain.com) Netscape won't let you set a cookie. It looks for two periods in a hostname if it's one of the big 7 TLDs (you know, COM, NET, ORG, etc.) and three periods if it's a ccTLD (.nj.us, .it, etc.) Hmmm, very odd. I mostly use www.domain.pl (even used http://zoro2.org) and NN4 did not make any problems at all for me. I found out the problem. If the URL is http://foodomain.com/ (one period) and your Set-Cookie: has domain=.foodomain.com or domain=foodomain.com it won't set the cookie. Remove the domain= attribute entirely from the Set-Cookie: and it works for NS and IE. I didn't use domain= - sad to admit it, but never understood what does it exactly do. Hmm. I'd be curious to try some benchmarks of my version (which is pure Tcl) vs. yours in C. A simple helloworld+counter was about 5% slower than a simple hello world when I told ab to send session by hand. Wait, do you mean you actually benchmarked your implementation vs. my implementation, and mine is 5% slower? Or what do you mean? hello.adp: %=Hello world% hello_c.adp: % nsession init % %=Hello world% This is quite what you assumed... I think you mean that you tested a plain HTML page vs. a page that uses YOUR session management to implement a counter, and you found that adding the counter was 5% slower? Yeap. btw Do you know any good http benching software that supports cookies in a convenient way? :) I _think_ WebLoad (by whoever owns it today ... RadView, Mercury, Platinum, I can't keep up) will use cookies intelligently. RadView - and it's commercial, darn :( I've been thinking about writing a small tool like ab in Tcl, but I'm afraid that Tcl could cause it not quite accurate... I'd be willing to bet that the ability to extend my implementation rapidly will outweigh any performance gains your C implementation might offer. That depends. I learnt that Tcl+C offers the best performance/exdending_speed compromise (I wrote a quite fancy name-based vhosting module that way - it uses tcl to resolve domain-path and caches it - under 1% performance loss to not using the module). Anyway, I assumed that sessions aren't that complex and can be written in pure C. We can bench and compare things if you want to. I'm also curious about the difference in performance. Well, when you have some free time, we can put together some tests. This means on january :-) Lets put our heads together, and try getting something that people can start using -- not everyone needs or wants to use ACS ... Definitely so. I tried OpenACS but it looked a bit too complex for me ;-) Besides, I'd like to see some modules that allow half the stuff ACS does - like news, forums, downloads, but as a nice Tcl module - so that I can put something like %=[z.news::latest]% in my code :) Well, I think Jerry's working on some blog stuff, which depending on how clean the implementation is, could probably be repurposed to do the kind of stuff you're thinking of. Otherwise, I might get around to doing it. Write a spec. for what you want on the AOLserver wiki, and maybe in 14 months I'll get around to implementing it. *chuckle* rotfl ;-) I wrote a nice thingie for news - uses ns_cache, my own XML module, TBC for more efficient code loading and so on. BTW What shocked me in a way was that when I rewrote namespace.tcl to append [list load libtbcload.so];[list source $tbcfilename] it gave the engine about 5-10% boost :) - even though it required opening a file, decoding TBC and so on. And what's most interesting is that TBC was never written
Re: [AOLSERVER] nssession reference implementation available
Hmmm. I put up my 3 interesting packages: www.nsstuff.zoro.tcl.pl (nice domain - a better one is www.nsstuff.nsession.zoro.tcl.pl) These domains are just a nice trick done by nssmartvh :) Wojciech Kocjan wrote: Dossy wrote: On 2001.12.23, Wojciech Kocjan [EMAIL PROTECTED] wrote: Hmmm. When a user logs in, he gets a new cookie with a new SID. So both of them send the same SID and both of them will have the same session settings/data. This shouldn't be a problem. I want to implement nsession eval (similar to ns_cache eval) so that data can (but does not have to) be modified by one thread at a time. The problem is that there can be activity BEFORE the user logs in that gets tracked to the anonymous session ... and that will get lost once they log in. I set expires on the cookie to 2 weeks by default. So after logging in the user usually remains logged in as long as he/she visits my site once in a while. That's an idea. Sessions with hitcount 2 don't get saved to persistent storage. Cool! Thanks for the idea. Sounds good. The downside is that an actual anonymous user that only hits the site once (creates a session, then closes their browser or links away from the site) won't get their session saved either. Who cares about them? ;-) I do not want to use sessions to track users Since I'm going through the trouble of creating a new session regardless, I might as well save them anyway, and just clean them up in the expiry process. Doesn't really cost me that much, I don't think. I ran into a browser bug with Netscape ... if your webserver is just foodomain.com (and not www.foodomain.com) Netscape won't let you set a cookie. It looks for two periods in a hostname if it's one of the big 7 TLDs (you know, COM, NET, ORG, etc.) and three periods if it's a ccTLD (.nj.us, .it, etc.) Hmmm, very odd. I mostly use www.domain.pl (even used http://zoro2.org) and NN4 did not make any problems at all for me. I found out the problem. If the URL is http://foodomain.com/ (one period) and your Set-Cookie: has domain=.foodomain.com or domain=foodomain.com it won't set the cookie. Remove the domain= attribute entirely from the Set-Cookie: and it works for NS and IE. I didn't use domain= - sad to admit it, but never understood what does it exactly do. Hmm. I'd be curious to try some benchmarks of my version (which is pure Tcl) vs. yours in C. A simple helloworld+counter was about 5% slower than a simple hello world when I told ab to send session by hand. Wait, do you mean you actually benchmarked your implementation vs. my implementation, and mine is 5% slower? Or what do you mean? hello.adp: %=Hello world% hello_c.adp: % nsession init % %=Hello world% This is quite what you assumed... I think you mean that you tested a plain HTML page vs. a page that uses YOUR session management to implement a counter, and you found that adding the counter was 5% slower? Yeap. btw Do you know any good http benching software that supports cookies in a convenient way? :) I _think_ WebLoad (by whoever owns it today ... RadView, Mercury, Platinum, I can't keep up) will use cookies intelligently. RadView - and it's commercial, darn :( I've been thinking about writing a small tool like ab in Tcl, but I'm afraid that Tcl could cause it not quite accurate... I'd be willing to bet that the ability to extend my implementation rapidly will outweigh any performance gains your C implementation might offer. That depends. I learnt that Tcl+C offers the best performance/exdending_speed compromise (I wrote a quite fancy name-based vhosting module that way - it uses tcl to resolve domain-path and caches it - under 1% performance loss to not using the module). Anyway, I assumed that sessions aren't that complex and can be written in pure C. We can bench and compare things if you want to. I'm also curious about the difference in performance. Well, when you have some free time, we can put together some tests. This means on january :-) Lets put our heads together, and try getting something that people can start using -- not everyone needs or wants to use ACS ... Definitely so. I tried OpenACS but it looked a bit too complex for me ;-) Besides, I'd like to see some modules that allow half the stuff ACS does - like news, forums, downloads, but as a nice Tcl module - so that I can put something like %=[z.news::latest]% in my code :) Well, I think Jerry's working on some blog stuff, which depending on how clean the implementation is, could probably be repurposed to do the kind of stuff you're thinking of. Otherwise, I might get around to doing it. Write a spec. for what you want on the AOLserver wiki, and maybe in 14 months I'll get around to implementing it. *chuckle* rotfl ;-) I wrote a nice thingie for news - uses ns_cache, my own XML module, TBC for more efficient code loading and so on. BTW
[AOLSERVER] client/server software with AOLserver
Hello. I've been writing a nice and easy to use DB module. The webpages side works fine, but I want to write a client-server software for editing tables. I want to know if anyone's used AOLserver for server with Tcl/Tk for client and which technology should I use? I once noticed a project to integrate TclSOAP into AOLserver. What's the status of this project? Is it production stable? -- WK