dovecot-2.2: lib-http: url: Implemented functions to copy/clone ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Aug 18 18:02:36 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/c1ffec72a134
changeset: 18964:c1ffec72a134
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Tue Aug 18 20:39:24 2015 +0300
description:
lib-http: url: Implemented functions to copy/clone URLs including the userinfo part (normally skipped).

diffstat:

 src/lib-http/http-url.c |  22 +++++++++++++++++++++-
 src/lib-http/http-url.h |   5 +++++
 2 files changed, 26 insertions(+), 1 deletions(-)

diffs (55 lines):

diff -r 07ceb84bf899 -r c1ffec72a134 src/lib-http/http-url.c
--- a/src/lib-http/http-url.c	Tue Aug 18 20:39:24 2015 +0300
+++ b/src/lib-http/http-url.c	Tue Aug 18 20:39:24 2015 +0300
@@ -450,7 +450,15 @@
 	dest->enc_fragment = p_strdup(pool, src->enc_fragment);
 }
 
-struct http_url *http_url_clone(pool_t pool,const struct http_url *src)
+void http_url_copy_with_userinfo(pool_t pool, struct http_url *dest,
+	const struct http_url *src)
+{
+	http_url_copy(pool, dest, src);
+	dest->user = p_strdup(pool, src->user);
+	dest->password = p_strdup(pool, src->password);
+}
+
+struct http_url *http_url_clone(pool_t pool, const struct http_url *src)
 {
 	struct http_url *new_url;
 
@@ -460,6 +468,18 @@
 	return new_url;
 }
 
+struct http_url *http_url_clone_with_userinfo(pool_t pool,
+	const struct http_url *src)
+{
+	struct http_url *new_url;
+
+	new_url = p_new(pool, struct http_url, 1);
+	http_url_copy_with_userinfo(pool, new_url, src);
+
+	return new_url;
+}
+
+
 /*
  * HTTP URL construction
  */
diff -r 07ceb84bf899 -r c1ffec72a134 src/lib-http/http-url.h
--- a/src/lib-http/http-url.h	Tue Aug 18 20:39:24 2015 +0300
+++ b/src/lib-http/http-url.h	Tue Aug 18 20:39:24 2015 +0300
@@ -59,7 +59,12 @@
 	const struct http_url *src);
 void http_url_copy(pool_t pool, struct http_url *dest,
 	const struct http_url *src);
+void http_url_copy_with_userinfo(pool_t pool, struct http_url *dest,
+	const struct http_url *src);
+
 struct http_url *http_url_clone(pool_t pool,const struct http_url *src);
+struct http_url *http_url_clone_with_userinfo(pool_t pool,
+	const struct http_url *src);
 
 /*
  * HTTP URL construction


More information about the dovecot-cvs mailing list