[issue14001] CVE-2012-0845 Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2021-11-04 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
components: +Library (Lib), XML -email
nosy: +Arfrever, dmalcolm, ezio.melotti, flox, iankko, loewis, neologix, 
orsenthil, pitrou, python-dev, rosslagerwall, schmir -ahmedsayeed1982, barry, 
r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] CVE-2012-0845 Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2021-11-04 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
Removed message: https://bugs.python.org/msg405710

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] CVE-2012-0845 Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2021-11-04 Thread Ahmed Sayeed


Ahmed Sayeed  added the comment:

The glibc regular expression code mishandles regular expressions such as:

   .*((.)\2){2}$ https://www.webb-dev.co.uk/services/navona-trains/

as it does not backtrack enough to find a match that satisfies the 
back-references when they are used twice.
http://www.compilatori.com/computers/latest-car-deals/
To reproduce the problem, compile and run the attached file backrefbug.c. It 
will exit with status 2, whereas the correct exit status is 0.
 http://www.acpirateradio.co.uk/computers/latest-car-deals/
This bug was originally reported against GNU 'grep' here:
The glibc regular expression code mishandles regular expressions such as:

   .*((.)\2){2}$ http://www.logoarts.co.uk/computers/latest-car-deals/

as it does not backtrack enough to find a match that satisfies the 
back-references when they are used twice.

To reproduce the problem, compile and run the attached file backrefbug.c. It 
will exit with status 2, whereas the correct exit status is 0. 
http://www.slipstone.co.uk/computers/latest-car-deals/

This bug was originally reported against GNU 'grep' here:
The glibc regular expression code mishandles regular expressions such as: 
http://embermanchester.uk/computers/latest-car-deals/

   .*((.)\2){2}$

as it does not backtrack enough to find a match that satisfies the 
back-references when they are used twice. 
http://connstr.net/computers/latest-car-deals/

To reproduce the problem, compile and run the attached file backrefbug.c. It 
will exit with status 2, whereas the correct exit status is 0. 
http://joerg.li/computers/latest-car-deals/

This bug was originally reported against GNU 'grep' here:
The glibc regular expression code mishandles regular expressions such as:

   .*((.)\2){2}$ http://www.jopspeech.com/computers/latest-car-deals/

as it does not backtrack enough to find a match that satisfies the 
back-references when they are used twice.
 http://www.wearelondonmade.com/computers/latest-car-deals/
To reproduce the problem, compile and run the attached file backrefbug.c. It 
will exit with status 2, whereas the correct exit status is 0.
 https://waytowhatsnext.com/crypto/crypto-world/
This bug was originally reported against GNU 'grep' here:
The glibc regular expression code mishandles regular expressions such as:
http://www.iu-bloomington.com/crypto/latest-coins/
   .*((.)\2){2}$

as it does not backtrack enough to find a match that satisfies the 
back-references when they are used twice. 
https://komiya-dental.com/crypto/alt-coins/

To reproduce the problem, compile and run the attached file backrefbug.c. It 
will exit with status 2, whereas the correct exit status is 0. 
http://www-look-4.com/computers/latest-car-deals/

This bug was originally reported against GNU 'grep' here:

--
components: +email -Library (Lib), XML
nosy: +ahmedsayeed1982, barry, r.david.murray -Arfrever, dmalcolm, 
ezio.melotti, flox, iankko, loewis, neologix, orsenthil, pitrou, python-dev, 
rosslagerwall, schmir
versions:  -Python 2.6, Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-28 Thread Alejandro MJ

Alejandro MJ added the comment:

Thanks a lot for your help, as you suggested the problem was because of the 
method set_tunnel. I've tested the code that you have posted and now works 
perfectly.

I'll keep in mind this for future works. We can conclude that it's not really a 
bug of Python, so that this problem is related to proxy configuration. However, 
I'll take in count which version of Python to use if I have to do a similar job.

Regards,
Alejandro

--
resolution:  - not a bug

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-28 Thread Demian Brecht

Demian Brecht added the comment:

No problem, happy you were able to get things sorted. Feel free to close this 
issue as I've opened #22095 to address the host port header issue.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-28 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
stage:  - resolved
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-25 Thread Alejandro MJ

Alejandro MJ added the comment:

Thanks a lot for your help!

I've tested it in Linux, Python version 3.3.5 and the message obtained is this: 
[404 Not Found]. The script is this one (changing of course the ip_address and 
the proxy_url values):

import http.client, urllib.parse
data = urllib.parse.urlencode({'nombre': 'HERVAS INFANTE ALBERTO'})
headers = {Content-type: application/x-www-form-urlencoded}
conn = http.client.HTTPConnection(proxy_url,8080, source_address=(ip_address, 
0))
conn.set_tunnel(www.telexplorer.es,port=80)  
conn.request(POST, /?zone=namwp,data,headers)
response = conn.getresponse()
print(Test 1: TE - , response.status, response.reason)
data = response.read()
conn.close()


How could I test that patch attached? I suppose that I have to install 
something on Suse? As I could read in some forums, I should launch this 
sentence:

patch -p1 --dry-run  issue22041_1.patch

Could you please help me with this points? thanks!

--
nosy: +AlexMJ

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-25 Thread Alejandro MJ

Alejandro MJ added the comment:

I've wrote these sentences on my SUSE, python is installed on path: 
/usr/local/pr/python

computer002:/usr/local/pr/python # patch -p1 --dry-run issue22041_1.patch
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--
|diff -r 5d70ac83d104 Lib/http/client.py
|--- a/Lib/http/client.py   Thu Jul 24 12:44:07 2014 +0200
|+++ b/Lib/http/client.py   Thu Jul 24 16:34:46 2014 -0700
--
File to patch: /usr/local/pr/python/lib/python3.3/http/client.py
patching file /usr/local/pr/python/lib/python3.3/http/client.py
Hunk #1 FAILED at 835.
1 out of 1 hunk FAILED -- saving rejects to file 
/usr/local/pr/python/lib/python3.3/http/client.py.rej
can't find file to patch at input line 17
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--
|diff -r 5d70ac83d104 Lib/test/test_httplib.py
|--- a/Lib/test/test_httplib.py Thu Jul 24 12:44:07 2014 +0200
|+++ b/Lib/test/test_httplib.py Thu Jul 24 16:34:46 2014 -0700
--
File to patch: /usr/local/pr/python/lib/python3.3/test/test_httplib.py
patching file /usr/local/pr/python/lib/python3.3/test/test_httplib.py
Hunk #1 FAILED at 1235.
1 out of 1 hunk FAILED -- saving rejects to file 
/usr/local/pr/python/lib/python3.3/test/test_httplib.py.rej
computer002:/usr/local/pr/python #
 
What am I doing wrong?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-25 Thread Demian Brecht

Demian Brecht added the comment:

To add a little more detail, from what I gather, CONNECT support may be 
unsupported or limited (i.e. only allowing SSL connections) on various proxy 
servers. If the code snippet in my previous post solves your issue, then I 
would assume that to be the case with the proxy you're using.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-25 Thread Demian Brecht

Demian Brecht added the comment:

Sorry Alejandro, I should have clarified: The attached patch is for dev, so the 
failure you're seeing when attempting to apply the patch against 3.3 is 
expected. It effectively does the same thing as explicitly setting the port as 
you have already attempted.

At this point, I'm relatively confident that the issue is due to the proxy 
server in use. Using your latest code but a local squid proxy, I'm able to get 
200 responses with the latest releases of 3.3 and 3.4 as well as against dev.

Do you absolutely need to tunnel? The most common use case for tunnelling is to 
use SSL, which doesn't seem to be the case here. Does the following code work 
for you? It still uses the proxy server, but without CONNECT.

import http.client, urllib.parse
data = urllib.parse.urlencode({'nombre': 'HERVAS INFANTE ALBERTO'})
headers = {Content-type: application/x-www-form-urlencoded}
conn = http.client.HTTPConnection(proxy_url,8080, source_address=(ip_address, 
0))
conn.request(POST, http://www.telexplorer.es/?zone=namwp,data,headers)
response = conn.getresponse()
print(Test 1: TE - , response.status, response.reason)
data = response.read()
conn.close()


If the above code doesn't fulfill your requirements, do you know the 
vendor/version of the proxy that you're using?


Note to self: 3.3 doesn't respect _tunnel_port when setting the host header for 
requests (this was added in 3.4), so CONNECT and subsequent host headers will 
appear to be correct as long as the ports match up. The problem 3.4+ is that 
rather than ensuring non-None value in set_tunnel, it's done in _tunnel as a 
step just before CONNECT. That step is not replicated when the host header is 
set in putrequest, which leads to the value of None being sent for the port 
in the case where the port is not explicitly set in set_tunnel. To me, it makes 
the most sense to use _set_hostport in set_tunnel as in the attached patch to 
ensure any other use of _tunnel_port can be done without special handling of 
None.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-24 Thread Demian Brecht

Demian Brecht added the comment:

I've attached a patch that solves the issue I encountered. It would be great if 
you could confirm whether or not it also resolves the issue as reported.

--
keywords: +patch
Added file: http://bugs.python.org/file36066/issue22041.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-24 Thread Demian Brecht

Demian Brecht added the comment:

Attached a new patch with with a simple test.

--
Added file: http://bugs.python.org/file36079/issue22041_1.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-23 Thread Alejandro Mj

Changes by Alejandro Mj witchar...@gmail.com:


--
nosy:  -AlexMJ

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-23 Thread Demian Brecht

Changes by Demian Brecht demianbre...@gmail.com:


--
nosy: +demian.brecht

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-23 Thread Demian Brecht

Demian Brecht added the comment:

Hi Alejandro,

I've spent a little time looking into this. I haven't been able to reproduce 
what you're seeing on Windows exactly, but I've encountered other issues along 
the same path using a local squid instance (localhost:4242):


from http.client import OK, HTTPConnection
import unittest

class TestProxy(unittest.TestCase):
def test_proxy_tunnel_success(self):
con = HTTPConnection('localhost', 4242)
con.set_tunnel('www.example.com')
con.request('GET', 'http://www.example.com')
resp = con.getresponse()
self.assertEqual(resp.code, 200)
data = resp.read()
con.close()

def test_proxy_tunnel_failure(self):
con = HTTPConnection('localhost', 4242)
con.set_tunnel('www.example.com')
con.request('GET', '/')
resp = con.getresponse()
self.assertEqual(resp.code, 200) # FAILS
con.close()

if __name__ == '__main__':
unittest.main()


As you can see with the test above, if I use the full URI, the request 
succeeds, but the relative path (as in your example) fails. My assumption is 
that these issues may be related to proxy server implementations, but I'd have 
to some further investigation before being able to go on more than a hunch (and 
I don't have time to do that tonight).

As a first step, could you please try using a full URI in your request and see 
if that produces the desired result?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-23 Thread Demian Brecht

Demian Brecht added the comment:

Ignore my previous note. Digging into this a little more, I think I've possibly 
found the underlying issue:

If the port is not specified in set_tunnel (as in your example), the buffer 
sent over the wire looks like

send: b'POST [PATH] HTTP/1.1\r\nHost: [HOST]:None\r\nAccept-Encoding: 
identity\r\nContent-Length: 41\r\nAccept: text/plain\r\nContent-type: 
application/x-www-form-urlencoded\r\n\r\n[FORM_DATA]'

Note the None as the port. However, if the port is explicitly set, then the 
resulting buffer looks like:

send: b'POST [PATH] HTTP/1.1\r\nHost: [HOST]:[PORT]\r\nAccept-Encoding: 
identity\r\nContent-Length: 41\r\nAccept: text/plain\r\nContent-type: 
application/x-www-form-urlencoded\r\n\r\n[FORM_DATA]'


Can you retry your example, but specify the port and let me know if that fixes 
your problem? Either way, this is a bug that I'll submit a patch (and test) 
for, but I'd like to know that it solves the issue as written.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22041] http POST request with python 3.3 through web proxy

2014-07-22 Thread Alejandro MJ

New submission from Alejandro MJ:

I'm trying this specific method with python, in order to use a different ip 
source, to do a POST request: 

import http.client, urllib.parse
data = urllib.parse.urlencode({'QLastname': 'DIAZ HERNANDEZ', 'QFirstname': 
'JAIME'})
headers = {Content-type: application/x-www-form-urlencoded,Accept: 
text/plain}
conn = http.client.HTTPConnection(www.infobel.com,80, 
source_address=(16.19.109.51, 0))
conn.request(POST, /es/spain/people.aspx, data, headers)
response = conn.getresponse()
print(response.status, response.reason)
data = response.read()
conn.close()

It works perfectly when I test it without a proxy, but when I try with proxy 
connection, I receive this error:

 conn.request(POST, /es/spain/people.aspx, data, headers)
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\Python34\lib\http\client.py, line 1090, in request
self._send_request(method, url, body, headers)
  File C:\Python34\lib\http\client.py, line 1128, in _send_request
self.endheaders(body)
  File C:\Python34\lib\http\client.py, line 1086, in endheaders
self._send_output(message_body)
  File C:\Python34\lib\http\client.py, line 924, in _send_output
self.send(msg)
  File C:\Python34\lib\http\client.py, line 859, in send
self.connect()
  File C:\Python34\lib\http\client.py, line 836, in connect
self.timeout, self.source_address)
  File C:\Python34\lib\socket.py, line 509, in create_connection
raise err
  File C:\Python34\lib\socket.py, line 500, in create_connection
sock.connect(sa)

TimeoutError: [WinError 10060] Se produjo un error durante el intento...

How could I follow proxy configuration in this script? 

This is the code I made to test with proxy (following the documentation of 
Python):

import http.client, urllib.parse
data = urllib.parse.urlencode({'QLastname': 'DIAZ HERNANDEZ', 'QFirstname': 
'JAIME'})
headers={Content-Type:application/x-www-form-urlencoded,Accept:text/plain}
conn = http.client.HTTPConnection(proxy_url,8080, source_address=(ipAddress, 0))
conn.set_tunnel(www.infobel.com)
conn.request(POST, /es/spain/people.aspx, data, headers)
response = conn.getresponse()
print(response.status, response.reason)
data = response.read()
conn.close()

I could't make it work in this SO:
SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 2 

The message that proxy give us is this:

2014-07-22 08:31:49 87 16.19.109.51 23.2.2.22 - - - PROXIED none -  200 
TCP_ACCELERATED CONNECT - tcp www.infobel.com 80 / - - - 23.2.2.22 39 39 - 
2014-07-22 08:31:49 1  16.19.109.51 23.2.2.22 - - dns_unresolved_hostname 
PROXIED none -  404 TCP_ERR_MISS POST - http cachebdvg1.igrupobbva 8080 
/es/spain/people.aspx - aspx - 23.2.2.22 815 230 - 

So I tried to prove it in other SO, such as Windows, in a different computer. A 
curious thing... I've tried this with Python3.4.1 in Windows, and it didn't 
work. But when I proved with Python3.3.5 it works!! 

Thanks for help.

--
components: Windows
messages: 223688
nosy: AlexMJ
priority: normal
severity: normal
status: open
title: http POST request with python 3.3 through web proxy
type: behavior
versions: Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22041
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] CVE-2012-0845 Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-19 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

Committed, thanks!

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] CVE-2012-0845 Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-18 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 24244a744d01 by Charles-François Natali in branch '2.6':
Issue #14001: CVE-2012-0845: xmlrpc: Fix an endless loop in SimpleXMLRPCServer
http://hg.python.org/cpython/rev/24244a744d01

New changeset 0c02f30b2538 by Charles-François Natali in branch '2.7':
Issue #14001: CVE-2012-0845: xmlrpc: Fix an endless loop in SimpleXMLRPCServer
http://hg.python.org/cpython/rev/0c02f30b2538

New changeset 4dd5a94fd3e3 by Charles-François Natali in branch '3.1':
Issue #14001: CVE-2012-0845: xmlrpc: Fix an endless loop in SimpleXMLRPCServer
http://hg.python.org/cpython/rev/4dd5a94fd3e3

New changeset cd67740ce653 by Charles-François Natali in branch '3.2':
Issue #14001: CVE-2012-0845: xmlrpc: Fix an endless loop in SimpleXMLRPCServer
http://hg.python.org/cpython/rev/cd67740ce653

New changeset 5756b295b6fb by Charles-François Natali in branch 'default':
Issue #14001: CVE-2012-0845: xmlrpc: Fix an endless loop in SimpleXMLRPCServer
http://hg.python.org/cpython/rev/5756b295b6fb

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] CVE-2012-0845 Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-15 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

As a security issue, it applies to 2.6 and 3.1 as well.

--
versions: +Python 2.6, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] CVE-2012-0845 Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-15 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

The test fails on 2.6 and 2.7, because of a EPIPE, which is normal in
this case (well, at least expected):

test_partial_post (test.test_xmlrpc.SimpleServerTestCase) ...

Exception happened during processing of request from ('127.0.0.1', 47844)
Traceback (most recent call last):
  File /home/cf/python/cpython/Lib/SocketServer.py, line 283, in
_handle_request_noblock
self.process_request(request, client_address)
  File /home/cf/python/cpython/Lib/SocketServer.py, line 309, in
process_request
self.finish_request(request, client_address)
  File /home/cf/python/cpython/Lib/SocketServer.py, line 322, in
finish_request
self.RequestHandlerClass(request, client_address, self)
  File /home/cf/python/cpython/Lib/SocketServer.py, line 617, in __init__
self.handle()
  File /home/cf/python/cpython/Lib/BaseHTTPServer.py, line 329, in handle
self.handle_one_request()
  File /home/cf/python/cpython/Lib/BaseHTTPServer.py, line 323, in
handle_one_request
method()
  File /home/cf/python/cpython/Lib/SimpleXMLRPCServer.py, line 490, in do_POST
self.send_response(200)
  File /home/cf/python/cpython/Lib/BaseHTTPServer.py, line 384, in
send_response
self.send_header('Server', self.version_string())
  File /home/cf/python/cpython/Lib/BaseHTTPServer.py, line 390, in send_header
self.wfile.write(%s: %s\r\n % (keyword, value))
  File /home/cf/python/cpython/Lib/socket.py, line 318, in write
self.flush()
  File /home/cf/python/cpython/Lib/socket.py, line 297, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 32] Broken pipe


What should I do? Remove the test?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] CVE-2012-0845 Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-14 Thread Jan Lieskovsky

Jan Lieskovsky ian...@seznam.cz added the comment:

The CVE identifier of CVE-2012-0845 has been assigned to this issue:
[3] http://www.openwall.com/lists/oss-security/2012/02/13/4

--
title: Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) 
by processing malformed XMLRPC / HTTP POST request - CVE-2012-0845 Python 
v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing 
malformed XMLRPC / HTTP POST request

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] CVE-2012-0845 Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-14 Thread Senthil Kumaran

Changes by Senthil Kumaran sent...@uthcode.com:


--
nosy: +orsenthil

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] CVE-2012-0845 Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-14 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
stage: needs patch - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] CVE-2012-0845 Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-14 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

With test.
test_xmlrpc has a timeout detection code which is simply broken (and it's 
actually documented): I just removed it, so if the server loops, the test will 
block. I think it's acceptable since other tests behave in the same way, and 
those days we have faulthandler that can be used to pinpoint such 
deadlocks/loops easily. Also, I've noticed that people are more inclined to fix 
tests that block than mere failing tests :-)

--
Added file: http://bugs.python.org/file24522/xmlrpc_loop-1.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] CVE-2012-0845 Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-14 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

The patch looks ok to me.

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-13 Thread Jan Lieskovsky

New submission from Jan Lieskovsky ian...@seznam.cz:

A denial of service flaw was found in the way Simple XML-RPC Server module of 
Python processed client connections, that were closed prior the complete 
request body has been received. A remote attacker could use this flaw to cause 
Python Simple XML-RPC based server process to consume excessive amount of CPU.

Credit:
Issue reported by Daniel Callaghan

References:
[1] https://bugzilla.redhat.com/show_bug.cgi?id=789790

Steps to reproduce:
--
A) for v3.2.2 version:

1) start server:
cat s.py 
#!/usr/local/bin/python3

from xmlrpc.server import SimpleXMLRPCServer
server = SimpleXMLRPCServer(('127.0.0.1', 12345))
server.serve_forever()

2) # top

3) issue request from client:
echo -e 'POST /RPC2 HTTP/1.0\r\nContent-Length: 100\r\n\r\nlol bye' | nc 
localhost 12345

Return to 'top' screen and see, how CPU consumption on particular host quickly 
moves to 100%.

B) for v2.7.2 version:

1) start server:

cat s.py 
#!/usr/bin/python

from SimpleXMLRPCServer import SimpleXMLRPCServer

server = SimpleXMLRPCServer(('127.0.0.1', 12345))
server.serve_forever()

Steps 2) and 3) for v2.7.2 version are identical to
those for v3.2.2 version.

--
components: Library (Lib)
messages: 153267
nosy: iankko
priority: normal
severity: normal
status: open
title: Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) 
by processing malformed XMLRPC / HTTP POST request
type: security
versions: Python 2.7, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-13 Thread Ralf Schmitt

Changes by Ralf Schmitt python-b...@systemexit.de:


--
nosy: +schmir

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-13 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti, loewis
stage:  - needs patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-13 Thread Jan Lieskovsky

Jan Lieskovsky ian...@seznam.cz added the comment:

CVE request:
[2] http://www.openwall.com/lists/oss-security/2012/02/13/3

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-13 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
components: +XML
nosy: +flox
versions: +Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-13 Thread Ross Lagerwall

Changes by Ross Lagerwall rosslagerw...@gmail.com:


--
nosy: +rosslagerwall

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-13 Thread Dave Malcolm

Changes by Dave Malcolm dmalc...@redhat.com:


--
nosy: +dmalcolm

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-13 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

SimpleXMLRPCRequestHandler.do_POST() is simply looping on EOF.
The patch attached fixes this (the server doesn't seem to generate an error in 
response to this partial request though).

--
keywords: +patch
nosy: +neologix
Added file: http://bugs.python.org/file24513/xmlrpc_loop.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14001] Python v2.7.2 / v3.2.2 (SimpleXMLRPCServer): DoS (excessive CPU usage) by processing malformed XMLRPC / HTTP POST request

2012-02-13 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14001
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Google Chart API, HTTP POST request format.

2011-01-06 Thread Chris Rebert
On Wed, Jan 5, 2011 at 11:21 PM, Garland Fulton stacks...@gmail.com wrote:
 On Wed, Jan 5, 2011 at 7:26 PM, Tim Harig user...@ilthio.net wrote:

 On 2011-01-06, Slie stacks...@gmail.com wrote:
 [reformated to 80 columns per RFC 1855 guidelines]
  I have read several examples on python post requests but I'm not sure
  mine needs to be that complicated.

 From the HTML example on the page you posted:

    form action='https://chart.googleapis.com/chart' method='POST'
        input type=hidden name=cht value=lc  /
        input type=hidden name=chtt value=This is | my chart  /
        input type='hidden' name='chs' value='600x200' /
        input type=hidden name=chxt value=x,y /
        input type='hidden' name='chd' value='t:40,20,50,20,100'/
        input type=submit  /
    /form

 you can retreive the same chart from Python:

    Python 3.1.2 (r312:79147, Oct  9 2010, 00:16:06)
    [GCC 4.4.4] on linux2
    Type help, copyright, credits or license for more information.
     import urllib.request, urllib.parse
     params = urllib.parse.urlencode({'cht':'lc', 'chtt':'This is | my
     chart',
    ...         'chs':'600x200', 'chxt':'x,y', 'chd':'t:40,20,50,20,100'})
     chart =
 urllib.request.urlopen('https://chart.googleapis.com/chart',
    ...         data = params).read()
     chartFile = open(chart.png, 'wb')
     chartFile.write(chart)
    10782
     chartFile.close()
 --
 http://mail.python.org/mailman/listinfo/python-list

 Hope this isn't to stupid,
 For the
 chart = urllib.request.urlopen('https://chart.googleapis.com/chart', data =
 params).read()
 Where would I find information on why and what the ).read() part does.

http://docs.python.org/py3k/library/urllib.request.html#urllib.request.urlopen
Specifically: This function returns a file-like object (representing
the stream of data received). Thus, .read() on the file-like object
returns the actual bytes obtained from the given URL.

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Google Chart API, HTTP POST request format.

2011-01-06 Thread Tim Harig
On 2011-01-06, Chris Rebert c...@rebertia.com wrote:
 On Wed, Jan 5, 2011 at 11:21 PM, Garland Fulton stacks...@gmail.com wrote:
 On Wed, Jan 5, 2011 at 7:26 PM, Tim Harig user...@ilthio.net wrote:
    Python 3.1.2 (r312:79147, Oct  9 2010, 00:16:06)
    [GCC 4.4.4] on linux2
    Type help, copyright, credits or license for more information.
     import urllib.request, urllib.parse
     params = urllib.parse.urlencode({'cht':'lc', 'chtt':'This is | my
     chart',

Sorry I didn't notice this got accidently wrapped when I pasted it.
 params = urllib.parse.urlencode({'cht':'lc', 'chtt':'This is | my 
chart',

    ...         'chs':'600x200', 'chxt':'x,y', 'chd':'t:40,20,50,20,100'})
     chart =
 urllib.request.urlopen('https://chart.googleapis.com/chart',
    ...         data = params).read()
     chartFile = open(chart.png, 'wb')
     chartFile.write(chart)
    10782
     chartFile.close()

 Hope this isn't to stupid,
 For the
 chart = urllib.request.urlopen('https://chart.googleapis.com/chart', data =
 params).read()
 Where would I find information on why and what the ).read() part does.

For some reason, posts from from this account don't seem to be making it
through the gateway to usenet so I am only seeing what Mr. Rebert has
replied to.  If you have asked anything else, I very well may have missed
it.

 http://docs.python.org/py3k/library/urllib.request.html#urllib.request.urlopen
 Specifically: This function returns a file-like object (representing
 the stream of data received). Thus, .read() on the file-like object
 returns the actual bytes obtained from the given URL.

Mr. Rebert already answed your question; but, I will expand on that a
little bit.  One of the great things about the Python language is that it
uses what is commonly known as duck typing.  That is anything object which
provides the same attributes as another object can be used as though it is
actually the second object.  It is kind of like an implicit form of
generics that doesn't require a template or an interface.

The Python standard library makes extensive use of duck typing for file
like objects.  Any object that provides the proper method attributes can be
given to functions that expect files even though the object is given might
not be the traditional concept of a file on the filesystem.  It might be a
stringIO object, a socket file object, or something new that you have
created that supports the required method attributes.

The semantics and documentation for file like objects have changed a
little for python2 vs. python3:

python2: http://docs.python.org/library/stdtypes.html#file-objects
python3: http://docs.python.org/py3k/library/io.html#io.IOBase

but they still basically work the same way.  Much of the Python 3
documentation still refers file objects.
-- 
http://mail.python.org/mailman/listinfo/python-list


Google Chart API, HTTP POST request format.

2011-01-05 Thread Slie

http://code.google.com/apis/chart/docs/post_requests.html

Google will return a chart in your browser from a URL that you have built. If 
your URL is bigger then 2K characters it will allow you to submit POST requests.

They gives examples of HTML, JavaScript, and PHP POST requests. Is there a way 
I can submit a request with Python? Or possibly submit the HTML, JavaScript or 
PHP using python?(That was a long shot thought). If I do that I would need to 
find out what to do with the .PNG it gives me.

Am I headed in the right direction, is the above paragraph about submitting an 
HTML form from my program even logical?

I have read several examples on python post requests but I'm not sure mine 
needs to be that complicated.


Thank You,
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Google Chart API, HTTP POST request format.

2011-01-05 Thread Tim Harig
On 2011-01-06, Slie stacks...@gmail.com wrote:
[reformated to 80 columns per RFC 1855 guidelines]
 I have read several examples on python post requests but I'm not sure
 mine needs to be that complicated.

From the HTML example on the page you posted:

form action='https://chart.googleapis.com/chart' method='POST'
input type=hidden name=cht value=lc  /
input type=hidden name=chtt value=This is | my chart  /
input type='hidden' name='chs' value='600x200' /
input type=hidden name=chxt value=x,y /
input type='hidden' name='chd' value='t:40,20,50,20,100'/
input type=submit  /
/form

you can retreive the same chart from Python:

Python 3.1.2 (r312:79147, Oct  9 2010, 00:16:06)
[GCC 4.4.4] on linux2
Type help, copyright, credits or license for more information.
 import urllib.request, urllib.parse
 params = urllib.parse.urlencode({'cht':'lc', 'chtt':'This is | my
 chart',
... 'chs':'600x200', 'chxt':'x,y', 'chd':'t:40,20,50,20,100'})
 chart = urllib.request.urlopen('https://chart.googleapis.com/chart',
... data = params).read()
 chartFile = open(chart.png, 'wb')
 chartFile.write(chart)
10782
 chartFile.close()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Google Chart API, HTTP POST request format.

2011-01-05 Thread Chris Rebert
On Wed, Jan 5, 2011 at 7:36 PM, Slie stacks...@gmail.com wrote:

 http://code.google.com/apis/chart/docs/post_requests.html

 Google will return a chart in your browser from a URL that you have built. If 
 your URL is bigger then 2K characters it will allow you to submit POST 
 requests.

 They gives examples of HTML, JavaScript, and PHP POST requests. Is there a 
 way I can submit a request with Python? Or possibly submit the HTML, 
 JavaScript or PHP using python?(That was a long shot thought). If I do that I 
 would need to find out what to do with the .PNG it gives me.

 Am I headed in the right direction, is the above paragraph about submitting 
 an HTML form from my program even logical?

You should probably first try one of the existing Python wrappers for
Google's chart API and see if that meets your needs:
http://code.google.com/p/google-chartwrapper/
http://pygooglechart.slowchop.com/

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Google Chart API, HTTP POST request format.

2011-01-05 Thread Garland Fulton
I tried to use pygooglechart.py and I have been trying to get it set up
all day actually along with several other graphing API's.

I just found out that there is a problem with numpy and python 3.1 that is
why I moved from the API's. Should I change version just for
these library's?

Should I be learning Python on 3.1?

Awesome!


On Wed, Jan 5, 2011 at 7:52 PM, Chris Rebert c...@rebertia.com wrote:

 On Wed, Jan 5, 2011 at 7:36 PM, Slie stacks...@gmail.com wrote:
 
  http://code.google.com/apis/chart/docs/post_requests.html
 
  Google will return a chart in your browser from a URL that you have
 built. If your URL is bigger then 2K characters it will allow you to submit
 POST requests.
 
  They gives examples of HTML, JavaScript, and PHP POST requests. Is there
 a way I can submit a request with Python? Or possibly submit the HTML,
 JavaScript or PHP using python?(That was a long shot thought). If I do that
 I would need to find out what to do with the .PNG it gives me.
 
  Am I headed in the right direction, is the above paragraph about
 submitting an HTML form from my program even logical?

 You should probably first try one of the existing Python wrappers for
 Google's chart API and see if that meets your needs:
 http://code.google.com/p/google-chartwrapper/
 http://pygooglechart.slowchop.com/

 Cheers,
 Chris
 --
 http://blog.rebertia.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Google Chart API, HTTP POST request format.

2011-01-05 Thread Garland Fulton
Thank you for showing me the POST request, I will defiantly learn a lot from
that.

On Wed, Jan 5, 2011 at 7:26 PM, Tim Harig user...@ilthio.net wrote:

 On 2011-01-06, Slie stacks...@gmail.com wrote:
 [reformated to 80 columns per RFC 1855 guidelines]
  I have read several examples on python post requests but I'm not sure
  mine needs to be that complicated.

 From the HTML example on the page you posted:

form action='https://chart.googleapis.com/chart' method='POST'
input type=hidden name=cht value=lc  /
input type=hidden name=chtt value=This is | my chart  /
input type='hidden' name='chs' value='600x200' /
input type=hidden name=chxt value=x,y /
input type='hidden' name='chd' value='t:40,20,50,20,100'/
input type=submit  /
/form

 you can retreive the same chart from Python:

Python 3.1.2 (r312:79147, Oct  9 2010, 00:16:06)
[GCC 4.4.4] on linux2
Type help, copyright, credits or license for more information.
 import urllib.request, urllib.parse
 params = urllib.parse.urlencode({'cht':'lc', 'chtt':'This is | my
 chart',
... 'chs':'600x200', 'chxt':'x,y', 'chd':'t:40,20,50,20,100'})
 chart = urllib.request.urlopen('https://chart.googleapis.com/chart
 ',
... data = params).read()
 chartFile = open(chart.png, 'wb')
 chartFile.write(chart)
10782
 chartFile.close()
 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Google Chart API, HTTP POST request format.

2011-01-05 Thread Corey Richardson
On 01/06/2011 12:16 AM, Garland Fulton wrote:
 I tried to use pygooglechart.py and I have been trying to get it set
 up all day actually along with several other graphing API's.
 
 I just found out that there is a problem with numpy and python 3.1 that
 is why I moved from the API's. Should I change version just for
 these library's?
 
 Should I be learning Python on 3.1?
 
 Awesome!
 
 [snip]

I swapped from 3 to 2.6 a while back, better support for modules, and
not really losing much in the way of features.

~Corey Richardson

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Google Chart API, HTTP POST request format.

2011-01-05 Thread Chris Rebert
 On Wed, Jan 5, 2011 at 7:52 PM, Chris Rebert c...@rebertia.com wrote:
 On Wed, Jan 5, 2011 at 7:36 PM, Slie stacks...@gmail.com wrote:
 
  http://code.google.com/apis/chart/docs/post_requests.html
 
  Google will return a chart in your browser from a URL that you have
  built. If your URL is bigger then 2K characters it will allow you to submit
  POST requests.
 
  They gives examples of HTML, JavaScript, and PHP POST requests. Is there
  a way I can submit a request with Python? Or possibly submit the HTML,
  JavaScript or PHP using python?(That was a long shot thought). If I do that
  I would need to find out what to do with the .PNG it gives me.
 
  Am I headed in the right direction, is the above paragraph about
  submitting an HTML form from my program even logical?

 You should probably first try one of the existing Python wrappers for
 Google's chart API and see if that meets your needs:
 http://code.google.com/p/google-chartwrapper/
 http://pygooglechart.slowchop.com/

On Wed, Jan 5, 2011 at 9:16 PM, Garland Fulton stacks...@gmail.com wrote:
 I tried to use pygooglechart.py and I have been trying to get it set up
 all day actually along with several other graphing API's.
 I just found out that there is a problem with numpy and python 3.1 that is
 why I moved from the API's. Should I change version just for
 these library's?
 Should I be learning Python on 3.1?

Most third-party libraries have yet to be ported to Python 3.1 (with a
few notable exceptions). If you actually want to write
non-(toy/demo/trivial) programs, you should probably use Python 2.x.
Python 3.1 is fine for learning the basics of the language; once
you've done that, learning the Python 2.x differences and wart
workarounds is not hard.

(Also, in the future, please don't top-post.)

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Google Chart API, HTTP POST request format.

2011-01-05 Thread Garland Fulton
On Wed, Jan 5, 2011 at 7:52 PM, Chris Rebert c...@rebertia.com wrote:

 On Wed, Jan 5, 2011 at 7:36 PM, Slie stacks...@gmail.com wrote:
 
  http://code.google.com/apis/chart/docs/post_requests.html
 
  Google will return a chart in your browser from a URL that you have
 built. If your URL is bigger then 2K characters it will allow you to submit
 POST requests.
 
  They gives examples of HTML, JavaScript, and PHP POST requests. Is there
 a way I can submit a request with Python? Or possibly submit the HTML,
 JavaScript or PHP using python?(That was a long shot thought). If I do that
 I would need to find out what to do with the .PNG it gives me.
 
  Am I headed in the right direction, is the above paragraph about
 submitting an HTML form from my program even logical?

 You should probably first try one of the existing Python wrappers for
 Google's chart API and see if that meets your needs:
 http://code.google.com/p/google-chartwrapper/
 http://pygooglechart.slowchop.com/

 Cheers,
 Chris
 --
 http://blog.rebertia.com

Google Chart Wrapper is compatible with 3.1 and i have been looking all day
for something like this. Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Google Chart API, HTTP POST request format.

2011-01-05 Thread Garland Fulton
On Wed, Jan 5, 2011 at 7:26 PM, Tim Harig user...@ilthio.net wrote:

 On 2011-01-06, Slie stacks...@gmail.com wrote:
 [reformated to 80 columns per RFC 1855 guidelines]
  I have read several examples on python post requests but I'm not sure
  mine needs to be that complicated.

 From the HTML example on the page you posted:

form action='https://chart.googleapis.com/chart' method='POST'
input type=hidden name=cht value=lc  /
input type=hidden name=chtt value=This is | my chart  /
input type='hidden' name='chs' value='600x200' /
input type=hidden name=chxt value=x,y /
input type='hidden' name='chd' value='t:40,20,50,20,100'/
input type=submit  /
/form

 you can retreive the same chart from Python:

Python 3.1.2 (r312:79147, Oct  9 2010, 00:16:06)
[GCC 4.4.4] on linux2
Type help, copyright, credits or license for more information.
 import urllib.request, urllib.parse
 params = urllib.parse.urlencode({'cht':'lc', 'chtt':'This is | my
 chart',
... 'chs':'600x200', 'chxt':'x,y', 'chd':'t:40,20,50,20,100'})
 chart = urllib.request.urlopen('https://chart.googleapis.com/chart
 ',
... data = params).read()
 chartFile = open(chart.png, 'wb')
 chartFile.write(chart)
10782
 chartFile.close()
 --
 http://mail.python.org/mailman/listinfo/python-list


Hope this isn't to stupid,

For the
chart = urllib.request.urlopen('https://chart.googleapis.com/chart', data =
params).read()

Where would I find information on why and what the ).read() part does.

Thank you,
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: HTTP Post Request

2010-05-12 Thread kak...@gmail.com
On May 12, 6:13 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com
wrote:
 On Tue, May 11, 2010 at 3:59 PM, kak...@gmail.com kak...@gmail.com wrote:
  On May 11, 10:56 am, kak...@gmail.com kak...@gmail.com wrote:
  On May 11, 5:06 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com
  wrote:

   On Mon, May 10, 2010 at 8:26 PM, kak...@gmail.com kak...@gmail.com 
   wrote:
On May 10, 10:22 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com
wrote:
On Mon, May 10, 2010 at 7:30 PM, kak...@gmail.com kak...@gmail.com 
wrote:
 Hi to all, i want to ask you a question, concerning the best way to 
 do
 the following as a POST request:
 There is server-servlet that accepts xml commands
 It had the following HTTP request headers:

            Host: somehost.com
            User-Agent: Jakarta Commons-HttpClient
            Content-Type: text/xml
            Content-Length: 415

 and the following request body (reformatted here for clarity):

            ?xml version='1.0'?
            methodCall
              methodNamesearch/methodName
            /methodCall
 How can i send the above to the Listener Servlet?
 Thanks in advance

Use the xmlrpclib module.

OK, sending headers with xmlrpclib,
but how do i send the XML message?

   Your XML message is an XML RPC message.  You will use xmlrpclib like 
   this:

   server_proxy = xmlrpclib.ServerProxy(('somehost.com', 80))
   result = server_proxy.search()

   The call to server_proxy.search will result in an actual XML RPC
   message being sent.

   Read up on the xmlrpclib documentation 
   here:http://docs.python.org/library/xmlrpclib.html, and the XMLRPC spec
   here:http://www.xmlrpc.com/spec

  Ok I got it!
  Thank you!!!

  A.K

  Apparently the server i'm trying to connect accepts only POST
  connections. So xmlrpclib is useless.
  I think I need the httplib library module.

  Any hints?

 I don't understand.  xmlrpclib sends POST requests only.  Are you
 getting an exception?  If so, please post the entire stack trace.

 If you want to send the data by hand, use the httplib module.  you
 can pass your XML to the HTTPConnection.request method as the body
 argument.

 --
 regards,
 kushal

Ok i found it. I sent the xml by hand with httplib module.
i use the last example of http://docs.python.org/library/httplib.html
and it worked.
Thank you very much for your response.

A.K.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: HTTP Post Request

2010-05-11 Thread kak...@gmail.com
On May 11, 5:06 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com
wrote:
 On Mon, May 10, 2010 at 8:26 PM, kak...@gmail.com kak...@gmail.com wrote:
  On May 10, 10:22 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com
  wrote:
  On Mon, May 10, 2010 at 7:30 PM, kak...@gmail.com kak...@gmail.com wrote:
   Hi to all, i want to ask you a question, concerning the best way to do
   the following as a POST request:
   There is server-servlet that accepts xml commands
   It had the following HTTP request headers:

              Host: somehost.com
              User-Agent: Jakarta Commons-HttpClient
              Content-Type: text/xml
              Content-Length: 415

   and the following request body (reformatted here for clarity):

              ?xml version='1.0'?
              methodCall
                methodNamesearch/methodName
              /methodCall
   How can i send the above to the Listener Servlet?
   Thanks in advance

  Use the xmlrpclib module.

  OK, sending headers with xmlrpclib,
  but how do i send the XML message?

 Your XML message is an XML RPC message.  You will use xmlrpclib like this:

 server_proxy = xmlrpclib.ServerProxy(('somehost.com', 80))
 result = server_proxy.search()

 The call to server_proxy.search will result in an actual XML RPC
 message being sent.

 Read up on the xmlrpclib documentation 
 here:http://docs.python.org/library/xmlrpclib.html, and the XMLRPC spec
 here:http://www.xmlrpc.com/spec

 --
 regards,
 kushal

Ok I got it!
Thank you!!!

A.K
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: HTTP Post Request

2010-05-11 Thread kak...@gmail.com
On May 11, 10:56 am, kak...@gmail.com kak...@gmail.com wrote:
 On May 11, 5:06 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com
 wrote:



  On Mon, May 10, 2010 at 8:26 PM, kak...@gmail.com kak...@gmail.com wrote:
   On May 10, 10:22 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com
   wrote:
   On Mon, May 10, 2010 at 7:30 PM, kak...@gmail.com kak...@gmail.com 
   wrote:
Hi to all, i want to ask you a question, concerning the best way to do
the following as a POST request:
There is server-servlet that accepts xml commands
It had the following HTTP request headers:

           Host: somehost.com
           User-Agent: Jakarta Commons-HttpClient
           Content-Type: text/xml
           Content-Length: 415

and the following request body (reformatted here for clarity):

           ?xml version='1.0'?
           methodCall
             methodNamesearch/methodName
           /methodCall
How can i send the above to the Listener Servlet?
Thanks in advance

   Use the xmlrpclib module.

   OK, sending headers with xmlrpclib,
   but how do i send the XML message?

  Your XML message is an XML RPC message.  You will use xmlrpclib like this:

  server_proxy = xmlrpclib.ServerProxy(('somehost.com', 80))
  result = server_proxy.search()

  The call to server_proxy.search will result in an actual XML RPC
  message being sent.

  Read up on the xmlrpclib documentation 
  here:http://docs.python.org/library/xmlrpclib.html, and the XMLRPC spec
  here:http://www.xmlrpc.com/spec

  --
  regards,
  kushal

 Ok I got it!
 Thank you!!!

 A.K

Apparently the server i'm trying to connect accepts only POST
connections. So xmlrpclib is useless.
I think I need the httplib library module.

Any hints?

A.K.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: HTTP Post Request

2010-05-11 Thread Kushal Kumaran
On Tue, May 11, 2010 at 3:59 PM, kak...@gmail.com kak...@gmail.com wrote:
 On May 11, 10:56 am, kak...@gmail.com kak...@gmail.com wrote:
 On May 11, 5:06 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com
 wrote:



  On Mon, May 10, 2010 at 8:26 PM, kak...@gmail.com kak...@gmail.com wrote:
   On May 10, 10:22 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com
   wrote:
   On Mon, May 10, 2010 at 7:30 PM, kak...@gmail.com kak...@gmail.com 
   wrote:
Hi to all, i want to ask you a question, concerning the best way to do
the following as a POST request:
There is server-servlet that accepts xml commands
It had the following HTTP request headers:

           Host: somehost.com
           User-Agent: Jakarta Commons-HttpClient
           Content-Type: text/xml
           Content-Length: 415

and the following request body (reformatted here for clarity):

           ?xml version='1.0'?
           methodCall
             methodNamesearch/methodName
           /methodCall
How can i send the above to the Listener Servlet?
Thanks in advance

   Use the xmlrpclib module.

   OK, sending headers with xmlrpclib,
   but how do i send the XML message?

  Your XML message is an XML RPC message.  You will use xmlrpclib like this:

  server_proxy = xmlrpclib.ServerProxy(('somehost.com', 80))
  result = server_proxy.search()

  The call to server_proxy.search will result in an actual XML RPC
  message being sent.

  Read up on the xmlrpclib documentation 
  here:http://docs.python.org/library/xmlrpclib.html, and the XMLRPC spec
  here:http://www.xmlrpc.com/spec


 Ok I got it!
 Thank you!!!

 A.K

 Apparently the server i'm trying to connect accepts only POST
 connections. So xmlrpclib is useless.
 I think I need the httplib library module.

 Any hints?


I don't understand.  xmlrpclib sends POST requests only.  Are you
getting an exception?  If so, please post the entire stack trace.

If you want to send the data by hand, use the httplib module.  you
can pass your XML to the HTTPConnection.request method as the body
argument.

-- 
regards,
kushal
-- 
http://mail.python.org/mailman/listinfo/python-list


HTTP Post Request

2010-05-10 Thread kak...@gmail.com
Hi to all, i want to ask you a question, concerning the best way to do
the following as a POST request:
There is server-servlet that accepts xml commands
It had the following HTTP request headers:

Host: somehost.com
User-Agent: Jakarta Commons-HttpClient
Content-Type: text/xml
Content-Length: 415

and the following request body (reformatted here for clarity):

?xml version='1.0'?
methodCall
  methodNamesearch/methodName
/methodCall
How can i send the above to the Listener Servlet?
Thanks in advance
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: HTTP Post Request

2010-05-10 Thread Kushal Kumaran
On Mon, May 10, 2010 at 7:30 PM, kak...@gmail.com kak...@gmail.com wrote:
 Hi to all, i want to ask you a question, concerning the best way to do
 the following as a POST request:
 There is server-servlet that accepts xml commands
 It had the following HTTP request headers:

            Host: somehost.com
            User-Agent: Jakarta Commons-HttpClient
            Content-Type: text/xml
            Content-Length: 415

 and the following request body (reformatted here for clarity):

            ?xml version='1.0'?
            methodCall
              methodNamesearch/methodName
            /methodCall
 How can i send the above to the Listener Servlet?
 Thanks in advance

Use the xmlrpclib module.

-- 
regards,
kushal
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: HTTP Post Request

2010-05-10 Thread kak...@gmail.com
On May 10, 10:22 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com
wrote:
 On Mon, May 10, 2010 at 7:30 PM, kak...@gmail.com kak...@gmail.com wrote:
  Hi to all, i want to ask you a question, concerning the best way to do
  the following as a POST request:
  There is server-servlet that accepts xml commands
  It had the following HTTP request headers:

             Host: somehost.com
             User-Agent: Jakarta Commons-HttpClient
             Content-Type: text/xml
             Content-Length: 415

  and the following request body (reformatted here for clarity):

             ?xml version='1.0'?
             methodCall
               methodNamesearch/methodName
             /methodCall
  How can i send the above to the Listener Servlet?
  Thanks in advance

 Use the xmlrpclib module.

 --
 regards,
 kushal

OK, sending headers with xmlrpclib,
but how do i send the XML message?

Thanks
A.K.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: HTTP Post Request

2010-05-10 Thread Kushal Kumaran
On Mon, May 10, 2010 at 8:26 PM, kak...@gmail.com kak...@gmail.com wrote:
 On May 10, 10:22 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com
 wrote:
 On Mon, May 10, 2010 at 7:30 PM, kak...@gmail.com kak...@gmail.com wrote:
  Hi to all, i want to ask you a question, concerning the best way to do
  the following as a POST request:
  There is server-servlet that accepts xml commands
  It had the following HTTP request headers:

             Host: somehost.com
             User-Agent: Jakarta Commons-HttpClient
             Content-Type: text/xml
             Content-Length: 415

  and the following request body (reformatted here for clarity):

             ?xml version='1.0'?
             methodCall
               methodNamesearch/methodName
             /methodCall
  How can i send the above to the Listener Servlet?
  Thanks in advance

 Use the xmlrpclib module.


 OK, sending headers with xmlrpclib,
 but how do i send the XML message?


Your XML message is an XML RPC message.  You will use xmlrpclib like this:

server_proxy = xmlrpclib.ServerProxy(('somehost.com', 80))
result = server_proxy.search()

The call to server_proxy.search will result in an actual XML RPC
message being sent.

Read up on the xmlrpclib documentation here:
http://docs.python.org/library/xmlrpclib.html, and the XMLRPC spec
here: http://www.xmlrpc.com/spec

-- 
regards,
kushal
-- 
http://mail.python.org/mailman/listinfo/python-list