Skip to content

feat(websocket): add WEBSOCKET_EVENT_HEADER_RECEIVED #827

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bryghtlabs-richard
Copy link
Contributor

Description

Send a new event for each HTTP header-line received, so that the caller may extract interesting headers and cookies. In my case, this is needed for supporting F5 and Amazon ALB cookie-based load-balancers.

Related

Depends on espressif/esp-idf#16119
Closes #715

Testing

Confirmed I can print out the needed header-lines.

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@bryghtlabs-richard bryghtlabs-richard force-pushed the feat/websocket-response-headers branch from 6be5991 to f96e373 Compare June 12, 2025 18:41
@@ -473,6 +479,8 @@
.sub_protocol = client->config->subprotocol,
.user_agent = client->config->user_agent,
.headers = client->config->headers,
.header_hook = websocket_header_hook,

Check failure

Code scanning / clang-tidy

field designator 'header_hook' does not refer to any field in type 'const esp_transport_ws_config_t' [clang-diagnostic-error] Error

field designator 'header_hook' does not refer to any field in type 'const esp_transport_ws_config_t' [clang-diagnostic-error]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is expected until ESP-IDF is updated to support header_hook and header_userp.

@@ -473,6 +479,8 @@
.sub_protocol = client->config->subprotocol,
.user_agent = client->config->user_agent,
.headers = client->config->headers,
.header_hook = websocket_header_hook,
.header_userp = client,

Check failure

Code scanning / clang-tidy

field designator 'header_userp' does not refer to any field in type 'const esp_transport_ws_config_t' [clang-diagnostic-error] Error

field designator 'header_userp' does not refer to any field in type 'const esp_transport_ws_config_t' [clang-diagnostic-error]
Send a new event for each HTTP header-line received.

Depends on espressif/esp-idf#16119
Closes espressif#715
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[websocket]: ability to read connection upgrade headers (IDFGH-14252)
1 participant