Skip to content

Removing dead code for RequestedConnectionType - #471

Merged
mathieucarbou merged 2 commits into
mainfrom
RequestedConnectionType
Aug 2, 2026
Merged

Removing dead code for RequestedConnectionType#471
mathieucarbou merged 2 commits into
mainfrom
RequestedConnectionType

Conversation

@mathieucarbou

@mathieucarbou mathieucarbou commented Jul 31, 2026

Copy link
Copy Markdown
Member
  • RCT_NOT_USED unused only as a placeholder as a default param value
  • RCT_DEFAULT was partly mean RCT_HTTP but was never assigned, so hardly usable from user code.
  • RCT_MAX: unused also

- RCT_NOT_USED unused only as a placeholder as a default param value
- RCT_DEFAULT was partly mean RCT_HTTP but was never assigned, so hardly usable from user code.
@mathieucarbou
mathieucarbou force-pushed the RequestedConnectionType branch from 74ef00e to 1c1a543 Compare July 31, 2026 13:47
Comment thread src/ESPAsyncWebServer.h Outdated
Copilot AI review requested due to automatic review settings August 2, 2026 13:31
@mathieucarbou
mathieucarbou force-pushed the RequestedConnectionType branch from a3d3c15 to edd16e7 Compare August 2, 2026 13:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR removes unused RequestedConnectionType enum values and related helper logic, simplifying how request connection type is represented and checked across the server request parsing and API surface.

Changes:

  • Simplifies request header parsing logic to only treat RCT_HTTP as the “plain HTTP” baseline for WS/SSE classification.
  • Removes unused RequestedConnectionType values and prunes requestedConnTypeToString() accordingly.
  • Reworks isExpectedRequestedConnType(...) into a single-type check with deprecated overloads for multi-argument compatibility.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/WebRequest.cpp Updates WS/SSE detection conditions and removes unused connection-type string/utility cases.
src/literals.h Removes unused string literals for deleted enum values.
src/ESPAsyncWebServer.h Removes unused enum members and refactors connection-type checking API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ESPAsyncWebServer.h
Comment on lines 395 to 399
typedef enum {
RCT_NOT_USED = -1,
RCT_DEFAULT = 0,
RCT_HTTP,
RCT_WS,
RCT_EVENT,
RCT_MAX
RCT_HTTP = 1,
RCT_WS = 2,
RCT_EVENT = 3
} RequestedConnectionType;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes this is intentional. They should not be used by the user code anyway.

Copilot AI review requested due to automatic review settings August 2, 2026 13:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/ESPAsyncWebServer.h:399

  • Removing the public enum values RCT_DEFAULT, RCT_NOT_USED, and RCT_MAX is a source-breaking change for downstream sketches/libraries that reference them. Consider keeping backward-compatible aliases (marked deprecated) for at least one release cycle so existing code still compiles while migrating to RCT_HTTP / the 1-arg isExpectedRequestedConnType overloads.
typedef enum {
  RCT_HTTP = 1,
  RCT_WS = 2,
  RCT_EVENT = 3
} RequestedConnectionType;

@mathieucarbou
mathieucarbou merged commit d009eff into main Aug 2, 2026
38 checks passed
@mathieucarbou
mathieucarbou deleted the RequestedConnectionType branch August 2, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants