Re: [naviserver-devel] nsdbpg SSL mode

2013-12-05 Thread Stephen Deasey
On Thu, Dec 5, 2013 at 11:44 PM, Ian Harding harding@gmail.com wrote:

 My naviserver nsdbipg module seems to barf on it.
 psql connects fine.

nsbipg is configured with a datasource param which lets you pass any
key=value pairs directly through to libpq.

According to:

  
http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS

...the default sslmode is prefer, which apparently means don't bother
trying. You actually need sslmode=require.

nsdbpg unfortunately implements it's own datasource parsing so you're
stuck with user:host:db


Are you also using nsssl? Looks like some modifications are required:

  http://www.postgresql.org/docs/9.3/static/libpq-ssl.html#LIBPQ-SSL-INITIALIZE

  If your application initializes libssl and/or libcrypto libraries
and libpq is built
  with SSL support, you should call PQinitOpenSSL to tell libpq that the libssl
  and/or libcrypto libraries have been initialized by your application, so that
  libpq will not also initialize those libraries.

But you could try connecting to the db via ssl with nsssl unloaded, to
confirm that it works.

Not sure what the best way is to coordinate with nsssl who should init
the openssl library.

--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] naviserver with connection thread queue

2012-12-06 Thread Stephen Deasey
On Tue, Dec 4, 2012 at 10:24 PM, Gustaf Neumann neum...@wu.ac.at wrote:

 Today, i was hunting another problem in connection with nsssl, which
 turns out to be a weakness of our interfaces. The source for the problem
 is that the buffer management of OpenSSL is not aligned with the buffer
 management in naviserver. In the naviserver driver, all receive requests
 are triggered via the poll, when sockets are readable. With OpenSSL it
 might be as well possible that data as a leftover from an earlier
 receive when a smaller buffer is provided. Naviserver requested during
 upload spool reveive operations with a 4KB buffer. OpenSSL might receive
 at once 16KB. The read operation with the small buffer will not drain
 the OpenSSL buffer, and later, poll() will not be triggered by the fact,
 that the socket is readable (since the buffer is still quite full). The
 problem happened in NaviServer, when the input was spooled (e.g. file
 uploads). I have doubts that this combination ever worked. I have
 corrected the problem by increasing the buffer variable in the driver.c.
 The cleaner implementation would be to add an Ns_DriverReadableProc
 Readable  similar to the Ns_DriverKeepProc Keep, but that would
 effect the interface of all drivers.

Another way to use the openssl library is to manage socket read/writes
yourself and hand memory buffers to openssl to encrypt/decrypt.

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] naviserver with connection thread queue

2012-12-06 Thread Stephen Deasey
On Tue, Dec 4, 2012 at 10:55 PM, Gustaf Neumann neum...@wu.ac.at wrote:
 Am 04.12.12 20:06, schrieb Stephen Deasey:

 - we should actually ship some code which searches for *.gz versions of
 static files

 this would mean to keep a .gz version and a non-.gz version in the file
 system for the cases, where gzip is not an accepted encoding. Not sure, i
 would like to manage these files and to keep it in sync the fast-path
 cache could keep gzipped copies, invalidation is already there.

I guess it depends on how the website is deployed: in a more modern
set-up CSS is often compiled from SASS or LESS; javascript needs to be
minified and combined, possibly compiled using Google's optmising
compiler, maybe from coffee script; images are compressed, etc. Making
gzip versions of static text/* files is just one more target in a
Makefile.  Which is a little different than the old PHP/OpenACS
perspective where everything happens at run-time.

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] naviserver with connection thread queue

2012-12-04 Thread Stephen Deasey
On Tue, Dec 4, 2012 at 5:21 PM, Gustaf Neumann neum...@wu.ac.at wrote:


 * Only content sent via Ns_ConnWriteVChars has the chance to get
 compressed.


ie. dynamic content with a text/* mime-type. The idea here was you don't
want to try and compress gifs an so on, and static content could be
pre-compressed on disk - at runtime simple look for a *.gz version of the
content.

This could be cleaned up a bit by:

- having an extendable white-list of mime-types which should be compressed:
text/*, application/javascript, application/xml etc.

- we should actually ship some code which searches for *.gz versions of
static files



 * Similarly, range requests are not handled when the data is not sent
 ReturnOpen to the writer Queue.


The diagram shows Ns_ConnReturnData also calls ReturnRange, and hence the
other leg of fastpath and all the main data sending routines should handle
range requests.




 * there is quite some potential to simplify / orthogonalize the servers
 infrastructure.
 * improving this structure has nothing to do with
 naviserver-connthreadqueue, and should happen at some time in the main tip.



The writer thread was one of the last bits of code to land before things
quietened down, and a lot of the stuff that got talked about didn't get
implemented. One thing that was mentioned was having a call-back interface
where you submit a function to the writer thread and it runs it. This would
allow other kinds of requests to be served async.

One of the things we've been talking about with the connthread work is
simplification. The current code, with it's workarounds for stalls and
managing thread counts is very complicated. If it were simplified and
genericised it could also be used for background writer threads, and SSL
read-ahead threads (as in aolserver  4.5). So, that's another +1 for
keeping the conn threads simple.
--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] naviserver with connection thread queue

2012-12-04 Thread Stephen Deasey
On Mon, Dec 3, 2012 at 10:38 AM, Gustaf Neumann neum...@wu.ac.at wrote:

 All changes are on bitbucket (nsssl and naviserver-connthreadqueue).


I found this nifty site the other day:

https://www.ssllabs.com/ssltest/analyze.html?d=next-scripting.org

It's highlighting a few things that need fixed in the nsssl module,
including a couple of security bugs. Looks like relatively little code
though.

Also, there's this:

https://insouciant.org/tech/ssl-performance-case-study/

which is a pretty good explanation of things from a performance point
of view. I haven't spent much time looking at SSL. Looks like there
could be some big wins. For example, some of the stuff to do with
certificate chains could probably be automated - the server could spit
out an informative error to the log if things look poorly optimised.

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] naviserver with connection thread queue

2012-12-04 Thread Stephen Deasey
On Thu, Nov 29, 2012 at 6:51 PM, Gustaf Neumann neum...@wu.ac.at wrote:

 It turned out
 that the large queueing time came from requests from taipeh, which contained
 several 404 errors. The size of the 404 request is 727 bytes, and therefore
 under the writersize, which was configured as 1000. The delivery of an error
 message takes to this site more than a second. Funny enough, the delivery of
 the error message blocked the connection thread longer than the delivery of
 the image when it is above the writersize.

 I will reduce the writersize further, but still a slow delivery can even
 slow down the delivery of the headers, which happens still in the connection
 thread.

This shouldn't be the case for strings, or data sent from the fast
path cache, such as a small file (a custom 404), as eventually those
should work their way down to Ns_ConnWriteData which will construct
the headers if not already sent and pass them, along with the data
payload to writev(2). Linux should coalesce the buffers and send in a
single packet, if small enough.

I wonder if this is some kind of weird nsssl interaction.

(For things like sendfile without ssl we could use TCP_CORK to
coalesce the headers with the body)

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] naviserver with connection thread queue

2012-12-04 Thread Stephen Deasey
On Tue, Dec 4, 2012 at 10:55 PM, Gustaf Neumann neum...@wu.ac.at wrote:

 The code in naviserver-connthreadqueue handles already read-aheads with SSL.
 i have removed there these hacks already; i think, these were in part
 responsible for the sometimes erratic response times with SSL.

Well, I think the thing here is one-upon-a-time SSL was considered
computationally expensive (I don't know if it still is, with recent
Intel cpus having dedicated AES instructions etc.). Read-ahead is good
because you don't want an expensive conn thread waiting around for the
whole request to arrive, packet by packet. But with SSL the single
driver thread will be decrypting read-ahead data for multiple sockets
and may run out of cpu, stalling the request pipeline, starving the
conn threads. By making the SSL driver thread non-async you lose out
on read-ahead as that all happens on the conn thread, but you gain cpu
resources on a multi-cpu system (all of them, today). AOLserver 4.5
added a pool of read-ahead threads, one per-socket IIRC, to keep the
benefits of read-ahead while gaining cpu parallelism.

- does a single driver thread have enough computational resources to
decrypt all sockets currently in read-ahead? This is going to depend
on the algorithm. Might want to favour AES if you know your cpu has
support.
- which is worse, losing read-ahead, or losing cpu-parallelism?
- if a read-ahead thread-pool is added, should it be one thread
per-socket, which is simple, or one thread per-cpu and some kind of
balancing mechanism?

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] naviserver with connection thread queue

2012-12-04 Thread Stephen Deasey
On Wed, Nov 28, 2012 at 10:38 AM, Gustaf Neumann neum...@wu.ac.at wrote:

 It is interesting to see, that with always 5 connections threads running and
 using jemalloc, we see a rss consumption only slightly larger than with
 plain tcl and zippy malloc having maxthreads == 2, having less requests
 queued.

 Similarly, with tcmalloc we see with minthreads to 5, maxthreads 10

requests 2062 spools 49 queued 3 connthreads 6 rss 376
requests 7743 spools 429 queued 359 connthreads 11 rss 466
requests 8389 spools 451 queued 366 connthreads 12 rss 466

 which is even better.

Min/max threads 5/10 better than 2/10? How about 7/10? When you hit
10/10 you can delete an awful lot of code :-)

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] naviserver with connection thread queue

2012-11-18 Thread Stephen Deasey
On Sun, Nov 18, 2012 at 1:22 PM, Gustaf Neumann neum...@wu.ac.at wrote:
 On 14.11.12 09:51, Gustaf Neumann wrote:

 On 13.11.12 15:02, Stephen Deasey wrote:

 On Tue, Nov 13, 2012 at 11:18 AM, Gustaf Neumann neum...@wu.ac.at wrote:

 minthreads = 2

 creating threads, when idle == 0
 10468 requests, connthreads 267
 total cputime 00:10:32

 creating threads, when queue = 5
 requests 10104 connthreads 27
 total cputime 00:06:14

 What if you set minthreads == maxthreads?

 The number of thread create operations will go further down.

 Here are some actual figures with a comparable number of requests:

 with minthreads==maxthreads==2
requests 10182 queued 2695 connthreads 11 cpu 00:05:27 rss 415

 below are the previous values, competed by the number of queuing operations
 and the rss size in MV

 with minthreads=2, create when queue = 2
requests 10104 queued 1584 connthreads 27 cpu 00:06:14 rss 466

 as anticipated, thread creations and cpu consumption went down, but the
 number of queued requests (requests that could not be executed immediately)
 increased significantly.

I was thinking of the opposite: make min/max threads equal by
increasing min threads. Requests would never stall in the queue,
unlike the experiment you ran with max threads reduced to min threads.
But there's another benefit: unlike the dynamic scenario requests
would also never stall in the queue when a new thread had to be
started when min  max threads.

What is the down side to increasing min threads up to max threads?

 Maybe the most significant benefit of a low maxthreads value is the reduced
 memory consumption. On this machine we are using plain Tcl with its zippy
 malloc, which does not release memory (once allocated to its pool) back to
 the OS. So, the measured memsize depends on the max number of threads with
 tcl interps, especially with large blueprints (as in the case of OpenACS).

Right: the max number of threads *ever*, not just currently. So by
killing threads you don't reduce memory usage, but you do increase
latency for some requests which have to wait for a thread+interp to be
created.

Is it convenient to measure latency distribution (not just average)? I
guess not: we record conn.startTime when a connection is taken out of
the queue and passed to a conn thread, but we don't record the time
when a socket was accepted.


Actually, managing request latency is another area we don't handle so
well. You can influence it by adjusting the OS listen socket accept
queue length, you can adjust the length of the naviserver queue, and
with the proposed change here you can change how aggressive new
threads are created to process requests in the queue. But queue-depth
is a roundabout way of specifying milliseconds of latency. And not
just round-about but inherently imprecise as different URLs are going
to require different amounts of time to complete, and which URLs are
requested is a function of current traffic. If instead of queue size
you could specify a target latency then we could maybe do smarter
things with the queue, such as pull requests off the back of the queue
which have been waiting longer than the target latency, making room
for fresh requests on the front of the queue.

--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] ns_return* documentation and ns_register_* default method

2012-11-02 Thread Stephen Deasey
On Wed, Oct 31, 2012 at 12:54 PM, Stefan Sobernig
stefan.sober...@wu.ac.at wrote:

 I'd also appreciate a heads-up on a previous thread:

 http://www.mail-archive.com/naviserver-devel@lists.sourceforge.net/msg01811.html

 Was the idea of a default method (* or the like) for the
 ns_register_* cmd family ever implemented?

No.

Looks like some surgery to nsd/urlspace.c might be required to alter
the current order of lookup from: method, path, path for the url GET
/foo/bar to: path, path, method, so that if the path matches and the
method does not, a default method handler can be returned.

--
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] ns_urldecode -charset

2012-10-30 Thread Stephen Deasey
On Tue, Oct 30, 2012 at 10:38 AM, David Osborne da...@qcode.co.uk wrote:
 Hi,

 We're currently in the process of porting a fairly large code base from
 Aolserver to Naviserver for testing (using Naviserver v4.99.4 on Debian
 Squeeze).

 One thing that has come up so far is that ns_urldecode seems to have dropped
 the -charset switch.

 I'm assuming it used to be present since some of your documentation mentions
 it:
 (eg. http://naviserver.sourceforge.net/n/naviserver/files/ns_urldecode.html
 )
 I can't find any mention of why it was dropped?


It was more than 7 years ago so I can't remember the details, but I
think there were some other bugs to do with character sets that
basically meant forcing everything to be utf-8. Strictly speaking the
-charset switch to ns_urldecode might still be needed, and I think it
got removed by mistake, but it's usually not needed:

 So in Naviserver, is there an alternative to achieve the following:

 nscp 1 ns_urldecode -charset iso8859-1 %FA
 รบ

Here for example, if you don't pass -charset then naviserver assumes
utf8. But the code points of iso88591 are a subset of utf8 (and ascii
is a subset of both), so the result is identical. So you should never
have to specify iso88591, because I think you can no longer set the
notion of a global default character set -- it's always utf8, and then
in some places you can specifically choose if really needed.

Where are you getting %FA from? Is it something you're encoding
yourself or are you interacting with another system?


 PS. This is not really a devel question - is there a more appropriate place
 to ask config/user questions?


This is it.

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] ns_urldecode -charset

2012-10-30 Thread Stephen Deasey
On Tue, Oct 30, 2012 at 7:59 PM, Stephen Deasey sdea...@gmail.com wrote:

 But the code points of iso88591 are a subset of utf8...

Actually, this doesn't make sense. The byte encoding of code points
above 128 uses two bytes for utf8, but only one byte for iso88591.

Looks like you need -charset.

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] lurking bugs: conn threads

2012-10-27 Thread Stephen Deasey
On Fri, Oct 26, 2012 at 11:44 PM, Jeff Rogers dv...@diphi.com wrote:
 Andrew Piskorski wrote:
 On Fri, Oct 26, 2012 at 08:30:26PM +0100, Stephen Deasey wrote:

 I was thinking it could work something like this:

 - driver acquires lock, takes first conn thread off queue, releases lock

 What if there are no conn threads waiting in the queue?


 Same as currently I'd think: the driver holds on to them as waiting
 sockets.  I think the handling of this is a bit less efficient than
 putting them on the conn queue tho, as it creates more work for the
 driver to do on every spin and it needs to get woken up once threads are
 available.

- driver takes the lock, sees that there are no threads in the thread
queue, puts conn on the back of the conn queue, does not signal
anything, releases the lock

- conn thread completes a request, takes the driver lock.
-- If the conn queue is empty it puts itself on the front of the
thread queue and releases the lock.
-- Otherwise it takes then next conn and releases the lock.

--
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] compression

2012-10-27 Thread Stephen Deasey
On Sat, Oct 27, 2012 at 1:13 PM, Gustaf Neumann neum...@wu.ac.at wrote:
 On 26.10.12 15:47, Stephen Deasey wrote:
 I think the spec says that for HTTP/1.1, if the client doesn't
 explicitly say to NOT send the body gzipped, say by using a q value of
 0 (which we don't actually check for, woops...), then the server can
 choose the encoding, although it should prefer the identity, unless
 that's unavailable. So we're being very pushy...

 now we do check for the qvalues used in connection with
 gzip. So, a client can now specify explicitly, that gzip is
 NOT wanted via gzip; q=0. What the code still does not do
 is comparing the identity-qvalue with the gzip-qvalue or
 combination with wildcards *;q=...

Jeff had a go at this as well:

  https://bitbucket.org/jeffr/naviserver-queues/changesets

Here's the feedback I tacked on to the end of a mercurial question via email:



It bothers me a bit that a fresh Ns_Set has to be allocated, and also
the parsing code is pretty gnarly and hard to verify. It looks about
right, but I'd have to resort to pencil and paper to be more sure, and
the fact I haven't done that reminds me that people tend to not look
too closely at these things and that's where bugs can fester. I wonder
if there's another way of doing this...

You'll have to double check the details, but IIRC q values go from
0-999. If 'gzip' is present without a q value then it's as if it had
q=1 -- that's the default. If it's not present, it's as if it were but
with q=0. So, how about a function like Ns_HeaderQ(header, attr) which
returns the integer q value for the specified atttribute. It simply
uses strstr to find gzip. If it doesn't, return 0. If it does, then
check for a q=. If it's the character '0', return 0. If there's no q,
return 1. If it's something else, parse the int and return that. Then
you can use it something like:


if (!(connPtr-flags  NS_CONN_SENTHDRS)
!(connPtr-flags  NS_CONN_SKIPBODY)) {

contentEncoding = Ns_SetIGet(Ns_ConnHeaders(conn), Accept-Encoding);

if (Ns_HeaderQ(contentEncoding, gzip)  0 ||
Ns_HeaderQ(contentEncoding, *)  0) {
gzip = 1;


I'm not sure how eager the server should be sending gzipped content.
An alternative to the above would be to keep the existing eager use of
gzip, but respect the client's negative assertion:


if (!(connPtr-flags  NS_CONN_SENTHDRS)
!(connPtr-flags  NS_CONN_SKIPBODY)) {

contentEncoding = Ns_SetIGet(Ns_ConnHeaders(conn), Accept-Encoding);

if (connPtr-request-version = 1.1) {
if ((!Ns_HeaderQ(contentEncoding, gzip, q) || q  0)
 (!Ns_HeaderQ(contentEncoding, *, q) || q  0)) {
gzip = 1;
}
} else if ((Ns_HeaderQ(contentEncoding, gzip, q)  q  0)
   || (Ns_HeaderQ(contentEncoding, *, q)  q  0)) {
gzip = 1;
}


Here Ns_HeaderQ is modified to return NS_TRUE or NS_FALSE depending on
whether the attribute is present, and the q value is returned into the
given variable. HTTP 1.0 clients have to explicitly ask for gzip, 1.1
clients get it unless the say they don't want it.

--
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] compression

2012-10-26 Thread Stephen Deasey
On Thu, Oct 25, 2012 at 9:20 PM, Jeff Rogers dv...@diphi.com wrote:
 It looks like we're enabling compression for all http/1.1 requests
 regardless of whether it was specified in the request header, or even
 specifically disallowed.  This seems incorrect, but the code has been in
 place for several years (connio.c:CheckCompress) ;  is there a reason
 not to change that?

I think the spec says that for HTTP/1.1, if the client doesn't
explicitly say to NOT send the body gzipped, say by using a q value of
0 (which we don't actually check for, woops...), then the server can
choose the encoding, although it should prefer the identity, unless
that's unavailable. So we're being very pushy...

There's a bunch of tests for this in tests/ns_adp_compress.test,
including with and without the Accept-Encoding header and q values,
but many of them are disabled with -constraints knownBug. I guess it's
something someone thought about but no one got round to fixing it.

This page describes how to run these particular tests:

  http://wiki.tcl.tk/21659

 Also on compression, a separate compression stream is pre-allocated and
 initialized for each pre-allocated Conn, whether or not compression is
 even enabled for the server.  The causes a fairly large initial memory
 footprint.  I think this pre-initialization could be made optional, and
 bypassed entirely when compression isn't enabled.  Any thoughts?

Seems reasonable.

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Hello

2012-10-26 Thread Stephen Deasey
On Wed, Oct 24, 2012 at 5:01 PM, Agustin Lopez agustin.lo...@uv.es wrote:

 When I run the server I get error with Ns_ConfigSection from my compiled
 nsldap.
 I suppose that it is a known problem. Any pointer to work it?

What is the exact error message?

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] lurking bugs: conn threads

2012-10-26 Thread Stephen Deasey
On Thu, Oct 25, 2012 at 10:31 AM, Gustaf Neumann neum...@wu.ac.at wrote:
 I don't think, that a major problem comes from the racy
 notification of queuing  events to the connection threads.
 This has advantages (make os responsible, which does this
 very efficiently, less mutex requirements) and disadvantages
 (little control).


I think the current code works something like this:

- driver thread acquires lock, puts connection on queue, broadcasts to
conn threads, releases lock

- every conn thread waiting on the condition is woken up in some
arbitrary but approximately round-robin order, and maybe some of the
conn threads which aren't currently waiting pick up that message when
they do wait, because for performance these things aren't strictly
guaranteed (I may be remembering this wrong)

- n conn threads race to acquire the lock

- the one which gets the lock first take the conn from the queue and
release the lock

- it runs the connection, acquires the lock again, puts the conn back
on the queue, and release the lock

- meanwhile the other woken conn threads acquire then release the lock
with possibly nothing to do.


So for each request there can be up to 6 lock/unlock sequences by the
driver and active conn thread, plus a lock/unlock by n other conn
threads, all on one contended lock, plus the context switching
overhead, and this all happens in an undesirable order.


 By having a conn-thread-queue, the
 threads have to update this queue with their status
 information (being created, warming up, free, busy,
 will-die) which requires some overhead and more mutex locks
 on the driver.


I was thinking it could work something like this:


- driver acquires lock, takes first conn thread off queue, releases lock

- driver thread puts new socket in conn structure and the signals on
cond to that one thread (no locking, I don't think)

- that conn thread wakes up, takes no locks, runs connection

- conn thread acquires driver lock, puts conn back on front of queue,
releases lock


Four lock/unlock, lock/unlock sequences, two threads.

--
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] lurking bugs: conn threads

2012-10-26 Thread Stephen Deasey
Interesting, but I wonder if we're not thinking this through
correctly. My suggestion, and your here, and Gustaf's recet work are
all aimed at refining the model as it currently is, but I wonder if
we're even attempting to do the right thing?

 So I'm assuming that the available processing power - the number of
 threads - should correlate to how busy the server is.  A server that is
 50% busy should have 50% of its full capacity working.

But what is busy, CPU?  There needs to be an appropriate max number of
threads to handle the max expected load, considering the capabilities
of the machine. Too many and the machine will run slower. But why kill
them when we're no longer busy?

- naviserver conn threads use a relatively large amount of memory
because there tends to be one or more tcl interps associated with each
one

- killing threads kills interps which frees memory

But this is only useful if you can use the memory more profitably some
where else, and I'm not sure you can.

It is incoming load which drives conn thread creation, and therefore
memory usage, not availability of memory. So if you kill of some conn
threads when they're not needed, freeing up some memory for some other
system, how do you get the memory back when you create conn threads
again? There needs to be some higher mechanism which has a global view
of, say your database and web server requirements, and can balance the
memory needs between them.

I think it might be better to drop min/max conn threads and just have
n conn threads, always:

- simpler code

- predictable memory footprint

- bursty loads aren't delayed waiting for conn threads/interps to be created

- interps can be fully pre-warmed without delaying requests

- could back-port aolserver's ns_pools command to dynamically set the
nconnthreads setting

With ns_pools you could do something like use a scheduled proc to set
the nconnthreads down to 10 from 20 between 3-5am when your database
is taking a hefty dump.


Thread pools are used throughout the server: multiple pools of conn
threads, driver spool threads, scheduled proc threads, job threads,
etc. so one clean way to tackle this might be to create a new
nsd/pools.c which implements a very simple generic thread pool which
has n threads, fifo ordering for requests, a tcl interface for
dynamically setting the number of threads, and thread recycling after
n requests. Then try to implement conn threads in terms of it.


btw. an idea for pre-warming conn thread interps: generate a synthetic
request to /_ns/pool/foo/warmup (or whatever) when the thread is
created, before it is added to the queue. This would cause the tcl
source code to be byte compiled, and this could be controlled
precisely be registering a proc for that path.

--
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] [AOLSERVER] Naviserver Win-64 Sources

2012-10-17 Thread Stephen Deasey
On Wed, Oct 17, 2012 at 4:55 AM, Maurizio Martignano
maurizio.martign...@spazioit.com wrote:
 OK

 Simple reason: Visual Studio complains about that stuff and it is annoying.

Looks like Visual Studio 2012 comes with a C compiler:

  http://msdn.microsoft.com/en-us/library/bb384838.aspx

Visual Studio includes a C compiler that you can use to create
everything from basic C programs to Windows API applications.

By default, the Visual C++ compiler treats all files that end in .c
as C source code,

Maybe there's a bug in your build scripts that are forcing C code to
be treated as C++?

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] lurking bugs: conn threads

2012-10-11 Thread Stephen Deasey
On Wed, Oct 10, 2012 at 9:44 PM, Jeff Rogers dv...@diphi.com wrote:

 It is possible to get into a situation where there are connections
 queued but no conn threads running to handle them, meaning nothing
 happens until a new connection comes in.  When this happens the server
 will also not shut down cleanly.  As far as I can figure, this can only
 happen if the connection queue is larger than connsperthread and the
 load is very bursty (i.e., a load test);  all the existing conn threads
 can hit their cpt and exit, but a new conn thread only starts when a new
 connection is queued.  I think the solution here is to limit
 maxconnections to no more than connsperthread.  Doing so exposes a less
 severe problem where connections waiting in the driver thread don't get
 queued for some time; it's less of a problem because there is a timeout
 and the dirver thread will typically wake up on a closing socket fairly
 soon, but it can still result in a simple request taking ~3s to
 complete.  I don't know how to fix this latter problem.

I think this is racy because all conn threads block on a single
condition variable. The driver thread and conn threads must cooperate
to manage the whole life cycle and the code to manage the state is
spread around.

If instead all conn thread were in a queue, each with it's own
condition variable, the driver thread could have sole responsibility
for choosing which conn thread to run by signalling it directly,
probably in LIFO order rather than the current semi-round-robin order
which tends to cause all conn threads to expire at once. Conn threads
would return to the front of the queue, unless wishing to expire in
which case they'd go on the back of the queue, and the driver would
signal when it was convenient to do so. Something like that...

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] ns_set ... -persistent

2012-10-10 Thread Stephen Deasey
On Wed, Oct 10, 2012 at 10:09 AM, Gustaf Neumann neum...@wu.ac.at wrote:

 Using a _ns_set capable of handling -shared which just calls
 existing ns_set with the unlocked semantics would not work,
 using a lock with for all _ns_set commands is not good either
 without modifying the existing ns_set semantics (one should
 not be able to access variables created by _ns_set from
 ns_set). If we check for the shared flag in ns_set, we are
 essentially at the old ns_set implementation.

I was thinking that the 2 or 3 people in the world that need backward
compatibility would load the nsshare module and then:

  rename _ns_set ns_set

You wouldn't use them both, you just want your old code to work the
way it did in 1999.

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] ns_set ... -persistent

2012-10-09 Thread Stephen Deasey
On Tue, Oct 9, 2012 at 11:11 AM, Gustaf Neumann neum...@wu.ac.at wrote:
 Stephen,

 do you remember why you took out the -shared flag from ns_set?

 https://bitbucket.org/naviserver/naviserver/changeset/1cbaf1acc09436f2a1c56102269a8b7fab0be168


 it seems that some people love it. We have either to take it
 out of
 the documentation (and give sensible explanation) or
 reintroduce it in the code...


If I remember rightly, the code has long been depreciated in
AOLserver, and as no one used it and it complicates the arg parsing
and locking we removed it, along with the ns_share and ns_var command.
There's Tcl wrapper for ns_var because it was trivial.

I've created a new module nsshare which reimplements the ns_share
command using the old C code:

  https://bitbucket.org/naviserver/nsshare/overview

Haven't put much effort into testing it, but the skeleton of the
module is ready to go, it compiles and the sanity tests work.

I think the way to add back the -shared switch to ns_set would be to
add a new file to this module: setcmd.c, add the C code that was
removed, export an _ns_set ?-shared? ?args ...? command which, if the
-shared flag is present does it's thing, otherwise calls the
underlying ns_set command. If you want to do this, that would be
great.

As there is now somewhere to put it, the ns_var code could be moved here too.

There's some compatibility info here:

  http://wiki.tcl.tk/22567

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Greetings

2012-10-09 Thread Stephen Deasey
On Tue, Oct 9, 2012 at 7:49 PM, Zoran Vasiljevic z...@archiware.com wrote:

 On 09.10.2012, at 20:10, Jeff Rogers wrote:

 Hi Jeff!

 Propose
 changes on the development list and then make changes to the main

 This is how we have worked so far. This mostly covers bug fixes.
 Whole-sale changes are little bit different... but they happen
 seldom. In that case, a branch consisting of all the changes is
 prefered.

Conceptually yes, but don't actually use a mercurial branch for
temporary development. You can't delete branches.

On your local computer just clone an existing checkout into a new
directory, it'll use hard links so it's fast and efficient. If you
want to publish it for feedback then click the 'fork' button on the
naviserver project at bitbucket and create a new repo under your own
account: push your changes directly to it. If it's a small change,
just post it here.


Anyway, if you think of vc as backup and approval then it sounds like
a drag, but it's really more like your editor - it helps you code.

You often don't know what you're going to end up with when you start
so you use your editor and hg to manipulate the code.
- You start to add a feature but half way through you realise if you
refactored some existing functions it would make the addition easier.
- So, pop-off what you've done so far, refactor the code, push your
pending changes back.
- Then you notice a bug in some existing code. Pop off both changes,
fix the bug, push them back on again.
Now when you share the code there's 3 separate changes and they tell a
story: here's a simple bug fix, here's a refactoring which should not
change existing behaviour, and here's a new feature.

The easier it is to read the more people are likely to read it and the
more feedback you'll get, which is invaluable. In addition, everyone
who touches the code end up with a mental model of how it works, so
when the code changes the model needs to be synced up again. It's not
scalable to have each person slog through a big old dump of code that
took the original changer 6 hours to grok. You need to present it like
a story so it makes sense.

Check out the lkml to see how the ninjas do it.

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] nsproxy module: change comm to sockets instead of pipes?

2012-01-28 Thread Stephen Deasey
On Sat, Jan 28, 2012 at 1:26 PM, Zoran Vasiljevic z...@archiware.com wrote:

 On Windows there are some limitations as how you can
 do non-blocking operations... In particular, there
 seems to be a problem with non-blocking reads/writes
 on unnamed pipes... They simply do not work on windows,
 at least as to our knowledge.

I don't know anything about Windows, but i t looks like PIPE_NOWAIT
switches to non-blocking mode but is a legacy of ye olde lan manager,
and instead you should use overlapped IO with the FILE_FLAG_OVERLAPPED
flag:

  
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365788%28v=vs.85%29.aspx

This is all with named pipes. But it says the followinf about anon pipes:

  Anonymous pipes are implemented using a named pipe with
  a unique name. Therefore, you can often pass a handle to an
  anonymous pipe to a function that requires a handle to a named pipe.

So maybe you can substitute a named pipe with the appropriate flags
for the anon pipe?

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] nsproxy module: change comm to sockets instead of pipes?

2012-01-28 Thread Stephen Deasey
On Sat, Jan 28, 2012 at 8:19 PM, Ibrahim Tannir itan...@archiware.com wrote:

 However, the entire asynchronous IO in Windows is really messy
 business, since the entire mechanism of processing IO
 notifications is tied to a window.

I see what y'all mean. That's a lot of non-shared code.

I suppose you can always use a unix domain socket on the unixy side
while using a socket on the loopback interface for Windows and still
use the same poll() code on both.

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Socket buffer sizes

2010-05-10 Thread Stephen Deasey
On Mon, May 10, 2010 at 7:22 PM, Andrew Piskorski a...@piskorski.com wrote:
 On Mon, May 10, 2010 at 11:39:26AM +0200, Vasiljevic Zoran wrote:

 So far I could understand from reading tons of docs
 found all over the internet, the socket buffer sizes are
 crucial for optimizing the network peformance related to
 fast, high-latency links.

 Sounds like what the hpn-ssh patches do for ssh:

 http://www.psc.edu/networking/projects/hpn-ssh/


Zoran:

Looks like it would be a mistake to use setsockopt() on Linux =
2.6.17 (released June 2006) ie. RHEL 5+ (ignoring any patches Redhat
may have backported):

http://www.psc.edu/networking/projects/tcptune/#detailed
http://kbase.redhat.com/faq/docs/DOC-3079

--

___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Ns_ConnFlushHeaders() deprecated: why?

2010-05-04 Thread Stephen Deasey
On Tue, May 4, 2010 at 4:50 PM, Vasiljevic Zoran z...@archiware.com wrote:
 Hi all!

 Tcl_WideInt
 Ns_ConnFlushHeaders(Ns_Conn *conn, int status)
 {
 ย  ย  Conn *connPtr = (Conn *) conn;

 ย  ย  Ns_ConnSetResponseStatus(conn, status);
 ย  ย  Ns_ConnWriteData(conn, NULL, 0, 0);

 ย  ย  return connPtr-nContentSent;
 }

 This function is set as deprecated. It returns number of bytes sent.
 I cannot see that connPtr-nContentSent is exposed from outside
 so how am I to obtain the original Ns_ConnFlushHeaders functionality
 w/o accessing internal connection state?


Flushing headers is discouraged because it isn't needed for HTTP, it's
slow, and often extra headers need to be added depending on which
Write* calls you use.

I guess you could give access to nContentSent in a new public API.
What are you using it for? How are you writing the data?

--
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Ns_ConnWriteData needs Ns_ConnFlushData ?

2010-05-04 Thread Stephen Deasey
On Tue, May 4, 2010 at 4:58 PM, Vasiljevic Zoran z...@archiware.com wrote:
 Hi!

 Quite often I see:

 ย  ย Ns_ConnWriteData(conn, NULL, 0, 0);

 This is OK but not very readable. Can we add something like

 ย  ย Ns_ConnFlushData(conn, flags)

 convenience wrapper that would supply the NULL buffer and
 zero bytes to the Ns_ConnWriteData() ?

 This would add zero functionality but would make the
 programmers intention more clear.


Hmm... well it's not *too* often that you see it. Some of the places
where it's currently done is probably a mistake, and sometimes it's
because the api doesn't quite let you do what you need.

For example, return.c:ReturnRange() flushes the headers by calling
Ns_ConnWriteData with a null buffer before calling
Ns_ConnSendFileVec() because the latter is low level enough, for
flexibility, that it completely ignores headers, for alternate
protocols etc. But the vector sending code can actually handle memory
buffers as well as files, so ideally you'd want to dump the headers to
a string buffer then pass them on to SendVec. Or something...

What is being buffered that you're trying to flush?

--
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] commit/naviserver: gustafn: - Fix to prevent multiple DriverAccepts on the same socket. The original coded relied on the fact that later accepts

2010-04-12 Thread Stephen Deasey
On Sun, Apr 11, 2010 at 4:16 PM,  commits-nore...@bitbucket.org wrote:

 changeset: 2575:3963e46562e8
 user: Gustaf Neumann neum...@wu-wien.ac.at
 date: Sun Apr 11 17:16:27 2010 +0200
 summary: Fix to prevent multiple DriverAccepts on the same socket.
  The original coded relied on the fact that later accepts lead to
  an ERROR_STATE. Under RHEL 4 (Power, 64bit) the second accept 
 blocks.


 diff --git a/nsd/driver.c b/nsd/driver.c
 --- a/nsd/driver.c
 +++ b/nsd/driver.c
 @@ -1523,7 +1523,22 @@ SockAccept(Driver *drvPtr, Sock **sockPt
   * Accept the new connection.
   */

 - status = DriverAccept(sockPtr);
 + /*
 + * Hmmm: the original implementation was written in style that
 + * DriverAccept was called twice, one to return for e.g. a simple,
 + * new HTTP request NS_DRIVER_ACCEPT (staying in the SOCK_MORE
 + * status), and then calling ACCEPT again, but which causes on our
 + * RHEL 4 system (POWER6, 64bit) a hang: the second accept blocks,
 + * while it returns under (most?) other system a
 + * NS_DRIVER_ACCEPT_ERROR. It seems that the original code rely on
 + * this ERROR handling. It is not clear to me, why the second call
 + * to ACCEPT is necessary, when the socket is already available.
 + */
 + if (*sockPtrPtr) {
 + status = NS_DRIVER_ACCEPT_ERROR;
 + } else {
 + status = DriverAccept(sockPtr);
 + }

  if (status == NS_DRIVER_ACCEPT_ERROR) {
  status = SOCK_ERROR;




 It is not clear to me, why the second call to ACCEPT is necessary, when the 
 socket is already available.



http://bitbucket.org/naviserver/naviserver/src/tip/nsd/driver.c#cl-1175 :


DriverThread():

if (waitPtr == NULL) {
/*
 * If configured, try to accept more than one request,
under heavy load
 * this helps to process more requests
 */

accepted = 0;
while (accepted  drvPtr-acceptsize
drvPtr-queuesize  drvPtr-maxqueuesize
PollIn(pdata, drvPtr-pidx)
(n = SockAccept(drvPtr, sockPtr)) != SOCK_ERROR) {

switch (n) {
...

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] driver changes, please check

2010-04-12 Thread Stephen Deasey
On Sun, Apr 11, 2010 at 4:42 PM, Gustaf Neumann neum...@wu-wien.ac.at wrote:

 PS: i had to do a hg push -f  Not sure, if this is intentional.
 Do the commits to tip look right?


All that's happened here is that you've made changes to your checkout
without first updating it. In the meantime, Zoran has made changes and
pushed them.

If this were CVS it would refuse to let you commit. With mercurial
obviously you can commit as it's local, but it will not let you push
and will give you a warning. You ignored the warning by using -f  :-)

You are going to have to merge the two heads with 'hg merge' and then
push that changeset. See: hg help merge.

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Mercurial does not substitute tags?

2010-03-06 Thread Stephen Deasey
On Sat, Mar 6, 2010 at 1:18 PM, Vasiljevic Zoran z...@archiware.com wrote:
 Hi!

 It seems to me that we miss RCS Tag substitution.
 Is this so deliberately? If yes, what's the point
 in keeping NS_RCSID any longer?

  NS_RCSID(@(#) $Header: /Volumes/DATEN0/develop/local/CVS/dev/
 naviserver/nsd/queue.c,v 1.2 2008/04/29 08:11:15 zv Exp $);
 ---
 ย  NS_RCSID(@(#) $Header$);


Mercurial doesn't mangle the source code by default. There is a
plugin, included but disabled by default, that can do this, but I
haven't tried it.

Not sure whether it's worth the bother to set that up, remove the
unused RCS tags, or just leave it be...

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] spooler not working on linux

2009-11-22 Thread Stephen Deasey
On Sun, Nov 22, 2009 at 2:58 AM, John Buckman j...@magnatune.com wrote:

 Perhaps the problem is how I built my naviserver on linux? ย I simply ran 
 autogen.sh from the cvs tree, and I also tried it with
 ./autogen.sh --enable-threads --enable-symbols ย --with-tcl=/usr/local/lib


The latest source is here, not in CVS:

  http://bitbucket.org/naviserver/naviserver/


(If you've found an old link to CVS, let us know so we can change it)

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Following symbolic directory links with NaviServer possible?

2009-09-22 Thread Stephen Deasey
On Tue, Sep 22, 2009 at 11:23 AM, Christian A Vogl c...@kinetiqa.de wrote:
 Hi all!

 I'm wondering if it's a misconfiguration of mine or a feature of
 NaviServer:

 whenever I want to symbolically link to a folder in pages directory,
 I run into a 403 (Forbidden) error.

 Symbolically linking to individual files works fine.
 Did I miss a configuration parameter?


I don't think there's any code in the fastpath (static files) or
adp/tcl path which returns a 403 response.

Maybe you have some code which calls ns_forbidden or
Ns_ConnReturnForbidden? In a filter, or a directory listing proc/adp?

If there is also a file/directory permission error, it should show up
in the error log.

--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Following symbolic directory links with NaviServer possible?

2009-09-22 Thread Stephen Deasey
On Tue, Sep 22, 2009 at 1:13 PM, Christian A Vogl c.v...@kinetiqa.de wrote:
 Yes, you're right, Stephen, thank you!

 Responsible's my own ns_returnforbidden, and I was misguided by the
 different behaviour for files and directories. In detail, for maybe
 helping other misguided half-blinds like me:

 I checked file access using TCL's file normalize,
 which returns
 ย  /path/to/real/file.ext
 for requests of /path/to/webserver/pages/symdir/file.ext in a
 symbolically linked directory (symbolic link
 ย  symdir -- /path/to/real
 in physical naviserver page root /path/to/webserver/pages),

 but returns
 ย  /path/to/webserver/pages/physdir/file.ext
 if only file.ext links symbolically somewhere else (symbolic link
 ย  file.ext -- /path/to/real/file.ext
 in physical directory /path/to/webserver/pages/realdir)


 So I just had to drop the normalizing.


Check out ns_register_fasturl2file:

  http://naviserver.sourceforge.net/n/naviserver/files/ns_register_url2file.html

It's like the 'mount' command in linux, or like symlinking one
directory to another.

Some examples (bit obscure...) here:

  http://bitbucket.org/naviserver/naviserver/src/tip/tests/url2file.test#cl-73

--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


[naviserver-devel] Migrating aol.com from proprietary platform (AOLserver) to Open Source

2009-07-13 Thread Stephen Deasey
Some pretty funny miss-statements in this history of AOLserver running aol.com:

http://velocityconference.blip.tv/file/2286110/


But the punchline is that their shiny new apache/tomcat setup can
barely manage half the 45 reqs/sec she derides the old AOLserver on 6
year old hardware achieving.


The other videos from this conference are actually interesting -- check 'em out.

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] DB Connection Handles nsdbipg

2009-03-26 Thread Stephen Deasey
On Thu, Mar 26, 2009 at 3:09 PM, Ian Harding harding@gmail.com wrote:
 Please ignore, it is a permission issue. ย The user had not rights in
 the schema, and since I used search_path, it didn't generate a
 permission denied error, it just didn't look there and generated a
 does not exist error.


Great.


FYI, there is some extra debug output available if you enable
server-wide debug logging. Each handle has an id and much of the log
output shows the id and the number of queries performed.  In this
case, you'd want to make sure that the same handle is being used for
both the SET command and the following query.

--
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] DB Connection Handles nsdbipg

2009-03-25 Thread Stephen Deasey
On Wed, Mar 25, 2009 at 10:56 PM, Ian Harding harding@gmail.com wrote:
 I am in a situation where I'd like to be able to set the search_path
 on each page request. ย In AOLServer I would have just made a db handle
 getter function that would call ns_db gethandle, issue a quick SET
 command, and pass the handle back to the caller.

 With nsdbipg I don't know how to do this. ย There doesn't seem to be an
 explicit getting of a handle. ย It seems that they are gotten
 automatically on each call and released on each call to a nsdbi
 function.


Handles are managed automatically by default, but you can extend the
lifetime with the eval command:

dbi_eval {
dbi_dml {set search_path to foo, public}
set users [dbi_rows {select * from users}]
}

When you don't pass the -transaction switch, you are simply reusing
the same handle.


 Maybe the datasource param can contain a schema setting, but even that
 would not be what I want. ย I want to be able to set the path ideally
 on each connection, or on each call to the nsdbi functions.


Do you want to set the path for the lifetime of the *database*
connection, or are you trying to create 'virtual' users with one
database pool, switching the schema search path for duration of the
*http* connection?

If it's the first, you could set the default path in the postgresql.conf file:

search_path = '$user, public'

If it's the second, then maybe something like the above db_eval will
work for you.

You could wrap it up in a command like:

with_schema foo {
dbi_rows { ... }
}

Alternatively, you could set the max number of handles to 0, in which
case the driver switches to handle-per-thread mode (See docs).  In
this case, when each command 'gets' a handle it will always get the
same one, as it is never actually returned to the pool but cached for
the thread.  The idea behind this was as a performance optimisation
for the case where pretty much all your conn threads perform queries
and getting and putting is just overhead. But it would allow you in
this case to set the schema path at the beginning of the http request
and have it persist.

--
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] commit/naviserver: Vlad Seryakov : Added call to nsproxy Tcl_FindExecutable(argv[0]); to keep Tcl 8.5 from crashing in thread related initialization.

2009-03-10 Thread Stephen Deasey
On Sun, Mar 8, 2009 at 4:13 PM,  commits-nore...@bitbucket.org wrote:
 1 new changeset in naviserver:

 http://www.bitbucket.org/naviserver/naviserver/changeset/4b0584c5e64b/
 changeset: ย  r2184:4b0584c5e64b
 user: ย  ย  ย  ย Vlad Seryakov
 date: ย  ย  ย  ย 2009-03-08 17:12:53
 summary: ย  ย  Added call to nsproxy Tcl_FindExecutable(argv[0]); to keep Tcl 
 8.5 from crashing in thread related initialization.


Already present...

  
http://bitbucket.org/naviserver/naviserver/src/4b0584c5e64b/nsproxy/nsproxylib.c#cl-432

--
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Mercurial help

2009-03-10 Thread Stephen Deasey
On Tue, Mar 10, 2009 at 4:14 PM, Vlad Seryakov v...@crystalballinc.com wrote:
 Stephen,

 Can you describe how to import module into hg on bitbucket, it keeps saying i 
 am not authorized.


Log in as 'naviserver' at bitbucket.org.

Got to:

http://bitbucket.org/repo/create

Fill out the info.  Once created, in the admin tab, on the right hand
side under Permissions - Administrators  add verseryakov and whoever
else you'd like.

Back on your machine...

You can now clone the repo from bitbucket to your machine if you like,
and commit straight into it -- the repo url will be set correctly for
you.

As a shortcut, you can add something like this to your ~/.hgrc file:

[paths]
nsfoo = https://vserya...@bitbucket.org/naviserver/nsfoo/

this allows you to refer to the repo on bitbucket as 'nsfoo' on the
command line. So, if you've converted one of the remaining repos and
you want to push it, without first cloning from bitbucket, you just:

cd ~/nsfoo-hg
hg outgoing nsfoo
hg push nsfoo

The 'outgoing' tells you what it would push without actually pushing.

If you edit the ~/nsfo-hg/.hg/hgrc to add:

[paths]
default = http://bitbucket.org/naviserver/nsfoo

you don't have to tell it where you want to push to. Just:

cd ~/nsfoo-hg
hg push


Once it's up there, *then* you can customise the rest of the Admin
options on bitbucket -- set up the commit emails etc. (look at
naviserver for an example). Do this second so you don't spam the list
with 5 years of history :-)


I've converted some more modules.  Here's what's left to do:

nsconf
nsexpat
#nsstats
nssys
nstk
nszlib

nsffmpeg
nsfortune
nsocaml
nsotcl
nssavi

nsdbext
nsdbpd


I know you said some where perhaps obsolete now, but what they hey,
better not to loose them.

You could leave nsdbext and nsdbpd for me if you like. I was going to
try merging in the whole aolserver history, which is a little more
work.

--
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Mercurial help

2009-03-10 Thread Stephen Deasey
On Tue, Mar 10, 2009 at 4:41 PM, Stephen Deasey sdea...@gmail.com wrote:
 On Tue, Mar 10, 2009 at 4:14 PM, Vlad Seryakov v...@crystalballinc.com 
 wrote:
 Stephen,

 Can you describe how to import module into hg on bitbucket, it keeps saying 
 i am not authorized.


 Log in as 'naviserver' at bitbucket.org.

 Got to:

 ย  ย http://bitbucket.org/repo/create

 Fill out the info. ย Once created, in the admin tab, on the right hand
 side under Permissions - Administrators ย add verseryakov and whoever
 else you'd like.

 Back on your machine...

 You can now clone the repo from bitbucket to your machine if you like,
 and commit straight into it -- the repo url will be set correctly for
 you.

 As a shortcut, you can add something like this to your ~/.hgrc file:

 ย  ย [paths]
 ย  ย nsfoo = https://vserya...@bitbucket.org/naviserver/nsfoo/

 this allows you to refer to the repo on bitbucket as 'nsfoo' on the
 command line. So, if you've converted one of the remaining repos and
 you want to push it, without first cloning from bitbucket, you just:

 ย  ย cd ~/nsfoo-hg
 ย  ย hg outgoing nsfoo
 ย  ย hg push nsfoo

 The 'outgoing' tells you what it would push without actually pushing.

 If you edit the ~/nsfo-hg/.hg/hgrc to add:

 ย  ย [paths]
 ย  ย default = http://bitbucket.org/naviserver/nsfoo

 you don't have to tell it where you want to push to. Just:

 ย  ย cd ~/nsfoo-hg
 ย  ย hg push


 Once it's up there, *then* you can customise the rest of the Admin
 options on bitbucket -- set up the commit emails etc. (look at
 naviserver for an example). Do this second so you don't spam the list
 with 5 years of history :-)


 I've converted some more modules. ย Here's what's left to do:

 nsconf
 nsexpat
 #nsstats
 nssys
 nstk
 nszlib

 nsffmpeg
 nsfortune
 nsocaml
 nsotcl
 nssavi

 nsdbext
 nsdbpd


 I know you said some where perhaps obsolete now, but what they hey,
 better not to loose them.

 You could leave nsdbext and nsdbpd for me if you like. I was going to
 try merging in the whole aolserver history, which is a little more
 work.



Oh yeah, if anyone has a few spare minutes you could add the missing
modules to ohloh:

   https://www.ohloh.net/tags/naviserver

Then we can link them up in the Tcl wiki and embed the ohloh graphs 'n stuff.

--
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] SLS

2009-03-02 Thread Stephen Deasey
On Mon, Mar 2, 2009 at 6:31 PM, Vlad Seryakov v...@crystalballinc.com wrote:
 I am working with persistent connections right now and want to track when the 
 socket is closed to cleanup some memory in
 Tcl but it looks like there is no way to call cleanup Tcl proc on socket 
 close. I am thinking to extend ns_sls to attach
 Tcl proc to be called at cleanup stage.
 Is this right thing to do?


What else have you had to modify to create persistent connections -- a
new driver?  You could run cleanup callbacks from your
Ns_DriverCloseProc.

Also, in what thread do you expect callbacks to run? In which thread
are the sockets being held open?

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Wiki Account

2009-02-19 Thread Stephen Deasey
On Thu, Feb 19, 2009 at 4:10 PM, Vlad Seryakov v...@crystalballinc.com wrote:
 Ian Harding wrote:
 Hi,

 Can I have an account on the wiki?

 Thanks!

 It was long time ago i used but now i always get this error even if i logged 
 in. In my opinion, this Wiki is no-use

 Sorry! We could not process your edit due to a loss of session data. Please 
 try again. If it still doesn't work, try
 logging out and logging back in.

 We've been using pmwiki for a long time under Naviservr with nsphp, this is 
 very simple and fast and powerful wiki, no
 need for database, just one dir with .php files. I'd vote for it, mediawiki 
 is too complex for occasional edits and the
 syntax i forget completely if do not use it for some time. pmwiki syntax is 
 much more simpler.


How about using the Tcl wiki?

  http://wiki.tcl.tk/naviserver

One advantage is that it has a critical mass of users, so that even
without requiring sign-up before editing there does not seem to be a
spam problem.  That's going to be tough to achieve in a stand-alone
wiki. (I think the spam on ours tired every one out).

Here's a list of all the pages on the current wiki:

  http://naviserver.sourceforge.net/w/Special:Allpages

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Config error

2009-02-05 Thread Stephen Deasey
On Thu, Feb 5, 2009 at 5:21 PM, Vasiljevic Zoran z...@archiware.com wrote:

 On 05.02.2009, at 18:14, Vlad Seryakov wrote:

 The reason i think because Ns_DStringPrintf now uses OS's snprintf,
 before that it uses home-grown sprintf-like engine.


Yeah, all uses of printf-like functions throughout the code base need
to be checked. I know at least I've been sloppy about this.


 Most probably. But that will not help us of course.
 I will need to learn this brave new code
 repository thing...


Don't forget to sign up with bitbucket.org and tell me your username.

You'll be able to clone (checkout) and commit (locally) no problem as
is, but you need to be authorized to push back.

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] nsdbi 0.2 released

2009-02-04 Thread Stephen Deasey
On Wed, Feb 4, 2009 at 2:37 PM, Ian Harding harding@gmail.com wrote:
 On Wed, Jun 11, 2008 at 3:43 AM, Stephen Deasey sdea...@gmail.com wrote:
 Changes and downloads:


 http://sourceforge.net/project/shownotes.php?release_id=605838group_id=130646


 I just discovered this, and it's all I need to decide to jump to
 Naviserver from AOLServer.


Great.

How did you eventually find it?  (just wondering...)

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] commit/naviserver: groks: Manage lifetime of tcl synchronization objects without trampling memory -- -- The old scheme with both anonymous and named locks was makinf it difficul

2008-12-01 Thread Stephen Deasey
On Tue, Dec 2, 2008 at 3:33 AM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 Stephen,

 Will it be too much to ask just to add all existing modules into
 Mercurial, frankly i would like to do it but just my mind on something
 else right now. At the same time i will start using Naviserver big time
 very soon and would like to have repository available for all bugfixes
 and improvements.


I already converted some:

  http://www.bitbucket.org/naviserver/

I'll do the rest, but if there's any that are particularly important
to you I'll do them first.

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] commit/naviserver: groks: Manage lifetime of tcl synchronization objects without trampling memory -- -- The old scheme with both anonymous and named locks was makinf it difficul

2008-11-25 Thread Stephen Deasey
On Tue, Nov 25, 2008 at 1:28 AM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 That means all development from now on goes to Mercurial, Right?


Well no one complained so I guess that means we've switched.

I'll convert the other modules...

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] nsdbpg

2008-11-21 Thread Stephen Deasey
On 11/21/08, Bernd Eidenschink [EMAIL PROTECTED] wrote:

  I'm cursed. I never can compile a postgres driver for naviserver
  from scratch.

  Here's my tale - maybe you can hint me to an obvious mistake:

  I compiled a Postgres 8.2.11 from source into
  /opt/pgsql8.2.11

  Then I checked out /modules/nsdbpg.

  I changed in the Makefile the line
  MODLIBS= -lnsdb -lpq


You shouldn't need to edit the Makefile.

NAVISERVER points to the base of your naviserver install, and
POSTGRES points the base of your postgres install.

So,

$ make NAVISERVER=/usr/local/ns POSTGRES=/opt/pgsql8.2.11


(The Makefile uses -rpath to embed the location of postgres into
nsdbpg, so you shouldn't need to use LD_LIBRARY_PATH)

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] make memcheck / valgrind

2008-11-21 Thread Stephen Deasey
On 11/21/08, Bernd Eidenschink [EMAIL PROTECTED] wrote:

   No no. Errors are bad, there should be none.
  
   Stop teasing and show us them...   :-)


 Here you go:
  http://www.kinetiqa.de/naviserver/memcheck.log.txt

  TCL: 8.4.19 sources


This is weird, 8.4 also has errors? (you were using 8.5.5 before?)

8.4.19 works for me.

Are you compiling 32bit on a 64bit linux box?


Anyway, these kinds of things are usually errors (the message is from valgrind):

==18662== Invalid read of size 4
==18662==at 0x40151E3: (within /lib/ld-2.7.so)
==18662==by 0x4005C59: (within /lib/ld-2.7.so)
==18662==by 0x4007A87: (within /lib/ld-2.7.so)
==18662==by 0x4011533: (within /lib/ld-2.7.so)
==18662==by 0x400D5C5: (within /lib/ld-2.7.so)
==18662==by 0x4010F4D: (within /lib/ld-2.7.so)
==18662==by 0x41E9C18: (within /lib/tls/i686/cmov/libdl-2.7.so)
==18662==by 0x400D5C5: (within /lib/ld-2.7.so)
==18662==by 0x41EA2BB: (within /lib/tls/i686/cmov/libdl-2.7.so)
==18662==by 0x41E9B50: dlopen (in /lib/tls/i686/cmov/libdl-2.7.so)
==18662==by 0x41CF245: TclpDlopen (tclLoadDl.c:78)
==18662==by 0x419195C: Tcl_FSLoadFile (tclIOUtil.c:2791)
==18662==  Address 0x4fd2fc0 is 32 bytes inside a block of size 35 alloc'd
==18662==at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==18662==by 0x4006FC4: (within /lib/ld-2.7.so)
==18662==by 0x40079C9: (within /lib/ld-2.7.so)
==18662==by 0x4011533: (within /lib/ld-2.7.so)
==18662==by 0x400D5C5: (within /lib/ld-2.7.so)
==18662==by 0x4010F4D: (within /lib/ld-2.7.so)
==18662==by 0x41E9C18: (within /lib/tls/i686/cmov/libdl-2.7.so)
==18662==by 0x400D5C5: (within /lib/ld-2.7.so)
==18662==by 0x41EA2BB: (within /lib/tls/i686/cmov/libdl-2.7.so)
==18662==by 0x41E9B50: dlopen (in /lib/tls/i686/cmov/libdl-2.7.so)
==18662==by 0x41CF245: TclpDlopen (tclLoadDl.c:78)
==18662==by 0x419195C: Tcl_FSLoadFile (tclIOUtil.c:2791)



  BTW: make install fails because of install-docs in Makefile,
  maybe it would make sense to change the Makefile to be more
  aware of missing dtplite-missing situations.


The idea is that if you are building from a released tarball then the
built documentation is included and you don't need dtplite. If you're
building direct from the repo, you need dtplite (and autoconf, etc.).


  Nice: The ns_thread.test(s) double the memory usage, saturate my box with
  100% CPU load... but, once done, all falls back to where it started.


Well at least something's working!

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Chnaged my mind: switch to mercurial

2008-11-20 Thread Stephen Deasey
On 11/20/08, Vlad Seryakov [EMAIL PROTECTED] wrote:
 vseryakov is my username,


OK. I've given you write access.


  looks oike adding openssh pub key does not work, it keeps saying SSH key is 
 not valid


Perhaps during cut 'n paste a stray \n crept in?  Worked for me.

Anyway, you don't need to use ssh, ssl works just as well (http is
mercurial's native transport):

$ hg clone https://[EMAIL PROTECTED]/naviserver/naviserver/
~/in/naviserver-hg



btw. it seems that the bitbucket site is set up such that all repos
belong to a person, so for the naviserver repo I created a 'fake'
person 'naviserver' to own it. I'll send you and Zoran the password,
in case I'm run over by a walrus or something.

You won't need to use it on a day to day basis. It's just for adding
more people to the commit list and changing the details on the
website.


Also, make sure you have this in your ~/.hgrc

[ui]
username=Vlad Seryakov [EMAIL PROTECTED]

so that it matches all the other log entries, otherwise you'll be
[EMAIL PROTECTED] or whatever.

And for log messages note that the convention is to have a single
line, like an email subject, then a blank line, then any extra
explanation, in normal paragraphs. Word wrap to 70-80 characters. Use
active voice, 'fix' rather than 'fixed'. No full stop. if it's a
module, prefix with 'nsperm: ' or whatever. Check what's there
already, you'll get the idea. And because commit and push are
separate, you can check and redo as many times as you like before
anything is public.

If you find yourself trying to describe two things, they should have
been separate commits. Mercurial makes this easy. You can commit
multiple times, and then at the end push to the public repo.

And clean your finger nails, and brush your teeth, and say your prayers...

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Chnaged my mind: switch to mercurial

2008-11-20 Thread Stephen Deasey
On 11/20/08, Vasiljevic Zoran [EMAIL PROTECTED] wrote:

  On 20.11.2008, at 20:33, Stephen Deasey wrote:

  
   And clean your finger nails, and brush your teeth, and say your
   prayers...


 Eh... brave new world...

  So yet another thing to learn... I guess Internet is full of docs
  about this and I will have fun reading it.


Hopefully, it will take you about 2 minutes to get the basics, which
is the advantage of mercurial over git, an otherwise great system.

Clone the repository first. You need the bits on your hard drive:


$ hg clone https://[EMAIL PROTECTED]/naviserver/naviserver/
$ cd naviserver

... hack hack hack...

$ hg commit
$ hg push


Now obviously there are bells n' whistles, but the basics are easy
enough that it shouldn't prevent you from getting things done.


(The built-in help is excellent: hg help, hg pull --help, etc.)

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


[naviserver-devel] Chnaged my mind: switch to mercurial

2008-11-19 Thread Stephen Deasey
On Wed, Aug 20, 2008 at 7:16 AM, Vasiljevic Zoran [EMAIL PROTECTED] wrote:

 On 20.08.2008, at 00:19, Stephen Deasey wrote:

 I think it's probably better to stay with the familiar cvs. It doesn't
 scare anyone, SF handles everything, and patches are probably too
 infrequent to for the vcs to make much difference anyway.

 Agree?

 Yes. Lets keep it simple for now.



I've changed my mind about this again. It's just too much of a pain in
the ass to do anything more than minor fixes without trampling on
other peoples stuff, using CVS.

Here's something new though:

  http://www.bitbucket.org/naviserver/naviserver/overview/

Fancy hosting for mercurial repos. It's like github (if you're
familiar with that, very popular), but for mercurial. It's up to date
for both branches of AOLserver, and naviserver with the exception of
Zoran's commit the other day (I'll update that now).  It also models
the fact that naviserver is a fork AOLserver 4.0.10.

This would have all the advantages we talked about previously, plus a
couple of new ones which would be particularly helpful when developing
larger changes which need a bit of back and forth development before
being committed: branches a patch queues.

If you look at the interface you'll see a 'fork' link. The idea is any
random stranger can fork any project to make changes. They then send a
pull request to you and merge the changes back, and they delete their
fork.  Bitbucket also supports mercurial queues, which is almost the
same but a bit easier when reworking a set of patches.

So the ideas is that we'd use bitbucket for hosting the mercurial
repos and keep everything else as is.

How does this sound?


(Tell me you username on bitbucket and I'll add you to the project).

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] naviserver ChangeLog,1.827,1.828

2008-11-08 Thread Stephen Deasey
On Sat, Nov 8, 2008 at 10:42 PM, Vlad Seryakov
[EMAIL PROTECTED] wrote:
 Update of /cvsroot/naviserver/naviserver
 In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26902

 Modified Files:
ChangeLog
 Log Message:
 mark connection flags when last chunk is sent


 Index: ChangeLog
 ===
 RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v
 retrieving revision 1.827
 retrieving revision 1.828
 diff -C2 -d -r1.827 -r1.828
 *** ChangeLog   7 Nov 2008 19:01:57 -   1.827
 --- ChangeLog   8 Nov 2008 22:42:09 -   1.828
 ***
 *** 1,2 
 --- 1,7 
 + 2008-11-08  Vlad Seryakov [EMAIL PROTECTED]
 +
 +   * nsd/connio.c: Mark connection flags with NS_CONN_SENT_LAST_CHUNK
 +   when last chunk is actuall sent.
 +


What?


$ grep -r NS_CONN_SENT_LAST_CHUNK *

ChangeLog:   * nsd/connio.c: Mark connection flags with NS_CONN_SENT_LAST_CHUNK
include/ns.h:   #define NS_CONN_SENT_LAST_CHUNK0x100 /* Marks that
the last chunk was sent in chunked mode */
nsd/connio.c:  connPtr-flags |= NS_CONN_SENT_LAST_CHUNK;

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] PHP streaming hangs

2008-11-08 Thread Stephen Deasey
On Sat, Nov 8, 2008 at 8:47 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:

 Do you need to buy into the full build process? Maybe you can just
 pull in the header and link against the library..?

 The problem with PHP that it can support only one SAPI implementation
 and nsphp is not just extesion but SAPI handler, so just compiling it as
 extension will not work



There's an --enable-embed=shared option, and it seems to work (added).

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] naviserver/tcl fastpath.tcl,1.5,1.6

2008-11-07 Thread Stephen Deasey
On Fri, Nov 7, 2008 at 3:12 AM, Vlad Seryakov
[EMAIL PROTECTED] wrote:

 + # If address set to 0.0.0.0 in nssock to listen on
 + # all interfaces we may try to use Host: header to
 + # return proper urls
 + #
 +
 + if { $loc == http://0.0.0.0; } {
 +   set host [ns_set iget [ns_conn headers] Host]
 +   if { $host !=  } {
 + set loc http://$host
 +   }
 + }


You can't take unfiltered input from the host header and then feed it
back to ns_returnredirect as this vulnerable to a response splitting
attack.

  http://www.google.co.uk/search?q=response+splitting

It seems like this may be a more general kind of bug. After all, it's
not just in directory listings that 0.0.0.0 is an invalid host
address. Take a look at conn.c:Ns_ConnLocationAppend() -- looks like
this is where the fix needs to go.

This is a tricky are so add some extra tests in tests/ns_conn_host.test

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] modules/nsssl nsssl.c,1.6,1.7

2008-11-07 Thread Stephen Deasey
On Wed, Oct 22, 2008 at 8:58 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 Stephen Deasey wrote:
 On Wed, Oct 22, 2008 at 9:03 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 I tried to use Ns_SockSendBufs() but it sends data directly to socket
 where i need to send via driver's send proc.


 Just pass your Send() proc directly, and delete SendBufs():

  static ssize_t
  SendFile(Ns_Sock *sock, Ns_FileVec *bufs, int nbufs, Ns_Time
 *timeoutPtr, int flags)
  {
 -return Ns_SockSendFileBufsIndirect(sock-sock, bufs, nbufs,
 timeoutPtr, flags, SendBufs);
 +return Ns_SockSendFileBufsIndirect(sock-sock, bufs, nbufs,
 timeoutPtr, flags, Send);
  }


 Why connPtr-nContentSent is not updated, all send called with conn
 parameters should do this


 Yes, but Ns_ConnSend() is higher up the stack, so when sending data it
 looks something like this:

 return.c: Ns_ConnReturnData
 connio.c: Ns_ConnWriteData
 connio.c: Ns_ConnWriteVData
 connio.c: Ns_ConnSend
 driver.c: NsDriverSend
 nsssl/nsssl.c: Send


 By the time your Send() is called we've already passed through
 Ns_ConnSend(). nContentSent will be updated as the stack unwinds.

 If you call Ns_ConnSend() from within Send(), that's a loop...


 The first argument is different, Ns_Sock vs SOCKET



Fixed. For SSL (and for all drivers) just leave sendfFileProc as NULL
and your sendProc will be called as needed to send file/buffer chunks.

If you were writing something like an FTP server, then you would want
to copy nssock and call Ns_SockSendFileBufs to optimise the
reading-from-disk/writing-to-network. Leaving it NULL will always be
correct though.

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] naviserver/nsd driver.c,1.119,1.120

2008-11-07 Thread Stephen Deasey
On Wed, Oct 22, 2008 at 10:35 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 static ssize_t
 Recv(Ns_Sock *sock, struct iovec *bufs, int nbufs, Ns_Time
 *timeoutPtr, int flags)
 {
 static const char request[] = GET /whateva HTTP/1.0\r\n\r\n;
 size_t requestLen = sizeof(request);
 socklen_t sockLen = sizeof(struct sockaddr_in);

 memcpy(bufs-iov_base, request, requestLen);

 return recvfrom(sock-sock,
 bufs-iov_base + requestLen,
 bufs-iov_len - requestLen,
 0, (struct sockaddr*) sock-sa, size);
 }

 (checking for buffer lengths skipped here)


 The advantage of doing it this way is that everything is much simpler
 from the driver threads point of view. It doesn't need to know
 anything special about non-standard protocols, and there isn't
 anything in the driver callback api that isn't also useful to the HTTP
 server.

 Arguable this is not very clear and simple, driver will have to hack
 buffers and every request should pretend to be HTTP just so driver
 thread would think that it serves only HTTP requests.


 It's clear and simple. It's maybe not very pretty :-)


 If we have special codes and already have 3, does another one breaks
 anythings if only one code makes overall process simpler not only in
 driver thread but for drivers itself?


 It's a trade off.

 Either non-standard drivers prepend their first read with 20 bytes in Recv().
 (~ two lines of code)

 *OR*

 You need to change all parts of the sever that expect an HTTP request
 structure to be available. AND you need to account for the fact that
 sometimes it gets created in the normal fashion, but other times it
 gets created later, or not at all.


 You've tried to ways to do this:


 1) Exposing a new Ns_DriverSetRequest routine.

 Here's what it looked like in nssyslogd:

 http://naviserver.cvs.sourceforge.net/viewvc/naviserver/modules/nssyslogd/nssyslogd.c?revision=1.18view=markup

 NS_EXPORT int
 Ns_ModuleInit(char *server, char *module)
 {
 ...
 Ns_RegisterRequest(server, SYSLOG,  /, SyslogRequestProc,
 NULL, srvPtr, 0);
 ...
 }

 static NS_DRIVER_ACCEPT_STATUS
 Accept(Ns_Sock *sock, SOCKET listensock, struct sockaddr *sockaddrPtr,
 int *socklenPtr)
 {
 sock-sock = listensock;
 Ns_DriverSetRequest(sock, SYSLOG / HTTP/1.0);
 return NS_DRIVER_ACCEPT_DATA;
 }


 How is this functionally different to what I proposed (example in Recv 
 above)?


 2) Doing away with the need for a Ns_Request all together.

 Which now looks like this:

 http://naviserver.cvs.sourceforge.net/viewvc/naviserver/modules/nssyslogd/nssyslogd.c?revision=1.19view=markup

 NS_EXPORT int
 Ns_ModuleInit(char *server, char *module)
 {
 ...
 init.requestProc = Request;
 ...
 init.opts = NS_DRIVER_ASYNC | NS_DRIVER_NOPARSE;
 ...
 }

 static int
 Request(void *arg, Ns_Conn *conn)
 {
 Ns_DString *dsPtr = Ns_ConnSockContent(conn);
 SyslogRequest *req = SyslogRequestCreate(server, sockPtr-sock,
 dsPtr-string, dsPtr-length, sa);
 SyslogRequestProcess(req);
 ...
 }


 The strategy here seems to be to completely ignore the standard
 request structure and do your own thing. There's nothing wrong with
 this in the abstract -- you're not actually using any of the HTTP
 stuff. However, the rest of the server fully expects the HTTP request
 to be present and filled in, and this is why you've had to touch
 dozens of files in dozens of places fixing up all code that might trip
 over a null request field. (And the public API has changed...)


 As far as I can see, neither method 1 or 2 achieves anything than
 passing METHOD / HTTP/1.0\r\n\r\n does, using considerably less
 code.

 For example, In the snippet above, you can see the newly added
 Ns_ConnSockContent which returns a pointer to the read buffer (which
 is otherwise private). Ordinarily the buffer would contain the HTTP
 request line, any headers, then any body. You can get at the body with
 the existing Ns_ConnContent. So if you just return SYSLOG /
 HTTP/1.0\r\n\r\n and then your bytes in Recv(), the request would be
 constructed and then you could parse the protocol beginning in the
 body content.



 I will try to take a look at this. ...



Did you take a look at this?  What do you think?

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] PHP streaming hangs

2008-11-07 Thread Stephen Deasey
On Fri, Nov 7, 2008 at 9:23 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:

 This is the simple PHP page that triggers hanging, when attached to the
 nsd, backtrace on all thread show they all are in the condwait or poll
 wait, seems like sent/expected bytes miscalculation.

 ?php

 $test = @$_COOKIE[test];
 setcookie(test, 1, time() + 60, '/');

 if ($test == 1) {
header(HTTP/1.0 304 Not Modified);
exit();
 }
 ?
 test page



Make a 'tests' directory and add the above snippet. Make it run from
'make test'.

The 'nsvfs' module in CVS is an example of an external module which
has tests using the nstest_http command. You could just 'cp -a
../nsvfs/tests tests' and then cut 'n paste from the Makefile.

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] nsphp and other broken things

2008-10-29 Thread Stephen Deasey
On Tue, Oct 28, 2008 at 5:02 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 After 2008-09-11, nsphp stopped working, even with the latest update to
 non-obsolete functions, it looks like something in the core flow,
 especially streaming part doe snot work properly.

 I tried all versions and the latest stable is marked in ChangeLog at
 2008-09-11.

 This is only HTTP related and it could be problem in nsphp, but it was
 very stable until functions it used became obsolete. I started using
 Ns_ConnWriteData with or without NS_CONN_STREAM and browsers stopped
 showing web pages.

 These functions would tell that streaming is required and no
 Content-Length will be supplied:

 Ns_ConnSetRequiredHeaders(ctx-conn, ctype, -1);
 Ns_ConnFlushHeaders(ctx-conn, SG(sapi_headers).http_response_code);

 Then
 Ns_ConnWriteData without any flags would just send data to the browser

 In new code, the server does all things automatically but NS_CONN_STREAM
 flags is required to tell that we are streaming. Flush is not used
 anymore. When i telnet i get page back without content-length but still,
 every second request hangs or comes empty.



I'm not sure how you're triggering this. Can you write a test and
point me at it?

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] naviserver ChangeLog,1.820,1.821

2008-10-22 Thread Stephen Deasey
On Wed, Oct 22, 2008 at 3:14 AM, Vlad Seryakov
[EMAIL PROTECTED] wrote:
 Update of /cvsroot/naviserver/naviserver
 In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17830

 Modified Files:
ChangeLog
 Log Message:
 nsssl module ported, sock context and driver context exposed


 Index: ChangeLog
 ===
 RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v
 retrieving revision 1.820
 retrieving revision 1.821
 diff -C2 -d -r1.820 -r1.821
 *** ChangeLog   21 Oct 2008 21:46:36 -  1.820
 --- ChangeLog   22 Oct 2008 02:14:23 -  1.821
 ***
 *** 13,16 
 --- 13,24 
  modules/nstftpd: ported to new driver API

 + modules/nsssl: Ported to new API
 +
 + nsd/conn.c: Added new Ns_ConnSockContext function which returns 
 sock-arg,
 + socket-wide context
 +
 + Ns_ConnDriverContext will now return connPtr-drvPtr-arg, this is 
 driver-wide
 + context.
 +


These structure members are already public, so Ns_ConnSockContext()
and Ns_ConnDriverContext() are not needed:

include/ns.h:

typedef struct Ns_Sock {
Ns_Driver  *driver;
SOCKET  sock;   /* Connection socket */
struct sockaddr_in  sa; /* Actual peer address */
void   *arg;/* Driver context. */
} Ns_Sock;

typedef struct Ns_Driver {
void*arg;   /* Driver callback data. */
   ...

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] naviserver/nsd driver.c,1.119,1.120

2008-10-22 Thread Stephen Deasey
On Wed, Oct 22, 2008 at 4:23 AM, Vlad Seryakov
[EMAIL PROTECTED] wrote:
 Update of /cvsroot/naviserver/naviserver/nsd
 In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22913/nsd

 Modified Files:
driver.c
 Log Message:
 new accept status, SSL driver works now


 Index: driver.c
 ===
 RCS file: /cvsroot/naviserver/naviserver/nsd/driver.c,v
 retrieving revision 1.119
 retrieving revision 1.120
 diff -C2 -d -r1.119 -r1.120
 *** driver.c20 Oct 2008 00:06:54 -  1.119
 --- driver.c22 Oct 2008 03:23:06 -  1.120
 ***
 *** 787,791 
   * Results:
   *  _ACCEPT:   a socket was accepted, poll for data
 !  *  _ACCEPT_DATA:  a socket was accepted, data present
   *  _ACCEPT_ERROR: no socket was accepted
   *
 --- 787,793 
   * Results:
   *  _ACCEPT:   a socket was accepted, poll for data
 !  *  _ACCEPT_DATA:  a socket was accepted, data present, read immediately
 !  * if in async mode, defer reading to connection thread
 !  *  _ACCEPT_QUEUE: a socket was accepted, queue immediately
   *  _ACCEPT_ERROR: no socket was accepted
   *
 ***
 *** 1523,1534 

  } else {
  drvPtr-queuesize++;

 - /*
 -  * If there is already data present then read it without
 -  * polling if we're in async mode.
 -  */
 -
  if (status == NS_DRIVER_ACCEPT_DATA) {
  if (drvPtr-opts  NS_DRIVER_ASYNC) {
  status = SockRead(sockPtr, 0);
 --- 1525,1538 

  } else {
 + status = SOCK_MORE;
  drvPtr-queuesize++;

  if (status == NS_DRIVER_ACCEPT_DATA) {
 +
 + /*
 +  * If there is already data present then read it without
 +  * polling if we're in async mode.
 +  */
 +
  if (drvPtr-opts  NS_DRIVER_ASYNC) {
  status = SockRead(sockPtr, 0);
 ***
 *** 1541,1553 

  /*
 !  *  We need to call this to make sure socket has request 
 structure allocated,
 !  *  otherwise NsGetRequest will call SockRead which is not 
 what this driver wants
   */

 - SockPrepare(sockPtr);
  status = SOCK_READY;
  }
 ! } else {
 ! status = SOCK_MORE;
  }
  }
 --- 1545,1564 

  /*
 !  * Queue this socket without reading, NsGetRequest in
 !  * the connection thread will perform actual reading of the 
 request
   */

  status = SOCK_READY;
  }
 ! } else
 ! if (status == NS_DRIVER_ACCEPT_QUEUE) {
 !
 ! /*
 !  *  We need to call SockPrepare to make sure socket has request 
 structure allocated,
 !  *  otherwise NsGetRequest will call SockRead which is not what 
 this driver wants
 !  */
 !
 ! SockPrepare(sockPtr);
 ! status = SOCK_READY;
  }
  }


Why the new accept status: NS_DRIVER_ACCEPT_QUEUE ?

The idea we talked about with the driver callbacks was that a
non-standard driver could fake-up a request in it's read callback. So,
whereas at the mo you have something like this:

modules/nsudp/nsudp.c:

static NS_DRIVER_ACCEPT_STATUS
Accept(Ns_Sock *sock, SOCKET listensock, struct sockaddr *sockaddrPtr,
int *socklenPtr)
{
sock-sock = listensock;
return NS_DRIVER_ACCEPT_DATA;
}

static ssize_t
Recv(Ns_Sock *sock, struct iovec *bufs, int nbufs, Ns_Time
*timeoutPtr, int flags)
{
 socklen_t size = sizeof(struct sockaddr_in);

 return recvfrom(sock-sock, bufs-iov_base, bufs-iov_len, 0,
(struct sockaddr*)sock-sa, size);
}


You would instead do something like this:


static ssize_t
Recv(Ns_Sock *sock, struct iovec *bufs, int nbufs, Ns_Time
*timeoutPtr, int flags)
{
static const char request[] = GET /whateva HTTP/1.0\r\n\r\n;
size_t requestLen = sizeof(request);
socklen_t sockLen = sizeof(struct sockaddr_in);

memcpy(bufs-iov_base, request, requestLen);

return recvfrom(sock-sock,
bufs-iov_base + requestLen,
bufs-iov_len - requestLen,
0, (struct sockaddr*) sock-sa, size);
}

(checking for buffer lengths skipped here)


The advantage of doing it this way is that everything is much simpler
from the driver threads point of view. It doesn't need to know
anything special about non-standard protocols, and there isn't
anything in the driver callback api that isn't also useful to the HTTP
server.


Also, this can't work:

nsd/driver.c:1515

status = DriverAccept(sockPtr);

if (status == NS_DRIVER_ACCEPT_ERROR) {
status = SOCK_ERROR;
...

} else {
status = SOCK_MORE;
...

if (status == NS_DRIVER_ACCEPT_DATA) {
...
} else if (status == NS_DRIVER_ACCEPT_QUEUE) 

Re: [naviserver-devel] modules/nsssl nsssl.c,1.6,1.7

2008-10-22 Thread Stephen Deasey
 Index: nsssl.c
 ===
 RCS file: /cvsroot/naviserver/modules/nsssl/nsssl.c,v
 retrieving revision 1.6
 retrieving revision 1.7
 diff -C2 -d -r1.6 -r1.7
 *** nsssl.c 22 Oct 2008 02:14:24 -  1.6
 --- nsssl.c 22 Oct 2008 03:23:06 -  1.7
 ***
 --- 432,447 
   */

 ! static int
 ! SendBufs(SOCKET sock, struct iovec *bufs, int nbufs, Ns_Time *timeoutPtr, 
 int flags)
  {
 ! Ns_Conn *conn = Ns_GetConn();
 !
 ! return Ns_ConnSend(conn, bufs, nbufs);
 ! }
 !


This should be Ns_SockSendBufs(), otherwise connPtr-nContentSent will
be double counted and the driver thread may block.

Although in this case it should actually be Send(), which is your SSL
specific implementation of Ns_SockSendBufs(). The way it is now static
files may be sent in the clear :-/


(Basically, you implement the SendFile() callback by calling
Ns_SockSendFileIndirect(), which is the default library implementation
which scrapes the bytes off disk, and pass it Send(), which is your
implementation of writing to the network.  nssock is maybe a little
confusing in that it doesn't actually do anything but call the default
implementations, because it doesn't have to...)

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] modules/nsssl nsssl.c,1.6,1.7

2008-10-22 Thread Stephen Deasey
On Wed, Oct 22, 2008 at 9:03 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 I tried to use Ns_SockSendBufs() but it sends data directly to socket
 where i need to send via driver's send proc.


Just pass your Send() proc directly, and delete SendBufs():

 static ssize_t
 SendFile(Ns_Sock *sock, Ns_FileVec *bufs, int nbufs, Ns_Time
*timeoutPtr, int flags)
 {
-return Ns_SockSendFileBufsIndirect(sock-sock, bufs, nbufs,
timeoutPtr, flags, SendBufs);
+return Ns_SockSendFileBufsIndirect(sock-sock, bufs, nbufs,
timeoutPtr, flags, Send);
 }


 Why connPtr-nContentSent is not updated, all send called with conn
 parameters should do this


Yes, but Ns_ConnSend() is higher up the stack, so when sending data it
looks something like this:

return.c: Ns_ConnReturnData
connio.c: Ns_ConnWriteData
connio.c: Ns_ConnWriteVData
connio.c: Ns_ConnSend
driver.c: NsDriverSend
nsssl/nsssl.c: Send


By the time your Send() is called we've already passed through
Ns_ConnSend(). nContentSent will be updated as the stack unwinds.

If you call Ns_ConnSend() from within Send(), that's a loop...

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Last build, cache test failure

2008-08-28 Thread Stephen Deasey
On Tue, Aug 26, 2008 at 11:36 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 I spent a lot of time and still cannot resolve the problem with latest
 version ns_cache test failure.

 One problem i noticed with latest Tcl 8.5.4, in crashes nsd in thread
 test in 64bit and hangs forever in 32bit Linux.

 But ns_caches fails with tests using -expires and i rolled back the
 changed i made recently and it still fails. I cannot see why driver
 change would make it fail, but other sources are the same.

 Help please


When doing development, as opposed to building for install, you MUST
run autogen.sh with --prefix=/tmp/ns or some other path that is
unlikely to have a copy of the naviserver libraries.

Otherwise, you will drive yourself insane...  :-)

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Bug in fastpath cache causes info leak

2008-08-28 Thread Stephen Deasey
On Thu, Aug 28, 2008 at 9:52 PM, Vasiljevic Zoran [EMAIL PROTECTED] wrote:

 On 21.08.2008, at 21:06, Stephen Deasey wrote:

 You used to have to manually edit the makefile to disable zippy. Is
 this still the case?

 Perhaps the Tcl default should be to use the system allocator even on
 threaded builds, and to provide a configure switch to enable zippy.
 Zoran, you have Tcl cvs access right?

 Yes. I just discussed this with Vlad.
 Here is the consensus:

 There is Tcl single-threaded allocator and zippy allocator.

 If you turn on Tcl allocator it should use
  single-threaded allocator for non-thread builds
  zippy allocator for thread builds

 If you turn off Tcl allocator it should use
  system-level malloc regardless of the thread/nonthread builds

 This is most logical setup. So, either you have custom Tcl
 memory allocator or not. If you dont, then system malloc is used.
 If you do, then it depends on the threaded build.

 To aid this, there is (confugure-wise unused) USE_TCLALLOC define.
 Control which (simple one-lock Tcl allocator or AOL's zippy allocator)
 is selected, is done over USE_THREAD_ALLOC.

 By allowing the USE_TCLALLOC  to be confugured from the outside
 one can decide wether TCL allocator (singlethreaded or zippy)
 or system/OS malloc us used.

 The USE_THREAD_ALLOC is implicitly set (reset) when threaded build
 is configured (or not).

 This way we would have one knob (the USE_TCLALLOC) which we can
 toggle over --enable-tclalloc (default us true). By --disable-tclalloc
 we would default to system level alloc, thread build or not.

 This is the path of least resistence and would not change any defaults.
 I could go to the Tcl core list with this suggestion, yes.

 Vlad suggested to raise the queston of disabling the zippy even for
 thread builds, per default. I can only second that. But then again,
 we would change the default behaviour from as-is now and that is a
 chance to get some oposition which I do not have time to deal with.

 What do you think?


Sounds sensible. Configuration knob first, change defaults later, possibly.

To change the default is going to require proof that one way is better
than another anyway. There's a Tcl performance test suite somewhere,
right?  Some work for somebody...

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Bug in fastpath cache causes info leak

2008-08-21 Thread Stephen Deasey
On Thu, Aug 21, 2008 at 7:49 PM, Vasiljevic Zoran [EMAIL PROTECTED] wrote:

 On 21.08.2008, at 18:26, Vlad Seryakov wrote:

 I always recompile Tcl with default memory
 allocator: it has 2 benefits, 1) not-ever-growing, 2) i can use
 vtmalloc
 easily for example if default one does not work like i need

 yep. me too.



You used to have to manually edit the makefile to disable zippy. Is
this still the case?

Perhaps the Tcl default should be to use the system allocator even on
threaded builds, and to provide a configure switch to enable zippy.
Zoran, you have Tcl cvs access right?

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] How to http proxy?

2008-08-19 Thread Stephen Deasey
On Tue, Aug 19, 2008 at 3:43 PM, Vasiljevic Zoran [EMAIL PROTECTED] wrote:
 Hi !

 I would need to make a GET/POST/HEAD proxy module for
 HTTP and I recall that somebody did that (Vlad?) but
 I cannot find it in the code (OK I did not look very
 deep). Can somebody point me where to look, quickly?


naviserver/tcl/http.tcl

ns_proxy_handler_http

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


[naviserver-devel] CVS, just keep it?

2008-08-19 Thread Stephen Deasey
So what's the verdict on switching from cvs to mercurial? Or git or whatever?

Vlad is the only one who gave it a try, but he switched back to cvs.

There's an orphan commit to mercurial now that isn't in cvs. Here's the patch:

  http://naviserver.sourceforge.net/hg/naviserver/rev/e5f41846eef4


I think it's probably better to stay with the familiar cvs. It doesn't
scare anyone, SF handles everything, and patches are probably too
infrequent to for the vcs to make much difference anyway.

Agree?

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


[naviserver-devel] Bug in fastpath cache causes info leak

2008-08-19 Thread Stephen Deasey
fyi, there's talk of a bug in the fastpath cache on the aolserver
list. I agree with the reporter, John: it's totally busted. I
committed a fix last night, but if you're not on the commits list you
won't have seen it. Heads up.

The fix was to lookup objects in the cache using the file name, as the
windows code did, and not use the two-stage file name to inode, inode
to object lookups.

The only down side might be that if you have files known by more than
one name, eg symlinks, the cache will hold duplicates and be less
efficient. But that may not be a great idea anyway: with symlinks,
user-agents will use different URLs to request the same file, so HTTP
caching can't be used.

Also, it seems to me that the problem has nothing to do with dynamic
content or temp files or the programmer doing anything wrong. You
could be unlucky with your timing and have random content appear
instead of the file you expected. For example, two programmers could
log in to one machine and edit two html documents live. If they happen
to save at the same time, and there happens to be requests for those
files which cause them to be cached, and the OS chooses to recycle
inodes unfavourably, then the contents of either of the files might
appear to be any other file that has previously been cached by
fastpath.  Ouch.

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


[naviserver-devel] nsdbi 0.2 released

2008-06-11 Thread Stephen Deasey
Changes and downloads:


http://sourceforge.net/project/shownotes.php?release_id=605838group_id=130646

(you'll also need the updated driver)


There are some more inline examples in the man page:

http://www.groks.org/nsdbi.n.html

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Mercurial: naviserver.sourceforge.net/hg/

2008-06-02 Thread Stephen Deasey
On Mon, Jun 2, 2008 at 2:08 AM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 I decided to try, followed all the instructions.
 First impression is very positive, it was easy. I commited my latest
 changes into hg, so now both repos are in sync.
 I will try to maintain both for a while and see how it goes and will
 import all the modules one by one.


Groovy.

Looks like the commit email got lost somewhere :-/   I thought I had
that sorted...

Also, double-check your ui.username in ~/.hgrc

  [ui]
  username = Vlad Seryakov [EMAIL PROTECTED]

  http://naviserver.sourceforge.net/hg/naviserver/


If you're going to try a conversion, you might want to do something
like rsync the sf cvs repo to your local machine, for speed. The hg
convert command wants to be pointed at a checkout, but it reaches back
into the repo for history.

  rsync -avz --delete \
  rsync://naviserver.cvs.sourceforge.net/cvsroot/naviserver/  \
  ~/in/naviserver-CVSROOT

  cvs -d ~/in/naviserver-CVSROOT co -d ~/co/nsmemcache-HEAD modules/nsmemcache

  echo seryakov=Vlad Seryakov [EMAIL PROTECTED]  ~/authors

  hg convert -A ~/authors --config config.hg.usebranchnames=0 --config
config.hg.clonebranches=1 \
  ~/co/nsmemcache-HEAD ~/co/nsmemcache

  cd ~/co/nsmemcache/default

  hg qinit

  hg qimport -r :

  hg up

  hg qpop -a

  ls

  # all gone...

All that's left is to clean up some of the formatting of the commit
messages. Just edit the patch and then push it. (there's only 8
revisions to nsmemcache).

  less .hg/patches/1.diff

  # looks good

  hg qpush

  vi .hg/patches/2.diff

  hg qpush


You will need to add other people to the ~/authors file if they've
touched the module you're converting.

When your done:

  hg clone ~/co/nsmemcache/default ~/co/nsmemcache-hg
  rm -rf ~/co/nsmemcache

  hg clone ~/co/nsmemcache-hg  ssh://sf/ns/hg/nsmemcache

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] nsmemcached

2008-05-27 Thread Stephen Deasey
On Tue, May 27, 2008 at 8:12 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:


 Looks like the 'expires' and 'flags' variables might be uninitialised
 for the cmdSet etc. commands if values aren't passed from Tcl.

 In CVS version 1.5 they are initialized with 0



Thinking about flags...

If you remove -flags from the Tcl interface then you could use it to
distinguish between urf8 and byte arrays. ATM all data is sent as a
byte array, which is flexible. But probably a lot of the data will be
utf8 strings, and in that case it gets converted on the way in, and
again on the way out.  It would be more efficient to save the data in
it's native format.

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


[naviserver-devel] Mercurial: naviserver.sourceforge.net/hg/

2008-05-23 Thread Stephen Deasey
I updated the naviserver mercurial repo with the latest changes from
cvs put it on sourceforge:

  http://naviserver.sourceforge.net/hg/


To check it out:

  hg clone http://naviserver.sourceforge.net/hg/naviserver  ~/in/naviserver-hg

Or, if you've already cloned from the freehg.org repo, you can simply
update with the differences:

  hg -R ~/in/navserver-hg pull -u

The -u at the end means 'and update the working directory'. pull and
update are 2 separate things.
The -R saves you from CD'ing into the repo directory.

If you are updating instead of cloning, you might want to change the
default pull location in the repo config file:

  ~/in/naviserver-hg/.hg/hgrc

  [paths]
  default = http://naviserver.sourceforge.net/hg/naviserver

Now you don't have to specify where to pull from each time. cd into
the repo directory and 'hg pull -u'. Same for other commands which
work with two repos: incoming, outgoing etc.


I guess that's how most people would grab a copy of the latest source.
For people who expect to commit to the public repo themselves you
might want to clone via ssh. A couple of prerequisites:

Add something like the following to your ~/.ssh/config file:

  Host sf shell.sf.net
Hostname  shell.sf.net
User  yoursfusername

log into sf and do the following:

  ssh sf
  ln -s /home/groups/n/na/naviserver ~/ns
  echo source /home/groups/n/na/naviserver/bashc  ~/.bashrc

bashrc just sets the umask correctly and adds the 'hg' command to the PATH.

Now you can clone via ssh:

  hg clone ssh://sf/ns/hg/naviserver ~/in/naviserver-hg

That's also where you push to make your commits public.

  hg clone ~/in/naviserver-hg ~/ns-work
  cd ~/work
  ... hack hack hack ...
  hg commit
  hg push ssh://sf/ns/hg/naviserver


For people who don't have direct commit access, and with mercurial
that's really no disadvantage, perhaps a good way to work is to use
the 'patchbomb' extension.  Add the following to your ~/.hgrc file:

  [extensions]
  patchbomb=

  [email]
  from = Your Name [EMAIL PROTECTED]

  [smtp]
  host = smtp.gmail.com
  port = 587
  tls = 1
  username = [EMAIL PROTECTED]
  password = 

(or whatever)

btw. you'll also want to make sure that the following is present --
it's what your name appears as in the commit message:

  [ui]
  username = Your Name [EMAIL PROTECTED]


Now, to publish your last commit (the tip, aka HEAD) you could do:

  hg email -r tip --to naviserver-devel@lists.sourceforge.net

  ('hg help email' for more)

The patch is created as an attachment such that it can exactly
reproduce the commit when imported to another repo, including the
committer name, date etc., so full credit is always given.  At this
point some one with commit access would import the patch, check it,
and if OK push it:

  hg import ~/saved-email
  hg push


Commit Messages:

Format them like an email. A single like subject of about ~70 chars,
followed by a blank like, followed by the body, word wrapped to ~80
chars.  Keyword stuff the subject so that folks can get the gist of it
by skimming. Prefix with a module name such as nsperm: if you think it
makes sense. Say 'Add ...' instead of 'Added ...'.



The commit messages should be working, and so is cia.vc. Here's an example:

http://sourceforge.net/mailarchive/message.php?msg_id=hg.1883a10a6e0c.1210791169.-2015825136%40sc8-pr-shella-b.sourceforge.net


Does this all look OK?

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] drop CVS

2008-05-23 Thread Stephen Deasey
On Wed, May 7, 2008 at 11:03 AM, Ibrahim Tannir [EMAIL PROTECTED] wrote:
 FWIW, to let my paranoia out:

 I don't like SVN because it obscures and packs the whole
 repository into one big file, which IMHO overshadows all its
 benifits.

 I've been able in tha past to resolve the consequences of quite a
 few CVS bugs, due to the open structure of its repository.


That's a good point.

Mercurial and Git etc. are inherently better than cvs/svn because each
time someone clones they get the full repo. A kind of built-in backup.

That doesn't protect against cosmic rays, Murpheys Law. Perhaps a nice
way to handle this is to use the ultimate text format as backup -
patches.  Mercurial has the nice feature that you can export commits
as patches with a set of special headers which preserve the
mercurial-specific info, such as the hashes, and the stuff that
patches don't carry, such as the username, date etc.

You could set up a trigger to dump a copy of each commit as a patch in
some directory. I haven't tried, but I guess it wouldn't be too hard.

You can simulate it by importing the whole repo into a patch queue:

  hg clone ~/in/naviserver ~/ns-test
  cd test
  hg qinit
  hg qimport -r :

The ':' is python-like slice notation for a range of commits, which in
this case says 'everything'. You could also say -r 0:tip.

The patches are kept in numbered order in:

  ~/ns-test/.hg/patches

Another of the nice properties of mercurial is the content hashing,
which like git uses sha1 to hash the content of each changeset,
including the metadata. Mercurial also mixes in the hash of the
parent(s) changesets. So, when you reapply all the patches to
reconsitute the repo, and corruption will be noticed because the
hashes won't match.

This would be a nice little project for someone...

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] drop CVS

2008-05-23 Thread Stephen Deasey
On Wed, May 7, 2008 at 11:24 AM, Gustaf Neumann [EMAIL PROTECTED] wrote:

 Let me point out another nice feature of git:
 git provides server-support to behave to clients like a
 cvs and/or svn server. This means, one can access the git
 repository from cvs or svn (or git) clients. Not sure
 if this is an issue, but a user who does not want to
 learn new commands can contiune to use the CVS interface.


I'm not sure this is actually useful.  You can't really commit from
cvs or svn, and a straight checkout is actually easier in hg and git
than cvs, which requires you to specify a user even if it's just anon,
and they often show this in two stages.

For those who don't want to install any extra tools I've enabled the
tarball feature. You can grab a tarball of any revision of any project
straight from the web interface.


 I personally like git for its speed and simplicity to setup and
 usage. Git has certain ideosyncharies (e.g. does not like
 empty directories), and the downside is that if the full
 feature set of a more distributed scm is used, things become
 quite complex, at least for a casual user.


Git is very nice. But it is considerably harder to use than hg.  Even
for someone like Zoran, who is quite capable, but is too busy to faff
around with something like this, I think that would be a barrier.

The main thing for me re hg and git is that you can't go wrong with
either of them, where as cvs and svn have too much baggage these days
and most of the other systems have serious problems some where.
Bazaar is probably a solid 3rd -- a Dr. Pepper to the Coke and Pepsi
of git hg...  :-)

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] drop CVS

2008-05-23 Thread Stephen Deasey
On Wed, May 7, 2008 at 6:56 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 One benefit i can see is not immediate and obvious but having more
 flexible source control system may attract or make it easy to handle
 access to more developers, easy to revert unneeded changes, as Stephan
 pointed, better patch control and changsets.

 Yes, it will require some learning but not that much, still this is just
 source control system, using it in the-CVS-mode, as commit/update/diff,
 will be possible with any tool.



Yeah, for this particular project then a new version control system is
not going to bring new developers stampeding through the door. But
there is some potentially nice usability benefits for newbies.

A couple of times recently on the aolserver list there should have
been some patches flowing but instead either whole files or tarballs
have been posted, making it extremely difficult to figure out whats
been changed, and making it unlikely that the changes will be
incorporated into cvs.  The mechanics of doing it right aren't hard
per-se, but it can be non obvious and sometimes it's a pain.
Obviously there are other problems with aolserver development, but if
there was a culture of passing patches back and forth it would make up
for a lot.

I think in general we've just scratched the surface of how to work
with dvcs'.  A lot of focus has been put on some of the new technical
abilities, just as svn was better because of atomic commits, renames
etc. But the new systems have a lot more headroom for new ways to
work.  It's interesting to me, that after ~ 3 years use of git for
kernel development they're even now having discussions about whether
or not you should rebase if you're a maintainer (pull and rebase other
peoples patches). You shouldn't, apparently, and the way it was
explained makes sense (saw this on kerneltrap.org I think, if you're
interested).

It will be cool to see how open source development is done in a couple
of years when we figure this all out...

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Mercurial: naviserver.sourceforge.net/hg/

2008-05-23 Thread Stephen Deasey
On Fri, May 23, 2008 at 7:39 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 Does that mean i have to use either one, CVS or HG, not both at the same
 time?
 What i am asking, we still have 2 repos, will it work if commits are
 coming to both of them?


No, we should use one or the other.

Or, we should treat what's in the hg repos now as a demo/test and plan
to redo them later.



You could commit your recent change to the hg repo and then they will
be in synch again, and we can decide what to do. You can be the guinea
pig :-)

btw. I deleted the ChangeLog in the hg repo. The commit log messages
should be enough.

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] ns_share

2008-05-23 Thread Stephen Deasey
On Sun, May 18, 2008 at 6:09 PM, Vasiljevic Zoran [EMAIL PROTECTED] wrote:
 Hi again!

 This is yet-antother scrap candidate. I wonder if
 anybody is still using this ancient interface?
 I would like to get it out as to keep the code
 smaller and simpler to maintain.


It would be great if it could be made to compile as a standalone
module, as was done with some of the old db modules that we removed,
such as nsdbext. I think ns_share is pretty separate, maybe just need
something to hang the per-server stuff off which is currently in the
NsServer struct.

Also, there is some ns_var stuff in nsd/tclvar.c that probably belongs
with ns_share.  I think the progression went ns_share - ns_var -
nsv_*, with ns_var being born already superseded by nsv_* when aol
released it.

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] moonshadow

2008-05-23 Thread Stephen Deasey
On Thu, May 15, 2008 at 6:52 PM, Vasiljevic Zoran [EMAIL PROTECTED] wrote:

 On 11.05.2008, at 15:42, Stephen Deasey wrote:


 Undocumented:

generic/tclResolve.c: Tcl_AddInterpResolvers()



 You could probably even fake-up a solution using a single interp with
 your own name resolvers. Before you start executing the code for a
 single client, set a 'context' global which your resolver routines
 will use to keep state variables separate for each client.

 Hmhmhm... I do not really follow

 I cannot do that with a single interp. As it is bound to a thread.
 So - single interp - single thread. How do I scale?


You mentioned that you didn't want to rewrite a complicated state
machine that uses a lot of uplevels, in an event style. I thought
maybe you could keep the variables separate using these namespace
lookup procs. Then you could use a single interp to manage multiple
state machines, instead of using the stacks of 1000 threads.

You could give each client an id on first connect and put them in
buckets, with buckets =1 and = 1000. You need a pool of threads, one
for each bucket.  When a message arrives from a client, you sent it to
the same thread/bucket each time. The interps of those threads are
persistent.

Within the bucket interps you use the namespace lookup trick to
subdivide the variable space between the clients which are assigned to
that interp. The interp runs a client message to completion, then
picks up the next. Your concurrency level is however many buckets you
decide to subdivide the 1000 connections into.

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Mercurial: naviserver.sourceforge.net/hg/

2008-05-23 Thread Stephen Deasey
On Fri, May 23, 2008 at 8:45 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 I am personally ready to switch right away, i use hg for xine-lib for a
 long time already, in readonly mode but it did not require much learning
 to use it.

 More questions, is hg repo hosted by SF? Is it Sf service or you just
 run additional hg server there?


I basically followed this recipe:

http://www.selenic.com/mercurial/wiki/index.cgi/MercurialOnSourceforge

Although I used mercurial-1.0  (installed into
/home/groups/n/na/naviserver/local/mercurial-1.0)

All the repos live in /home/groups/n/na/naviserver/hg

Mercurial comes with cgi-scripts to publish the repos, that's what you
see when you go to:

  http://naviserver.sourceforge.net/hg/

(See: /home/groups/n/na/naviserver/cgi-bin)

(And btw. you can get the same view on your own machine by typing 'hg
serve', built-in web server).


So, the repos in $SF/hg  are basically identical to what you end up
with on your own machine when you clone. The only difference is that I
modified the per-repo hgrc file to add the hooks for commit messages
and a couple of other small things.

I guess I should make clear, the naviserver repo, and each of the
module repos would in fact be individual repos.


So to convert the other modules from cvs, you'd run 'hg convert'
(which you have to enable first, it's an extension shipped with
mercurial). And then you'd clean it up a little, make sure the commit
messages follow the mercurial style etc. And then you'd clone it up
there:

  hg clone ./nsexample ssh://sf/ns/hg/nsexample

And then you would ssh into sf and copy the hgrc from an existing repo
into the new one:

  ssh sf
  cd ~/ns/hg
  cp naviserver/.hg/hgrc nsexample/.hg/hgrc
  vi nsexample

It should show up in the web interface automatically.  You only need
to edit the top of the file to change the display name, basically just
this:

  [web]
  description = Programmable Web Server

  [cia]
  module = naviserver

You could also edit 'contact' if you like. It's just for display on
the web interface.


That should be it.  We can go into more details about how to convert
modules from cvs later, but shout out if you're keen to get started.

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] gzip compression fixes

2008-05-23 Thread Stephen Deasey
http://naviserver.sourceforge.net/hg/naviserver/rev/3f16ccfc8985

What are the bugs that are fixed here? The message doesn't say.

Also, it breaks the tests:

$ make test
...
 ns_adp_conpress-1.2 Accept-Encoding gzip FAILED
 Contents of test case:

set response [nstest_http -encoding binary -setheaders
{accept-encoding gzip}  -getheaders {content-encoding} -getbody 1 GET
/ns_adp_compress.adp]
binary scan [lindex $response 2] H* values
list [lindex $response 0] [lindex $response 1] [regexp -all
-inline {..} $values]

 Result was:
200 gzip {1f 8b 08 00 00 00 00 00 00 03 2b c9 c8 2c 56 00 a2 44 85 92
d4 e2 12 00 ea e7 1e 0d 0e 00 00 00}
 Result should have been (exact matching):
200 gzip {1f 8b 08 00 00 00 00 00 00 03 2b c9 c8 2c 56 00 a2 44 85 92
d4 e2 12 00 26 33 05 16 0d 1e e7 ea 00 00 00 0e}
 ns_adp_conpress-1.2 FAILED



It's tough to know which is right, the code or the test, with no hints
in the commit message... :-)


  
http://naviserver.sourceforge.net/hg/naviserver/log/3fe51589271f/tests/ns_adp_compress.test

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Mercurial: naviserver.sourceforge.net/hg/

2008-05-23 Thread Stephen Deasey
On Fri, May 23, 2008 at 9:50 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 Another question: why to keep every module in separate repo?
 will it be easier to have them under one root?


No, they need to be separate repos.

The reason is that unlike cvs hg is changeset based. There is one
commit message that goes with the changes to a collection of files.
They go together, like a transaction in a db.

When you do a 'hg log' you get the commit message, user, date etc. for
each changeset. If we put all the modules into one repo then it would
be like have just one ChangeLog for everything, with all message mixed
together. Also, things like tags are repo wide, and you don't really
want to tag nsdbi with naviserver-4.99.2, and vice-versa.

There is an extension call 'forrest' which is something like repos
within repos. I don't know if it's needed though.

To keep updated, you could just stick something like the following in cron:

for repo in ~/in/ns/*-hg; do
  hg -R $repo pull
done

We could publish a shell script with a list of all modules, to
bootstrap for those who want a copy of everything.


Also, slightly related, I think we want to follow a repo-as-branch
model. So no branches within repos. It's simpler.

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] [naviserver-commits] naviserver/nsd tclobj.c, 1.7, 1.8

2008-05-12 Thread Stephen Deasey
On Sat, Apr 26, 2008 at 8:50 PM, Zoran Vasiljevic
[EMAIL PROTECTED] wrote:
 Update of /cvsroot/naviserver/naviserver/nsd
 In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10260/nsd

 Modified Files:
tclobj.c
 Log Message:
 * nsd/tclobj.c: Changed Tcl handle format to include hyphens (-)
 instead of spaces, as spaces create troubles with Tcl [eval].


This change broke these tests:

 ns_thread-2.2 wait for thread thread FAILED
 ns_thread-3.1 create and destroy a mutex FAILED
 ns_thread-4.1 create and destroy a critical section FAILED
 ns_thread-5.1 create and destroy a semaphore FAILED
 ns_thread-6.1 create and destroy a read-write lock FAILED

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] [naviserver-commits] naviserver/nsd tclobj.c, 1.7, 1.8

2008-05-12 Thread Stephen Deasey
On Mon, May 12, 2008 at 1:25 PM, Vasiljevic Zoran [EMAIL PROTECTED] wrote:

 On 12.05.2008, at 13:53, Vasiljevic Zoran wrote:


 So I will fix those tests.

 Fixed. Really, the format of the handle(s) was
 a great pain for me for some auto-synthetized
 code...


No problem. It's a good change.

I was just passively-aggressively suggesting you don't run 'make test'
enough...  :-)

Also, there's no tests/ns_job.test to cover all those bugs you fixed.

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] sample config

2008-05-11 Thread Stephen Deasey
On Sat, May 10, 2008 at 8:01 PM, Vasiljevic Zoran [EMAIL PROTECTED] wrote:
 Hi !

 In the process of a spring-cleanup I wanted to attack
 the gobal sample-config.tcl file that we deliver
 with the server. The purpose of that file is obviously
 dual:

  o. get a config file people can start with
  o. declare and document each and every config option

 As it seems, we fail to meet any of those goals _really_.
 One can use this file to start the server, right, but
 thats about it. Any attempt to understand it, is not
 going to bear fruits...

 I will reorganize this file as follows:

   o. write man page about the overal layout of the file


http://naviserver.sourceforge.net/n/naviserver/files/ns_config.html

Maybe hoist the existing small examples into the section explains the
command in the example, and add a new section at the bottom
Configuration File Structure, with the sections that are always
present, such as ns/parameters etc.


   o. write man page explaining server internal parameters


I wonder if there are many parameters which wouldn't fit nicely on a
page with their related commands? We've had a bit of a push to make
config more dynamic, so for example all the ADP parameters are now can
now be controlled by the ns_adp_ctl command and per-request by
ns_register_adp:

http://naviserver.sourceforge.net/n/naviserver/files/ns_register_adp.html

Maybe the ns_limits page handles this better:

http://naviserver.sourceforge.net/n/naviserver/files/ns_limits.html

It uses the config section as definition item and shows a literal
config file example with all keys. The keys are identically named to
the options passed to the ns_limits_set command, which is documented
above.  Maybe ns_adp_ctl should be added to the ns_register_adp page,
document the options for it, and reference that in the config section?


Another example is the ns_ictl page:

http://naviserver.sourceforge.net/n/naviserver/files/ns_ictl.html

which currently has zero config, but the stuff you put there might be
considered 'server internal parameters', like the path to private Tcl
files and the path to the boot init.tcl file.


   o. expand man pages for each module and put explanations
  of module paramaters there


The nslog module is not bad:

http://naviserver.sourceforge.net/n/naviserver/files/ns_accesslog.html

but maybe it should be moved from:

doc/src/mann/ns_accesslog.man

to:

nslog/doc/src/mann/ns_accesslog.man

so that it shows up as a module on the TOC page.

Same with ns_proxy.man.


   o. rewrite this file to include sample for configuring
  two virtual servers


I dunno... There needs to be a man page describing ns_serverpath,
ns_pagepath, ns_hashpath, ns_serverpathproc ns_locationproc, with
see-also of ns_url2file.  It will have to explain the difference
between virtual servers and mass virtual hosting, and show config
params.  Maybe this is enough to cover vhosting?


 Vlad already started this right by providing a minimal
 no-fuss config file for somebody that needs to pull up
 the server fast with minimal config. What we need is
 something similar to that for virtual servers in perhaps
 2 or 3 sample configurations.


There is already a nsd-config.tcl and it's kind of a bad example
because it has a very generic name and no comments at all. It's not
clear why you would want to use it.

Ideally simple-config.tcl would be expanded a little -- it's just a
bit too simple -- and then you could cat it to
config/sample-virtual-hosts.tcl and add only the bits that are
relevant to the virtual hosting example.

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] ns_perm module bug fix

2008-05-11 Thread Stephen Deasey
On Sun, May 11, 2008 at 4:53 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:

 Also, you need to fix your editor so that it doesn't automatically
 change whitespace willy-nilly. Your 3 line change turned into a
 gigantic unreadable mess in the commit email.

 (when you figure out how to fix it, remind Vlad 'cos he seems to have
 forgotten :-)

 Yes, i think i have.
 What are our editor predefines? i think i tried but my editor keeps
 removing tabs automaticlaly and this is not what we want i guess.


Exactly. It's the automatic on open/save bit that's the problem.


 - Use whitespaces, not tabs
 - Tab is 8 charactares, or 4 ?


4


 what else?


You're using Vim?  Maybe someone knows how to fix this. Anyone?

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] ns_perm module bug fix

2008-05-11 Thread Stephen Deasey
On Sun, May 11, 2008 at 5:05 PM, Daniel Stasinski [EMAIL PROTECTED] wrote:

 I did the commit on aolserver cvs only and the white space was unchanged.


Your editor changed it behind your back.  :-(

Vim?

Anyway, here's what the commit message looks like:



*** nsperm.c8 Aug 2005 11:30:15 -   1.10
--- nsperm.c10 May 2008 19:31:32 -  1.11
***
*** 12,16 
  * The Original Code is AOLserver Code and related documentation
  * distributed by AOL.
!  *
  * The Initial Developer of the Original Code is America Online,
  * Inc. Portions created by AOL are Copyright (C) 1999 America Online,
--- 12,16 
  * The Original Code is AOLserver Code and related documentation
  * distributed by AOL.
!  *
  * The Initial Developer of the Original Code is America Online,
  * Inc. Portions created by AOL are Copyright (C) 1999 America Online,
***
*** 28,32 
  */

! /*
  * nsperm --
  *
--- 28,32 
  */

! /*
  * nsperm --
  *
***
*** 111,115 
 static Tcl_HashTable   serversTable;

!
 /*
  *--
--- 111,115 
 static Tcl_HashTable   serversTable;

!
 /*
  *--
***



There's about 10 screens of this...



 I do notice that at least in the
 aolserver code, there is inconsistent use of tabs and spaces.  Some
 lines use spaces and others use tabs to indent.   Though it looks
 funky, I left them as they were.


Yeah, we like spaces not tabs, and we try to leave it as it is when
making small changes so that the commits are readable.

Before making a large change to a file that hasn't been cleaned up
it's often a good idea to make a separate commit with just the
whitespace changes -- then everyone can just ignore it.

So I guess that's something like:

:%retab

in Vim, and M-x untabify in emacs.

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] ns_perm module bug fix

2008-05-11 Thread Stephen Deasey
On Sun, May 11, 2008 at 6:43 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:

 You're using Vim?  Maybe someone knows how to fix this. Anyone?

 No, i do not use Vim and i just fixed that. Tested using cvs diff, works
 fine.


Groovy.  So how did you fix it?

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] [naviserver-commits] naviserver/nsd adprequest.c, 1.29, 1.30

2008-05-11 Thread Stephen Deasey
On Fri, May 9, 2008 at 7:11 PM, Vlad Seryakov
[EMAIL PROTECTED] wrote:
 Update of /cvsroot/naviserver/naviserver/nsd
 In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5680/nsd

 Modified Files:
adprequest.c
 Log Message:
* nsd/adprequest.c: Fixed situation when adp registered absolute path
outside of the page root.

Output error message when registered adp callback could resolve file

  if (file == NULL) {
 + Ns_Log(Error, adp file not found for %s %s, file=%s, flags=0x%x,
 +conn-request-method, conn-request-url, adp-file, 
 adp-flags);
  status = Ns_ConnReturnInternalError(conn);
  goto done;


Maybe this should just return a 404?

I guess the idea behind the internal error is that if you register an
ADP with a fully qualified path and the file does not exist then it is
a config error. But it is kind of weird to stat the file at
registration time -- we don't do that anywhere else -- so the error is
delayed to runtime.

If someone moves a file without bouncing the server the error-log may
fill up before anyone notices.

A 404 is probably a big enough clue as to what's gone wrong.

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] [naviserver-commits] naviserver/nsd driver.c, 1.97, 1.98

2008-05-11 Thread Stephen Deasey
On Sun, Apr 27, 2008 at 9:39 AM, Vasiljevic Zoran [EMAIL PROTECTED] wrote:

 On 26.04.2008, at 23:46, Vlad Seryakov wrote:

 I think it was working perfectly fine, new buffer size is set on
 accepted socket, new one, not the one we listened.


 I used to play with these options for one of the modules i wrote and
 at
 least on Linux it was working fine.

 OK. I will back this off. I was unable to get that working
 on my platforms. So I thought to comment this and move
 close to the place where it *might* work.

 Good to know that this works on Linux at least...


These options can probably just be dropped:

http://www.psc.edu/networking/projects/tcptune/#options


For Linux it says:

NB: Recent versions of Linux (version 2.6.17 and later) have full
autotuning with 4 MB maximum buffer sizes. Except in some rare cases,
manual tuning is unlikely to substantially improve the performance of
these kernels over most network paths, and is not generally
recommended


This wasn't the web page I was looking for. There's one somewhere that
describes a project that looked at autotuning TCP buffer sizes and I
remember it said that all major OS' were fixed a couple of years ago,
as a result.

I think this is not needed anymore, and probably just makes things
worse if used.

One less knob!

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] [naviserver-commits] naviserver/nsd tcljob.c, 1.30, 1.31

2008-05-11 Thread Stephen Deasey
On Tue, Apr 29, 2008 at 7:44 PM, Zoran Vasiljevic
[EMAIL PROTECTED] wrote:
 Update of /cvsroot/naviserver/naviserver/nsd
 In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1402/nsd

 Modified Files:
tcljob.c
 Log Message:
 nsd/tcljob.c: Fixed wrong access to queuePtr variable
 in the worker thread (Bug introduced 2008-04-26). Made
 LookupQueue errors trigger Fatal exceptions when run
 from within the worker threads.


 --- 1239,1242 
 ***
 *** 1330,1334 
  while (!done  jobPtr != NULL) {

 ! LookupQueue(NULL, jobPtr-queueId, queuePtr, 1);

  /*
 --- 1331,1337 
  while (!done  jobPtr != NULL) {

 ! if (LookupQueue(NULL, jobPtr-queueId, queuePtr, 1) != TCL_OK) {
 ! Ns_Log(Fatal, cannot find queue: %s, jobPtr-queueId);
 ! }

  /*
 ***



Should call Ns_Fatal() here, not Ns_Log(Fatal, ...)

(Ns_Log(Fatal, ) is kind of a hidden implementation detail)

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] nsphp.c error

2008-05-05 Thread Stephen Deasey
On Mon, May 5, 2008 at 5:02 AM, Daniel Stasinski [EMAIL PROTECTED] wrote:
 When using nsphp with CVS version of naviserver, the following crash occurs:

 /root/modules/nsphp/php-5.2.5/main/SAPI.c(424) : Block 0x08523200 status:
 Invalid pointer: ((thread_id=0x0001) != (expected=0xB53FFB90))
 [04/May/2008:20:58:14][27361.b53ffb90][-conn:default:0] Fatal:
 received fatal signal 11
 Aborted

 To duplicate, load a page that requires authentication, such as:
 http://something.com/nsconf.tcl and then a plain non-authenticated
 page like http://something.com/helloworld.php

 Daniel


Here's some tips to help narrow down the cause of the crash:

  http://naviserver.sourceforge.net/w/Running_Tests

A backtrace would be very helpful.


So would a short test case (the auth stuff you mentioned above).  You
could do this by loading nsphp in the naviserver/tests/test.nscfg file
and adding a new file tests/php.test, but even better would be to add
this to the nsphp module itself.

nsphp doesn't already have the test harness set up, but you can use
nsloopctl as an example of a module which does.

  http://naviserver.cvs.sourceforge.net/naviserver/modules/nsloopctl/

Basically you need to cut 'n paste the test targets from the Makefile,
copy the tests/all.tcl into place, copy the tests/config.tcl and edit,
then add a php.test file with your single test.

Send the output of 'cvs diff -u' to the list  (and your backtrace /
bug hunting results).


If you're uncomfortable fixing the bug someone else will take a look
at it, but if you'd like to take a shot yourself we can guide you
through it.


Thanks!

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] [AOLSERVER] nsdbi database driver interface 0.1

2008-05-05 Thread Stephen Deasey
On Fri, May 2, 2008 at 8:50 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 Frankly, i would go from CVS to SVN/Mercurial/Git, whatever.
 I still think SF CVS sucks, so i would switch anytime if my voice will
 need to be counted:-)))

 The question i have, is freehg.org reliable and supposed to live long?
 On other hand SF is very popular and search engine favorite, not that
 popularity is my big concern though.


freehg.org was just a convenient place to publish.  I guess we would
put the repos on the sourceforge web space. Mercurial can run as a cgi
script front end to the repo for anonymous pulling and web browsing.
Commiters would push via ssh.

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] [AOLSERVER] nsdbi database driver interface 0.1

2008-05-02 Thread Stephen Deasey
(sorry for the delay)


On Thu, Apr 17, 2008 at 3:49 PM, Vlad Seryakov [EMAIL PROTECTED] wrote:
 This is very cool,

 Can you commit it into primary Naviserver CVS?


Hmm, I hadn't thought about it much, I just wanted to get it off my
hard drive. But now that you mention it, it would kind of suck to move
it out of mercurial (and I'm not even sure there's a downward
conversion tool...)

Btw. some time ago I also converted the aolserver and naviserver
histories to mercurial.  I cleaned up the commits quite a lot so that
logical changes appear in one changeset with comments in the right
place in the right format, attributed to the right people etc.  I
collapsed about 30% of the commits IIRC.

I did the same for naviserver then stuck it on to the end of the
history of aolserver 4.0.10.  So, there's now complete history going
back 8 years which is browsable and annotatable.  Check it out:

http://freehg.org/u/groks/naviserver/
http://freehg.org/u/groks/aolserver/


I don't want to agitate for change too strongly, but maybe it's worth
thinking about?


http://www.selenic.com/mercurial/wiki/

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


[naviserver-devel] nsdbi database driver interface 0.1

2008-04-17 Thread Stephen Deasey
nsdbi is a database driver interface for naviserver. It provides
native bind variable support, transparent prepared queries and handle
management, runtime configuration, statistics, and a few other things.

There are drivers for postgres, mysql and sqlite. There's also a stub
driver included for testing, fault injection etc.

It relies on a few utility routines in naviserver, but it wouldn't be
too hard to port those to aolserver, should anyone want to.


Here's a snapshot of the man page:

  http://www.groks.org/nsdbi.n.html

Tarballs:

  http://www.groks.org/nsdbi-0.1.tgz
  http://www.groks.org/nsdbipg-0.1.tgz
  http://www.groks.org/nsdbimy-0.1.tgz
  http://www.groks.org/nsdbilite-0.1.tgz

Mercurial repositories:

  http://freehg.org/u/groks/nsdbi/
  http://freehg.org/u/groks/nsdbipg/
  http://freehg.org/u/groks/nsdbimy/
  http://freehg.org/u/groks/nsdbilite/

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] nslog

2008-01-07 Thread Stephen Deasey
On Jan 7, 2008 10:00 AM, Neophytos Demetriou [EMAIL PROTECTED] wrote:
 I'm having the same problem as outlined below.

 Basically, the log fails to roll (and so does ns_accesslog roll)
 eventhough the directory and the log file look good.


What messages appear in your error log when you try to roll a file?

If it's to be rolled at midnight, whether it actually rolls or not
you'd expect to see a message from the sched thread. If you don't see
it, then log rolling is not enabled.

If you see that but the log does not actually roll, I would expect an
error message of some sort. Looking through the code for this last
time all error paths appear to be covered by log messages.

Re permissions, look at the permissions of both the log files and the
directory they're in. The server needs to have permission to create a
new file under it's run-time uid/gid -- whereas at startup it creates
the file as root.

Also, has log file rolling never worked for you?  If this is something
new, what's changed recently?


 Please note that ns_rollfile renames the existing log (say,
 access.log.000) but it does not create a new one (not sure if that is
 the expected behaviour).


That's expected. It is a low-level routine to handle the renaming.
ns_log roll and ns_accesslog roll call it and handle the reopening
themselves. If you use it to roll some other kind of file manually,
you'll have to take account of that.

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] compat

2007-12-06 Thread Stephen Deasey
On Dec 6, 2007 5:07 PM, Vasiljevic Zoran [EMAIL PROTECTED] wrote:

 On Dec 6, 2007, at 6:05 PM, Vlad Seryakov wrote:

  I guess this is Stephen's call

 OK, Stephen, what should we do with this?
 At the moment I removed all those from my
 solaris-2.8 sandbox but this is not a real
 solution. So what is the purpose of %j and
 why do we need it?


%jd is intmax_t, you can replace them with %lld and long long.

-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] [naviserver-commits] naviserver/nsd tclconf.c, 1.5, 1.6

2007-11-28 Thread Stephen Deasey
On Nov 28, 2007 11:42 AM, Zoran Vasiljevic
[EMAIL PROTECTED] wrote:
 Update of /cvsroot/naviserver/naviserver/nsd
 In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23874/nsd

 Modified Files:
 tclconf.c
 Log Message:
 * nsd/tclconf.c: Fixed NsTclConfigObjCmd() to correctly set the
   returned value of an default boolean param to 0/1 and not just
   blindly parrot what user has given (true/false for example) as
   this could (and it does!) break Tcl expressions.



 Index: tclconf.c
 ===
 RCS file: /cvsroot/naviserver/naviserver/nsd/tclconf.c,v
 retrieving revision 1.5
 retrieving revision 1.6
 diff -C2 -d -r1.5 -r1.6
 *** tclconf.c   21 Oct 2007 16:20:24 -  1.5
 --- tclconf.c   28 Nov 2007 11:42:38 -  1.6
 ***
 *** 130,140 

   if (defObj != NULL) {
 ! if ((isbool  Tcl_GetBooleanFromObj(interp, defObj, i) != TCL_OK)
 ! || (isint  Tcl_GetWideIntFromObj(interp, defObj, v) != 
 TCL_OK)) {
 ! return TCL_ERROR;
 ! }
 ! if (isint  (v  min || v  max)) {
 ! Tcl_SetResult(interp, value out of range, TCL_STATIC);
 ! return TCL_ERROR;
   }
   Tcl_SetObjResult(interp, defObj);
 --- 130,143 

   if (defObj != NULL) {
 ! if (isbool) {
 ! if (Tcl_GetBooleanFromObj(interp, defObj, i) != TCL_OK) {
 ! return TCL_ERROR;
 ! }
 ! defObj = Tcl_NewIntObj(i);
 ! } else if (isint) {
 ! if (v  min || v  max) {
 ! Tcl_SetResult(interp, value out of range, TCL_STATIC);
 ! return TCL_ERROR;
 ! }
   }
   Tcl_SetObjResult(interp, defObj);


Pre-change:


% expr !1
0
% expr !0
1

% expr !true
0
% expr !yes
0
% expr !y
0

% expr !yup
syntax error in expression !yup: variable references require preceding $

% expr ![ns_config -bool a/b c yup]
expected boolean value but got yup



Post-change:


$ make test TCLTESTARGS=-file ns_config.test


Only running test files that match:  ns_config.test
Tests began at Wed Nov 28 06:18:18 PM GMT 2007
ns_config.test

 ns_config-3.4 not an int FAILED
 Contents of test case:

ns_config -int ns/testconfig missing huh?

 Test completed normally; Return code was: 0
 Return code should have been one of: 1
 ns_config-3.4 FAILED


 ns_config-4.6 int min def FAILED
 Contents of test case:

ns_config -min 43 ns/testconfig intval 43

 Test generated error; Return code was: 1
 Return code should have been one of: 0 2
 errorInfo: value out of range
while executing
ns_config -min 43 ns/testconfig intval 43
(uplevel body line 2)
invoked from within
uplevel 1 $script
 errorCode: NONE
 ns_config-4.6 FAILED


 ns_config-4.7 int max def FAILED
 Contents of test case:

ns_config -max 41 ns/testconfig intval 41

 Test generated error; Return code was: 1
 Return code should have been one of: 0 2
 errorInfo: value out of range
while executing
ns_config -max 41 ns/testconfig intval 41
(uplevel body line 2)
invoked from within
uplevel 1 $script
 errorCode: NONE
 ns_config-4.7 FAILED


Tests ended at Wed Nov 28 06:18:18 PM GMT 2007
all.tcl:Total   31  Passed  28  Skipped 0   Failed  3
Sourced 1 Test Files.
Files with failing tests: ns_config.test

-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] [naviserver-commits] naviserver/nsd tclconf.c, 1.5, 1.6

2007-11-28 Thread Stephen Deasey
On Nov 28, 2007 7:38 PM, Vasiljevic Zoran [EMAIL PROTECTED] wrote:

 On Nov 28, 2007, at 8:14 PM, Stephen Deasey wrote:

 
  {$bool == 1} is not a valid test of truthiness.

 ... so Tcl and C are broken?


Tcl and C are fine. The example is broken.


For example, in C the above should be:

if (bool != 0) {
printf(truth);
}

because 1 is not the only value of true.

Same in Tcl, although it's not sufficient because integers other than
0 are not the only valid representation of truth.

The *default* representation of truth is the integer 1:

% expr 1  2
1
% expr 2  1
0

You can certainly use 1/0 for true/false.

But if you only check the equality of a boolean against 1 you are only
checking a small subset of integers, and none of the other truths:
yes, y, t, on, etc.

Therefore, I don't think it's fair to say that this is a more robust
test of Tcl truth:

if {$bool == 1} ...


 When Tcl disallows us to use 1/0 for true/false and test on 1/0 equality for
 it, then we can talk more about it.


It is already disallowed... :-)



if:   http://www.tcl.tk/man/tcl8.5/TclCmd/if.htm

The if command evaluates expr1 as an expression (in the same way that
expr evaluates its argument). The value of the expression must be a
boolean (a numeric value, where 0 is false and anything is true, or a
string value such as true or yes for true and false or no for false)



expr:   http://www.tcl.tk/man/tcl8.5/TclCmd/expr.htm

A Tcl expression consists of a combination of operands, operators, and
parentheses... Where possible, operands are interpreted as integer
values... If no numeric interpretation is possible (note that all
literal operands that are not numeric or boolean must be quoted with
either braces or with double quotes), then an operand is left as a
string (and only a limited set of operators may be applied to it).

Operands may be specified in any of the following ways:

[1] As a numeric value, either integer or floating-point.
[2] As a boolean value, using any form understood by string is boolean.
[...]



string is ...:   http://www.tcl.tk/man/tcl8.5/TclCmd/string.htm#M16

Returns 1 if string is a valid member of the specified character
class, otherwise returns 0. If -strict is specified, then an empty
string returns 0, otherwise an empty string will return 1 on any
class.

string is boolean:  Any of the forms allowed to Tcl_GetBoolean.



Tcl_GetBoolean:   http://www.tcl.tk/man/tcl8.5/TclLib/GetInt.htm

Tcl_GetBoolean expects src to specify a boolean value. If src is any
of 0, false, no, or off, then Tcl_GetBoolean stores a zero value at
*boolPtr. If src is any of 1, true, yes, or on, then 1 is stored at
*boolPtr. Any of these values may be abbreviated, and upper-case
spellings are also acceptable.

-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] [naviserver-commits] naviserver/nsd tclconf.c, 1.5, 1.6

2007-11-28 Thread Stephen Deasey
On Nov 29, 2007 5:15 AM, Vasiljevic Zoran [EMAIL PROTECTED] wrote:

 On Nov 28, 2007, at 10:39 PM, Stephen Deasey wrote:

 
  Tcl and C are fine. The example is broken.



 Ah, Stephen...

 set value [ns_config -bool /missing/thing missing_par false]
 if {$value == 0} {
 puts should it print?
 }

 In the pre-checkin version it didn't
 because value was set to string false
 and this ain't equal number zero.
 In the post-checkin version it does as
 it always substitutes the result to 0 or 1.

 Is this now broken?


It's equally as broken as the other example, and for exactly the same reason.

Are you saying that false is not false and true is not true?

If not, then whey insist on using integer equality expressions?

-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] [naviserver-commits] naviserver/nsd tclconf.c, 1.5, 1.6

2007-11-28 Thread Stephen Deasey
On Nov 29, 2007 6:45 AM, Vasiljevic Zoran [EMAIL PROTECTED] wrote:

 On Nov 29, 2007, at 7:32 AM, Stephen Deasey wrote:

 
  Are you saying that false is not false and true is not true?

 I'm saying that false IS zero and 1 IS true (better, non-zero is true).


OK. But why are you saying that?

The Tcl man pages define explicitly what the valid values for boolean
are, and in what context booleans are expected. Can you point to the
part which supports your argument?


 But this can bring us to the question:

set value [ns_config -bool jummy juice false]
if {$value == true} {
   # ...
}

 and all sorts of other weird things. I know I know...


This is a false dilemma.

A string equality expression is not the only substitute for an integer
comparison expression.

if {$boolilicious} {   ;# --- boolean expression
puts truthy
}


 This all ISN'T very clear because Tcl's C-heritage and
 LACK of proper boolean type (actually lack of ANY types).


Tcl has a boolean type:

  http://www.tcl.tk/man/tcl8.5/TclLib/BoolObj.htm

It's string rep when false is 0, false, no, f and so on.


 So, we cannot teach Tcl types, we can only make some
 approximations. The (ns_config )code was simply too strict
 at that place


It was returning a boolean value, guaranteed. It used Tcl_GetBoolean
to parse the value from the config file, and Tcl_GetBooleanFromObj to
check the default value. If both of those calls return TCL_OK, then
whatever comes out the other side is a valid boolean value.

-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


  1   2   3   4   >