summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bcache.c9
-rw-r--r--url.c3
-rw-r--r--url.h1
3 files changed, 4 insertions, 9 deletions
diff --git a/bcache.c b/bcache.c
index 5b6d63ee..dbdc3467 100644
--- a/bcache.c
+++ b/bcache.c
@@ -57,7 +57,7 @@ static int bcache_path(ACCOUNT *account, const char *mailbox,
* if this ever changes, we have a memleak here
*/
url.path = NULL;
- if (url_ciss_tostring (&url, host, sizeof (host), 0) < 0)
+ if (url_ciss_tostring (&url, host, sizeof (host), U_PATH) < 0)
{
dprint (1, (debugfile, "bcache_path: URL to string failed\n"));
return -1;
@@ -65,13 +65,6 @@ static int bcache_path(ACCOUNT *account, const char *mailbox,
dprint (3, (debugfile, "bcache_path: URL: '%s'\n", host));
- /* transform URL scheme:// to scheme: */
- for (s = p = host; *s; s++)
- /* keep trailing slash */
- if (*s != '/' || *(s + 1) == '\0')
- *p++ = *s;
- *p = '\0';
-
len = snprintf (dst, dstlen-1, "%s/%s%s%s", MessageCachedir,
host, NONULL(mailbox),
(mailbox && *mailbox &&
diff --git a/url.c b/url.c
index 3e3c5a33..14a90241 100644
--- a/url.c
+++ b/url.c
@@ -184,7 +184,8 @@ int url_ciss_tostring (ciss_url_t* ciss, char* dest, size_t len, int flags)
if (ciss->host)
{
- safe_strcat (dest, len, "//");
+ if (!(flags & U_PATH))
+ safe_strcat (dest, len, "//");
len -= (l = strlen (dest)); dest += l;
if (ciss->user) {
diff --git a/url.h b/url.h
index cf9b4b46..926416e7 100644
--- a/url.h
+++ b/url.h
@@ -16,6 +16,7 @@ typedef enum url_scheme
url_scheme_t;
#define U_DECODE_PASSWD (1)
+#define U_PATH (1 << 1)
typedef struct ciss_url
{