diff --git a/common/socket_helper.c b/common/socket_helper.c index 7373029..b1c4a89 100644 --- a/common/socket_helper.c +++ b/common/socket_helper.c @@ -29,6 +29,15 @@ static const char *get_line_terminator(const char *buffer, int buffer_size) { return NULL; } +/** + * Read a line from a buffer, and parse headers + * + * @param buffer The buffer to read from + * @param buffer_size The size of the buffer + * @param message The http_message to store headers in + * + * @return A line_read_result indicating the status of reading the line + */ static struct line_read_result read_line(const char *buffer, int buffer_size, struct http_message *message) { const char *line_terminator = get_line_terminator(buffer, buffer_size); if (line_terminator == NULL) { @@ -86,6 +95,13 @@ static struct line_read_result read_line(const char *buffer, int buffer_size, st return result; } +/** + * Get the strategy to take when reading from the socket + * + * @param headers The headers to use to infer this decision. + * + * @return A populated socket_read_info, with -1 as length if no length is specified by the strategy. + */ static struct socket_read_info get_read_info(const struct http_header *headers) { const struct http_header *header_cursor = headers; struct socket_read_info info = {STRATEGY_EOF, -1};