Skip to content

Handle additional characters in headers #1

@mpchadwick

Description

@mpchadwick

Currently we only count the size of the key and value in the headers.

static int gather_header_size(void *b_, const char *key, const char *value)
{
int *b = b_;
(*b) += strlen(key);
(*b) += strlen(value);
return 1;
}

Typically a line looks like this

Key: Value

It has 4 additional bytes...

  • The colon after the key
  • The space after the colon
  • A CLRF at the end of the line

After the final line there is an additional line with only a CLRF before the body starts. Based on the HTTP spec I don't think this is part of the headers

Request (section 5) and Response (section 6) messages use the generic message format of RFC 822 [9] for transferring entities (the payload of the message). Both types of message consist of a start-line, zero or more header fields (also known as "headers"), an empty line (i.e., a line with nothing preceding the CRLF) indicating the end of the header fields, and possibly a message-body.

https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions