[PATCH] http-push.c: DAV must support olny http and https scheme

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the response from remote web-server have scp or other not http-like
scheme http-push can't go to change url, because DAV must work only
over HTTP (http and https scheme).

Signed-off-by: Kirill A. Korinskiy <catap@xxxxxxxx>
---
 http-push.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/http-push.c b/http-push.c
index feeb340..cce9ead 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1457,16 +1457,17 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
 			}
 		} else if (!strcmp(ctx->name, DAV_PROPFIND_NAME) && ctx->cdata) {
 			char *path = ctx->cdata;
-			if (*ctx->cdata == 'h') {
-				path = strstr(path, "//");
-				if (path) {
-					path = strchr(path+2, '/');
-				}
-			}
-			if (path) {
-				path += repo->path_len;
-				ls->dentry_name = xstrdup(path);
+			if (!strcmp(ctx->cdata, "http://";)) {
+				path = strchr(path + sizeof("http://";) - 1, '/');
+			} else if (!strcmp(ctx->cdata, "https://";)) {
+				path = strchr(path + sizeof("https://";) - 1, '/');
 			}
+
+			path += repo->path_len;
+
+			ls->dentry_name = xmalloc(strlen(path) -
+						  repo->path_len + 1);
+			strcpy(ls->dentry_name, path + repo->path_len);
 		} else if (!strcmp(ctx->name, DAV_PROPFIND_COLLECTION)) {
 			ls->dentry_flags |= IS_DIR;
 		}
-- 
1.6.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]