From 0fb2f38cb79dba72696a0e47db9f00a93f6502cc Mon Sep 17 00:00:00 2001 From: Sergey Lyubka <valenok@gmail.com> Date: Sun, 14 Sep 2014 15:06:09 +0100 Subject: [PATCH] Fixed mg_connect() call --- examples/http_client/http_client.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/http_client/http_client.c b/examples/http_client/http_client.c index ecf21c678..3f89d8ae6 100644 --- a/examples/http_client/http_client.c +++ b/examples/http_client/http_client.c @@ -11,8 +11,7 @@ static int s_received_signal = 0; static struct mg_server *s_server = NULL; -static const char *s_remote_host = "glosbe.com"; -static int s_remote_port = 80; +static const char *s_remote_addr = "glosbe.com:80"; static void signal_handler(int sig_num) { signal(sig_num, signal_handler); @@ -31,7 +30,7 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) { // TODO(lsm): handle connect error here. mg_printf(conn, "GET %s HTTP/1.0\r\nHost: %s\r\n\r\n", "/gapi/translate?from=eng&dest=fra&format=json&phrase=cat", - s_remote_host); + s_remote_addr); return MG_TRUE; case MG_REPLY: @@ -47,7 +46,7 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) { return MG_TRUE; case MG_REQUEST: - if ((client = mg_connect(s_server, s_remote_host, s_remote_port, 0)) != NULL) { + if ((client = mg_connect(s_server, s_remote_addr)) != NULL) { // Interconnect requests client->connection_param = conn; conn->connection_param = client; -- GitLab