benoitc / benoitc/http-parser

HttpParser and multiple concatenated HTTP responses

Open
#44 2 comments 0 reactions 0 assignees View on GitHub
improvement
Dominant language
C
Stars
345
Forks
94
PR merge metrics
No merged PRs in 30d

Description

Hi!

If my understanding is correct HttpParser.execute returns the number of bytes consumed, hence it is possible to parse multiple concatenated HTTP responses by checking is_message_complete() and starting a new parser from the same very position the last one stopped.

However the observed behavior is very different: execute() happily consumes the whole string, the subsequent responses text ends up in the message body and _clen_rest is negative.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the concatenated-response case around HttpParser.execute() and is_message_complete(), then inspect how _clen_rest is updated when a response ends. Done means the parser reports the first response boundary without placing subsequent response text in the body, so another parser can start at the returned position.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.