Skip to content

Commit

Permalink
auto use wss for ssl http
Browse files Browse the repository at this point in the history
  • Loading branch information
manatlan committed Oct 12, 2024
1 parent f25b9cf commit cfe2687
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions htagweb/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,14 @@ def __init__(self,
host="0.0.0.0",
port=8000,
debug:bool=False,
ssl:bool=False,
ssl:bool=False, # now, Indicate that Secure flag should be set for middleware WebServerSession (cookies)
parano:bool=False,
http_only:bool=False,
timeout_interaction:int=60,
timeout_inactivity:int=0,
):
self.host=host
self.port=port
self.ssl=ssl
self.parano = parano
self.http_only = http_only
self.timeout_interaction = timeout_interaction
Expand All @@ -226,7 +225,7 @@ def __init__(self,
Starlette.__init__( self,
debug=debug,
routes=routes,
middleware=[Middleware(WebServerSession,https_only=self.ssl)],
middleware=[Middleware(WebServerSession,https_only=ssl)],
lifespan=lifespan,
)

Expand Down Expand Up @@ -272,6 +271,7 @@ async def handle(self, request,
pparano=""



if is_http_only:
# interactions use HTTP POST
js = """%(jslib)s
Expand All @@ -287,7 +287,7 @@ async def handle(self, request,
""" % locals()
else:
# interactions use WS
protocol = "wss" if self.ssl else "ws"
protocol = "wss" if (request.url.scheme == "https") else "ws"

js = """%(jslib)s
Expand Down

0 comments on commit cfe2687

Please sign in to comment.