Skip to content

Commit

Permalink
1.7.1dev: merge [17782] from 1.6-stable (fix for #13563)
Browse files Browse the repository at this point in the history
git-svn-id: http://trac.edgewall.org/intertrac/log:/trunk@17783 af82e41b-90c4-0310-8c96-b1721e28e2e2
  • Loading branch information
jomae committed Apr 29, 2024
2 parents 7181ba4 + 731da29 commit 15071ff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
23 changes: 13 additions & 10 deletions trac/web/standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,19 @@ def serve():
print("[Errno %s] %s" % e.args)
sys.exit(1)

print("Server starting in PID %s." % os.getpid())
print("Serving on %s" % loc)
if args.http11:
print("Using HTTP/1.1 protocol version")
if args.protocol == 'https':
httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True,
certfile=args.certfile,
keyfile=args.keyfile)
httpd.environ['HTTPS'] = 'yes'
httpd.serve_forever()
with httpd:
print("Server starting in PID %s." % os.getpid())
print("Serving on %s" % loc)
if args.http11:
print("Using HTTP/1.1 protocol version")
if args.protocol == 'https':
httpd.socket = ssl.wrap_socket(httpd.socket,
server_side=True,
certfile=args.certfile,
keyfile=args.keyfile)
httpd.environ['HTTPS'] = 'yes'
httpd.serve_forever()

elif args.protocol in ('scgi', 'ajp', 'fcgi'):
def serve():
module = 'flup.server.%s' % args.protocol
Expand Down
8 changes: 8 additions & 0 deletions trac/web/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,11 @@ def __init__(self, server_address, application, gateway=WSGIServerGateway,
self.environ = {'SERVER_NAME': self.server_name,
'SERVER_PORT': str(self.server_port),
'SCRIPT_NAME': ''}

if not hasattr(HTTPServer, '__enter__'):
def __enter__(self):
return self

if not hasattr(HTTPServer, '__exit__'):
def __exit__(self, *args):
self.server_close()

0 comments on commit 15071ff

Please sign in to comment.