SSL Sockets in Windows
gh_pythonlist at gmx.de
Sat Dec 29 17:05:26 CET 2001
Le 29/12/01 à 16:03, Syver Enstad écrivit:
> Gerhard Häring <gh_pythonlist at gmx.de> writes:
> > Le 28/12/01 à 07:18, Syver Enstad écrivit:
> > >
> > > Hi Al, I'm not exactly an expert on SSL :-). I know it's what goes
> > on
> > > behind the scenes when my browser uses an https url and
> > communication
> > > is encrypted and whatnot.
> > >
> > > Do you have (or can you refer me to) a quick
> > > example to check that SSL is indeed working on Python?
> > You can check pretty easily if your Python is compiled with SSL
> > support:
> > 'ssl' in dir(socket)
> Yes, returns true (1)
> > If so, you should be able to fetch a HTML page with the urllib module:
> > print urllib.urlopen("https://www.sf.net/").read()
> Yes, this fetches the front page of sourceforge, which says that I'm
> not logged in.
> What would happen if I didn't have SSL installed.
'ssl' in dir(socket) will return 0, because the entire SSL stuff in
socketmodule.c is #ifdef'd out.
print urllib.urlopen("https://www.sf.net/").read() raises
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.1/urllib.py", line 71, in urlopen
File "/usr/lib/python2.1/urllib.py", line 173, in open
return self.open_unknown(fullurl, data)
File "/usr/lib/python2.1/urllib.py", line 185, in
raise IOError, ('url error', 'unknown url type', type)
IOError: [Errno url error] unknown url type: 'https'
> You see I compiled up a new version of _socket.pyd with VC++ 6 and
> this time I specified that SSL shouldn't be compiled in. 'ssl' in
> dir(socket) still returns true, and the download goes without a
> hitch too. I haven't checked with a packet sniffer though.
You seem to still have SSL compiled in. Be sure to replace your
_socket.pyd with the one without SSL. Using "python -v" helps tracking
down which module really is loaded.
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
More information about the Python-list