Version 2#1
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates request/response and static-file handling from fixed-size char[] buffers (and separate buffer_size tracking) to a shared dynamic buffer struct across the server pipeline (recv → parse → load → build → send).
Changes:
- Introduces
src/data_structures/buffer.{h,c}withENSURE_CAPACITY+ dynamic allocation. - Updates socket recv/send, HTTP request parsing, HTTP response building, and static file reads to use
buffer*. - Refactors session cache and worker handlers to remove the old
buffer_sizeplumbing and rely onbuffer->count.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 26 comments.
Show a summary per file
| File | Description |
|---|---|
| src/data_structures/buffer.h / buffer.c | New dynamic buffer type and capacity growth helper |
| src/data_structures/session.c | Session cache now stores buffer* per session (removes buffer_size_array) |
| src/socket.h / src/socket.c | send_* and recv_* APIs updated to use buffer |
| src/utils/static_file.h / static_file.c | Static file read now fills a buffer |
| src/http/request.h / request.c | Request parsing now accepts a buffer* |
| src/http/response.h / response.c | Response construction now uses buffer for body/tmp/response |
| src/handlers/{parser,loader,builder,sender}.c | Pipeline updated to use buffer |
| src/listener.c | Listener switched to new recv_* signatures |
| src/static.h / src/static.c | Introduces ALLOCATE_MEMORY_ERROR; updates session return struct buffer field |
| CMakeLists.txt | Adds and links buffer_lib |
| README.md | Notes/ideas update |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 22 changed files in this pull request and generated 15 comments.
Comments suppressed due to low confidence (1)
src/static.h:16
REQUEST_RESPONSE_MAX_SIZE/HTML_MAX_SIZEwere removed fromstatic.h, but the repository’s unit and simulator tests still includestatic.hand use these macros (e.g.,test/unit_tests/http/*andtest/simulator/*). As-is, this PR will break the test build. Either keep these macros (possibly deprecated) or update the test code and any remaining public API to use the newbufferabstraction instead.
#include <pthread.h>
#define HTTP_HEADER_SIZE 256
#define HTTP_URI_TOKEN_COUNT 4
#define HTTP_URI_TOKEN_SIZE 200
#define HTTP_VERSION_SIZE 16
#define HTTP_METHOD_SIZE 8
#define HTTP_HEADER_SMALL_SIZE 128
#define HTTP_HEADER_ETAG_SIZE 65
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot stopped work on behalf of
diderikk due to an error
April 18, 2026 14:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.