|
@@ -2438,8 +2438,6 @@ static int alloc_vprintf(char **buf, size_t size, const char *fmt, va_list ap)
|
|
|
return len;
|
|
|
}
|
|
|
|
|
|
-int mg_vprintf(struct mg_connection *conn, const char *fmt, va_list ap);
|
|
|
-
|
|
|
int mg_vprintf(struct mg_connection *conn, const char *fmt, va_list ap)
|
|
|
{
|
|
|
char mem[MG_BUF_LEN], *buf = mem;
|
|
@@ -6417,7 +6415,7 @@ void mg_close_connection(struct mg_connection *conn)
|
|
|
mg_free(conn);
|
|
|
}
|
|
|
|
|
|
-static struct mg_connection *mg_connect(const char *host, int port, int use_ssl,
|
|
|
+struct mg_connection *mg_connect(const char *host, int port, int use_ssl,
|
|
|
char *ebuf, size_t ebuf_len)
|
|
|
{
|
|
|
static struct mg_context fake_ctx;
|
|
@@ -6472,7 +6470,7 @@ static int is_valid_uri(const char *uri)
|
|
|
return uri[0] == '/' || (uri[0] == '*' && uri[1] == '\0');
|
|
|
}
|
|
|
|
|
|
-static int getreq(struct mg_connection *conn, char *ebuf, size_t ebuf_len)
|
|
|
+int mg_getreq(struct mg_connection *conn, char *ebuf, size_t ebuf_len)
|
|
|
{
|
|
|
const char *cl;
|
|
|
|
|
@@ -6525,7 +6523,7 @@ struct mg_connection *mg_download(const char *host, int port, int use_ssl,
|
|
|
} else if (mg_vprintf(conn, fmt, ap) <= 0) {
|
|
|
snprintf(ebuf, ebuf_len, "%s", "Error sending request");
|
|
|
} else {
|
|
|
- getreq(conn, ebuf, ebuf_len);
|
|
|
+ mg_getreq(conn, ebuf, ebuf_len);
|
|
|
}
|
|
|
if (ebuf[0] != '\0' && conn != NULL) {
|
|
|
mg_close_connection(conn);
|
|
@@ -6648,7 +6646,7 @@ static void process_new_connection(struct mg_connection *conn)
|
|
|
to crule42. */
|
|
|
conn->data_len = 0;
|
|
|
do {
|
|
|
- if (!getreq(conn, ebuf, sizeof(ebuf))) {
|
|
|
+ if (!mg_getreq(conn, ebuf, sizeof(ebuf))) {
|
|
|
send_http_error(conn, 500, "Server Error", "%s", ebuf);
|
|
|
conn->must_close = 1;
|
|
|
} else if (!is_valid_uri(conn->request_info.uri)) {
|