[issue14204] Support for the NPN extension to TLS/SSL
Changes by Marcelo Fernández marcelo.fidel.fernan...@gmail.com: -- nosy: +marcelo_fernandez ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14204 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5672] Implement a way to change the python process name
Marcelo Fernández marcelo.fidel.fernan...@gmail.com added the comment: So, while I'd be pleased to have it included in the stdlib, I'm not really convinced it would be useful to such a large audience. I think different, if python becomes even more successful to be used in desktop apps, this feature will be *very* important, because the reasons I've exposed in this thread. Regards -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5672 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5672] Implement a way to change the python process name
Marcelo Fernández marcelo.fidel.fernan...@gmail.com added the comment: 2009/12/7 Daniele Varrazzo rep...@bugs.python.org: Daniele Varrazzo p...@develer.com added the comment: I've just tested it and it works fine here... Any possibility this module can be included in the regular python standard library, in the future? Only in the far future. I don't think the Python standard library should include a module whose version number is 0.2. I agree: I started the project 4-5 days ago and, albeit very limited in its scope, for portability reasons is way more complex than a simple syscall and needs to be tested on many other platforms. Of course, when I said future I meant when this project is stable and tested enough... :-) Thanks -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5672 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5672] Implement a way to change the python process name
Marcelo Fernández marcelo.fidel.fernan...@gmail.com added the comment: Great, piro! I'm taking a look at it, and it seems to use setproctitle() in BSD, and writes over the argv array in most Sys-V like systems; this includes Linux? My question is because I think there's a better and supported method for Linux, that is, using prctl [1]. I read somewhere that changing argv causes some inconsistencies between programs who read /sys files, /proc files... or I don't remember what, but it is, in fact, not the *recommended* way. Prctl is. :-) PR_SET_NAME and PR_GET_NAME parameters in prctl.h: [1] http://www.kernel.org/doc/man-pages/online/pages/man2/prctl.2.html Could this module be altered to use a prctl call in Linux (2.6.9)? Thanks a lot. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5672 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5672] Implement a way to change the python process name
Marcelo Fernández marcelo.fidel.fernan...@gmail.com added the comment: 2009/12/6 Daniele Varrazzo rep...@bugs.python.org: My question is because I think there's a better and supported method for Linux, that is, using prctl [1]. I read somewhere that changing argv causes some inconsistencies between programs who read /sys files, /proc files... or I don't remember what, but it is, in fact, not the *recommended* way. Prctl is. :-) This is interesting: do you have any reference? For example, take a look at the comments here: http://abock.org/2006/02/09/changing-process-name-in-mono It seems that some utilities and programs (killall, gnome-system-monitor, and so on) looks for the process name in /proc/PID/status, not in /proc/PID/cmdline, so it should be better (in Linux), to modify both, /proc/PID/cmdline (changing argv) *and* /proc/PID/status (calling prctl()). I installed py-setproctitle, and can't kill it with killall once I set the name to hello, for example. :-( [1]+ Detenidopython marc...@marcelo-laptop:~/src/py-setproctitle$ ps a PID TTY STAT TIME COMMAND 1030 tty4 Ss+0:00 /sbin/getty -8 38400 tty4 1033 tty5 Ss+0:00 /sbin/getty -8 38400 tty5 1049 tty2 Ss+0:00 /sbin/getty -8 38400 tty2 1050 tty3 Ss+0:00 /sbin/getty -8 38400 tty3 1052 tty6 Ss+0:00 /sbin/getty -8 38400 tty6 1349 tty7 Ss+ 17:14 /usr/bin/X :0 -br -verbose -auth /var/run/gdm/auth-for-gdm-XhETSO/database -nolisten tcp vt7 2225 tty1 Ss+0:00 /sbin/getty -8 38400 tty1 10344 pts/0Ss+0:00 /bin/bash -l 11923 pts/1Ss 0:00 bash 12068 pts/2Ss+0:00 bash 12485 pts/1T 0:00 hello 12496 pts/1R+ 0:00 ps a marc...@marcelo-laptop:~/src/py-setproctitle$ killall hello hello: proceso no encontrado Another example: The gnome-system-monitor still lists the 'hello' process (PID 12485) like 'python'. So we should try I've tested with the difference between clobbering argv and call prctl: two demo programs are in the tools directory of the module project [2]. For what I observed, clobbering argv changes what shown in ``/proc/PID/cmdline``, whereas prctl changes what can be read in ``/proc/PID/status`` (and ``stat`` too). ``ps`` uses the former, but switches to the latter when calling ``ps a`` and ``ps f``. ``top`` toggles between the two pressing ``c``. Sorry, but here (Ubuntu 9.10) it works the other way around: ps lists the /proc/PID/status - name field and ps a lists the /proc/PID/cmdline. But I got the explanation. :-) I think is probably better to have both strings updated: I'd prefer this behavior instead of the title being set in different places on different Linux versions. IMHO, I'd prefer both things: to change the argv array *and* calling prctl() if possible (Linux 2.6.9). If Linux is lower than 2.6.9, fallback to change argv only. Regards -- Marcelo F. Fernández Buenos Aires, Argentina Licenciado en Sistemas - CCNA E-Mail: marcelo.fidel.fernan...@gmail.com Blog: http://blog.marcelofernandez.info Twitter: http://twitter.com/fidelfernandez -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5672 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5672] Implement a way to change the python process name
Marcelo Fernández marcelo.fidel.fernan...@gmail.com added the comment: 2009/12/6 Daniele Varrazzo rep...@bugs.python.org: Just released setproctitle 0.2 where I also call prctl() if available. It is actually the string used by killall. Great! I've just tested it and it works fine here... Any possibility this module can be included in the regular python standard library, in the future? Thanks! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5672 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3466] urllib2 should support HTTPS connections with client keys
Marcelo Fernández fernandez...@yahoo.com.ar added the comment: The workaround I posted before doesn't work with Python 2.6. This one works (at least) with Python 2.5 *and* Python 2.6: import httplib import urllib2 key_file = 'mykey.pem' cert_file = 'mycert-signed.pem' class HTTPSClientAuthConnection(httplib.HTTPSConnection): def __init__(self, host, timeout=None): httplib.HTTPSConnection.__init__(self, host, key_file=key_file, cert_file=cert_file) self.timeout = timeout # Only valid in Python 2.6 class HTTPSClientAuthHandler(urllib2.HTTPSHandler): def https_open(self, req): return self.do_open(HTTPSClientAuthConnection, req) This is a little class to use it: class Connection(object): def __init__(self, url): # TODO: Validate/Sanitize the url self.url = url self._cookiejar = cookielib.CookieJar() def send(self, **data): parameters = urllib.urlencode(data) opener = urllib2.build_opener(HTTPHandler(debuglevel=DEBUG_LEVEL), HTTPSClientAuthHandler(debuglevel=DEBUG_LEVEL), HTTPCookieProcessor(self._cookiejar)) req = Request(self.url, parameters) server_response = opener.open(req).read() print server_response return server_response Regards -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3466 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5672] Implement a way to change the python process name
Marcelo Fernández fernandez...@yahoo.com.ar added the comment: This patch (to python 2.7 trunk) allows to call prctl() function from Linux kernel to change the process name. It adds two methods to the os module: os.getprocname() and os.setprocname(). Working example: marc...@marcelo-laptop:~/src/pytrunk$ ./python Python 2.7a0 (trunk:71261M, Apr 5 2009, 16:32:55) [GCC 4.3.2] on linux2 Type help, copyright, credits or license for more information. import os [34831 refs] os.getprocname() './python' [34833 refs] os.getpid() 5601 [34833 refs] os.setprocname('hello_process_name') [34833 refs] os.getprocname() 'hello_process_name' [34833 refs] Before changing the process name: marc...@marcelo-laptop:~/src/pytrunk$ ps -fax | grep 5601 Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html 5601 pts/2S+ 0:00 | \_ ./python 5611 pts/3S+ 0:00 \_ grep 5601 After changing the process name: marc...@marcelo-laptop:~/src/pytrunk$ ps -fax | grep 5601 Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html 5601 pts/2S+ 0:00 | \_ hello_process_name 5635 pts/3S+ 0:00 \_ grep 5601 And killall hello_process_name works, Gnome Process monitor shows it fine too. By now this is Linux only, but I hope to implement it also for BSD (FreeBSD has it[1], OpenBSD [2] and NetBSD [3] too). [1] http://fxr.watson.org/fxr/source/gen/setproctitle.c?v=FREEBSD-LIBC [2] http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/gen/setproctitle.c?rev=1.11;content-type=text%2Fx-cvsweb-markup [3] http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/gen/setproctitle.c?rev=1.22content-type=text/x-cvsweb-markuponly_with_tag=MAIN Regards -- keywords: +patch Added file: http://bugs.python.org/file13635/issue5672_1.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5672 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5672] Implement a way to change the python process name
Marcelo Fernández fernandez...@yahoo.com.ar added the comment: Great, it's my first patch to python and I'm very happy with your comments. :-) Thanks Amaury, do you think is better that I should take out getprocname() if setprocname() changes sys.argv too? When I got some spare time, I'll take a look at your suggestion and the psutil project. Thanks again -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5672 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5672] Implement a way to change the python process name
Marcelo Fernández fernandez...@yahoo.com.ar added the comment: Fine, I'll try to make a patch based on the procname project in Google Code. Here are some more links with more approaches to solve this issue (while I learn how to make a patch :-) ) http://abock.org/2006/02/09/changing-process-name-in-mono/ http://shiny.thorne.id.au/2006/02/changing-python-process-titles.html http://ubuntuforums.org/showthread.php?t=694331 Regards -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5672 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5672] Implement a way to change the python process name
New submission from Marcelo Fernández fernandez...@yahoo.com.ar: As python gains more popularity, more and more applications run under CPython in a common user desktop. The problem is that if a user has 2 or more python apps running there is no way to identify them correctly from the generic Task/Process Manager Application (in Windows/Linux/OSX/any OS), because all appear as a python process. Take Ubuntu for an example. There are more cases when this is annoying: - Imagine two python process (doing different things, of course) sending messages to syslog: looks like all coming from python process. - A bash script which wants to killall one application: how can it identify a given python script between two or more python processes? There are some methods [1][2] to work around it, but there are not just Linux/BSD only, moreover, there are not included in the python standard modules. [1] http://davyd.livejournal.com/166352.html [2] http://code.google.com/p/procname/ I hope this issue gets considered in the community to fix it, I really think this is important... :-) Regards, Marcelo -- components: Extension Modules messages: 85252 nosy: marcelo_fernandez severity: normal status: open title: Implement a way to change the python process name type: feature request ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5672 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5672] Implement a way to change the python process name
Marcelo Fernández fernandez...@yahoo.com.ar added the comment: Uhm... ok, (looking at issue 4015) I agree with that method at some point (tough is not exactly the same thing)... but only if the launcher will not be for Windows only, and that solution would be consistent across al platforms... Just to know, there is no prctl equivalent in Windows? Regards -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5672 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3466] urllib2 should support HTTPS connections with client keys
New submission from Marcelo Fernández [EMAIL PROTECTED]: Despite httplib does have support for HTTPS with client keys[1], urllib2 should support them too, because of the added value that urllib2 has, like cookielib automatic handling. [1]: http://code.activestate.com/recipes/117004/ However, I made a workaround: #-*- coding: utf-8 -*- import httplib import urllib2 key_file = None cert_file = None class HTTPSClientAuthConnection(httplib.HTTPSConnection): def __init__(self, host): httplib.HTTPSConnection.__init__(self, host, key_file=key_file, cert_file=cert_file) class HTTPSClientAuthHandler(urllib2.HTTPSHandler): def https_open(self, req): return self.do_open(HTTPSClientAuthConnection, req) Regards, Marcelo -- components: Library (Lib) messages: 70397 nosy: marcelo_fernandez severity: normal status: open title: urllib2 should support HTTPS connections with client keys type: feature request ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3466 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com