mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-05 02:49:00 +08:00
23122b327c
It would be probably good idea to also remove tools/docgen.py and asciidoc.mk, but asciidoc.mk is still mentioned under `cloud/doc`, which may contain some useful info which we'll need at least to review before removing. PUBLISHED_FROM=faf454d4c52a2f07ea8ac084cf0bd11a0c9c9b3b
1.3 KiB
1.3 KiB
title | decl_name | symbol_kind | signature |
---|---|---|---|
mg_connect_http() | mg_connect_http | func | struct mg_connection *mg_connect_http(struct mg_mgr *mgr, mg_event_handler_t event_handler, const char *url, const char *extra_headers, const char *post_data); |
Helper function that creates outbound HTTP connection.
url
is a URL to fetch. It must be properly URL-encoded, e.g. have
no spaces, etc. By default, mg_connect_http()
sends Connection and
Host headers. extra_headers
is an extra HTTP headers to send, e.g.
"User-Agent: my-app\r\n"
.
If post_data
is NULL, then GET request is created. Otherwise, POST request
is created with the specified POST data. Note that if the data being posted
is a form submission, the Content-Type
header should be set accordingly
(see example below).
Examples:
nc1 = mg_connect_http(mgr, ev_handler_1, "http://www.google.com", NULL,
NULL);
nc2 = mg_connect_http(mgr, ev_handler_1, "https://github.com", NULL, NULL);
nc3 = mg_connect_http(
mgr, ev_handler_1, "my_server:8000/form_submit/",
"Content-Type: application/x-www-form-urlencoded\r\n",
"var_1=value_1&var_2=value_2");