{"thread":{"id":"18846","subject":"[PATCH] http-push.c: DAV must support olny http and https scheme","startedAt":"2009-04-13T12:42:34Z","lastAt":"2009-04-13T17:00:37Z","messageCount":2,"participants":["Kirill A. Korinskiy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"111185","messageId":"1239626554-26206-1-git-send-email-catap@catap.ru","threadId":"18846","inReplyTo":null,"subject":"[PATCH] http-push.c: DAV must support olny http and https scheme","fromName":"Kirill A. Korinskiy","fromEmail":"catap@catap.ru","sentAt":"2009-04-13T12:42:34Z","receivedAt":"2009-04-13T12:42:34Z","isPatch":true,"sender":{"key":"catap@catap.ru","avatar":"https://gravatar.com/avatar/ea0ab2c29579606bd684eccdf786c666f4425bedc4e599b698a175f12737b1c5?d=mp&s=160"},"body":"If the response from remote web-server have scp or other not http-like\nscheme http-push can't go to change url, because DAV must work only\nover HTTP (http and https scheme).\n\nSigned-off-by: Kirill A. Korinskiy <catap@catap.ru>\n---\n http-push.c |   17 ++++++++++++-----\n 1 files changed, 12 insertions(+), 5 deletions(-)\n\ndiff --git a/http-push.c b/http-push.c\nindex 5138224..79c8201 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -1486,16 +1486,23 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)\n \t\t\t}\n \t\t} else if (!strcmp(ctx->name, DAV_PROPFIND_NAME) && ctx->cdata) {\n \t\t\tchar *path = ctx->cdata;\n-\t\t\tif (*ctx->cdata == 'h') {\n-\t\t\t\tpath = strstr(path, \"//\");\n-\t\t\t\tif (path) {\n-\t\t\t\t\tpath = strchr(path+2, '/');\n-\t\t\t\t}\n+\n+\t\t\tif (!strncasecmp(ctx->cdata, \"http://\", sizeof(\"http://\") - 1)) {\n+\t\t\t\tpath = strchr(path + sizeof(\"http://\") - 1, '/');\n+\t\t\t} else if (!strncasecmp(ctx->cdata, \"https://\",\n+\t\t\t\t\t\tsizeof(\"https://\") - 1)) {\n+\t\t\t\tpath = strchr(path + sizeof(\"https://\") - 1, '/');\n+\t\t\t} else if (strstr(path, \"://\")) {\n+\t\t\t\tpath = NULL;\n \t\t\t}\n+\n \t\t\tif (path) {\n \t\t\t\tpath += repo->path_len;\n \t\t\t\tls->dentry_name = xstrdup(path);\n+\t\t\t} else {\n+\t\t\t\tfprintf(stderr, \"Not valid URI: %s\\n\", ctx->cdata);\n \t\t\t}\n+\n \t\t} else if (!strcmp(ctx->name, DAV_PROPFIND_COLLECTION)) {\n \t\t\tls->dentry_flags |= IS_DIR;\n \t\t}\n-- \n1.6.2\n"},{"id":"111202","messageId":"1239642037-20352-1-git-send-email-catap@catap.ru","threadId":"18846","inReplyTo":"1239626554-26206-1-git-send-email-catap@catap.ru","subject":"[PATCH] http-push.c: DAV must support only http and https scheme","fromName":"Kirill A. Korinskiy","fromEmail":"catap@catap.ru","sentAt":"2009-04-13T17:00:37Z","receivedAt":"2009-04-13T17:00:37Z","isPatch":true,"sender":{"key":"catap@catap.ru","avatar":"https://gravatar.com/avatar/ea0ab2c29579606bd684eccdf786c666f4425bedc4e599b698a175f12737b1c5?d=mp&s=160"},"body":"If the response from remote web-server have scp or other not http-like\nscheme http-push can't go to change url, because DAV must work only\nover HTTP (http and https scheme).\n\nSigned-off-by: Kirill A. Korinskiy <catap@catap.ru>\n---\n http-push.c |   17 ++++++++++++-----\n 1 files changed, 12 insertions(+), 5 deletions(-)\n\ndiff --git a/http-push.c b/http-push.c\nindex 5138224..79c8201 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -1486,16 +1486,23 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)\n \t\t\t}\n \t\t} else if (!strcmp(ctx->name, DAV_PROPFIND_NAME) && ctx->cdata) {\n \t\t\tchar *path = ctx->cdata;\n-\t\t\tif (*ctx->cdata == 'h') {\n-\t\t\t\tpath = strstr(path, \"//\");\n-\t\t\t\tif (path) {\n-\t\t\t\t\tpath = strchr(path+2, '/');\n-\t\t\t\t}\n+\n+\t\t\tif (!strncasecmp(ctx->cdata, \"http://\", sizeof(\"http://\") - 1)) {\n+\t\t\t\tpath = strchr(path + sizeof(\"http://\") - 1, '/');\n+\t\t\t} else if (!strncasecmp(ctx->cdata, \"https://\",\n+\t\t\t\t\t\tsizeof(\"https://\") - 1)) {\n+\t\t\t\tpath = strchr(path + sizeof(\"https://\") - 1, '/');\n+\t\t\t} else if (strstr(path, \"://\")) {\n+\t\t\t\tpath = NULL;\n \t\t\t}\n+\n \t\t\tif (path) {\n \t\t\t\tpath += repo->path_len;\n \t\t\t\tls->dentry_name = xstrdup(path);\n+\t\t\t} else {\n+\t\t\t\tfprintf(stderr, \"Not valid URI: %s\\n\", ctx->cdata);\n \t\t\t}\n+\n \t\t} else if (!strcmp(ctx->name, DAV_PROPFIND_COLLECTION)) {\n \t\t\tls->dentry_flags |= IS_DIR;\n \t\t}\n-- \n1.6.2\n"}]}