mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-11 16:40:17 +00:00
Fix http_client doc
PUBLISHED_FROM=f415ddbac47e3069d3ab29467a23f6b8dab0066f
This commit is contained in:
1 parent
349d25dccf
commit
71d09722be
1 file changed
+3
-2
@@ -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) {
|
|||||||
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) {
|
||||||
|
|||||||
Reference in new issue
Block a user