Skip to content

Instantly share code, notes, and snippets.

@kellabyte
Last active December 19, 2015 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kellabyte/5912838 to your computer and use it in GitHub Desktop.
Save kellabyte/5912838 to your computer and use it in GitHub Desktop.
typedef struct
{
unsigned short http_major;
unsigned short http_minor;
unsigned char method;
int keep_alive;
char *url;
void *headers;
int body_length;
char *body;
} http_request;
int http_request_on_body(http_parser *parser, const char *at, size_t length)
{
/* No Copy! Will this work? */
http_request_context *context = (http_request_context *)parser->data;
if (context->request->body == NULL)
{
context->request->body = at;
}
context->request->body_length += length;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment