Skip to content

feat(http_parser): add HTTP QUERY method (RFC 10008) (IDFGH-18266) - #19071

Open
EyJunge1 wants to merge 1 commit into
espressif:masterfrom
EyJunge1:feat/http-query-rfc-10008
Open

EyJunge1 wants to merge 1 commit into
espressif:masterfrom
EyJunge1:feat/http-query-rfc-10008

Conversation

@EyJunge1

@EyJunge1 EyJunge1 commented Sep 11, 2026 •

Copy link
Copy Markdown

Description

Add the RFC 10008 QUERY method to the vendored http_parser so esp_http_server (and Arduino-ESP32 WebServer, which uses this enum) can accept safe, idempotent requests that carry a body.

  • HTTP_METHOD_MAP: XX(33, QUERY, QUERY) (HTTP_QUERY)
  • Request-line matcher: leading Q → HTTP_QUERY; remaining characters come from method_strings[]
  • HTTP_PARSER_HAS_QUERY: feature macro for downstream (the enumerator is not a #define)

This does not change esp_http_server URI registration beyond making HTTP_QUERY a valid httpd_method_t. Callers can then register .method = HTTP_QUERY.

Feature issue: #19072

Related:

Test

  • QUERY /path HTTP/1.1 + Content-Length parses as HTTP_QUERY (not HPE_INVALID_METHOD / 400)
  • Existing methods (GET/POST/PATCH/SEARCH/…) unchanged
  • http_method_str(HTTP_QUERY) returns "QUERY"
  • HTTP_PARSER_HAS_QUERY is defined

Note

Low Risk
Adds a new recognized HTTP method in the parser and documents registration; existing methods and error handling paths are unchanged aside from QUERY no longer mapping to invalid/501.

Overview
Adds RFC 10008 HTTP_QUERY to the vendored http_parser, so esp_http_server can register and serve QUERY requests instead of treating them as unknown methods (501).

The parser gains HTTP_QUERY in HTTP_METHOD_MAP and request-line dispatch for a leading Q, which completes against the "QUERY" method string like other methods. English and Chinese HTTP server docs now mention HTTP_QUERY and that it may carry a request body when registered with .method = HTTP_QUERY.

An esp_http_server integration test sends QUERY /search with Content-Length and JSON body, checks http_method_str(HTTP_QUERY), handler dispatch, body echo, and HTTP 200. Minor comment typo fixes in http_parser.c are included.

Reviewed by Cursor Bugbot for commit 4fb3dd1. Bugbot is set up for automated code reviews on this repo. Configure here.

@CLAassistant

CLAassistant commented Sep 11, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@EyJunge1

Copy link
Copy Markdown
Author

Implements / tracks feature request: #19072

Related Async issue: ESP32Async/ESPAsyncWebServer#475
Related Async PR: ESP32Async/ESPAsyncWebServer#474

@EyJunge1 EyJunge1 changed the title http_parser: add HTTP QUERY method (RFC 10008) (IDFGH-18266) feat(http_parser): add HTTP QUERY method (RFC 10008) (IDFGH-18266) Sep 12, 2026
@EyJunge1
EyJunge1 force-pushed the feat/http-query-rfc-10008 branch from 3407031 to fdebf4d Compare September 12, 2026 19:21

@Ashish285 Ashish285 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for raising this PR and adding in the support, I only have some minor comments

Comment thread components/esp_http_server/include/esp_http_server.h Outdated
Comment thread components/esp_http_server/test_apps/main/test_http_server.c Outdated
Comment thread components/esp_http_server/test_apps/main/test_http_server.c Outdated
Comment thread components/http_parser/http_parser.c Outdated
Comment thread components/http_parser/http_parser.c Outdated
Comment thread components/http_parser/http_parser.c Outdated
Comment thread components/http_parser/http_parser.h Outdated
Comment thread components/http_parser/http_parser.h Outdated
Comment thread components/http_parser/sbom.yml Outdated
Register QUERY in HTTP_METHOD_MAP and accept a leading 'Q' in the
request-line matcher so esp_http_server can parse safe, idempotent
queries with a body.

Document HTTP_QUERY on the server API and cover a bodied QUERY request
in the esp_http_server test app.
@EyJunge1
EyJunge1 force-pushed the feat/http-query-rfc-10008 branch from 4d3f24f to 4fb3dd1 Compare September 23, 2026 07:33
@EyJunge1
EyJunge1 requested a review from Ashish285 September 23, 2026 07:33
@Ashish285

Copy link
Copy Markdown
Collaborator

LGTM!

@Ashish285

Copy link
Copy Markdown
Collaborator

sha=4fb3dd1afce5bb705828e88b8bb41f52e44cb2e0

@Ashish285 Ashish285 added the PR-Sync-Merge Pull request sync as merge commit label Sep 24, 2026
@Ashish285 Ashish285 added PR-Sync-Merge Pull request sync as merge commit and removed PR-Sync-Merge Pull request sync as merge commit labels Sep 28, 2026
@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: Opened Issue is new labels Sep 28, 2026
@espressif-bot espressif-bot added Resolution: Done Issue is done internally and removed Resolution: NA Issue resolution is unavailable labels Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Sync-Merge Pull request sync as merge commit Resolution: Done Issue is done internally Status: Done Issue is done internally

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants