Re: ResponseNotReady exception

2009-01-06 Thread vk
http://www.python.org/phpvuln.txt

Error 404: File Not Found
The URL you requested was not found on this server.
--
http://mail.python.org/mailman/listinfo/python-list


ResponseNotReady exception

2009-01-03 Thread asit
import httplib

class Server:
#server class
def __init__(self, host):
self.host = host
def fetch(self, path):
http = httplib.HTTPConnection(self.host)
http.putrequest(GET, path)
r = http.getresponse()
print str(r.status) +   :   + r.reason


server = Server(www.python.org)
fp=open(phpvuln.txt)
x=fp.readlines();
for y in x:
 server.fetch(/ + y);

In the above code the phpvuln.txt file contains a list of directories.

Why the above code throws ResponseNotReady exception ???

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


Re: ResponseNotReady exception

2009-01-03 Thread Chris Rebert
On Sat, Jan 3, 2009 at 12:38 PM, asit lipu...@gmail.com wrote:
 import httplib

 class Server:
#server class
def __init__(self, host):
self.host = host
def fetch(self, path):
http = httplib.HTTPConnection(self.host)
http.putrequest(GET, path)

According to the docs, if you use .putrequest(), you have to also then
call .putheader() [as many times as necessary], .endheaders(), and
.send(), in that order. I'd advise just changing .putrequest() to
.request() instead.

And you should also read the fine docs yourself:
http://docs.python.org/library/httplib.html

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: ResponseNotReady exception

2009-01-03 Thread asit
On Jan 4, 1:59 am, Chris Rebert c...@rebertia.com wrote:
 On Sat, Jan 3, 2009 at 12:38 PM, asit lipu...@gmail.com wrote:
  import httplib

  class Server:
     #server class
     def __init__(self, host):
         self.host = host
     def fetch(self, path):
         http = httplib.HTTPConnection(self.host)
         http.putrequest(GET, path)

 According to the docs, if you use .putrequest(), you have to also then
 call .putheader() [as many times as necessary], .endheaders(), and
 .send(), in that order. I'd advise just changing .putrequest() to
 .request() instead.

 And you should also read the fine docs 
 yourself:http://docs.python.org/library/httplib.html

 Cheers,
 Chris

 --
 Follow the path of the Iguana...http://rebertia.com

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