mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-06 05:31:44 +00:00
support for OSX in the webdav plugin
This commit is contained in:
+12
-9
@@ -1814,18 +1814,21 @@ void init_magic_table(char *magic_table[]) {
|
||||
}
|
||||
|
||||
char *uwsgi_get_last_char(char *what, char c) {
|
||||
int i;
|
||||
char *ptr = NULL;
|
||||
|
||||
for (i = 0; i < (int) strlen(what); i++) {
|
||||
if (what[i] == c) {
|
||||
ptr = what + i;
|
||||
}
|
||||
size_t len = strlen(what);
|
||||
while(len--) {
|
||||
if (what[len] == c) return what + len;
|
||||
}
|
||||
|
||||
return ptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *uwsgi_get_last_charn(char *what, size_t len, char c) {
|
||||
while(len--) {
|
||||
if (what[len] == c) return what + len;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
char *uwsgi_num2str(int num) {
|
||||
|
||||
char *str = uwsgi_malloc(11);
|
||||
|
||||
@@ -229,7 +229,7 @@ static size_t uwsgi_webdav_expand_path(struct wsgi_request *wsgi_req, char *item
|
||||
}
|
||||
|
||||
static size_t uwsgi_webdav_expand_fake_path(struct wsgi_request *wsgi_req, char *item, uint16_t item_len, char *filename) {
|
||||
char *last_slash = memrchr(item, '/', item_len);
|
||||
char *last_slash = uwsgi_get_last_charn(item, item_len, '/');
|
||||
if (!last_slash) return 0;
|
||||
size_t filename_len = uwsgi_webdav_expand_path(wsgi_req, item, last_slash - item, filename);
|
||||
if (!filename_len) return 0;
|
||||
@@ -704,7 +704,7 @@ next:
|
||||
if (de_r == NULL) break;
|
||||
// skip items startign with a dot
|
||||
if (de.d_name[0] == '.') continue;
|
||||
if (uwsgi_webdav_dirlist_add_item(ub, de.d_name[0], strlen(de.d_name[0]), de.d_type == DT_DIR ? 1 : 0) goto end;
|
||||
if (uwsgi_webdav_dirlist_add_item(ub, de.d_name, strlen(de.d_name), de.d_type == DT_DIR ? 1 : 0)) goto end;
|
||||
}
|
||||
|
||||
closedir(d);
|
||||
|
||||
@@ -2808,6 +2808,7 @@ void uwsgi_gateway_go_cheap(char *, int, int *);
|
||||
|
||||
char *uwsgi_open_and_read(char *, size_t *, int, char *[]);
|
||||
char *uwsgi_get_last_char(char *, char);
|
||||
char *uwsgi_get_last_charn(char *, size_t, char);
|
||||
|
||||
void uwsgi_spawn_daemon(struct uwsgi_daemon *);
|
||||
void uwsgi_detach_daemons();
|
||||
|
||||
Reference in New Issue
Block a user