ResponseParser

Stores and parses the response data which readConsume outputs.

Constructors

this
this(size_t payload_length)
Undocumented in source.

Members

Functions

consume
size_t consume(void[] data)

readConsume callback, appends data to this.response, then looks for end_of_header_token. Returns data.length if finished or a greater value if the full payload isn't there yet.

payload
char[] payload()

Returns the payload or null if end_of_header_token hasn't been found yet.

Static variables

end_of_header_token
auto end_of_header_token;

The token that denotes the end of the HTTP header and the beginning of the payload.

Variables

have_payload
bool have_payload;

true if end_of_header_token has been fond in response.

payload_length
size_t payload_length;

The expected payload length so that consume knows when to finish. The preferred way is to use the "Content-Length" HTTP response header line, but for simplicity we don't parse the full HTTP header here.

payload_start
size_t payload_start;

The index in response after end_of_header_token.

response
char[] response;

Everything passed to consume is appended here.

Meta