Merge pull request #549 from ai0/websocket-scheme
add websocket scheme in request
This commit is contained in:
commit
6984f6eec4
|
@ -57,7 +57,7 @@ Blueprints have much the same functionality as an application instance.
|
||||||
|
|
||||||
### WebSocket routes
|
### WebSocket routes
|
||||||
|
|
||||||
WebSocket handlers can be registered on a blueprint using the `@bp.route`
|
WebSocket handlers can be registered on a blueprint using the `@bp.websocket`
|
||||||
decorator or `bp.add_websocket_route` method.
|
decorator or `bp.add_websocket_route` method.
|
||||||
|
|
||||||
### Middleware
|
### Middleware
|
||||||
|
|
|
@ -142,10 +142,16 @@ class Request(dict):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def scheme(self):
|
def scheme(self):
|
||||||
if self.transport.get_extra_info('sslcontext'):
|
if self.app.websocket_enabled \
|
||||||
return 'https'
|
and self.headers.get('upgrade') == 'websocket':
|
||||||
|
scheme = 'ws'
|
||||||
|
else:
|
||||||
|
scheme = 'http'
|
||||||
|
|
||||||
return 'http'
|
if self.transport.get_extra_info('sslcontext'):
|
||||||
|
scheme += 's'
|
||||||
|
|
||||||
|
return scheme
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def host(self):
|
def host(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user