1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-12-22 04:02:04 +03:00

Set request_info->uri for the client api functions (to the http server response code, as before)

This commit is contained in:
bel
2015-09-17 22:20:11 +02:00
parent b91207c067
commit 9d13578bef

View File

@@ -10401,6 +10401,7 @@ getreq(struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err)
return 1; return 1;
} }
int mg_get_response(struct mg_connection *conn, int mg_get_response(struct mg_connection *conn,
char *ebuf, char *ebuf,
size_t ebuf_len, size_t ebuf_len,
@@ -10425,6 +10426,10 @@ int mg_get_response(struct mg_connection *conn,
ret = getreq(conn, ebuf, ebuf_len, &err); ret = getreq(conn, ebuf, ebuf_len, &err);
conn->ctx = octx; 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? /* TODO (mid): Define proper return values - maybe return length?
* For the first test use <0 for error and >0 for OK */ * For the first test use <0 for error and >0 for OK */
return (ret == 0) ? -1 : +1; return (ret == 0) ? -1 : +1;
@@ -10432,6 +10437,7 @@ int mg_get_response(struct mg_connection *conn,
return -1; return -1;
} }
struct mg_connection *mg_download(const char *host, struct mg_connection *mg_download(const char *host,
int port, int port,
int use_ssl, int use_ssl,
@@ -10462,6 +10468,10 @@ struct mg_connection *mg_download(const char *host,
"Error sending request"); "Error sending request");
} else { } else {
getreq(conn, ebuf, ebuf_len, &reqerr); 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; return conn;
} }
struct websocket_client_thread_data { struct websocket_client_thread_data {
struct mg_connection *conn; struct mg_connection *conn;
mg_websocket_data_handler data_handler; mg_websocket_data_handler data_handler;
@@ -10482,6 +10493,7 @@ struct websocket_client_thread_data {
void *callback_data; void *callback_data;
}; };
#if defined(USE_WEBSOCKET) #if defined(USE_WEBSOCKET)
#ifdef _WIN32 #ifdef _WIN32
static unsigned __stdcall websocket_client_thread(void *data) static unsigned __stdcall websocket_client_thread(void *data)