apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Travis <jtra...@covalent.net>
Subject [PATCH] apr_uri_unparse_components
Date Thu, 19 Jul 2001 00:22:13 GMT
It is possible unparse a URI into something like:
"http://@foo.bar.com", if a username or password is given, and
the OMITUSER and OMITPASSWORD fields are blank.  This should
do the job (though that section of the code is particularly
ugly).


-- Jon


Index: apr_uri.c
===================================================================
RCS file: /home/cvspublic/apr-util/uri/apr_uri.c,v
retrieving revision 1.6
diff -u -u -r1.6 apr_uri.c
--- apr_uri.c	2001/06/13 22:56:23	1.6
+++ apr_uri.c	2001/07/19 00:14:53
@@ -139,7 +139,9 @@
 			(uptr->password && !(flags & UNP_OMITPASSWORD))
 			   ? ((flags & UNP_REVEALPASSWORD) ? uptr->password : "XXXXXXXX")
 			   : "",
-			"@", NULL);
+			(uptr->user && !(flags & UNP_OMITUSER) ||
+			 uptr->password && !(flags & UNP_OMITPASSWORD)) ? "@" 
+			 : "", NULL);
 
 	/* Construct scheme://site string */
 	if (uptr->hostname) {

Mime
View raw message