You can subscribe to this list here.
2005 |
Jan
|
Feb
(61) |
Mar
(153) |
Apr
(39) |
May
(10) |
Jun
(15) |
Jul
(15) |
Aug
(2) |
Sep
|
Oct
(17) |
Nov
(2) |
Dec
(13) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(18) |
Feb
(9) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(7) |
Aug
(1) |
Sep
(2) |
Oct
|
Nov
(1) |
Dec
|
2007 |
Jan
(8) |
Feb
(3) |
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
(6) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: SourceForge.net <no...@so...> - 2005-05-22 23:50:28
|
Feature Requests item #1151137, was opened at 2005-02-24 16:01 Message generated for change (Settings changed) made by seryakov You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1151137&group_id=130646 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: C-API Group: None >Status: Closed Resolution: None Priority: 5 Submitted By: Vlad Seryakov (seryakov) Assigned to: Vlad Seryakov (seryakov) Summary: New driver API and Udp module Initial Comment: Hi guys, Attached is minor driver extensions which do not change existing drivers but add new functionality. There are some cosmetic changes, like moving some fields in the Ns_Sock/Ns_Driver structres so they can be accessed publically and made some private functions public but functionality preserved as before. I included udp driver as an example of new API, and also added ns_sha1 command in the tclmisc.c, it is just one command and it is uses practically everywhere. ------------------------------------------------------------------------- To test udp driver i use new ns_udp command: ossweb:nscp 8> ns_udp send 127.0.0.1 5060 "GET / HTTP/1.0\n\n" HTTP/1.0 200 OK MIME-Version: 1.0 Date: Thu, 24 Feb 2005 05:39:50 GMT Server: NaviServer/4.0.10 Content-Type: text/html; charset=iso-8859-1 Content-Length: 661 Connection: close <HEAD><TITLE>Seryakov's Family Intranet</TITLE></HEAD> ..... ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-05-17 19:24 Message: Logged In: YES user_id=184124 I am attaching new nsudp driver, it uses existing driver sock, just couple places where NS_DRIVER_UDP flag is checked for initializing and not performing accept calls. ns_udp module is simple driver like nssock. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-05-04 18:01 Message: Logged In: YES user_id=184124 I implemented my SIP driver completely in separate threads and do not use Conn/Queue or jobs at all. When comparing performance with SER(sip proxy), NS still behind because of multi-threading overhead while SER forks many children listening on the same socket, same way as apache 1.x used to do. Also, NS/AS/Tcl memory allocator is slower than non-threaded allocator. My first version was using Conn/SockCallbacks but it was so slow, i could not process more than 500 requests per second. Now i can do 9000 requests per second on the same server. So, having UDP implemented in the core is not that important for me but still, using UDP as signaling/messaging protocol instead of HTTP or implementing other not that performance-needed drivers would be great. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-18 18:17 Message: Logged In: YES user_id=184124 >I'm happy to see any of the core changed to add this >support, but it needs to be justified. I don't want to >support multiple different ways of doing the same thing. No, it is not the same thing. To build different drivers, API and tools should be flexible enough, if we have only one way to add a driver, so only drivers which fit will be(if) added, and if something usefull will come up, will we need to change the core again to fit different mehtod? Basically you offered the same thing that i am talking about: if we supply new DriverThread for UDP driver, the only common is how to queue it, public NsQueueConn. The rest is driver/thread specific. Currently, i can live with specific thread proc using sock callbacks, but when driver threads will be available, i can switch to it, but still once i read data from UDP, i need to build Sock/Conn and queue it. This is what i am offering, make NsQueueConn public plus/mines changing some other function but just to only support public NsQueueConn. IT will not conflict with future global driver changes. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-18 14:28 Message: Logged In: YES user_id=184124 One good for having NsQueueConn public is to be able to submit connection threads from memory, without actual protocol/driver connection. I have data to spawn connection thread for and i just submit it. This way my server uses thread/connection pooling without implementing my own thread management(for example i do this now in my monitoring, but i could use conn threads instead with better control over the queue). ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-18 14:23 Message: Logged In: YES user_id=184124 Yes, it will work in the long run. Currently i do not have any problems with having only one DriverThread but having different driver threads with specific ThreadProc would be nice. It is just last time i tried new 4.1 driver, i could not work with it using Mozilla, somehow all connections got stale and mozilla was excepting more and more data from the server while server thought it sent everything already. My point: it needs more testing and even AOL did not start testing it. In the short run i am fine with ability to use sockcallbacks, i just need to be able to submit Sock to the ConnQueue, couple of small functions i added. If we can allow it for now and wait till 4.1 driver will be stable i would be okay. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-18 13:03 Message: Logged In: YES user_id=87254 I'm not against making NsQueueConn() public per-se, I am against publishing it as a work-around to creating a good API for pluggable protocols. I'm keen to see great support for text based and binary protocols, packet based and stream based protocols, implementations which want to use a listen thread and multiple worker threads, and those which want to do all work in a single thread. I'm happy to see any of the core changed to add this support, but it needs to be justified. I don't want to support multiple different ways of doing the same thing. Maybe we should backport the changes in 4.1 to our tree before we start hacking into it? We could leave out the adp changes etc. as I believe someone said they were broken. We should make a point release before doing this. What do you think? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-18 12:46 Message: Logged In: YES user_id=87254 Sorry, I don't have a patch to show how UDP/Unix sockets could be integrated into nssock. The 4.1 code base would seem to be a better starting point as it creates a new thread for each loaded comm driver. Here's how it could work: Unix domain socket support is easy. Use the same syntax as for the binder for the address param of the driver module in the config file. Call the correct socket listen routine depending on type within NsStartDrivers(). The nssock module should require no changes to work with this socket type. UDP sockets are harder. The 4.1 code base has changed NsStartDrivers() to spin off a thread for each loaded comm module. As the requirements for stream and packet sockets are different, a different routine would be passed to Ns_ThreadCreate() for each type. I would rename DriverThread() StreamThread() and add a new routine, PacketThread(). Much of the contents of DriverThread() can be junked for handling packet based protocols, but not all should. The new QueueWait callbacks and pre-queue filters are just as applicable here as for stream based protocols. The advantage of this is that there is a clear distinction between network transport, protocol, and application. Network transports such as SSL/TLS, SSH, etc. can be swapped in below different protocol implementations. Many applications can be built on a protocol implementation if it provides the standard hooks (registered proc, filters, QueueWait callbacks, pre-queue filteres...). Is this enough to give you an idea? It seems feasable to me, what do you think? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-18 04:31 Message: Logged In: YES user_id=184124 Do we have any conclusions about this? Soon i will have to develop some application with support for SIP over UDP, i would like to do it on Naviserver and not on my hacked AS. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-04 16:44 Message: Logged In: YES user_id=184124 And again, i have nothing against it, i said it before, what i am offering is a littl ebit different, for network based protocols driver stuff is kay, i just want to be able to submit conn threads from within the server, not through the main driver. If i have already request data, through shared memory, file or other way, i want to submit wroker thread directly, not by connecting to myself and submitting data using HTTP or other protocol i will have to implement just to queue te request. This is for other applications, not HTTP/Web based, more like messaging/authentication servers and alike. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-04 14:41 Message: Logged In: YES user_id=184124 Can you provide what you have to modify in driver/nssock, i think that will not be easy and will require too many modifications. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-04 10:08 Message: Logged In: YES user_id=87254 What do you think of my suggestion that the nssock module and nsd/driver.c could be easily modified to handle udp and unix domain sockets when specified in the config file? A change like that combined with the work you've already done to the binder would mean no development is required to handle all socket types, and would be transparent to the upper layers. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-26 17:10 Message: Logged In: YES user_id=184124 Stephan, I am suggesting a compromise, let's put ParseProc and DriverSockQueu patches, they can coexists easily but will offer two way to add new drivers. Once we have new drivers working we will see what can be modified/adjusted, for now we do not have anything except my several drivers i use in the production and i use my own loop for smtp driver to keep processing and state machine in one place. Again, i have nothing against your method, i used to do similar in my previous versions but now i need to be completely free to implement aditional driver and i think we should have this ability. Zoran, what do you think? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 22:57 Message: Logged In: YES user_id=184124 Try to implement HTTP over UDP as i provided in the patch, you will need to modify core driver again, this is one example. Next, if i want to implement small driver that do not interact with web part of aolserver, no filters, it just need to do one small thing, it should be fast but will handle very many requests. I do not need filters, callbacks, i need my own main loop. I do not understand why you are insisting that all drivers should go through http driver's main loop. If i implement dns server and web interface to it, why they should compete in the same driver's main loop and go through registered filters if they share only backend database structure? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 22:22 Message: Logged In: YES user_id=87254 You don't have to use registered filters or procs. It's an option for protocol implementations where the initial accept and parsing take place in the driver thread, and processing takes place in a conn thread. Once you submit to the queue however, either a filter, a registered proc, or a registered proxy proc must handle the request. It makes no difference whether you submit explicitly with Ns_DriverSockQueue or implicitly after your Ns_ParseProc completes. How much of the request structure you fill in is up to you, it's all optional. If you choose not to use it there is no overhead. It doesn't have to be a text based protocol for this to make sense. You might fill in the request structure if you wanted to enable people to handle different request types via C or Tcl. Or, you could store binary data in Ns_Cls storage and access it from registered procs etc. In the case where you want to handle connection accept/parse/reponse processing in the same thread, nothing needs to be added. You can do that today with Ns_SockCallback (or by placing all your code in an Ns_ParseProc and returning the response from there) Can you be more specific about the overhead of using an Ns_ParseProc? Exactly what memory is allocated, what code is run that should not..? What specifically can you not do with the Ns_ParseProc interface that you need the Ns_Driver* routines for? I'm looking for concrete examples. As far as I can tell, with Ns_ParseProc you write less code, get more options, and it takes advantage of infrastructure to give you more speed. I must be missing something, but you'll have to explain it to me in more detail because I don't get it. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 20:43 Message: Logged In: YES user_id=184124 Okay, the biggest problem with your way i see that i am enforced to go through http driver, even with my parse proc, i need to know how it works to implement my driver so correct hooks/filters will be called. If i want skip some parts i am not able to do it, http driver works only one way. Another issue is if something will not fit into current driver, additional hook needs to be introduced and core driver needs to be modified again. If my driver fits http-like/text mode paradigm, reusing http driver is the easiest way, but if i need something specific, all extra step to mimic the connection as http request, so all other parts of the http driver will not fail is just unnecesssary extra efforts. And i you mentioned, using Ns_DriverSockQueue is low level function and requires from the developer full attention for bulding the driver, but if this is what i want, why not. I can spawn my own thread if some callbacks are long running Tcl scripts and queue connection from my own loop. If i omly want to received packets, decode them and submit connection, i do not need all http driver infrusturcture, why to enforce using it? So we can have at least 3 ways for supporting multiprotocols: - standard callbacks, completely different threads, no connection pooling (Exists now) - Ns_DriverSockQueue, new thread or callback thread, reusing connection pooling. All filters/traces are reused as well - driver Parse proc in the http driver to reuse drivers thread and connection pooling with all filters/traces All 3 methiods can co-exists and do not interfere with each other, that's my point, and all they add just couple extra functions. I would implement all methods, i have 3 drivers i need to run: smtp, dns, snmp, can add imap in the future ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 20:31 Message: Logged In: YES user_id=87254 "Each way has its own drawbacks..." That's what I'm asking. What are the drawbacks for each approach we've come up with so far? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 15:23 Message: Logged In: YES user_id=184124 I am not arguing with you about your ParseProc driver extension, it is very usefull and makes driver more flexible. I just want to add couple of new API functions that will allow developer to queue connections from any place, that's it. How drivers will be written and how developer will decide to handle it is up to each particular developer. But nobody will be locked up in only one way of doing it. Each way has its own drawbacks so we have multiple choices and developer will decide for itself how it should be. Both our ways do not mutually exclusive. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 08:28 Message: Logged In: YES user_id=87254 Ah I see you're right, an extra thread is not created for each incoming request. 'udpThread' is perhaps not the best name for the socket callback though... :-) I still don't see the advantage of using Ns_SockCalback. A single thread is created by the server to handle all registered callbacks, including those from ns_sockcallback. At runtime, while this single thread is running tcl code to handle one callback, your dirver callback cannot run, no new connections will be accepted, etc. Why is it better to use the Ns_SockCallback thread rather than a driver thread? Maybe I'm reading this wrong, but how do you handle the case where the request arrives as more than one packet? Ns_DriverSockRead() is called from the 'udpThread' socket callback. The only return value checked is NS_OK, but couldn't this also be SOCK_MORE? How would you handle things like keepalive? I think you'd have to reimplement that in the Ns_SockCallback thread. Re the proxy stuff, Ns_RegisterRequest() and Ns_RegisterProxyRequest() seem very simillar. With Ns_RegisterRequest(), filters are run and you get the choice of using C or Tcl. Ns_RegisterProxyRequest() offers no advantage that I can see -- you still need a complete Request structure, even if you just ignore it. The comm driver initialization should probably be changed to automatically handle unix domain sockets. You add /foo rather that 127.0.0.1 in the config file and it knows to create the correct type of socket. nssock and nsopenssl wouldn't have to be modified at all. UDP is different. There are two types of protocols: single packet, such as DNS or RADIUS; multi packet, as used in some streaming media and p2p protocols. I think for the single packet case we again might want to modify the driver code to automatically handle it. No read-ahead is necessary, there's only one packet per request, so it's placed in the request buffer and passed on to the next stage, which is parsing. Here, a return code of SOCK_MORE would be illegal. Every multi-packet UDP protocol will require custom framing/sequencing and the developer will have to create a new socket driver. Taking RADIUS as an example, which is a single packet UDP protocol, you'd create a very simple Ns_ParseProc who's only job is to check that the number of bytes specified in the header actually arrived, and return SOCK_READY. A default request structure is created for you so the only other thing you have to do is Ns_RegisterRequest() for the '/' URL. Within your request proc, call Ns_ConnContent() and parse the buffer. Now, you do have a number of other options to make this more flexible. You could parse the request in your Ns_ParseProc and then fill out the request structure. e.g. the different RADIUS message types could be expressed as HTTP verbs. This buys you flexibility. Now you can Ns_RegisterRequest() a different routine for each RADIUS message type, and someone reusing your code can override your default implementation. You can also handle some message types in C, and others in Tcl. You might decide to put some useful information about the RADIUS request in the URL line. Now you get logging for free. You might decide to parse the key/value pairs from the RADIUS request into query vars or headers. Now you don't have to write a bunch of RADIUS specific Tcl commands to access the data, should you want to handle that from Tcl. ns_queryget or ns_conn headers will work. How far you want to go is up to you, the writer of the protocol module. But at the low end all you need is an Ns_ParseProc and usually a single registered request proc, which is a lot less code to write than the Ns_Driver* stuff, I think. I'm sure it's not perfect! So what's wrong with it? Why would it suck to write a RADIUS protocol module as I've just described, to take one example? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 05:51 Message: Logged In: YES user_id=184124 I think we need to collect all solutions and then see where are going, i am holding to port all my old/running modules because i do not know how naviserver will handle foreign protocols. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 05:48 Message: Logged In: YES user_id=184124 yes, using proxy can solve immediate requirements without hacking NsConnProc by adding hooks to call driver specific C functions. If i need my smtp server and main loop is in C, i need somehow call it in the connection thread. Using registered proxy function i can do it now, i do not need filter/traces. This is for completely new modules. I can implement main loop in the module as Tcl command and then call it in the connection filter, it is possible, it will just require many different parts to be in place and still filter should be registered as Tcl proc which will call another driver main loop. sometimes low level stuff makes things easier and simpler:-))) ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 05:45 Message: Logged In: YES user_id=184124 In all my installations i need sha module but it wasn't in the distribution, so i need to download it or repackage aolserver to include nssha1. That is my point, it is just one simple function use more often than something like ns_jpegsize or so. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 05:42 Message: Logged In: YES user_id=87254 Well I don't know about the wisdom of adding sha1 to the core at this stage :-) I see your point though, encryption and hashing functions are almost universally required for systems/server work. Maybe we need to consider adding a new encryption module to the core distribution. Like nsdb it would export a C API via libnscypher.so (or whatever) as well as the Tcl module nscypher.so. Times have changed and things like the openssl libraries are common on all platforms so it's not the big deal it used to be to add such dependiencies. Such a module should make implementing SSL in nsopenssl easier. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 05:41 Message: Logged In: YES user_id=184124 No, i do not spawn new thread, i use callback feature of the server, when socket is ready, server calls provided callback ad that callback just submits the socket to connection pool. if pool is full, Ns_DriverSockQueue will return NS_TIMEOUT, you can retry. Yes, it is low-level, for high level, HTTP driver provides a lot of functionality, it could be extended like you did, but still it is HTTP driver hacked. If i want completely new driver, like RADIUS server, http driver will not help me, i need low level stuff, and it is there already. To reuse resource limiting, i added Ns_DriverSockQueue function, so new conections can be queue instead of creating new threads. I do not have anything against your patch for extending current driver, it is very usefull. i am offering new API for low level drivers. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 05:36 Message: Logged In: YES user_id=87254 The proxy stuff is too late in the cycle to do much. The request has to be fully parsed by then (for read-ahead). If a proxy function is available, then all filters, the auth phase, registered procs, cleanup procs etc. are bypassed. A lot of that stuff can be very useful for non-HTTP protocols. I don't think handling stuff via a proxy function buys you much. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 05:32 Message: Logged In: YES user_id=87254 I don't understand what you're trying to acheive here (well, apart from multi-protocol... :-). The newly exposed Ns_Driver* entry points are quite low level, and so the implementor of the new protocol is left to do a lot of the heavy lifting. For example, the way I read it you have to create your own listen socket and register a callback. Every time a new reaquest comes in a thread is spawned to handle it. From that thread you then submit the parsed request to one of the conn threads. Excessive thread creation and message passing between threads is not going to perform well. And it seems you have to write more code than e.g. the example POP3 driver I posted some time ago. You're also not taking advantage of the other facilities that the server offers. What happens if 1000 connections arrive, do you spawn 1000 threads? You could of course code up some limit checks, but this already exists. What if a client sends you a continuous stream of data, 2GB... etc. By using the driver hooks to provide the new protocol parser, you deny yourself the opportunity to use something like the nsopenssl module. This should work just fine for protocols like SMTP, IMAP, POP3 and probably others. Anyway, I think one of the most carefully coded aspects of the server is it's attention to resource usage. That goes for IO, context switching, memory, etc. It's espescialy nice that most of the time you're not even aware that all this work is being done for you. I'd like new protocol drivers to be able to transparently take advantage of that. Could you take a look at my old POP3 demo driver? It's the attachment nspopd-0.3.tar.bz2 over here: http://sourceforge.net/tracker/index.php?func=detail&aid=973010&group_id=3152&atid=353152 It's not obvious that anything interesting is going on, so it's not much to look at. But actually, conn socket read-ahead is happening eficiently in one thread with async IO, the conn threads are treated as a precious resource (heavy-weight Tcl interps) and are allocated at the last minute, there's an easy API in C and Tcl to implement the actual reading of data from the INBOX (could be from the file system, db etc.). You've got a lot of experience writing servers, what do you think is wrong with this model? What can it not do, or what could it do better? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-24 21:29 Message: Logged In: YES user_id=184124 Another thing, once we can submit connections from any place, no need to build any drivers, even in C, i can register new proxy proc and set protocol field in my request, so when submitted, connection will run registered proxy proc. for example: in my smtp driver/module, i create driver, register proxy for smtp: protocol, register callback for the socket. Once connection accepted, in my module i submit that connection to the queue with request-protocl set to smtp:. queue.c will call my proxy handler, which is C function. No need to add anything else. This way even standard aolserver can be extended without touching precious http driver thread. Sorry for sarcasm. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1151137&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-05-17 19:24:28
|
Feature Requests item #1151137, was opened at 2005-02-24 16:01 Message generated for change (Comment added) made by seryakov You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1151137&group_id=130646 Category: C-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Vlad Seryakov (seryakov) Assigned to: Vlad Seryakov (seryakov) Summary: New driver API and Udp module Initial Comment: Hi guys, Attached is minor driver extensions which do not change existing drivers but add new functionality. There are some cosmetic changes, like moving some fields in the Ns_Sock/Ns_Driver structres so they can be accessed publically and made some private functions public but functionality preserved as before. I included udp driver as an example of new API, and also added ns_sha1 command in the tclmisc.c, it is just one command and it is uses practically everywhere. ------------------------------------------------------------------------- To test udp driver i use new ns_udp command: ossweb:nscp 8> ns_udp send 127.0.0.1 5060 "GET / HTTP/1.0\n\n" HTTP/1.0 200 OK MIME-Version: 1.0 Date: Thu, 24 Feb 2005 05:39:50 GMT Server: NaviServer/4.0.10 Content-Type: text/html; charset=iso-8859-1 Content-Length: 661 Connection: close <HEAD><TITLE>Seryakov's Family Intranet</TITLE></HEAD> ..... ---------------------------------------------------------------------- >Comment By: Vlad Seryakov (seryakov) Date: 2005-05-17 19:24 Message: Logged In: YES user_id=184124 I am attaching new nsudp driver, it uses existing driver sock, just couple places where NS_DRIVER_UDP flag is checked for initializing and not performing accept calls. ns_udp module is simple driver like nssock. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-05-04 18:01 Message: Logged In: YES user_id=184124 I implemented my SIP driver completely in separate threads and do not use Conn/Queue or jobs at all. When comparing performance with SER(sip proxy), NS still behind because of multi-threading overhead while SER forks many children listening on the same socket, same way as apache 1.x used to do. Also, NS/AS/Tcl memory allocator is slower than non-threaded allocator. My first version was using Conn/SockCallbacks but it was so slow, i could not process more than 500 requests per second. Now i can do 9000 requests per second on the same server. So, having UDP implemented in the core is not that important for me but still, using UDP as signaling/messaging protocol instead of HTTP or implementing other not that performance-needed drivers would be great. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-18 18:17 Message: Logged In: YES user_id=184124 >I'm happy to see any of the core changed to add this >support, but it needs to be justified. I don't want to >support multiple different ways of doing the same thing. No, it is not the same thing. To build different drivers, API and tools should be flexible enough, if we have only one way to add a driver, so only drivers which fit will be(if) added, and if something usefull will come up, will we need to change the core again to fit different mehtod? Basically you offered the same thing that i am talking about: if we supply new DriverThread for UDP driver, the only common is how to queue it, public NsQueueConn. The rest is driver/thread specific. Currently, i can live with specific thread proc using sock callbacks, but when driver threads will be available, i can switch to it, but still once i read data from UDP, i need to build Sock/Conn and queue it. This is what i am offering, make NsQueueConn public plus/mines changing some other function but just to only support public NsQueueConn. IT will not conflict with future global driver changes. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-18 14:28 Message: Logged In: YES user_id=184124 One good for having NsQueueConn public is to be able to submit connection threads from memory, without actual protocol/driver connection. I have data to spawn connection thread for and i just submit it. This way my server uses thread/connection pooling without implementing my own thread management(for example i do this now in my monitoring, but i could use conn threads instead with better control over the queue). ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-18 14:23 Message: Logged In: YES user_id=184124 Yes, it will work in the long run. Currently i do not have any problems with having only one DriverThread but having different driver threads with specific ThreadProc would be nice. It is just last time i tried new 4.1 driver, i could not work with it using Mozilla, somehow all connections got stale and mozilla was excepting more and more data from the server while server thought it sent everything already. My point: it needs more testing and even AOL did not start testing it. In the short run i am fine with ability to use sockcallbacks, i just need to be able to submit Sock to the ConnQueue, couple of small functions i added. If we can allow it for now and wait till 4.1 driver will be stable i would be okay. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-18 13:03 Message: Logged In: YES user_id=87254 I'm not against making NsQueueConn() public per-se, I am against publishing it as a work-around to creating a good API for pluggable protocols. I'm keen to see great support for text based and binary protocols, packet based and stream based protocols, implementations which want to use a listen thread and multiple worker threads, and those which want to do all work in a single thread. I'm happy to see any of the core changed to add this support, but it needs to be justified. I don't want to support multiple different ways of doing the same thing. Maybe we should backport the changes in 4.1 to our tree before we start hacking into it? We could leave out the adp changes etc. as I believe someone said they were broken. We should make a point release before doing this. What do you think? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-18 12:46 Message: Logged In: YES user_id=87254 Sorry, I don't have a patch to show how UDP/Unix sockets could be integrated into nssock. The 4.1 code base would seem to be a better starting point as it creates a new thread for each loaded comm driver. Here's how it could work: Unix domain socket support is easy. Use the same syntax as for the binder for the address param of the driver module in the config file. Call the correct socket listen routine depending on type within NsStartDrivers(). The nssock module should require no changes to work with this socket type. UDP sockets are harder. The 4.1 code base has changed NsStartDrivers() to spin off a thread for each loaded comm module. As the requirements for stream and packet sockets are different, a different routine would be passed to Ns_ThreadCreate() for each type. I would rename DriverThread() StreamThread() and add a new routine, PacketThread(). Much of the contents of DriverThread() can be junked for handling packet based protocols, but not all should. The new QueueWait callbacks and pre-queue filters are just as applicable here as for stream based protocols. The advantage of this is that there is a clear distinction between network transport, protocol, and application. Network transports such as SSL/TLS, SSH, etc. can be swapped in below different protocol implementations. Many applications can be built on a protocol implementation if it provides the standard hooks (registered proc, filters, QueueWait callbacks, pre-queue filteres...). Is this enough to give you an idea? It seems feasable to me, what do you think? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-18 04:31 Message: Logged In: YES user_id=184124 Do we have any conclusions about this? Soon i will have to develop some application with support for SIP over UDP, i would like to do it on Naviserver and not on my hacked AS. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-04 16:44 Message: Logged In: YES user_id=184124 And again, i have nothing against it, i said it before, what i am offering is a littl ebit different, for network based protocols driver stuff is kay, i just want to be able to submit conn threads from within the server, not through the main driver. If i have already request data, through shared memory, file or other way, i want to submit wroker thread directly, not by connecting to myself and submitting data using HTTP or other protocol i will have to implement just to queue te request. This is for other applications, not HTTP/Web based, more like messaging/authentication servers and alike. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-04 14:41 Message: Logged In: YES user_id=184124 Can you provide what you have to modify in driver/nssock, i think that will not be easy and will require too many modifications. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-04 10:08 Message: Logged In: YES user_id=87254 What do you think of my suggestion that the nssock module and nsd/driver.c could be easily modified to handle udp and unix domain sockets when specified in the config file? A change like that combined with the work you've already done to the binder would mean no development is required to handle all socket types, and would be transparent to the upper layers. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-26 17:10 Message: Logged In: YES user_id=184124 Stephan, I am suggesting a compromise, let's put ParseProc and DriverSockQueu patches, they can coexists easily but will offer two way to add new drivers. Once we have new drivers working we will see what can be modified/adjusted, for now we do not have anything except my several drivers i use in the production and i use my own loop for smtp driver to keep processing and state machine in one place. Again, i have nothing against your method, i used to do similar in my previous versions but now i need to be completely free to implement aditional driver and i think we should have this ability. Zoran, what do you think? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 22:57 Message: Logged In: YES user_id=184124 Try to implement HTTP over UDP as i provided in the patch, you will need to modify core driver again, this is one example. Next, if i want to implement small driver that do not interact with web part of aolserver, no filters, it just need to do one small thing, it should be fast but will handle very many requests. I do not need filters, callbacks, i need my own main loop. I do not understand why you are insisting that all drivers should go through http driver's main loop. If i implement dns server and web interface to it, why they should compete in the same driver's main loop and go through registered filters if they share only backend database structure? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 22:22 Message: Logged In: YES user_id=87254 You don't have to use registered filters or procs. It's an option for protocol implementations where the initial accept and parsing take place in the driver thread, and processing takes place in a conn thread. Once you submit to the queue however, either a filter, a registered proc, or a registered proxy proc must handle the request. It makes no difference whether you submit explicitly with Ns_DriverSockQueue or implicitly after your Ns_ParseProc completes. How much of the request structure you fill in is up to you, it's all optional. If you choose not to use it there is no overhead. It doesn't have to be a text based protocol for this to make sense. You might fill in the request structure if you wanted to enable people to handle different request types via C or Tcl. Or, you could store binary data in Ns_Cls storage and access it from registered procs etc. In the case where you want to handle connection accept/parse/reponse processing in the same thread, nothing needs to be added. You can do that today with Ns_SockCallback (or by placing all your code in an Ns_ParseProc and returning the response from there) Can you be more specific about the overhead of using an Ns_ParseProc? Exactly what memory is allocated, what code is run that should not..? What specifically can you not do with the Ns_ParseProc interface that you need the Ns_Driver* routines for? I'm looking for concrete examples. As far as I can tell, with Ns_ParseProc you write less code, get more options, and it takes advantage of infrastructure to give you more speed. I must be missing something, but you'll have to explain it to me in more detail because I don't get it. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 20:43 Message: Logged In: YES user_id=184124 Okay, the biggest problem with your way i see that i am enforced to go through http driver, even with my parse proc, i need to know how it works to implement my driver so correct hooks/filters will be called. If i want skip some parts i am not able to do it, http driver works only one way. Another issue is if something will not fit into current driver, additional hook needs to be introduced and core driver needs to be modified again. If my driver fits http-like/text mode paradigm, reusing http driver is the easiest way, but if i need something specific, all extra step to mimic the connection as http request, so all other parts of the http driver will not fail is just unnecesssary extra efforts. And i you mentioned, using Ns_DriverSockQueue is low level function and requires from the developer full attention for bulding the driver, but if this is what i want, why not. I can spawn my own thread if some callbacks are long running Tcl scripts and queue connection from my own loop. If i omly want to received packets, decode them and submit connection, i do not need all http driver infrusturcture, why to enforce using it? So we can have at least 3 ways for supporting multiprotocols: - standard callbacks, completely different threads, no connection pooling (Exists now) - Ns_DriverSockQueue, new thread or callback thread, reusing connection pooling. All filters/traces are reused as well - driver Parse proc in the http driver to reuse drivers thread and connection pooling with all filters/traces All 3 methiods can co-exists and do not interfere with each other, that's my point, and all they add just couple extra functions. I would implement all methods, i have 3 drivers i need to run: smtp, dns, snmp, can add imap in the future ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 20:31 Message: Logged In: YES user_id=87254 "Each way has its own drawbacks..." That's what I'm asking. What are the drawbacks for each approach we've come up with so far? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 15:23 Message: Logged In: YES user_id=184124 I am not arguing with you about your ParseProc driver extension, it is very usefull and makes driver more flexible. I just want to add couple of new API functions that will allow developer to queue connections from any place, that's it. How drivers will be written and how developer will decide to handle it is up to each particular developer. But nobody will be locked up in only one way of doing it. Each way has its own drawbacks so we have multiple choices and developer will decide for itself how it should be. Both our ways do not mutually exclusive. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 08:28 Message: Logged In: YES user_id=87254 Ah I see you're right, an extra thread is not created for each incoming request. 'udpThread' is perhaps not the best name for the socket callback though... :-) I still don't see the advantage of using Ns_SockCalback. A single thread is created by the server to handle all registered callbacks, including those from ns_sockcallback. At runtime, while this single thread is running tcl code to handle one callback, your dirver callback cannot run, no new connections will be accepted, etc. Why is it better to use the Ns_SockCallback thread rather than a driver thread? Maybe I'm reading this wrong, but how do you handle the case where the request arrives as more than one packet? Ns_DriverSockRead() is called from the 'udpThread' socket callback. The only return value checked is NS_OK, but couldn't this also be SOCK_MORE? How would you handle things like keepalive? I think you'd have to reimplement that in the Ns_SockCallback thread. Re the proxy stuff, Ns_RegisterRequest() and Ns_RegisterProxyRequest() seem very simillar. With Ns_RegisterRequest(), filters are run and you get the choice of using C or Tcl. Ns_RegisterProxyRequest() offers no advantage that I can see -- you still need a complete Request structure, even if you just ignore it. The comm driver initialization should probably be changed to automatically handle unix domain sockets. You add /foo rather that 127.0.0.1 in the config file and it knows to create the correct type of socket. nssock and nsopenssl wouldn't have to be modified at all. UDP is different. There are two types of protocols: single packet, such as DNS or RADIUS; multi packet, as used in some streaming media and p2p protocols. I think for the single packet case we again might want to modify the driver code to automatically handle it. No read-ahead is necessary, there's only one packet per request, so it's placed in the request buffer and passed on to the next stage, which is parsing. Here, a return code of SOCK_MORE would be illegal. Every multi-packet UDP protocol will require custom framing/sequencing and the developer will have to create a new socket driver. Taking RADIUS as an example, which is a single packet UDP protocol, you'd create a very simple Ns_ParseProc who's only job is to check that the number of bytes specified in the header actually arrived, and return SOCK_READY. A default request structure is created for you so the only other thing you have to do is Ns_RegisterRequest() for the '/' URL. Within your request proc, call Ns_ConnContent() and parse the buffer. Now, you do have a number of other options to make this more flexible. You could parse the request in your Ns_ParseProc and then fill out the request structure. e.g. the different RADIUS message types could be expressed as HTTP verbs. This buys you flexibility. Now you can Ns_RegisterRequest() a different routine for each RADIUS message type, and someone reusing your code can override your default implementation. You can also handle some message types in C, and others in Tcl. You might decide to put some useful information about the RADIUS request in the URL line. Now you get logging for free. You might decide to parse the key/value pairs from the RADIUS request into query vars or headers. Now you don't have to write a bunch of RADIUS specific Tcl commands to access the data, should you want to handle that from Tcl. ns_queryget or ns_conn headers will work. How far you want to go is up to you, the writer of the protocol module. But at the low end all you need is an Ns_ParseProc and usually a single registered request proc, which is a lot less code to write than the Ns_Driver* stuff, I think. I'm sure it's not perfect! So what's wrong with it? Why would it suck to write a RADIUS protocol module as I've just described, to take one example? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 05:51 Message: Logged In: YES user_id=184124 I think we need to collect all solutions and then see where are going, i am holding to port all my old/running modules because i do not know how naviserver will handle foreign protocols. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 05:48 Message: Logged In: YES user_id=184124 yes, using proxy can solve immediate requirements without hacking NsConnProc by adding hooks to call driver specific C functions. If i need my smtp server and main loop is in C, i need somehow call it in the connection thread. Using registered proxy function i can do it now, i do not need filter/traces. This is for completely new modules. I can implement main loop in the module as Tcl command and then call it in the connection filter, it is possible, it will just require many different parts to be in place and still filter should be registered as Tcl proc which will call another driver main loop. sometimes low level stuff makes things easier and simpler:-))) ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 05:45 Message: Logged In: YES user_id=184124 In all my installations i need sha module but it wasn't in the distribution, so i need to download it or repackage aolserver to include nssha1. That is my point, it is just one simple function use more often than something like ns_jpegsize or so. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 05:42 Message: Logged In: YES user_id=87254 Well I don't know about the wisdom of adding sha1 to the core at this stage :-) I see your point though, encryption and hashing functions are almost universally required for systems/server work. Maybe we need to consider adding a new encryption module to the core distribution. Like nsdb it would export a C API via libnscypher.so (or whatever) as well as the Tcl module nscypher.so. Times have changed and things like the openssl libraries are common on all platforms so it's not the big deal it used to be to add such dependiencies. Such a module should make implementing SSL in nsopenssl easier. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 05:41 Message: Logged In: YES user_id=184124 No, i do not spawn new thread, i use callback feature of the server, when socket is ready, server calls provided callback ad that callback just submits the socket to connection pool. if pool is full, Ns_DriverSockQueue will return NS_TIMEOUT, you can retry. Yes, it is low-level, for high level, HTTP driver provides a lot of functionality, it could be extended like you did, but still it is HTTP driver hacked. If i want completely new driver, like RADIUS server, http driver will not help me, i need low level stuff, and it is there already. To reuse resource limiting, i added Ns_DriverSockQueue function, so new conections can be queue instead of creating new threads. I do not have anything against your patch for extending current driver, it is very usefull. i am offering new API for low level drivers. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 05:36 Message: Logged In: YES user_id=87254 The proxy stuff is too late in the cycle to do much. The request has to be fully parsed by then (for read-ahead). If a proxy function is available, then all filters, the auth phase, registered procs, cleanup procs etc. are bypassed. A lot of that stuff can be very useful for non-HTTP protocols. I don't think handling stuff via a proxy function buys you much. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 05:32 Message: Logged In: YES user_id=87254 I don't understand what you're trying to acheive here (well, apart from multi-protocol... :-). The newly exposed Ns_Driver* entry points are quite low level, and so the implementor of the new protocol is left to do a lot of the heavy lifting. For example, the way I read it you have to create your own listen socket and register a callback. Every time a new reaquest comes in a thread is spawned to handle it. From that thread you then submit the parsed request to one of the conn threads. Excessive thread creation and message passing between threads is not going to perform well. And it seems you have to write more code than e.g. the example POP3 driver I posted some time ago. You're also not taking advantage of the other facilities that the server offers. What happens if 1000 connections arrive, do you spawn 1000 threads? You could of course code up some limit checks, but this already exists. What if a client sends you a continuous stream of data, 2GB... etc. By using the driver hooks to provide the new protocol parser, you deny yourself the opportunity to use something like the nsopenssl module. This should work just fine for protocols like SMTP, IMAP, POP3 and probably others. Anyway, I think one of the most carefully coded aspects of the server is it's attention to resource usage. That goes for IO, context switching, memory, etc. It's espescialy nice that most of the time you're not even aware that all this work is being done for you. I'd like new protocol drivers to be able to transparently take advantage of that. Could you take a look at my old POP3 demo driver? It's the attachment nspopd-0.3.tar.bz2 over here: http://sourceforge.net/tracker/index.php?func=detail&aid=973010&group_id=3152&atid=353152 It's not obvious that anything interesting is going on, so it's not much to look at. But actually, conn socket read-ahead is happening eficiently in one thread with async IO, the conn threads are treated as a precious resource (heavy-weight Tcl interps) and are allocated at the last minute, there's an easy API in C and Tcl to implement the actual reading of data from the INBOX (could be from the file system, db etc.). You've got a lot of experience writing servers, what do you think is wrong with this model? What can it not do, or what could it do better? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-24 21:29 Message: Logged In: YES user_id=184124 Another thing, once we can submit connections from any place, no need to build any drivers, even in C, i can register new proxy proc and set protocol field in my request, so when submitted, connection will run registered proxy proc. for example: in my smtp driver/module, i create driver, register proxy for smtp: protocol, register callback for the socket. Once connection accepted, in my module i submit that connection to the queue with request-protocl set to smtp:. queue.c will call my proxy handler, which is C function. No need to add anything else. This way even standard aolserver can be extended without touching precious http driver thread. Sorry for sarcasm. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1151137&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-05-16 11:43:50
|
Feature Requests item #1202462, was opened at 2005-05-15 22:14 Message generated for change (Comment added) made by vasiljevic You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1202462&group_id=130646 Category: C-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Rewrite to use Tcl VFS filesystem abstraction Initial Comment: We should really invest some time and rewrite all (most?) of the internal usages of open(), stat() (etc) so we can take advantage of Tcl virtual filesystem wappers. ---------------------------------------------------------------------- >Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-05-16 13:43 Message: Logged In: YES user_id=95086 Oh yes. The packaging is what I'm (mostly) after. The only parts where mmap is used is fastpath.c. I do not know what/where is sendfile... So, effectively, the mmap has to be *enabled* to be used, right? Well, there is nothing wrong in leaving the mmap inplace. Actually, it should be also done in the way that Windows platform can use it (nees some wrapping but its easy done). But, it mmap is not enabled? Then the server uses standard open/read/close stuff from the OS. Now, what's wrong in using Tcl API equivalents of that? In that case, it is transparent where the file actually comes from, filesystem, zip/tarfile, etc... Do you think this could hit us performance-wise. I do not know. Maybe, but it's worth trying it out. Also, there are whole lotta places where the server uses OS calls to the filesystem which has nothing to do with serving pages (logfiles, access files, config files, etc...). These are not sensitive performance-wise and those places should/could be rewritten so we can bootstrap from zipfile if needed. Or be entirely wrapped in a startkit. What do you think? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-05-16 13:30 Message: Logged In: YES user_id=87254 I'd be reluctant to let go of mmap and sendfile, considering our niche as a performace server. You can already use the vfs to read zip files etc., it's the single file packaging your after, right? ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-05-16 08:55 Message: Logged In: YES user_id=95086 The advantage is that you can for example, assemble all of the server distro in a starkit and distribute it as a wrapped application. Also, all sorts of filesystem wrappers (tar, zip, metakit, http, ...) are already implemeted in TclVFS so you can serve pages out of the tar/zip files directly, for example. No, mmap kind of things would be not possible since all would be going thru Tcl API. But, where is the mmap used? I believe only in fastpath and only if you explicitly enable it. And, only for Unix port. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-05-16 01:25 Message: Logged In: YES user_id=87254 What would be the advantage of using the Tcl VFS? Would it be just as fast? Could we still use performance enhancemts such as mmap() and sendfile()? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1202462&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-05-16 11:30:20
|
Feature Requests item #1202462, was opened at 2005-05-15 14:14 Message generated for change (Comment added) made by sdeasey You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1202462&group_id=130646 Category: C-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Rewrite to use Tcl VFS filesystem abstraction Initial Comment: We should really invest some time and rewrite all (most?) of the internal usages of open(), stat() (etc) so we can take advantage of Tcl virtual filesystem wappers. ---------------------------------------------------------------------- >Comment By: Stephen Deasey (sdeasey) Date: 2005-05-16 05:30 Message: Logged In: YES user_id=87254 I'd be reluctant to let go of mmap and sendfile, considering our niche as a performace server. You can already use the vfs to read zip files etc., it's the single file packaging your after, right? ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-05-16 00:55 Message: Logged In: YES user_id=95086 The advantage is that you can for example, assemble all of the server distro in a starkit and distribute it as a wrapped application. Also, all sorts of filesystem wrappers (tar, zip, metakit, http, ...) are already implemeted in TclVFS so you can serve pages out of the tar/zip files directly, for example. No, mmap kind of things would be not possible since all would be going thru Tcl API. But, where is the mmap used? I believe only in fastpath and only if you explicitly enable it. And, only for Unix port. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-05-15 17:25 Message: Logged In: YES user_id=87254 What would be the advantage of using the Tcl VFS? Would it be just as fast? Could we still use performance enhancemts such as mmap() and sendfile()? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1202462&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-05-16 06:55:08
|
Feature Requests item #1202462, was opened at 2005-05-15 22:14 Message generated for change (Comment added) made by vasiljevic You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1202462&group_id=130646 Category: C-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Rewrite to use Tcl VFS filesystem abstraction Initial Comment: We should really invest some time and rewrite all (most?) of the internal usages of open(), stat() (etc) so we can take advantage of Tcl virtual filesystem wappers. ---------------------------------------------------------------------- >Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-05-16 08:55 Message: Logged In: YES user_id=95086 The advantage is that you can for example, assemble all of the server distro in a starkit and distribute it as a wrapped application. Also, all sorts of filesystem wrappers (tar, zip, metakit, http, ...) are already implemeted in TclVFS so you can serve pages out of the tar/zip files directly, for example. No, mmap kind of things would be not possible since all would be going thru Tcl API. But, where is the mmap used? I believe only in fastpath and only if you explicitly enable it. And, only for Unix port. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-05-16 01:25 Message: Logged In: YES user_id=87254 What would be the advantage of using the Tcl VFS? Would it be just as fast? Could we still use performance enhancemts such as mmap() and sendfile()? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1202462&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-05-15 23:25:50
|
Feature Requests item #1202462, was opened at 2005-05-15 14:14 Message generated for change (Comment added) made by sdeasey You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1202462&group_id=130646 Category: C-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Rewrite to use Tcl VFS filesystem abstraction Initial Comment: We should really invest some time and rewrite all (most?) of the internal usages of open(), stat() (etc) so we can take advantage of Tcl virtual filesystem wappers. ---------------------------------------------------------------------- >Comment By: Stephen Deasey (sdeasey) Date: 2005-05-15 17:25 Message: Logged In: YES user_id=87254 What would be the advantage of using the Tcl VFS? Would it be just as fast? Could we still use performance enhancemts such as mmap() and sendfile()? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1202462&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-05-15 20:15:42
|
Feature Requests item #1156107, was opened at 2005-03-03 20:04 Message generated for change (Settings changed) made by vasiljevic You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1156107&group_id=130646 Category: Tcl-API Group: None >Status: Closed Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Scrap optional connid parameter from Tcl API Initial Comment: Some Tcl-API commands still accept optional connection-id parameter which is left as the compatibility trace from older 2.x nsd servers. This complicates argument processing and serves no other obvious purpose. The idea is to scrap this optional connid parsing from the Tcl-API calls making them simpler to document and implement. I never used any code running for the 2.x servers hence for me it is OK to remove those. Any thoughts on that? ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-18 21:41 Message: Logged In: YES user_id=95086 Nothing that o know of. I think we can close this one. If I encounter one of those along the road I will scrap it out. I will leave this open as a reminder, though. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-18 15:06 Message: Logged In: YES user_id=87254 I removed connid suuport from conn.c and tclresp.c. Is there anything left? ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-03-08 19:34 Message: Logged In: YES user_id=95086 I will do this on as-encountered basis. If others are about to rewrite some command that still parses this ugly argument, I suggest to remove it entirely. Furthermore, we should gradually start to use Stephens new tclobjv arg parsing. Stephen, you mind checkin in some example command rewrite so we can all see and use this as a guidance while rewriting or implementing new parsers? ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-03-04 09:38 Message: Logged In: YES user_id=95086 ns_conn ns_register_filter ns_return (some of them) They all accept a weird syntax: <proc> ?connid? args which is PITA to parse and maintain. Yet, it is not used any more... It is only there to be able to run 2.x server-side Tcl code ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-03 23:08 Message: Logged In: YES user_id=184124 Which commands are you talking about? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1156107&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-05-15 20:14:34
|
Feature Requests item #1202462, was opened at 2005-05-15 22:14 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1202462&group_id=130646 Category: C-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Rewrite to use Tcl VFS filesystem abstraction Initial Comment: We should really invest some time and rewrite all (most?) of the internal usages of open(), stat() (etc) so we can take advantage of Tcl virtual filesystem wappers. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1202462&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-05-04 18:01:59
|
Feature Requests item #1151137, was opened at 2005-02-24 16:01 Message generated for change (Comment added) made by seryakov You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1151137&group_id=130646 Category: C-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Vlad Seryakov (seryakov) Assigned to: Vlad Seryakov (seryakov) Summary: New driver API and Udp module Initial Comment: Hi guys, Attached is minor driver extensions which do not change existing drivers but add new functionality. There are some cosmetic changes, like moving some fields in the Ns_Sock/Ns_Driver structres so they can be accessed publically and made some private functions public but functionality preserved as before. I included udp driver as an example of new API, and also added ns_sha1 command in the tclmisc.c, it is just one command and it is uses practically everywhere. ------------------------------------------------------------------------- To test udp driver i use new ns_udp command: ossweb:nscp 8> ns_udp send 127.0.0.1 5060 "GET / HTTP/1.0\n\n" HTTP/1.0 200 OK MIME-Version: 1.0 Date: Thu, 24 Feb 2005 05:39:50 GMT Server: NaviServer/4.0.10 Content-Type: text/html; charset=iso-8859-1 Content-Length: 661 Connection: close <HEAD><TITLE>Seryakov's Family Intranet</TITLE></HEAD> ..... ---------------------------------------------------------------------- >Comment By: Vlad Seryakov (seryakov) Date: 2005-05-04 18:01 Message: Logged In: YES user_id=184124 I implemented my SIP driver completely in separate threads and do not use Conn/Queue or jobs at all. When comparing performance with SER(sip proxy), NS still behind because of multi-threading overhead while SER forks many children listening on the same socket, same way as apache 1.x used to do. Also, NS/AS/Tcl memory allocator is slower than non-threaded allocator. My first version was using Conn/SockCallbacks but it was so slow, i could not process more than 500 requests per second. Now i can do 9000 requests per second on the same server. So, having UDP implemented in the core is not that important for me but still, using UDP as signaling/messaging protocol instead of HTTP or implementing other not that performance-needed drivers would be great. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-18 18:17 Message: Logged In: YES user_id=184124 >I'm happy to see any of the core changed to add this >support, but it needs to be justified. I don't want to >support multiple different ways of doing the same thing. No, it is not the same thing. To build different drivers, API and tools should be flexible enough, if we have only one way to add a driver, so only drivers which fit will be(if) added, and if something usefull will come up, will we need to change the core again to fit different mehtod? Basically you offered the same thing that i am talking about: if we supply new DriverThread for UDP driver, the only common is how to queue it, public NsQueueConn. The rest is driver/thread specific. Currently, i can live with specific thread proc using sock callbacks, but when driver threads will be available, i can switch to it, but still once i read data from UDP, i need to build Sock/Conn and queue it. This is what i am offering, make NsQueueConn public plus/mines changing some other function but just to only support public NsQueueConn. IT will not conflict with future global driver changes. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-18 14:28 Message: Logged In: YES user_id=184124 One good for having NsQueueConn public is to be able to submit connection threads from memory, without actual protocol/driver connection. I have data to spawn connection thread for and i just submit it. This way my server uses thread/connection pooling without implementing my own thread management(for example i do this now in my monitoring, but i could use conn threads instead with better control over the queue). ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-18 14:23 Message: Logged In: YES user_id=184124 Yes, it will work in the long run. Currently i do not have any problems with having only one DriverThread but having different driver threads with specific ThreadProc would be nice. It is just last time i tried new 4.1 driver, i could not work with it using Mozilla, somehow all connections got stale and mozilla was excepting more and more data from the server while server thought it sent everything already. My point: it needs more testing and even AOL did not start testing it. In the short run i am fine with ability to use sockcallbacks, i just need to be able to submit Sock to the ConnQueue, couple of small functions i added. If we can allow it for now and wait till 4.1 driver will be stable i would be okay. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-18 13:03 Message: Logged In: YES user_id=87254 I'm not against making NsQueueConn() public per-se, I am against publishing it as a work-around to creating a good API for pluggable protocols. I'm keen to see great support for text based and binary protocols, packet based and stream based protocols, implementations which want to use a listen thread and multiple worker threads, and those which want to do all work in a single thread. I'm happy to see any of the core changed to add this support, but it needs to be justified. I don't want to support multiple different ways of doing the same thing. Maybe we should backport the changes in 4.1 to our tree before we start hacking into it? We could leave out the adp changes etc. as I believe someone said they were broken. We should make a point release before doing this. What do you think? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-18 12:46 Message: Logged In: YES user_id=87254 Sorry, I don't have a patch to show how UDP/Unix sockets could be integrated into nssock. The 4.1 code base would seem to be a better starting point as it creates a new thread for each loaded comm driver. Here's how it could work: Unix domain socket support is easy. Use the same syntax as for the binder for the address param of the driver module in the config file. Call the correct socket listen routine depending on type within NsStartDrivers(). The nssock module should require no changes to work with this socket type. UDP sockets are harder. The 4.1 code base has changed NsStartDrivers() to spin off a thread for each loaded comm module. As the requirements for stream and packet sockets are different, a different routine would be passed to Ns_ThreadCreate() for each type. I would rename DriverThread() StreamThread() and add a new routine, PacketThread(). Much of the contents of DriverThread() can be junked for handling packet based protocols, but not all should. The new QueueWait callbacks and pre-queue filters are just as applicable here as for stream based protocols. The advantage of this is that there is a clear distinction between network transport, protocol, and application. Network transports such as SSL/TLS, SSH, etc. can be swapped in below different protocol implementations. Many applications can be built on a protocol implementation if it provides the standard hooks (registered proc, filters, QueueWait callbacks, pre-queue filteres...). Is this enough to give you an idea? It seems feasable to me, what do you think? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-18 04:31 Message: Logged In: YES user_id=184124 Do we have any conclusions about this? Soon i will have to develop some application with support for SIP over UDP, i would like to do it on Naviserver and not on my hacked AS. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-04 16:44 Message: Logged In: YES user_id=184124 And again, i have nothing against it, i said it before, what i am offering is a littl ebit different, for network based protocols driver stuff is kay, i just want to be able to submit conn threads from within the server, not through the main driver. If i have already request data, through shared memory, file or other way, i want to submit wroker thread directly, not by connecting to myself and submitting data using HTTP or other protocol i will have to implement just to queue te request. This is for other applications, not HTTP/Web based, more like messaging/authentication servers and alike. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-04 14:41 Message: Logged In: YES user_id=184124 Can you provide what you have to modify in driver/nssock, i think that will not be easy and will require too many modifications. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-04 10:08 Message: Logged In: YES user_id=87254 What do you think of my suggestion that the nssock module and nsd/driver.c could be easily modified to handle udp and unix domain sockets when specified in the config file? A change like that combined with the work you've already done to the binder would mean no development is required to handle all socket types, and would be transparent to the upper layers. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-26 17:10 Message: Logged In: YES user_id=184124 Stephan, I am suggesting a compromise, let's put ParseProc and DriverSockQueu patches, they can coexists easily but will offer two way to add new drivers. Once we have new drivers working we will see what can be modified/adjusted, for now we do not have anything except my several drivers i use in the production and i use my own loop for smtp driver to keep processing and state machine in one place. Again, i have nothing against your method, i used to do similar in my previous versions but now i need to be completely free to implement aditional driver and i think we should have this ability. Zoran, what do you think? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 22:57 Message: Logged In: YES user_id=184124 Try to implement HTTP over UDP as i provided in the patch, you will need to modify core driver again, this is one example. Next, if i want to implement small driver that do not interact with web part of aolserver, no filters, it just need to do one small thing, it should be fast but will handle very many requests. I do not need filters, callbacks, i need my own main loop. I do not understand why you are insisting that all drivers should go through http driver's main loop. If i implement dns server and web interface to it, why they should compete in the same driver's main loop and go through registered filters if they share only backend database structure? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 22:22 Message: Logged In: YES user_id=87254 You don't have to use registered filters or procs. It's an option for protocol implementations where the initial accept and parsing take place in the driver thread, and processing takes place in a conn thread. Once you submit to the queue however, either a filter, a registered proc, or a registered proxy proc must handle the request. It makes no difference whether you submit explicitly with Ns_DriverSockQueue or implicitly after your Ns_ParseProc completes. How much of the request structure you fill in is up to you, it's all optional. If you choose not to use it there is no overhead. It doesn't have to be a text based protocol for this to make sense. You might fill in the request structure if you wanted to enable people to handle different request types via C or Tcl. Or, you could store binary data in Ns_Cls storage and access it from registered procs etc. In the case where you want to handle connection accept/parse/reponse processing in the same thread, nothing needs to be added. You can do that today with Ns_SockCallback (or by placing all your code in an Ns_ParseProc and returning the response from there) Can you be more specific about the overhead of using an Ns_ParseProc? Exactly what memory is allocated, what code is run that should not..? What specifically can you not do with the Ns_ParseProc interface that you need the Ns_Driver* routines for? I'm looking for concrete examples. As far as I can tell, with Ns_ParseProc you write less code, get more options, and it takes advantage of infrastructure to give you more speed. I must be missing something, but you'll have to explain it to me in more detail because I don't get it. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 20:43 Message: Logged In: YES user_id=184124 Okay, the biggest problem with your way i see that i am enforced to go through http driver, even with my parse proc, i need to know how it works to implement my driver so correct hooks/filters will be called. If i want skip some parts i am not able to do it, http driver works only one way. Another issue is if something will not fit into current driver, additional hook needs to be introduced and core driver needs to be modified again. If my driver fits http-like/text mode paradigm, reusing http driver is the easiest way, but if i need something specific, all extra step to mimic the connection as http request, so all other parts of the http driver will not fail is just unnecesssary extra efforts. And i you mentioned, using Ns_DriverSockQueue is low level function and requires from the developer full attention for bulding the driver, but if this is what i want, why not. I can spawn my own thread if some callbacks are long running Tcl scripts and queue connection from my own loop. If i omly want to received packets, decode them and submit connection, i do not need all http driver infrusturcture, why to enforce using it? So we can have at least 3 ways for supporting multiprotocols: - standard callbacks, completely different threads, no connection pooling (Exists now) - Ns_DriverSockQueue, new thread or callback thread, reusing connection pooling. All filters/traces are reused as well - driver Parse proc in the http driver to reuse drivers thread and connection pooling with all filters/traces All 3 methiods can co-exists and do not interfere with each other, that's my point, and all they add just couple extra functions. I would implement all methods, i have 3 drivers i need to run: smtp, dns, snmp, can add imap in the future ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 20:31 Message: Logged In: YES user_id=87254 "Each way has its own drawbacks..." That's what I'm asking. What are the drawbacks for each approach we've come up with so far? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 15:23 Message: Logged In: YES user_id=184124 I am not arguing with you about your ParseProc driver extension, it is very usefull and makes driver more flexible. I just want to add couple of new API functions that will allow developer to queue connections from any place, that's it. How drivers will be written and how developer will decide to handle it is up to each particular developer. But nobody will be locked up in only one way of doing it. Each way has its own drawbacks so we have multiple choices and developer will decide for itself how it should be. Both our ways do not mutually exclusive. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 08:28 Message: Logged In: YES user_id=87254 Ah I see you're right, an extra thread is not created for each incoming request. 'udpThread' is perhaps not the best name for the socket callback though... :-) I still don't see the advantage of using Ns_SockCalback. A single thread is created by the server to handle all registered callbacks, including those from ns_sockcallback. At runtime, while this single thread is running tcl code to handle one callback, your dirver callback cannot run, no new connections will be accepted, etc. Why is it better to use the Ns_SockCallback thread rather than a driver thread? Maybe I'm reading this wrong, but how do you handle the case where the request arrives as more than one packet? Ns_DriverSockRead() is called from the 'udpThread' socket callback. The only return value checked is NS_OK, but couldn't this also be SOCK_MORE? How would you handle things like keepalive? I think you'd have to reimplement that in the Ns_SockCallback thread. Re the proxy stuff, Ns_RegisterRequest() and Ns_RegisterProxyRequest() seem very simillar. With Ns_RegisterRequest(), filters are run and you get the choice of using C or Tcl. Ns_RegisterProxyRequest() offers no advantage that I can see -- you still need a complete Request structure, even if you just ignore it. The comm driver initialization should probably be changed to automatically handle unix domain sockets. You add /foo rather that 127.0.0.1 in the config file and it knows to create the correct type of socket. nssock and nsopenssl wouldn't have to be modified at all. UDP is different. There are two types of protocols: single packet, such as DNS or RADIUS; multi packet, as used in some streaming media and p2p protocols. I think for the single packet case we again might want to modify the driver code to automatically handle it. No read-ahead is necessary, there's only one packet per request, so it's placed in the request buffer and passed on to the next stage, which is parsing. Here, a return code of SOCK_MORE would be illegal. Every multi-packet UDP protocol will require custom framing/sequencing and the developer will have to create a new socket driver. Taking RADIUS as an example, which is a single packet UDP protocol, you'd create a very simple Ns_ParseProc who's only job is to check that the number of bytes specified in the header actually arrived, and return SOCK_READY. A default request structure is created for you so the only other thing you have to do is Ns_RegisterRequest() for the '/' URL. Within your request proc, call Ns_ConnContent() and parse the buffer. Now, you do have a number of other options to make this more flexible. You could parse the request in your Ns_ParseProc and then fill out the request structure. e.g. the different RADIUS message types could be expressed as HTTP verbs. This buys you flexibility. Now you can Ns_RegisterRequest() a different routine for each RADIUS message type, and someone reusing your code can override your default implementation. You can also handle some message types in C, and others in Tcl. You might decide to put some useful information about the RADIUS request in the URL line. Now you get logging for free. You might decide to parse the key/value pairs from the RADIUS request into query vars or headers. Now you don't have to write a bunch of RADIUS specific Tcl commands to access the data, should you want to handle that from Tcl. ns_queryget or ns_conn headers will work. How far you want to go is up to you, the writer of the protocol module. But at the low end all you need is an Ns_ParseProc and usually a single registered request proc, which is a lot less code to write than the Ns_Driver* stuff, I think. I'm sure it's not perfect! So what's wrong with it? Why would it suck to write a RADIUS protocol module as I've just described, to take one example? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 05:51 Message: Logged In: YES user_id=184124 I think we need to collect all solutions and then see where are going, i am holding to port all my old/running modules because i do not know how naviserver will handle foreign protocols. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 05:48 Message: Logged In: YES user_id=184124 yes, using proxy can solve immediate requirements without hacking NsConnProc by adding hooks to call driver specific C functions. If i need my smtp server and main loop is in C, i need somehow call it in the connection thread. Using registered proxy function i can do it now, i do not need filter/traces. This is for completely new modules. I can implement main loop in the module as Tcl command and then call it in the connection filter, it is possible, it will just require many different parts to be in place and still filter should be registered as Tcl proc which will call another driver main loop. sometimes low level stuff makes things easier and simpler:-))) ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 05:45 Message: Logged In: YES user_id=184124 In all my installations i need sha module but it wasn't in the distribution, so i need to download it or repackage aolserver to include nssha1. That is my point, it is just one simple function use more often than something like ns_jpegsize or so. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 05:42 Message: Logged In: YES user_id=87254 Well I don't know about the wisdom of adding sha1 to the core at this stage :-) I see your point though, encryption and hashing functions are almost universally required for systems/server work. Maybe we need to consider adding a new encryption module to the core distribution. Like nsdb it would export a C API via libnscypher.so (or whatever) as well as the Tcl module nscypher.so. Times have changed and things like the openssl libraries are common on all platforms so it's not the big deal it used to be to add such dependiencies. Such a module should make implementing SSL in nsopenssl easier. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-25 05:41 Message: Logged In: YES user_id=184124 No, i do not spawn new thread, i use callback feature of the server, when socket is ready, server calls provided callback ad that callback just submits the socket to connection pool. if pool is full, Ns_DriverSockQueue will return NS_TIMEOUT, you can retry. Yes, it is low-level, for high level, HTTP driver provides a lot of functionality, it could be extended like you did, but still it is HTTP driver hacked. If i want completely new driver, like RADIUS server, http driver will not help me, i need low level stuff, and it is there already. To reuse resource limiting, i added Ns_DriverSockQueue function, so new conections can be queue instead of creating new threads. I do not have anything against your patch for extending current driver, it is very usefull. i am offering new API for low level drivers. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 05:36 Message: Logged In: YES user_id=87254 The proxy stuff is too late in the cycle to do much. The request has to be fully parsed by then (for read-ahead). If a proxy function is available, then all filters, the auth phase, registered procs, cleanup procs etc. are bypassed. A lot of that stuff can be very useful for non-HTTP protocols. I don't think handling stuff via a proxy function buys you much. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-02-25 05:32 Message: Logged In: YES user_id=87254 I don't understand what you're trying to acheive here (well, apart from multi-protocol... :-). The newly exposed Ns_Driver* entry points are quite low level, and so the implementor of the new protocol is left to do a lot of the heavy lifting. For example, the way I read it you have to create your own listen socket and register a callback. Every time a new reaquest comes in a thread is spawned to handle it. From that thread you then submit the parsed request to one of the conn threads. Excessive thread creation and message passing between threads is not going to perform well. And it seems you have to write more code than e.g. the example POP3 driver I posted some time ago. You're also not taking advantage of the other facilities that the server offers. What happens if 1000 connections arrive, do you spawn 1000 threads? You could of course code up some limit checks, but this already exists. What if a client sends you a continuous stream of data, 2GB... etc. By using the driver hooks to provide the new protocol parser, you deny yourself the opportunity to use something like the nsopenssl module. This should work just fine for protocols like SMTP, IMAP, POP3 and probably others. Anyway, I think one of the most carefully coded aspects of the server is it's attention to resource usage. That goes for IO, context switching, memory, etc. It's espescialy nice that most of the time you're not even aware that all this work is being done for you. I'd like new protocol drivers to be able to transparently take advantage of that. Could you take a look at my old POP3 demo driver? It's the attachment nspopd-0.3.tar.bz2 over here: http://sourceforge.net/tracker/index.php?func=detail&aid=973010&group_id=3152&atid=353152 It's not obvious that anything interesting is going on, so it's not much to look at. But actually, conn socket read-ahead is happening eficiently in one thread with async IO, the conn threads are treated as a precious resource (heavy-weight Tcl interps) and are allocated at the last minute, there's an easy API in C and Tcl to implement the actual reading of data from the INBOX (could be from the file system, db etc.). You've got a lot of experience writing servers, what do you think is wrong with this model? What can it not do, or what could it do better? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-02-24 21:29 Message: Logged In: YES user_id=184124 Another thing, once we can submit connections from any place, no need to build any drivers, even in C, i can register new proxy proc and set protocol field in my request, so when submitted, connection will run registered proxy proc. for example: in my smtp driver/module, i create driver, register proxy for smtp: protocol, register callback for the socket. Once connection accepted, in my module i submit that connection to the queue with request-protocl set to smtp:. queue.c will call my proxy handler, which is C function. No need to add anything else. This way even standard aolserver can be extended without touching precious http driver thread. Sorry for sarcasm. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1151137&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-21 20:33:09
|
Bugs item #1187635, was opened at 2005-04-21 22:25 Message generated for change (Comment added) made by vasiljevic You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719006&aid=1187635&group_id=130646 Category: C-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: timegm() usage not mt-safe Initial Comment: In httptime.c timegm() is used w/o protective locks. This call is not thread safe. Definitely not on Darwin. ---------------------------------------------------------------------- >Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-21 22:33 Message: Logged In: YES user_id=95086 Fixed in HEAD. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719006&aid=1187635&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-21 20:25:29
|
Bugs item #1187635, was opened at 2005-04-21 22:25 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719006&aid=1187635&group_id=130646 Category: C-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: timegm() usage not mt-safe Initial Comment: In httptime.c timegm() is used w/o protective locks. This call is not thread safe. Definitely not on Darwin. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719006&aid=1187635&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-18 19:41:54
|
Feature Requests item #1156107, was opened at 2005-03-03 20:04 Message generated for change (Comment added) made by vasiljevic You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1156107&group_id=130646 Category: Tcl-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Scrap optional connid parameter from Tcl API Initial Comment: Some Tcl-API commands still accept optional connection-id parameter which is left as the compatibility trace from older 2.x nsd servers. This complicates argument processing and serves no other obvious purpose. The idea is to scrap this optional connid parsing from the Tcl-API calls making them simpler to document and implement. I never used any code running for the 2.x servers hence for me it is OK to remove those. Any thoughts on that? ---------------------------------------------------------------------- >Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-18 21:41 Message: Logged In: YES user_id=95086 Nothing that o know of. I think we can close this one. If I encounter one of those along the road I will scrap it out. I will leave this open as a reminder, though. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-18 15:06 Message: Logged In: YES user_id=87254 I removed connid suuport from conn.c and tclresp.c. Is there anything left? ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-03-08 19:34 Message: Logged In: YES user_id=95086 I will do this on as-encountered basis. If others are about to rewrite some command that still parses this ugly argument, I suggest to remove it entirely. Furthermore, we should gradually start to use Stephens new tclobjv arg parsing. Stephen, you mind checkin in some example command rewrite so we can all see and use this as a guidance while rewriting or implementing new parsers? ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-03-04 09:38 Message: Logged In: YES user_id=95086 ns_conn ns_register_filter ns_return (some of them) They all accept a weird syntax: <proc> ?connid? args which is PITA to parse and maintain. Yet, it is not used any more... It is only there to be able to run 2.x server-side Tcl code ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-03 23:08 Message: Logged In: YES user_id=184124 Which commands are you talking about? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1156107&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-18 13:17:54
|
Feature Requests item #1184271, was opened at 2005-04-16 16:03 Message generated for change (Comment added) made by vasiljevic You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 Category: Tcl-API Group: None >Status: Closed >Resolution: Rejected Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Add "ns_conn flush" Initial Comment: This should internally invoke Ns_ConnFlushHeaders effectively spitting out the headers and any content not sent already. The call can be executed at any time, but the headers are sent only once. The call should return the integer equivalent of NS_OK or NS_ERROR to be compatible with ns_return calls. Implementation is trivial and I will check this in. If there are serious complaints, I will revert the changes. ---------------------------------------------------------------------- >Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-18 15:17 Message: Logged In: YES user_id=95086 No need. The "ns_headers" command does the right thing already. How did I miss that?? ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-18 15:16 Message: Logged In: YES user_id=95086 ????????? When/who added THAT? And how the heck I did not see this before???? lexxsrv:nscp 2> ns_headers wrong # args: should be "ns_headers connid status ?type len?" Hrmpffff... ok, the "connid" should be removed but that is another story... ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-18 15:07 Message: Logged In: YES user_id=87254 No need, it's been there all the time... :-) ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-18 11:33 Message: Logged In: YES user_id=95086 Yeah. Basically, the ns_headers status ?type len? type of thing is what I have already implemented in our custom code. If there is no objection to this type of command, I can add it by copying our working code. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-17 22:42 Message: Logged In: YES user_id=87254 Ns_ConnSend() (which is called by Ns_ConnWrite() <- Ns_WriteConn()) does mention that it sends any queued write-behind data, but as far as I can tell this buffer exclusivley contains the response headers. Therefore, flushheaders would be a more accurate description than flush alone. Anyhow, I think what you're looking for is: ns_headers status ?type len? Which basically calls Ns_ConnSetRequiredHeaders(), Ns_ConnFlushHeaders(), which is exactly what you want. I don't know why we didn't see this earlier... :-) (Actually, I think this means conn.c and tclresp.c could do with some improvement) ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-17 10:01 Message: Logged In: YES user_id=95086 You are right. I am still looking for the way to compose correct set of headers and push them to remote peer w/o sending the content and closing the connection socket. The application for this is: you get the request, set up response headers, send them over, use "ns_conn channel" to get the channel and then use this channel to communicate with the remote. This is kindof poor-man´s custom protocol implementation. Basically I also needed an equivalent of Ns_ConnSetRequiredHeaders but I did not succeed to put this somewhere logically. Therefore I skipped that and now I do something like: set oh [ns_conn outpoutheaders] ns_set put $oh Content-Length" xxxx ns_set put $oh Content-Type yyyy ns_conn status 200 ns_conn flush There are other required headers (time, server etc) but this I just ignore for now. There should also be a way to get those in the set returned by the [ns_conn outputheaders]. That would be actually a good idea, instead of returning the empty set. Right? Now, concerning the Ns_ConnFlushContent... I`ve greped thru the code but this call is not used anywhere, It reads: * Finish reading waiting content. which leads me to believe that this is used to discard the non-processed content received from the remote (the opposite direction). This one could be the mechanism for "ns_conn discardcontent" but as you told us before, this is not realy needed in 4.x series servers. Hence I removed our private implementation and rely on the fact that the server already consumed all data from the socket being sent by the remote. So I did not consider using that call and opening it on the Tcl API level. The *very* reason I named this command "ns_conn flush" instead of "ns_conn flushheaders" was because it does soething like: Ns_WriteConn(conn, NULL, 0); which will send *any* queued data (including headers). Does all of that make sense? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-17 00:33 Message: Logged In: YES user_id=87254 When I first read the subject line I thought you were refering to this: http://sourceforge.net/mailarchive/forum.php?thread_id=6736550&forum_id=43966 Turns out that there's a Ns_ConnFlushContent() function. I think this needs to be called something like [ns_conn flushheaders], to avoid confusion. Not that there's much we can do about it, but even with that change it could still be a little bit confusing: FlushHeaders flushes output to the conn, FlushContent drops input from the conn... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-18 13:16:43
|
Feature Requests item #1184271, was opened at 2005-04-16 16:03 Message generated for change (Comment added) made by vasiljevic You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 Category: Tcl-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Add "ns_conn flush" Initial Comment: This should internally invoke Ns_ConnFlushHeaders effectively spitting out the headers and any content not sent already. The call can be executed at any time, but the headers are sent only once. The call should return the integer equivalent of NS_OK or NS_ERROR to be compatible with ns_return calls. Implementation is trivial and I will check this in. If there are serious complaints, I will revert the changes. ---------------------------------------------------------------------- >Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-18 15:16 Message: Logged In: YES user_id=95086 ????????? When/who added THAT? And how the heck I did not see this before???? lexxsrv:nscp 2> ns_headers wrong # args: should be "ns_headers connid status ?type len?" Hrmpffff... ok, the "connid" should be removed but that is another story... ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-18 15:07 Message: Logged In: YES user_id=87254 No need, it's been there all the time... :-) ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-18 11:33 Message: Logged In: YES user_id=95086 Yeah. Basically, the ns_headers status ?type len? type of thing is what I have already implemented in our custom code. If there is no objection to this type of command, I can add it by copying our working code. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-17 22:42 Message: Logged In: YES user_id=87254 Ns_ConnSend() (which is called by Ns_ConnWrite() <- Ns_WriteConn()) does mention that it sends any queued write-behind data, but as far as I can tell this buffer exclusivley contains the response headers. Therefore, flushheaders would be a more accurate description than flush alone. Anyhow, I think what you're looking for is: ns_headers status ?type len? Which basically calls Ns_ConnSetRequiredHeaders(), Ns_ConnFlushHeaders(), which is exactly what you want. I don't know why we didn't see this earlier... :-) (Actually, I think this means conn.c and tclresp.c could do with some improvement) ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-17 10:01 Message: Logged In: YES user_id=95086 You are right. I am still looking for the way to compose correct set of headers and push them to remote peer w/o sending the content and closing the connection socket. The application for this is: you get the request, set up response headers, send them over, use "ns_conn channel" to get the channel and then use this channel to communicate with the remote. This is kindof poor-man´s custom protocol implementation. Basically I also needed an equivalent of Ns_ConnSetRequiredHeaders but I did not succeed to put this somewhere logically. Therefore I skipped that and now I do something like: set oh [ns_conn outpoutheaders] ns_set put $oh Content-Length" xxxx ns_set put $oh Content-Type yyyy ns_conn status 200 ns_conn flush There are other required headers (time, server etc) but this I just ignore for now. There should also be a way to get those in the set returned by the [ns_conn outputheaders]. That would be actually a good idea, instead of returning the empty set. Right? Now, concerning the Ns_ConnFlushContent... I`ve greped thru the code but this call is not used anywhere, It reads: * Finish reading waiting content. which leads me to believe that this is used to discard the non-processed content received from the remote (the opposite direction). This one could be the mechanism for "ns_conn discardcontent" but as you told us before, this is not realy needed in 4.x series servers. Hence I removed our private implementation and rely on the fact that the server already consumed all data from the socket being sent by the remote. So I did not consider using that call and opening it on the Tcl API level. The *very* reason I named this command "ns_conn flush" instead of "ns_conn flushheaders" was because it does soething like: Ns_WriteConn(conn, NULL, 0); which will send *any* queued data (including headers). Does all of that make sense? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-17 00:33 Message: Logged In: YES user_id=87254 When I first read the subject line I thought you were refering to this: http://sourceforge.net/mailarchive/forum.php?thread_id=6736550&forum_id=43966 Turns out that there's a Ns_ConnFlushContent() function. I think this needs to be called something like [ns_conn flushheaders], to avoid confusion. Not that there's much we can do about it, but even with that change it could still be a little bit confusing: FlushHeaders flushes output to the conn, FlushContent drops input from the conn... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-18 13:07:39
|
Feature Requests item #1184271, was opened at 2005-04-16 08:03 Message generated for change (Comment added) made by sdeasey You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 Category: Tcl-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Add "ns_conn flush" Initial Comment: This should internally invoke Ns_ConnFlushHeaders effectively spitting out the headers and any content not sent already. The call can be executed at any time, but the headers are sent only once. The call should return the integer equivalent of NS_OK or NS_ERROR to be compatible with ns_return calls. Implementation is trivial and I will check this in. If there are serious complaints, I will revert the changes. ---------------------------------------------------------------------- >Comment By: Stephen Deasey (sdeasey) Date: 2005-04-18 07:07 Message: Logged In: YES user_id=87254 No need, it's been there all the time... :-) ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-18 03:33 Message: Logged In: YES user_id=95086 Yeah. Basically, the ns_headers status ?type len? type of thing is what I have already implemented in our custom code. If there is no objection to this type of command, I can add it by copying our working code. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-17 14:42 Message: Logged In: YES user_id=87254 Ns_ConnSend() (which is called by Ns_ConnWrite() <- Ns_WriteConn()) does mention that it sends any queued write-behind data, but as far as I can tell this buffer exclusivley contains the response headers. Therefore, flushheaders would be a more accurate description than flush alone. Anyhow, I think what you're looking for is: ns_headers status ?type len? Which basically calls Ns_ConnSetRequiredHeaders(), Ns_ConnFlushHeaders(), which is exactly what you want. I don't know why we didn't see this earlier... :-) (Actually, I think this means conn.c and tclresp.c could do with some improvement) ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-17 02:01 Message: Logged In: YES user_id=95086 You are right. I am still looking for the way to compose correct set of headers and push them to remote peer w/o sending the content and closing the connection socket. The application for this is: you get the request, set up response headers, send them over, use "ns_conn channel" to get the channel and then use this channel to communicate with the remote. This is kindof poor-man´s custom protocol implementation. Basically I also needed an equivalent of Ns_ConnSetRequiredHeaders but I did not succeed to put this somewhere logically. Therefore I skipped that and now I do something like: set oh [ns_conn outpoutheaders] ns_set put $oh Content-Length" xxxx ns_set put $oh Content-Type yyyy ns_conn status 200 ns_conn flush There are other required headers (time, server etc) but this I just ignore for now. There should also be a way to get those in the set returned by the [ns_conn outputheaders]. That would be actually a good idea, instead of returning the empty set. Right? Now, concerning the Ns_ConnFlushContent... I`ve greped thru the code but this call is not used anywhere, It reads: * Finish reading waiting content. which leads me to believe that this is used to discard the non-processed content received from the remote (the opposite direction). This one could be the mechanism for "ns_conn discardcontent" but as you told us before, this is not realy needed in 4.x series servers. Hence I removed our private implementation and rely on the fact that the server already consumed all data from the socket being sent by the remote. So I did not consider using that call and opening it on the Tcl API level. The *very* reason I named this command "ns_conn flush" instead of "ns_conn flushheaders" was because it does soething like: Ns_WriteConn(conn, NULL, 0); which will send *any* queued data (including headers). Does all of that make sense? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-16 16:33 Message: Logged In: YES user_id=87254 When I first read the subject line I thought you were refering to this: http://sourceforge.net/mailarchive/forum.php?thread_id=6736550&forum_id=43966 Turns out that there's a Ns_ConnFlushContent() function. I think this needs to be called something like [ns_conn flushheaders], to avoid confusion. Not that there's much we can do about it, but even with that change it could still be a little bit confusing: FlushHeaders flushes output to the conn, FlushContent drops input from the conn... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-18 13:06:56
|
Feature Requests item #1156107, was opened at 2005-03-03 12:04 Message generated for change (Comment added) made by sdeasey You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1156107&group_id=130646 Category: Tcl-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Scrap optional connid parameter from Tcl API Initial Comment: Some Tcl-API commands still accept optional connection-id parameter which is left as the compatibility trace from older 2.x nsd servers. This complicates argument processing and serves no other obvious purpose. The idea is to scrap this optional connid parsing from the Tcl-API calls making them simpler to document and implement. I never used any code running for the 2.x servers hence for me it is OK to remove those. Any thoughts on that? ---------------------------------------------------------------------- >Comment By: Stephen Deasey (sdeasey) Date: 2005-04-18 07:06 Message: Logged In: YES user_id=87254 I removed connid suuport from conn.c and tclresp.c. Is there anything left? ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-03-08 11:34 Message: Logged In: YES user_id=95086 I will do this on as-encountered basis. If others are about to rewrite some command that still parses this ugly argument, I suggest to remove it entirely. Furthermore, we should gradually start to use Stephens new tclobjv arg parsing. Stephen, you mind checkin in some example command rewrite so we can all see and use this as a guidance while rewriting or implementing new parsers? ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-03-04 01:38 Message: Logged In: YES user_id=95086 ns_conn ns_register_filter ns_return (some of them) They all accept a weird syntax: <proc> ?connid? args which is PITA to parse and maintain. Yet, it is not used any more... It is only there to be able to run 2.x server-side Tcl code ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-03 15:08 Message: Logged In: YES user_id=184124 Which commands are you talking about? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1156107&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-18 09:33:13
|
Feature Requests item #1184271, was opened at 2005-04-16 16:03 Message generated for change (Comment added) made by vasiljevic You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 Category: Tcl-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Add "ns_conn flush" Initial Comment: This should internally invoke Ns_ConnFlushHeaders effectively spitting out the headers and any content not sent already. The call can be executed at any time, but the headers are sent only once. The call should return the integer equivalent of NS_OK or NS_ERROR to be compatible with ns_return calls. Implementation is trivial and I will check this in. If there are serious complaints, I will revert the changes. ---------------------------------------------------------------------- >Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-18 11:33 Message: Logged In: YES user_id=95086 Yeah. Basically, the ns_headers status ?type len? type of thing is what I have already implemented in our custom code. If there is no objection to this type of command, I can add it by copying our working code. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-17 22:42 Message: Logged In: YES user_id=87254 Ns_ConnSend() (which is called by Ns_ConnWrite() <- Ns_WriteConn()) does mention that it sends any queued write-behind data, but as far as I can tell this buffer exclusivley contains the response headers. Therefore, flushheaders would be a more accurate description than flush alone. Anyhow, I think what you're looking for is: ns_headers status ?type len? Which basically calls Ns_ConnSetRequiredHeaders(), Ns_ConnFlushHeaders(), which is exactly what you want. I don't know why we didn't see this earlier... :-) (Actually, I think this means conn.c and tclresp.c could do with some improvement) ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-17 10:01 Message: Logged In: YES user_id=95086 You are right. I am still looking for the way to compose correct set of headers and push them to remote peer w/o sending the content and closing the connection socket. The application for this is: you get the request, set up response headers, send them over, use "ns_conn channel" to get the channel and then use this channel to communicate with the remote. This is kindof poor-man´s custom protocol implementation. Basically I also needed an equivalent of Ns_ConnSetRequiredHeaders but I did not succeed to put this somewhere logically. Therefore I skipped that and now I do something like: set oh [ns_conn outpoutheaders] ns_set put $oh Content-Length" xxxx ns_set put $oh Content-Type yyyy ns_conn status 200 ns_conn flush There are other required headers (time, server etc) but this I just ignore for now. There should also be a way to get those in the set returned by the [ns_conn outputheaders]. That would be actually a good idea, instead of returning the empty set. Right? Now, concerning the Ns_ConnFlushContent... I`ve greped thru the code but this call is not used anywhere, It reads: * Finish reading waiting content. which leads me to believe that this is used to discard the non-processed content received from the remote (the opposite direction). This one could be the mechanism for "ns_conn discardcontent" but as you told us before, this is not realy needed in 4.x series servers. Hence I removed our private implementation and rely on the fact that the server already consumed all data from the socket being sent by the remote. So I did not consider using that call and opening it on the Tcl API level. The *very* reason I named this command "ns_conn flush" instead of "ns_conn flushheaders" was because it does soething like: Ns_WriteConn(conn, NULL, 0); which will send *any* queued data (including headers). Does all of that make sense? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-17 00:33 Message: Logged In: YES user_id=87254 When I first read the subject line I thought you were refering to this: http://sourceforge.net/mailarchive/forum.php?thread_id=6736550&forum_id=43966 Turns out that there's a Ns_ConnFlushContent() function. I think this needs to be called something like [ns_conn flushheaders], to avoid confusion. Not that there's much we can do about it, but even with that change it could still be a little bit confusing: FlushHeaders flushes output to the conn, FlushContent drops input from the conn... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-17 20:42:10
|
Feature Requests item #1184271, was opened at 2005-04-16 08:03 Message generated for change (Comment added) made by sdeasey You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 Category: Tcl-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Add "ns_conn flush" Initial Comment: This should internally invoke Ns_ConnFlushHeaders effectively spitting out the headers and any content not sent already. The call can be executed at any time, but the headers are sent only once. The call should return the integer equivalent of NS_OK or NS_ERROR to be compatible with ns_return calls. Implementation is trivial and I will check this in. If there are serious complaints, I will revert the changes. ---------------------------------------------------------------------- >Comment By: Stephen Deasey (sdeasey) Date: 2005-04-17 14:42 Message: Logged In: YES user_id=87254 Ns_ConnSend() (which is called by Ns_ConnWrite() <- Ns_WriteConn()) does mention that it sends any queued write-behind data, but as far as I can tell this buffer exclusivley contains the response headers. Therefore, flushheaders would be a more accurate description than flush alone. Anyhow, I think what you're looking for is: ns_headers status ?type len? Which basically calls Ns_ConnSetRequiredHeaders(), Ns_ConnFlushHeaders(), which is exactly what you want. I don't know why we didn't see this earlier... :-) (Actually, I think this means conn.c and tclresp.c could do with some improvement) ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-17 02:01 Message: Logged In: YES user_id=95086 You are right. I am still looking for the way to compose correct set of headers and push them to remote peer w/o sending the content and closing the connection socket. The application for this is: you get the request, set up response headers, send them over, use "ns_conn channel" to get the channel and then use this channel to communicate with the remote. This is kindof poor-man´s custom protocol implementation. Basically I also needed an equivalent of Ns_ConnSetRequiredHeaders but I did not succeed to put this somewhere logically. Therefore I skipped that and now I do something like: set oh [ns_conn outpoutheaders] ns_set put $oh Content-Length" xxxx ns_set put $oh Content-Type yyyy ns_conn status 200 ns_conn flush There are other required headers (time, server etc) but this I just ignore for now. There should also be a way to get those in the set returned by the [ns_conn outputheaders]. That would be actually a good idea, instead of returning the empty set. Right? Now, concerning the Ns_ConnFlushContent... I`ve greped thru the code but this call is not used anywhere, It reads: * Finish reading waiting content. which leads me to believe that this is used to discard the non-processed content received from the remote (the opposite direction). This one could be the mechanism for "ns_conn discardcontent" but as you told us before, this is not realy needed in 4.x series servers. Hence I removed our private implementation and rely on the fact that the server already consumed all data from the socket being sent by the remote. So I did not consider using that call and opening it on the Tcl API level. The *very* reason I named this command "ns_conn flush" instead of "ns_conn flushheaders" was because it does soething like: Ns_WriteConn(conn, NULL, 0); which will send *any* queued data (including headers). Does all of that make sense? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-16 16:33 Message: Logged In: YES user_id=87254 When I first read the subject line I thought you were refering to this: http://sourceforge.net/mailarchive/forum.php?thread_id=6736550&forum_id=43966 Turns out that there's a Ns_ConnFlushContent() function. I think this needs to be called something like [ns_conn flushheaders], to avoid confusion. Not that there's much we can do about it, but even with that change it could still be a little bit confusing: FlushHeaders flushes output to the conn, FlushContent drops input from the conn... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-17 08:01:53
|
Feature Requests item #1184271, was opened at 2005-04-16 16:03 Message generated for change (Comment added) made by vasiljevic You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 Category: Tcl-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Add "ns_conn flush" Initial Comment: This should internally invoke Ns_ConnFlushHeaders effectively spitting out the headers and any content not sent already. The call can be executed at any time, but the headers are sent only once. The call should return the integer equivalent of NS_OK or NS_ERROR to be compatible with ns_return calls. Implementation is trivial and I will check this in. If there are serious complaints, I will revert the changes. ---------------------------------------------------------------------- >Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-17 10:01 Message: Logged In: YES user_id=95086 You are right. I am still looking for the way to compose correct set of headers and push them to remote peer w/o sending the content and closing the connection socket. The application for this is: you get the request, set up response headers, send them over, use "ns_conn channel" to get the channel and then use this channel to communicate with the remote. This is kindof poor-man´s custom protocol implementation. Basically I also needed an equivalent of Ns_ConnSetRequiredHeaders but I did not succeed to put this somewhere logically. Therefore I skipped that and now I do something like: set oh [ns_conn outpoutheaders] ns_set put $oh Content-Length" xxxx ns_set put $oh Content-Type yyyy ns_conn status 200 ns_conn flush There are other required headers (time, server etc) but this I just ignore for now. There should also be a way to get those in the set returned by the [ns_conn outputheaders]. That would be actually a good idea, instead of returning the empty set. Right? Now, concerning the Ns_ConnFlushContent... I`ve greped thru the code but this call is not used anywhere, It reads: * Finish reading waiting content. which leads me to believe that this is used to discard the non-processed content received from the remote (the opposite direction). This one could be the mechanism for "ns_conn discardcontent" but as you told us before, this is not realy needed in 4.x series servers. Hence I removed our private implementation and rely on the fact that the server already consumed all data from the socket being sent by the remote. So I did not consider using that call and opening it on the Tcl API level. The *very* reason I named this command "ns_conn flush" instead of "ns_conn flushheaders" was because it does soething like: Ns_WriteConn(conn, NULL, 0); which will send *any* queued data (including headers). Does all of that make sense? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-17 00:33 Message: Logged In: YES user_id=87254 When I first read the subject line I thought you were refering to this: http://sourceforge.net/mailarchive/forum.php?thread_id=6736550&forum_id=43966 Turns out that there's a Ns_ConnFlushContent() function. I think this needs to be called something like [ns_conn flushheaders], to avoid confusion. Not that there's much we can do about it, but even with that change it could still be a little bit confusing: FlushHeaders flushes output to the conn, FlushContent drops input from the conn... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-16 22:33:27
|
Feature Requests item #1184271, was opened at 2005-04-16 08:03 Message generated for change (Comment added) made by sdeasey You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 Category: Tcl-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Add "ns_conn flush" Initial Comment: This should internally invoke Ns_ConnFlushHeaders effectively spitting out the headers and any content not sent already. The call can be executed at any time, but the headers are sent only once. The call should return the integer equivalent of NS_OK or NS_ERROR to be compatible with ns_return calls. Implementation is trivial and I will check this in. If there are serious complaints, I will revert the changes. ---------------------------------------------------------------------- >Comment By: Stephen Deasey (sdeasey) Date: 2005-04-16 16:33 Message: Logged In: YES user_id=87254 When I first read the subject line I thought you were refering to this: http://sourceforge.net/mailarchive/forum.php?thread_id=6736550&forum_id=43966 Turns out that there's a Ns_ConnFlushContent() function. I think this needs to be called something like [ns_conn flushheaders], to avoid confusion. Not that there's much we can do about it, but even with that change it could still be a little bit confusing: FlushHeaders flushes output to the conn, FlushContent drops input from the conn... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-16 14:03:58
|
Feature Requests item #1184271, was opened at 2005-04-16 16:03 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 Category: Tcl-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Zoran Vasiljevic (vasiljevic) Assigned to: Zoran Vasiljevic (vasiljevic) Summary: Add "ns_conn flush" Initial Comment: This should internally invoke Ns_ConnFlushHeaders effectively spitting out the headers and any content not sent already. The call can be executed at any time, but the headers are sent only once. The call should return the integer equivalent of NS_OK or NS_ERROR to be compatible with ns_return calls. Implementation is trivial and I will check this in. If there are serious complaints, I will revert the changes. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1184271&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-12 06:46:47
|
Feature Requests item #1159471, was opened at 2005-03-08 17:40 Message generated for change (Comment added) made by sdeasey You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1159471&group_id=130646 Category: C-API Group: None >Status: Closed >Resolution: Accepted Priority: 5 Submitted By: Vlad Seryakov (seryakov) Assigned to: Vlad Seryakov (seryakov) Summary: Virtual Hosting Initial Comment: Okay, i did some digging and testing, looks working and much simpler. I tried to simplify default AS 4.x virtual hosting and added pageroot virtual hosting, simple way to use different pagetroots on the same server. The change vor default virtual hosting is: no defaultserver anymore, the server who registered virtual hosts is default server, so nssock is loaded in the default server, other than that virtual servers are defined the same way. One thing i left is to chamge ns_info pageroot to use Ns_GetConn() and then if exists use connPtr->pageroot, but this is simple change if you approve current virtual hosting patch. Here is the nsd.tcl config example: ns_section "ns/server/${server}/module/nssock/servers" ns_param test vlad.seryakov.com ns_param test vlad.seryakov.com:80 ns_section "ns/server/${server}/module/nssock/pageroots" ns_param ${home}/html/test vlad.seryakov.com ns_param ${home}/html/test vlad.seryakov.com:80 ---------------------------------------------------------------------- >Comment By: Stephen Deasey (sdeasey) Date: 2005-04-12 00:46 Message: Logged In: YES user_id=87254 Ok, this is now in CVS. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-04-03 20:40 Message: Logged In: YES user_id=184124 Patch worked for me ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-03 18:56 Message: Logged In: YES user_id=87254 I found some errors in the previous patch, so here's another one. I wouldn't be so conservative, except an error here would be a big security hole. I've written some tests. I;d appreciate it if you'd take a look and see if this looks alright? If you're happy that this looks reasonable, I'll commit it. I've fixed the hostprefix config that you noted. I also changed Ns_ConnLocationAppend() and Ns_ServerPath()/Ns_PagePath() to always return a valid result. The driver's staticaly configured location is used if a callback fails. I felt it was just too ugly to have to check the return every time. I'm thinking maybe there needs to be some kind of common Ns_HostIsValid() routine... ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-04-01 07:12 Message: Logged In: YES user_id=184124 Can we commit this patch, i need to replace one of my virtual hosting servers and i would give it a try with new patch. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-27 18:59 Message: Logged In: YES user_id=184124 One notice, hostpreix bt default is vhost, not empty, would be better to have it empty. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-27 18:55 Message: Logged In: YES user_id=184124 Yes, this worked for me, if Zoran does not mind, you can commit it. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-27 07:25 Message: Logged In: YES user_id=87254 The new serverdir is for storing files associated with a server (or virtual host) which are not made public via the pagedir. So, things like uploads, auto-generated data, caches etc. This will contain only the pages directory by default, because the server doesn't do anything interesting by default. I've attached a new patch which makes the serverdir and pagedir fully customisable. Here are the possible config settings: ns_section "ns/server/${servername}/fastpath" ns_param serverdir /srv # default: $home/servers/$servername ns_param pagedir pages #ns_param pageroot pages # depreciated ns_section "ns/server/${servername}/vhost" ns_param enabled false ns_param hostprefix vhosts #default "" ns_param hosthashlevel 3 ns_param stripport true ns_param stripwww true I've added path hashing, which hashes the hostname so that they are spread accross multiple directories. e.g. foo.com -> ./f/o/o/pages a.com -> ./a/_/_/pages I've also added a -host switch to the ns_serverpath and ns_pagepath commands so that tool can be written which setup the necessary directories. Does this look ok? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-17 21:26 Message: Logged In: YES user_id=184124 On the other hand if it will be possible to configure/rename "servers/" and "pages/" parts or omit them completely i would be happy with this patch. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-14 07:48 Message: Logged In: YES user_id=184124 The problem i see with this patch, it will break all my AS installations, because it assumes that every servers is under servers/ direcotory and pageroot is awlays named pages/. I my on-server installs i do not have this complex directory structure, i have html/ under ns_info home and pageroot is set in the nsd.tcl. Also, what is the point of ServerRoot dir, we have PageRoot already, if it is set into absolute path other apps use ns_info pageroot? As i understand, under ServerRoot there is only pages difrectory? Why not to use pageroot directly? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-14 07:05 Message: Logged In: YES user_id=87254 Oh, forgot to mention. It depends on the Tcl Callbacks patch. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-14 07:03 Message: Logged In: YES user_id=87254 I've added the patch naviserver-4.0.10-server-root-vhost.patch. It adds the following new routines: Ns_ServerPath() Ns_PagePath() Ns_SetServerRootProc() Ns_ConnLocationAppend() Ns_SetConnLocationProc() NsServerRoot() NsPageRoot() ns_serverpath ?pathSegment ...? ns_pagepath ?pathSegment ...? ns_serverrootproc script ?arg? ns_locationproc script ?arg? And the following new configuration options: ns_section "ns/server/${servername}/vhost" ns_param enabled false ns_param prefix "" ns_param pagedir pages # overides fastpath/pageroot ns_param stripwww true ns_parma stripport true This version of host header based virtual hosting which depends on the existance of the pages directory is a superset of the functionality provided by a static configuration. Applications which call Ns_ConnLocation() will need to be modified to call Ns_ConnLocationAppend() or they will not be vhost aware. I've reinstated the depreciated proc Ns_SetConnLocationProc() and changed it's signature. It dissapeared from ns.h almost 5 years ago, then reappreared ~2.5 years ago. I don't think this will be a problem. In turn, I've depreciated the Ns_SetLocationProc(). It compiles and the server runs. I haven't had time to test it. Does this look acceptable? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-12 17:41 Message: Logged In: YES user_id=184124 Just to consider the possibility, instead of mallocing pageroot/location, by default it can use sockPtr->pageroot/sockPtr->location, then when ns_conn pageroot newpageroot called, it will set connPtr->pageroot with malloced string and ns_conn pageroot will check and return it instead of sockPtr->pageroot. This way, no overhead at conn queue and still new pageroot/location can be set in Tcl ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-12 17:02 Message: Logged In: YES user_id=184124 That is the probem with nssock, it is actually an extender of the driver but still somehow kept independent. nssock itself is useless without driver and only used to bind to more than one address for different servers. it could be moved in the core but the problem will be how to define more than once instance. malloc are overhead indeed, but once copied they can be used independently and canbe set in Tcl by using ns_conn location newLocation or ns_conn pageroot newPageroot. In this case they should be a copies. Just do not make mass virtual hosting the only virtual hosting way, being able to change pageroot in the Tcl/C give developer more flexibility if required. For simple cases, mass virtual hosting is okay. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-12 16:48 Message: Logged In: YES user_id=87254 I'm not keen at all on adding virtual hosting to the nssock driver. There's nothing HTTP specific about the nssock dirver and I'd like to keep it that way. There are a couple of problems with the other proposed solution. The paired functions Ns_SetLocationProc()/Ns_ConnSetLocationProc() etc. seems excessive, and the enforced malloc()ing at runtime of the location and pageroot strings is an unwelcome overhead. Using Tls storage is clever but pretty ugly. I think dstrings are the way to go here. I'm not sure Tls is safe in this implementation. The same dstring is used for location and pageroot strings, so it depends what the caller decides to do with the result and in what order, whether or not one overwrites the other. I would like to explore adding mas virtual hosting into the core. Let me work up a patch, I think I can get to this this weekend... ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-12 14:57 Message: Logged In: YES user_id=184124 Attached is nssock with virtual hosting patch ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-12 13:39 Message: Logged In: YES user_id=184124 Actually, vhost can be combined with nssock, if options given it will enable virtual hosting, if not works as regular sock driver. This way it is always with the core and at the same time independent. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-10 14:38 Message: Logged In: YES user_id=184124 If loaded, vhost module works as Stephan suggested, strips port/host and usesd pageroot if other root is not specified. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-10 14:37 Message: Logged In: YES user_id=184124 There is new patch with Stephans corrections/additions. I think we can provide core module for virtual hosting, i called it nsvhost and we can extend this module to do all sorts of hosting. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-10 11:53 Message: Logged In: YES user_id=184124 And keeping port and www. is sometimes necessary, you can do virtual hosting by port only, IDT does that for example, and many sites work without www. prefix, just stripping them by default may not be appropriate. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-10 11:24 Message: Logged In: YES user_id=184124 >Looks good. However, isn't ns_conn pageroot >unneccessary? For templating engines ns_info pageroot is the only way to figure out the root, UrlToFile works for fastpath only. >Would it be better to have the servers and pageroot config >in one section, to avoid duplication? They are mutually exclusive, that's why i put them in different sections, if full virtual server is set, pageroots are ignored, this is for AOL like virtual hosting with different servers(rare situation though). So in most cases pageroots will be used only, thus only one simple syntax. As for PageRoot and ServerRoot, i think this is a little cofusing. Currently, pageroot returns full path and whoever calls pageroot assumes that it will return full path. Virtual hosting using directories as hostnames is what i am currently using with vhost module and i think it can be included as a standard feature for easy virtualhosting solutions. I do not think this should be the ONLY virtual hosting solution, everybody can write their own modules using SetLocation/SetPageRoot procs or register filter which will set pageroot for each connection. Let me prepare another patch-set with your suggestions included . ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-10 01:00 Message: Logged In: YES user_id=87254 Looks good. However, isn't ns_conn pageroot unneccessary? Would it be better to have the servers and pageroot config in one section, to avoid duplication? ns_section "ns/server/${server}/module/nssock/servers" ns_param example.com exampleserver ns_param foo.example.com "exampleserver ${home}/whatever" Here, the first entry maps the example.com host to the exampleserver and uses it's default pageroot. The second entry supplies a new pageroot. How about mass virtual hosting, i.e. where you don't have to explicitly configure each host header to pageroot mapping, but construct the pageroot from the host heafer at runtime? I've attached the file nsmassvhost.c which implements the above. It uses the hooks Ns_PageRootProc and Ns_LocationProc which would be unneccessary if the functionality was included as standard. It trims the port and any leading 'www.' from the host header. It would be nice to have this for the static mapping also, as at the moment to be robust you often need 4 mappings for each virtual host. It also uses the function Ns_ServerPath(). The idea here is to introduce the concept of the virtual server root as a distinct location in the file system, where the pageroot is a location below that. I want to change this so that the serverroot is dynamic and based on the host header (when configured), and the pageroot is simply the serverroot with "/pages" (or whatever is configured) appended. It would look something like this: /srv/server1/pages /srv/server1/example.com/pages /srv/server1/example.com/cache The first path is the default or non-virtual hosted case. server1 is a server defind in the config file and has it's own private tcl library. The second path is the pageroot of a virtual host. The third is an example of some data which is specific to the example.com virtual host. So, without virtual hosts: Ns_ServerRoot() -> /srv/server1 Ns_PageRoot() -> /srv/server1/pages With virtual hosts (and called in the context of a conn thread): Ns_ServerRoot() -> /srv/server1/example.com Ns_PageRoot() -> /srv/server1/example.com/pages The advantage of this system is that you don't have to restart your server every time you add or remove a virtual host. There is also a convenient location to store data associated with both virtual servers and virtual hosts. Easy to backup, remove, etc. I haven't had time to look at how this would be integrated into what you've got here, maybe at the weekend. Feel free to take a shot at though :-) Does the scheme outlined above make sense to you? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1159471&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-10 00:59:55
|
Feature Requests item #1174311, was opened at 2005-03-31 18:15 Message generated for change (Comment added) made by seryakov You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1174311&group_id=130646 Category: Tcl-API Group: None >Status: Closed Resolution: None Priority: 5 Submitted By: Vlad Seryakov (seryakov) Assigned to: Vlad Seryakov (seryakov) Summary: NaviServer ToolKit Initial Comment: This is light version of templating system, in syntax very similar to OpenACS's templating. Just one small file and several demo pages. For a start this can be enough, but it could be extended to support DB api and other usefull things instead of old modules/tcl/*.tcl files in the standard distribution. ---------------------------------------------------------------------- >Comment By: Vlad Seryakov (seryakov) Date: 2005-04-10 00:59 Message: Logged In: YES user_id=184124 I decided to import and support it, could be useful to other people ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-04-04 00:05 Message: Logged In: YES user_id=184124 I will think about it, i am supporintg my OSSWEB toolkit and forking another one very similar to the primary is just big overhead i cannot commit yet. Having light templating is good but i i see it it will grow eventually to the system i have now. If not one simple file in the core then i will postpone this. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-04-01 14:13 Message: Logged In: YES user_id=184124 Ok, i will build separate module and put it into modules directory, i will maintain it ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-01 02:56 Message: Logged In: YES user_id=87254 This would be great as a standalone module. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1174311&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-04 15:30:01
|
Feature Requests item #1175561, was opened at 2005-04-02 23:34 Message generated for change (Comment added) made by seryakov You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1175561&group_id=130646 Category: C-API Group: None >Status: Closed Resolution: None Priority: 5 Submitted By: Vlad Seryakov (seryakov) Assigned to: Vlad Seryakov (seryakov) Summary: nsmain without getopt Initial Comment: attached is nsmain command parsing without getopt, it is really very simple so getopt can be avoided. ---------------------------------------------------------------------- >Comment By: Vlad Seryakov (seryakov) Date: 2005-04-04 15:29 Message: Logged In: YES user_id=184124 make test works now, getopt removed ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-04-04 02:19 Message: Logged In: YES user_id=184124 I had some doubts about this but according to the usage help, there is no any uprocessed arguments left, i do not know why optind has been used at all, it was always equalt to the last argument. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-04 00:46 Message: Logged In: YES user_id=87254 'make test' no longer works. Looks like the following is too strict: if (argv[i][0] != '-') { UsageError("invalid option: %s", argv[i]); exit(1); } Also, this isn't equivalent: ! NsConfigEval(config, argc, argv, optind); --- 537,541 ---- ! NsConfigEval(config, argc, argv, argc); The config script should end up with unprocessed args in the interp's $::argv, right? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-04-03 15:29 Message: Logged In: YES user_id=184124 Yes, i run my server with all parameters, no difference. ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-04-03 11:42 Message: Logged In: YES user_id=95086 If you have verified the correct operation, you can submit this. The "poll" implementation is still open, right? I will be unavailable for couple of days... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1175561&group_id=130646 |
From: SourceForge.net <no...@so...> - 2005-04-04 02:40:15
|
Feature Requests item #1159471, was opened at 2005-03-09 00:40 Message generated for change (Comment added) made by seryakov You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1159471&group_id=130646 Category: C-API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Vlad Seryakov (seryakov) Assigned to: Vlad Seryakov (seryakov) Summary: Virtual Hosting Initial Comment: Okay, i did some digging and testing, looks working and much simpler. I tried to simplify default AS 4.x virtual hosting and added pageroot virtual hosting, simple way to use different pagetroots on the same server. The change vor default virtual hosting is: no defaultserver anymore, the server who registered virtual hosts is default server, so nssock is loaded in the default server, other than that virtual servers are defined the same way. One thing i left is to chamge ns_info pageroot to use Ns_GetConn() and then if exists use connPtr->pageroot, but this is simple change if you approve current virtual hosting patch. Here is the nsd.tcl config example: ns_section "ns/server/${server}/module/nssock/servers" ns_param test vlad.seryakov.com ns_param test vlad.seryakov.com:80 ns_section "ns/server/${server}/module/nssock/pageroots" ns_param ${home}/html/test vlad.seryakov.com ns_param ${home}/html/test vlad.seryakov.com:80 ---------------------------------------------------------------------- >Comment By: Vlad Seryakov (seryakov) Date: 2005-04-04 02:40 Message: Logged In: YES user_id=184124 Patch worked for me ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-04-04 00:56 Message: Logged In: YES user_id=87254 I found some errors in the previous patch, so here's another one. I wouldn't be so conservative, except an error here would be a big security hole. I've written some tests. I;d appreciate it if you'd take a look and see if this looks alright? If you're happy that this looks reasonable, I'll commit it. I've fixed the hostprefix config that you noted. I also changed Ns_ConnLocationAppend() and Ns_ServerPath()/Ns_PagePath() to always return a valid result. The driver's staticaly configured location is used if a callback fails. I felt it was just too ugly to have to check the return every time. I'm thinking maybe there needs to be some kind of common Ns_HostIsValid() routine... ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-04-01 14:12 Message: Logged In: YES user_id=184124 Can we commit this patch, i need to replace one of my virtual hosting servers and i would give it a try with new patch. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-28 01:59 Message: Logged In: YES user_id=184124 One notice, hostpreix bt default is vhost, not empty, would be better to have it empty. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-28 01:55 Message: Logged In: YES user_id=184124 Yes, this worked for me, if Zoran does not mind, you can commit it. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-27 14:25 Message: Logged In: YES user_id=87254 The new serverdir is for storing files associated with a server (or virtual host) which are not made public via the pagedir. So, things like uploads, auto-generated data, caches etc. This will contain only the pages directory by default, because the server doesn't do anything interesting by default. I've attached a new patch which makes the serverdir and pagedir fully customisable. Here are the possible config settings: ns_section "ns/server/${servername}/fastpath" ns_param serverdir /srv # default: $home/servers/$servername ns_param pagedir pages #ns_param pageroot pages # depreciated ns_section "ns/server/${servername}/vhost" ns_param enabled false ns_param hostprefix vhosts #default "" ns_param hosthashlevel 3 ns_param stripport true ns_param stripwww true I've added path hashing, which hashes the hostname so that they are spread accross multiple directories. e.g. foo.com -> ./f/o/o/pages a.com -> ./a/_/_/pages I've also added a -host switch to the ns_serverpath and ns_pagepath commands so that tool can be written which setup the necessary directories. Does this look ok? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-18 04:26 Message: Logged In: YES user_id=184124 On the other hand if it will be possible to configure/rename "servers/" and "pages/" parts or omit them completely i would be happy with this patch. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-14 14:48 Message: Logged In: YES user_id=184124 The problem i see with this patch, it will break all my AS installations, because it assumes that every servers is under servers/ direcotory and pageroot is awlays named pages/. I my on-server installs i do not have this complex directory structure, i have html/ under ns_info home and pageroot is set in the nsd.tcl. Also, what is the point of ServerRoot dir, we have PageRoot already, if it is set into absolute path other apps use ns_info pageroot? As i understand, under ServerRoot there is only pages difrectory? Why not to use pageroot directly? ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-14 14:05 Message: Logged In: YES user_id=87254 Oh, forgot to mention. It depends on the Tcl Callbacks patch. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-14 14:03 Message: Logged In: YES user_id=87254 I've added the patch naviserver-4.0.10-server-root-vhost.patch. It adds the following new routines: Ns_ServerPath() Ns_PagePath() Ns_SetServerRootProc() Ns_ConnLocationAppend() Ns_SetConnLocationProc() NsServerRoot() NsPageRoot() ns_serverpath ?pathSegment ...? ns_pagepath ?pathSegment ...? ns_serverrootproc script ?arg? ns_locationproc script ?arg? And the following new configuration options: ns_section "ns/server/${servername}/vhost" ns_param enabled false ns_param prefix "" ns_param pagedir pages # overides fastpath/pageroot ns_param stripwww true ns_parma stripport true This version of host header based virtual hosting which depends on the existance of the pages directory is a superset of the functionality provided by a static configuration. Applications which call Ns_ConnLocation() will need to be modified to call Ns_ConnLocationAppend() or they will not be vhost aware. I've reinstated the depreciated proc Ns_SetConnLocationProc() and changed it's signature. It dissapeared from ns.h almost 5 years ago, then reappreared ~2.5 years ago. I don't think this will be a problem. In turn, I've depreciated the Ns_SetLocationProc(). It compiles and the server runs. I haven't had time to test it. Does this look acceptable? ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-13 00:41 Message: Logged In: YES user_id=184124 Just to consider the possibility, instead of mallocing pageroot/location, by default it can use sockPtr->pageroot/sockPtr->location, then when ns_conn pageroot newpageroot called, it will set connPtr->pageroot with malloced string and ns_conn pageroot will check and return it instead of sockPtr->pageroot. This way, no overhead at conn queue and still new pageroot/location can be set in Tcl ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-13 00:02 Message: Logged In: YES user_id=184124 That is the probem with nssock, it is actually an extender of the driver but still somehow kept independent. nssock itself is useless without driver and only used to bind to more than one address for different servers. it could be moved in the core but the problem will be how to define more than once instance. malloc are overhead indeed, but once copied they can be used independently and canbe set in Tcl by using ns_conn location newLocation or ns_conn pageroot newPageroot. In this case they should be a copies. Just do not make mass virtual hosting the only virtual hosting way, being able to change pageroot in the Tcl/C give developer more flexibility if required. For simple cases, mass virtual hosting is okay. ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-12 23:48 Message: Logged In: YES user_id=87254 I'm not keen at all on adding virtual hosting to the nssock driver. There's nothing HTTP specific about the nssock dirver and I'd like to keep it that way. There are a couple of problems with the other proposed solution. The paired functions Ns_SetLocationProc()/Ns_ConnSetLocationProc() etc. seems excessive, and the enforced malloc()ing at runtime of the location and pageroot strings is an unwelcome overhead. Using Tls storage is clever but pretty ugly. I think dstrings are the way to go here. I'm not sure Tls is safe in this implementation. The same dstring is used for location and pageroot strings, so it depends what the caller decides to do with the result and in what order, whether or not one overwrites the other. I would like to explore adding mas virtual hosting into the core. Let me work up a patch, I think I can get to this this weekend... ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-12 21:57 Message: Logged In: YES user_id=184124 Attached is nssock with virtual hosting patch ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-12 20:39 Message: Logged In: YES user_id=184124 Actually, vhost can be combined with nssock, if options given it will enable virtual hosting, if not works as regular sock driver. This way it is always with the core and at the same time independent. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-10 21:38 Message: Logged In: YES user_id=184124 If loaded, vhost module works as Stephan suggested, strips port/host and usesd pageroot if other root is not specified. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-10 21:37 Message: Logged In: YES user_id=184124 There is new patch with Stephans corrections/additions. I think we can provide core module for virtual hosting, i called it nsvhost and we can extend this module to do all sorts of hosting. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-10 18:53 Message: Logged In: YES user_id=184124 And keeping port and www. is sometimes necessary, you can do virtual hosting by port only, IDT does that for example, and many sites work without www. prefix, just stripping them by default may not be appropriate. ---------------------------------------------------------------------- Comment By: Vlad Seryakov (seryakov) Date: 2005-03-10 18:24 Message: Logged In: YES user_id=184124 >Looks good. However, isn't ns_conn pageroot >unneccessary? For templating engines ns_info pageroot is the only way to figure out the root, UrlToFile works for fastpath only. >Would it be better to have the servers and pageroot config >in one section, to avoid duplication? They are mutually exclusive, that's why i put them in different sections, if full virtual server is set, pageroots are ignored, this is for AOL like virtual hosting with different servers(rare situation though). So in most cases pageroots will be used only, thus only one simple syntax. As for PageRoot and ServerRoot, i think this is a little cofusing. Currently, pageroot returns full path and whoever calls pageroot assumes that it will return full path. Virtual hosting using directories as hostnames is what i am currently using with vhost module and i think it can be included as a standard feature for easy virtualhosting solutions. I do not think this should be the ONLY virtual hosting solution, everybody can write their own modules using SetLocation/SetPageRoot procs or register filter which will set pageroot for each connection. Let me prepare another patch-set with your suggestions included . ---------------------------------------------------------------------- Comment By: Stephen Deasey (sdeasey) Date: 2005-03-10 08:00 Message: Logged In: YES user_id=87254 Looks good. However, isn't ns_conn pageroot unneccessary? Would it be better to have the servers and pageroot config in one section, to avoid duplication? ns_section "ns/server/${server}/module/nssock/servers" ns_param example.com exampleserver ns_param foo.example.com "exampleserver ${home}/whatever" Here, the first entry maps the example.com host to the exampleserver and uses it's default pageroot. The second entry supplies a new pageroot. How about mass virtual hosting, i.e. where you don't have to explicitly configure each host header to pageroot mapping, but construct the pageroot from the host heafer at runtime? I've attached the file nsmassvhost.c which implements the above. It uses the hooks Ns_PageRootProc and Ns_LocationProc which would be unneccessary if the functionality was included as standard. It trims the port and any leading 'www.' from the host header. It would be nice to have this for the static mapping also, as at the moment to be robust you often need 4 mappings for each virtual host. It also uses the function Ns_ServerPath(). The idea here is to introduce the concept of the virtual server root as a distinct location in the file system, where the pageroot is a location below that. I want to change this so that the serverroot is dynamic and based on the host header (when configured), and the pageroot is simply the serverroot with "/pages" (or whatever is configured) appended. It would look something like this: /srv/server1/pages /srv/server1/example.com/pages /srv/server1/example.com/cache The first path is the default or non-virtual hosted case. server1 is a server defind in the config file and has it's own private tcl library. The second path is the pageroot of a virtual host. The third is an example of some data which is specific to the example.com virtual host. So, without virtual hosts: Ns_ServerRoot() -> /srv/server1 Ns_PageRoot() -> /srv/server1/pages With virtual hosts (and called in the context of a conn thread): Ns_ServerRoot() -> /srv/server1/example.com Ns_PageRoot() -> /srv/server1/example.com/pages The advantage of this system is that you don't have to restart your server every time you add or remove a virtual host. There is also a convenient location to store data associated with both virtual servers and virtual hosts. Easy to backup, remove, etc. I haven't had time to look at how this would be integrated into what you've got here, maybe at the weekend. Feel free to take a shot at though :-) Does the scheme outlined above make sense to you? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1159471&group_id=130646 |