bug in M2Crypto.urllib2 ..
Michal Wallace
sabren at manifestation.com
Fri Jul 28 09:28:53 EDT 2000
Hey all,
I've been using the excellent M2Crypto package for its HTTPS
support, and I've discovered a small bug that I'm trying to
track down.
When I hit my own HTTPS pages, everything works just fine. But
when I send a request to another particular server, I'm unable
to read from the url, even though data IS being sent. Here's my
code:
#######################
import M2Crypto.urllib2
import urllib
url = "https://secure.authorize.net/gateway/transact.dll"
page = M2Crypto.urllib2.urlopen(url)
print page.headers
print "-" * 50
while 1:
line = page.readline()
if not line: break
print line
print "-" * 50
######################
Which produces:
Server: Microsoft-IIS/4.0
Date: Fri, 28 Jul 2000 13:17:48 GMT
Content-Type: text/html
Content-Length: 42
Content:
--------------------------------------------------
--------------------------------------------------
If I try page.read(), that doesn't work either...
However, if I step through with the debugger,
I see:
"Invalid Merchant Login or Account Inactive"
.. 42 characters, which is what I want.
To prove it, I added the following debug code
to M2Crypto.httpslib:
def getreply(self):
rep = httplib.HTTP.getreply(self)
while 1:
line = self.file.readline()
print "::", line
if not line: break
return rep
and now I get:
:: Invalid Merchant Login or Account Inactive
::
Server: Microsoft-IIS/4.0
Date: Fri, 28 Jul 2000 13:26:20 GMT
Content-Type: text/html
Content-Length: 42
Content:
--------------------------------------------------
--------------------------------------------------
I've been at this for a couple hours now, and my brain is fried, so
maybe I'm missing something obvious here.. I'm going to try again in a
little while to narrow it down some more, but first I thought I'd ask
if anyone else had run into this problem and had a workaround or a
patch...?
Cheers,
- Michal
------------------------------------------------------------------------
www.manifestation.com www.sabren.com www.linkwatcher.com www.zike.net
------------------------------------------------------------------------
More information about the Python-list
mailing list