You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need use the virtual directory , but it don't support on version 3.4.
I compared the code, It have get_document_root() function that is parsed the
virtual directory in 3.0, but 3.4 havn't.
// Mongoose allows to specify multiple directories to serve,
// like /var/www,/~bob=/home/bob. That means that root directory depends on URI.
// This function returns root dir for given URI.
static int get_document_root(const struct mg_connection *conn,
struct vec *document_root) {
const char *root, *uri;
int len_of_matched_uri;
struct vec uri_vec, path_vec;
uri = conn->request_info.uri;
len_of_matched_uri = 0;
root = next_option(conn->ctx->config[DOCUMENT_ROOT], document_root, NULL);
while ((root = next_option(root, &uri_vec, &path_vec)) != NULL) {
if (memcmp(uri, uri_vec.ptr, uri_vec.len) == 0) {
*document_root = path_vec;
len_of_matched_uri = uri_vec.len;
break;
}
}
return len_of_matched_uri;
}
static void convert_uri_to_file_name(struct mg_connection *conn,
const char *uri, char *buf,
size_t buf_len) {
struct vec vec;
int match_len;
match_len = get_document_root(conn, &vec);
mg_snprintf(conn, buf, buf_len, "%.*s%s", vec.len, vec.ptr, uri + match_len);
#if defined(_WIN32) && !defined(__SYMBIAN32__)
change_slashes_to_backslashes(buf);
#endif /* _WIN32 */
DEBUG_TRACE(("[%s] -> [%s], [%.*s]", uri, buf, (int) vec.len, vec.ptr));
}
Original issue reported on code.google.com by [email protected] on 29 Dec 2012 at 9:30
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 29 Dec 2012 at 9:30The text was updated successfully, but these errors were encountered: