support for OSX in the webdav plugin

This commit is contained in:
Roberta Giordano
2013-04-28 11:24:07 +02:00
parent 63c1dbb3ed
commit ca3b1a9b30
3 changed files with 15 additions and 11 deletions
+12 -9
View File
@@ -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);
+2 -2
View File
@@ -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);
+1
View File
@@ -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();