From robin@j... Tue Jan 25 11:26:28 2000 From: robin@j... (Robin Becker) Date: Tue, 25 Jan 2000 11:26:28 +0000 Subject: [medusa] status.py out of sync? Message-ID: The Zope version at least of status.py seems to be out of sync with the recent changes to asyncore.py eg I think that channel_list_producer should contain something like channel_reprs = map ( lambda x: '<' + repr(x[0]) + ',' + repr(x[1])[1:-1] + '>', asyncore.socket_map.items() ) rather than channel_reprs = map ( lambda x: '<' + repr(x[1])[1:-1] + '>', asyncore.socket_map.keys() ) the same is true wherever we refer to the keys() as these seem to be just integers now rather than objects. -- Robin Becker From mike@e... Fri Jan 28 03:22:03 2000 From: mike@e... (Mike) Date: Thu, 27 Jan 2000 19:22:03 -0800 Subject: [medusa] More performance ?'s Message-ID: <86r20r$mhdn@e...> Hello, I read in the archives a few posts about perfomance. One of the posts mentions that medusa isn't as fast as thttpd or zeus and that medusa can't handle 1000 connections per second. My question is what -can- medusa handle? Basically, I need to compare it to apache with mod_fastcgi for using Zope. I'm having some trouble with mod_fastcgi and Zope that I don't have while using medusa in place of apache, so I'm pondering just giving up and using medusa. Since apache isn't the world's fastest web server, I assume that medusa is at least comparable. While I'm at it, how stable is medusa in the long run? I read on the web page that medusa is currently used in mission-critical applications, but can examples be provided (in terms of using it as a web server, which is my goal)? One last question: this will eventually be a commercial application, so I'll be purchasing a license for single server use. Other than the right to use medusa, are there any other benefits? Any support? Is it possible to purchase support? Who do I sue if it breaks? (kidding) Okay, one more question: since I'm a python and medusa newbie, this may seem like a dumb question, but how secure is medusa? Does it deal decently with buffers (ie, low likelihood of buffer overflow attacks) and can it stand up to a denial of service attack (many more connections than it can handle) without falling over (this may be more of a function of the OS, though)? Thanks, Mike From jim@d... Fri Jan 28 14:47:20 2000 From: jim@d... (Jim Fulton) Date: Fri, 28 Jan 2000 09:47:20 -0500 Subject: [medusa] Re: More performance ?'s References: <86r20r$mhdn@e...> Message-ID: <3891ABF8.BA892F29@d...> Mike wrote: > (snip) > Basically, I need to compare it to apache with mod_fastcgi for using > Zope. > I'm having some trouble with mod_fastcgi and Zope that I don't have > while > using medusa in place of apache, so I'm pondering just giving up and > using > medusa. Uh, ZServer is based on Medusa. Using Medusa to talk to ZServer is effectively using Medusa to talk to itself. Why not just use ZServer as your HTTP server? If you need to serve static content, you could install the standard Medusa HTTP server along side the various servers that Zope provides. Jim -- Jim Fulton mailto:jim@d... Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From mike@e... Fri Jan 28 15:25:17 2000 From: mike@e... (Mike) Date: Fri, 28 Jan 2000 07:25:17 -0800 Subject: [medusa] Re: More performance ?'s In-Reply-To: <3891ABF8.BA892F29@d...> Message-ID: <86scct$cb6m@e...> jim fulton wrote: original article:http://www.egroups.com/group/medusa/?start=133 > Uh, ZServer is based on Medusa. Using Medusa to talk to ZServer > is effectively using Medusa to talk to itself. Why not just > use ZServer as your HTTP server? Sorry about that, I wasn't clear. I meant that I wondered if ZServer, which is based on Medusa, was any faster/slower than Apache with mod_fastcgi. ZServer is working wonderfully, and Apache/mod_fastcgi is not, so I'm trying to figure out if it's worth my time to fix Apache/mod_fastcgi. If this is a question I should ask the Zope folk, I'll do that. Since ZServer is based on Medusa, and I was looking for a comparison of the two webservers, I figgured folks here could tell me about Medusa's (and therefore ZServer's) performance. > Jim Thanks, Mike From mike@e... Fri Jan 28 15:28:56 2000 From: mike@e... (Mike) Date: Fri, 28 Jan 2000 07:28:56 -0800 Subject: [medusa] Re: More performance ?'s In-Reply-To: <3891ABF8.BA892F29@d...> Message-ID: <86scjo$6dmk@e...> jim fulton wrote: original article:http://www.egroups.com/group/medusa/?start=133 > Uh, ZServer is based on Medusa. Using Medusa to talk to ZServer > is effectively using Medusa to talk to itself. Why not just > use ZServer as your HTTP server? Sorry about that, I wasn't clear. I meant that I wondered if ZServer, which is based on Medusa, was any faster/slower than Apache with mod_fastcgi. ZServer is working wonderfully, and Apache/mod_fastcgi is not, so I'm trying to figure out if it's worth my time to fix Apache/mod_fastcgi. If this is a question I should ask the Zope folk, I'll do that. Since ZServer is based on Medusa, and I was looking for a comparison of the two webservers, I figured folks here could tell me about Medusa's (and therefore ZServer's) performance. > Jim Thanks, Mike From rushing@n... Sat Jan 29 05:25:58 2000 From: rushing@n... (Sam Rushing) Date: Fri, 28 Jan 2000 21:25:58 -0800 (PST) Subject: [medusa] status.py out of sync? In-Reply-To: References: Message-ID: <14482.31206.663536.2048@s...> Robin Becker writes: > The Zope version at least of status.py seems to be out of sync with > the recent changes to asyncore.py > I think that channel_list_producer should contain something like > > channel_reprs = map ( > lambda x: '<' + repr(x[0]) + ',' + repr(x[1])[1:-1] + '>', > asyncore.socket_map.items() > ) asyncore.socket_map.values(), actually. > the same is true wherever we refer to the keys() as these seem to > be just integers now rather than objects. Yes, this change has been very painful, I'm continually finding things that are broken by it. -Sam From rushing@n... Sat Jan 29 05:58:59 2000 From: rushing@n... (Sam Rushing) Date: Fri, 28 Jan 2000 21:58:59 -0800 (PST) Subject: [medusa] More performance ?'s In-Reply-To: <86r20r$mhdn@e...> References: <86r20r$mhdn@e...> Message-ID: <14482.33187.774153.679275@s...> Mike writes: > I read in the archives a few posts about perfomance. One of the > posts mentions that medusa isn't as fast as thttpd or zeus and that > medusa can't handle 1000 connections per second. My question is > what -can- medusa handle? I haven't done any real testing recently, so it's hard to give real performance numbers. And of course, numbers will mean different things to different people; depending on the application, etc... > Basically, I need to compare it to apache with mod_fastcgi for > using Zope. I'm having some trouble with mod_fastcgi and Zope that > I don't have while using medusa in place of apache, so I'm > pondering just giving up and using medusa. The reason I hem-haw is that folks are often comparing apples and oranges. For many things, apache will be more than fast enough. It's when you try to bend it into something that it is not that you'll run into trouble. It's a question of design. For building a complex web server with lots of state, using apache to fire up cgi programs that make separate connections to a database for every hit is just fundamentally the wrong way to solve the problem. I would suggest taking your existing system, writing a simple handler for it and then benchmarking with your own code. > Since apache isn't the world's fastest web server, I assume that > medusa is at least comparable. For the delivery of static pages, it's quite likely that apache will be able to handle a higher load than Medusa 'out of the box'. However, by incrementally replacing bits of medusa with C modules, it should be possible to make it incrementally as fast as thttpd (since they share the same design). Why hasn't this been done yet? Because no one has needed it. > While I'm at it, how stable is medusa in the long run? I read on > the web page that medusa is currently used in mission-critical > applications, but can examples be provided (in terms of using it as > a web server, which is my goal)? I can think of two applications at eGroups that exposed the Medusa HTTP server to the outside world (the main site still uses PyApache): 1) the chat server 2) the ad servers The ad servers have recently been replaced with a coroutine implementation, but the chat server still uses medusa. [though it may get rewritten soon] Other folks may have more interesting examples. For my own purposes I usually use Medusa's HTTP server only for status/control of a system that does some other job. > One last question: this will eventually be a commercial > application, so I'll be purchasing a license for single server use. > Other than the right to use medusa, are there any other benefits? > Any support? Is it possible to purchase support? Who do I sue if > it breaks? (kidding) I'm more likely to Jump when folks ask; I do my best to help with problems and give advice. > Okay, one more question: since I'm a python and medusa newbie, this > may seem like a dumb question, but how secure is medusa? Does it > deal decently with buffers (ie, low likelihood of buffer overflow > attacks) and can it stand up to a denial of service attack (many > more connections than it can handle) without falling over (this may > be more of a function of the OS, though)? Python itself is immune from all the classic buffer overflows. DoS is another matter. There are not defenses against DoS in the stock Medusa; but I guarantee you that whatever approach you take to handling DoS will be easier to implement in Python than in C. In several projects I have used explicit queues to limit the number of descriptors; this approach works well. -Sam From rushing@n... Tue Feb 1 01:52:17 2000 From: rushing@n... (Sam Rushing) Date: Mon, 31 Jan 2000 17:52:17 -0800 (PST) Subject: [medusa] support for sendfile() on linux and freebsd Message-ID: <14486.15441.777671.754037@s...> I've added support for asynchronous sendfile() on linux and freebsd. So now you can do something like this: def my_method (self): fd = os.open (filename, os.O_RDONLY, 0644) size = os.lseek (fd, 0, 2) os.lseek (fd, 0, 0) self.push ('%08x' % size) self.push_sendfile (fd, 0, size, self.close_that_descriptor) self.close_when_done() See the 'sendfile' subdirectory for details. For you convenience, a new tarball has been rolled: http://www.nightmare.com/medusa/medusa-src-20000201.tar.gz Suggestions for a more portable interface are welcome, the current setup is a bit clumsy. Enjoy! -Sam From billtut@m... Thu Feb 3 20:59:45 2000 From: billtut@m... (Bill Tutt) Date: Thu, 3 Feb 2000 12:59:45 -0800 Subject: [medusa] Changes to the FTP stuff for use by efs/ange-ftp. Message-ID: <4D0A23B3F74DD111ACCD00805F31D8101D8BCCB3@R...> Since I start and stop IIS all day for debugging the MSN Yellowpages, I can't use IIS's FTP server from within XEmacs if I'm working remotely. So, I figured, lets see how easy it would be to make Medusa handle the gig. It turned out it wasn't that difficult. Changes: * Added support for XPWD since thats what the NT command line ftp client sends. * The long output now always includes the parent directory (".."), this is mostly to make life easier in XEmacs efs based DirEd sessions. (no, DirEd features via efs/ange-ftp haven't been tested, just simple navigation). * NLST now requires the -l option to be specified in order to get long output mode. All other ls options are ignored at the moment. * Ignore the common "*"-only glob. Notes: * It should be fairly easy to extend whats going on here to add support for more ls options. * ".." shouldn't be listed if you're listing the root directory of the filesystem. * XEmacs was happy with the Unix long output that Medusa produced, I didn't have to overload the system type response at all. * I wasn't sure if cmd_list() should have identical processing as cmd_nlst() so I didn't alter it. Submitted for your pleasure/pain, Bill Index: filesys.py =================================================================== RCS file: /usr/local/cvsroot/medusa/filesys.py,v retrieving revision 1.9 diff -u -r1.9 filesys.py --- filesys.py 1998/06/22 05:36:05 1.9 +++ filesys.py 2000/02/03 13:48:11 @@ -132,6 +132,9 @@ return self.cwd ('..') def listdir (self, path, long=0): + # Cheesy yanking of the all inclusive glob. + if path == "*": + path = "" p = self.translate (path) # I think we should glob, but limit it to the current # directory only. @@ -139,6 +142,10 @@ if not long: return list_producer (ld, 0, None) else: + # add ".." if we're doing the long printout. + # This really should only happen when -a or -A is used + # but, the option logic doesn't make its way down here. + ld = [".."] + ld old_dir = os.getcwd() try: os.chdir (p) Index: ftp_server.py =================================================================== RCS file: /usr/local/cvsroot/medusa/ftp_server.py,v retrieving revision 2.39 diff -u -r2.39 ftp_server.py --- ftp_server.py 1999/11/19 09:25:34 2.39 +++ ftp_server.py 2000/02/03 13:48:11 @@ -32,6 +32,9 @@ import string import sys import time +import StringIO +import shlex +import getopt # TODO: implement a directory listing cache. On very-high-load # servers this could save a lot of disk abuse, and possibly the @@ -198,19 +201,22 @@ def get_dir_list (self, line, long=0): # we need to scan the command line for arguments to '/bin/ls'... - args = line[1:] - path_args = [] - for arg in args: - if arg[0] != '-': - path_args.append (arg) - else: - # ignore arguments - pass - if len(path_args) < 1: - dir = '.' + # and strip them away since we currently don't make use of them. + # (except for triggering long mode...) + if len(line) > 1: + args = line[1] + # convert args into a list of arguments. + args = ConvertArgsStringToArgsList (args) + # Cool, now we can run this thing through getopt. + optlist, args = getopt.getopt (args, "abcdfgiklmnpqrstuxABCFGLNQRSUX") + for opt, optValue in optlist: + if opt == "-l": + long = 1 + args = [args[0]] else: - dir = path_args[0] - return self.listdir (dir, long) + args = ["."] + return self.listdir (args, long) + # -------------------------------------------------- # authorization methods @@ -378,12 +384,8 @@ def cmd_nlst (self, line): 'give name list of files in directory' - # ncftp adds the -FC argument for the user-visible 'nlist' - # command. We could try to emulate ls flags, but not just yet. - if '-FC' in line: - line.remove ('-FC') try: - dir_list_producer = self.get_dir_list (line, 0) + dir_list_producer = self.get_dir_list (line) except os.error, why: self.respond ('550 Could not list directory: %s' % repr(why)) return @@ -433,6 +435,9 @@ self.filesystem.current_directory() ) ) + + def cmd_xpwd (self, line): + self.cmd_pwd(line) # modification time # example output: @@ -1110,7 +1115,7 @@ 'xcup': 'change to parent of current working directory (deprecated)', 'xcwd': 'change working directory (deprecated)', 'xmkd': 'make a directory (deprecated)', #! - 'xpwd': 'print the current working directory (deprecated)', + 'xpwd': 'print the current working directory (deprecated)', #* 'xrmd': 'remove a directory (deprecated)', #! } @@ -1121,3 +1126,18 @@ def print_vm(): print 'vm: %8dk' % (get_vm_size()/1024) + +# Convert a string containing an argument list +# to the actual list of arguments. +def ConvertArgStringToArgList(s): + # All praise shlex! + lex = shlex.shlex(StringIO.StringIO(s)) + # Add '-' to the set of word characters so that '-''s group + # to the flags + lex.wordchars = lex.wordchars + '-' + lArgs = [] + token = lex.get_token() + while token != '': + lArgs.append(token) + token = lex.get_token() + return lArgs From szilveszter.juhos@d... Sat Feb 12 12:22:04 2000 From: szilveszter.juhos@d... (Szilveszter Juhos) Date: Sat, 12 Feb 2000 04:22:04 -0800 Subject: [medusa] Dynamic object plugin sample Message-ID: <883j9c$e64v@e...> Can somebody give me a sample how to send a brand-new executable (plugin) to a running Medusa server (via monitor or via a dedicated "new-handler-handling-handler")? Is there a sample already somewhere in the source? Thanks: Szilva From hurd@s... Wed Feb 16 09:00:37 2000 From: hurd@s... (Youngbong Choe) Date: Wed, 16 Feb 2000 01:00:37 -0800 Subject: [medusa] Usage for recv_channel in ftp_server.py Message-ID: <88dovl$uq9g@e...> hi, i'm a newbie in python and medusa. I built a simple file server using asyncore.py and asynchat.py, recv_channel and xmit_channel classes. but i could not understatand recv_channel, xmit_channel flow exactly. My question is this: 1. After adding new xmit channel and then push_with_producer(....), how can a client get the data? need new socket? or using current socket? 2. After adding new recv channel, how can a client send the data? i need a piece of wisdom :) thank you. -- hurd. From rushing@n... Wed Feb 16 09:15:28 2000 From: rushing@n... (Sam Rushing) Date: Wed, 16 Feb 2000 01:15:28 -0800 (PST) Subject: [medusa] Usage for recv_channel in ftp_server.py In-Reply-To: <88dovl$uq9g@e...> References: <88dovl$uq9g@e...> Message-ID: <14506.27312.924941.748934@s...> Youngbong Choe writes: > hi, i'm a newbie in python and medusa. > > I built a simple file server using asyncore.py and asynchat.py, > recv_channel and xmit_channel classes. > but i could not understatand recv_channel, xmit_channel flow exactly. Unless you really *need* to use the FTP protocol, I would not recommend modeling a new protocol on it (especially if your purpose is to learn how to do protocols!). It's a bit over-complicated because of the way it uses separate data and command channels. A simpler approach would be something modeled on HTTP, where commands and data are sent over a single socket. [this works because a TCP stream is a two-way communications channel; commands can go in one direction, data the other] > My question is this: > > 1. After adding new xmit channel and then push_with_producer(....), > how can a client get the data? need new socket? or using current socket? > 2. After adding new recv channel, how can a client send the data? This is what makes the ftp model complicated: since it uses a separate channel for data it is necessary to 1) set up a new listening socket 2) tell the client side what port to connect to 3) accept the client's connection, thereby 4) creating *another* socket, which you then send the data over. [I just described PASV-mode ftp, normal-mode FTP is just the same only the client does the listening] See? Very complicated compared to: class simple_file_transfer_channel: def __init__ (self, conn): self.set_terminator ('\r\n') [...] def found_terminator (self): self.buffer, filename = '', self.buffer self.push_with_producer (hypothetical_filename_producer (filename)) [...] In the above, you could request a file like this: $ telnet mymachine 9021 /etc/resolv.conf [... contents of /etc/resolv.conf ...] Hope that helps! -Sam From hurd@s... Wed Feb 16 09:27:06 2000 From: hurd@s... (Youngbong Choe) Date: Wed, 16 Feb 2000 01:27:06 -0800 Subject: [medusa] Re: Usage for recv_channel in ftp_server.py In-Reply-To: <14506.27312.924941.748934@s...> Message-ID: <88dqha$g4c0@e...> Thank you sam :) sam rushing wrote: original article:http://www.egroups.com/group/medusa/?start=144 > Youngbong Choe writes: > > hi, i'm a newbie in python and medusa. > > > > I built a simple file server using asyncore.py and asynchat.py, > > recv_channel and xmit_channel classes. > > but i could not understatand recv_channel, xmit_channel flow exactly. > > Unless you really *need* to use the FTP protocol, I would not > recommend modeling a new protocol on it (especially if your purpose is > to learn how to do protocols!). It's a bit over-complicated > because of the way it uses separate data and command channels. > > A simpler approach would be something modeled on HTTP, where > commands and data are sent over a single socket. [this works because > a TCP stream is a two-way communications channel; commands can go > in one direction, data the other] > > > My question is this: > > > > 1. After adding new xmit channel and then push_with_producer(... .), > > how can a client get the data? need new socket? or using current socket? > > 2. After adding new recv channel, how can a client send the data? > > This is what makes the ftp model complicated: since it uses a separate > channel for data it is necessary to > > 1) set up a new listening socket > 2) tell the client side what port to connect to > 3) accept the client's connection, thereby > 4) creating *another* socket, which you then send > the data over. > > [I just described PASV-mode ftp, normal-mode FTP is just the > same only the client does the listening] > > See? Very complicated compared to: > > class simple_file_transfer_channel: > def __init__ (self, conn): > self.set_terminator ('\r\n') > > [...] > def found_terminator (self): > self.buffer, filename = '', self.buffer > self.push_with_producer (hypothetical_filename_producer (filename)) > > [...] > > In the above, you could request a file like this: > > $ telnet mymachine 9021 > /etc/resolv.conf > [... contents of /etc/resolv.conf ...] > > Hope that helps! > > -Sam > From Amos@d... Wed Mar 29 02:12:39 2000 From: Amos@d... (Amos Latteier) Date: Tue, 28 Mar 2000 21:12:39 -0500 Subject: [medusa] select.error -- Interrupted system call Message-ID: <613145F79272D211914B0020AFF640193204EB@g...> Hi, I've got a report from a Zope user who is getting: select.error exception: (4, 'Interrupted system call') This occurs in asyncore.poll. It seems likely that this is related to using ZOracleDA. Does anyone have any ideas about what is causing this? -Amos -- Amos Latteier mailto:amos@d... Digital Creations http://www.digicool.com From rushing@n... Wed Mar 29 01:57:44 2000 From: rushing@n... (Sam Rushing) Date: Tue, 28 Mar 2000 17:57:44 -0800 (PST) Subject: [medusa] select.error -- Interrupted system call In-Reply-To: <613145F79272D211914B0020AFF640193204EB@g...> References: <613145F79272D211914B0020AFF640193204EB@g...> Message-ID: <14561.25368.129791.680648@s...> Amos Latteier writes: > Hi, > > I've got a report from a Zope user who is getting: > > select.error exception: (4, 'Interrupted system call') > > This occurs in asyncore.poll. It seems likely that this is related to > using ZOracleDA. > > Does anyone have any ideas about what is causing this? select() is supposed to return immediately whenever any signal is sent to the process. I usually avoid using signals, but have put handlers in some applications; I don't think I've had this problem before. What operating system? -Sam From rushing@e... Thu Apr 20 21:11:49 2000 From: rushing@e... (Sam Rushing) Date: Thu, 20 Apr 2000 13:11:49 -0700 (PDT) Subject: asyncore.poll() in C Message-ID: <14591.25733.420692.154681@s...> Andy Dustman has recently written a version of asyncore.poll() in C, it's still in alpha but looks interesting! ad> I was wondering if you ever heard of or tried my own asyncore ad> tweak, which is a C module that replaces asyncore.poll. (It ad> still does a select() call internally.) It also does almost ad> the same thing as your fdcache tweak, except it stores { ad> object: fd }. Since you are benchmarking things, I thought it ad> might be worth taking a look. ad> ad> http://dustman.net/andy/python/asyncore I've also placed a link on the main medusa page... -Sam From ngps@p... Fri Apr 28 16:37:14 2000 From: ngps@p... (Ng Pheng Siong) Date: Fri, 28 Apr 2000 23:37:14 +0800 Subject: [ngps@p...: [ANNOUNCE] ZServerSSL 0.04] Message-ID: <20000428233714.C684@m...> Hello, Pardon the spam. I believe the following might be of interest to Medusa users and hackers. ----- Forwarded message from Ng Pheng Siong ----- Date: Wed, 26 Apr 2000 00:28:12 +0800 From: Ng Pheng Siong To: zope-dev@z... Subject: [ANNOUNCE] ZServerSSL 0.04 X-Mailer: Mutt 1.0i Hello, I am pleased to announce the release of ZServerSSL 0.04. ZServerSSL provides a HTTPS server for Zope. In normal operation, ZServerSSL protects user names, passwords and data in transit against eavesdropping. This release of ZServerSSL presents a significant enhancement: X.509 certificate-based authentication for Zope. In this mode, Zope is run in "remote user" mode, and ZServerSSL's HTTPS server is configured to *require* user certificates. When a user connects, ZServerSSL handles certificate verification, maps the user certificate's "subject distinguished name" to a Zope username and sets REMOTE_USER accordingly. Zope's REMOTE_USER machinery takes care of the rest. Given valid user certificates and mappings from certificates to Zope users, Zope no longer requires passwords for access. This improves site security by removing the need to store passwords on the Zope site. This mode of operation can be adapted to other HTTPS servers like Apache+SSL, Roxen+SSL, etc. that perform certificate-based authentication. ZServerSSL is bundled with the latest snapshot of M2Crypto, and is also available as a separate package. It can be downloaded from here: http://www.post1.com/home/ngps/m2 Usual disclaimers apply. Feedback is very much appreciated. Cheers. -- Ng Pheng Siong * http://www.post1.com/home/ngps (BTW, what's this about no cross-posting btw zope-dev and zope?) ----- End forwarded message ----- -- Ng Pheng Siong * http://www.post1.com/home/ngps From jilanik@t... Fri Jun 2 10:01:53 2000 From: jilanik@t... (Jilani Khaldi) Date: Fri, 02 Jun 2000 11:01:53 +0200 Subject: How to keep python interpreter persistent? Message-ID: <39377801.A0C88677@t...> Hi All, I am new to medusa and I really like it. I wonder if it is possible to have only one instance of python interpreter for all cgi scripts. Jilani -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From robin@j... Fri Jun 2 10:21:52 2000 From: robin@j... (Robin Becker) Date: Fri, 2 Jun 2000 10:21:52 +0100 Subject: [medusa] How to keep python interpreter persistent? In-Reply-To: <39377801.A0C88677@t...> References: <39377801.A0C88677@t...> Message-ID: In article <39377801.A0C88677@t...>, Jilani Khaldi writes >Hi All, >I am new to medusa and I really like it. I wonder if it is possible to >have only one instance of python interpreter for all cgi scripts. > >Jilani > >-- > ... certainly medusa is the basis of Zope's ZServer and they have something called pcgi README notes for Persistent CGI - version 2.0 alpha 4 What it is? Persistent CGI is an architecture designed by Digital Creations http://www.digicool.com to publish web objects as long-running processes. The pcgi component is an integral part of DC's Principia product, but is also provided to Bobo developers under open software terms. Please review the copyright appearing in the source code for full details. -- Robin Becker From rushing@n... Fri Jun 2 23:00:08 2000 From: rushing@n... (Sam Rushing) Date: Fri, 2 Jun 2000 15:00:08 -0700 (PDT) Subject: [medusa] How to keep python interpreter persistent? In-Reply-To: <39377801.A0C88677@t...> References: <39377801.A0C88677@t...> Message-ID: <14648.11880.530963.26625@s...> Jilani Khaldi writes: > I am new to medusa and I really like it. I wonder if it is possible > to have only one instance of python interpreter for all cgi > scripts. This is one of the main ideas behind medusa, to keep the server running in a single process in order to make it easy to maintain state. Take a look at medusa/script_handler.py, and the files in the script_handler_demo.py directory. The main drawback with Medusa's 'CGI' model is that it can't be used for processing that would 'block' the rest of the server. Processing should be quick. For example, building a medusa server around a bsddb works well, but you can't (easily) make connections to an external SQL database, process, or server where the queries might take on the order of seconds. To solve that problem, check out the eGroups coroutine stuff here: http://www.nightmare.com/~rushing/copython/index.html -Sam From martinb@e... Fri Jun 2 23:13:36 2000 From: martinb@e... (Martin Baker) Date: Fri, 2 Jun 2000 15:13:36 -0700 (PDT) Subject: [medusa] How to keep python interpreter persistent? In-Reply-To: <14648.11880.530963.26625@s...> Message-ID: On Fri, 2 Jun 2000, Sam Rushing wrote: > To solve that problem, check out the eGroups coroutine stuff here: > > http://www.nightmare.com/~rushing/copython/index.html You can find more details (including an explanation of coroutines and links to the assembler coroutine package) in the README at http://www.egroups.com/files/python-coro/egroups/README-2000-04-24.txt The software itself is available at http://www.egroups.com/files/python-coro/egroups/egp-coro-20000424.tar.gz Martin PS Sam, you can add a link to the tar file (now available in a truly "public" manner). From jilanik@t... Sun Jun 4 16:13:05 2000 From: jilanik@t... (Jilani Khaldi) Date: Sun, 04 Jun 2000 17:13:05 +0200 Subject: medusa as a service on NT Message-ID: <393A7201.4B2AF8F7@t...> Hi All, how to get medusa working as a service on NT Server? Thanks. -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From jilanik@t... Sun Jun 4 16:13:17 2000 From: jilanik@t... (Jilani Khaldi) Date: Sun, 04 Jun 2000 17:13:17 +0200 Subject: Problems with medusa Message-ID: <393A720D.CFC15DD2@t...> Hi All, I have installed medusa on my Linux (Slackware 7.0). No problem for installation and to get it running. But when a access to it from a browser (Netscape - Windows), I get this error: ////////////////// error: Problem with DNS lookup (socket.error:(111, 'Connection refused') [asyncore.py|poll|75] [asyncore.py|handle_read_event|327] [resolver.py|handle_read|264] //////////////// my settings are: HOSTNAME = 'bellatrix.antares.it' IP_ADDRESS = '192.168.1.1' PUBLISHING_ROOT = '/home/www' I have the same problem with medusa installed in local on Windows2000 Pro. However, I can call the HTML pages from the browser, but I get the error, not on the browser, but on the console. What am I missing. Thanks. -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From jam@q... Sun Jun 4 16:26:12 2000 From: jam@q... (Jeff) Date: Sun, 4 Jun 2000 11:26:12 -0400 Subject: [medusa] Problems with medusa In-Reply-To: <393A720D.CFC15DD2@t...>; from jilanik@t... on Sun, Jun 04, 2000 at 05:13:17PM +0200 References: <393A720D.CFC15DD2@t...> Message-ID: <20000604112612.A20223@q...> On Sun, Jun 04, 2000 at 05:13:17PM +0200, Jilani Khaldi wrote: > Hi All, > I have installed medusa on my Linux (Slackware 7.0). No problem for > installation and to get it running. But when a access to it from a > browser (Netscape - Windows), I get this error: > > ////////////////// > error: Problem with DNS lookup (socket.error:(111, 'Connection refused') > [asyncore.py|poll|75] [asyncore.py|handle_read_event|327] > [resolver.py|handle_read|264] > //////////////// > medusa is attempting to perform a hostname lookup by connecting to (presumably) 'localhost'. what is the setup of your network? regards, J -- || visit gfd || psa member -- From jilanik@t... Sun Jun 4 20:49:43 2000 From: jilanik@t... (Jilani Khaldi) Date: Sun, 04 Jun 2000 21:49:43 +0200 Subject: [medusa] Problems with medusa References: <393A720D.CFC15DD2@t...> <20000604112612.A20223@q...> Message-ID: <393AB2D7.4D825926@t...> Jeff wrote: > On Sun, Jun 04, 2000 at 05:13:17PM +0200, Jilani Khaldi wrote: > > Hi All, > > I have installed medusa on my Linux (Slackware 7.0). No problem for > > installation and to get it running. But when a access to it from a > > browser (Netscape - Windows), I get this error: > > > > ////////////////// > > error: Problem with DNS lookup (socket.error:(111, 'Connection refused') > > [asyncore.py|poll|75] [asyncore.py|handle_read_event|327] > > [resolver.py|handle_read|264] > > //////////////// > > > > medusa is attempting to perform a hostname lookup by connecting to > (presumably) 'localhost'. what is the setup of your network? - Linux (Slackware 7.0) as server running medusa | HOSTNAME = 'bellatrix.antares.it' | # This is the IP address of the network interface you want | # your servers to be visible from. This can be changed to '' | # to listen on all interfaces. | IP_ADDRESS = '192.168.1.1' | | # Root of the http and ftp server's published filesystems. | PUBLISHING_ROOT = '/home/www' | | HTTP_PORT = 8080 # The standard port is 80 | FTP_PORT = 8021 # The standard port is 21 | CHAT_PORT = 8888 | MONITOR_PORT = 9999 Thse are my settings. -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From rushing@n... Sun Jun 4 22:31:24 2000 From: rushing@n... (Sam Rushing) Date: Sun, 4 Jun 2000 14:31:24 -0700 (PDT) Subject: [medusa] medusa as a service on NT In-Reply-To: <393A7201.4B2AF8F7@t...> References: <393A7201.4B2AF8F7@t...> Message-ID: <14650.51884.412494.422077@s...> Jilani Khaldi writes: > Hi All, > how to get medusa working as a service on NT Server? I think there's a utility in the NT resource kit that can be used to turn any console app into a service. -Sam From rushing@n... Sun Jun 4 22:33:42 2000 From: rushing@n... (Sam Rushing) Date: Sun, 4 Jun 2000 14:33:42 -0700 (PDT) Subject: [medusa] Problems with medusa In-Reply-To: <393A720D.CFC15DD2@t...> References: <393A720D.CFC15DD2@t...> Message-ID: <14650.52022.135912.748187@s...> Jilani Khaldi writes: > Hi All, > I have installed medusa on my Linux (Slackware 7.0). No problem for > installation and to get it running. But when a access to it from a > browser (Netscape - Windows), I get this error: > > ////////////////// > error: Problem with DNS lookup (socket.error:(111, 'Connection refused') > [asyncore.py|poll|75] [asyncore.py|handle_read_event|327] > [resolver.py|handle_read|264] > //////////////// > > my settings are: > HOSTNAME = 'bellatrix.antares.it' > IP_ADDRESS = '192.168.1.1' > PUBLISHING_ROOT = '/home/www' > > I have the same problem with medusa installed in local on > Windows2000 Pro. However, I can call the HTML pages from the > browser, but I get the error, not on the browser, but on the > console. What am I missing. Did you point the resolver at a local DNS server? There's a line in 'start_medusa.py' that looks like this: rs = resolver.caching_resolver ('127.0.0.1') It assumes there's a name server running on the local machine, but if there's not you should put the IP address of your local DNS server in there instead. Alternatively you could probably do this: rs = None Which would tell the HTTP server not to try to resolve addresses at all. -Sam From jam@q... Mon Jun 5 00:48:36 2000 From: jam@q... (Jeff) Date: Sun, 4 Jun 2000 19:48:36 -0400 Subject: [medusa] Problems with medusa In-Reply-To: <393AB2D7.4D825926@t...>; from jilanik@t... on Sun, Jun 04, 2000 at 09:49:43PM +0200 References: <393A720D.CFC15DD2@t...> <20000604112612.A20223@q...> <393AB2D7.4D825926@t...> Message-ID: <20000604194836.B20223@q...> On Sun, Jun 04, 2000 at 09:49:43PM +0200, Jilani Khaldi wrote: > - Linux (Slackware 7.0) as server running medusa do you have a 'bind' or /etc/hosts file? can you run 'host hellatrix.atares.it' and get a valid response? > | HOSTNAME = 'bellatrix.antares.it' does the problem go away if you change this to the ipaddress of the machine? is the machine behind a dialup connection? hmm.. maybe I'm barking up the wrong tree, but this really seems like a DNS problem to me. regards, J -- || visit gfd || psa member -- From jilanik@t... Mon Jun 5 09:48:01 2000 From: jilanik@t... (Jilani Khaldi) Date: Mon, 05 Jun 2000 10:48:01 +0200 Subject: Information about "Client_IP_Adress:Mysterious_Number" References: <393A720D.CFC15DD2@t...> <14650.52022.135912.748187@s...> Message-ID: <393B6940.A2A206BB@t...> Sam Rushing wrote: > Did you point the resolver at a local DNS server? There's a line > in 'start_medusa.py' that looks like this: > > rs = resolver.caching_resolver ('127.0.0.1') > > It assumes there's a name server running on the local machine, but if > there's not you should put the IP address of your local DNS server > in there instead. > > Alternatively you could probably do this: > > rs = None > > Which would tell the HTTP server not to try to resolve addresses at > all. Done! Thank you. Now everything seems to work fine. Everytime I open a web page I see on the monitor: IP_Address of the client + ':' + an other number which changes when I go on a new page. What does that number mean and how can I call it (know it) from a python script? Could that number (+ client IP_Address) be used to controll sessions? Jilani -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From jilanik@t... Mon Jun 5 12:26:46 2000 From: jilanik@t... (Jilani Khaldi) Date: Mon, 05 Jun 2000 13:26:46 +0200 Subject: python cgi scripts with medusa. How? Message-ID: <393B8E76.E1C7D8DD@t...> Hi, is it possible to write cgi scripts in python with medusa? If yes, tell me please how. ps. I have medusa installed on a Linux box at "/medusa" and html pages at "/home/www" -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From rushing@n... Mon Jun 5 12:31:47 2000 From: rushing@n... (Sam Rushing) Date: Mon, 5 Jun 2000 04:31:47 -0700 (PDT) Subject: [medusa] Information about "Client_IP_Adress:Mysterious_Number" In-Reply-To: <393B6940.A2A206BB@t...> References: <393A720D.CFC15DD2@t...> <14650.52022.135912.748187@s...> <393B6940.A2A206BB@t...> Message-ID: <14651.36771.771039.450948@s...> Jilani Khaldi writes: > Now everything seems to work fine. Everytime I open a web page I > see on the monitor: IP_Address of the client + ':' + an other > number which changes when I go on a new page. What does that > number mean and how can I call it (know it) from a python script? > Could that number (+ client IP_Address) be used to controll > sessions? If you're using the class, then you can access the object directory to find out the IP and port number of each connection. (something like request.channel.socket.getpeername() ought to work) However, using the ip:port pair is not a reliable way of tracking a user, because for example many users will come through a proxy. [i.e., they will be sharing the IP address with potentially thousands of other people]. The only reliable way to track users is to either use 'cookies': http://home.netscape.com/newsref/std/cookie_spec.html Or to use forms with hidden variables. [i.e., http://my_host/my_uri?id=29348392] -Sam From ray@u... Mon Jun 5 23:13:29 2000 From: ray@u... (Ray Price) Date: Mon, 05 Jun 2000 22:13:29 -0000 Subject: implications of asyncore.loop() timeout change Message-ID: <8hh8m9+blf5@e...> I've got a Linux Medusa server returning http pages via a Solaris Apache script (written in python to act as a proxy). For some reason the client does not see the complete page for 15-30 seconds. So, I went in and changed the asyncore.loop() timeout value from 30.0 to 0.5 and now pages are returned very quickly. The question is: what implications should I beware of when changing the timeout value in this way. FYI the asyncore module is shared between several other servers running XML-RPC and mxODBC. Before I made the timeout change, a client requesting a page directly from the Medusa server would 'free the stuck' page back to the proxy. Thanks for your comments, Ray From rushing@n... Mon Jun 5 23:22:55 2000 From: rushing@n... (Sam Rushing) Date: Mon, 5 Jun 2000 15:22:55 -0700 (PDT) Subject: [medusa] implications of asyncore.loop() timeout change In-Reply-To: <8hh8m9+blf5@e...> References: <8hh8m9+blf5@e...> Message-ID: <14652.10303.157403.860134@s...> Ray Price writes: > I've got a Linux Medusa server returning http pages via a Solaris > Apache script (written in python to act as a proxy). For some reason > the client does not see the complete page for 15-30 seconds. I'm not sure I understand the setup. The Apache server is not really involved, is it? It is generating pages with anchors pointing at the other server (on a different port or machine?). Are you calling 'request.done()' when finished generating the page? Sounds like there's a delay in closing the connection? > So, I went in and changed the asyncore.loop() timeout value from 30.0 > to 0.5 and now pages are returned very quickly. The timeout value represents how long (max) the select() loop will wait for anything to happen. If nothing happens, then the server will sit idle (not consuming CPU) until the timeout expires. > The question is: what implications should I beware of when changing > the timeout value in this way. FYI the asyncore module is shared > between several other servers running XML-RPC and mxODBC. by lowering the timeout, you create more busy-work for the server. It has to run through all the objects every 1/2 second rather than whenever there's activity. If your server is really busy (events come in at an average of 1/2 second anyway), then there won't be much of an impact. > Before I made the timeout change, a client requesting a page directly > from the Medusa server would 'free the stuck' page back to the proxy. Yes, because the activity on the server socket would 'wake up' the select() call. Sounds like something's getting 'stuck'. If you can, send me the code that generates the stuck page. -Sam From jilanik@t... Tue Jun 6 19:31:47 2000 From: jilanik@t... (Jilani Khaldi) Date: Tue, 06 Jun 2000 20:31:47 +0200 Subject: Medusa and web application Message-ID: <393D4393.FC3114AF@t...> Hi, could somebody points how to write web application using medusa and python? Please not tell me about Zope, it is huge and time consuming. Thank you Jilani -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From ppetru@c... Tue Jun 6 19:45:05 2000 From: ppetru@c... (Petru Paler) Date: Tue, 6 Jun 2000 21:45:05 +0300 (EEST) Subject: [medusa] Medusa and web application In-Reply-To: <393D4393.FC3114AF@t...> Message-ID: > could somebody points how to write web application using medusa and > python? > Please not tell me about Zope, it is huge and time consuming. (no intention to start a flamewar here) Contrary of what you think, Zope saves you a *big* amount of time compared to what you'd spend building by yourself. It is so big because of the large number of features it offers. -Petru From jilanik@t... Wed Jun 7 11:00:20 2000 From: jilanik@t... (Jilani Khaldi) Date: Wed, 07 Jun 2000 12:00:20 +0200 Subject: Medusa and web applications on Linux&C magazine References: Message-ID: <393E1D34.D56E01A5@t...> > (no intention to start a flamewar here) > Contrary of what you think, Zope saves you a *big* amount of time compared > to what you'd spend building by yourself. It is so big because of the > large number of features it offers. You are right Petru, but Zope is only apparently easy, and once you have a problem it will be very difficult to solve, seen the compexity of the product. All in Zope would be saved in a database and if your database is go corrupted, you loose everything and it is not a nice thing. PHP and Apache are very flexible, but I need a solution made at home using medusa as web server and python. A simple and homogeneous solution to pubblish on Linux&C (http://www.oltrelinux.com), the first italian magazine dedicated to Linux and FreeBSD. For the moment I am writing a series of articles about Interbase-Apache-PHP for web applications development, and I think the next articles will be about GadFly-medusa-python for small web applications.We have more than 30.000 readers monthly, so it will be interesting to promove medusa this way. Our goal is to promove freeware and open source; but all freeware and open source. Apache doesn't need any more tam tam, but small and interesting software like medusa need to be much more known. I am still wainting for help to go on. Any help will be welcome. Thank you. Jilani -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From paul@d... Wed Jun 7 13:30:07 2000 From: paul@d... (Paul Everitt) Date: Wed, 7 Jun 2000 08:30:07 -0400 Subject: [medusa] Medusa and web applications on Linux&C magazine Message-ID: <613145F79272D211914B0020AFF64019713527@g...> Jilani wrote: > You are right Petru, but Zope is only apparently easy, and > once you have a > problem it will be very difficult to solve, seen the > compexity of the product. > All in Zope would be saved in a database and if your database This isn't true. Skip Montanaro (long-time Python insider) doesn't use the object database. He just uses the publisher and template portion. That's why everything is arranged as Python packages. To be modular. You can use the publisher, the template system, and the object database independently of each other. > is go corrupted, > you loose everything and it is not a nice thing. PHP and > Apache are very > flexible, but I need a solution made at home using medusa as > web server and > python. A simple and homogeneous solution to pubblish on Linux&C > (http://www.oltrelinux.com), the first italian magazine > dedicated to Linux and Heh heh, you should check out: http://www.zopeit.org/ > FreeBSD. For the moment I am writing a series of articles about > Interbase-Apache-PHP for web applications development, and I > think the next > articles will be about GadFly-medusa-python for small web > applications.We have > more than 30.000 readers monthly, so it will be interesting > to promove medusa > this way. That's fine to have an agenda, but at least > Our goal is to promove freeware and open source; but all > freeware and open > source. Apache doesn't need any more tam tam, but small and > interesting > software like medusa need to be much more known. > I am still wainting for help to go on. Any help will be welcome. It's OK to have an agenda (promote Medusa). At least, though, don't say things about Zope that aren't true (such as your statement above about the object database). --Paul From rprice@u... Wed Jun 7 17:42:19 2000 From: rprice@u... (rprice@u...) Date: Wed, 7 Jun 2000 09:42:19 -0700 Subject: [medusa] Medusa and web applications on Linux&C magazine Message-ID: <882568F7.005B6FC6.00@b...> Hi, I'm another Zope user that only uses the publisher and template modules. Couldn't be happier. Ray Paul Everitt on 06/07/2000 05:30:07 AM Please respond to medusa@egroups.com To: medusa@egroups.com cc: (bcc: Ray Price/UAI) Subject: RE: [medusa] Medusa and web applications on Linux&C magazine Jilani wrote: > You are right Petru, but Zope is only apparently easy, and > once you have a > problem it will be very difficult to solve, seen the > compexity of the product. > All in Zope would be saved in a database and if your database This isn't true. Skip Montanaro (long-time Python insider) doesn't use the object database. He just uses the publisher and template portion. That's why everything is arranged as Python packages. To be modular. You can use the publisher, the template system, and the object database independently of each other. > is go corrupted, > you loose everything and it is not a nice thing. PHP and > Apache are very > flexible, but I need a solution made at home using medusa as > web server and > python. A simple and homogeneous solution to pubblish on Linux&C > (http://www.oltrelinux.com), the first italian magazine > dedicated to Linux and Heh heh, you should check out: http://www.zopeit.org/ > FreeBSD. For the moment I am writing a series of articles about > Interbase-Apache-PHP for web applications development, and I > think the next > articles will be about GadFly-medusa-python for small web > applications.We have > more than 30.000 readers monthly, so it will be interesting > to promove medusa > this way. That's fine to have an agenda, but at least > Our goal is to promove freeware and open source; but all > freeware and open > source. Apache doesn't need any more tam tam, but small and > interesting > software like medusa need to be much more known. > I am still wainting for help to go on. Any help will be welcome. It's OK to have an agenda (promote Medusa). At least, though, don't say things about Zope that aren't true (such as your statement above about the object database). --Paul ------------------------------------------------------------------------ Remember Father's Day Is June 18th Click Here For Great Gifts! http://click.egroups.com/1/5037/10/_/1360/_/960380985/ ------------------------------------------------------------------------ From edcjones@e... Thu Jun 15 16:22:36 2000 From: edcjones@e... (Edward C. Jones) Date: Thu, 15 Jun 2000 15:22:36 -0000 Subject: Newbie: "http://localhost" problem Message-ID: <8iasbs+1tpn@e...> I have put Medusa on my RedHat 6.1 Linux system. I started the demo program "publish.py". What can I now access through Netscape and how do I access it? What changes do I need to make in the Medusa defaults, the Netscape Preferences, and the Linux system configuration files? Currently "/etc/hosts.allow" and "/etc/hosts.deny" are empty and "/etc/hosts" contains "127.0.0.1 localhost localhost.localdomain". Thanks, Ed Jones From edcjones@e... Fri Jun 16 02:11:55 2000 From: edcjones@e... (Edward C. Jones) Date: Fri, 16 Jun 2000 01:11:55 -0000 Subject: Newbie: "http://localhost" problem In-Reply-To: <8iasbs+1tpn@e...> Message-ID: <8ibusr+i8hp@e...> --- In medusa@egroups.com, "Edward C. Jones" wrote: > I have put Medusa on my RedHat 6.1 Linux system. I started the demo > program "publish.py". What can I now access through Netscape and how > do I access it? What changes do I need to make in the Medusa defaults, > the Netscape Preferences, and the Linux system configuration files? > Currently "/etc/hosts.allow" and "/etc/hosts.deny" are empty and > "/etc/hosts" contains "127.0.0.1 localhost localhost.localdomain". As usual when I am a newbie in anything, questions always seem to take two days to answer, and the answers are simple. On my system, Netscape and Lynx use the port 8000 while the Medusa default is 8080. The answer is: "http://localhost:8080/...". No changes in system configuration or preferences files were needed. From henken@s... Sat Jun 24 18:03:39 2000 From: henken@s... (Nicholas Henke) Date: Sat, 24 Jun 2000 17:03:39 -0000 Subject: Weird CGI problem. Message-ID: <8j2plb+p439@e...> Hello, I have medusa setup and runnign just fine for serving webpages, but with a python script I have written, there seem to be some problems. It is a simple form based cgi that parses the input, and then ouputs a newpage based on the input. What is happening is that the script is getting called twice. There is a log message in the console window that medusa was started from that tells me there was an" error: uncaptured python exception, closing channel (socket.error:(32, 'Broken pipe') [asynchat.py|handle_read|80] [http_server.py|recv|397] [asyncore.py|recv|293]) " There is a line after this message that indicated that the script is getting called again. The second time it gets called, it seems to work just fine. I know the script works just fine for Apache, but I have no idea on how to start debugging medusa to see what is happening? Any ideas? Thanks ahead of time for any and all help Nicholas Henke From rushing@n... Sat Jun 24 19:08:54 2000 From: rushing@n... (Sam Rushing) Date: Sat, 24 Jun 2000 11:08:54 -0700 (PDT) Subject: [medusa] Weird CGI problem. In-Reply-To: <8j2plb+p439@e...> References: <8j2plb+p439@e...> Message-ID: <14676.63798.659539.260331@s...> Nicholas Henke writes: > There is a log message in the console window that medusa was > started from that tells me there was an" error: uncaptured python > exception, closing channel 165.123.102.198:4666 at 8172ea0 channel#: 1 requests:1> > (socket.error:(32, 'Broken pipe') [asynchat.py|handle_read|80] > [http_server.py|recv|397] [asyncore.py|recv|293]) " > There is a line after this message that indicated that the script > is getting called again. The second time it gets called, it seems > to work just fine. I know the script works just fine for Apache, > but I have no idea on how to start debugging medusa to see what is > happening? Any ideas? Is the second hit showing up on the same port number? It's possible that you're just seeing the log entry for the aborted connection. 'Broken Pipe' is the error you'll see whenever the connection is aborted by the browser side, which can happen if the user follows another link or hits the stop button before the page is finished loading. Does the problem show up on every hit to the script, or just occasionally? -Sam From henken@s... Sat Jun 24 19:14:39 2000 From: henken@s... (Nicholas Henke) Date: Sat, 24 Jun 2000 14:14:39 -0400 Subject: [medusa] Weird CGI problem. References: <8j2plb+p439@e...> <14676.63798.659539.260331@s...> Message-ID: <3954FA8F.A4A8C7BE@s...> Sam Rushing wrote: [SNIP] > > Is the second hit showing up on the same port number? It's possible > that you're just seeing the log entry for the aborted connection. Nope different port number It acutally looks like the script fails, and then gets called again > 'Broken Pipe' is the error you'll see whenever the connection is > aborted by the browser side, which can happen if the user follows > another link or hits the stop button before the page is finished > loading. Nothing doing...just waiting for execution > Does the problem show up on every hit to the script, or just > occasionally? > Every time... Hope this helps narrow it down. I wouldnt worry about it too much though, as I think I have found a solution. I have switched to using the simple CGI and HTTP servers included in the python distibution thanks again Nic -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The problem with the gene pool is that there is no lifeguard. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The dumber people think you are, the more surprised they will be when you kill them. From kbd@i... Thu Jul 6 13:42:33 2000 From: kbd@i... (Keith Davidson) Date: Thu, 06 Jul 2000 12:42:33 -0000 Subject: Interrupted system call issues Message-ID: <8k1urp+2cm2@e...> In order to get Medusa to play nicely in an application that uses SIGALRM, I had to make some changes to asyncore.py. Basically the change causes EINTR to be ignored if it is raised during the select (). According to "UNIX Network Programming" pg 124, it is ok to restart accept(), read(), write(), select(), etc after an EINTR. My questions... 1) Is simply ignoring the exception the right way to 'restart' the select() call? 2) Any other options for making Medusa work in an app with SIGALRM (no... I can't get rid of the SIGALRMs ;-). 3) Any possibility of incorporating this into the official version of Medusa if all the networking gurus agree it is correct? Thanks! Keith 35d34 < EINTR = 10004 43c42 < from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, ENOTCONN, ESHUTDOWN, EINTR --- > from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, ENOTCONN, ESHUTDOWN 56,61c55 < while 1: < try: < (r,w,e) = select.select (r,w,e, timeout) < break < except select.error, (errno, errstr): < if errno != EINTR: raise --- > (r,w,e) = select.select (r,w,e, timeout) From akuchlin@m... Thu Jul 6 23:05:21 2000 From: akuchlin@m... (Andrew Kuchling) Date: Thu, 06 Jul 2000 18:05:21 -0400 Subject: Adding poll() to Python 2.0 Message-ID: I'm looking at Medusa for work-related reasons, and noticed pollmodule.c on the Medusa page; I'd like to see the poll() function get into Python 2.0 (probably added to the posix module, judging by the reactions so far). Any objections? And who wrote pollmodule.c in the first place? --amk From vshkap01@h... Fri Jul 7 06:48:10 2000 From: vshkap01@h... (vshkap01@h...) Date: Fri, 07 Jul 2000 05:48:10 -0000 Subject: asyncore & asynchat implementation in C++ Message-ID: <8k3quq+kcb0@e...> Are there any plans to update the C++ version of the library. The file dates of cpp files are all 1996 compared with frequent updates of python version. Thanks for the comments, Vlad From akuchlin@m... Fri Jul 7 22:19:57 2000 From: akuchlin@m... (Andrew Kuchling) Date: Fri, 07 Jul 2000 17:19:57 -0400 Subject: Python 2.0 asyncore and asynchat.py Message-ID: I noticed the asyncore and asynchat.py in the Python CVS tree aren't the same as the ones in the most recent Medusa code. Should they be resynced so Python's copies are up-to-date? (Note that the ones in the Python CVS tree have had docstrings added to them; that change should be pulled into Sam's master copy of the source.) --amk From jim@d... Mon Jul 10 14:08:19 2000 From: jim@d... (Jim Fulton) Date: Mon, 10 Jul 2000 09:08:19 -0400 Subject: [medusa] Python 2.0 asyncore and asynchat.py References: Message-ID: <3969CAC3.B5F289BC@d...> Andrew Kuchling wrote: > > I noticed the asyncore and asynchat.py in the Python CVS tree aren't > the same as the ones in the most recent Medusa code. Should they be > resynced so Python's copies are up-to-date? Absolutely. They should only be in the standard distribution if they are maintained there. Jim -- Jim Fulton mailto:jim@d... Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From rushing@n... Tue Jul 11 04:35:20 2000 From: rushing@n... (Sam Rushing) Date: Mon, 10 Jul 2000 20:35:20 -0700 (PDT) Subject: [medusa] Adding poll() to Python 2.0 In-Reply-To: References: Message-ID: <14698.38392.921079.87711@s...> Andrew Kuchling writes: > I'm looking at Medusa for work-related reasons, and noticed > pollmodule.c on the Medusa page; I'd like to see the poll() > function get into Python 2.0 (probably added to the posix module, > judging by the reactions so far). Any objections? And who wrote > pollmodule.c in the first place? I wrote that particular pollmodule.c, I don't know if there are others. I think the idea of putting it into the posix module is a good one, actually: we have never used the poll support at eGroups simply because we have another module named 'poll' that does something completely unrelated. Probably a pretty common problem. [I was about to ask about moving select() over there, too, but I see that this has already started a discussion on python-dev] -Sam From rushing@n... Tue Jul 11 04:36:38 2000 From: rushing@n... (Sam Rushing) Date: Mon, 10 Jul 2000 20:36:38 -0700 (PDT) Subject: [medusa] asyncore & asynchat implementation in C++ In-Reply-To: <8k3quq+kcb0@e...> References: <8k3quq+kcb0@e...> Message-ID: <14698.38470.724666.67188@s...> vshkap01@h... writes: > Are there any plans to update the C++ version of the library. The > file dates of cpp files are all 1996 compared with frequent updates > of python version. Not that I know of. It's possible that Digital Creations is using that code (I think I originally wrote it for them?). I bet the moving-target nature of STL means it'll require some header renaming/juggling to get it to work nowadays. -Sam From akuchlin@c... Tue Jul 11 11:14:32 2000 From: akuchlin@c... (Andrew Kuchling) Date: Tue, 11 Jul 2000 06:14:32 -0400 Subject: [medusa] Adding poll() to Python 2.0 In-Reply-To: <14698.38392.921079.87711@s...>; from rushing@n... on Mon, Jul 10, 2000 at 08:35:20PM -0700 References: <14698.38392.921079.87711@s...> Message-ID: <20000711061432.A4222@n...> On Mon, Jul 10, 2000 at 08:35:20PM -0700, Sam Rushing wrote: >others. I think the idea of putting it into the posix module is a >good one, actually: we have never used the poll support at eGroups OK; I'm working on a patch and will submit it once it's ready. >[I was about to ask about moving select() over there, too, but I see > that this has already started a discussion on python-dev] The consensus here was that, while select() would probably go in posix if we could do it all over again, there's not much point in moving it now. The time machine has a broken dimensional stabilizer at the moment... --amk From jim@d... Tue Jul 11 13:52:41 2000 From: jim@d... (Jim Fulton) Date: Tue, 11 Jul 2000 08:52:41 -0400 Subject: [medusa] asyncore & asynchat implementation in C++ References: <8k3quq+kcb0@e...> <14698.38470.724666.67188@s...> Message-ID: <396B1899.B6A9C57D@d...> Sam Rushing wrote: > > vshkap01@h... writes: > > Are there any plans to update the C++ version of the library. The > > file dates of cpp files are all 1996 compared with frequent updates > > of python version. > > Not that I know of. It's possible that Digital Creations is using > that code (I think I originally wrote it for them?). If you did, I never knew of it. ;) If I pade for it, I would have wanted it in something portable, like C. :) Jim -- Jim Fulton mailto:jim@d... Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From yp66@h... Thu Jul 20 15:18:40 2000 From: yp66@h... (yp66@h...) Date: Thu, 20 Jul 2000 14:18:40 -0000 Subject: EINPROGRESS Message-ID: <8l71o0+lus8@e...> I am making a client/server application on Linux Redhat 6.1 Python 5.2 (default redhat distro). Both the client and server are using asynchat.py When I use the (default setting) non-blocking client socket, a EINPROGRESS exception occurs in the connect method, self.connected will not be set to 1 and therefore the flush() method will not do anything (if I set self.connected=1 by hand afterwards, my application works like a charm) (on NT it will give a EWOULDBLOCK) Is there a simple example for a client/server implemented with asynchat at both sides (simpler than the proxy-example) or an explanation for my little problem. With regards, Jaap CLIENT (partial) class PClientSocket (asynchat.async_chat): def __init__ (self, address=(SERVERIP,SERVERSOCKET)): asynchat.async_chat.__init__ (self) self.set_terminator (None) self.create_socket (socket.AF_INET, socket.SOCK_STREAM) self.buffer = '' #self.simpleterminator() #self.setblocking(1) self.connect (address) print address print self.connected self.connected=1 ................... SERVER (partial) class PSocketServer( asyncore.dispatcher ): def __init__( self, pServer ): self.pServer = pizzaServer # Registator of all connections asyncore.dispatcher.__init__( self ) self.create_socket( socket.AF_INET, socket.SOCK_STREAM ) self.set_reuse_addr() here = ( LISTENIP, LISTENSOCKET ) self.bind( here ) self.listen( 5 ) def handle_accept( self ): PSocketReceiver( self, self.accept(), self.pServer) class PSocketReceiver( asynchat.async_chat ): def __init__( self, server, (conn, addr), pServer): asynchat.async_chat.__init__( self, conn ) self.simpleterminator() self.buffer=[] self.data=[] self.pConnAddress = addr log("connection attempt at ip %s port %d" % self.pConnAddress ) self.pClient = pServer.connect( self ) From rushing@n... Thu Jul 20 18:42:09 2000 From: rushing@n... (Sam Rushing) Date: Thu, 20 Jul 2000 10:42:09 -0700 (PDT) Subject: [medusa] EINPROGRESS In-Reply-To: <8l71o0+lus8@e...> References: <8l71o0+lus8@e...> Message-ID: <14711.14833.983399.61163@s...> yp66@h... writes: > I am making a client/server application on Linux Redhat 6.1 Python > 5.2 (default redhat distro). > Both the client and server are using asynchat.py > When I use the (default setting) non-blocking client socket, a > EINPROGRESS exception occurs in the connect method, self.connected > will not be set to 1 and therefore the flush() method will not do > anything > (if I set self.connected=1 by hand afterwards, my application works > like a charm) > > (on NT it will give a EWOULDBLOCK) It looks like you're relying on the connect() succeeding immediately? Which isn't always going to be the case. [on a really fast local network it can actually succeed before the call to connect() returns, but this is certainly luck] What asyncore will do is this: as soon as it sees a 'WRITE' event on that socket, it will set 'connected=1', and will call the 'handle_connect' method. This is where you will want to place the code that would normally come directly after a blocking call to connect(). > Is there a simple example for a client/server implemented with > asynchat at both sides (simpler than the proxy-example) or an > explanation for my little problem. A quick scan over the medusa sources shows rpc_client and rpc_server, if you ignore all the RPC stuff and pay attention to the asynchat-based classes, these are pretty vanilla examples. -Sam From butcuz@y... Wed Aug 16 04:10:40 2000 From: butcuz@y... (But Cuz) Date: Tue, 15 Aug 2000 20:10:40 -0700 (PDT) Subject: poor man's zope and medusa Message-ID: <20000816031040.23384.qmail@w...> Has anybody had any experience using Poor Man's Zope and Medusa? "PMZ is a small Python script that allows you to combine HTML and Python code. It is very similar to Microsoft Active Server Pages or PHP3 or PHP4. So you can easily integrate Python into your HTML pages" [quoted from (http://pmz.sourceforge.net) ] PMZ is currently documented to run as a cgi script on apache. I was wondering is there any way I could do something similar with medusa. A pure python implementation would be xtracool. Preemptive thanks for any responses, Leved Kuce butcuz@y... __________________________________________________ Do You Yahoo!? Yahoo! Mail – Free email you can access from anywhere! http://mail.yahoo.com/ From jmpadmore@y... Thu Aug 24 19:05:06 2000 From: jmpadmore@y... (John Padmore) Date: Thu, 24 Aug 2000 18:05:06 -0000 Subject: Medusa on NT Message-ID: <8o3o4i+d50t@e...> I am receiving a large number of errors trying access HTML documents via IE 5. It seems to work fine on linux, however when run on nt, its like medusa doesnt send back all of the images all of the time. Any ideas? thx ck ckolp@m... From rushing@n... Thu Aug 24 20:57:40 2000 From: rushing@n... (Sam Rushing) Date: Thu, 24 Aug 2000 12:57:40 -0700 (PDT) Subject: [medusa] Medusa on NT In-Reply-To: <8o3o4i+d50t@e...> References: <8o3o4i+d50t@e...> Message-ID: <14757.32308.51552.764778@s...> John Padmore writes: > I am receiving a large number of errors trying access HTML documents > via IE 5. > > It seems to work fine on linux, however when run on nt, its like > medusa doesnt send back all of the images all of the time. > > Any ideas? Could you send me medusa's log? That way I'd have some idea exactly what errors are being seen. You might try changing the logic to turn off support for http/1.1, let me know if that helps. -Sam From akuchlin@m... Thu Sep 7 15:34:31 2000 From: akuchlin@m... (Andrew Kuchling) Date: Thu, 07 Sep 2000 10:34:31 -0400 Subject: Updated versions of asyncore/asynchat Message-ID: I've reconciled the slight divergence between the versions of asyncore.py and asynchat.py in Sam's distribution and the Python CVS tree. The Python tree uses outdated versions, but it also added module docstrings and fixed a typo in a comment. Sam, could you please get the updated versions of the files from http://www.mems-exchange.org/software/files/working/ ? They make no code changes at all, simply the docstring and comment changes. (I can make a patch if you like.) I'll also submit a Python patch to update the modules. --amk From jim@d... Thu Sep 7 15:36:53 2000 From: jim@d... (Jim Fulton) Date: Thu, 07 Sep 2000 10:36:53 -0400 Subject: [medusa] Updated versions of asyncore/asynchat References: Message-ID: <39B7A805.24EC136A@d...> Much thanks for sorting this out. Jim Andrew Kuchling wrote: > > > I've reconciled the slight divergence between the versions of > asyncore.py and asynchat.py in Sam's distribution and the Python CVS > tree. The Python tree uses outdated versions, but it also added > module docstrings and fixed a typo in a comment. > > Sam, could you please get the updated versions of the files from > http://www.mems-exchange.org/software/files/working/ ? They make no > code changes at all, simply the docstring and comment changes. (I can > make a patch if you like.) I'll also submit a Python patch to update > the modules. > > --amk -- Jim Fulton mailto:jim@d... Technical Director (888) 344-4332 Python Powered! Digital Creations http://www.digicool.com http://www.python.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From rushing@n... Thu Sep 7 22:34:13 2000 From: rushing@n... (Sam Rushing) Date: Thu, 7 Sep 2000 14:34:13 -0700 (PDT) Subject: [medusa] Updated versions of asyncore/asynchat In-Reply-To: References: Message-ID: <14776.2517.602780.222969@s...> Andrew Kuchling writes: > Sam, could you please get the updated versions of the files from > http://www.mems-exchange.org/software/files/working/ ? They make no > code changes at all, simply the docstring and comment changes. (I can > make a patch if you like.) I'll also submit a Python patch to update > the modules. Great, thanks for doing this! All future edits will go through official channels. 8^) I suppose I should take them out of CVS here. I wonder if there's some way to tell CVS that those particular files belong to a different CVS server? -Sam From jim@d... Tue Sep 26 14:21:45 2000 From: jim@d... (Jim Fulton) Date: Tue, 26 Sep 2000 09:21:45 -0400 Subject: Question: killing/shuting down asyncore servers Message-ID: <39D0A2E9.5EEAC23@d...> Are there any recommendations for shutting down asyncore-based servers cleanly from outside the servers? - Can a clean signal handler be written to handle kill events? I tried writing a signal handler that closed all the entries in the socket map, but I have a feeling that this isn't working properly. One of the problems I want to solve is getting the socket I'm listening on to close cleanly so that it isn't in use when I restart the server. I suspect I could make this work with some sort of dedicated select trigger. I think it probably wants to be dedicated because, if I used an existing select trigger, I'd need to worry about the possability that the signal would interrupt I/O on the select trigger. - I suppose I could include a shutdown server, such that if connections were made to this server, the application would shut-down cleanly. I could obviously generalize this to a more general control server, which might provide other commands. This approach is more portable, but requires clients more complicated than kill. :) How are other folks solving this problem? Jim -- Jim Fulton mailto:jim@d... Technical Director (888) 344-4332 Python Powered! Digital Creations http://www.digicool.com http://www.python.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From kbd@i... Tue Sep 26 14:52:48 2000 From: kbd@i... (Keith Davidson) Date: Tue, 26 Sep 2000 09:52:48 -0400 Subject: [medusa] Question: killing/shuting down asyncore servers References: <39D0A2E9.5EEAC23@d...> Message-ID: <00b901c027c1$0ea2de20$500c1d18@c...> I need to handle the same thing (i.e. cleanly handle 'kill' type shutdown scenarios gracefully). It would be great if Medusa or asyncore provided automatic support for this (preferably as an option since not everyone will want it). Please post if you come up with a clean solution! thanks, Keith ----- Original Message ----- From: "Jim Fulton" To: Sent: Tuesday, September 26, 2000 9:21 AM Subject: [medusa] Question: killing/shuting down asyncore servers > > Are there any recommendations for shutting down > asyncore-based servers cleanly from outside the > servers? > > - Can a clean signal handler be written to > handle kill events? I tried writing a signal > handler that closed all the entries in the socket > map, but I have a feeling that this isn't working > properly. One of the problems I want to solve is > getting the socket I'm listening on to close > cleanly so that it isn't in use when I restart > the server. > > I suspect I could make this work with some sort of > dedicated select trigger. I think it probably wants > to be dedicated because, if I used an existing select > trigger, I'd need to worry about the possability that > the signal would interrupt I/O on the select trigger. > > - I suppose I could include a shutdown server, such that > if connections were made to this server, the application > would shut-down cleanly. I could obviously generalize this > to a more general control server, which might provide > other commands. This approach is more portable, but > requires clients more complicated than kill. :) > > How are other folks solving this problem? > > Jim > > -- > Jim Fulton mailto:jim@d... > Technical Director (888) 344-4332 Python Powered! > Digital Creations http://www.digicool.com http://www.python.org > > Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email > address may not be added to any commercial mail list with out my > permission. Violation of my privacy with advertising or SPAM will > result in a suit for a MINIMUM of $500 damages/incident, $1500 for > repeats. > > > From fredrik@p... Thu Sep 28 10:25:39 2000 From: fredrik@p... (Fredrik Lundh) Date: Thu, 28 Sep 2000 11:25:39 +0200 Subject: [medusa] Question: killing/shuting down asyncore servers References: <39D0A2E9.5EEAC23@d...> Message-ID: <04dd01c0292e$11eb94a0$0900a8c0@S...> jim wrote: > How are other folks solving this problem? by calling the set_reuse_addr method on the listening socket? From mdeavila@s... Thu Sep 28 19:34:30 2000 From: mdeavila@s... (mdeavila@s...) Date: Thu, 28 Sep 2000 18:34:30 -0000 Subject: Medusa & JPython Message-ID: <8r02vm+kfet@e...> It appears that Medusa (ver. dated 2000/06/01) does not run under JPython. Specifically, Medusa uses the regex module, which does not exist under JPYthon. Is Medusa going to be upgraded to use the 're'module in place of the regex module? From akuchlin@m... Thu Sep 28 19:54:15 2000 From: akuchlin@m... (Andrew Kuchling) Date: Thu, 28 Sep 2000 14:54:15 -0400 Subject: [medusa] Medusa & JPython In-Reply-To: <8r02vm+kfet@e...>; from mdeavila@s... on Thu, Sep 28, 2000 at 06:34:30PM -0000 References: <8r02vm+kfet@e...> Message-ID: <20000928145415.B5433@k...> On Thu, Sep 28, 2000 at 06:34:30PM -0000, mdeavila@s... wrote: >It appears that Medusa (ver. dated 2000/06/01) does not run under >JPython. Specifically, Medusa uses the regex module, which does not >exist under JPYthon. Does JPython support an emulation of the select module, though? This would be critical to Medusa working at all. select could be emulated with threads, though I'd imagine this would make it impossible to handle very many clients simulatneously, due to the number of threads required. --amk From howardlightstone@s... Fri Sep 29 18:15:39 2000 From: howardlightstone@s... (howardlightstone@s...) Date: Fri, 29 Sep 2000 17:15:39 -0000 Subject: newbie asyncore question on win9x Message-ID: <8r2inr+ob5v@e...> I seem to be unable to get a simple test of asyncore to 'work'. I tried just a simple server/client pair (see below) but I never get a handle_recv event. I can see the connection being made between the slave accept port (some small port number like 13xx) and the master port (50007). After the master 'sends' data, the connection goes silently away. What am I not doing? Thanks ------------------------------------------------------------- 'Slave' server import string import socket import asyncore HOST = 'localhost' # Symbolic name meaning the local host PORT = 50007 # Arbitrary non-privileged server class goer(asyncore.dispatcher_with_send): def __init__(self, sock,conn,addr,reader=None): asyncore.dispatcher.__init__ (self,conn) self.create_socket (socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind(addr) self.listen(5) self.reader=reader print 'goer=',sock,conn,addr def handle_read(self): print 'handle read' if self.reader != None: self.reader(self) class checker(asyncore.dispatcher): def __init__(self, port=PORT): self.port = port asyncore.dispatcher.__init__ (self) self.create_socket (socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind((HOST, port)) self.listen(5) self.readin=None print 'checker init',self,self.socket def handle_accept(self): print 'handle accept' conn,addr=self.accept() g=goer(self,conn,addr,self.readin) print self,self.socket,g def read_me(asock): " reads from async socket" global endit print 'in read_me' data=asock.recv print data #endit=process(data) s=checker() s.readin=read_me endit=0 counter=0 while endit == 0: asyncore.poll() counter=counter+1 cv='%6d' % counter #show_whats_up asyncore.close_all() =========================================== 'master' client from socket import * HOST = 'localhost' # The remote host PORT = 50007 # The same port as used by the server s = socket(AF_INET, SOCK_STREAM) s.connect(HOST, PORT) while 1: x=raw_input('Command: ') if len(x): s.send(x) if x[0] == 'x': break s.close() From t.c.jones@a... Fri Sep 29 21:06:58 2000 From: t.c.jones@a... (t.c.jones@a...) Date: Fri, 29 Sep 2000 20:06:58 +0000 Subject: shut down Message-ID: <20000929200658.SYBA9211.mtiwmhc21.worldnet.att.net@w...> I have been running Medusa on a std Linux system for a while, but find that when I use ctl-Z to shut it down, it leaves a socket open. I then reboot to get things running again. Two questions: Is ctl-Z the correct way to terminate Medusa? Is there any more detailed documentation on running Medusa? thnx ..tomj From rushing@n... Sat Sep 30 22:57:10 2000 From: rushing@n... (Sam Rushing) Date: Sat, 30 Sep 2000 14:57:10 -0700 (PDT) Subject: [medusa] Question: killing/shuting down asyncore servers In-Reply-To: <39D0A2E9.5EEAC23@d...> References: <39D0A2E9.5EEAC23@d...> Message-ID: <14806.25014.546439.768981@s...> Jim Fulton writes: > Are there any recommendations for shutting down > asyncore-based servers cleanly from outside the > servers? > > - Can a clean signal handler be written to > handle kill events? I tried writing a signal > handler that closed all the entries in the socket > map, but I have a feeling that this isn't working > properly. One of the problems I want to solve is > getting the socket I'm listening on to close > cleanly so that it isn't in use when I restart > the server. > > I suspect I could make this work with some sort of > dedicated select trigger. I think it probably wants > to be dedicated because, if I used an existing select > trigger, I'd need to worry about the possability that > the signal would interrupt I/O on the select trigger. This is why I added the ExitNow exception to asyncore recently. But you can still have a problem with catch-all try/except clauses. Here's some code I've been using on unix: [excerpts] def handle_signal (*ignore): shutdown() import signal signal.signal (signal.SIGTERM, handle_signal) signal.signal (signal.SIGHUP, handle_signal) SHUTDOWN_PERFORMED = 0 def shutdown(): global SHUTDOWN_PERFORMED if not SHUTDOWN_PERFORMED: [other processing] asyncore.socket_map.clear() SHUTDOWN_PERFORMED = 1 raise asyncore.ExitNow Now this generally works. There are two cases where it can get in trouble: 1) you have a try/except that doesn't watch for ExitNow. I try to limit my use of catch-all try/except, so it's pretty easy to find these and fix them *if you have control of the code*. 2) Your exit handler will clear the socket map, and then raises an exception that crawls all the way up to the poll() function. poll() is probably in the middle of a for loop processing pending events on other channels. Processing those events can actually repopulate the socket map, and the normal exit condition of an empty socket map isn't seen. Making the pending-events stuff globally accessible (like the socket_map itself) could fix this. But I wouldn't enjoy explaining such code to others. > - I suppose I could include a shutdown server, such that > if connections were made to this server, the application > would shut-down cleanly. I could obviously generalize this > to a more general control server, which might provide > other commands. This approach is more portable, but > requires clients more complicated than kill. :) I've used the marshal-based rpc classes (recently added to the distribution) for exactly this. Rather than calling a shutdown() function directly, it's cleaner to schedule a shutdown to happen in a couple of seconds. -Sam From rushing@n... Sat Sep 30 23:09:30 2000 From: rushing@n... (Sam Rushing) Date: Sat, 30 Sep 2000 15:09:30 -0700 (PDT) Subject: [medusa] Medusa & JPython In-Reply-To: <20000928145415.B5433@k...> References: <8r02vm+kfet@e...> <20000928145415.B5433@k...> Message-ID: <14806.25754.607738.65033@s...> Andrew Kuchling writes: > On Thu, Sep 28, 2000 at 06:34:30PM -0000, mdeavila@s... wrote: > >It appears that Medusa (ver. dated 2000/06/01) does not run under > >JPython. Specifically, Medusa uses the regex module, which does not > >exist under JPYthon. > > Does JPython support an emulation of the select module, though? This > would be critical to Medusa working at all. select could be emulated > with threads, though I'd imagine this would make it impossible to > handle very many clients simulatneously, due to the number of threads > required. Running something like Medusa under Java is probably pointless, unless you were to use an 'illegal' Java that exposed a real select(). To further explain: Java's "Green Threads" implementation is actually very similar to the select()-loop core of Medusa itself - it gives the illusion of threads by multiplexing I/O and attaching a scheduler to a timer. -Sam From rushing@n... Sat Sep 30 23:19:07 2000 From: rushing@n... (Sam Rushing) Date: Sat, 30 Sep 2000 15:19:07 -0700 (PDT) Subject: [medusa] newbie asyncore question on win9x In-Reply-To: <8r2inr+ob5v@e...> References: <8r2inr+ob5v@e...> Message-ID: <14806.26331.276635.943386@s...> howardlightstone@s... writes: > I seem to be unable to get a simple test of asyncore to 'work'. I > tried just a simple server/client pair (see below) but I never get a > handle_recv event. I can see the connection being made between the > slave accept port (some small port number like 13xx) and the master > port (50007). After the master 'sends' data, the connection goes > silently away. What am I not doing? > class goer(asyncore.dispatcher_with_send): > def __init__(self, sock,conn,addr,reader=None): > asyncore.dispatcher.__init__ (self,conn) The following four lines aren't necessary... the 'conn' parameter initializes your 'goer' object directly via the above line. The steps below are needed only for a server socket. A server socket's only purpose is to accept connections and thus produce new sockets. > self.create_socket (socket.AF_INET, socket.SOCK_STREAM) > self.set_reuse_addr() > self.bind(addr) > self.listen(5) Also, the 'sock' argument above is confusing - it's actually the server object (of class 'checker') from below, a better name for this parameter might be 'server'. I think if you just remove the four lines above it will work. > self.reader=reader > print 'goer=',sock,conn,addr > > def handle_read(self): > print 'handle read' > if self.reader != None: > self.reader(self) -Sam From rushing@n... Sat Sep 30 23:23:46 2000 From: rushing@n... (Sam Rushing) Date: Sat, 30 Sep 2000 15:23:46 -0700 (PDT) Subject: [medusa] shut down In-Reply-To: <20000929200658.SYBA9211.mtiwmhc21.worldnet.att.net@w...> References: <20000929200658.SYBA9211.mtiwmhc21.worldnet.att.net@w...> Message-ID: <14806.26610.963444.931140@s...> t.c.jones@a... writes: > I have been running Medusa on a std Linux system for a > while, but find that when I use ctl-Z to shut it down, it > leaves a socket open. I then reboot to get things > running again. > > Two questions: > > Is ctl-Z the correct way to terminate Medusa? Ctrl-Z will normally 'suspend' the job, leaving it in a STOPPED state in the background. [you can use 'fg' and 'bg' to change the status of stopped jobs. type 'help fg' and 'help bg' for a little more info] More likely what you want is Ctrl-C. > Is there any more detailed documentation on running Medusa? If you're new to socket programming I would suggest playing around with socket from the python prompt directly; for example open a couple of terminal windows, create a server socket in one window, connect to it from another python in another window, exchange data back and for, etc... Once you understand how sockets work, you might go through the tutorial that comes with the medusa distribution. -Sam From jim@d... Sun Oct 1 15:11:32 2000 From: jim@d... (Jim Fulton) Date: Sun, 01 Oct 2000 10:11:32 -0400 Subject: [medusa] Question: killing/shuting down asyncore servers References: <39D0A2E9.5EEAC23@d...> <04dd01c0292e$11eb94a0$0900a8c0@S...> Message-ID: <39D74614.D257476@d...> Fredrik Lundh wrote: > > jim wrote: > > How are other folks solving this problem? > > by calling the set_reuse_addr method on the listening socket? Ah. Reading Stevens, it looks like all servers should set this. This solves the "address already in use" problem. I wonder whi all medusa servers don'e set this. I'll make sure all of ours do. Jim -- Jim Fulton mailto:jim@d... Technical Director (888) 344-4332 Python Powered! Digital Creations http://www.digicool.com http://www.python.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From jim@d... Sun Oct 1 15:32:27 2000 From: jim@d... (Jim Fulton) Date: Sun, 01 Oct 2000 10:32:27 -0400 Subject: select, signals, and "interrupted system call" (EINTR) Message-ID: <39D74AFB.322E5187@d...> If a select-based (or, presumably, poll-based) server wants to use signals for anything other than shutdown (e.g. closing and reopening log files, rereading configs, etc.), then, on some platforms, a select call can fail with an "interrupted system call" (EINTR) error that should be ignored. The asyncore main loop should check for this error in it's select call and the select module should make this error easier to check for. In Python 1.5.2, the medusa select call can be changed from r,w,e = select.select (r,w,e, timeout) to: while 1: try: r,w,e = select.select (r,w,e, timeout) except select.error, v: if v[0] != EINTR: raise else: break I presume that this works in Python 1.6/2.0, but I haven't tried it yet? This depends on the structure of select.error values and requires that we get EINTR from somewhere. (What should the value be on NT?) I wonder if there should be an InterruptedSystemCall exception somewhere that select raises in this case? At a minimum, code like the above should be added to asyncore. Thoughts? Jim -- Jim Fulton mailto:jim@d... Technical Director (888) 344-4332 Python Powered! Digital Creations http://www.digicool.com http://www.python.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From rushing@n... Sun Oct 1 19:55:00 2000 From: rushing@n... (Sam Rushing) Date: Sun, 1 Oct 2000 11:55:00 -0700 (PDT) Subject: [medusa] Question: killing/shuting down asyncore servers In-Reply-To: <39D74614.D257476@d...> References: <39D0A2E9.5EEAC23@d...> <04dd01c0292e$11eb94a0$0900a8c0@S...> <39D74614.D257476@d...> Message-ID: <14807.34948.795398.765095@s...> Jim Fulton writes: > Fredrik Lundh wrote: > > jim wrote: > > > How are other folks solving this problem? > > > > by calling the set_reuse_addr method on the listening socket? > > Ah. Reading Stevens, it looks like all servers should set this. > This solves the "address already in use" problem. I wonder whi all > medusa servers don'e set this. I'll make sure all of ours do. Presumably there are situations where you'd not want to take over the socket (or share it with an existing process? I'm not sure what the semantics are). I didn't want to make it the default, but I did wrap the setsockopt() calls to make it as easy as possible. [Hmmm.. and it looks like I call it for the base http and ftp server classes] -Sam From rushing@n... Sun Oct 1 20:07:59 2000 From: rushing@n... (Sam Rushing) Date: Sun, 1 Oct 2000 12:07:59 -0700 (PDT) Subject: [medusa] select, signals, and "interrupted system call" (EINTR) In-Reply-To: <39D74AFB.322E5187@d...> References: <39D74AFB.322E5187@d...> Message-ID: <14807.35727.423642.721873@s...> Jim Fulton writes: > The asyncore main loop should check for this error in it's select > call and the select module should make this error easier to check > for. It might go better into the event_loop function, which I think of as a more user-serviceable part. [for example, the default loop vs. the one in medusa/event_loop.py that supports schedulable events] > I presume that this works in Python 1.6/2.0, but I > haven't tried it yet? > > This depends on the structure of select.error values > and requires that we get EINTR from somewhere. (What > should the value be on NT?) If it's a big problem, I guess we could use a different default event_loop() function for win32 vs. unix. > At a minimum, code like the above should be added to asyncore. > > Thoughts? This has been asked for several times, I agree it'd be nice to have at least a note in the docs.. -Sam From t.c.jones@a... Wed Oct 4 06:43:11 2000 From: t.c.jones@a... (t.c.jones@a...) Date: Wed, 04 Oct 2000 05:43:11 +0000 Subject: getting environ variables in a script Message-ID: <20001004054312.VDCC9211.mtiwmhc21.worldnet.att.net@w...> I need to access header variables (like accept:) in a script and wondered if anyone has a preferred way to do that. I was thinking about execve and putting them all into a dictonary (like os.environ returns.) ..tom From zmbq@a... Wed Oct 4 15:38:15 2000 From: zmbq@a... (Itay Zandbank) Date: Wed, 4 Oct 2000 17:38:15 +0300 Subject: Stalled producers Message-ID: <01cb01c02e10$bb21e8d0$05010101@s...> ---------------------- multipart/alternative attachment I was going through the proxy server example (work_in_progress/http_proxy= .py) while writing something somewhat similar, and I encountered quite a fe= w problems with it. First, the http_proxy_producer is not added as a producer to the http_cha= nnel. This was quite confusing at first, because I assumed from its name th= at it's a producer, and was surprised to see its more() method never gets c= alled. Once I added the producer to the channel (using push_with_producer, = of course), the channel closed immediately, giving me no chance to collect = the data, and without calling my stalled() method. I traced the problem down to async_chat.refill_buffer(). Refill_buffer() = simply eliminates producers that return an empty response, without ever bot= hering to check if they are stalled. The writable_for_proxy method doesn't = fix this, because push_with_producer calls initiate_send, which in turn cal= ls refill_buffer. So pushing a stalled producer with no input is always goi= ng to be the last thing you do with that producer (well, more() will be cal= led once, if that's any consolation). To fix it, I had to override refill_buffer in my channel, and check wheth= er the first producer is stalled. If it isn't, I pass control to the origin= al refill_buffer, something like this: def refill_buffer(self): try: p =3D self.producer_fifo.first() if p.stalled(): return except: pass http_server.http_channel.refill_buffer(self) Itay. ---------------------- multipart/alternative attachment An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail-21/medusa-dev/attachments/af5289ba/attachment.html ---------------------- multipart/alternative attachment-- From zmbq@a... Wed Oct 4 15:53:24 2000 From: zmbq@a... (Itay Zandbank) Date: Wed, 4 Oct 2000 17:53:24 +0300 Subject: Multithreaded Medusa Message-ID: <01e701c02e12$d8dd6190$05010101@s...> ---------------------- multipart/alternative attachment Aside from stalled producers, I also needed to multi-thread Medusa. I hav= e a proxy server, that does some processing on the passing data. This proce= ssing is pretty quick. Quick enough to put in the main select thread withou= t slowing things down (the overhead of delegating the job to another thread= , even if that thread is already running, is not worth it). The problem is = with multi-CPU machines. On a machine with two CPUs, having two threads can= have a drastic impact on performance. What I came up with, then, was this: Have one thread listening for incomi= ng connections, and one (or more, depending on the number of CPUs you have)= process these connections. The theory seemed easy enough. But then reality= hit me. Since I have two (or more) threads working on network connections,= I need two select loops, and more importantly, two socket_maps. All throughout Medusa, there's code that assumes the socket map is asynco= re.socket_map (in http_server, for instance). What I had to do eventually, = was create a class (I called it Redirector), which has two methods - add_ch= annel and del_channel, which put the socket in the right socket_map, like t= his: class Redirector: def __init__(self, socket_map): self.socket_map =3D socket_map def add_channel(self, map=3DNone): if map is None: map =3D self.socket_map asynccore.dispatcher.add_channel(self, map) def del_channel(self, map=3DNone): # Very much like add_channel Each time I have an asyncore.dispatcher derived class in my souce, I also= derive it from Redirector. This works, but it's really ugly (I'm sure that in a month, I'll spend an= entire week tracking down a bug caused by not deriving a class from Redire= ctor). It would have been much better if asyncore.dispatcher had a socket_m= ap member in the first place. The default can still be the global socket_ma= p, so no code will break. Thanks again, Itay. ---------------------- multipart/alternative attachment An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail-21/medusa-dev/attachments/d5eab7df/attachment.html ---------------------- multipart/alternative attachment-- From jim@d... Wed Oct 4 16:46:14 2000 From: jim@d... (Jim Fulton) Date: Wed, 04 Oct 2000 11:46:14 -0400 Subject: [medusa] Multithreaded Medusa References: <01e701c02e12$d8dd6190$05010101@s...> Message-ID: <39DB50C6.948BCDAC@d...> > Itay Zandbank wrote: > > Aside from stalled producers, I also needed to multi-thread Medusa. I have a proxy server, that does some processing on the passing data. This processing is pretty quick. Quick enough to put in the main select thread without slowing things down (the overhead of delegating the job to another thread, even if that thread is already running, is not worth it). The problem is with multi-CPU machines. On a machine with two CPUs, having two threads can have a drastic impact on performance. You won't get a drastic improvement in performance using Python, since only one thread can be in the interpreter at a time. There are exotic ways to get around this involving running two interpreters, but I haven't tried them. > What I came up with, then, was this: Have one thread listening for incoming connections, and one (or more, depending on the number of CPUs you have) process these connections. The theory seemed easy enough. But then reality hit me. Since I have two (or more) threads working on network connections, I need two select loops, and more importantly, two socket_maps. > > All throughout Medusa, there's code that assumes the socket map is asyncore.socket_map (in http_server, for instance). What I had to do eventually, was create a class (I called it Redirector), which has two methods - add_channel and del_channel, which put the socket in the right socket_map, like this: > > class Redirector: > def __init__(self, socket_map): > self.socket_map = socket_map > > def add_channel(self, map=None): > if map is None: > map = self.socket_map > asynccore.dispatcher.add_channel(self, map) > > def del_channel(self, map=None): > # Very much like add_channel > > > Each time I have an asyncore.dispatcher derived class in my souce, I also derive it from Redirector. > > This works, but it's really ugly (I'm sure that in a month, I'll spend an entire week tracking down a bug caused by not deriving a class from Redirector). It would have been much better if asyncore.dispatcher had a socket_map member in the first place. The default can still be the global socket_map, so no code will break. I raised this same issue a while ago. At least asyncore now lets you specify alternate socket maps. :) Jim -- Jim Fulton mailto:jim@d... Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From zmbq@a... Wed Oct 4 17:04:56 2000 From: zmbq@a... (Itay Zandbank) Date: Wed, 4 Oct 2000 19:04:56 +0300 Subject: [medusa] Multithreaded Medusa References: <01e701c02e12$d8dd6190$05010101@s...> <39DB50C6.948BCDAC@d...> Message-ID: <01fd01c02e1c$d749e4c0$05010101@s...> > You won't get a drastic improvement in performance using Python, since only one thread > can be in the interpreter at a time. There are exotic ways to get around this involving > running two interpreters, but I haven't tried them. Oh, RIGHT! I can't believe I missed that. Running several processes is not a bad idea, actually. I already have a root process that's responsible for spawning a child process which will do all the work (the root process is there to shut the child down gracefully, without cutting existing connections). Changing it to run several children instead of just one is going to be pretty easy. > I raised this same issue a while ago. At least asyncore now lets > you specify alternate socket maps. :) Who cares? I don't need this any more :-) From cwagner@s... Wed Oct 4 17:51:17 2000 From: cwagner@s... (Chuck Wagner) Date: Wed, 4 Oct 2000 11:51:17 -0500 Subject: [medusa] Confirm your new account with eGroups References: <970678063.3069@egroups.com> Message-ID: <001801c02e23$50ebfd30$6401c10a@b...> ----- Original Message ----- From: "eGroups" To: Sent: Wednesday, October 04, 2000 11:47 AM Subject: [medusa] Confirm your new account with eGroups > > Hello, > > Thank you for your interest in eGroups, a free email group > service. To activate your account with eGroups, we need to > verify that your email address is correct. To protect your email > address, your account will not be activated until you follow one > of the confirmation steps below: > > 1. PLEASE REPLY to this email using the reply function in your email > program. Your correct email address will be entered automatically. > > OR > > 2. VISIT > http://www.egroups.com/confirm.cgi?email=medusa%40e-groups%2Ecom&id=8997 > and follow the easy instructions. > > To access the eGroups web site, please visit > http://www.egroups.com > > If you did not request, or do not want, a eGroups account, > please accept our apologies and ignore this message. > > > Regards, > > eGroups Customer Support > > IMPORTANT NOTE: If you believe your email address has been registered > with eGroups without your consent, please forward a copy > of this message to abuse@egroups.com > > > > > > > > > From zmbq@a... Wed Oct 4 18:27:42 2000 From: zmbq@a... (Itay Zandbank) Date: Wed, 4 Oct 2000 20:27:42 +0300 Subject: [medusa] Question: killing/shuting down asyncore servers References: <39D0A2E9.5EEAC23@d...> Message-ID: <00bb01c02e28$80d84300$e5d05c8b@i...> Woops, just bumped into this. > other commands. This approach is more portable, but > requires clients more complicated than kill. :) > How are other folks solving this problem? Instead of signals, I use a named pipe. I can't use kill as my client, but echo performs well, to :-) From jim@d... Thu Oct 5 19:10:42 2000 From: jim@d... (Jim Fulton) Date: Thu, 05 Oct 2000 14:10:42 -0400 Subject: [medusa] select, signals, and "interrupted system call" (EINTR) References: <39D74AFB.322E5187@d...> <14807.35727.423642.721873@s...> Message-ID: <39DCC422.90E4D0D5@d...> Sam Rushing wrote: > > Jim Fulton writes: > > The asyncore main loop should check for this error in it's select > > call and the select module should make this error easier to check > > for. > > It might go better into the event_loop function, which I think of as a > more user-serviceable part. [for example, the default loop vs. the > one in medusa/event_loop.py that supports schedulable events] Don't you think anyone using select on Unix would want this? This isn't really an application-specific thing is it? > > I presume that this works in Python 1.6/2.0, but I > > haven't tried it yet? > > > > This depends on the structure of select.error values > > and requires that we get EINTR from somewhere. (What > > should the value be on NT?) > > If it's a big problem, I guess we could use a different default > event_loop() function for win32 vs. unix. Or we could put this in the poll function and reraise the error on NT, as my change does. Jim -- Jim Fulton mailto:jim@d... Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From edcjones@e... Tue Oct 10 21:00:15 2000 From: edcjones@e... (Edward C. Jones) Date: Tue, 10 Oct 2000 20:00:15 -0000 Subject: How to use proxy.py? Message-ID: <8rvsgf+ok6n@e...> I use RedHat Linux 6.2 with Python 1.5.2. How do you put proxy.py between Netscape and the Internet? (What arguments do I give proxy.py, etc.?) I have looked at programming.html. All it says is "You might also try pointing a real client (a news reader [port 119] or web browser [port 80]) at your proxy." Thanks, Ed Jones From simuran@h... Wed Oct 11 09:02:28 2000 From: simuran@h... (simuran@h...) Date: 11 Oct 2000 02:02:28 -0600 Subject: [comp.lang.python] Async sockets. Message-ID: ---------------------- multipart/mixed attachment Hi. I think this question would be more appropriate here. Any help would be greatly appreatiated. ---------------------- multipart/mixed attachment An embedded message was scrubbed... From: simuran@h... (Alexandre A. Rodioukov) Subject: Async sockets. Date: Tue, 10 Oct 2000 00:37:36 GMT Size: 1426 Url: http://mail.python.org/pipermail-21/medusa-dev/attachments/2f11bc41/attachment.txt ---------------------- multipart/mixed attachment Alex. ---------------------- multipart/mixed attachment-- From webmaster@a... Wed Oct 11 23:04:43 2000 From: webmaster@a... (Emmanuel DISCORS) Date: Thu, 12 Oct 2000 00:04:43 +0200 Subject: Question to medusa & bobo_handler.py users Message-ID: <00101200414600.00650@s...> Hi all, Trying to use Medusa & bobo_handler.py. Seems to work well ; Very nice system ;-) Medusa version : medusa-src-20000601.tar.gz Document Template : DocumentTemplate-2_2_tar BoboPos DB : Not installed yet Question : =3D=3D=3D=3D=3D=3D=3D=3D What version of Bobo modules can I install to work with Medusa ? (Thinking = of BoboPos DB) Where can I find it ? (FTP ; CVS ; or extract from last Zope product) In the case of Zope product, I can't install (compil) Zope on my ISP server is this a problem ? Many thanks. Manu. http://www.advl.org: 9090/bobotest/hello?name=3D"Medusa and Bobo" ;-) -- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Emmanuel DISCORS Tel & Fax : 02 54 56 80 61 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Conception, Informatique, R=E9seau ADVL ( Au-Del=E0 de Vos Limites ) Site web : http://www.advl.org/ Archives mOdbc : http://www.advl.org/public/mOdbc/ From thomas@c... Tue Oct 24 11:40:26 2000 From: thomas@c... (thomas@c...) Date: Tue, 24 Oct 2000 10:40:26 -0000 Subject: Simple subclassing of http-server Message-ID: <8t3ouq+m9so@e...> I want to subclass medusas http-server-class so that I can write my own request handler. The server is going to serve xml. I've looked at the docs/tutorial but I cannot figure out where to put my own handler, so that I can pick the requested url apart, use the submitted data to find what data to send back to the client. The simpleHTTPServer in the standard python distro has a simpler or at least more understandable approach, so if anybody could show me how to get something similar to that to work with I'd be glad. The only thing I need is to have a place to insert my method and let it return data based on the url the user typed in the browser. If I can sublclass something and do it in my own subclass that would be the best solution. It would be nice to leave the medusa-code alone. Thanks From kthangavelu@e... Tue Oct 24 20:52:08 2000 From: kthangavelu@e... (Ender) Date: Tue, 24 Oct 2000 12:52:08 -0700 Subject: [medusa] [comp.lang.python] Async sockets. References: Message-ID: <39F5E868.66DD3D90@e...> simuran@h... wrote: > > Hi. > > I think this question would be more appropriate here. Any help would > be greatly appreatiated. > > I'm giving up on trying to understand how asyncore works. I need help :) > What i'm trying to do is to write a piece of software that just would > redirect TCP connections. Trick is that it should accept multiple > connections on one (fixed) port and forward the data to remote host:port, > where port is being taken from range of available values, and once taken it > can't be used again (on the remote side i'm dealing with thing that doesn't > accept more than one connection per port). > > I really need a working example/advice on how to do simple port forwarding > with asyncore or multithreading. port forwarding. the simple_proxy_server.py in the docs multithreading -- zope's zserver or webware's multithreadedappserver cheers kapil From thomas@c... Thu Oct 26 10:30:47 2000 From: thomas@c... (thomas@c...) Date: Thu, 26 Oct 2000 09:30:47 -0000 Subject: Stopping access to lower subdirs Message-ID: <8t8tk7+cd5k@e...> I've written a custom authorizer. How can I set a start root-dir so the users doesn't get access to dirs outside or below this ( using cd .. etc.) ? If I've allready set the ftp_channel read-only to false can the users overwrite files all across the filesystem ?? Which id is used to write files using the ftp-server? Any clues ?? From thomas@c... Thu Oct 26 13:00:26 2000 From: thomas@c... (thomas@c...) Date: Thu, 26 Oct 2000 12:00:26 -0000 Subject: Stopping access to lower subdirs In-Reply-To: <8t8tk7+cd5k@e...> Message-ID: <8t96cq+o5p3@e...> --- In medusa@egroups.com, thomas@c... wrote: > > I've written a custom authorizer. How can I set a start root-dir so > the users doesn't get access to dirs outside or below this ( using > cd .. etc.) ? > > If I've allready set the ftp_channel read-only to false can the users > overwrite files all across the filesystem ?? Which id is used to > write files using the ftp-server? > > Any clues ?? Me again: Nevermind. The source gave me some hints. Subclassing the ftp_channel- class and overriding the specific methods work like a charm. Thomas From ebnf@h... Thu Oct 26 14:42:55 2000 From: ebnf@h... (ebnf@h...) Date: Thu, 26 Oct 2000 13:42:55 -0000 Subject: handle_connect called when connection fails Message-ID: <8t9ccv+so8o@e...> The following code tries to connect to a port that no one is listening to - the problem is that handle_connect is called anyway. Is there anyway I can find out whether the connection failed without trying to write or read (which I imagined would fail). import asyncore class test (asyncore.dispatcher): def __init__ (self): asyncore.dispatcher.__init__ (self) def handle_connect (self): print 'Connected' if __name__ == '__main__': import socket t = test() t.create_socket(socket.AF_INET, socket.SOCK_STREAM) # there's nobody listening on 9879 t.connect(('localhost', 9879)) asyncore.poll(1) Thanks in advance. /A From thomas@c... Tue Oct 31 08:56:58 2000 From: thomas@c... (thomas@c...) Date: Tue, 31 Oct 2000 08:56:58 -0000 Subject: Data-part of a POST request is missing!! Message-ID: <8tm1gq+krbd@e...> I've written my own default_handler and want to use the POST command to send data to the HTTP-server ( username, passwd etc. therefore the POST command, not GET). My Python client ( a script that sends the POST command and header parts manually to the HTTP-server) sends the data ok. It's available in the request-object in my default_handler. But using a form in Netscape ( with ENCTYPE=multipart/form-data, method=POST ) shows no form data in the request-object. Why ?? I need to use both clients, my Python client and a ordinary browser, and I need to use the POST-command. Any clues, hints or tips? From drone_drone@h... Tue Oct 31 12:22:00 2000 From: drone_drone@h... (drone) Date: Tue, 31 Oct 2000 07:22:00 -0500 Subject: [medusa] Data-part of a POST request is missing!! References: <8tm1gq+krbd@e...> Message-ID: What does your form look like?? ---------------------------------------------------------------------- Olivier A. Dagenais - Software Architect and Developer "Someone called 'Type your name here' is impersonating me on the internet and is posting exactly the same things I am posting!" ----- Original Message ----- From: To: Sent: Tuesday, October 31, 2000 03:56 Subject: [medusa] Data-part of a POST request is missing!! > I've written my own default_handler and want to use the POST command > to send data to the HTTP-server ( username, passwd etc. therefore the > POST command, not GET). > > My Python client ( a script that sends the POST command and header > parts manually to the HTTP-server) sends the data ok. It's available > in the request-object in my default_handler. But using a form in > Netscape ( with ENCTYPE=multipart/form-data, method=POST ) shows no > form data in the request-object. Why ?? > > I need to use both clients, my Python client and a ordinary browser, > and I need to use the POST-command. > > Any clues, hints or tips? > > > > > > From zmbq@a... Tue Oct 31 12:12:12 2000 From: zmbq@a... (Itay Zandbank) Date: Tue, 31 Oct 2000 14:12:12 +0200 Subject: [medusa] Data-part of a POST request is missing!! References: <8tm1gq+krbd@e...> Message-ID: <021b01c04333$ccde07b0$05010101@s...> When your handler is passed the request object, it still has to read the post data from the request channel. Check out the proxy demo (it was in work_in_progress last I checked), or the CGI demo to see how it's done. > I've written my own default_handler and want to use the POST command > to send data to the HTTP-server ( username, passwd etc. therefore the > POST command, not GET). > > My Python client ( a script that sends the POST command and header > parts manually to the HTTP-server) sends the data ok. It's available > in the request-object in my default_handler. But using a form in > Netscape ( with ENCTYPE=multipart/form-data, method=POST ) shows no > form data in the request-object. Why ?? > > I need to use both clients, my Python client and a ordinary browser, > and I need to use the POST-command. > > Any clues, hints or tips? From thomas@c... Tue Oct 31 17:23:15 2000 From: thomas@c... (thomas@c...) Date: Tue, 31 Oct 2000 17:23:15 -0000 Subject: Data-part of a POST request is missing!! In-Reply-To: Message-ID: <8tmv63+vo5k@e...> it's a plain
--- In medusa@egroups.com, "[drone]" wrote: > What does your form look like?? > > ---------------------------------------------------------------------- > Olivier A. Dagenais - Software Architect and Developer > "Someone called 'Type your name here' is impersonating me on the > internet and is posting exactly the same things I am posting!" > > > ----- Original Message ----- > From: > To: > Sent: Tuesday, October 31, 2000 03:56 > Subject: [medusa] Data-part of a POST request is missing!! > > > > I've written my own default_handler and want to use the POST command > > to send data to the HTTP-server ( username, passwd etc. therefore the > > POST command, not GET). > > > > My Python client ( a script that sends the POST command and header > > parts manually to the HTTP-server) sends the data ok. It's available > > in the request-object in my default_handler. But using a form in > > Netscape ( with ENCTYPE=multipart/form-data, method=POST ) shows no > > form data in the request-object. Why ?? > > > > I need to use both clients, my Python client and a ordinary browser, > > and I need to use the POST-command. > > > > Any clues, hints or tips? > > > > > > > > > > > > From abo@m... Mon Nov 6 13:27:32 2000 From: abo@m... (Donovan Baarda) Date: Tue, 7 Nov 2000 00:27:32 +1100 Subject: How to submit producer ready() changes, and tuning async core Message-ID: <20001107002731.A17249@m...> ---------------------- multipart/mixed attachment G'day Sam and medusa@e..., sorry for appearing on this list outa nowhere announcing code changes without serving the obligitory lurk time. Was just going to send this to Sam then noticed there was a list. I've been fiddling with medusa (ps, thanks for making it "Free!", this was the final straw in convincing me it was worth using). And have made a few changes you might like to fold back in. I was wondering how to go about submitting changes etc. Have you got anything setup like a sourceforge project for medusa? I've added the ability for producers to block via a ready() method, effectively allowing async producers. The changes required were suprisingly small, affecting only asynchat.py and producers.py, plus some minor fixups to http_server.py and filesys.py to avoid conflicts with the new feature. I was using 20000601 as my base. Medusa appears to be working fine, and the combined changes to asynchat.py and producers.py make them actualy simpler and smaller than they were before. The changes are backwards compatible with old producers that don't have a ready() method. The only conflicts in http_server and filesys were pre-existing (and broken) ready() methods or conflicts with my changes the composite_producer. I've noticed that the zope guys early on mentioned that they were thinking of extending medusa so that producers could block, probably by giving them a ready() method. I've also seen hints of this throughout your code, with vestigial ready() and stalled() methods, and even a writeable_for_proxy() test in your http_server. Dispite all this, no-one seems to have implemented it. I know that this feature can be worked around by using dispatchers to push data onto an asynchat, but the producer queue is a powerful feature, and it is nice to be able to push asyc-producers onto that queue. I notice the ZServer guys are even using the producer queue to push callbacks onto it using empty producers that just execute the callback on more()... neat idea. BTW, I saw someone else post on the egroups list about writeable_for_proxy not working properly... AFAICT, it looks like it's something that was never completely implemented. Using this ready() change will achieve all you wanted and more :-) Warning! these changes are only lightly tested... I am planning to use medusa for on-demand mirroring with http, ftp, and (eventualy) rsync back and front ends. The easy way to achieve this was to make ftp and http filesystems that fetched and cached on demand. The problem is all the filesystem stuff is blocking, so this wouldn't work well. Implementing ready() for an async_file_producer looked easier than implementing a non-blocking replacement for the filesystem layer. On a different note, just read your stuff on recent improvements to the async core. You mention the overhead of readable() and writeable() methods in the polling loop. One trick that might be worth trying is something from visibility tests in 3D graphics; cache the result. The idea is when you test an object's visibility, give it an integer value. For each successive frame, decrement the value, and don't test it's visibility again until the value reaches zero. The size of integer can be tuned based on how soon you think it's visibility status might change. The price is occasionaly you get it wrong, but usually only for a few frames. For async core stuff, you could 'learn' the visibility value based on network load, whatever. If you made it robust enough to handle the occasional "false write/readable" error, you could cache both 'writeable' and 'not writable' type results. You would need to make sure it could handle the occasional visibility error. -- ---------------------------------------------------------------------- ABO: finger abo@m... for more info, including pgp key ---------------------------------------------------------------------- ---------------------- multipart/mixed attachment A non-text attachment was scrubbed... Name: medusa-ready.tar.bz2 Type: application/octet-stream Size: 20173 bytes Desc: not available Url : http://mail.python.org/pipermail-21/medusa-dev/attachments/65c0cbe9/medusa-ready.tar.bz2 ---------------------- multipart/mixed attachment-- From gb@a... Mon Nov 13 10:16:14 2000 From: gb@a... (gunter ) Date: Mon, 13 Nov 2000 10:16:14 -0000 Subject: medusa with pythonw.exe Message-ID: <8uof1e+q3f7@e...> Hi folks! I've got a problem using medusa on windows98. I've written an programm which uses an browser-frontend and an python server part. I suceeded in installing the server on windows98 and running the client on the same machine (no problems so far...) My project uses medusa as server. As long as I am starting my script with python.exe it works fine. Now I want to use pythonw.exe because it does not open an ugly DOS-Box-Window. But now medusa seems to be unstable: Somtimes some requests are returning "internal server errors". I am using an "script_handler.persistent_script_handler". I think my scripts are ok, because the errors occure also in GET-Requests to the "default_handler.default_handler(file_system)" any ideas? gunter From itamarst@y... Sat Nov 25 23:29:04 2000 From: itamarst@y... (Itamar S.-T.) Date: Sat, 25 Nov 2000 15:29:04 -0800 (PST) Subject: WebDAV in Medusa? Message-ID: <20001125232904.24341.qmail@w...> Has anyone added WebDAV support to Medusa? I know Zope has pretty good WebDAV support, but I'm not sure if it can be used with the regular Medusa codebase - if it is possible I'd be grateful for any hints on how to do this. ===== -- Itamar Shtull-Trauring, itamar(at)shtull-trauring.org __________________________________________________ Do You Yahoo!? Yahoo! Shopping - Thousands of Stores. Millions of Products. http://shopping.yahoo.com/ From lucifer@e... Thu Dec 7 05:07:21 2000 From: lucifer@e... (Nicolas Echaniz) Date: Thu, 7 Dec 2000 02:07:21 -0300 Subject: [medusa] WebDAV in Medusa? In-Reply-To: <20001125232904.24341.qmail@w...> Message-ID: <200012070507.CAA14211@w...> Hi everyone. I have this problem: I need apache to handle certain sites and medusa tu handle others. But I can´ t tell both to use port 80, so, if I have site1.com on apache on port 80, and site2.com on medusa on port 8080, people will need to specify the port number in their address bar if they want to access site2.com. Anyone had the same problem ? Thanks, Nico. _______________________________________________________________ Nicolás Echániz | RAKAR Producciones | Buenos Aires | Argentina From t.c.jones@a... Fri Dec 8 05:19:46 2000 From: t.c.jones@a... (t.c.jones@a...) Date: Fri, 08 Dec 2000 05:19:46 +0000 Subject: [medusa] WebDAV in Medusa? Message-ID: <20001208051947.EWMP5130.mtiwmhc22.worldnet.att.net@w...> sure, that's what I do on my site. You can start then out on port 80 and then you redirect them immediately to port 8080. You can create a virtual site in apache if you don't want to use the same one as the "other" apache site. my site is topcatnetwork.com ..tom > Hi everyone. > > I have this problem: > > I need apache to handle certain sites and medusa tu handle others. But I can´ t > tell both to use port 80, so, if I have site1.com on apache on port 80, and > site2.com on medusa on port 8080, people will need to specify the port number in > their address bar if they want to access site2.com. > > Anyone had the same problem ? > > > Thanks, > > Nico. > _______________________________________________________________ > Nicolás Echániz | RAKAR Producciones | Buenos Aires | Argentina > > > > From support@i... Sat Dec 9 23:25:33 2000 From: support@i... (Mike Clarkson) Date: Sat, 09 Dec 2000 23:25:33 -0000 Subject: handle_connect called when connection fails In-Reply-To: <8t9ccv+so8o@e...> Message-ID: <90uf1d+fo9d@e...> --- In medusa@egroups.com, ebnf@h... wrote: > The following code tries to connect to a port that no one is listening > to - the problem is that handle_connect is called anyway. Is there > anyway I can find out whether the connection failed without trying to > write or read (which I imagined would fail). This also affects http_proxy.py: if you proxy request a port that no one is listening to then the exception after this handle_connect is unhandled, and the client will wait forever. Any fixes? Many thanks in advance, Mike. From support@i... Sat Dec 9 23:05:05 2000 From: support@i... (Mike Clarkson) Date: Sat, 09 Dec 2000 18:05:05 -0500 Subject: Medusa Message-ID: <3.0.6.32.20001209180505.007d5d60@p...> I've been playing with Medusa and I wanted to see if I could make a GUI for it. I looked at the tkinter.txt notes, but that won't work with Python 2.0, and it's really groddy way of doing it. (at least in old versions of Tk after would crash after a while). In Python 2.0 the main event loop of Tkinter is in C, with threads meshed into the loop, as Tk is in it's own thread with its own special lock. If you compile with threads, then the code is (_tkinter.c Tkapp_MainLoop) quitMainLoop = 0; while (Tk_GetNumMainWindows() > threshold && !quitMainLoop && !errorInCmd) { int result; #ifdef WITH_THREAD Py_BEGIN_ALLOW_THREADS PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; result = Tcl_DoOneEvent(TCL_DONT_WAIT); tcl_tstate = NULL; PyThread_release_lock(tcl_lock); if (result == 0) Sleep(20); Py_END_ALLOW_THREADS #else result = Tcl_DoOneEvent(0); #endif Tcl_DoOneEvent(TCL_DONT_WAIT) handles any existing events and returns, nonzero if it did anything, whereas Tcl_DoOneEvent(0) does select waiting for events. The loop uses a 20 msec wait using Sleep, but on most systems, Sleep is just a call to a null select, so you could mesh the asynccore with Tkinter using your poll as a replacement for Sleep. The only detail is how to pass the array of fd's for poll in. Presumably you could check for the existence of a global variable, which is groddy, or you could extend the arguments to the Python mainloop function (it already takes one optional argument), to take a callable object. by default this callable object would be time.sleep(20). If you were using asynccore you make the callable object a call to poll with it's fd's (or better still a continuation?). This would have the added benefit of giving the user control over the loop granularity so that the change might even be adopted into the Tkinter core. Does this seem like a good way to go? I'm new to Python so I don't know how to pass a callable function as an argument, but it shouldn't be more than a few lines of C code. Many thanks for medusa. Mike. From jkraai@m... Tue Dec 12 18:59:41 2000 From: jkraai@m... (jkraai@m...) Date: Tue, 12 Dec 2000 18:59:41 -0000 Subject: Connection Pooling w/ async_mysql? Message-ID: <915sit+he1s@e...> Greetings, Anyone doing connection pooling w/ async_mysql from inside a medusa'ish server? Nice features'd be configurable max_connections and smart cmd_use() 'caching' w/ default db option. If it hasn't been done, I'll make an attempt and post it for criticism. Thanks, --jim From rushing@n... Tue Dec 12 20:07:57 2000 From: rushing@n... (Sam Rushing) Date: Tue, 12 Dec 2000 12:07:57 -0800 Subject: [medusa] Connection Pooling w/ async_mysql? References: <915sit+he1s@e...> Message-ID: <3A36859D.1070104@n...> jkraai@m... wrote: > Greetings, > > Anyone doing connection pooling w/ async_mysql from inside > a medusa'ish server? > > Nice features'd be configurable max_connections and smart > cmd_use() 'caching' w/ default db option. > > If it hasn't been done, I'll make an attempt and post it > for criticism. > The egp-coro package has support for connection-pooling (or rather 'connection-limiting'), that I think was also used with the mysql protocol implementation. You could look in there for hints. Of course it won't be as easy using callbacks... http://www.nightmare.com/~rushing/copython/index.html -Sam From tassellim@y... Wed Dec 13 08:30:05 2000 From: tassellim@y... (Marco Tasselli) Date: Wed, 13 Dec 2000 08:30:05 -0000 Subject: https Message-ID: <917c2d+hkpl@e...> Hi, is there a way to know if a connection is of type http or https? I looked in the request object but could only find infos on the uri part following the host name so the info on the type of protocol (http/https) is not "visible" thanks Marco From nhytro@c... Thu Dec 14 14:03:42 2000 From: nhytro@c... (nhytro@c...) Date: Thu, 14 Dec 2000 14:03:42 -0000 Subject: MEDUSA Message-ID: <91ajvu+oou7@e...> Hi Medusa List! I=B4m newbie to both Python and MEDUSA, I took a look at the tutorial=20 on the Medusa web-site, to my dismay, I did=B4nt really understand much=20 of what was being explained. Could someone point me to an URL where I=20 can RTFM Medusa programming for newbies/ dummies? or could someone=20 break the whole process of using medusa to construct a web server=20 down into detailed bits for me? OR does anyone have a skeleton=20 WEBserver with CGI support that I can study, so I can re-code for my=20 own purposes? Thanks all for your anticipated help Sharriff From lucifer@e... Thu Dec 14 16:15:20 2000 From: lucifer@e... (Nicolas Echaniz) Date: Thu, 14 Dec 2000 13:15:20 -0300 Subject: [medusa] WebDAV in Medusa? In-Reply-To: <20001208051947.EWMP5130.mtiwmhc22.worldnet.att.net@w...> Message-ID: <200012141615.NAA09134@w...> Thanks to everyone for the help on redirecting from Apache to Medusa. It worked fine. I'd like to have your opinion on my site/application. It's based on python/mysql/medusa. It's address is www.ecmess.com (the main page is in spanish, but the rest of it is in english). Check it out and let me know what you think. _______________________________________________________________ Nicolás Echániz | RAKAR Producciones | Buenos Aires | Argentina From t.c.jones@a... Thu Dec 14 16:55:07 2000 From: t.c.jones@a... (t.c.jones@a...) Date: Thu, 14 Dec 2000 16:55:07 +0000 Subject: [medusa] WebDAV in Medusa? Message-ID: <20001214165516.PUCK2402.mtiwmhc21.worldnet.att.net@w...> when i try to register i get There are no users registered with that nickname. Retry Register > Thanks to everyone for the help on redirecting from Apache to Medusa. It worked > fine. > > I'd like to have your opinion on my site/application. It's based on > python/mysql/medusa. > > It's address is www.ecmess.com (the main page is in spanish, but the rest of it > is in english). > Check it out and let me know what you think. > > > _______________________________________________________________ > Nicolás Echániz | RAKAR Producciones | Buenos Aires | Argentina > > > > From lucifer@e... Wed Dec 20 03:13:40 2000 From: lucifer@e... (lucifer@e...) Date: Wed, 20 Dec 2000 03:13:40 -0000 Subject: EcMess was Re: WebDAV in Medusa? In-Reply-To: <20001214165516.PUCK2402.mtiwmhc21.worldnet.att.net@w...> Message-ID: <91p854+8kcp@e...> You have to choose register and enter your desired nickname and password. Then you may log in. To add friends to your list you have to know their id (soon you'll be able to search by name, etc). There's a list of users in the main page (where you log in), the link says: "lista de usuarios con sus nicknames y Id's." I hope that's enough to get you going. bye. Nico. PS: My id is 1 .=20 --- In medusa@egroups.com, t.c.jones@a... wrote: > when i try to register i get >=20 > There are no users registered with that nickname.=20 >=20 > Retry Register > > Thanks to everyone for the help on redirecting from Apache to Medusa. It worked=20 > > fine. > >=20 > > I'd like to have your opinion on my site/application. It's based on=20 > > python/mysql/medusa. > >=20 > > It's address is www.ecmess.com (the main page is in spanish, but the rest of it=20 > > is in english). > > Check it out and let me know what you think. > >=20 > >=20 > > _______________________________________________________________ > > Nicol=E1s Ech=E1niz | RAKAR Producciones | Buenos Aires | Argentina > >=20 > >=20 > >=20 > > From akuchlin@m... Thu Dec 21 03:40:06 2000 From: akuchlin@m... (A.M. Kuchling) Date: Wed, 20 Dec 2000 22:40:06 -0500 Subject: Patch to use poll() support in Python 2.0 Message-ID: <200012210340.WAA00993@2...> This patch adds the ability to use the poll() support that was added to the select module in Python 2.0. Only lightly tested ... please proofread this patch carefully. --amk --- /tmp/asyncore.py Thu May 4 02:06:04 2000 +++ asyncore.py Wed Dec 20 22:38:38 2000 @@ -93,6 +93,7 @@ pass def poll2 (timeout=0.0, map=None): + # Use Andy Dustman's poll module import poll if map is None: map=socket_map @@ -124,9 +125,45 @@ except KeyError: pass +def poll3 (timeout=0.0, map=None): + # Use the poll() support added to the select module in Python 2.0 + if map is None: + map=socket_map + # timeout is in milliseconds + timeout = int(timeout*1000) + pollster = select.poll() + if map: + l = [] + for fd, obj in map.items(): + flags = 0 + if obj.readable(): + flags = select.POLLIN + if obj.writable(): + flags = flags | select.POLLOUT + if flags: + pollster.register(fd, flags) + r = pollster.poll (timeout) + for fd, flags in r: + try: + obj = map[fd] + try: + if (flags & select.POLLIN): + obj.handle_read_event() + if (flags & select.POLLOUT): + obj.handle_write_event() + except ExitNow: + raise ExitNow + except: + obj.handle_error() + except KeyError: + pass + def loop (timeout=30.0, use_poll=0, map=None): if use_poll: + if hasattr(select, 'poll'): + poll_fun = poll3 + else: poll_fun = poll2 else: poll_fun = poll From smoriano@s... Thu Dec 21 12:41:11 2000 From: smoriano@s... (Sergio Boix) Date: Thu, 21 Dec 2000 12:41:11 -0000 Subject: Modifiyng the ftp server dinamically Message-ID: <91stp7+anoe@e...> Hi all, I want to build an script to change the ftp server parameters dinamically from a remote machine. Is anyway to do it? Thanks in advace for your responses From rushing@n... Thu Dec 21 17:14:36 2000 From: rushing@n... (Sam Rushing) Date: Thu, 21 Dec 2000 09:14:36 -0800 Subject: [medusa] Modifiyng the ftp server dinamically References: <91stp7+anoe@e...> Message-ID: <3A423A7C.5030703@n...> Sergio Boix wrote: > Hi all, > > I want to build an script to change the ftp server parameters > dinamically from a remote machine. > > Is anyway to do it? The easiest way to do this sort of thing is to use the rpc service. See the files rpc_server.py and rpc_client.py in the distribution. [they use a lightweight, fast rpc built around marshal] -Sam From robin@j... Tue Jan 25 11:26:28 2000 From: robin@j... (Robin Becker) Date: Tue, 25 Jan 2000 11:26:28 +0000 Subject: [medusa] status.py out of sync? Message-ID: The Zope version at least of status.py seems to be out of sync with the recent changes to asyncore.py eg I think that channel_list_producer should contain something like channel_reprs = map ( lambda x: '<' + repr(x[0]) + ',' + repr(x[1])[1:-1] + '>', asyncore.socket_map.items() ) rather than channel_reprs = map ( lambda x: '<' + repr(x[1])[1:-1] + '>', asyncore.socket_map.keys() ) the same is true wherever we refer to the keys() as these seem to be just integers now rather than objects. -- Robin Becker From mike@e... Fri Jan 28 03:22:03 2000 From: mike@e... (Mike) Date: Thu, 27 Jan 2000 19:22:03 -0800 Subject: [medusa] More performance ?'s Message-ID: <86r20r$mhdn@e...> Hello, I read in the archives a few posts about perfomance. One of the posts mentions that medusa isn't as fast as thttpd or zeus and that medusa can't handle 1000 connections per second. My question is what -can- medusa handle? Basically, I need to compare it to apache with mod_fastcgi for using Zope. I'm having some trouble with mod_fastcgi and Zope that I don't have while using medusa in place of apache, so I'm pondering just giving up and using medusa. Since apache isn't the world's fastest web server, I assume that medusa is at least comparable. While I'm at it, how stable is medusa in the long run? I read on the web page that medusa is currently used in mission-critical applications, but can examples be provided (in terms of using it as a web server, which is my goal)? One last question: this will eventually be a commercial application, so I'll be purchasing a license for single server use. Other than the right to use medusa, are there any other benefits? Any support? Is it possible to purchase support? Who do I sue if it breaks? (kidding) Okay, one more question: since I'm a python and medusa newbie, this may seem like a dumb question, but how secure is medusa? Does it deal decently with buffers (ie, low likelihood of buffer overflow attacks) and can it stand up to a denial of service attack (many more connections than it can handle) without falling over (this may be more of a function of the OS, though)? Thanks, Mike From jim@d... Fri Jan 28 14:47:20 2000 From: jim@d... (Jim Fulton) Date: Fri, 28 Jan 2000 09:47:20 -0500 Subject: [medusa] Re: More performance ?'s References: <86r20r$mhdn@e...> Message-ID: <3891ABF8.BA892F29@d...> Mike wrote: > (snip) > Basically, I need to compare it to apache with mod_fastcgi for using > Zope. > I'm having some trouble with mod_fastcgi and Zope that I don't have > while > using medusa in place of apache, so I'm pondering just giving up and > using > medusa. Uh, ZServer is based on Medusa. Using Medusa to talk to ZServer is effectively using Medusa to talk to itself. Why not just use ZServer as your HTTP server? If you need to serve static content, you could install the standard Medusa HTTP server along side the various servers that Zope provides. Jim -- Jim Fulton mailto:jim@d... Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From mike@e... Fri Jan 28 15:25:17 2000 From: mike@e... (Mike) Date: Fri, 28 Jan 2000 07:25:17 -0800 Subject: [medusa] Re: More performance ?'s In-Reply-To: <3891ABF8.BA892F29@d...> Message-ID: <86scct$cb6m@e...> jim fulton wrote: original article:http://www.egroups.com/group/medusa/?start=133 > Uh, ZServer is based on Medusa. Using Medusa to talk to ZServer > is effectively using Medusa to talk to itself. Why not just > use ZServer as your HTTP server? Sorry about that, I wasn't clear. I meant that I wondered if ZServer, which is based on Medusa, was any faster/slower than Apache with mod_fastcgi. ZServer is working wonderfully, and Apache/mod_fastcgi is not, so I'm trying to figure out if it's worth my time to fix Apache/mod_fastcgi. If this is a question I should ask the Zope folk, I'll do that. Since ZServer is based on Medusa, and I was looking for a comparison of the two webservers, I figgured folks here could tell me about Medusa's (and therefore ZServer's) performance. > Jim Thanks, Mike From mike@e... Fri Jan 28 15:28:56 2000 From: mike@e... (Mike) Date: Fri, 28 Jan 2000 07:28:56 -0800 Subject: [medusa] Re: More performance ?'s In-Reply-To: <3891ABF8.BA892F29@d...> Message-ID: <86scjo$6dmk@e...> jim fulton wrote: original article:http://www.egroups.com/group/medusa/?start=133 > Uh, ZServer is based on Medusa. Using Medusa to talk to ZServer > is effectively using Medusa to talk to itself. Why not just > use ZServer as your HTTP server? Sorry about that, I wasn't clear. I meant that I wondered if ZServer, which is based on Medusa, was any faster/slower than Apache with mod_fastcgi. ZServer is working wonderfully, and Apache/mod_fastcgi is not, so I'm trying to figure out if it's worth my time to fix Apache/mod_fastcgi. If this is a question I should ask the Zope folk, I'll do that. Since ZServer is based on Medusa, and I was looking for a comparison of the two webservers, I figured folks here could tell me about Medusa's (and therefore ZServer's) performance. > Jim Thanks, Mike From rushing@n... Sat Jan 29 05:25:58 2000 From: rushing@n... (Sam Rushing) Date: Fri, 28 Jan 2000 21:25:58 -0800 (PST) Subject: [medusa] status.py out of sync? In-Reply-To: References: Message-ID: <14482.31206.663536.2048@s...> Robin Becker writes: > The Zope version at least of status.py seems to be out of sync with > the recent changes to asyncore.py > I think that channel_list_producer should contain something like > > channel_reprs = map ( > lambda x: '<' + repr(x[0]) + ',' + repr(x[1])[1:-1] + '>', > asyncore.socket_map.items() > ) asyncore.socket_map.values(), actually. > the same is true wherever we refer to the keys() as these seem to > be just integers now rather than objects. Yes, this change has been very painful, I'm continually finding things that are broken by it. -Sam From rushing@n... Sat Jan 29 05:58:59 2000 From: rushing@n... (Sam Rushing) Date: Fri, 28 Jan 2000 21:58:59 -0800 (PST) Subject: [medusa] More performance ?'s In-Reply-To: <86r20r$mhdn@e...> References: <86r20r$mhdn@e...> Message-ID: <14482.33187.774153.679275@s...> Mike writes: > I read in the archives a few posts about perfomance. One of the > posts mentions that medusa isn't as fast as thttpd or zeus and that > medusa can't handle 1000 connections per second. My question is > what -can- medusa handle? I haven't done any real testing recently, so it's hard to give real performance numbers. And of course, numbers will mean different things to different people; depending on the application, etc... > Basically, I need to compare it to apache with mod_fastcgi for > using Zope. I'm having some trouble with mod_fastcgi and Zope that > I don't have while using medusa in place of apache, so I'm > pondering just giving up and using medusa. The reason I hem-haw is that folks are often comparing apples and oranges. For many things, apache will be more than fast enough. It's when you try to bend it into something that it is not that you'll run into trouble. It's a question of design. For building a complex web server with lots of state, using apache to fire up cgi programs that make separate connections to a database for every hit is just fundamentally the wrong way to solve the problem. I would suggest taking your existing system, writing a simple handler for it and then benchmarking with your own code. > Since apache isn't the world's fastest web server, I assume that > medusa is at least comparable. For the delivery of static pages, it's quite likely that apache will be able to handle a higher load than Medusa 'out of the box'. However, by incrementally replacing bits of medusa with C modules, it should be possible to make it incrementally as fast as thttpd (since they share the same design). Why hasn't this been done yet? Because no one has needed it. > While I'm at it, how stable is medusa in the long run? I read on > the web page that medusa is currently used in mission-critical > applications, but can examples be provided (in terms of using it as > a web server, which is my goal)? I can think of two applications at eGroups that exposed the Medusa HTTP server to the outside world (the main site still uses PyApache): 1) the chat server 2) the ad servers The ad servers have recently been replaced with a coroutine implementation, but the chat server still uses medusa. [though it may get rewritten soon] Other folks may have more interesting examples. For my own purposes I usually use Medusa's HTTP server only for status/control of a system that does some other job. > One last question: this will eventually be a commercial > application, so I'll be purchasing a license for single server use. > Other than the right to use medusa, are there any other benefits? > Any support? Is it possible to purchase support? Who do I sue if > it breaks? (kidding) I'm more likely to Jump when folks ask; I do my best to help with problems and give advice. > Okay, one more question: since I'm a python and medusa newbie, this > may seem like a dumb question, but how secure is medusa? Does it > deal decently with buffers (ie, low likelihood of buffer overflow > attacks) and can it stand up to a denial of service attack (many > more connections than it can handle) without falling over (this may > be more of a function of the OS, though)? Python itself is immune from all the classic buffer overflows. DoS is another matter. There are not defenses against DoS in the stock Medusa; but I guarantee you that whatever approach you take to handling DoS will be easier to implement in Python than in C. In several projects I have used explicit queues to limit the number of descriptors; this approach works well. -Sam From rushing@n... Tue Feb 1 01:52:17 2000 From: rushing@n... (Sam Rushing) Date: Mon, 31 Jan 2000 17:52:17 -0800 (PST) Subject: [medusa] support for sendfile() on linux and freebsd Message-ID: <14486.15441.777671.754037@s...> I've added support for asynchronous sendfile() on linux and freebsd. So now you can do something like this: def my_method (self): fd = os.open (filename, os.O_RDONLY, 0644) size = os.lseek (fd, 0, 2) os.lseek (fd, 0, 0) self.push ('%08x' % size) self.push_sendfile (fd, 0, size, self.close_that_descriptor) self.close_when_done() See the 'sendfile' subdirectory for details. For you convenience, a new tarball has been rolled: http://www.nightmare.com/medusa/medusa-src-20000201.tar.gz Suggestions for a more portable interface are welcome, the current setup is a bit clumsy. Enjoy! -Sam From billtut@m... Thu Feb 3 20:59:45 2000 From: billtut@m... (Bill Tutt) Date: Thu, 3 Feb 2000 12:59:45 -0800 Subject: [medusa] Changes to the FTP stuff for use by efs/ange-ftp. Message-ID: <4D0A23B3F74DD111ACCD00805F31D8101D8BCCB3@R...> Since I start and stop IIS all day for debugging the MSN Yellowpages, I can't use IIS's FTP server from within XEmacs if I'm working remotely. So, I figured, lets see how easy it would be to make Medusa handle the gig. It turned out it wasn't that difficult. Changes: * Added support for XPWD since thats what the NT command line ftp client sends. * The long output now always includes the parent directory (".."), this is mostly to make life easier in XEmacs efs based DirEd sessions. (no, DirEd features via efs/ange-ftp haven't been tested, just simple navigation). * NLST now requires the -l option to be specified in order to get long output mode. All other ls options are ignored at the moment. * Ignore the common "*"-only glob. Notes: * It should be fairly easy to extend whats going on here to add support for more ls options. * ".." shouldn't be listed if you're listing the root directory of the filesystem. * XEmacs was happy with the Unix long output that Medusa produced, I didn't have to overload the system type response at all. * I wasn't sure if cmd_list() should have identical processing as cmd_nlst() so I didn't alter it. Submitted for your pleasure/pain, Bill Index: filesys.py =================================================================== RCS file: /usr/local/cvsroot/medusa/filesys.py,v retrieving revision 1.9 diff -u -r1.9 filesys.py --- filesys.py 1998/06/22 05:36:05 1.9 +++ filesys.py 2000/02/03 13:48:11 @@ -132,6 +132,9 @@ return self.cwd ('..') def listdir (self, path, long=0): + # Cheesy yanking of the all inclusive glob. + if path == "*": + path = "" p = self.translate (path) # I think we should glob, but limit it to the current # directory only. @@ -139,6 +142,10 @@ if not long: return list_producer (ld, 0, None) else: + # add ".." if we're doing the long printout. + # This really should only happen when -a or -A is used + # but, the option logic doesn't make its way down here. + ld = [".."] + ld old_dir = os.getcwd() try: os.chdir (p) Index: ftp_server.py =================================================================== RCS file: /usr/local/cvsroot/medusa/ftp_server.py,v retrieving revision 2.39 diff -u -r2.39 ftp_server.py --- ftp_server.py 1999/11/19 09:25:34 2.39 +++ ftp_server.py 2000/02/03 13:48:11 @@ -32,6 +32,9 @@ import string import sys import time +import StringIO +import shlex +import getopt # TODO: implement a directory listing cache. On very-high-load # servers this could save a lot of disk abuse, and possibly the @@ -198,19 +201,22 @@ def get_dir_list (self, line, long=0): # we need to scan the command line for arguments to '/bin/ls'... - args = line[1:] - path_args = [] - for arg in args: - if arg[0] != '-': - path_args.append (arg) - else: - # ignore arguments - pass - if len(path_args) < 1: - dir = '.' + # and strip them away since we currently don't make use of them. + # (except for triggering long mode...) + if len(line) > 1: + args = line[1] + # convert args into a list of arguments. + args = ConvertArgsStringToArgsList (args) + # Cool, now we can run this thing through getopt. + optlist, args = getopt.getopt (args, "abcdfgiklmnpqrstuxABCFGLNQRSUX") + for opt, optValue in optlist: + if opt == "-l": + long = 1 + args = [args[0]] else: - dir = path_args[0] - return self.listdir (dir, long) + args = ["."] + return self.listdir (args, long) + # -------------------------------------------------- # authorization methods @@ -378,12 +384,8 @@ def cmd_nlst (self, line): 'give name list of files in directory' - # ncftp adds the -FC argument for the user-visible 'nlist' - # command. We could try to emulate ls flags, but not just yet. - if '-FC' in line: - line.remove ('-FC') try: - dir_list_producer = self.get_dir_list (line, 0) + dir_list_producer = self.get_dir_list (line) except os.error, why: self.respond ('550 Could not list directory: %s' % repr(why)) return @@ -433,6 +435,9 @@ self.filesystem.current_directory() ) ) + + def cmd_xpwd (self, line): + self.cmd_pwd(line) # modification time # example output: @@ -1110,7 +1115,7 @@ 'xcup': 'change to parent of current working directory (deprecated)', 'xcwd': 'change working directory (deprecated)', 'xmkd': 'make a directory (deprecated)', #! - 'xpwd': 'print the current working directory (deprecated)', + 'xpwd': 'print the current working directory (deprecated)', #* 'xrmd': 'remove a directory (deprecated)', #! } @@ -1121,3 +1126,18 @@ def print_vm(): print 'vm: %8dk' % (get_vm_size()/1024) + +# Convert a string containing an argument list +# to the actual list of arguments. +def ConvertArgStringToArgList(s): + # All praise shlex! + lex = shlex.shlex(StringIO.StringIO(s)) + # Add '-' to the set of word characters so that '-''s group + # to the flags + lex.wordchars = lex.wordchars + '-' + lArgs = [] + token = lex.get_token() + while token != '': + lArgs.append(token) + token = lex.get_token() + return lArgs From szilveszter.juhos@d... Sat Feb 12 12:22:04 2000 From: szilveszter.juhos@d... (Szilveszter Juhos) Date: Sat, 12 Feb 2000 04:22:04 -0800 Subject: [medusa] Dynamic object plugin sample Message-ID: <883j9c$e64v@e...> Can somebody give me a sample how to send a brand-new executable (plugin) to a running Medusa server (via monitor or via a dedicated "new-handler-handling-handler")? Is there a sample already somewhere in the source? Thanks: Szilva From hurd@s... Wed Feb 16 09:00:37 2000 From: hurd@s... (Youngbong Choe) Date: Wed, 16 Feb 2000 01:00:37 -0800 Subject: [medusa] Usage for recv_channel in ftp_server.py Message-ID: <88dovl$uq9g@e...> hi, i'm a newbie in python and medusa. I built a simple file server using asyncore.py and asynchat.py, recv_channel and xmit_channel classes. but i could not understatand recv_channel, xmit_channel flow exactly. My question is this: 1. After adding new xmit channel and then push_with_producer(....), how can a client get the data? need new socket? or using current socket? 2. After adding new recv channel, how can a client send the data? i need a piece of wisdom :) thank you. -- hurd. From rushing@n... Wed Feb 16 09:15:28 2000 From: rushing@n... (Sam Rushing) Date: Wed, 16 Feb 2000 01:15:28 -0800 (PST) Subject: [medusa] Usage for recv_channel in ftp_server.py In-Reply-To: <88dovl$uq9g@e...> References: <88dovl$uq9g@e...> Message-ID: <14506.27312.924941.748934@s...> Youngbong Choe writes: > hi, i'm a newbie in python and medusa. > > I built a simple file server using asyncore.py and asynchat.py, > recv_channel and xmit_channel classes. > but i could not understatand recv_channel, xmit_channel flow exactly. Unless you really *need* to use the FTP protocol, I would not recommend modeling a new protocol on it (especially if your purpose is to learn how to do protocols!). It's a bit over-complicated because of the way it uses separate data and command channels. A simpler approach would be something modeled on HTTP, where commands and data are sent over a single socket. [this works because a TCP stream is a two-way communications channel; commands can go in one direction, data the other] > My question is this: > > 1. After adding new xmit channel and then push_with_producer(....), > how can a client get the data? need new socket? or using current socket? > 2. After adding new recv channel, how can a client send the data? This is what makes the ftp model complicated: since it uses a separate channel for data it is necessary to 1) set up a new listening socket 2) tell the client side what port to connect to 3) accept the client's connection, thereby 4) creating *another* socket, which you then send the data over. [I just described PASV-mode ftp, normal-mode FTP is just the same only the client does the listening] See? Very complicated compared to: class simple_file_transfer_channel: def __init__ (self, conn): self.set_terminator ('\r\n') [...] def found_terminator (self): self.buffer, filename = '', self.buffer self.push_with_producer (hypothetical_filename_producer (filename)) [...] In the above, you could request a file like this: $ telnet mymachine 9021 /etc/resolv.conf [... contents of /etc/resolv.conf ...] Hope that helps! -Sam From hurd@s... Wed Feb 16 09:27:06 2000 From: hurd@s... (Youngbong Choe) Date: Wed, 16 Feb 2000 01:27:06 -0800 Subject: [medusa] Re: Usage for recv_channel in ftp_server.py In-Reply-To: <14506.27312.924941.748934@s...> Message-ID: <88dqha$g4c0@e...> Thank you sam :) sam rushing wrote: original article:http://www.egroups.com/group/medusa/?start=144 > Youngbong Choe writes: > > hi, i'm a newbie in python and medusa. > > > > I built a simple file server using asyncore.py and asynchat.py, > > recv_channel and xmit_channel classes. > > but i could not understatand recv_channel, xmit_channel flow exactly. > > Unless you really *need* to use the FTP protocol, I would not > recommend modeling a new protocol on it (especially if your purpose is > to learn how to do protocols!). It's a bit over-complicated > because of the way it uses separate data and command channels. > > A simpler approach would be something modeled on HTTP, where > commands and data are sent over a single socket. [this works because > a TCP stream is a two-way communications channel; commands can go > in one direction, data the other] > > > My question is this: > > > > 1. After adding new xmit channel and then push_with_producer(... .), > > how can a client get the data? need new socket? or using current socket? > > 2. After adding new recv channel, how can a client send the data? > > This is what makes the ftp model complicated: since it uses a separate > channel for data it is necessary to > > 1) set up a new listening socket > 2) tell the client side what port to connect to > 3) accept the client's connection, thereby > 4) creating *another* socket, which you then send > the data over. > > [I just described PASV-mode ftp, normal-mode FTP is just the > same only the client does the listening] > > See? Very complicated compared to: > > class simple_file_transfer_channel: > def __init__ (self, conn): > self.set_terminator ('\r\n') > > [...] > def found_terminator (self): > self.buffer, filename = '', self.buffer > self.push_with_producer (hypothetical_filename_producer (filename)) > > [...] > > In the above, you could request a file like this: > > $ telnet mymachine 9021 > /etc/resolv.conf > [... contents of /etc/resolv.conf ...] > > Hope that helps! > > -Sam > From Amos@d... Wed Mar 29 02:12:39 2000 From: Amos@d... (Amos Latteier) Date: Tue, 28 Mar 2000 21:12:39 -0500 Subject: [medusa] select.error -- Interrupted system call Message-ID: <613145F79272D211914B0020AFF640193204EB@g...> Hi, I've got a report from a Zope user who is getting: select.error exception: (4, 'Interrupted system call') This occurs in asyncore.poll. It seems likely that this is related to using ZOracleDA. Does anyone have any ideas about what is causing this? -Amos -- Amos Latteier mailto:amos@d... Digital Creations http://www.digicool.com From rushing@n... Wed Mar 29 01:57:44 2000 From: rushing@n... (Sam Rushing) Date: Tue, 28 Mar 2000 17:57:44 -0800 (PST) Subject: [medusa] select.error -- Interrupted system call In-Reply-To: <613145F79272D211914B0020AFF640193204EB@g...> References: <613145F79272D211914B0020AFF640193204EB@g...> Message-ID: <14561.25368.129791.680648@s...> Amos Latteier writes: > Hi, > > I've got a report from a Zope user who is getting: > > select.error exception: (4, 'Interrupted system call') > > This occurs in asyncore.poll. It seems likely that this is related to > using ZOracleDA. > > Does anyone have any ideas about what is causing this? select() is supposed to return immediately whenever any signal is sent to the process. I usually avoid using signals, but have put handlers in some applications; I don't think I've had this problem before. What operating system? -Sam From rushing@e... Thu Apr 20 21:11:49 2000 From: rushing@e... (Sam Rushing) Date: Thu, 20 Apr 2000 13:11:49 -0700 (PDT) Subject: asyncore.poll() in C Message-ID: <14591.25733.420692.154681@s...> Andy Dustman has recently written a version of asyncore.poll() in C, it's still in alpha but looks interesting! ad> I was wondering if you ever heard of or tried my own asyncore ad> tweak, which is a C module that replaces asyncore.poll. (It ad> still does a select() call internally.) It also does almost ad> the same thing as your fdcache tweak, except it stores { ad> object: fd }. Since you are benchmarking things, I thought it ad> might be worth taking a look. ad> ad> http://dustman.net/andy/python/asyncore I've also placed a link on the main medusa page... -Sam From ngps@p... Fri Apr 28 16:37:14 2000 From: ngps@p... (Ng Pheng Siong) Date: Fri, 28 Apr 2000 23:37:14 +0800 Subject: [ngps@p...: [ANNOUNCE] ZServerSSL 0.04] Message-ID: <20000428233714.C684@m...> Hello, Pardon the spam. I believe the following might be of interest to Medusa users and hackers. ----- Forwarded message from Ng Pheng Siong ----- Date: Wed, 26 Apr 2000 00:28:12 +0800 From: Ng Pheng Siong To: zope-dev@z... Subject: [ANNOUNCE] ZServerSSL 0.04 X-Mailer: Mutt 1.0i Hello, I am pleased to announce the release of ZServerSSL 0.04. ZServerSSL provides a HTTPS server for Zope. In normal operation, ZServerSSL protects user names, passwords and data in transit against eavesdropping. This release of ZServerSSL presents a significant enhancement: X.509 certificate-based authentication for Zope. In this mode, Zope is run in "remote user" mode, and ZServerSSL's HTTPS server is configured to *require* user certificates. When a user connects, ZServerSSL handles certificate verification, maps the user certificate's "subject distinguished name" to a Zope username and sets REMOTE_USER accordingly. Zope's REMOTE_USER machinery takes care of the rest. Given valid user certificates and mappings from certificates to Zope users, Zope no longer requires passwords for access. This improves site security by removing the need to store passwords on the Zope site. This mode of operation can be adapted to other HTTPS servers like Apache+SSL, Roxen+SSL, etc. that perform certificate-based authentication. ZServerSSL is bundled with the latest snapshot of M2Crypto, and is also available as a separate package. It can be downloaded from here: http://www.post1.com/home/ngps/m2 Usual disclaimers apply. Feedback is very much appreciated. Cheers. -- Ng Pheng Siong * http://www.post1.com/home/ngps (BTW, what's this about no cross-posting btw zope-dev and zope?) ----- End forwarded message ----- -- Ng Pheng Siong * http://www.post1.com/home/ngps From jilanik@t... Fri Jun 2 10:01:53 2000 From: jilanik@t... (Jilani Khaldi) Date: Fri, 02 Jun 2000 11:01:53 +0200 Subject: How to keep python interpreter persistent? Message-ID: <39377801.A0C88677@t...> Hi All, I am new to medusa and I really like it. I wonder if it is possible to have only one instance of python interpreter for all cgi scripts. Jilani -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From robin@j... Fri Jun 2 10:21:52 2000 From: robin@j... (Robin Becker) Date: Fri, 2 Jun 2000 10:21:52 +0100 Subject: [medusa] How to keep python interpreter persistent? In-Reply-To: <39377801.A0C88677@t...> References: <39377801.A0C88677@t...> Message-ID: In article <39377801.A0C88677@t...>, Jilani Khaldi writes >Hi All, >I am new to medusa and I really like it. I wonder if it is possible to >have only one instance of python interpreter for all cgi scripts. > >Jilani > >-- > ... certainly medusa is the basis of Zope's ZServer and they have something called pcgi README notes for Persistent CGI - version 2.0 alpha 4 What it is? Persistent CGI is an architecture designed by Digital Creations http://www.digicool.com to publish web objects as long-running processes. The pcgi component is an integral part of DC's Principia product, but is also provided to Bobo developers under open software terms. Please review the copyright appearing in the source code for full details. -- Robin Becker From rushing@n... Fri Jun 2 23:00:08 2000 From: rushing@n... (Sam Rushing) Date: Fri, 2 Jun 2000 15:00:08 -0700 (PDT) Subject: [medusa] How to keep python interpreter persistent? In-Reply-To: <39377801.A0C88677@t...> References: <39377801.A0C88677@t...> Message-ID: <14648.11880.530963.26625@s...> Jilani Khaldi writes: > I am new to medusa and I really like it. I wonder if it is possible > to have only one instance of python interpreter for all cgi > scripts. This is one of the main ideas behind medusa, to keep the server running in a single process in order to make it easy to maintain state. Take a look at medusa/script_handler.py, and the files in the script_handler_demo.py directory. The main drawback with Medusa's 'CGI' model is that it can't be used for processing that would 'block' the rest of the server. Processing should be quick. For example, building a medusa server around a bsddb works well, but you can't (easily) make connections to an external SQL database, process, or server where the queries might take on the order of seconds. To solve that problem, check out the eGroups coroutine stuff here: http://www.nightmare.com/~rushing/copython/index.html -Sam From martinb@e... Fri Jun 2 23:13:36 2000 From: martinb@e... (Martin Baker) Date: Fri, 2 Jun 2000 15:13:36 -0700 (PDT) Subject: [medusa] How to keep python interpreter persistent? In-Reply-To: <14648.11880.530963.26625@s...> Message-ID: On Fri, 2 Jun 2000, Sam Rushing wrote: > To solve that problem, check out the eGroups coroutine stuff here: > > http://www.nightmare.com/~rushing/copython/index.html You can find more details (including an explanation of coroutines and links to the assembler coroutine package) in the README at http://www.egroups.com/files/python-coro/egroups/README-2000-04-24.txt The software itself is available at http://www.egroups.com/files/python-coro/egroups/egp-coro-20000424.tar.gz Martin PS Sam, you can add a link to the tar file (now available in a truly "public" manner). From jilanik@t... Sun Jun 4 16:13:05 2000 From: jilanik@t... (Jilani Khaldi) Date: Sun, 04 Jun 2000 17:13:05 +0200 Subject: medusa as a service on NT Message-ID: <393A7201.4B2AF8F7@t...> Hi All, how to get medusa working as a service on NT Server? Thanks. -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From jilanik@t... Sun Jun 4 16:13:17 2000 From: jilanik@t... (Jilani Khaldi) Date: Sun, 04 Jun 2000 17:13:17 +0200 Subject: Problems with medusa Message-ID: <393A720D.CFC15DD2@t...> Hi All, I have installed medusa on my Linux (Slackware 7.0). No problem for installation and to get it running. But when a access to it from a browser (Netscape - Windows), I get this error: ////////////////// error: Problem with DNS lookup (socket.error:(111, 'Connection refused') [asyncore.py|poll|75] [asyncore.py|handle_read_event|327] [resolver.py|handle_read|264] //////////////// my settings are: HOSTNAME = 'bellatrix.antares.it' IP_ADDRESS = '192.168.1.1' PUBLISHING_ROOT = '/home/www' I have the same problem with medusa installed in local on Windows2000 Pro. However, I can call the HTML pages from the browser, but I get the error, not on the browser, but on the console. What am I missing. Thanks. -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From jam@q... Sun Jun 4 16:26:12 2000 From: jam@q... (Jeff) Date: Sun, 4 Jun 2000 11:26:12 -0400 Subject: [medusa] Problems with medusa In-Reply-To: <393A720D.CFC15DD2@t...>; from jilanik@t... on Sun, Jun 04, 2000 at 05:13:17PM +0200 References: <393A720D.CFC15DD2@t...> Message-ID: <20000604112612.A20223@q...> On Sun, Jun 04, 2000 at 05:13:17PM +0200, Jilani Khaldi wrote: > Hi All, > I have installed medusa on my Linux (Slackware 7.0). No problem for > installation and to get it running. But when a access to it from a > browser (Netscape - Windows), I get this error: > > ////////////////// > error: Problem with DNS lookup (socket.error:(111, 'Connection refused') > [asyncore.py|poll|75] [asyncore.py|handle_read_event|327] > [resolver.py|handle_read|264] > //////////////// > medusa is attempting to perform a hostname lookup by connecting to (presumably) 'localhost'. what is the setup of your network? regards, J -- || visit gfd || psa member -- From jilanik@t... Sun Jun 4 20:49:43 2000 From: jilanik@t... (Jilani Khaldi) Date: Sun, 04 Jun 2000 21:49:43 +0200 Subject: [medusa] Problems with medusa References: <393A720D.CFC15DD2@t...> <20000604112612.A20223@q...> Message-ID: <393AB2D7.4D825926@t...> Jeff wrote: > On Sun, Jun 04, 2000 at 05:13:17PM +0200, Jilani Khaldi wrote: > > Hi All, > > I have installed medusa on my Linux (Slackware 7.0). No problem for > > installation and to get it running. But when a access to it from a > > browser (Netscape - Windows), I get this error: > > > > ////////////////// > > error: Problem with DNS lookup (socket.error:(111, 'Connection refused') > > [asyncore.py|poll|75] [asyncore.py|handle_read_event|327] > > [resolver.py|handle_read|264] > > //////////////// > > > > medusa is attempting to perform a hostname lookup by connecting to > (presumably) 'localhost'. what is the setup of your network? - Linux (Slackware 7.0) as server running medusa | HOSTNAME = 'bellatrix.antares.it' | # This is the IP address of the network interface you want | # your servers to be visible from. This can be changed to '' | # to listen on all interfaces. | IP_ADDRESS = '192.168.1.1' | | # Root of the http and ftp server's published filesystems. | PUBLISHING_ROOT = '/home/www' | | HTTP_PORT = 8080 # The standard port is 80 | FTP_PORT = 8021 # The standard port is 21 | CHAT_PORT = 8888 | MONITOR_PORT = 9999 Thse are my settings. -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From rushing@n... Sun Jun 4 22:31:24 2000 From: rushing@n... (Sam Rushing) Date: Sun, 4 Jun 2000 14:31:24 -0700 (PDT) Subject: [medusa] medusa as a service on NT In-Reply-To: <393A7201.4B2AF8F7@t...> References: <393A7201.4B2AF8F7@t...> Message-ID: <14650.51884.412494.422077@s...> Jilani Khaldi writes: > Hi All, > how to get medusa working as a service on NT Server? I think there's a utility in the NT resource kit that can be used to turn any console app into a service. -Sam From rushing@n... Sun Jun 4 22:33:42 2000 From: rushing@n... (Sam Rushing) Date: Sun, 4 Jun 2000 14:33:42 -0700 (PDT) Subject: [medusa] Problems with medusa In-Reply-To: <393A720D.CFC15DD2@t...> References: <393A720D.CFC15DD2@t...> Message-ID: <14650.52022.135912.748187@s...> Jilani Khaldi writes: > Hi All, > I have installed medusa on my Linux (Slackware 7.0). No problem for > installation and to get it running. But when a access to it from a > browser (Netscape - Windows), I get this error: > > ////////////////// > error: Problem with DNS lookup (socket.error:(111, 'Connection refused') > [asyncore.py|poll|75] [asyncore.py|handle_read_event|327] > [resolver.py|handle_read|264] > //////////////// > > my settings are: > HOSTNAME = 'bellatrix.antares.it' > IP_ADDRESS = '192.168.1.1' > PUBLISHING_ROOT = '/home/www' > > I have the same problem with medusa installed in local on > Windows2000 Pro. However, I can call the HTML pages from the > browser, but I get the error, not on the browser, but on the > console. What am I missing. Did you point the resolver at a local DNS server? There's a line in 'start_medusa.py' that looks like this: rs = resolver.caching_resolver ('127.0.0.1') It assumes there's a name server running on the local machine, but if there's not you should put the IP address of your local DNS server in there instead. Alternatively you could probably do this: rs = None Which would tell the HTTP server not to try to resolve addresses at all. -Sam From jam@q... Mon Jun 5 00:48:36 2000 From: jam@q... (Jeff) Date: Sun, 4 Jun 2000 19:48:36 -0400 Subject: [medusa] Problems with medusa In-Reply-To: <393AB2D7.4D825926@t...>; from jilanik@t... on Sun, Jun 04, 2000 at 09:49:43PM +0200 References: <393A720D.CFC15DD2@t...> <20000604112612.A20223@q...> <393AB2D7.4D825926@t...> Message-ID: <20000604194836.B20223@q...> On Sun, Jun 04, 2000 at 09:49:43PM +0200, Jilani Khaldi wrote: > - Linux (Slackware 7.0) as server running medusa do you have a 'bind' or /etc/hosts file? can you run 'host hellatrix.atares.it' and get a valid response? > | HOSTNAME = 'bellatrix.antares.it' does the problem go away if you change this to the ipaddress of the machine? is the machine behind a dialup connection? hmm.. maybe I'm barking up the wrong tree, but this really seems like a DNS problem to me. regards, J -- || visit gfd || psa member -- From jilanik@t... Mon Jun 5 09:48:01 2000 From: jilanik@t... (Jilani Khaldi) Date: Mon, 05 Jun 2000 10:48:01 +0200 Subject: Information about "Client_IP_Adress:Mysterious_Number" References: <393A720D.CFC15DD2@t...> <14650.52022.135912.748187@s...> Message-ID: <393B6940.A2A206BB@t...> Sam Rushing wrote: > Did you point the resolver at a local DNS server? There's a line > in 'start_medusa.py' that looks like this: > > rs = resolver.caching_resolver ('127.0.0.1') > > It assumes there's a name server running on the local machine, but if > there's not you should put the IP address of your local DNS server > in there instead. > > Alternatively you could probably do this: > > rs = None > > Which would tell the HTTP server not to try to resolve addresses at > all. Done! Thank you. Now everything seems to work fine. Everytime I open a web page I see on the monitor: IP_Address of the client + ':' + an other number which changes when I go on a new page. What does that number mean and how can I call it (know it) from a python script? Could that number (+ client IP_Address) be used to controll sessions? Jilani -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From jilanik@t... Mon Jun 5 12:26:46 2000 From: jilanik@t... (Jilani Khaldi) Date: Mon, 05 Jun 2000 13:26:46 +0200 Subject: python cgi scripts with medusa. How? Message-ID: <393B8E76.E1C7D8DD@t...> Hi, is it possible to write cgi scripts in python with medusa? If yes, tell me please how. ps. I have medusa installed on a Linux box at "/medusa" and html pages at "/home/www" -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From rushing@n... Mon Jun 5 12:31:47 2000 From: rushing@n... (Sam Rushing) Date: Mon, 5 Jun 2000 04:31:47 -0700 (PDT) Subject: [medusa] Information about "Client_IP_Adress:Mysterious_Number" In-Reply-To: <393B6940.A2A206BB@t...> References: <393A720D.CFC15DD2@t...> <14650.52022.135912.748187@s...> <393B6940.A2A206BB@t...> Message-ID: <14651.36771.771039.450948@s...> Jilani Khaldi writes: > Now everything seems to work fine. Everytime I open a web page I > see on the monitor: IP_Address of the client + ':' + an other > number which changes when I go on a new page. What does that > number mean and how can I call it (know it) from a python script? > Could that number (+ client IP_Address) be used to controll > sessions? If you're using the class, then you can access the object directory to find out the IP and port number of each connection. (something like request.channel.socket.getpeername() ought to work) However, using the ip:port pair is not a reliable way of tracking a user, because for example many users will come through a proxy. [i.e., they will be sharing the IP address with potentially thousands of other people]. The only reliable way to track users is to either use 'cookies': http://home.netscape.com/newsref/std/cookie_spec.html Or to use forms with hidden variables. [i.e., http://my_host/my_uri?id=29348392] -Sam From ray@u... Mon Jun 5 23:13:29 2000 From: ray@u... (Ray Price) Date: Mon, 05 Jun 2000 22:13:29 -0000 Subject: implications of asyncore.loop() timeout change Message-ID: <8hh8m9+blf5@e...> I've got a Linux Medusa server returning http pages via a Solaris Apache script (written in python to act as a proxy). For some reason the client does not see the complete page for 15-30 seconds. So, I went in and changed the asyncore.loop() timeout value from 30.0 to 0.5 and now pages are returned very quickly. The question is: what implications should I beware of when changing the timeout value in this way. FYI the asyncore module is shared between several other servers running XML-RPC and mxODBC. Before I made the timeout change, a client requesting a page directly from the Medusa server would 'free the stuck' page back to the proxy. Thanks for your comments, Ray From rushing@n... Mon Jun 5 23:22:55 2000 From: rushing@n... (Sam Rushing) Date: Mon, 5 Jun 2000 15:22:55 -0700 (PDT) Subject: [medusa] implications of asyncore.loop() timeout change In-Reply-To: <8hh8m9+blf5@e...> References: <8hh8m9+blf5@e...> Message-ID: <14652.10303.157403.860134@s...> Ray Price writes: > I've got a Linux Medusa server returning http pages via a Solaris > Apache script (written in python to act as a proxy). For some reason > the client does not see the complete page for 15-30 seconds. I'm not sure I understand the setup. The Apache server is not really involved, is it? It is generating pages with anchors pointing at the other server (on a different port or machine?). Are you calling 'request.done()' when finished generating the page? Sounds like there's a delay in closing the connection? > So, I went in and changed the asyncore.loop() timeout value from 30.0 > to 0.5 and now pages are returned very quickly. The timeout value represents how long (max) the select() loop will wait for anything to happen. If nothing happens, then the server will sit idle (not consuming CPU) until the timeout expires. > The question is: what implications should I beware of when changing > the timeout value in this way. FYI the asyncore module is shared > between several other servers running XML-RPC and mxODBC. by lowering the timeout, you create more busy-work for the server. It has to run through all the objects every 1/2 second rather than whenever there's activity. If your server is really busy (events come in at an average of 1/2 second anyway), then there won't be much of an impact. > Before I made the timeout change, a client requesting a page directly > from the Medusa server would 'free the stuck' page back to the proxy. Yes, because the activity on the server socket would 'wake up' the select() call. Sounds like something's getting 'stuck'. If you can, send me the code that generates the stuck page. -Sam From jilanik@t... Tue Jun 6 19:31:47 2000 From: jilanik@t... (Jilani Khaldi) Date: Tue, 06 Jun 2000 20:31:47 +0200 Subject: Medusa and web application Message-ID: <393D4393.FC3114AF@t...> Hi, could somebody points how to write web application using medusa and python? Please not tell me about Zope, it is huge and time consuming. Thank you Jilani -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From ppetru@c... Tue Jun 6 19:45:05 2000 From: ppetru@c... (Petru Paler) Date: Tue, 6 Jun 2000 21:45:05 +0300 (EEST) Subject: [medusa] Medusa and web application In-Reply-To: <393D4393.FC3114AF@t...> Message-ID: > could somebody points how to write web application using medusa and > python? > Please not tell me about Zope, it is huge and time consuming. (no intention to start a flamewar here) Contrary of what you think, Zope saves you a *big* amount of time compared to what you'd spend building by yourself. It is so big because of the large number of features it offers. -Petru From jilanik@t... Wed Jun 7 11:00:20 2000 From: jilanik@t... (Jilani Khaldi) Date: Wed, 07 Jun 2000 12:00:20 +0200 Subject: Medusa and web applications on Linux&C magazine References: Message-ID: <393E1D34.D56E01A5@t...> > (no intention to start a flamewar here) > Contrary of what you think, Zope saves you a *big* amount of time compared > to what you'd spend building by yourself. It is so big because of the > large number of features it offers. You are right Petru, but Zope is only apparently easy, and once you have a problem it will be very difficult to solve, seen the compexity of the product. All in Zope would be saved in a database and if your database is go corrupted, you loose everything and it is not a nice thing. PHP and Apache are very flexible, but I need a solution made at home using medusa as web server and python. A simple and homogeneous solution to pubblish on Linux&C (http://www.oltrelinux.com), the first italian magazine dedicated to Linux and FreeBSD. For the moment I am writing a series of articles about Interbase-Apache-PHP for web applications development, and I think the next articles will be about GadFly-medusa-python for small web applications.We have more than 30.000 readers monthly, so it will be interesting to promove medusa this way. Our goal is to promove freeware and open source; but all freeware and open source. Apache doesn't need any more tam tam, but small and interesting software like medusa need to be much more known. I am still wainting for help to go on. Any help will be welcome. Thank you. Jilani -- ___________________________________________________ http://space.tin.it/scuola/jkhaldi FreeBSD ~ The Power to Serve From paul@d... Wed Jun 7 13:30:07 2000 From: paul@d... (Paul Everitt) Date: Wed, 7 Jun 2000 08:30:07 -0400 Subject: [medusa] Medusa and web applications on Linux&C magazine Message-ID: <613145F79272D211914B0020AFF64019713527@g...> Jilani wrote: > You are right Petru, but Zope is only apparently easy, and > once you have a > problem it will be very difficult to solve, seen the > compexity of the product. > All in Zope would be saved in a database and if your database This isn't true. Skip Montanaro (long-time Python insider) doesn't use the object database. He just uses the publisher and template portion. That's why everything is arranged as Python packages. To be modular. You can use the publisher, the template system, and the object database independently of each other. > is go corrupted, > you loose everything and it is not a nice thing. PHP and > Apache are very > flexible, but I need a solution made at home using medusa as > web server and > python. A simple and homogeneous solution to pubblish on Linux&C > (http://www.oltrelinux.com), the first italian magazine > dedicated to Linux and Heh heh, you should check out: http://www.zopeit.org/ > FreeBSD. For the moment I am writing a series of articles about > Interbase-Apache-PHP for web applications development, and I > think the next > articles will be about GadFly-medusa-python for small web > applications.We have > more than 30.000 readers monthly, so it will be interesting > to promove medusa > this way. That's fine to have an agenda, but at least > Our goal is to promove freeware and open source; but all > freeware and open > source. Apache doesn't need any more tam tam, but small and > interesting > software like medusa need to be much more known. > I am still wainting for help to go on. Any help will be welcome. It's OK to have an agenda (promote Medusa). At least, though, don't say things about Zope that aren't true (such as your statement above about the object database). --Paul From rprice@u... Wed Jun 7 17:42:19 2000 From: rprice@u... (rprice@u...) Date: Wed, 7 Jun 2000 09:42:19 -0700 Subject: [medusa] Medusa and web applications on Linux&C magazine Message-ID: <882568F7.005B6FC6.00@b...> Hi, I'm another Zope user that only uses the publisher and template modules. Couldn't be happier. Ray Paul Everitt on 06/07/2000 05:30:07 AM Please respond to medusa@egroups.com To: medusa@egroups.com cc: (bcc: Ray Price/UAI) Subject: RE: [medusa] Medusa and web applications on Linux&C magazine Jilani wrote: > You are right Petru, but Zope is only apparently easy, and > once you have a > problem it will be very difficult to solve, seen the > compexity of the product. > All in Zope would be saved in a database and if your database This isn't true. Skip Montanaro (long-time Python insider) doesn't use the object database. He just uses the publisher and template portion. That's why everything is arranged as Python packages. To be modular. You can use the publisher, the template system, and the object database independently of each other. > is go corrupted, > you loose everything and it is not a nice thing. PHP and > Apache are very > flexible, but I need a solution made at home using medusa as > web server and > python. A simple and homogeneous solution to pubblish on Linux&C > (http://www.oltrelinux.com), the first italian magazine > dedicated to Linux and Heh heh, you should check out: http://www.zopeit.org/ > FreeBSD. For the moment I am writing a series of articles about > Interbase-Apache-PHP for web applications development, and I > think the next > articles will be about GadFly-medusa-python for small web > applications.We have > more than 30.000 readers monthly, so it will be interesting > to promove medusa > this way. That's fine to have an agenda, but at least > Our goal is to promove freeware and open source; but all > freeware and open > source. Apache doesn't need any more tam tam, but small and > interesting > software like medusa need to be much more known. > I am still wainting for help to go on. Any help will be welcome. It's OK to have an agenda (promote Medusa). At least, though, don't say things about Zope that aren't true (such as your statement above about the object database). --Paul ------------------------------------------------------------------------ Remember Father's Day Is June 18th Click Here For Great Gifts! http://click.egroups.com/1/5037/10/_/1360/_/960380985/ ------------------------------------------------------------------------ From edcjones@e... Thu Jun 15 16:22:36 2000 From: edcjones@e... (Edward C. Jones) Date: Thu, 15 Jun 2000 15:22:36 -0000 Subject: Newbie: "http://localhost" problem Message-ID: <8iasbs+1tpn@e...> I have put Medusa on my RedHat 6.1 Linux system. I started the demo program "publish.py". What can I now access through Netscape and how do I access it? What changes do I need to make in the Medusa defaults, the Netscape Preferences, and the Linux system configuration files? Currently "/etc/hosts.allow" and "/etc/hosts.deny" are empty and "/etc/hosts" contains "127.0.0.1 localhost localhost.localdomain". Thanks, Ed Jones From edcjones@e... Fri Jun 16 02:11:55 2000 From: edcjones@e... (Edward C. Jones) Date: Fri, 16 Jun 2000 01:11:55 -0000 Subject: Newbie: "http://localhost" problem In-Reply-To: <8iasbs+1tpn@e...> Message-ID: <8ibusr+i8hp@e...> --- In medusa@egroups.com, "Edward C. Jones" wrote: > I have put Medusa on my RedHat 6.1 Linux system. I started the demo > program "publish.py". What can I now access through Netscape and how > do I access it? What changes do I need to make in the Medusa defaults, > the Netscape Preferences, and the Linux system configuration files? > Currently "/etc/hosts.allow" and "/etc/hosts.deny" are empty and > "/etc/hosts" contains "127.0.0.1 localhost localhost.localdomain". As usual when I am a newbie in anything, questions always seem to take two days to answer, and the answers are simple. On my system, Netscape and Lynx use the port 8000 while the Medusa default is 8080. The answer is: "http://localhost:8080/...". No changes in system configuration or preferences files were needed. From henken@s... Sat Jun 24 18:03:39 2000 From: henken@s... (Nicholas Henke) Date: Sat, 24 Jun 2000 17:03:39 -0000 Subject: Weird CGI problem. Message-ID: <8j2plb+p439@e...> Hello, I have medusa setup and runnign just fine for serving webpages, but with a python script I have written, there seem to be some problems. It is a simple form based cgi that parses the input, and then ouputs a newpage based on the input. What is happening is that the script is getting called twice. There is a log message in the console window that medusa was started from that tells me there was an" error: uncaptured python exception, closing channel (socket.error:(32, 'Broken pipe') [asynchat.py|handle_read|80] [http_server.py|recv|397] [asyncore.py|recv|293]) " There is a line after this message that indicated that the script is getting called again. The second time it gets called, it seems to work just fine. I know the script works just fine for Apache, but I have no idea on how to start debugging medusa to see what is happening? Any ideas? Thanks ahead of time for any and all help Nicholas Henke From rushing@n... Sat Jun 24 19:08:54 2000 From: rushing@n... (Sam Rushing) Date: Sat, 24 Jun 2000 11:08:54 -0700 (PDT) Subject: [medusa] Weird CGI problem. In-Reply-To: <8j2plb+p439@e...> References: <8j2plb+p439@e...> Message-ID: <14676.63798.659539.260331@s...> Nicholas Henke writes: > There is a log message in the console window that medusa was > started from that tells me there was an" error: uncaptured python > exception, closing channel 165.123.102.198:4666 at 8172ea0 channel#: 1 requests:1> > (socket.error:(32, 'Broken pipe') [asynchat.py|handle_read|80] > [http_server.py|recv|397] [asyncore.py|recv|293]) " > There is a line after this message that indicated that the script > is getting called again. The second time it gets called, it seems > to work just fine. I know the script works just fine for Apache, > but I have no idea on how to start debugging medusa to see what is > happening? Any ideas? Is the second hit showing up on the same port number? It's possible that you're just seeing the log entry for the aborted connection. 'Broken Pipe' is the error you'll see whenever the connection is aborted by the browser side, which can happen if the user follows another link or hits the stop button before the page is finished loading. Does the problem show up on every hit to the script, or just occasionally? -Sam From henken@s... Sat Jun 24 19:14:39 2000 From: henken@s... (Nicholas Henke) Date: Sat, 24 Jun 2000 14:14:39 -0400 Subject: [medusa] Weird CGI problem. References: <8j2plb+p439@e...> <14676.63798.659539.260331@s...> Message-ID: <3954FA8F.A4A8C7BE@s...> Sam Rushing wrote: [SNIP] > > Is the second hit showing up on the same port number? It's possible > that you're just seeing the log entry for the aborted connection. Nope different port number It acutally looks like the script fails, and then gets called again > 'Broken Pipe' is the error you'll see whenever the connection is > aborted by the browser side, which can happen if the user follows > another link or hits the stop button before the page is finished > loading. Nothing doing...just waiting for execution > Does the problem show up on every hit to the script, or just > occasionally? > Every time... Hope this helps narrow it down. I wouldnt worry about it too much though, as I think I have found a solution. I have switched to using the simple CGI and HTTP servers included in the python distibution thanks again Nic -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The problem with the gene pool is that there is no lifeguard. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The dumber people think you are, the more surprised they will be when you kill them. From kbd@i... Thu Jul 6 13:42:33 2000 From: kbd@i... (Keith Davidson) Date: Thu, 06 Jul 2000 12:42:33 -0000 Subject: Interrupted system call issues Message-ID: <8k1urp+2cm2@e...> In order to get Medusa to play nicely in an application that uses SIGALRM, I had to make some changes to asyncore.py. Basically the change causes EINTR to be ignored if it is raised during the select (). According to "UNIX Network Programming" pg 124, it is ok to restart accept(), read(), write(), select(), etc after an EINTR. My questions... 1) Is simply ignoring the exception the right way to 'restart' the select() call? 2) Any other options for making Medusa work in an app with SIGALRM (no... I can't get rid of the SIGALRMs ;-). 3) Any possibility of incorporating this into the official version of Medusa if all the networking gurus agree it is correct? Thanks! Keith 35d34 < EINTR = 10004 43c42 < from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, ENOTCONN, ESHUTDOWN, EINTR --- > from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, ENOTCONN, ESHUTDOWN 56,61c55 < while 1: < try: < (r,w,e) = select.select (r,w,e, timeout) < break < except select.error, (errno, errstr): < if errno != EINTR: raise --- > (r,w,e) = select.select (r,w,e, timeout) From akuchlin@m... Thu Jul 6 23:05:21 2000 From: akuchlin@m... (Andrew Kuchling) Date: Thu, 06 Jul 2000 18:05:21 -0400 Subject: Adding poll() to Python 2.0 Message-ID: I'm looking at Medusa for work-related reasons, and noticed pollmodule.c on the Medusa page; I'd like to see the poll() function get into Python 2.0 (probably added to the posix module, judging by the reactions so far). Any objections? And who wrote pollmodule.c in the first place? --amk From vshkap01@h... Fri Jul 7 06:48:10 2000 From: vshkap01@h... (vshkap01@h...) Date: Fri, 07 Jul 2000 05:48:10 -0000 Subject: asyncore & asynchat implementation in C++ Message-ID: <8k3quq+kcb0@e...> Are there any plans to update the C++ version of the library. The file dates of cpp files are all 1996 compared with frequent updates of python version. Thanks for the comments, Vlad From akuchlin@m... Fri Jul 7 22:19:57 2000 From: akuchlin@m... (Andrew Kuchling) Date: Fri, 07 Jul 2000 17:19:57 -0400 Subject: Python 2.0 asyncore and asynchat.py Message-ID: I noticed the asyncore and asynchat.py in the Python CVS tree aren't the same as the ones in the most recent Medusa code. Should they be resynced so Python's copies are up-to-date? (Note that the ones in the Python CVS tree have had docstrings added to them; that change should be pulled into Sam's master copy of the source.) --amk From jim@d... Mon Jul 10 14:08:19 2000 From: jim@d... (Jim Fulton) Date: Mon, 10 Jul 2000 09:08:19 -0400 Subject: [medusa] Python 2.0 asyncore and asynchat.py References: Message-ID: <3969CAC3.B5F289BC@d...> Andrew Kuchling wrote: > > I noticed the asyncore and asynchat.py in the Python CVS tree aren't > the same as the ones in the most recent Medusa code. Should they be > resynced so Python's copies are up-to-date? Absolutely. They should only be in the standard distribution if they are maintained there. Jim -- Jim Fulton mailto:jim@d... Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From rushing@n... Tue Jul 11 04:35:20 2000 From: rushing@n... (Sam Rushing) Date: Mon, 10 Jul 2000 20:35:20 -0700 (PDT) Subject: [medusa] Adding poll() to Python 2.0 In-Reply-To: References: Message-ID: <14698.38392.921079.87711@s...> Andrew Kuchling writes: > I'm looking at Medusa for work-related reasons, and noticed > pollmodule.c on the Medusa page; I'd like to see the poll() > function get into Python 2.0 (probably added to the posix module, > judging by the reactions so far). Any objections? And who wrote > pollmodule.c in the first place? I wrote that particular pollmodule.c, I don't know if there are others. I think the idea of putting it into the posix module is a good one, actually: we have never used the poll support at eGroups simply because we have another module named 'poll' that does something completely unrelated. Probably a pretty common problem. [I was about to ask about moving select() over there, too, but I see that this has already started a discussion on python-dev] -Sam From rushing@n... Tue Jul 11 04:36:38 2000 From: rushing@n... (Sam Rushing) Date: Mon, 10 Jul 2000 20:36:38 -0700 (PDT) Subject: [medusa] asyncore & asynchat implementation in C++ In-Reply-To: <8k3quq+kcb0@e...> References: <8k3quq+kcb0@e...> Message-ID: <14698.38470.724666.67188@s...> vshkap01@h... writes: > Are there any plans to update the C++ version of the library. The > file dates of cpp files are all 1996 compared with frequent updates > of python version. Not that I know of. It's possible that Digital Creations is using that code (I think I originally wrote it for them?). I bet the moving-target nature of STL means it'll require some header renaming/juggling to get it to work nowadays. -Sam From akuchlin@c... Tue Jul 11 11:14:32 2000 From: akuchlin@c... (Andrew Kuchling) Date: Tue, 11 Jul 2000 06:14:32 -0400 Subject: [medusa] Adding poll() to Python 2.0 In-Reply-To: <14698.38392.921079.87711@s...>; from rushing@n... on Mon, Jul 10, 2000 at 08:35:20PM -0700 References: <14698.38392.921079.87711@s...> Message-ID: <20000711061432.A4222@n...> On Mon, Jul 10, 2000 at 08:35:20PM -0700, Sam Rushing wrote: >others. I think the idea of putting it into the posix module is a >good one, actually: we have never used the poll support at eGroups OK; I'm working on a patch and will submit it once it's ready. >[I was about to ask about moving select() over there, too, but I see > that this has already started a discussion on python-dev] The consensus here was that, while select() would probably go in posix if we could do it all over again, there's not much point in moving it now. The time machine has a broken dimensional stabilizer at the moment... --amk From jim@d... Tue Jul 11 13:52:41 2000 From: jim@d... (Jim Fulton) Date: Tue, 11 Jul 2000 08:52:41 -0400 Subject: [medusa] asyncore & asynchat implementation in C++ References: <8k3quq+kcb0@e...> <14698.38470.724666.67188@s...> Message-ID: <396B1899.B6A9C57D@d...> Sam Rushing wrote: > > vshkap01@h... writes: > > Are there any plans to update the C++ version of the library. The > > file dates of cpp files are all 1996 compared with frequent updates > > of python version. > > Not that I know of. It's possible that Digital Creations is using > that code (I think I originally wrote it for them?). If you did, I never knew of it. ;) If I pade for it, I would have wanted it in something portable, like C. :) Jim -- Jim Fulton mailto:jim@d... Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From yp66@h... Thu Jul 20 15:18:40 2000 From: yp66@h... (yp66@h...) Date: Thu, 20 Jul 2000 14:18:40 -0000 Subject: EINPROGRESS Message-ID: <8l71o0+lus8@e...> I am making a client/server application on Linux Redhat 6.1 Python 5.2 (default redhat distro). Both the client and server are using asynchat.py When I use the (default setting) non-blocking client socket, a EINPROGRESS exception occurs in the connect method, self.connected will not be set to 1 and therefore the flush() method will not do anything (if I set self.connected=1 by hand afterwards, my application works like a charm) (on NT it will give a EWOULDBLOCK) Is there a simple example for a client/server implemented with asynchat at both sides (simpler than the proxy-example) or an explanation for my little problem. With regards, Jaap CLIENT (partial) class PClientSocket (asynchat.async_chat): def __init__ (self, address=(SERVERIP,SERVERSOCKET)): asynchat.async_chat.__init__ (self) self.set_terminator (None) self.create_socket (socket.AF_INET, socket.SOCK_STREAM) self.buffer = '' #self.simpleterminator() #self.setblocking(1) self.connect (address) print address print self.connected self.connected=1 ................... SERVER (partial) class PSocketServer( asyncore.dispatcher ): def __init__( self, pServer ): self.pServer = pizzaServer # Registator of all connections asyncore.dispatcher.__init__( self ) self.create_socket( socket.AF_INET, socket.SOCK_STREAM ) self.set_reuse_addr() here = ( LISTENIP, LISTENSOCKET ) self.bind( here ) self.listen( 5 ) def handle_accept( self ): PSocketReceiver( self, self.accept(), self.pServer) class PSocketReceiver( asynchat.async_chat ): def __init__( self, server, (conn, addr), pServer): asynchat.async_chat.__init__( self, conn ) self.simpleterminator() self.buffer=[] self.data=[] self.pConnAddress = addr log("connection attempt at ip %s port %d" % self.pConnAddress ) self.pClient = pServer.connect( self ) From rushing@n... Thu Jul 20 18:42:09 2000 From: rushing@n... (Sam Rushing) Date: Thu, 20 Jul 2000 10:42:09 -0700 (PDT) Subject: [medusa] EINPROGRESS In-Reply-To: <8l71o0+lus8@e...> References: <8l71o0+lus8@e...> Message-ID: <14711.14833.983399.61163@s...> yp66@h... writes: > I am making a client/server application on Linux Redhat 6.1 Python > 5.2 (default redhat distro). > Both the client and server are using asynchat.py > When I use the (default setting) non-blocking client socket, a > EINPROGRESS exception occurs in the connect method, self.connected > will not be set to 1 and therefore the flush() method will not do > anything > (if I set self.connected=1 by hand afterwards, my application works > like a charm) > > (on NT it will give a EWOULDBLOCK) It looks like you're relying on the connect() succeeding immediately? Which isn't always going to be the case. [on a really fast local network it can actually succeed before the call to connect() returns, but this is certainly luck] What asyncore will do is this: as soon as it sees a 'WRITE' event on that socket, it will set 'connected=1', and will call the 'handle_connect' method. This is where you will want to place the code that would normally come directly after a blocking call to connect(). > Is there a simple example for a client/server implemented with > asynchat at both sides (simpler than the proxy-example) or an > explanation for my little problem. A quick scan over the medusa sources shows rpc_client and rpc_server, if you ignore all the RPC stuff and pay attention to the asynchat-based classes, these are pretty vanilla examples. -Sam From butcuz@y... Wed Aug 16 04:10:40 2000 From: butcuz@y... (But Cuz) Date: Tue, 15 Aug 2000 20:10:40 -0700 (PDT) Subject: poor man's zope and medusa Message-ID: <20000816031040.23384.qmail@w...> Has anybody had any experience using Poor Man's Zope and Medusa? "PMZ is a small Python script that allows you to combine HTML and Python code. It is very similar to Microsoft Active Server Pages or PHP3 or PHP4. So you can easily integrate Python into your HTML pages" [quoted from (http://pmz.sourceforge.net) ] PMZ is currently documented to run as a cgi script on apache. I was wondering is there any way I could do something similar with medusa. A pure python implementation would be xtracool. Preemptive thanks for any responses, Leved Kuce butcuz@y... __________________________________________________ Do You Yahoo!? Yahoo! Mail – Free email you can access from anywhere! http://mail.yahoo.com/ From jmpadmore@y... Thu Aug 24 19:05:06 2000 From: jmpadmore@y... (John Padmore) Date: Thu, 24 Aug 2000 18:05:06 -0000 Subject: Medusa on NT Message-ID: <8o3o4i+d50t@e...> I am receiving a large number of errors trying access HTML documents via IE 5. It seems to work fine on linux, however when run on nt, its like medusa doesnt send back all of the images all of the time. Any ideas? thx ck ckolp@m... From rushing@n... Thu Aug 24 20:57:40 2000 From: rushing@n... (Sam Rushing) Date: Thu, 24 Aug 2000 12:57:40 -0700 (PDT) Subject: [medusa] Medusa on NT In-Reply-To: <8o3o4i+d50t@e...> References: <8o3o4i+d50t@e...> Message-ID: <14757.32308.51552.764778@s...> John Padmore writes: > I am receiving a large number of errors trying access HTML documents > via IE 5. > > It seems to work fine on linux, however when run on nt, its like > medusa doesnt send back all of the images all of the time. > > Any ideas? Could you send me medusa's log? That way I'd have some idea exactly what errors are being seen. You might try changing the logic to turn off support for http/1.1, let me know if that helps. -Sam From akuchlin@m... Thu Sep 7 15:34:31 2000 From: akuchlin@m... (Andrew Kuchling) Date: Thu, 07 Sep 2000 10:34:31 -0400 Subject: Updated versions of asyncore/asynchat Message-ID: I've reconciled the slight divergence between the versions of asyncore.py and asynchat.py in Sam's distribution and the Python CVS tree. The Python tree uses outdated versions, but it also added module docstrings and fixed a typo in a comment. Sam, could you please get the updated versions of the files from http://www.mems-exchange.org/software/files/working/ ? They make no code changes at all, simply the docstring and comment changes. (I can make a patch if you like.) I'll also submit a Python patch to update the modules. --amk From jim@d... Thu Sep 7 15:36:53 2000 From: jim@d... (Jim Fulton) Date: Thu, 07 Sep 2000 10:36:53 -0400 Subject: [medusa] Updated versions of asyncore/asynchat References: Message-ID: <39B7A805.24EC136A@d...> Much thanks for sorting this out. Jim Andrew Kuchling wrote: > > > I've reconciled the slight divergence between the versions of > asyncore.py and asynchat.py in Sam's distribution and the Python CVS > tree. The Python tree uses outdated versions, but it also added > module docstrings and fixed a typo in a comment. > > Sam, could you please get the updated versions of the files from > http://www.mems-exchange.org/software/files/working/ ? They make no > code changes at all, simply the docstring and comment changes. (I can > make a patch if you like.) I'll also submit a Python patch to update > the modules. > > --amk -- Jim Fulton mailto:jim@d... Technical Director (888) 344-4332 Python Powered! Digital Creations http://www.digicool.com http://www.python.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From rushing@n... Thu Sep 7 22:34:13 2000 From: rushing@n... (Sam Rushing) Date: Thu, 7 Sep 2000 14:34:13 -0700 (PDT) Subject: [medusa] Updated versions of asyncore/asynchat In-Reply-To: References: Message-ID: <14776.2517.602780.222969@s...> Andrew Kuchling writes: > Sam, could you please get the updated versions of the files from > http://www.mems-exchange.org/software/files/working/ ? They make no > code changes at all, simply the docstring and comment changes. (I can > make a patch if you like.) I'll also submit a Python patch to update > the modules. Great, thanks for doing this! All future edits will go through official channels. 8^) I suppose I should take them out of CVS here. I wonder if there's some way to tell CVS that those particular files belong to a different CVS server? -Sam From jim@d... Tue Sep 26 14:21:45 2000 From: jim@d... (Jim Fulton) Date: Tue, 26 Sep 2000 09:21:45 -0400 Subject: Question: killing/shuting down asyncore servers Message-ID: <39D0A2E9.5EEAC23@d...> Are there any recommendations for shutting down asyncore-based servers cleanly from outside the servers? - Can a clean signal handler be written to handle kill events? I tried writing a signal handler that closed all the entries in the socket map, but I have a feeling that this isn't working properly. One of the problems I want to solve is getting the socket I'm listening on to close cleanly so that it isn't in use when I restart the server. I suspect I could make this work with some sort of dedicated select trigger. I think it probably wants to be dedicated because, if I used an existing select trigger, I'd need to worry about the possability that the signal would interrupt I/O on the select trigger. - I suppose I could include a shutdown server, such that if connections were made to this server, the application would shut-down cleanly. I could obviously generalize this to a more general control server, which might provide other commands. This approach is more portable, but requires clients more complicated than kill. :) How are other folks solving this problem? Jim -- Jim Fulton mailto:jim@d... Technical Director (888) 344-4332 Python Powered! Digital Creations http://www.digicool.com http://www.python.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From kbd@i... Tue Sep 26 14:52:48 2000 From: kbd@i... (Keith Davidson) Date: Tue, 26 Sep 2000 09:52:48 -0400 Subject: [medusa] Question: killing/shuting down asyncore servers References: <39D0A2E9.5EEAC23@d...> Message-ID: <00b901c027c1$0ea2de20$500c1d18@c...> I need to handle the same thing (i.e. cleanly handle 'kill' type shutdown scenarios gracefully). It would be great if Medusa or asyncore provided automatic support for this (preferably as an option since not everyone will want it). Please post if you come up with a clean solution! thanks, Keith ----- Original Message ----- From: "Jim Fulton" To: Sent: Tuesday, September 26, 2000 9:21 AM Subject: [medusa] Question: killing/shuting down asyncore servers > > Are there any recommendations for shutting down > asyncore-based servers cleanly from outside the > servers? > > - Can a clean signal handler be written to > handle kill events? I tried writing a signal > handler that closed all the entries in the socket > map, but I have a feeling that this isn't working > properly. One of the problems I want to solve is > getting the socket I'm listening on to close > cleanly so that it isn't in use when I restart > the server. > > I suspect I could make this work with some sort of > dedicated select trigger. I think it probably wants > to be dedicated because, if I used an existing select > trigger, I'd need to worry about the possability that > the signal would interrupt I/O on the select trigger. > > - I suppose I could include a shutdown server, such that > if connections were made to this server, the application > would shut-down cleanly. I could obviously generalize this > to a more general control server, which might provide > other commands. This approach is more portable, but > requires clients more complicated than kill. :) > > How are other folks solving this problem? > > Jim > > -- > Jim Fulton mailto:jim@d... > Technical Director (888) 344-4332 Python Powered! > Digital Creations http://www.digicool.com http://www.python.org > > Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email > address may not be added to any commercial mail list with out my > permission. Violation of my privacy with advertising or SPAM will > result in a suit for a MINIMUM of $500 damages/incident, $1500 for > repeats. > > > From fredrik@p... Thu Sep 28 10:25:39 2000 From: fredrik@p... (Fredrik Lundh) Date: Thu, 28 Sep 2000 11:25:39 +0200 Subject: [medusa] Question: killing/shuting down asyncore servers References: <39D0A2E9.5EEAC23@d...> Message-ID: <04dd01c0292e$11eb94a0$0900a8c0@S...> jim wrote: > How are other folks solving this problem? by calling the set_reuse_addr method on the listening socket? From mdeavila@s... Thu Sep 28 19:34:30 2000 From: mdeavila@s... (mdeavila@s...) Date: Thu, 28 Sep 2000 18:34:30 -0000 Subject: Medusa & JPython Message-ID: <8r02vm+kfet@e...> It appears that Medusa (ver. dated 2000/06/01) does not run under JPython. Specifically, Medusa uses the regex module, which does not exist under JPYthon. Is Medusa going to be upgraded to use the 're'module in place of the regex module? From akuchlin@m... Thu Sep 28 19:54:15 2000 From: akuchlin@m... (Andrew Kuchling) Date: Thu, 28 Sep 2000 14:54:15 -0400 Subject: [medusa] Medusa & JPython In-Reply-To: <8r02vm+kfet@e...>; from mdeavila@s... on Thu, Sep 28, 2000 at 06:34:30PM -0000 References: <8r02vm+kfet@e...> Message-ID: <20000928145415.B5433@k...> On Thu, Sep 28, 2000 at 06:34:30PM -0000, mdeavila@s... wrote: >It appears that Medusa (ver. dated 2000/06/01) does not run under >JPython. Specifically, Medusa uses the regex module, which does not >exist under JPYthon. Does JPython support an emulation of the select module, though? This would be critical to Medusa working at all. select could be emulated with threads, though I'd imagine this would make it impossible to handle very many clients simulatneously, due to the number of threads required. --amk From howardlightstone@s... Fri Sep 29 18:15:39 2000 From: howardlightstone@s... (howardlightstone@s...) Date: Fri, 29 Sep 2000 17:15:39 -0000 Subject: newbie asyncore question on win9x Message-ID: <8r2inr+ob5v@e...> I seem to be unable to get a simple test of asyncore to 'work'. I tried just a simple server/client pair (see below) but I never get a handle_recv event. I can see the connection being made between the slave accept port (some small port number like 13xx) and the master port (50007). After the master 'sends' data, the connection goes silently away. What am I not doing? Thanks ------------------------------------------------------------- 'Slave' server import string import socket import asyncore HOST = 'localhost' # Symbolic name meaning the local host PORT = 50007 # Arbitrary non-privileged server class goer(asyncore.dispatcher_with_send): def __init__(self, sock,conn,addr,reader=None): asyncore.dispatcher.__init__ (self,conn) self.create_socket (socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind(addr) self.listen(5) self.reader=reader print 'goer=',sock,conn,addr def handle_read(self): print 'handle read' if self.reader != None: self.reader(self) class checker(asyncore.dispatcher): def __init__(self, port=PORT): self.port = port asyncore.dispatcher.__init__ (self) self.create_socket (socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind((HOST, port)) self.listen(5) self.readin=None print 'checker init',self,self.socket def handle_accept(self): print 'handle accept' conn,addr=self.accept() g=goer(self,conn,addr,self.readin) print self,self.socket,g def read_me(asock): " reads from async socket" global endit print 'in read_me' data=asock.recv print data #endit=process(data) s=checker() s.readin=read_me endit=0 counter=0 while endit == 0: asyncore.poll() counter=counter+1 cv='%6d' % counter #show_whats_up asyncore.close_all() =========================================== 'master' client from socket import * HOST = 'localhost' # The remote host PORT = 50007 # The same port as used by the server s = socket(AF_INET, SOCK_STREAM) s.connect(HOST, PORT) while 1: x=raw_input('Command: ') if len(x): s.send(x) if x[0] == 'x': break s.close() From t.c.jones@a... Fri Sep 29 21:06:58 2000 From: t.c.jones@a... (t.c.jones@a...) Date: Fri, 29 Sep 2000 20:06:58 +0000 Subject: shut down Message-ID: <20000929200658.SYBA9211.mtiwmhc21.worldnet.att.net@w...> I have been running Medusa on a std Linux system for a while, but find that when I use ctl-Z to shut it down, it leaves a socket open. I then reboot to get things running again. Two questions: Is ctl-Z the correct way to terminate Medusa? Is there any more detailed documentation on running Medusa? thnx ..tomj From rushing@n... Sat Sep 30 22:57:10 2000 From: rushing@n... (Sam Rushing) Date: Sat, 30 Sep 2000 14:57:10 -0700 (PDT) Subject: [medusa] Question: killing/shuting down asyncore servers In-Reply-To: <39D0A2E9.5EEAC23@d...> References: <39D0A2E9.5EEAC23@d...> Message-ID: <14806.25014.546439.768981@s...> Jim Fulton writes: > Are there any recommendations for shutting down > asyncore-based servers cleanly from outside the > servers? > > - Can a clean signal handler be written to > handle kill events? I tried writing a signal > handler that closed all the entries in the socket > map, but I have a feeling that this isn't working > properly. One of the problems I want to solve is > getting the socket I'm listening on to close > cleanly so that it isn't in use when I restart > the server. > > I suspect I could make this work with some sort of > dedicated select trigger. I think it probably wants > to be dedicated because, if I used an existing select > trigger, I'd need to worry about the possability that > the signal would interrupt I/O on the select trigger. This is why I added the ExitNow exception to asyncore recently. But you can still have a problem with catch-all try/except clauses. Here's some code I've been using on unix: [excerpts] def handle_signal (*ignore): shutdown() import signal signal.signal (signal.SIGTERM, handle_signal) signal.signal (signal.SIGHUP, handle_signal) SHUTDOWN_PERFORMED = 0 def shutdown(): global SHUTDOWN_PERFORMED if not SHUTDOWN_PERFORMED: [other processing] asyncore.socket_map.clear() SHUTDOWN_PERFORMED = 1 raise asyncore.ExitNow Now this generally works. There are two cases where it can get in trouble: 1) you have a try/except that doesn't watch for ExitNow. I try to limit my use of catch-all try/except, so it's pretty easy to find these and fix them *if you have control of the code*. 2) Your exit handler will clear the socket map, and then raises an exception that crawls all the way up to the poll() function. poll() is probably in the middle of a for loop processing pending events on other channels. Processing those events can actually repopulate the socket map, and the normal exit condition of an empty socket map isn't seen. Making the pending-events stuff globally accessible (like the socket_map itself) could fix this. But I wouldn't enjoy explaining such code to others. > - I suppose I could include a shutdown server, such that > if connections were made to this server, the application > would shut-down cleanly. I could obviously generalize this > to a more general control server, which might provide > other commands. This approach is more portable, but > requires clients more complicated than kill. :) I've used the marshal-based rpc classes (recently added to the distribution) for exactly this. Rather than calling a shutdown() function directly, it's cleaner to schedule a shutdown to happen in a couple of seconds. -Sam From rushing@n... Sat Sep 30 23:09:30 2000 From: rushing@n... (Sam Rushing) Date: Sat, 30 Sep 2000 15:09:30 -0700 (PDT) Subject: [medusa] Medusa & JPython In-Reply-To: <20000928145415.B5433@k...> References: <8r02vm+kfet@e...> <20000928145415.B5433@k...> Message-ID: <14806.25754.607738.65033@s...> Andrew Kuchling writes: > On Thu, Sep 28, 2000 at 06:34:30PM -0000, mdeavila@s... wrote: > >It appears that Medusa (ver. dated 2000/06/01) does not run under > >JPython. Specifically, Medusa uses the regex module, which does not > >exist under JPYthon. > > Does JPython support an emulation of the select module, though? This > would be critical to Medusa working at all. select could be emulated > with threads, though I'd imagine this would make it impossible to > handle very many clients simulatneously, due to the number of threads > required. Running something like Medusa under Java is probably pointless, unless you were to use an 'illegal' Java that exposed a real select(). To further explain: Java's "Green Threads" implementation is actually very similar to the select()-loop core of Medusa itself - it gives the illusion of threads by multiplexing I/O and attaching a scheduler to a timer. -Sam From rushing@n... Sat Sep 30 23:19:07 2000 From: rushing@n... (Sam Rushing) Date: Sat, 30 Sep 2000 15:19:07 -0700 (PDT) Subject: [medusa] newbie asyncore question on win9x In-Reply-To: <8r2inr+ob5v@e...> References: <8r2inr+ob5v@e...> Message-ID: <14806.26331.276635.943386@s...> howardlightstone@s... writes: > I seem to be unable to get a simple test of asyncore to 'work'. I > tried just a simple server/client pair (see below) but I never get a > handle_recv event. I can see the connection being made between the > slave accept port (some small port number like 13xx) and the master > port (50007). After the master 'sends' data, the connection goes > silently away. What am I not doing? > class goer(asyncore.dispatcher_with_send): > def __init__(self, sock,conn,addr,reader=None): > asyncore.dispatcher.__init__ (self,conn) The following four lines aren't necessary... the 'conn' parameter initializes your 'goer' object directly via the above line. The steps below are needed only for a server socket. A server socket's only purpose is to accept connections and thus produce new sockets. > self.create_socket (socket.AF_INET, socket.SOCK_STREAM) > self.set_reuse_addr() > self.bind(addr) > self.listen(5) Also, the 'sock' argument above is confusing - it's actually the server object (of class 'checker') from below, a better name for this parameter might be 'server'. I think if you just remove the four lines above it will work. > self.reader=reader > print 'goer=',sock,conn,addr > > def handle_read(self): > print 'handle read' > if self.reader != None: > self.reader(self) -Sam From rushing@n... Sat Sep 30 23:23:46 2000 From: rushing@n... (Sam Rushing) Date: Sat, 30 Sep 2000 15:23:46 -0700 (PDT) Subject: [medusa] shut down In-Reply-To: <20000929200658.SYBA9211.mtiwmhc21.worldnet.att.net@w...> References: <20000929200658.SYBA9211.mtiwmhc21.worldnet.att.net@w...> Message-ID: <14806.26610.963444.931140@s...> t.c.jones@a... writes: > I have been running Medusa on a std Linux system for a > while, but find that when I use ctl-Z to shut it down, it > leaves a socket open. I then reboot to get things > running again. > > Two questions: > > Is ctl-Z the correct way to terminate Medusa? Ctrl-Z will normally 'suspend' the job, leaving it in a STOPPED state in the background. [you can use 'fg' and 'bg' to change the status of stopped jobs. type 'help fg' and 'help bg' for a little more info] More likely what you want is Ctrl-C. > Is there any more detailed documentation on running Medusa? If you're new to socket programming I would suggest playing around with socket from the python prompt directly; for example open a couple of terminal windows, create a server socket in one window, connect to it from another python in another window, exchange data back and for, etc... Once you understand how sockets work, you might go through the tutorial that comes with the medusa distribution. -Sam From jim@d... Sun Oct 1 15:11:32 2000 From: jim@d... (Jim Fulton) Date: Sun, 01 Oct 2000 10:11:32 -0400 Subject: [medusa] Question: killing/shuting down asyncore servers References: <39D0A2E9.5EEAC23@d...> <04dd01c0292e$11eb94a0$0900a8c0@S...> Message-ID: <39D74614.D257476@d...> Fredrik Lundh wrote: > > jim wrote: > > How are other folks solving this problem? > > by calling the set_reuse_addr method on the listening socket? Ah. Reading Stevens, it looks like all servers should set this. This solves the "address already in use" problem. I wonder whi all medusa servers don'e set this. I'll make sure all of ours do. Jim -- Jim Fulton mailto:jim@d... Technical Director (888) 344-4332 Python Powered! Digital Creations http://www.digicool.com http://www.python.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From jim@d... Sun Oct 1 15:32:27 2000 From: jim@d... (Jim Fulton) Date: Sun, 01 Oct 2000 10:32:27 -0400 Subject: select, signals, and "interrupted system call" (EINTR) Message-ID: <39D74AFB.322E5187@d...> If a select-based (or, presumably, poll-based) server wants to use signals for anything other than shutdown (e.g. closing and reopening log files, rereading configs, etc.), then, on some platforms, a select call can fail with an "interrupted system call" (EINTR) error that should be ignored. The asyncore main loop should check for this error in it's select call and the select module should make this error easier to check for. In Python 1.5.2, the medusa select call can be changed from r,w,e = select.select (r,w,e, timeout) to: while 1: try: r,w,e = select.select (r,w,e, timeout) except select.error, v: if v[0] != EINTR: raise else: break I presume that this works in Python 1.6/2.0, but I haven't tried it yet? This depends on the structure of select.error values and requires that we get EINTR from somewhere. (What should the value be on NT?) I wonder if there should be an InterruptedSystemCall exception somewhere that select raises in this case? At a minimum, code like the above should be added to asyncore. Thoughts? Jim -- Jim Fulton mailto:jim@d... Technical Director (888) 344-4332 Python Powered! Digital Creations http://www.digicool.com http://www.python.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From rushing@n... Sun Oct 1 19:55:00 2000 From: rushing@n... (Sam Rushing) Date: Sun, 1 Oct 2000 11:55:00 -0700 (PDT) Subject: [medusa] Question: killing/shuting down asyncore servers In-Reply-To: <39D74614.D257476@d...> References: <39D0A2E9.5EEAC23@d...> <04dd01c0292e$11eb94a0$0900a8c0@S...> <39D74614.D257476@d...> Message-ID: <14807.34948.795398.765095@s...> Jim Fulton writes: > Fredrik Lundh wrote: > > jim wrote: > > > How are other folks solving this problem? > > > > by calling the set_reuse_addr method on the listening socket? > > Ah. Reading Stevens, it looks like all servers should set this. > This solves the "address already in use" problem. I wonder whi all > medusa servers don'e set this. I'll make sure all of ours do. Presumably there are situations where you'd not want to take over the socket (or share it with an existing process? I'm not sure what the semantics are). I didn't want to make it the default, but I did wrap the setsockopt() calls to make it as easy as possible. [Hmmm.. and it looks like I call it for the base http and ftp server classes] -Sam From rushing@n... Sun Oct 1 20:07:59 2000 From: rushing@n... (Sam Rushing) Date: Sun, 1 Oct 2000 12:07:59 -0700 (PDT) Subject: [medusa] select, signals, and "interrupted system call" (EINTR) In-Reply-To: <39D74AFB.322E5187@d...> References: <39D74AFB.322E5187@d...> Message-ID: <14807.35727.423642.721873@s...> Jim Fulton writes: > The asyncore main loop should check for this error in it's select > call and the select module should make this error easier to check > for. It might go better into the event_loop function, which I think of as a more user-serviceable part. [for example, the default loop vs. the one in medusa/event_loop.py that supports schedulable events] > I presume that this works in Python 1.6/2.0, but I > haven't tried it yet? > > This depends on the structure of select.error values > and requires that we get EINTR from somewhere. (What > should the value be on NT?) If it's a big problem, I guess we could use a different default event_loop() function for win32 vs. unix. > At a minimum, code like the above should be added to asyncore. > > Thoughts? This has been asked for several times, I agree it'd be nice to have at least a note in the docs.. -Sam From t.c.jones@a... Wed Oct 4 06:43:11 2000 From: t.c.jones@a... (t.c.jones@a...) Date: Wed, 04 Oct 2000 05:43:11 +0000 Subject: getting environ variables in a script Message-ID: <20001004054312.VDCC9211.mtiwmhc21.worldnet.att.net@w...> I need to access header variables (like accept:) in a script and wondered if anyone has a preferred way to do that. I was thinking about execve and putting them all into a dictonary (like os.environ returns.) ..tom From zmbq@a... Wed Oct 4 15:38:15 2000 From: zmbq@a... (Itay Zandbank) Date: Wed, 4 Oct 2000 17:38:15 +0300 Subject: Stalled producers Message-ID: <01cb01c02e10$bb21e8d0$05010101@s...> ---------------------- multipart/alternative attachment I was going through the proxy server example (work_in_progress/http_proxy= .py) while writing something somewhat similar, and I encountered quite a fe= w problems with it. First, the http_proxy_producer is not added as a producer to the http_cha= nnel. This was quite confusing at first, because I assumed from its name th= at it's a producer, and was surprised to see its more() method never gets c= alled. Once I added the producer to the channel (using push_with_producer, = of course), the channel closed immediately, giving me no chance to collect = the data, and without calling my stalled() method. I traced the problem down to async_chat.refill_buffer(). Refill_buffer() = simply eliminates producers that return an empty response, without ever bot= hering to check if they are stalled. The writable_for_proxy method doesn't = fix this, because push_with_producer calls initiate_send, which in turn cal= ls refill_buffer. So pushing a stalled producer with no input is always goi= ng to be the last thing you do with that producer (well, more() will be cal= led once, if that's any consolation). To fix it, I had to override refill_buffer in my channel, and check wheth= er the first producer is stalled. If it isn't, I pass control to the origin= al refill_buffer, something like this: def refill_buffer(self): try: p =3D self.producer_fifo.first() if p.stalled(): return except: pass http_server.http_channel.refill_buffer(self) Itay. ---------------------- multipart/alternative attachment An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail-21/medusa-dev/attachments/87b42962/attachment.html ---------------------- multipart/alternative attachment-- From zmbq@a... Wed Oct 4 15:53:24 2000 From: zmbq@a... (Itay Zandbank) Date: Wed, 4 Oct 2000 17:53:24 +0300 Subject: Multithreaded Medusa Message-ID: <01e701c02e12$d8dd6190$05010101@s...> ---------------------- multipart/alternative attachment Aside from stalled producers, I also needed to multi-thread Medusa. I hav= e a proxy server, that does some processing on the passing data. This proce= ssing is pretty quick. Quick enough to put in the main select thread withou= t slowing things down (the overhead of delegating the job to another thread= , even if that thread is already running, is not worth it). The problem is = with multi-CPU machines. On a machine with two CPUs, having two threads can= have a drastic impact on performance. What I came up with, then, was this: Have one thread listening for incomi= ng connections, and one (or more, depending on the number of CPUs you have)= process these connections. The theory seemed easy enough. But then reality= hit me. Since I have two (or more) threads working on network connections,= I need two select loops, and more importantly, two socket_maps. All throughout Medusa, there's code that assumes the socket map is asynco= re.socket_map (in http_server, for instance). What I had to do eventually, = was create a class (I called it Redirector), which has two methods - add_ch= annel and del_channel, which put the socket in the right socket_map, like t= his: class Redirector: def __init__(self, socket_map): self.socket_map =3D socket_map def add_channel(self, map=3DNone): if map is None: map =3D self.socket_map asynccore.dispatcher.add_channel(self, map) def del_channel(self, map=3DNone): # Very much like add_channel Each time I have an asyncore.dispatcher derived class in my souce, I also= derive it from Redirector. This works, but it's really ugly (I'm sure that in a month, I'll spend an= entire week tracking down a bug caused by not deriving a class from Redire= ctor). It would have been much better if asyncore.dispatcher had a socket_m= ap member in the first place. The default can still be the global socket_ma= p, so no code will break. Thanks again, Itay. ---------------------- multipart/alternative attachment An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail-21/medusa-dev/attachments/adfe8fd7/attachment.html ---------------------- multipart/alternative attachment-- From jim@d... Wed Oct 4 16:46:14 2000 From: jim@d... (Jim Fulton) Date: Wed, 04 Oct 2000 11:46:14 -0400 Subject: [medusa] Multithreaded Medusa References: <01e701c02e12$d8dd6190$05010101@s...> Message-ID: <39DB50C6.948BCDAC@d...> > Itay Zandbank wrote: > > Aside from stalled producers, I also needed to multi-thread Medusa. I have a proxy server, that does some processing on the passing data. This processing is pretty quick. Quick enough to put in the main select thread without slowing things down (the overhead of delegating the job to another thread, even if that thread is already running, is not worth it). The problem is with multi-CPU machines. On a machine with two CPUs, having two threads can have a drastic impact on performance. You won't get a drastic improvement in performance using Python, since only one thread can be in the interpreter at a time. There are exotic ways to get around this involving running two interpreters, but I haven't tried them. > What I came up with, then, was this: Have one thread listening for incoming connections, and one (or more, depending on the number of CPUs you have) process these connections. The theory seemed easy enough. But then reality hit me. Since I have two (or more) threads working on network connections, I need two select loops, and more importantly, two socket_maps. > > All throughout Medusa, there's code that assumes the socket map is asyncore.socket_map (in http_server, for instance). What I had to do eventually, was create a class (I called it Redirector), which has two methods - add_channel and del_channel, which put the socket in the right socket_map, like this: > > class Redirector: > def __init__(self, socket_map): > self.socket_map = socket_map > > def add_channel(self, map=None): > if map is None: > map = self.socket_map > asynccore.dispatcher.add_channel(self, map) > > def del_channel(self, map=None): > # Very much like add_channel > > > Each time I have an asyncore.dispatcher derived class in my souce, I also derive it from Redirector. > > This works, but it's really ugly (I'm sure that in a month, I'll spend an entire week tracking down a bug caused by not deriving a class from Redirector). It would have been much better if asyncore.dispatcher had a socket_map member in the first place. The default can still be the global socket_map, so no code will break. I raised this same issue a while ago. At least asyncore now lets you specify alternate socket maps. :) Jim -- Jim Fulton mailto:jim@d... Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From zmbq@a... Wed Oct 4 17:04:56 2000 From: zmbq@a... (Itay Zandbank) Date: Wed, 4 Oct 2000 19:04:56 +0300 Subject: [medusa] Multithreaded Medusa References: <01e701c02e12$d8dd6190$05010101@s...> <39DB50C6.948BCDAC@d...> Message-ID: <01fd01c02e1c$d749e4c0$05010101@s...> > You won't get a drastic improvement in performance using Python, since only one thread > can be in the interpreter at a time. There are exotic ways to get around this involving > running two interpreters, but I haven't tried them. Oh, RIGHT! I can't believe I missed that. Running several processes is not a bad idea, actually. I already have a root process that's responsible for spawning a child process which will do all the work (the root process is there to shut the child down gracefully, without cutting existing connections). Changing it to run several children instead of just one is going to be pretty easy. > I raised this same issue a while ago. At least asyncore now lets > you specify alternate socket maps. :) Who cares? I don't need this any more :-) From cwagner@s... Wed Oct 4 17:51:17 2000 From: cwagner@s... (Chuck Wagner) Date: Wed, 4 Oct 2000 11:51:17 -0500 Subject: [medusa] Confirm your new account with eGroups References: <970678063.3069@egroups.com> Message-ID: <001801c02e23$50ebfd30$6401c10a@b...> ----- Original Message ----- From: "eGroups" To: Sent: Wednesday, October 04, 2000 11:47 AM Subject: [medusa] Confirm your new account with eGroups > > Hello, > > Thank you for your interest in eGroups, a free email group > service. To activate your account with eGroups, we need to > verify that your email address is correct. To protect your email > address, your account will not be activated until you follow one > of the confirmation steps below: > > 1. PLEASE REPLY to this email using the reply function in your email > program. Your correct email address will be entered automatically. > > OR > > 2. VISIT > http://www.egroups.com/confirm.cgi?email=medusa%40e-groups%2Ecom&id=8997 > and follow the easy instructions. > > To access the eGroups web site, please visit > http://www.egroups.com > > If you did not request, or do not want, a eGroups account, > please accept our apologies and ignore this message. > > > Regards, > > eGroups Customer Support > > IMPORTANT NOTE: If you believe your email address has been registered > with eGroups without your consent, please forward a copy > of this message to abuse@egroups.com > > > > > > > > > From zmbq@a... Wed Oct 4 18:27:42 2000 From: zmbq@a... (Itay Zandbank) Date: Wed, 4 Oct 2000 20:27:42 +0300 Subject: [medusa] Question: killing/shuting down asyncore servers References: <39D0A2E9.5EEAC23@d...> Message-ID: <00bb01c02e28$80d84300$e5d05c8b@i...> Woops, just bumped into this. > other commands. This approach is more portable, but > requires clients more complicated than kill. :) > How are other folks solving this problem? Instead of signals, I use a named pipe. I can't use kill as my client, but echo performs well, to :-) From jim@d... Thu Oct 5 19:10:42 2000 From: jim@d... (Jim Fulton) Date: Thu, 05 Oct 2000 14:10:42 -0400 Subject: [medusa] select, signals, and "interrupted system call" (EINTR) References: <39D74AFB.322E5187@d...> <14807.35727.423642.721873@s...> Message-ID: <39DCC422.90E4D0D5@d...> Sam Rushing wrote: > > Jim Fulton writes: > > The asyncore main loop should check for this error in it's select > > call and the select module should make this error easier to check > > for. > > It might go better into the event_loop function, which I think of as a > more user-serviceable part. [for example, the default loop vs. the > one in medusa/event_loop.py that supports schedulable events] Don't you think anyone using select on Unix would want this? This isn't really an application-specific thing is it? > > I presume that this works in Python 1.6/2.0, but I > > haven't tried it yet? > > > > This depends on the structure of select.error values > > and requires that we get EINTR from somewhere. (What > > should the value be on NT?) > > If it's a big problem, I guess we could use a different default > event_loop() function for win32 vs. unix. Or we could put this in the poll function and reraise the error on NT, as my change does. Jim -- Jim Fulton mailto:jim@d... Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. From edcjones@e... Tue Oct 10 21:00:15 2000 From: edcjones@e... (Edward C. Jones) Date: Tue, 10 Oct 2000 20:00:15 -0000 Subject: How to use proxy.py? Message-ID: <8rvsgf+ok6n@e...> I use RedHat Linux 6.2 with Python 1.5.2. How do you put proxy.py between Netscape and the Internet? (What arguments do I give proxy.py, etc.?) I have looked at programming.html. All it says is "You might also try pointing a real client (a news reader [port 119] or web browser [port 80]) at your proxy." Thanks, Ed Jones From simuran@h... Wed Oct 11 09:02:28 2000 From: simuran@h... (simuran@h...) Date: 11 Oct 2000 02:02:28 -0600 Subject: [comp.lang.python] Async sockets. Message-ID: ---------------------- multipart/mixed attachment Hi. I think this question would be more appropriate here. Any help would be greatly appreatiated. ---------------------- multipart/mixed attachment An embedded message was scrubbed... From: simuran@h... (Alexandre A. Rodioukov) Subject: Async sockets. Date: Tue, 10 Oct 2000 00:37:36 GMT Size: 1426 Url: http://mail.python.org/pipermail-21/medusa-dev/attachments/d2370897/attachment.txt ---------------------- multipart/mixed attachment Alex. ---------------------- multipart/mixed attachment-- From webmaster@a... Wed Oct 11 23:04:43 2000 From: webmaster@a... (Emmanuel DISCORS) Date: Thu, 12 Oct 2000 00:04:43 +0200 Subject: Question to medusa & bobo_handler.py users Message-ID: <00101200414600.00650@s...> Hi all, Trying to use Medusa & bobo_handler.py. Seems to work well ; Very nice system ;-) Medusa version : medusa-src-20000601.tar.gz Document Template : DocumentTemplate-2_2_tar BoboPos DB : Not installed yet Question : =3D=3D=3D=3D=3D=3D=3D=3D What version of Bobo modules can I install to work with Medusa ? (Thinking = of BoboPos DB) Where can I find it ? (FTP ; CVS ; or extract from last Zope product) In the case of Zope product, I can't install (compil) Zope on my ISP server is this a problem ? Many thanks. Manu. http://www.advl.org: 9090/bobotest/hello?name=3D"Medusa and Bobo" ;-) -- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Emmanuel DISCORS Tel & Fax : 02 54 56 80 61 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Conception, Informatique, R=E9seau ADVL ( Au-Del=E0 de Vos Limites ) Site web : http://www.advl.org/ Archives mOdbc : http://www.advl.org/public/mOdbc/ From thomas@c... Tue Oct 24 11:40:26 2000 From: thomas@c... (thomas@c...) Date: Tue, 24 Oct 2000 10:40:26 -0000 Subject: Simple subclassing of http-server Message-ID: <8t3ouq+m9so@e...> I want to subclass medusas http-server-class so that I can write my own request handler. The server is going to serve xml. I've looked at the docs/tutorial but I cannot figure out where to put my own handler, so that I can pick the requested url apart, use the submitted data to find what data to send back to the client. The simpleHTTPServer in the standard python distro has a simpler or at least more understandable approach, so if anybody could show me how to get something similar to that to work with I'd be glad. The only thing I need is to have a place to insert my method and let it return data based on the url the user typed in the browser. If I can sublclass something and do it in my own subclass that would be the best solution. It would be nice to leave the medusa-code alone. Thanks From kthangavelu@e... Tue Oct 24 20:52:08 2000 From: kthangavelu@e... (Ender) Date: Tue, 24 Oct 2000 12:52:08 -0700 Subject: [medusa] [comp.lang.python] Async sockets. References: Message-ID: <39F5E868.66DD3D90@e...> simuran@h... wrote: > > Hi. > > I think this question would be more appropriate here. Any help would > be greatly appreatiated. > > I'm giving up on trying to understand how asyncore works. I need help :) > What i'm trying to do is to write a piece of software that just would > redirect TCP connections. Trick is that it should accept multiple > connections on one (fixed) port and forward the data to remote host:port, > where port is being taken from range of available values, and once taken it > can't be used again (on the remote side i'm dealing with thing that doesn't > accept more than one connection per port). > > I really need a working example/advice on how to do simple port forwarding > with asyncore or multithreading. port forwarding. the simple_proxy_server.py in the docs multithreading -- zope's zserver or webware's multithreadedappserver cheers kapil From thomas@c... Thu Oct 26 10:30:47 2000 From: thomas@c... (thomas@c...) Date: Thu, 26 Oct 2000 09:30:47 -0000 Subject: Stopping access to lower subdirs Message-ID: <8t8tk7+cd5k@e...> I've written a custom authorizer. How can I set a start root-dir so the users doesn't get access to dirs outside or below this ( using cd .. etc.) ? If I've allready set the ftp_channel read-only to false can the users overwrite files all across the filesystem ?? Which id is used to write files using the ftp-server? Any clues ?? From thomas@c... Thu Oct 26 13:00:26 2000 From: thomas@c... (thomas@c...) Date: Thu, 26 Oct 2000 12:00:26 -0000 Subject: Stopping access to lower subdirs In-Reply-To: <8t8tk7+cd5k@e...> Message-ID: <8t96cq+o5p3@e...> --- In medusa@egroups.com, thomas@c... wrote: > > I've written a custom authorizer. How can I set a start root-dir so > the users doesn't get access to dirs outside or below this ( using > cd .. etc.) ? > > If I've allready set the ftp_channel read-only to false can the users > overwrite files all across the filesystem ?? Which id is used to > write files using the ftp-server? > > Any clues ?? Me again: Nevermind. The source gave me some hints. Subclassing the ftp_channel- class and overriding the specific methods work like a charm. Thomas From ebnf@h... Thu Oct 26 14:42:55 2000 From: ebnf@h... (ebnf@h...) Date: Thu, 26 Oct 2000 13:42:55 -0000 Subject: handle_connect called when connection fails Message-ID: <8t9ccv+so8o@e...> The following code tries to connect to a port that no one is listening to - the problem is that handle_connect is called anyway. Is there anyway I can find out whether the connection failed without trying to write or read (which I imagined would fail). import asyncore class test (asyncore.dispatcher): def __init__ (self): asyncore.dispatcher.__init__ (self) def handle_connect (self): print 'Connected' if __name__ == '__main__': import socket t = test() t.create_socket(socket.AF_INET, socket.SOCK_STREAM) # there's nobody listening on 9879 t.connect(('localhost', 9879)) asyncore.poll(1) Thanks in advance. /A From thomas@c... Tue Oct 31 08:56:58 2000 From: thomas@c... (thomas@c...) Date: Tue, 31 Oct 2000 08:56:58 -0000 Subject: Data-part of a POST request is missing!! Message-ID: <8tm1gq+krbd@e...> I've written my own default_handler and want to use the POST command to send data to the HTTP-server ( username, passwd etc. therefore the POST command, not GET). My Python client ( a script that sends the POST command and header parts manually to the HTTP-server) sends the data ok. It's available in the request-object in my default_handler. But using a form in Netscape ( with ENCTYPE=multipart/form-data, method=POST ) shows no form data in the request-object. Why ?? I need to use both clients, my Python client and a ordinary browser, and I need to use the POST-command. Any clues, hints or tips? From drone_drone@h... Tue Oct 31 12:22:00 2000 From: drone_drone@h... (drone) Date: Tue, 31 Oct 2000 07:22:00 -0500 Subject: [medusa] Data-part of a POST request is missing!! References: <8tm1gq+krbd@e...> Message-ID: What does your form look like?? ---------------------------------------------------------------------- Olivier A. Dagenais - Software Architect and Developer "Someone called 'Type your name here' is impersonating me on the internet and is posting exactly the same things I am posting!" ----- Original Message ----- From: To: Sent: Tuesday, October 31, 2000 03:56 Subject: [medusa] Data-part of a POST request is missing!! > I've written my own default_handler and want to use the POST command > to send data to the HTTP-server ( username, passwd etc. therefore the > POST command, not GET). > > My Python client ( a script that sends the POST command and header > parts manually to the HTTP-server) sends the data ok. It's available > in the request-object in my default_handler. But using a form in > Netscape ( with ENCTYPE=multipart/form-data, method=POST ) shows no > form data in the request-object. Why ?? > > I need to use both clients, my Python client and a ordinary browser, > and I need to use the POST-command. > > Any clues, hints or tips? > > > > > > From zmbq@a... Tue Oct 31 12:12:12 2000 From: zmbq@a... (Itay Zandbank) Date: Tue, 31 Oct 2000 14:12:12 +0200 Subject: [medusa] Data-part of a POST request is missing!! References: <8tm1gq+krbd@e...> Message-ID: <021b01c04333$ccde07b0$05010101@s...> When your handler is passed the request object, it still has to read the post data from the request channel. Check out the proxy demo (it was in work_in_progress last I checked), or the CGI demo to see how it's done. > I've written my own default_handler and want to use the POST command > to send data to the HTTP-server ( username, passwd etc. therefore the > POST command, not GET). > > My Python client ( a script that sends the POST command and header > parts manually to the HTTP-server) sends the data ok. It's available > in the request-object in my default_handler. But using a form in > Netscape ( with ENCTYPE=multipart/form-data, method=POST ) shows no > form data in the request-object. Why ?? > > I need to use both clients, my Python client and a ordinary browser, > and I need to use the POST-command. > > Any clues, hints or tips? From thomas@c... Tue Oct 31 17:23:15 2000 From: thomas@c... (thomas@c...) Date: Tue, 31 Oct 2000 17:23:15 -0000 Subject: Data-part of a POST request is missing!! In-Reply-To: Message-ID: <8tmv63+vo5k@e...> it's a plain
--- In medusa@egroups.com, "[drone]" wrote: > What does your form look like?? > > ---------------------------------------------------------------------- > Olivier A. Dagenais - Software Architect and Developer > "Someone called 'Type your name here' is impersonating me on the > internet and is posting exactly the same things I am posting!" > > > ----- Original Message ----- > From: > To: > Sent: Tuesday, October 31, 2000 03:56 > Subject: [medusa] Data-part of a POST request is missing!! > > > > I've written my own default_handler and want to use the POST command > > to send data to the HTTP-server ( username, passwd etc. therefore the > > POST command, not GET). > > > > My Python client ( a script that sends the POST command and header > > parts manually to the HTTP-server) sends the data ok. It's available > > in the request-object in my default_handler. But using a form in > > Netscape ( with ENCTYPE=multipart/form-data, method=POST ) shows no > > form data in the request-object. Why ?? > > > > I need to use both clients, my Python client and a ordinary browser, > > and I need to use the POST-command. > > > > Any clues, hints or tips? > > > > > > > > > > > > From abo@m... Mon Nov 6 13:27:32 2000 From: abo@m... (Donovan Baarda) Date: Tue, 7 Nov 2000 00:27:32 +1100 Subject: How to submit producer ready() changes, and tuning async core Message-ID: <20001107002731.A17249@m...> ---------------------- multipart/mixed attachment G'day Sam and medusa@e..., sorry for appearing on this list outa nowhere announcing code changes without serving the obligitory lurk time. Was just going to send this to Sam then noticed there was a list. I've been fiddling with medusa (ps, thanks for making it "Free!", this was the final straw in convincing me it was worth using). And have made a few changes you might like to fold back in. I was wondering how to go about submitting changes etc. Have you got anything setup like a sourceforge project for medusa? I've added the ability for producers to block via a ready() method, effectively allowing async producers. The changes required were suprisingly small, affecting only asynchat.py and producers.py, plus some minor fixups to http_server.py and filesys.py to avoid conflicts with the new feature. I was using 20000601 as my base. Medusa appears to be working fine, and the combined changes to asynchat.py and producers.py make them actualy simpler and smaller than they were before. The changes are backwards compatible with old producers that don't have a ready() method. The only conflicts in http_server and filesys were pre-existing (and broken) ready() methods or conflicts with my changes the composite_producer. I've noticed that the zope guys early on mentioned that they were thinking of extending medusa so that producers could block, probably by giving them a ready() method. I've also seen hints of this throughout your code, with vestigial ready() and stalled() methods, and even a writeable_for_proxy() test in your http_server. Dispite all this, no-one seems to have implemented it. I know that this feature can be worked around by using dispatchers to push data onto an asynchat, but the producer queue is a powerful feature, and it is nice to be able to push asyc-producers onto that queue. I notice the ZServer guys are even using the producer queue to push callbacks onto it using empty producers that just execute the callback on more()... neat idea. BTW, I saw someone else post on the egroups list about writeable_for_proxy not working properly... AFAICT, it looks like it's something that was never completely implemented. Using this ready() change will achieve all you wanted and more :-) Warning! these changes are only lightly tested... I am planning to use medusa for on-demand mirroring with http, ftp, and (eventualy) rsync back and front ends. The easy way to achieve this was to make ftp and http filesystems that fetched and cached on demand. The problem is all the filesystem stuff is blocking, so this wouldn't work well. Implementing ready() for an async_file_producer looked easier than implementing a non-blocking replacement for the filesystem layer. On a different note, just read your stuff on recent improvements to the async core. You mention the overhead of readable() and writeable() methods in the polling loop. One trick that might be worth trying is something from visibility tests in 3D graphics; cache the result. The idea is when you test an object's visibility, give it an integer value. For each successive frame, decrement the value, and don't test it's visibility again until the value reaches zero. The size of integer can be tuned based on how soon you think it's visibility status might change. The price is occasionaly you get it wrong, but usually only for a few frames. For async core stuff, you could 'learn' the visibility value based on network load, whatever. If you made it robust enough to handle the occasional "false write/readable" error, you could cache both 'writeable' and 'not writable' type results. You would need to make sure it could handle the occasional visibility error. -- ---------------------------------------------------------------------- ABO: finger abo@m... for more info, including pgp key ---------------------------------------------------------------------- ---------------------- multipart/mixed attachment A non-text attachment was scrubbed... Name: medusa-ready.tar.bz2 Type: application/octet-stream Size: 20173 bytes Desc: not available Url : http://mail.python.org/pipermail-21/medusa-dev/attachments/174af79d/medusa-ready.tar.bz2 ---------------------- multipart/mixed attachment-- From gb@a... Mon Nov 13 10:16:14 2000 From: gb@a... (gunter ) Date: Mon, 13 Nov 2000 10:16:14 -0000 Subject: medusa with pythonw.exe Message-ID: <8uof1e+q3f7@e...> Hi folks! I've got a problem using medusa on windows98. I've written an programm which uses an browser-frontend and an python server part. I suceeded in installing the server on windows98 and running the client on the same machine (no problems so far...) My project uses medusa as server. As long as I am starting my script with python.exe it works fine. Now I want to use pythonw.exe because it does not open an ugly DOS-Box-Window. But now medusa seems to be unstable: Somtimes some requests are returning "internal server errors". I am using an "script_handler.persistent_script_handler". I think my scripts are ok, because the errors occure also in GET-Requests to the "default_handler.default_handler(file_system)" any ideas? gunter From itamarst@y... Sat Nov 25 23:29:04 2000 From: itamarst@y... (Itamar S.-T.) Date: Sat, 25 Nov 2000 15:29:04 -0800 (PST) Subject: WebDAV in Medusa? Message-ID: <20001125232904.24341.qmail@w...> Has anyone added WebDAV support to Medusa? I know Zope has pretty good WebDAV support, but I'm not sure if it can be used with the regular Medusa codebase - if it is possible I'd be grateful for any hints on how to do this. ===== -- Itamar Shtull-Trauring, itamar(at)shtull-trauring.org __________________________________________________ Do You Yahoo!? Yahoo! Shopping - Thousands of Stores. Millions of Products. http://shopping.yahoo.com/ From lucifer@e... Thu Dec 7 05:07:21 2000 From: lucifer@e... (Nicolas Echaniz) Date: Thu, 7 Dec 2000 02:07:21 -0300 Subject: [medusa] WebDAV in Medusa? In-Reply-To: <20001125232904.24341.qmail@w...> Message-ID: <200012070507.CAA14211@w...> Hi everyone. I have this problem: I need apache to handle certain sites and medusa tu handle others. But I can´ t tell both to use port 80, so, if I have site1.com on apache on port 80, and site2.com on medusa on port 8080, people will need to specify the port number in their address bar if they want to access site2.com. Anyone had the same problem ? Thanks, Nico. _______________________________________________________________ Nicolás Echániz | RAKAR Producciones | Buenos Aires | Argentina From t.c.jones@a... Fri Dec 8 05:19:46 2000 From: t.c.jones@a... (t.c.jones@a...) Date: Fri, 08 Dec 2000 05:19:46 +0000 Subject: [medusa] WebDAV in Medusa? Message-ID: <20001208051947.EWMP5130.mtiwmhc22.worldnet.att.net@w...> sure, that's what I do on my site. You can start then out on port 80 and then you redirect them immediately to port 8080. You can create a virtual site in apache if you don't want to use the same one as the "other" apache site. my site is topcatnetwork.com ..tom > Hi everyone. > > I have this problem: > > I need apache to handle certain sites and medusa tu handle others. But I can´ t > tell both to use port 80, so, if I have site1.com on apache on port 80, and > site2.com on medusa on port 8080, people will need to specify the port number in > their address bar if they want to access site2.com. > > Anyone had the same problem ? > > > Thanks, > > Nico. > _______________________________________________________________ > Nicolás Echániz | RAKAR Producciones | Buenos Aires | Argentina > > > > From support@i... Sat Dec 9 23:25:33 2000 From: support@i... (Mike Clarkson) Date: Sat, 09 Dec 2000 23:25:33 -0000 Subject: handle_connect called when connection fails In-Reply-To: <8t9ccv+so8o@e...> Message-ID: <90uf1d+fo9d@e...> --- In medusa@egroups.com, ebnf@h... wrote: > The following code tries to connect to a port that no one is listening > to - the problem is that handle_connect is called anyway. Is there > anyway I can find out whether the connection failed without trying to > write or read (which I imagined would fail). This also affects http_proxy.py: if you proxy request a port that no one is listening to then the exception after this handle_connect is unhandled, and the client will wait forever. Any fixes? Many thanks in advance, Mike. From support@i... Sat Dec 9 23:05:05 2000 From: support@i... (Mike Clarkson) Date: Sat, 09 Dec 2000 18:05:05 -0500 Subject: Medusa Message-ID: <3.0.6.32.20001209180505.007d5d60@p...> I've been playing with Medusa and I wanted to see if I could make a GUI for it. I looked at the tkinter.txt notes, but that won't work with Python 2.0, and it's really groddy way of doing it. (at least in old versions of Tk after would crash after a while). In Python 2.0 the main event loop of Tkinter is in C, with threads meshed into the loop, as Tk is in it's own thread with its own special lock. If you compile with threads, then the code is (_tkinter.c Tkapp_MainLoop) quitMainLoop = 0; while (Tk_GetNumMainWindows() > threshold && !quitMainLoop && !errorInCmd) { int result; #ifdef WITH_THREAD Py_BEGIN_ALLOW_THREADS PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; result = Tcl_DoOneEvent(TCL_DONT_WAIT); tcl_tstate = NULL; PyThread_release_lock(tcl_lock); if (result == 0) Sleep(20); Py_END_ALLOW_THREADS #else result = Tcl_DoOneEvent(0); #endif Tcl_DoOneEvent(TCL_DONT_WAIT) handles any existing events and returns, nonzero if it did anything, whereas Tcl_DoOneEvent(0) does select waiting for events. The loop uses a 20 msec wait using Sleep, but on most systems, Sleep is just a call to a null select, so you could mesh the asynccore with Tkinter using your poll as a replacement for Sleep. The only detail is how to pass the array of fd's for poll in. Presumably you could check for the existence of a global variable, which is groddy, or you could extend the arguments to the Python mainloop function (it already takes one optional argument), to take a callable object. by default this callable object would be time.sleep(20). If you were using asynccore you make the callable object a call to poll with it's fd's (or better still a continuation?). This would have the added benefit of giving the user control over the loop granularity so that the change might even be adopted into the Tkinter core. Does this seem like a good way to go? I'm new to Python so I don't know how to pass a callable function as an argument, but it shouldn't be more than a few lines of C code. Many thanks for medusa. Mike. From jkraai@m... Tue Dec 12 18:59:41 2000 From: jkraai@m... (jkraai@m...) Date: Tue, 12 Dec 2000 18:59:41 -0000 Subject: Connection Pooling w/ async_mysql? Message-ID: <915sit+he1s@e...> Greetings, Anyone doing connection pooling w/ async_mysql from inside a medusa'ish server? Nice features'd be configurable max_connections and smart cmd_use() 'caching' w/ default db option. If it hasn't been done, I'll make an attempt and post it for criticism. Thanks, --jim From rushing@n... Tue Dec 12 20:07:57 2000 From: rushing@n... (Sam Rushing) Date: Tue, 12 Dec 2000 12:07:57 -0800 Subject: [medusa] Connection Pooling w/ async_mysql? References: <915sit+he1s@e...> Message-ID: <3A36859D.1070104@n...> jkraai@m... wrote: > Greetings, > > Anyone doing connection pooling w/ async_mysql from inside > a medusa'ish server? > > Nice features'd be configurable max_connections and smart > cmd_use() 'caching' w/ default db option. > > If it hasn't been done, I'll make an attempt and post it > for criticism. > The egp-coro package has support for connection-pooling (or rather 'connection-limiting'), that I think was also used with the mysql protocol implementation. You could look in there for hints. Of course it won't be as easy using callbacks... http://www.nightmare.com/~rushing/copython/index.html -Sam From tassellim@y... Wed Dec 13 08:30:05 2000 From: tassellim@y... (Marco Tasselli) Date: Wed, 13 Dec 2000 08:30:05 -0000 Subject: https Message-ID: <917c2d+hkpl@e...> Hi, is there a way to know if a connection is of type http or https? I looked in the request object but could only find infos on the uri part following the host name so the info on the type of protocol (http/https) is not "visible" thanks Marco From nhytro@c... Thu Dec 14 14:03:42 2000 From: nhytro@c... (nhytro@c...) Date: Thu, 14 Dec 2000 14:03:42 -0000 Subject: MEDUSA Message-ID: <91ajvu+oou7@e...> Hi Medusa List! I=B4m newbie to both Python and MEDUSA, I took a look at the tutorial=20 on the Medusa web-site, to my dismay, I did=B4nt really understand much=20 of what was being explained. Could someone point me to an URL where I=20 can RTFM Medusa programming for newbies/ dummies? or could someone=20 break the whole process of using medusa to construct a web server=20 down into detailed bits for me? OR does anyone have a skeleton=20 WEBserver with CGI support that I can study, so I can re-code for my=20 own purposes? Thanks all for your anticipated help Sharriff From lucifer@e... Thu Dec 14 16:15:20 2000 From: lucifer@e... (Nicolas Echaniz) Date: Thu, 14 Dec 2000 13:15:20 -0300 Subject: [medusa] WebDAV in Medusa? In-Reply-To: <20001208051947.EWMP5130.mtiwmhc22.worldnet.att.net@w...> Message-ID: <200012141615.NAA09134@w...> Thanks to everyone for the help on redirecting from Apache to Medusa. It worked fine. I'd like to have your opinion on my site/application. It's based on python/mysql/medusa. It's address is www.ecmess.com (the main page is in spanish, but the rest of it is in english). Check it out and let me know what you think. _______________________________________________________________ Nicolás Echániz | RAKAR Producciones | Buenos Aires | Argentina From t.c.jones@a... Thu Dec 14 16:55:07 2000 From: t.c.jones@a... (t.c.jones@a...) Date: Thu, 14 Dec 2000 16:55:07 +0000 Subject: [medusa] WebDAV in Medusa? Message-ID: <20001214165516.PUCK2402.mtiwmhc21.worldnet.att.net@w...> when i try to register i get There are no users registered with that nickname. Retry Register > Thanks to everyone for the help on redirecting from Apache to Medusa. It worked > fine. > > I'd like to have your opinion on my site/application. It's based on > python/mysql/medusa. > > It's address is www.ecmess.com (the main page is in spanish, but the rest of it > is in english). > Check it out and let me know what you think. > > > _______________________________________________________________ > Nicolás Echániz | RAKAR Producciones | Buenos Aires | Argentina > > > > From lucifer@e... Wed Dec 20 03:13:40 2000 From: lucifer@e... (lucifer@e...) Date: Wed, 20 Dec 2000 03:13:40 -0000 Subject: EcMess was Re: WebDAV in Medusa? In-Reply-To: <20001214165516.PUCK2402.mtiwmhc21.worldnet.att.net@w...> Message-ID: <91p854+8kcp@e...> You have to choose register and enter your desired nickname and password. Then you may log in. To add friends to your list you have to know their id (soon you'll be able to search by name, etc). There's a list of users in the main page (where you log in), the link says: "lista de usuarios con sus nicknames y Id's." I hope that's enough to get you going. bye. Nico. PS: My id is 1 .=20 --- In medusa@egroups.com, t.c.jones@a... wrote: > when i try to register i get >=20 > There are no users registered with that nickname.=20 >=20 > Retry Register > > Thanks to everyone for the help on redirecting from Apache to Medusa. It worked=20 > > fine. > >=20 > > I'd like to have your opinion on my site/application. It's based on=20 > > python/mysql/medusa. > >=20 > > It's address is www.ecmess.com (the main page is in spanish, but the rest of it=20 > > is in english). > > Check it out and let me know what you think. > >=20 > >=20 > > _______________________________________________________________ > > Nicol=E1s Ech=E1niz | RAKAR Producciones | Buenos Aires | Argentina > >=20 > >=20 > >=20 > > From akuchlin@m... Thu Dec 21 03:40:06 2000 From: akuchlin@m... (A.M. Kuchling) Date: Wed, 20 Dec 2000 22:40:06 -0500 Subject: Patch to use poll() support in Python 2.0 Message-ID: <200012210340.WAA00993@2...> This patch adds the ability to use the poll() support that was added to the select module in Python 2.0. Only lightly tested ... please proofread this patch carefully. --amk --- /tmp/asyncore.py Thu May 4 02:06:04 2000 +++ asyncore.py Wed Dec 20 22:38:38 2000 @@ -93,6 +93,7 @@ pass def poll2 (timeout=0.0, map=None): + # Use Andy Dustman's poll module import poll if map is None: map=socket_map @@ -124,9 +125,45 @@ except KeyError: pass +def poll3 (timeout=0.0, map=None): + # Use the poll() support added to the select module in Python 2.0 + if map is None: + map=socket_map + # timeout is in milliseconds + timeout = int(timeout*1000) + pollster = select.poll() + if map: + l = [] + for fd, obj in map.items(): + flags = 0 + if obj.readable(): + flags = select.POLLIN + if obj.writable(): + flags = flags | select.POLLOUT + if flags: + pollster.register(fd, flags) + r = pollster.poll (timeout) + for fd, flags in r: + try: + obj = map[fd] + try: + if (flags & select.POLLIN): + obj.handle_read_event() + if (flags & select.POLLOUT): + obj.handle_write_event() + except ExitNow: + raise ExitNow + except: + obj.handle_error() + except KeyError: + pass + def loop (timeout=30.0, use_poll=0, map=None): if use_poll: + if hasattr(select, 'poll'): + poll_fun = poll3 + else: poll_fun = poll2 else: poll_fun = poll From smoriano@s... Thu Dec 21 12:41:11 2000 From: smoriano@s... (Sergio Boix) Date: Thu, 21 Dec 2000 12:41:11 -0000 Subject: Modifiyng the ftp server dinamically Message-ID: <91stp7+anoe@e...> Hi all, I want to build an script to change the ftp server parameters dinamically from a remote machine. Is anyway to do it? Thanks in advace for your responses From rushing@n... Thu Dec 21 17:14:36 2000 From: rushing@n... (Sam Rushing) Date: Thu, 21 Dec 2000 09:14:36 -0800 Subject: [medusa] Modifiyng the ftp server dinamically References: <91stp7+anoe@e...> Message-ID: <3A423A7C.5030703@n...> Sergio Boix wrote: > Hi all, > > I want to build an script to change the ftp server parameters > dinamically from a remote machine. > > Is anyway to do it? The easiest way to do this sort of thing is to use the rpc service. See the files rpc_server.py and rpc_client.py in the distribution. [they use a lightweight, fast rpc built around marshal] -Sam