apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject [patch] handling the missing scheme in uri unparse
Date Tue, 18 Feb 2003 07:57:56 GMT
the uri unparse code wasn't properly ported from 1.0. The default scheme was 
dropped on the floor, now causing segfaults. In order to stay back compatible 
with 1.0 code the following patch should be applied.

In order to avoid segfaults, and break backcompat, the code should at least do:
         /* Construct scheme://site string */
         if (uptr->hostname && uptr->scheme) {

and not just if (uptr->hostname)


Index: srclib/apr-util/include/apr_uri.h
===================================================================
RCS file: /home/cvspublic/apr-util/include/apr_uri.h,v
retrieving revision 1.15
diff -u -r1.15 apr_uri.h
--- srclib/apr-util/include/apr_uri.h	1 Jan 2003 00:02:20 -0000	1.15
+++ srclib/apr-util/include/apr_uri.h	18 Feb 2003 07:55:53 -0000
@@ -101,6 +101,8 @@
  #define APR_URI_TIP_DEFAULT_PORT       3372 /**< default TIP port */
  #define APR_URI_SIP_DEFAULT_PORT       5060 /**< default SIP port */

+#define APR_URI_DEFAULT_SCHEME "http"
+
  /** Flags passed to unparse_uri_components(): */
  /** suppress "scheme://user@site:port" */
  #define APR_URI_UNP_OMITSITEPART    (1U<<0)
Index: srclib/apr-util/uri/apr_uri.c
===================================================================
RCS file: /home/cvspublic/apr-util/uri/apr_uri.c,v
retrieving revision 1.16
diff -u -r1.16 apr_uri.c
--- srclib/apr-util/uri/apr_uri.c	1 Jan 2003 00:02:22 -0000	1.16
+++ srclib/apr-util/uri/apr_uri.c	18 Feb 2003 07:55:53 -0000
@@ -167,6 +167,10 @@
                  rbrk = "]";
              }

+            if (!uptr->scheme) {
+                uptr->scheme = APR_URI_DEFAULT_SCHEME;
+            }
+
              is_default_port =
                  (uptr->port_str == NULL ||
                   uptr->port == 0 ||

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Mime
View raw message