-+ }
- /* rsync:// always uses rsync server over direct socket connection */
-- if (strncasecmp(URL_PREFIX, argv[0], strlen(URL_PREFIX)) == 0) {
-+ if (url_prefix) {
- char *host, *path;
-
-- host = argv[0] + strlen(URL_PREFIX);
-+ host = argv[0] + url_prefix;
- p = strchr(host,'/');
- if (p) {
- *p = 0;
-@@ -767,12 +785,27 @@ static int start_client(int argc, char *
++ }
++ if (url_prefix_len) {
++ char *host, *path;
++
++ host = argv[0] + url_prefix_len;
++ p = strchr(host,'/');
++ if (p) {
++ *p = '\0';
++ path = p+1;
++ } else
++ path = "";
++ if (*host == '[' && (p = strchr(host, ']')) != NULL) {
++ host++;
++ *p++ = '\0';
++ if (*p != ':')
++ p = NULL;
++ } else
++ p = strchr(host, ':');
++ if (p) {
++ rsync_port = atoi(p+1);
++ *p = '\0';
++ }
++ return start_socket_client(host, path, argc-1, argv+1);
+ }
+- return start_socket_client(host, path, argc-1, argv+1);
+- }
+
+- if (!read_batch) { /* for read_batch, NO source is specified */
+ p = find_colon(argv[0]);
+ if (p) { /* source is remote */
+ if (remote_filesfrom_file
+@@ -866,12 +884,26 @@ static int start_client(int argc, char *