File tree 1 file changed +13
-1
lines changed 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,18 @@ def allow_draft76(self):
149
149
"""
150
150
return False
151
151
152
+ def get_websocket_scheme (self ):
153
+ """Return the url scheme used for this request, either "ws" or "wss".
154
+
155
+ This is normally decided by HTTPServer, but applications
156
+ may wish to override this if they are using an SSL proxy
157
+ that does not provide the X-Scheme header as understood
158
+ by HTTPServer.
159
+
160
+ Note that this is only used by the draft76 protocol.
161
+ """
162
+ return "wss" if self .request .protocol == "https" else "ws"
163
+
152
164
def async_callback (self , callback , * args , ** kwargs ):
153
165
"""Wrap callbacks with this if they are used on asynchronous requests.
154
166
@@ -228,7 +240,7 @@ def accept_connection(self):
228
240
logging .debug ("Malformed WebSocket request received" )
229
241
self ._abort ()
230
242
return
231
- scheme = "wss" if self .request . protocol == "https" else "ws"
243
+ scheme = self .handler . get_websocket_scheme ()
232
244
# Write the initial headers before attempting to read the challenge.
233
245
# This is necessary when using proxies (such as HAProxy), which
234
246
# need to see the Upgrade headers before passing through the
You can’t perform that action at this time.
0 commit comments