From 9d13578bef60b8d09d003fb76324ed80a68977fd Mon Sep 17 00:00:00 2001 From: bel Date: Thu, 17 Sep 2015 22:20:11 +0200 Subject: [PATCH] Set request_info->uri for the client api functions (to the http server response code, as before) --- src/civetweb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/civetweb.c b/src/civetweb.c index ac90ddda..829646dc 100755 --- a/src/civetweb.c +++ b/src/civetweb.c @@ -10401,6 +10401,7 @@ getreq(struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err) return 1; } + int mg_get_response(struct mg_connection *conn, char *ebuf, size_t ebuf_len, @@ -10425,6 +10426,10 @@ int mg_get_response(struct mg_connection *conn, ret = getreq(conn, ebuf, ebuf_len, &err); conn->ctx = octx; + /* TODO: 1) uri is deprecated; + * 2) here, ri.uri is the http response code */ + conn->request_info.uri = conn->request_info.request_uri; + /* TODO (mid): Define proper return values - maybe return length? * For the first test use <0 for error and >0 for OK */ return (ret == 0) ? -1 : +1; @@ -10432,6 +10437,7 @@ int mg_get_response(struct mg_connection *conn, return -1; } + struct mg_connection *mg_download(const char *host, int port, int use_ssl, @@ -10462,6 +10468,10 @@ struct mg_connection *mg_download(const char *host, "Error sending request"); } else { getreq(conn, ebuf, ebuf_len, &reqerr); + + /* TODO: 1) uri is deprecated; + * 2) here, ri.uri is the http response code */ + conn->request_info.uri = conn->request_info.request_uri; } } @@ -10475,6 +10485,7 @@ struct mg_connection *mg_download(const char *host, return conn; } + struct websocket_client_thread_data { struct mg_connection *conn; mg_websocket_data_handler data_handler; @@ -10482,6 +10493,7 @@ struct websocket_client_thread_data { void *callback_data; }; + #if defined(USE_WEBSOCKET) #ifdef _WIN32 static unsigned __stdcall websocket_client_thread(void *data)