Commit 0fb2f38c authored by Sergey Lyubka's avatar Sergey Lyubka

Fixed mg_connect() call

parent aa007f12
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
static int s_received_signal = 0; static int s_received_signal = 0;
static struct mg_server *s_server = NULL; static struct mg_server *s_server = NULL;
static const char *s_remote_host = "glosbe.com"; static const char *s_remote_addr = "glosbe.com:80";
static int s_remote_port = 80;
static void signal_handler(int sig_num) { static void signal_handler(int sig_num) {
signal(sig_num, signal_handler); signal(sig_num, signal_handler);
...@@ -31,7 +30,7 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) { ...@@ -31,7 +30,7 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) {
// TODO(lsm): handle connect error here. // TODO(lsm): handle connect error here.
mg_printf(conn, "GET %s HTTP/1.0\r\nHost: %s\r\n\r\n", 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", "/gapi/translate?from=eng&dest=fra&format=json&phrase=cat",
s_remote_host); s_remote_addr);
return MG_TRUE; return MG_TRUE;
case MG_REPLY: case MG_REPLY:
...@@ -47,7 +46,7 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) { ...@@ -47,7 +46,7 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) {
return MG_TRUE; return MG_TRUE;
case MG_REQUEST: 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 // Interconnect requests
client->connection_param = conn; client->connection_param = conn;
conn->connection_param = client; conn->connection_param = client;
......
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