httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_rewrite.c
Date Mon, 28 Jul 2003 22:48:52 GMT
nd          2003/07/28 15:48:51

  Modified:    modules/mappers mod_rewrite.c
  Log:
  cleanup fully_qualify_uri function
  
  Revision  Changes    Path
  1.195     +10 -22    httpd-2.0/modules/mappers/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
  retrieving revision 1.194
  retrieving revision 1.195
  diff -u -r1.194 -r1.195
  --- mod_rewrite.c	28 Jul 2003 21:59:43 -0000	1.194
  +++ mod_rewrite.c	28 Jul 2003 22:48:51 -0000	1.195
  @@ -769,33 +769,21 @@
    */
   static void fully_qualify_uri(request_rec *r)
   {
  -    char buf[32];
  -    const char *thisserver;
  -    char *thisport;
  -    int port;
  -
       if (!is_absolute_uri(r->filename)) {
  +        const char *thisserver;
  +        char *thisport;
  +        int port;
   
           thisserver = ap_get_server_name(r);
           port = ap_get_server_port(r);
  -        if (ap_is_default_port(port,r)) {
  -            thisport = "";
  -        }
  -        else {
  -            apr_snprintf(buf, sizeof(buf), ":%u", port);
  -            thisport = buf;
  -        }
  +        thisport = ap_is_default_port(port, r)
  +                   ? ""
  +                   : apr_psprintf(r->pool, ":%u", port);
   
  -        if (r->filename[0] == '/') {
  -            r->filename = apr_psprintf(r->pool, "%s://%s%s%s",
  -                                       ap_http_method(r), thisserver,
  -                                       thisport, r->filename);
  -        }
  -        else {
  -            r->filename = apr_psprintf(r->pool, "%s://%s%s/%s",
  -                                       ap_http_method(r), thisserver,
  -                                       thisport, r->filename);
  -        }
  +        r->filename = apr_psprintf(r->pool, "%s://%s%s%s%s",
  +                                   ap_http_method(r), thisserver, thisport,
  +                                   (*r->filename == '/') ? "" : "/",
  +                                   r->filename);
       }
   
       return;
  
  
  

Mime
View raw message