mirror of
https://github.com/cesanta/mongoose.git
synced 2025-06-13 05:12:51 +08:00
transmit http answer code using http_client
This commit is contained in:
parent
531fec34fd
commit
df206bc05a
@ -36,6 +36,7 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) {
|
|||||||
case MG_REPLY:
|
case MG_REPLY:
|
||||||
// Send reply to the original connection
|
// Send reply to the original connection
|
||||||
orig = (struct mg_connection *) conn->connection_param;
|
orig = (struct mg_connection *) conn->connection_param;
|
||||||
|
mg_send_status(orig, conn->status_code);
|
||||||
mg_send_header(orig, "Content-Type", "text/plain");
|
mg_send_header(orig, "Content-Type", "text/plain");
|
||||||
mg_send_data(orig, conn->content, conn->content_len);
|
mg_send_data(orig, conn->content, conn->content_len);
|
||||||
mg_send_data(orig, "", 0); // Last chunk: mark the end of reply
|
mg_send_data(orig, "", 0); // Last chunk: mark the end of reply
|
||||||
|
@ -2410,6 +2410,9 @@ static int parse_http_message(char *buf, int len, struct mg_connection *ri) {
|
|||||||
if (is_request) {
|
if (is_request) {
|
||||||
ri->http_version += 5;
|
ri->http_version += 5;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
ri->status_code = atoi(ri->uri);
|
||||||
|
}
|
||||||
parse_http_headers(&buf, ri);
|
parse_http_headers(&buf, ri);
|
||||||
|
|
||||||
if ((ri->query_string = strchr(ri->uri, '?')) != NULL) {
|
if ((ri->query_string = strchr(ri->uri, '?')) != NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user