From jeremy at zope.com Tue Jan 7 17:49:57 2003 From: jeremy at zope.com (Jeremy Hylton) Date: Wed Jan 8 08:41:36 2003 Subject: [Medusa-dev] improvements to select_trigger Message-ID: <15899.22933.699317.594439@slothrop.zope.com> I wanted to mention that we've fixed a bunch of bugs in a forked copy medusa's select_trigger during ZEO development. (ZEO is a Zope/ZODB RPC protocol built on tope of asyncore.) I thought I'd mention it on this list in case you want to update the version in medusa. I don't know if I remember all the bugs fixed. I recall that the trigger can fail unexpectedly if a singal interrupts the recv() in handle_read() and that there was some problem with closing the trigger more than once. The gory details are in the CVS log here: http://cvs.zope.org/ZODB3/ZEO/zrpc/trigger.py Jeremy From sergio.fernandez at agora-2000.com Wed Jan 15 11:10:55 2003 From: sergio.fernandez at agora-2000.com (Sergio =?ISO-8859-1?Q?Fern=E1ndez?=) Date: Wed Jan 15 08:47:16 2003 Subject: [Medusa-dev] Medusa RPM Message-ID: <20030115111055.18f6e9ff.sergio.fernandez@agora-2000.com> Hi all: Does anyone knows if it exists a Medusa RPM package for SuSE 8.x? Thanks in advace Sergio From sfmunoz at teleline.es Wed Jan 15 11:25:22 2003 From: sfmunoz at teleline.es (Sergio =?ISO-8859-1?Q?Fern=E1ndez?=) Date: Wed Jan 15 11:27:17 2003 Subject: [Medusa-dev] Medusa RPM Message-ID: <20030115112522.0c2ea007.sfmunoz@teleline.es> Hi all: Does anyone knows if it exists a Medusa RPM package for SuSE 8.x? Thanks in advace Sergio From dmcclurg at pandemicstudios.com.au Thu Feb 20 09:54:16 2003 From: dmcclurg at pandemicstudios.com.au (David McClurg) Date: Fri Feb 21 08:24:50 2003 Subject: [Medusa-dev] license question Message-ID: Hello, The LICENSE.txt file in medusa-0.5.3.tar.gz says that "in May of 2000 Sam Rushing changed the license to be identical to the standard Python license" and on the python license page it says something about 1.6 not being GPL compatible. http://www.python.org/doc/Copyright.html My question is this-- Is the Medusa license compatible with the GPL and LGPL? Also, I noticed that the C++ implementation of Medusa is missing in... http://www.amk.ca/files/python/medusa-0.5.3.tar.gz It can be found here http://www.nightmare.com/squirl/python-ext/async.tar.gz http://squirl.nightmare.com/medusa/async_sockets.html -- link to download at bottom of page Was there a reason to not include it? Would it be possible to include the C++ implementation and say it's not maintained but might be useful? Thanks From amk at amk.ca Sat Feb 22 18:30:43 2003 From: amk at amk.ca (A.M. Kuchling) Date: Sat Feb 22 17:56:02 2003 Subject: [Medusa-dev] license question In-Reply-To: ; from dmcclurg@pandemicstudios.com.au on Thu, Feb 20, 2003 at 09:54:16AM +1000 References: Message-ID: <20030222183042.A11323@nyman.amk.ca> On Thu, Feb 20, 2003 at 09:54:16AM +1000, David McClurg wrote: >My question is this-- Is the Medusa license compatible with the GPL and LGPL? Yes it is; it's under the Python 1.5.2 license, which was basically the same as the BSD license. >Was there a reason to not include it? Would it be possible to >include the C++ implementation and say it's not maintained but might >be useful? The Medusa distribution already contains enough unmaintained and possibly-broken code; I don't want to go adding more of it! Is there a reason you'd want to have a C++ implementation available? --amk (www.amk.ca) Who was it said the living are just the dead on holiday? -- The Doctor, in "Destiny of the Daleks" From gb at murphy.bofh.ms Tue Mar 4 20:31:57 2003 From: gb at murphy.bofh.ms (Georg Bauer) Date: Tue Mar 4 14:31:59 2003 Subject: [Medusa-dev] Patch to the current cvs version Message-ID: Hi! There is a problem with medusa when you call an URI with a paramter that itself contains an URI with paramters. Medusa unquotes the full request instead just the path part, this leads to the effect that paramters of the URI in the paramter are "promoted" up to be paramters of the main URI you called. Attached is a patch we (Phil Pearson and me) believe will fix the problem. It's actually in use currently and seems to work out ok. bye, Georg -------------- next part -------------- A non-text attachment was scrubbed... Name: http_server.diff Type: application/text Size: 578 bytes Desc: not available Url : http://mail.python.org/pipermail/medusa-dev/attachments/20030304/e2439d4c/http_server.bin From scherrey at proteus-tech.com Tue Mar 4 20:47:58 2003 From: scherrey at proteus-tech.com (Benjamin Scherrey) Date: Tue Mar 4 21:17:23 2003 Subject: [Medusa-dev] SSL & Medusa Message-ID: <5ZTPNIBFA94SOB03XA7VT83JG3041Z.3e65574e@BONZO> I'm new to Medusa (nicely done btw) and am trying to build a pure python Medusa/Quixote system but I need SSL support. I saw a message in the archives implying some support for SSL but I don't find any indication of it in the source or docs. Has anyone deployed a medusa system using SSL and, if so, how? many thanx, Ben Scherrey From nick at humgat.org Wed Mar 5 11:47:18 2003 From: nick at humgat.org (Nick Strebkov) Date: Wed Mar 5 04:47:29 2003 Subject: [Medusa-dev] SSL & Medusa In-Reply-To: <5ZTPNIBFA94SOB03XA7VT83JG3041Z.3e65574e@BONZO> References: <5ZTPNIBFA94SOB03XA7VT83JG3041Z.3e65574e@BONZO> Message-ID: <20030305094718.GA5116@autumn.localdomain> On Tue, Mar 04, 2003 at 08:47:58PM -0500, Benjamin Scherrey wrote: > I'm new to Medusa (nicely done btw) and am trying to build a pure > python Medusa/Quixote system but I need SSL support. I saw a message > in the archives implying some support for SSL but I don't find any > indication of it in the source or docs. Has anyone deployed a medusa > system using SSL and, if so, how? A some time ago I have seen a recommendation to use medusa + stunnel. -- Nick Strebkov From akuchlin at mems-exchange.org Wed Mar 5 08:09:01 2003 From: akuchlin at mems-exchange.org (Andrew Kuchling) Date: Wed Mar 5 08:09:04 2003 Subject: [Medusa-dev] SSL & Medusa In-Reply-To: <5ZTPNIBFA94SOB03XA7VT83JG3041Z.3e65574e@BONZO> References: <5ZTPNIBFA94SOB03XA7VT83JG3041Z.3e65574e@BONZO> Message-ID: <20030305130901.GA29919@ute.mems-exchange.org> On Tue, Mar 04, 2003 at 08:47:58PM -0500, Benjamin Scherrey wrote: >but I need SSL support. I saw a message in the archives implying some support for SSL but I don't >find any indication of it in the source or docs. Has anyone deployed a medusa system using SSL At one point I looked at integrating M2Crypto's SSL support, but gave up. It looked really difficult to get it right, and there are already two alternatives: Twisted's SSL support and, if you're interested in HTTP over SSL, just using an appropriate web server. --amk (www.amk.ca) IAGO: For I am nothing, if not critical. -- _Othello_, II, i From ngps at netmemetic.com Fri Mar 7 11:56:18 2003 From: ngps at netmemetic.com (Ng Pheng Siong) Date: Fri Mar 7 00:03:19 2003 Subject: [Medusa-dev] SSL & Medusa In-Reply-To: <20030305130901.GA29919@ute.mems-exchange.org> References: <5ZTPNIBFA94SOB03XA7VT83JG3041Z.3e65574e@BONZO> <20030305130901.GA29919@ute.mems-exchange.org> Message-ID: <20030307035618.GG848@vista.netmemetic.com> On Wed, Mar 05, 2003 at 08:09:01AM -0500, Andrew Kuchling wrote: > At one point I looked at integrating M2Crypto's SSL support, but gave > up. It looked really difficult to get it right, and there are already > two alternatives: Twisted's SSL support and, if you're interested in > HTTP over SSL, just using an appropriate web server. M2Crypto includes a distribution of Medusa, likely not the latest, with HTTPS and FTP/TLS servers. Interoperability with all kinds of weird clients/servers is indeed difficult to get right. I was told (in email I think) there is an FTP server that advertises FTP/TLS capability which actually doesn't. Doh! -- Ng Pheng Siong http://firewall.rulemaker.net -+- Improve Your Firewall Operation ROI http://www.post1.com/home/ngps -+- Open Source Python Crypto & SSL From skeom at esolnet.net Wed Mar 12 20:46:43 2003 From: skeom at esolnet.net (=?ks_c_5601-1987?B?vva8urHH?=) Date: Wed Mar 12 06:46:48 2003 Subject: [Medusa-dev] Message-ID:  From janssen at parc.com Wed Mar 19 12:03:29 2003 From: janssen at parc.com (Bill Janssen) Date: Wed Mar 19 15:04:00 2003 Subject: [Medusa-dev] Using the SSL support in Python 2.2/2.3 with Medusa? Message-ID: <03Mar19.120334pst."58611"@synergy1.parc.xerox.com> Has anyone made the necessary changes to Medusa to provide HTTPS support using the OpenSSL support added to the socket module in Python 2.2? If so, could I please get the diffs? Thanks! Bill From janssen at parc.com Wed Mar 19 18:11:47 2003 From: janssen at parc.com (Bill Janssen) Date: Wed Mar 19 21:12:01 2003 Subject: [Medusa-dev] http_server.crack_request fails with multipart/form-data Message-ID: <200303200211.h2K2BlFo022275@wolfe.parc.xerox.com> Anyone tried this? The first POST sent to medusa failed because the re in crack_request failed to match the part divider in a multipart/form-data data element. But the real question is, why was that being called in the first place? Bill From ngps at netmemetic.com Thu Mar 20 11:39:11 2003 From: ngps at netmemetic.com (Ng Pheng Siong) Date: Wed Mar 19 22:37:53 2003 Subject: [Medusa-dev] Using the SSL support in Python 2.2/2.3 with Medusa? In-Reply-To: <03Mar19.120334pst."58611"@synergy1.parc.xerox.com> References: <03Mar19.120334pst."58611"@synergy1.parc.xerox.com> Message-ID: <20030320033911.GA835@vista.netmemetic.com> On Wed, Mar 19, 2003 at 12:03:29PM -0800, Bill Janssen wrote: > Has anyone made the necessary changes to Medusa to provide HTTPS support > using the OpenSSL support added to the socket module in Python 2.2? If so, > could I please get the diffs? Thanks! I think the SSL socket support in Python 2.2 doesn't do servers. M2Crypto has HTTPS and FTP/TLS servers for Medusa. If you ask on c.l.py, you'll be told "Twisted." IIRC, Twisted uses another OpenSSL wrapper for Python, not the one that comes with Python. -- Ng Pheng Siong http://firewall.rulemaker.net -+- Manage Your Firewall Rulebase Changes http://www.post1.com/home/ngps -+- Open Source Python Crypto & SSL From hal at dtor.com Wed Apr 9 17:57:48 2003 From: hal at dtor.com (Hal Wine) Date: Wed Apr 9 20:00:41 2003 Subject: [Medusa-dev] medusa & asyncore.loop -- termination & GUI Message-ID: <3E94B37C.4010200@dtor.com> Hi, all -- I've been trying to figure out how to wrap a medusa based app with a Tkinter GUI, and am stuck on clean termination. Seems like this would have come up before, but I can't find anything. What I want to do is allow timely and clean termination of the main medusa based server from a GUI similar to the PyDoc GUI, in some ways. This particular app has multiple calls to asyncore.loop (multi-threaded), so removing them and replacing with a call from Tkinter (ala the suggestion in the medusa/docs/tkinter.txt file) won't work. The app still needs to work from the command line, unaltered. There are two issues I need to resolve: 1) initiating a clean termination (can't type ^C to stop), and 2) responsiveness (default 30 second timeout is too long) The options I've come up with seem too kludgy -- there must be a simpler way. What I've thought of is: a) swap out asyncore.loop for my own hacked version b) push all of the orginal app into another thread, leaving the main thread for the GUI c) have the threads raise an ExitNow exception based on a global flag. (a) is the worst of it, as it's not robust across mods to asyncore. It'd be great if there was a separate asyncore.get_poll_func() as part of the API. Or an idle func that asyncore.loop would call on timeouts.... Any pointers to better/cleaner ideas welcomed. Thanks, --Hal From greg at electricrain.com Wed Apr 9 18:08:21 2003 From: greg at electricrain.com (Gregory P. Smith) Date: Wed Apr 9 20:08:25 2003 Subject: [Medusa-dev] medusa & asyncore.loop -- termination & GUI In-Reply-To: <3E94B37C.4010200@dtor.com> References: <3E94B37C.4010200@dtor.com> Message-ID: <20030410000821.GG3412@zot.electricrain.com> On Wed, Apr 09, 2003 at 04:57:48PM -0700, Hal Wine wrote: > Hi, all -- I've been trying to figure out how to wrap a medusa based > app with a Tkinter GUI, and am stuck on clean termination. Seems like > this would have come up before, but I can't find anything. > > What I want to do is allow timely and clean termination of the main > medusa based server from a GUI similar to the PyDoc GUI, in some ways. > > This particular app has multiple calls to asyncore.loop > (multi-threaded), so removing them and replacing with a call from > Tkinter (ala the suggestion in the medusa/docs/tkinter.txt file) won't > work. The app still needs to work from the command line, unaltered. > > There are two issues I need to resolve: > 1) initiating a clean termination (can't type ^C to stop), and > 2) responsiveness (default 30 second timeout is too long) > > The options I've come up with seem too kludgy -- there must be a > simpler way. What I've thought of is: > a) swap out asyncore.loop for my own hacked version > b) push all of the orginal app into another thread, leaving the main > thread for the GUI > c) have the threads raise an ExitNow exception based on a global flag. > > (a) is the worst of it, as it's not robust across mods to asyncore. > It'd be great if there was a separate asyncore.get_poll_func() as part > of the API. Or an idle func that asyncore.loop would call on timeouts.... > > Any pointers to better/cleaner ideas welcomed. (a) "make your own asyncore.loop" Is actually a good option. There is no reason that the event loop shouldn't handle other events as well as socket I/O. (look at twistedmatrix.com's twisted-python library for example) In virtually all of the asyncore based code I've written I've ended up using my own version of the loop for very similar reasons. -G From hal at dtor.com Wed Apr 9 18:50:04 2003 From: hal at dtor.com (Hal Wine) Date: Wed Apr 9 20:52:55 2003 Subject: [Medusa-dev] medusa & asyncore.loop -- termination & GUI In-Reply-To: <20030410000821.GG3412@zot.electricrain.com> References: <3E94B37C.4010200@dtor.com> <20030410000821.GG3412@zot.electricrain.com> Message-ID: <3E94BFBC.1040301@dtor.com> Gregory P. Smith wrote: > (a) "make your own asyncore.loop" > > Is actually a good option. There is no reason that the event loop > shouldn't handle other events as well as socket I/O. (look at > twistedmatrix.com's twisted-python library for example) Right, from the ground up, that's the way to go. > > In virtually all of the asyncore based code I've written I've ended up > using my own version of the loop for very similar reasons. Have you ever been bit by python's asyncore module getting out of phase with medusa releases? (It doesn't appear that the asyncore.loop API and functionality has changed in ages, but I'm relatively new to Python.) Somewhere post 1.5.2, asyncore.poll3 was introduced, and map became an arguement. But I guess if you're using a GUI, you don't need the efficiencies of poll over select, so no problems. (I note twisted's asyncoresupport uses select regardless, and ignores the map parameter.) Okay, makes sense to me (sorry for thinking out loud) Thanks, George! --Hal From scherrey at proteus-tech.com Sun Apr 13 23:39:29 2003 From: scherrey at proteus-tech.com (Benjamin Scherrey) Date: Sun Apr 13 22:39:49 2003 Subject: [Medusa-dev] How to shutdown cleanly? Message-ID: Apologize for the cross-post but I'm not sure where my question should be resolved (I'm guessing medusa). I'm developing a medusa/quixote application (great job on the tech resources btw) and can't figure out how to shutdown the server cleanly. Yes - I actually want to be able to shutdown the app through my web browser. Sometimes in runs on win32, sometimes on linux so I prefer an internal mechanism that can be coded. I tried calling sys.exit() and the log annouces that it catches the SystemExit exception and it claims to be shutting down but it doesn't. many thanx, Ben Scherrey From etienne at cs.vu.nl Fri Apr 25 12:45:42 2003 From: etienne at cs.vu.nl (Etienne Posthumus) Date: Fri Apr 25 05:46:17 2003 Subject: [Medusa-dev] Small patch to move URI unquoting in http_server.py Message-ID: On line 473 in http_server.py the request is unquoted. I would suggest that the unquoting is moved to AFTER the crack_request call, and that then a call to something like: uri = unquote_plus(uri) is done. I need to do this in my app to get quoted characters working in the URIs. (using Medusa + Quixote) It makes more sense to me to unquote only the URI portion of the request and not the entire shebang. Or am I missing something? Etienne Posthumus Amsterdam, Nederland From gb at murphy.bofh.ms Fri Apr 25 19:27:12 2003 From: gb at murphy.bofh.ms (Georg Bauer) Date: Fri Apr 25 12:27:24 2003 Subject: [Medusa-dev] Small patch to move URI unquoting in http_server.py In-Reply-To: Message-ID: Hi! > On line 473 in http_server.py the request is unquoted. I would suggest > that the unquoting is moved to AFTER the crack_request call, and that > then a call to something like: > uri = unquote_plus(uri) > is done. I think that's something I reported some time ago. I had the problem that URIs that are passed in as parameters were unquoted and broken (due to the fact that it's quoted & were unquoted and so paramters of a passed URI were used up as parameters of the called URI). bye, Georg From smithk at attbi.com Sun Apr 27 13:27:49 2003 From: smithk at attbi.com (Kevin Smith) Date: Sun Apr 27 08:27:50 2003 Subject: [Medusa-dev] psp_handler - embed python in HTML like ASP Message-ID: <1051449184.3563.14.camel@localhost> Hi, I have created a psp_handler (Python Server Pages???) for medusa based on the script_handler. This handler lets you mix HTML with python like ASP pages. The handler can be installed on the server in the sam manner as the script handler. Here is an example hello.psp file... Medusa PSP Handler <%psp print "hello world" %> I have been using this handler for much more useful applications of course :). Just wrap the inline python with <%psp ... %> tags. Here is the handler... # -*- Mode: Python -*- # This is a simple python server pages script handler. # A note about performance: This is really only suited for 'fast' # scripts: The script should generate its output quickly, since the # whole web server will stall otherwise. This doesn't mean you have # to write 'fast code' or anything, it simply means that you shouldn't # call any long-running code, [like say something that opens up an # internet connection, or a database query that will hold up the # server]. If you need this sort of feature, you can support it using # the asynchronous I/O 'api' that the rest of medusa is built on. [or # you could probably use threads] # Put your script into your web docs directory (like a cgi-bin # script), make sure it has the correct extension [see the overridable # script_handler.extension member below]. # # There's lots of things that can be done to tweak the restricted # execution model. Also, of course you could just use 'execfile' # instead (this is now the default, see class variable # script_handler.restricted) import rexec import re import string import StringIO import sys import counter import default_handler import producers from script_handler import collector unquote = default_handler.unquote def iif(expression,truepart,falsepart): if expression: return truepart else: return falsepart class psp_handler: extension = 'psp' # the following should not get overridden! fp = None script = '' data = '' insidePsp = False script_regex = re.compile ( r'.*/([^/]+\.%s)' % extension, re.IGNORECASE ) def __init__ (self, filesystem,restricted=False,preserveNamespace=True): self.filesystem = filesystem self.hits = counter.counter() self.exceptions = counter.counter() self.restricted = restricted self.preserveNamespace = preserveNamespace def match (self, request): [path, params, query, fragment] = request.split_uri() m = self.script_regex.match (path) return (m and (m.end() == len(path))) def handle_request (self, request): [path, params, query, fragment] = request.split_uri() while path and path[0] == '/': path = path[1:] if '%' in path: path = unquote (path) if not self.filesystem.isfile (path): request.error (404) return else: self.hits.increment() request.script_filename = self.filesystem.translate (path) if request.command in ('PUT', 'POST'): # look for a Content-Length header. cl = request.get_header ('content-length') length = int(cl) if not cl: request.error (411) else: collector (self, length, request) else: self.continue_request ( request, StringIO.StringIO() # empty stdin ) def continue_request (self, request, stdin): temp_files = stdin, StringIO.StringIO(), StringIO.StringIO() old_files = sys.stdin, sys.stdout, sys.stderr try: sys.request = request sys.stdin, sys.stdout, sys.stderr = temp_files try: #get the path from the uri and open the file with the filesystem class try: file = self.filesystem.open(request.split_uri()[0],'r') except IOError: request.error (404) return self.fp = producers.file_producer(file) self.dissect_psp(request) request.reply_code = 200 except: request.reply_code = 500 self.exceptions.increment() finally: sys.stdin, sys.stdout, sys.stderr = old_files del sys.request i,o,e = temp_files if request.reply_code != 200: s = e.getvalue() else: s = o.getvalue() request['Content-Length'] = len(s) request.push (s) request.done() def status (self): return producers.simple_producer ( '
  • PSP - Python Server Pages Handler' + '
      ' + '
    • Hits: %s' % self.hits + '
    • Exceptions: %s' % self.exceptions + '
    • Execution Mode:%s' % iif(self.restricted,'Restricted','Unrestricted' ) + '
    • Namespace::%sPreserved' % iif(self.preserveNamespace,'','not ' ) + '
    ' ) ## this function reads the file using the file producer and sends ## the data to the client until the script start tag '<%psp' ## is found. All of the text between the script start marker ## '<%psp' and the end script marker '%>' is executed as ## python script. def dissect_psp(self,request): self.insidePsp = False self.script = '' while not self.fp.done: self.data=self.fp.more() #print the HTML to the stdout, execute the python script... while self.data: if self.insidePsp: sectionend=self.data.find("%>") if (sectionend == -1): #end of script section is not in the current chunk self.script += self.data self.data = '' else: #end of script section is within the current chunk self.script += self.data[:sectionend] self.data = self.data[sectionend+len("%>"):] del sectionend if self.preserveNamespace: if self.restricted: r = rexec.RExec() try: if self.restricted: r.s_exec (self.script) else: exec (self.script) request.reply_code = 200 except: request.reply_code = 500 self.exceptions.increment() else: self.script_exec(request,self.script) self.script = '' self.insidePsp = False else: sectionend=self.data.find("<%psp") if (sectionend == -1): #end of HTML section is not in the current chunk print self.data self.data = '' else: #end of HTML section is within the current chunk print self.data[:sectionend] self.data = self.data[sectionend+len("<%psp"):] self.insidePsp = True # this function will eliminate any of the unnecessary objects # from appearing in the script namespace. print dir() should # return only self,request, and script. # one drawback with this method is that namespace is cleared # for each section of script in the document. def script_exec(self,request,script): # for debugging we can send a copy of the script to the browser. # this presents security issues so this next line should be # commented out. if self.restricted: r = rexec.RExec() try: if self.restricted: r.s_exec (script) else: exec (script) request.reply_code = 200 except: request.reply_code = 500 self.exceptions.increment() From etienne at cs.vu.nl Sun Apr 27 16:03:45 2003 From: etienne at cs.vu.nl (Etienne Posthumus) Date: Sun Apr 27 09:04:20 2003 Subject: [Medusa-dev] Small patch to move URI unquoting in http_server.py In-Reply-To: Message-ID: On Friday, Apr 25, 2003, at 18:27 Europe/Amsterdam, Georg Bauer wrote: > I think that's something I reported some time ago. I had the problem > that URIs > that are passed in as parameters were unquoted and broken (due to the > fact that > it's quoted & were unquoted and so paramters of a passed URI were used > up as > parameters of the called URI). Did you do a similar fix to mine (just moving the unquoting down a few lines) or something more involved? EP From gb at murphy.bofh.ms Sun Apr 27 16:14:23 2003 From: gb at murphy.bofh.ms (Georg Bauer) Date: Sun Apr 27 09:14:31 2003 Subject: [Medusa-dev] Small patch to move URI unquoting in http_server.py In-Reply-To: Message-ID: Hi! > Did you do a similar fix to mine (just moving the unquoting down a few > lines) or something more involved? My old posting is at: http://mail.python.org/pipermail/medusa-dev/2003/000828.html in the archive. It's basically just a little reordering of the unquoting stuff. The patch got a bit screwed up in indention because of tab/spaces problems, but it should be clear what is meant, it's just a very small patch. bye, Georg From eric at online.be Mon May 12 17:12:23 2003 From: eric at online.be (Eric) Date: Mon May 12 11:03:44 2003 Subject: [Medusa-dev] Channel not closing after error Message-ID: <045101c31890$825ee440$0301a8c0@bebrulloose> Folks, Found a small bug (I think) In the code for 'done' in http_server.py the variable close_it is checked to see whether the connection is closed, however, my feeling is that it should be self['Connection'] that is checked instead. I had a problem with the IE object in VB not handling failed authentication properly if the connection is not terminated. Since the error function requests the connection to be closed by setting self['Connection'] it's only natural that function done should check it that way. Cheers! PS: I am not subscribed, feel free to CC me the reply -- Eric Loos Network Engineer - European IP Engineering | http://www.cw.net Cable & Wireless Global | email: eric@cw.net . . . . . . . . . . . . . . . . . . . . . . . .| Tel : +32 (0)2 627.34.47 RIPE Handle: EL357-RIPE | Fax : +32 (0)2 627.34.01 "Of course there are limits to diversity, earth is a single point of failure for the foreseeable future." --Sean Donelan From akuchlin at mems-exchange.org Wed May 14 13:33:14 2003 From: akuchlin at mems-exchange.org (Andrew Kuchling) Date: Wed May 14 12:33:18 2003 Subject: [Medusa-dev] Channel not closing after error In-Reply-To: <045101c31890$825ee440$0301a8c0@bebrulloose> References: <045101c31890$825ee440$0301a8c0@bebrulloose> Message-ID: <20030514163314.GA21949@ute.mems-exchange.org> On Mon, May 12, 2003 at 04:12:23PM +0200, Eric wrote: >In the code for 'done' in http_server.py the variable close_it is checked to >see whether the connection is closed, however, my feeling is that it should >be self['Connection'] that is checked instead. I had a problem with the IE I don't understand your suggestion. Can you provide a patch? --amk From john.abel at pa.press.net Mon Jun 9 14:04:04 2003 From: john.abel at pa.press.net (John Abel) Date: Mon Jun 9 08:40:29 2003 Subject: [Medusa-dev] Problem With Unix User Handler Message-ID: <3EE477B4.9080709@pa.press.net> I am trying to set up a small web server, with support for Unix Users (~username). However, it doesn't seem to be working. The handler for unix_user_handler is being added OK, and default_handler is being called, but I keep getting 404 returned. I've put some prompt in unix_user_handler.py, and default_handler,py. This is the output from my startup: warning: Computing default hostname info: Medusa (V1.10) started at Mon Jun 9 12:08:39 2003 Hostname: lestat.howden.press.net Port:80 Just Done Init info: FTP server started at Mon Jun 9 12:08:39 2003 Authorizer:<__main__.ShadowAuthorizer instance at 0x4060d34c> Hostname: lestat Port: 21 info: Monitor Server (V1.5) started on port 9999 Chat Server (V1.4) started on port 8888 ('/~johnab/', None, None, None) warning: unhandled connect event This is the output from my monitor port: Welcome to [Hint: try 'from __main__ import *'] >>> from __main__ import * >>> dir() ['CHAT_PORT', 'FTP_PORT', 'HOSTNAME', 'HTTP_PORT', 'IP_ADDRESS', 'MONITOR_PORT', 'PUBLISHING_ROOT', 'ShadowAuthorizer', '__builtins__', '__doc__', '__name__', 'asyncore', 'chat_server', 'cs', 'default_handler', 'dh', 'filesys', 'fs', 'ftp', 'ftp_server', 'hs', 'http_server', 'lg', 'logger', 'monitor', 'ms', 'os', 'resolver', 'rs', 'sh', 'status_handler', 'status_objects', 'sys', 'uh', 'unix_user_handler'] >>> print uh I'm running SuSE 82, with Python2.2, and Python2.3. I've tested both 0.53, and CVS versions of medusa The public_html directory does exist in each user I've tested it with. Thanks John From gb at murphy.bofh.ms Mon Jun 9 19:26:34 2003 From: gb at murphy.bofh.ms (Georg Bauer) Date: Mon Jun 9 12:26:53 2003 Subject: [Medusa-dev] uri % resolving still broken (both release and CVS) In-Reply-To: <20030514163314.GA21949@ute.mems-exchange.org> Message-ID: Hi! I wrote some time ago about this problem, but up to now the following bug still exists both in the 0.53 release and the CVS version. The problem: the URI is passed into medusa. In http_channel in the found_terminator method, the URI is unquoted to remove % elements. This poses the problem that %-Elements are used in the query part, too. So if you pass in a parameter in the query part where you use the % to quote reserved chars like ? or ; or #, those chars will be unquoted in the http_channel.found_terminator method. This will lead to wrong request.split_uri handling, as there now are spurious ? ; or # chars in there. The unquote should only be done on the path element, not the query, parameter or fragment. Maybe it can be done to parameter (;-Part) or fragment (#-Part), but it should never be done to the query (?-Part) before the URI is split apart, as that leads to the above problem. It can be solved by not unquoting the full URI, but first do a split_uri on the URI and only unquote the path and then rejoin those parts to form the original URI (with unquoted path). bye, Georg From slim at maya.com Tue Jun 10 14:20:25 2003 From: slim at maya.com (Seung Chan Lim) Date: Tue Jun 10 13:26:01 2003 Subject: [Medusa-dev] event-driven CGI Message-ID: <05e401c32f74$94e34520$95fe46c0@GIRLS> Has anyone written a "plug-in" for Medusa that allows people to write event-driven CGI scripts? (It seems like a logical thing to write for Medusa of all web servers given its asynchronous nature) If not, I was going to start one this weekend... any ideas? slim From dfb at mrao.cam.ac.uk Mon Jun 23 17:20:07 2003 From: dfb at mrao.cam.ac.uk (David Buscher) Date: Mon Jun 23 11:20:13 2003 Subject: [Medusa-dev] EPIPE on asyncore.recv() Message-ID: I found that running an asynchat server under Linux, I can get a EPIPE socket exception on the server in asyncore.recv() when I have an ill-behaved client. Apparently what the client has to do to cause this is to close the socket while there is still some data sent by the server that it has not read (is this a well-known Linux sockets behaviour?). This causes problems because, although the exception is caught in handle_except(), the handle_close() method is not called and so I cannot tidy up the channel object. I am thinking of modifying asyncore.recv() to handle EPIPE in the same way as ECONNRESET, ENOTCONN and ESHUTDOWN are currently handled. My only worry is that no-one else has seen this problem and/or made this fix before. Am I misdiagnosing an error or handling it in the wrong place? Any comments welcomed. thanks David --------------------------------------+---------------------------------- Cavendish Laboratory | Phone +44 1223 337302 Madingley Road | Fax +44 1223 354599 Cambridge CB3 0HE, UK | http://www.mrao.cam.ac.uk/~dfb --------------------------------------+---------------------------------- From dfb at mrao.cam.ac.uk Tue Jun 24 14:46:23 2003 From: dfb at mrao.cam.ac.uk (David Buscher) Date: Tue Jun 24 08:46:28 2003 Subject: [Medusa-dev] EPIPE on asyncore.recv() In-Reply-To: Message-ID: In fact I *had* misdiagnosed the error: EPIPE is generated when the client sends a request and closes the connection before the server is able to send the reply: a slightly hard to reproduce timing-related error and hard to diagnose if you don't understand all the subtleties of exception handlers and tracebacks. I am now trying to fix the channel cleanup problem by writing a new handle_error() which calls handle_close() and not just close(). David On Mon, 23 Jun 2003, David Buscher wrote: > I found that running an asynchat server under Linux, I can get a EPIPE > socket exception on the server in asyncore.recv() when I have an > ill-behaved client. Apparently what the client has to do to cause this is > to close the socket while there is still some data sent by the server that > it has not read (is this a well-known Linux sockets behaviour?). > > This causes problems because, although the exception is caught in > handle_except(), the handle_close() method is not called and so I cannot > tidy up the channel object. I am thinking of modifying asyncore.recv() > to handle EPIPE in the same way as ECONNRESET, ENOTCONN and ESHUTDOWN > are currently handled. > > My only worry is that no-one else has seen this problem and/or made this > fix before. Am I misdiagnosing an error or handling it in the wrong place? > > Any comments welcomed. > > thanks > David > > --------------------------------------+---------------------------------- > Cavendish Laboratory | Phone +44 1223 337302 > Madingley Road | Fax +44 1223 354599 > Cambridge CB3 0HE, UK | http://www.mrao.cam.ac.uk/~dfb > --------------------------------------+---------------------------------- > > > _______________________________________________ > Medusa-dev mailing list > Medusa-dev@python.org > http://mail.python.org/mailman/listinfo/medusa-dev > From gb at murphy.bofh.ms Mon Jun 30 00:53:44 2003 From: gb at murphy.bofh.ms (Georg Bauer) Date: Sun Jun 29 17:57:24 2003 Subject: [Medusa-dev] Small patch to move URI unquoting in http_server.py In-Reply-To: Message-ID: Hi! Attached a patch for the http_server.py problem with unescaping of %XX forms in the whole request instead just the path. This is what I use in my tools to prevent medusa from unescaping too much. Would be great if this (or something like this, reason below) could make it into the next version of medusa, as this bug really is a bit annoying - for example it prevents you from passing parameters using ";" in their value, or pass in parameters that themselves contain other URLs. The patch just pulls out the path element from the request and only unescapes this and reconstructs the request. Actually this patch now unquotes not only the path, but given the form: /path/to/method;attr=value;another=value?query=blah&q2=blubb#fragmentpart splits at the '?' and unquotes the first part. Maybe (or most surely) this should be reworked to use split_query from medusa itself and reconstruct the split request, after unquoting only the path element. [murphy:~] gb% diff /Volumes/Datensicherungen/opt/pyds/lib/python2.2/site-packages/medusa/ http_server.py /opt/pyds/lib/python2.2/site-packages/medusa/http_server.py 32c32 < from urllib import unquote --- > from urllib import unquote, splitquery 473,474c473,478 < if '%' in request: < request = unquote (request) --- > rpath, rquery = splitquery(request) > if '%' in rpath: > if rquery: > request = unquote (rpath) + '?' + rquery > else: > request = unquote (rpath) bye, Georg From janssen at parc.com Mon Jun 30 14:22:51 2003 From: janssen at parc.com (Bill Janssen) Date: Mon Jun 30 16:23:22 2003 Subject: [Medusa-dev] Small patch to move URI unquoting in http_server.py In-Reply-To: Your message of "Sun, 29 Jun 2003 14:53:44 PDT." Message-ID: <03Jun30.132252pdt."58611"@synergy1.parc.xerox.com> Yes, I'd like to see this in the CVS too. Bill > Hi! > > Attached a patch for the http_server.py problem with unescaping of %XX forms in > the whole request instead just the path. This is what I use in my tools to > prevent medusa from unescaping too much. > > Would be great if this (or something like this, reason below) could make it into > the next version of medusa, as this bug really is a bit annoying - for example > it prevents you from passing parameters using ";" in their value, or pass in > parameters that themselves contain other URLs. > > The patch just pulls out the path element from the request and only unescapes > this and reconstructs the request. > > Actually this patch now unquotes not only the path, but given the form: > > /path/to/method;attr=value;another=value?query=blah&q2=blubb#fragmentpart > > splits at the '?' and unquotes the first part. Maybe (or most surely) this > should be reworked to use split_query from medusa itself and reconstruct the > split request, after unquoting only the path element. > > [murphy:~] gb% diff > /Volumes/Datensicherungen/opt/pyds/lib/python2.2/site-packages/medusa/ > http_server.py /opt/pyds/lib/python2.2/site-packages/medusa/http_server.py > 32c32 > < from urllib import unquote > --- > > from urllib import unquote, splitquery > 473,474c473,478 > < if '%' in request: > < request = unquote (request) > --- > > rpath, rquery = splitquery(request) > > if '%' in rpath: > > if rquery: > > request = unquote (rpath) + '?' + rquery > > else: > > request = unquote (rpath) > > bye, Georg > > _______________________________________________ > Medusa-dev mailing list > Medusa-dev@python.org > http://mail.python.org/mailman/listinfo/medusa-dev From amk at amk.ca Thu Jul 3 21:29:08 2003 From: amk at amk.ca (A.M. Kuchling) Date: Thu Jul 3 20:27:36 2003 Subject: [Medusa-dev] Small patch to move URI unquoting in http_server.py In-Reply-To: References: Message-ID: <20030704002908.GA4428@nyman.amk.ca> On Sun, Jun 29, 2003 at 11:53:44PM +0200, Georg Bauer wrote: >Attached a patch for the http_server.py problem with unescaping of %XX forms in Applied to CVS. Can someone try CVS and verify that it's fixed, or should I just make a new release? --amk From gb at murphy.bofh.ms Fri Jul 4 19:49:36 2003 From: gb at murphy.bofh.ms (Georg Bauer) Date: Fri Jul 4 12:50:13 2003 Subject: [Medusa-dev] Small patch to move URI unquoting in http_server.py In-Reply-To: <20030704002908.GA4428@nyman.amk.ca> Message-ID: Hi! > Applied to CVS. Can someone try CVS and verify that it's fixed, or > should I just make a new release? Uhm. Is that the CVS repository at oedipus.sourceforge.net? If yes, I couldn't find the patch in there. If no, please point me to the right place ;-) It might be that sourceforge had some problems recently with regard to CVS, so maybe there was a hickup? bye, Georg From amk at amk.ca Sun Jul 6 15:33:15 2003 From: amk at amk.ca (A.M. Kuchling) Date: Sun Jul 6 14:35:35 2003 Subject: [Medusa-dev] Small patch to move URI unquoting in http_server.py In-Reply-To: Message-ID: <4E594176-AFE0-11D7-9468-000A956F1D08@amk.ca> On Friday, July 4, 2003, at 12:49 PM, Georg Bauer wrote: > It might be that sourceforge had some problems recently with regard to > CVS, so > maybe there was a hickup? Quite possibly; I believe anonymous CVS on SourceForge is quite far behind the current CVS trees that project developers see, and the problem isn't likely to be fixed until August. See https://sourceforge.net/docman/display_doc.php?docid=17790&group_id=1 . However, I'm quite liberal in handing out CVS access. Send me your SF user ID, if you have one, and I'll add you to the oedipus project. (That goes for anyone who wants to be able to fix Medusa, not just Georg.) --amk From ncabral at terra.com.br Sat Jul 5 13:45:08 2003 From: ncabral at terra.com.br (Ricardo Niederberger Cabral) Date: Mon Jul 7 09:05:29 2003 Subject: [Medusa-dev] error: uncaptured python exception Message-ID: <20030705124508.21881296.ncabral@terra.com.br> Hi, I'm publishing a Quixote app using the medusa http server and I accidentally requested an url this way: (medusa-0.5.3 and Quixote-0.6b6) $ links 127.0.0.1:8080/\ (i believe most browsers would trim that trailing space char) All i got from links was "Error reading from socket", and on the Quixote error log I get 4 lines like this one: error: uncaptured python exception, closing channel (exceptions.AttributeError:'NoneType' object has no attribute 'end' [/usr/lib/python2.2/asyncore.py|poll|99] [/usr/lib/python2.2/asyncore.py|handle_read_event|396] [/usr/lib/python2.2/asynchat.py|handle_read|130] [/usr/lib/python2.2/site-packages/medusa/http_server.py|found_terminator|476] [/usr/lib/python2.2/site-packages/medusa/http_server.py|crack_request|700]) after that medusa still works fine, so I don't know if this is really important at all. Sorry if this has already been reported. Best regards, -- rnc From gb at murphy.bofh.ms Mon Jul 7 21:11:25 2003 From: gb at murphy.bofh.ms (Georg Bauer) Date: Mon Jul 7 14:18:36 2003 Subject: [Medusa-dev] Small patch to move URI unquoting in http_server.py In-Reply-To: <20030704002908.GA4428@nyman.amk.ca> Message-ID: Hi! > Applied to CVS. Can someone try CVS and verify that it's fixed, or > should I just make a new release? Today I was able to fetch the updated source from CVS (sf.net is not only lagging behind, it's quite slow and aborts very often, too :-/). Looks fine with me, I tested it on my community servers and it seems to work ok. So make a new release, I would say. bye, Georg From leonardbocock at yahoo.com Thu Jul 17 06:09:37 2003 From: leonardbocock at yahoo.com (Leonard Bocock) Date: Fri Jul 18 08:49:50 2003 Subject: [Medusa-dev] Sub-classing http_server Message-ID: <20030717120937.19100.qmail@web21309.mail.yahoo.com> List I'm trying to sub-class Medusa into a Threaded class - I basically want to run several 'instances' of the HTTP server in their own instances. Is this possible to do. I notice Zope has done this.... class new_server(http_server): def __init__ (self, ip, port, resolver=None, logger_object=None): self.shutup=1 http_server.__init__(self, ip, port, resolver, logger_object) but I can't get the sub-classing to work. What am I missing? if __name__ == '__main__': zs = zhttp_server(..... Thanks, Leonard __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com From amk at nyman.amk.ca Sun Sep 7 12:49:05 2003 From: amk at nyman.amk.ca (amk@nyman.amk.ca) Date: Mon Sep 8 08:06:12 2003 Subject: [Medusa-dev] Medusa 0.5.4 released Message-ID: <200309071549.h87Fn5Tf008505@nyman.amk.ca> I've finally gotten around to issuing a 0.5.4 release of Medusa in order to wrap up a few bugfixes. It's available from http://www.amk.ca/files/python/medusa-0.5.4.tar.gz . Changes in 0.5.4: * Open syslog using datagram sockets, and only try streams if that fails (Alxy Sav) * Fix bug in http_server.crack_request() (Contributed by Canis Lupus) * Incorporate bugfixes to thread/select_trigger.py from ZEO's version (Zope Corporation) * Add demo/winFTPserver.py, an FTP server that uses Windows authorization to determine who can access the server. (Contributed by John Abel) * Add control files for creating a Debian package of Medusa. --amk From larryt at winfirst.com Thu Oct 30 17:03:53 2003 From: larryt at winfirst.com (Larry Tjoelker) Date: Thu Oct 30 19:34:50 2003 Subject: [Medusa-dev] source consolidation Message-ID: <200310302203.h9UM3roK032127@mail.sacsys.com> Tue Jan 7, 2003, Jeremy Hylton wrote: > I wanted to mention that we've fixed a bunch of bugs in a forked copy > medusa's select_trigger [...] and Fri Mar 7, 2003, Ng Pheng Siong wrote: > M2Crypto includes a distribution of Medusa, likely not the latest, > with HTTPS and FTP/TLS servers. Zope says elsewhere that it has hardly touched core Medusa. Is there any movement or need to unwind these versions into a single authoritative Medusa source tree? -larry From janssen at parc.com Thu Oct 30 19:51:17 2003 From: janssen at parc.com (Bill Janssen) Date: Thu Oct 30 19:51:37 2003 Subject: [Medusa-dev] source consolidation In-Reply-To: Your message of "Thu, 30 Oct 2003 14:03:53 PST." <200310302203.h9UM3roK032127@mail.sacsys.com> Message-ID: <03Oct30.165119pst."58611"@synergy1.parc.xerox.com> On the Web-SIG list, we've been talking about folding Medusa (or something much like it) into the stdlib. Bill From abo at minkirri.apana.org.au Thu Oct 30 20:32:37 2003 From: abo at minkirri.apana.org.au (Donovan Baarda) Date: Thu Oct 30 20:32:57 2003 Subject: [Medusa-dev] source consolidation In-Reply-To: <200310302203.h9UM3roK032127@mail.sacsys.com> References: <200310302203.h9UM3roK032127@mail.sacsys.com> Message-ID: <1067563955.2125.7.camel@ngapa.apana.org.au> On Fri, 2003-10-31 at 09:03, Larry Tjoelker wrote: > Tue Jan 7, 2003, Jeremy Hylton wrote: > > I wanted to mention that we've fixed a bunch of bugs in a forked copy > > medusa's select_trigger [...] > > and > Fri Mar 7, 2003, Ng Pheng Siong wrote: > > M2Crypto includes a distribution of Medusa, likely not the latest, > > with HTTPS and FTP/TLS servers. > > Zope says elsewhere that it has hardly touched core Medusa. Zope doesn't modify Medusa, it inherits from it, then over-rides everything. I don't think much of the core medusa code gets exercised in ZServer because everything is over-ridden. > Is there any movement or need to unwind these versions into a single > authoritative Medusa source tree? Would be good... Some years ago Andrew Kurchling migrated Medusa's CVS to http://oedipus.sourceforge.net/medusa/. AFAIK this is as close as you get to an "authoritative Medusa source tree". Andrew was quite keen to give others CVS access at the time (myself included), but apart from the occasional bugfix it hasn't seen much activity (my fault too). I don't see why various fixes etc shouldn't go into CVS there. In any case it's worth a look to see what's already in there. -- Donovan Baarda http://minkirri.apana.org.au/~abo/ From amk at amk.ca Fri Oct 31 14:18:28 2003 From: amk at amk.ca (amk@amk.ca) Date: Fri Oct 31 14:18:37 2003 Subject: [Medusa-dev] source consolidation In-Reply-To: <1067563955.2125.7.camel@ngapa.apana.org.au> References: <200310302203.h9UM3roK032127@mail.sacsys.com> <1067563955.2125.7.camel@ngapa.apana.org.au> Message-ID: <20031031191828.GB18503@rogue.amk.ca> On Fri, Oct 31, 2003 at 12:32:37PM +1100, Donovan Baarda wrote: > Zope doesn't modify Medusa, it inherits from it, then over-rides > everything. I don't think much of the core medusa code gets exercised in > ZServer because everything is over-ridden. I believe the select_trigger.py changes were the only Zope changes that were actual bug fixes, and they're in the latest version of Medusa. --amk From noracentral at gmx.net Wed Nov 5 12:25:12 2003 From: noracentral at gmx.net (nora central) Date: Wed Nov 5 13:26:17 2003 Subject: [Medusa-dev] installing medusa on windows? Message-ID: hi, have error on installing. any binaries for W2k ? thanks nora From joerg at britannica.bec.de Fri Nov 14 11:30:40 2003 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Fri Nov 14 12:16:05 2003 Subject: [Medusa-dev] Handling of HTTP reply headers and ctime() dates Message-ID: <20031114163040.GA13094@britannica.bec.de> Hi all, the current Medusa code doesn't handle HTTP reply headers correctly. E.g. req['Content-Type'] and req['content-type'] are identical header fields. Another issue is the missing parsing of ctime() dates in http_date. The attached patch fixes those bugs. Hope it will be included in the next version. Regards, Joerg From joerg at britannica.bec.de Sat Nov 15 10:19:32 2003 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Sat Nov 15 10:20:22 2003 Subject: [Medusa-dev] Handling of HTTP reply headers and ctime() dates In-Reply-To: <20031114163040.GA13094@britannica.bec.de> References: <20031114163040.GA13094@britannica.bec.de> Message-ID: <20031115151932.GA851@britannica.bec.de> And here's the actual patch ;-) -------------- next part -------------- diff -uNr medusa-0.5.4.orig/http_date.py medusa-0.5.4/http_date.py --- medusa-0.5.4.orig/http_date.py Tue Mar 19 23:49:34 2002 +++ medusa-0.5.4/http_date.py Fri Nov 14 17:25:44 2003 @@ -118,7 +118,10 @@ if m and m.end() == len(d): retval = int (time.mktime (unpack_rfc822(m)) - tz) else: - return 0 + try: + return int( time.mktime ( time.strptime(d) ) ) + except: + return 0 # Thanks to Craig Silverstein for pointing # out the DST discrepancy if time.daylight and time.localtime(retval)[-1] == 1: # DST correction diff -uNr medusa-0.5.4.orig/http_server.py medusa-0.5.4/http_server.py --- medusa-0.5.4.orig/http_server.py Fri Jul 4 02:24:02 2003 +++ medusa-0.5.4/http_server.py Tue Oct 28 23:52:36 2003 @@ -73,13 +73,13 @@ # reply header management # -------------------------------------------------- def __setitem__ (self, key, value): - self.reply_headers[key] = value + self.reply_headers[key.lower()] = value def __getitem__ (self, key): - return self.reply_headers[key] + return self.reply_headers[key.lower()] def has_key (self, key): - return self.reply_headers.has_key (key) + return self.reply_headers.has_key (key.lower()) def build_reply_header (self): return string.join ( From mark at hubcapconsulting.com Tue Nov 18 17:36:06 2003 From: mark at hubcapconsulting.com (Mark Bucciarelli) Date: Tue Nov 18 17:39:38 2003 Subject: [Medusa-dev] Stopping a Medusa Server Message-ID: <200311181736.06592.mark@hubcapconsulting.com> Hi, First post ... Is there a way to method on a Medusa server that is similar to the twisted.internet.main.shutDown() method? I'd like to run an xmlrpc server using Medusa as a Windows service, and have that service shut things down gracefully, waiting for Medusa to finish any database stuff before stopping. I've quickly read through the Medusa sources (http_server, asyncore.dispatcher) but I didn't find any likely candidates. If there is no such method now, how would you add one? If it's not too complicated, I could attempt a patch ... Regards, -- Mark Bucciarelli, www.hubcapconsulting.com GNU/Linux user #266,902 at http://counter.li.org From joerg at britannica.bec.de Wed Nov 19 03:42:43 2003 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Wed Nov 19 03:44:20 2003 Subject: [Medusa-dev] Stopping a Medusa Server In-Reply-To: <200311181736.06592.mark@hubcapconsulting.com> References: <200311181736.06592.mark@hubcapconsulting.com> Message-ID: <20031119084243.GA800@britannica.bec.de> On Tue, Nov 18, 2003 at 05:36:06PM -0500, Mark Bucciarelli wrote: > Hi, > > First post ... > > Is there a way to method on a Medusa server that is similar to the > twisted.internet.main.shutDown() method? > > I'd like to run an xmlrpc server using Medusa as a Windows service, and have > that service shut things down gracefully, waiting for Medusa to finish any > database stuff before stopping. > > I've quickly read through the Medusa sources (http_server, > asyncore.dispatcher) but I didn't find any likely candidates. > > If there is no such method now, how would you add one? If it's not too > complicated, I could attempt a patch ... I am not aware of such a function. But have a look at the implementation of the emergency_debug in status_handler.py. Instead of closing the sockets and recreating them, close them only. Now only already open connections will be served and a new server instance can be started. If there are things like persistent connections, you might want to add a way for cancellation at the nearest useful point, but that's more complicated and somewhat application specific. Joerg > > Regards, > > -- > Mark Bucciarelli, www.hubcapconsulting.com > GNU/Linux user #266,902 at http://counter.li.org > > _______________________________________________ > Medusa-dev mailing list > Medusa-dev@python.org > http://mail.python.org/mailman/listinfo/medusa-dev > From giles_brown at hotmail.com Wed Nov 19 03:29:06 2003 From: giles_brown at hotmail.com (Giles Brown) Date: Thu Nov 20 17:45:37 2003 Subject: [Medusa-dev] Stopping a Medusa Server Message-ID: > >Hi, > >First post ... > >Is there a way to method on a Medusa server that is similar to the >twisted.internet.main.shutDown() method? > >I'd like to run an xmlrpc server using Medusa as a Windows service, and >have >that service shut things down gracefully, waiting for Medusa to finish any >database stuff before stopping. > >I've quickly read through the Medusa sources (http_server, >asyncore.dispatcher) but I didn't find any likely candidates. > >If there is no such method now, how would you add one? If it's not too >complicated, I could attempt a patch ... > >Regards, Stopping an asyncore event loop from within a handler is as simple as: def raise_exit(self): """Triggers exiting of event loop.""" raise asyncore.ExitNow Getting it into a handler from another thread is harder. If you try and use the medusa.thread.select_trigger to transfer it into the main thread, the handle_read method catches *all* exceptions (even asyncore.ExitNow). If you modify it to not catch this particular exception everything is ok. So IMHO the only change needed is to alter "handle_read" in medusa.thread.select_trigger to avoid catching (or re-raise) asyncore.ExitNow. Hth, Giles _________________________________________________________________ Stay in touch with absent friends - get MSN Messenger http://www.msn.co.uk/messenger From skumar at datec-systems.com Thu Dec 4 02:54:29 2003 From: skumar at datec-systems.com (Santosh Kumar K.) Date: Thu Dec 4 02:54:31 2003 Subject: [Medusa-dev] Telnet server implementation Message-ID: <3FCEE835.155F0D6F@datec-systems.com> Hi all, I am looking forward to use medusa as a telnet server in python of the same framework as the asyncore which uses no threads yet providing a threaded approach ( asyncore + async_chat kind) . I want to present the user with some menu system (test based which is the only one permitted on telnet session ) after he gets past a login banner and from where he can select further sub-menus .. and all the command typed should be piped ( to , from ) to the appropriate asyn_chat object instance ..unfortunately the asyncore does not address this unless u write some wrapper around it .. any pointers would be highly appreciated .Ya one thing the box which i am using (embedded customized linux, no shell ) has a behaviour of pre-empting all the child threads even b4 they have completed their tasks so i am avoiding threads . I lot of http server kind of work is there on medusa but no telent kinnda work ..any ideas ? any pointers would be highly appreciated, Thanks in advance, SK -------------- next part -------------- A non-text attachment was scrubbed... Name: skumar.vcf Type: text/x-vcard Size: 325 bytes Desc: Card for Santosh Kumar K. Url : http://mail.python.org/pipermail/medusa-dev/attachments/20031204/cb32aabc/skumar.vcf From mark at hubcapconsulting.com Thu Dec 4 09:25:16 2003 From: mark at hubcapconsulting.com (Mark Bucciarelli) Date: Thu Dec 4 09:28:53 2003 Subject: [Medusa-dev] [PATCH] Content-Length in xmlrpc response Message-ID: <200312040925.16204.mark@hubcapconsulting.com> I'm using a C++ xmlrpc client library. This client expects the response to an xmlrpc call to include the content length. I don't know if this is required as part of the xmlrpc spec, but it doesn't seem like it can hurt to include it in the response object. See attached patch. -- Mark Bucciarelli, www.hubcapconsulting.com GNU/Linux user #266,902 at http://counter.li.org -------------- next part -------------- A non-text attachment was scrubbed... Name: medusa-0.5.4_contentlength.patch Type: text/x-diff Size: 396 bytes Desc: not available Url : http://mail.python.org/pipermail/medusa-dev/attachments/20031204/f76590f9/medusa-0.5.4_contentlength.bin