HTTP client silently drops request headers larger than 4095 bytes

Closed
#648 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

Read src/net/http/http_client.c around lines 395–407, then trace the request path in cwist_http_client_request() and find the existing loopback HTTP client tests. Add a test that sends a header larger than 4095 bytes and checks that it arrives intact or the request fails explicitly. The issue is done when oversized headers and curl_slist_append() allocation failures are handled without silently performing a changed request.

Written by the indexing model from the issue text.

Description

bug

Affected: dev at bb2a33946.

cwist_http_client_request() formats each request header into a 4096-byte local buffer. When the formatted line does not fit, it simply skips curl_slist_append() and continues (src/net/http/http_client.c:395-407). The request still runs and no error reaches the caller.

Long Authorization, Cookie, or signed headers can therefore disappear silently, producing an unauthenticated or otherwise different request. CWIST's own general header limit is 8 KiB, so the client drops values within a size the framework otherwise accepts.

Expected: allocate each serialized header dynamically or return an explicit error before performing the request. Also check curl_slist_append() failures without losing the existing list. Add a loopback test proving that a header above 4095 bytes arrives intact or fails explicitly.

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

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.