---- orig/main.c 2005-01-10 00:22:54
-+++ main.c 2004-10-08 20:15:28
-@@ -56,6 +56,9 @@ extern int write_batch;
- extern int batch_fd;
- extern int batch_gen_fd;
- extern int filesfrom_fd;
-+#ifdef HAVE_OPENSSL
-+extern int use_ssl;
-+#endif
- extern pid_t cleanup_child_pid;
- extern char *files_from;
- extern char *remote_filesfrom_file;
-@@ -806,33 +809,48 @@ static int start_client(int argc, char *
- if ((rc = copy_argv(argv)))
- return rc;
-
-- /* rsync:// always uses rsync server over direct socket connection */
-- if (strncasecmp(URL_PREFIX, argv[0], strlen(URL_PREFIX)) == 0
-- && !read_batch) {
-- char *host, *path;
-+ if (!read_batch) { /* for read_batch, NO source is specified */
-+ int url_prefix_len = sizeof URL_PREFIX - 1;
-
-- host = argv[0] + strlen(URL_PREFIX);
-- 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';
-+ /* rsync:// always uses rsync server over direct socket connection */
-+ if (strncasecmp(URL_PREFIX, argv[0], url_prefix_len) != 0) {
-+#ifdef HAVE_OPENSSL
-+ url_prefix_len = sizeof SSL_URL_PREFIX - 1;
-+ if (strncasecmp(SSL_URL_PREFIX, argv[0], url_prefix_len) != 0)
-+ url_prefix_len = 0;
-+ else {
-+ if (!use_ssl)
-+ init_tls();
-+ use_ssl = 1;
-+ }
-+#else
-+ url_prefix_len = 0;
-+#endif
-+ }
-+ 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
-@@ -864,12 +882,26 @@ static int start_client(int argc, char *
- argv++;
- } else { /* source is local */
- am_sender = 1;
--
-+ url_prefix_len = sizeof URL_PREFIX - 1;
- /* rsync:// destination uses rsync server over direct socket */
-- if (strncasecmp(URL_PREFIX, argv[argc-1], strlen(URL_PREFIX)) == 0) {
-+ if (strncasecmp(URL_PREFIX, argv[argc-1], url_prefix_len) != 0) {
-+#ifdef HAVE_OPENSSL
-+ url_prefix_len = sizeof SSL_URL_PREFIX - 1;
-+ if (strncasecmp(SSL_URL_PREFIX, argv[argc-1], url_prefix_len) != 0)
-+ url_prefix_len = 0;
-+ else {
-+ if (!use_ssl)
-+ init_tls();
-+ use_ssl = 1;
-+ }
-+#else
-+ url_prefix_len = 0;
-+#endif
-+ }
-+ if (url_prefix_len) {
- char *host, *path;
-
-- host = argv[argc-1] + strlen(URL_PREFIX);
-+ host = argv[argc-1] + url_prefix_len;
- p = strchr(host,'/');
- if (p) {
- *p = '\0';
---- orig/options.c 2005-01-01 21:11:00
-+++ options.c 2004-11-27 18:31:46
-@@ -138,6 +138,14 @@ int quiet = 0;