Re: [AOLSERVER] encoding of ns_sockopen
* Dossy [EMAIL PROTECTED] [20040528 05:51]: An additional -encoding parameter for ns_httpopen would be the most flexible way. [...] If you're really serious about wanting this, file it as a Feature Request in SF tracker so we don't forget about it. Thanks! Done: http://sourceforge.net/tracker/index.php?func=detailaid=962233group_id=3152atid=353152 til -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
Note that tclhttpd uses fileevent to implement a full-fledged single-process select-based web server - I don't know how good it actually is in practice, but it should make for a very high- performance, low-overhead server. On Thu, 27 May 2004 12:45:09 -0700, Tom Jackson [EMAIL PROTECTED] wrote: On Thu, 2004-05-27 at 12:27, Dossy wrote: Except, there's no equivalent for ns_sockselect in Tcl yet, as far as I know ... Right, you use something like 'fileevent'. I'm going to be playing around with this a little to see how it compares to a server I just wrote using ns_socklistencallback. It should work 'better' than the ns_sock* commands. tom jackson -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
Brandy, Thanks for the info. That is very good to know. One thing that is 'busted' in AOLserver is the ability to provide threaded generic servers. I would like to build this in for various reasons, so it looks like the socket/fileevent method might be the way to go, and just forget about threads. For those who don't know, ns_socklistencallback runs in a single thread, no matter how many times you call it with different ip/port combinations. If any client connection blocks, everyone else stacks up waiting. Last week I started working on a shared 'Network Variable' server. Not wanting to write any more C level code, I had to use ns_socklistencallback to receive an ip/port number to dial back to, and start a new thread on the listen server to dial back the client, which had setup a server using ns_socklisten. While this worked great, I ran into another issue: when a connection thread finishes with a connection it forgets about any open fds, so the connection is only available for the first connection. :( So it looks like another project will be to setup a module which allows persistent tcp connections, probably similar to nsdb, but working with arrays instead of ns_sets. tom jackson On Fri, 2004-05-28 at 09:00, Brady Wetherington wrote: Note that tclhttpd uses fileevent to implement a full-fledged single-process select-based web server - I don't know how good it actually is in practice, but it should make for a very high- performance, low-overhead server. On Thu, 27 May 2004 12:45:09 -0700, Tom Jackson [EMAIL PROTECTED] wrote: Right, you use something like 'fileevent'. I'm going to be playing around with this a little to see how it compares to a server I just wrote using ns_socklistencallback. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
I have patch that convert aolserver into generic threaded server platform. I had to write SMTP proxy server and it required just a small patch to change default HTTP-aware behaiviour of server thread. Now it supports generic drivers and uses same thread pools/connection driver as for http communications. It is possible to write generic C-module that will register Tcl callbacks and call them at some points and aolserver connection thread will handle the rest. Tom Jackson wrote: Brandy, Thanks for the info. That is very good to know. One thing that is 'busted' in AOLserver is the ability to provide threaded generic servers. I would like to build this in for various reasons, so it looks like the socket/fileevent method might be the way to go, and just forget about threads. For those who don't know, ns_socklistencallback runs in a single thread, no matter how many times you call it with different ip/port combinations. If any client connection blocks, everyone else stacks up waiting. Last week I started working on a shared 'Network Variable' server. Not wanting to write any more C level code, I had to use ns_socklistencallback to receive an ip/port number to dial back to, and start a new thread on the listen server to dial back the client, which had setup a server using ns_socklisten. While this worked great, I ran into another issue: when a connection thread finishes with a connection it forgets about any open fds, so the connection is only available for the first connection. :( So it looks like another project will be to setup a module which allows persistent tcp connections, probably similar to nsdb, but working with arrays instead of ns_sets. tom jackson On Fri, 2004-05-28 at 09:00, Brady Wetherington wrote: Note that tclhttpd uses fileevent to implement a full-fledged single-process select-based web server - I don't know how good it actually is in practice, but it should make for a very high- performance, low-overhead server. On Thu, 27 May 2004 12:45:09 -0700, Tom Jackson [EMAIL PROTECTED] wrote: Right, you use something like 'fileevent'. I'm going to be playing around with this a little to see how it compares to a server I just wrote using ns_socklistencallback. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank. -- Vlad Seryakov 703 488-2173 office [EMAIL PROTECTED] http://www.crystalballinc.com/vlad/ -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
On Fri, May 28, 2004 at 12:58:36PM -0400, Vlad Seryakov wrote: I have patch that convert aolserver into generic threaded server platform. I had to write SMTP proxy server and it required just a small patch to change default HTTP-aware behaiviour of server thread. Now it supports generic drivers and uses same thread pools/connection driver as for http communications. That sounds quite useful. Vlad, where is this patch available? Dossy or others, can it go into the standard AOLserver sources? -- Andrew Piskorski [EMAIL PROTECTED] http://www.piskorski.com/ -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
On Friday 28 May 2004 19:59, you wrote: On Fri, May 28, 2004 at 12:58:36PM -0400, Vlad Seryakov wrote: I have patch that convert aolserver into generic threaded server platform. I had to write SMTP proxy server and it required just a small patch to change default HTTP-aware behaiviour of server thread. Now it supports generic drivers and uses same thread pools/connection driver as for http communications. That sounds quite useful. Vlad, where is this patch available? Dossy or others, can it go into the standard AOLserver sources? Vlad, can you post a SF feature request and put the patch there? This way everybody can see it and eventually comment. I think this is something you already mentioned some time ago, right? Zoran -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
I submitted it ot SF http://sourceforge.net/tracker/index.php?func=detailaid=726288group_id=3152atid=303152 but it is quite old already, i have newer version but did not submit it. The idea is same just little improvements. We use this proxy module for 1 year already in th eproduction, no problems at all, it co-exists with normal http driver in the same aolserver process, they both reuse same connection pool. i am working on generic TCP server using new patch, hope to release it soon. Basically new driver will look like this, just need to export socket interface to Tcl, so i can read/write to socket from scripts. All Ns_Conn fields are available and C API i used same way as for HTTP connections. typedef struct { char *server; char *initproc; char *dataproc; Ns_Driver *driver; } TcpServer; NS_EXPORT int Ns_ModuleInit(char *server, char *module) { TcpServer *serverPtr; Ns_DriverInitData init; serverPtr = ns_calloc(1,sizeof(TcpServer)); serverPtr-server = server; serverPtr-initproc = Ns_ConfigGet(path,initproc); serverPtr-heloproc = Ns_ConfigGet(path,dataproc); init.version = NS_DRIVER_VERSION_1; init.name = tcpserver; init.proc = TcpServerProc; init.opts = NS_DRIVER_RAW; init.arg = serverPtr; init.path = NULL; if(Ns_DriverInit(server, module, init) != NS_OK) { Ns_Log(Error, nstcpserver: driver init failed.); return NS_ERROR; } return NS_OK } static int TcpServerProc(Ns_DriverCmd cmd, Ns_Sock *sock, struct iovec *bufs, int nbufs) { TcpServer *server = sock-driver-arg; switch(cmd) { case DriverStart: server-driver = sock-driver; if(server-initproc) Ns_TclEval(0,server-server,server-initproc); return NS_OK; case DriverError: sleep(3); exit(0); break; case DriverProc: TcpServerThread(server,sock); return NS_FILTER_BREAK; case DriverRecv: case DriverSend: case DriverKeep: case DriverClose: break; } return NS_ERROR; } static void TcpServerThread(TcpServer *server,Ns_Sock *sock) { Ns_Conn *nsconn = Ns_GetConn(); TclInterp *interp = Ns_GetConnInterp(nsconn); if(interp server-dataproc) Ns_TclEval(0,server-server,server-dataproc); } Andrew Piskorski wrote: On Fri, May 28, 2004 at 12:58:36PM -0400, Vlad Seryakov wrote: I have patch that convert aolserver into generic threaded server platform. I had to write SMTP proxy server and it required just a small patch to change default HTTP-aware behaiviour of server thread. Now it supports generic drivers and uses same thread pools/connection driver as for http communications. That sounds quite useful. Vlad, where is this patch available? Dossy or others, can it go into the standard AOLserver sources? -- Andrew Piskorski [EMAIL PROTECTED] http://www.piskorski.com/ -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank. -- Vlad Seryakov 703 488-2173 office [EMAIL PROTECTED] http://www.crystalballinc.com/vlad/ -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
On Fri, 2004-05-28 at 09:58, Vlad Seryakov wrote: I have patch that convert aolserver into generic threaded server platform. I had to write SMTP proxy server and it required just a small patch to change default HTTP-aware behaiviour of server thread. Now it supports generic drivers and uses same thread pools/connection driver as for http communications. This is great, it would be a huge step forward, IMHO. I've been looking at the code, so I knew you could do it, but this is somethig that should really be done, given the state of the other ns_sock* APIs tom jackson -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
On 2004.05.27, Tilmann Singer [EMAIL PROTECTED] wrote: Can anyone tell me what the chances are for this bug to get fixed: [ 932459 ] Impossible to set encoding for ns_sockopen http://sourceforge.net/tracker/index.php?func=detailaid=932459group_id=3152atid=103152 Does it appear like fundamentally hard or even impossible to influence the encoding of ns_sockopen? If yes then I'll have to look for another possibility to implement the OpenACS xmlrpc functionality. Unfortunately it seems that the tcl http package doesn't allow that either. Currently that bug prevents from using aolserver as xmlrpc client in applications with non-ascii data. Does this not work: foreach {rfd wfd} [ns_sockopen $host $port] break fconfigure $wfd -encoding utf-8 puts $wfd some data If this doesn't, then we can look into what it might take to make this work for you. -- Dossy -- Dossy Shiobara mail: [EMAIL PROTECTED] Panoptic Computer Network web: http://www.panoptic.com/ He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on. (p. 70) -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
On Thursday 27 May 2004 20:39, you wrote: On 2004.05.27, Tilmann Singer [EMAIL PROTECTED] wrote: Can anyone tell me what the chances are for this bug to get fixed: [ 932459 ] Impossible to set encoding for ns_sockopen http://sourceforge.net/tracker/index.php?func=detailaid=932459group_id=3152atid=103152 Does it appear like fundamentally hard or even impossible to influence the encoding of ns_sockopen? If yes then I'll have to look for another possibility to implement the OpenACS xmlrpc functionality. Unfortunately it seems that the tcl http package doesn't allow that either. Currently that bug prevents from using aolserver as xmlrpc client in applications with non-ascii data. Does this not work: foreach {rfd wfd} [ns_sockopen $host $port] break fconfigure $wfd -encoding utf-8 puts $wfd some data If this doesn't, then we can look into what it might take to make this work for you. He's using the http protocol for that, I assume, not just plain socket connection. Zoran -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
On Thu, 2004-05-27 at 11:46, Zoran Vasiljevic wrote: He's using the http protocol for that, I assume, not just plain socket connection. I think Dossy's suggestion should work. All the tcl exposed sock commands use tcl channels. However, why not use tcl's 'socket' command: http://zmbh.com/tcl/socket? tom jackson -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
On Thursday 27 May 2004 21:05, you wrote: On Thu, 2004-05-27 at 11:46, Zoran Vasiljevic wrote: He's using the http protocol for that, I assume, not just plain socket connection. I think Dossy's suggestion should work. All the tcl exposed sock commands use tcl channels. Yes. But so far I've seen, he's implementing xmlrpc over http. You can do all sorts of things with Tcl channels, but since aolserver already has all this fancy http stuff, it's pretty natural to use http instead of home brewn comm. But... let the original poster tell us exactly what he's after, before we go too far into this direction... Zoran -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
On 2004.05.27, Zoran Vasiljevic [EMAIL PROTECTED] wrote: He's using the http protocol for that, I assume, not just plain socket connection. Tilmann's email only mentions ns_sockopen. If the fconfigure trick works, then extending ns_httpopen to take an -encoding parameter that it uses to fconfigure the channels returned to it from ns_sockopen is a simple fix. -- Dossy -- Dossy Shiobara mail: [EMAIL PROTECTED] Panoptic Computer Network web: http://www.panoptic.com/ He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on. (p. 70) -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
On 2004.05.27, Tom Jackson [EMAIL PROTECTED] wrote: On Thu, 2004-05-27 at 11:46, Zoran Vasiljevic wrote: He's using the http protocol for that, I assume, not just plain socket connection. I think Dossy's suggestion should work. All the tcl exposed sock commands use tcl channels. However, why not use tcl's 'socket' command: http://zmbh.com/tcl/socket? I was going to ask that, too -- as of Tcl 8.something, there's little reason to use the ns_sock* commands. They probably should be deprecated in favor of using Tcl's socket command directly. Except, there's no equivalent for ns_sockselect in Tcl yet, as far as I know ... -- Dossy -- Dossy Shiobara mail: [EMAIL PROTECTED] Panoptic Computer Network web: http://www.panoptic.com/ He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on. (p. 70) -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
* Nis Jorgensen [EMAIL PROTECTED] [20040527 22:08]: He's using the http protocol for that, I assume, not just plain socket connection. Tilmann's email only mentions ns_sockopen. If the fconfigure trick works, then extending ns_httpopen to take an -encoding parameter that it uses to fconfigure the channels returned to it from ns_sockopen is a simple fix. Yes that trick worked, thanks. He probably will want the default to be set from the config file - probably through a new parameter called something like HttpOpenWriteCharset? An additional -encoding parameter for ns_httpopen would be the most flexible way. Then an aolserver instance could in theory communicate as client with different servers that for whatever reasons need different encodings. For xmlrpc however it will be utf-8 most of the time anyway, so the ability to set it to utf-8 is most important for that usecase. I had a look at the tcl http client package seeing if the ns_httpopen calls could be replaced with that, but apparently there the only way to manipulate the encoding of POSTed data is by setting the system encoding. I don't know if that is a good idea to do within an aolserver tcl script. (Someone asked - yes I would like to use the fancy http stuff for xmlrpc and not re-implement it using only sockets). til -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] encoding of ns_sockopen
On 2004.05.28, Tilmann Singer [EMAIL PROTECTED] wrote: Tilmann's email only mentions ns_sockopen. If the fconfigure trick works, then extending ns_httpopen to take an -encoding parameter that it uses to fconfigure the channels returned to it from ns_sockopen is a simple fix. Yes that trick worked, thanks. Good to hear. I've gone and closed SF Bug #932459. An additional -encoding parameter for ns_httpopen would be the most flexible way. [...] If you're really serious about wanting this, file it as a Feature Request in SF tracker so we don't forget about it. Thanks! -- Dossy -- Dossy Shiobara mail: [EMAIL PROTECTED] Panoptic Computer Network web: http://www.panoptic.com/ He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on. (p. 70) -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
[AOLSERVER] encoding of ns_sockopen
Hi, When working with the openacs xmlrpc package I noticed that when posting data using ns_httpopen which calls ns_sockopen the data is encoded in iso-8859-1 although I have set the following parameters: ns_section ns/parameters ... ns_param HackContentType 1 ns_param URLCharset utf-8 ns_param OutputCharset utf-8 ns_param HttpOpenCharset utf-8 ns_param DefaultCharset utf-8 I would have expected and needed the posted data to be encoded in utf-8. Is this a bug in aolserver or am I missing some way to manipulate the encoding? Tested on Aolserver 4.0 on Linux. thanks in advance, Til -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.