FAQ
Responding to an old thread.

Another workaround to the IIS / SSL bug
http://sourceforge.net/tracker/?group_idT70&atid5470&funcÞtail&aidI4762

Using the MixIn class from Webware under Windows:
Python 2.2.1 (#34, Apr 9 2002, 19:34:33) [MSC 32 bit (Intel)] on win32

Call the following before any SSL calls:

import httplib
import socket
from MiscUtils.MixIn import MixIn
from cStringIO import StringIO

class FakeSocketIISFix:
def makefile(self, mode, bufsize=None):
"""Return a readable file-like object with data from socket.

This method offers only partial support for the makefile
interface of a real socket. It only supports modes 'r' and
'rb' and the bufsize argument is ignored.

The returned object contains *all* of the file data
With IIS EOF Fix - ADH
"""
if mode != 'r' and mode != 'rb':
raise UnimplementedFileMode()

msgbuf = []
while 1:
try:
buf = self._FakeSocket__ssl.read()
except socket.sslerror, err:
if err[0] == 5 :
#quickbase workaround
break
if (err[0] == socket.SSL_ERROR_WANT_READ
or err[0] == socket.SSL_ERROR_WANT_WRITE
or 0):
continue
if err[0] == socket.SSL_ERROR_ZERO_RETURN:
break
raise
except socket.error, err:
if err[0] == errno.EINTR:
continue
raise
if buf == '':
break
msgbuf.append(buf)
return StringIO("".join(msgbuf))

MixIn(httplib.FakeSocket,FakeSocketIISFix)


-Aaron

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedNov 25, '02 at 8:02p
activeNov 25, '02 at 8:02p
posts1
users1
websitepython.org

1 user in discussion

Aaron Held: 1 post

People

Translate

site design / logo © 2023 Grokbase