-
-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add no-server-header support for Web Socket implementations #1581
Conversation
adopted change suggested. Co-authored-by: Marcelo Trylesinski <[email protected]>
as per suggestion, moved the limitation to --no-server-header area
Added logic to add server header support for websockets and also to pass default headers
Added logic to add server header support for websockets and also to pass default headers
* added logic to accept default headers in websocket * added default_headers to class init * fix * feat(websockets): added server header support for websockets Added logic to add server header support for websockets and also to pass default headers * feat(websockets-wsproto): added server header support for websockets Added logic to add server header support for websockets and also to pass default headers Co-authored-by: Irfanuddin <[email protected]>
# Conflicts: # uvicorn/protocols/websockets/websockets_impl.py # uvicorn/protocols/websockets/wsproto_impl.py
I am not sure if these features are needed at this point of time, but I went ahead and added as I was not able to conclusively find a reason why server headers were not added to Websocket protocols. Note: Also, we can keep this in WIP till Websocket library provides an API to disable server header completely. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to not use the workaround on the websockets
implementation 🤔
There's already an issue on websockets
about this, and we already documented the limitation. Let's modify the note to specify that it does not work on websockets
implementation and add the headers to wsproto
.
@Kludex, agreed will make the changes today! thanks for your feedback |
Thanks 🙏 |
…sockets" This reverts commit 62c6c7e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implemented request changes
Test Results:Code:# app.py
from fastapi import FastAPI
from starlette.websockets import WebSocket
app = FastAPI()
@app.websocket("/ws")
async def websocket_endpoint(websocket: WebSocket):
await websocket.accept()
while True:
data = await websocket.receive_text()
await websocket.send_text(f"Message text was: {data}")
|
--no-date-header is also not compatible with Websockets
--no-date-header is also not compatible with Websockets
|
We also need tests here, jfyk. |
Suggestion removes duplication check on header names to keep it consistent with http implementations. Co-authored-by: Marcelo Trylesinski <[email protected]>
Co-authored-by: Marcelo Trylesinski <[email protected]> Co-authored-by: Irfanuddin <[email protected]>
Closing this request, as it was made from Please refer to #1606 for further updates. |
No description provided.