httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@hyperreal.org
Subject cvs commit: apache-1.3/src/main util_uri.c
Date Wed, 15 Jul 1998 23:49:14 GMT
martin      98/07/15 16:49:14

  Modified:    src      CHANGES
               src/include util_uri.h
               src/main util_uri.c
  Log:
  Changes in util_uri::ap_unparse_uri_components() - new flags
  
  Revision  Changes    Path
  1.966     +4 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.965
  retrieving revision 1.966
  diff -u -u -r1.965 -r1.966
  --- CHANGES	1998/07/15 05:46:00	1.965
  +++ CHANGES	1998/07/15 23:49:09	1.966
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3.1
   
  +  *) Add new flags for ap_unparse_uri_components() to make it generate
  +     the scheme://sitepart string only, or to omit the query string.
  +     [Martin Kraemer]
  +
     *) WIN32: Canonicalize ServerRoot before checking to see if it
        is a valid directory.  The failure to do this caused certain
        ServerRoot settings (eg. "ServerRoot /apache") to be improperly
  
  
  
  1.11      +2 -0      apache-1.3/src/include/util_uri.h
  
  Index: util_uri.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/util_uri.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -u -r1.10 -r1.11
  --- util_uri.h	1998/07/12 20:37:29	1.10
  +++ util_uri.h	1998/07/15 23:49:12	1.11
  @@ -84,6 +84,8 @@
   #define	UNP_OMITPASSWORD	(1U<<2)	/* Just omit password */
   #define	UNP_OMITUSERINFO	(UNP_OMITUSER|UNP_OMITPASSWORD)	/* omit "user:password@" part
*/
   #define	UNP_REVEALPASSWORD	(1U<<3)	/* Show plain text password (default: show XXXXXXXX)
*/
  +#define UNP_OMITPATHINFO	(1U<<4)	/* Show "scheme://user@site:port" only */
  +#define UNP_OMITQUERY	        (1U<<5)	/* Omit the "?queryarg" from the path */
   
   typedef struct {
       char *scheme;		/* scheme ("http"/"ftp"/...) */
  
  
  
  1.22      +38 -29    apache-1.3/src/main/util_uri.c
  
  Index: util_uri.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/util_uri.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -u -r1.21 -r1.22
  --- util_uri.c	1998/07/05 14:21:18	1.21
  +++ util_uri.c	1998/07/15 23:49:13	1.22
  @@ -66,14 +66,16 @@
   
   /* Some WWW schemes and their default ports; this is basically /etc/services */
   /* This will become global when the protocol abstraction comes */
  +/* As the schemes are searched by a linear search, */
  +/* they are sorted by their expected frequency */
   static schemes_t schemes[] =
   {
  +    {"http",   DEFAULT_HTTP_PORT},
       {"ftp",    DEFAULT_FTP_PORT},
  +    {"https",  DEFAULT_HTTPS_PORT},
       {"gopher", DEFAULT_GOPHER_PORT},
  -    {"http",   DEFAULT_HTTP_PORT},
  -    {"nntp",   DEFAULT_NNTP_PORT},
       {"wais",   DEFAULT_WAIS_PORT},
  -    {"https",  DEFAULT_HTTPS_PORT},
  +    {"nntp",   DEFAULT_NNTP_PORT},
       {"snews",  DEFAULT_SNEWS_PORT},
       {"prospero", DEFAULT_PROSPERO_PORT},
       { NULL, 0xFFFF }			/* unknown port */
  @@ -169,35 +171,42 @@
   {
       char *ret = "";
   
  -    /* Construct a "user:password@" string, honoring the passed UNP_ flags: */
  -    if (uptr->user||uptr->password)
  -	ret = ap_pstrcat (p,
  -		(uptr->user     && !(flags & UNP_OMITUSER)) ? uptr->user : "",
  -		(uptr->password && !(flags & UNP_OMITPASSWORD)) ? ":" : "",
  -		(uptr->password && !(flags & UNP_OMITPASSWORD))
  -		   ? ((flags & UNP_REVEALPASSWORD) ? uptr->password : "XXXXXXXX")
  -		   : "",
  -		"@", NULL);
  +    /* If suppressing the site part, omit both user name & scheme://hostname */
  +    if (!(flags & UNP_OMITSITEPART)) {
   
  -    /* Construct scheme://site string */
  -    if (uptr->hostname && !(flags & UNP_OMITSITEPART)) {
  -	ret = ap_pstrcat (p,
  -		uptr->scheme, "://", ret, 
  -		uptr->hostname ? uptr->hostname : "",
  -		       uptr->port_str ? ":" : "",
  -		       uptr->port_str ? uptr->port_str : "",
  -		       NULL);
  +	/* Construct a "user:password@" string, honoring the passed UNP_ flags: */
  +	if (uptr->user||uptr->password)
  +	    ret = ap_pstrcat (p,
  +			(uptr->user     && !(flags & UNP_OMITUSER)) ? uptr->user : "",
  +			(uptr->password && !(flags & UNP_OMITPASSWORD)) ? ":" : "",
  +			(uptr->password && !(flags & UNP_OMITPASSWORD))
  +			   ? ((flags & UNP_REVEALPASSWORD) ? uptr->password : "XXXXXXXX")
  +			   : "",
  +			"@", NULL);
  +
  +	/* Construct scheme://site string */
  +	if (uptr->hostname) {
  +	    ret = ap_pstrcat (p,
  +			uptr->scheme, "://", ret, 
  +			uptr->hostname ? uptr->hostname : "",
  +			uptr->port_str ? ":" : "",
  +			uptr->port_str ? uptr->port_str : "",
  +			NULL);
  +	}
       }
   
  -    /* Append path, query and fragment strings: */
  -    ret = ap_pstrcat (p,
  -		   ret,
  -		   uptr->path ? uptr->path : "",
  -		   uptr->query ? "?" : "",
  -		   uptr->query ? uptr->query : "",
  -		   uptr->fragment ? "#" : NULL,
  -		   uptr->fragment ? uptr->fragment : NULL,
  -		   NULL);
  +    /* Should we suppress all path info? */
  +    if (!(flags & UNP_OMITPATHINFO)) {
  +	/* Append path, query and fragment strings: */
  +	ret = ap_pstrcat (p,
  +		ret,
  +		uptr->path ? uptr->path : "",
  +		(uptr->query    && !(flags & UNP_OMITQUERY)) ? "?" : "",
  +		(uptr->query    && !(flags & UNP_OMITQUERY)) ? uptr->query : "",
  +		(uptr->fragment && !(flags & UNP_OMITQUERY)) ? "#" : NULL,
  +		(uptr->fragment && !(flags & UNP_OMITQUERY)) ? uptr->fragment : NULL,
  +		NULL);
  +    }
       return ret;
   }
   
  
  
  

Mime
View raw message