Commit 6193b517 authored by Sergey Lyubka's avatar Sergey Lyubka

Merge pull request #421 from mpromonet/master

transmit http answer code using http_client
parents 911115cc ca3f5a32
......@@ -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
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment