Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updates the copy of pyscgi to 1.16.1

  • Loading branch information...
commit e75f53b5d0dfc6b85633ee0492cb4d7f4d81da7d 1 parent a767e5c
@alobbs alobbs authored
Showing with 10 additions and 7 deletions.
  1. +10 −7 CTK/pyscgi.py
View
17 CTK/pyscgi.py
@@ -43,7 +43,7 @@
import sys
import os
-__version__ = '1.16'
+__version__ = '1.16.1'
__author__ = 'Alvaro Lopez Ortega'
__copyright__ = 'Copyright 2011, Alvaro Lopez Ortega'
__license__ = 'BSD'
@@ -199,19 +199,21 @@ def server_bind (self):
return SocketServer.TCPServer.server_bind (self)
def server_bind_multifamily (self):
- s = None
+ # Loop over the different addresses of 'host'
host, port = self.server_address
+ addresses = socket.getaddrinfo (host, port, socket.AF_UNSPEC,
+ socket.SOCK_STREAM, 0, socket.AI_PASSIVE)
- # Loop over the different options of 'host'
- for res in socket.getaddrinfo (host, port, socket.AF_UNSPEC,
- socket.SOCK_STREAM, 0, socket.AI_PASSIVE):
- s = None
+ # Find a suitable address
+ s = None
+ for res in addresses:
af, socktype, protocol, canonicalname, sa = res
# Create socket
try:
s = socket.socket (af, socktype, protocol)
except socket.error:
+ s = None
continue
# Bind
@@ -221,12 +223,13 @@ def server_bind_multifamily (self):
s.bind(sa)
except socket.error:
s.close()
+ s = None
continue
break
# If none successfully bind report error
- if s is None:
+ if not s:
raise socket.error, "Could not create server socket"
self.socket = s
Please sign in to comment.
Something went wrong with that request. Please try again.