Skip to content

Commit

Permalink
Merge pull request #421 from mpromonet/master
Browse files Browse the repository at this point in the history
transmit http answer code using http_client
  • Loading branch information
cpq committed Oct 14, 2014
2 parents 911115c + ca3f5a3 commit 6193b51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/http_client/http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) {
case MG_REPLY:
// Send reply to the original connection
orig = (struct mg_connection *) conn->connection_param;
mg_send_status(orig, conn->status_code);
mg_send_header(orig, "Content-Type", "text/plain");
mg_send_data(orig, conn->content, conn->content_len);
mg_send_data(orig, "", 0); // Last chunk: mark the end of reply
Expand Down
2 changes: 2 additions & 0 deletions mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -2409,6 +2409,8 @@ static int parse_http_message(char *buf, int len, struct mg_connection *ri) {
} else {
if (is_request) {
ri->http_version += 5;
} else {
ri->status_code = atoi(ri->uri);
}
parse_http_headers(&buf, ri);

Expand Down

0 comments on commit 6193b51

Please sign in to comment.