Commit 71d09722 authored by Yiming Sun's avatar Yiming Sun Committed by Cesanta Bot

Fix http_client doc

PUBLISHED_FROM=f415ddbac47e3069d3ab29467a23f6b8dab0066f
parent 349d25dc
...@@ -18,8 +18,9 @@ static int exit_flag = 0; ...@@ -18,8 +18,9 @@ static int exit_flag = 0;
static void ev_handler(struct mg_connection *c, int ev, void *p) { static void ev_handler(struct mg_connection *c, int ev, void *p) {
if (ev == MG_EV_HTTP_REPLY) { if (ev == MG_EV_HTTP_REPLY) {
struct http_message *hm = (struct http_message *)p;
c->flags |= MG_F_CLOSE_IMMEDIATELY; c->flags |= MG_F_CLOSE_IMMEDIATELY;
fwrite(hm->message.p, 1, hm->message.len, stdout); fwrite(hm->message.p, 1, (int)hm->message.len, stdout);
putchar('\n'); putchar('\n');
exit_flag = 1; exit_flag = 1;
} else if (ev == MG_EV_CLOSE) { } else if (ev == MG_EV_CLOSE) {
...@@ -31,7 +32,7 @@ int main(void) { ...@@ -31,7 +32,7 @@ int main(void) {
struct mg_mgr mgr; struct mg_mgr mgr;
mg_mgr_init(&mgr, NULL); mg_mgr_init(&mgr, NULL);
mg_connect_http(mgr, ev_handler, url, NULL, NULL); mg_connect_http(&mgr, ev_handler, url, NULL, NULL);
while (exit_flag == 0) { while (exit_flag == 0) {
......
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