HTTP/1: HTTP/1.1 prefix is accepted as the complete request version

Open Beginner friendly
#742 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c

Research direction

Start in src/net/http/http.c at the request-line parsing comparison around lines 4680–4697, then review the Host handling check around lines 4810–4815. Trace how the parsed version is used for keep-alive and add coverage for malformed version tokens such as HTTP/1.1junk. Done means unsupported or malformed request versions receive HTTP 400 while exact supported versions retain their behavior.

Written by the indexing model from the issue text.

Description

bug

Confirmed on dev at fd8cf045770459ebc0f6b6740f54dcd30a80ce6c.

Request-version checks use strncmp(version, "HTTP/1.1", 8) == 0 rather than exact matching. As a result, versions such as HTTP/1.1junk are accepted as HTTP/1.1, including keep-alive behavior.

Sources:

A public-parser repro accepted GET / HTTP/1.1junk and returned version_suffix=1.

Other HTTP agents will reject or classify this request differently, so accepting it creates another proxy differential. Require an exact supported version token and reject malformed request lines with HTTP 400.

Dominant language
C
Stars
16
Forks
7
Avg merge
4h 54m
Merged PRs (30d)
185

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from c4punks/CWIST

All issues in c4punks/CWIST

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.