httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <field...@kiwi.ICS.UCI.EDU>
Subject escape_uri replacement
Date Sun, 01 Dec 1996 17:05:31 GMT
>> OK. The main reasons were that path escaping was platform dependent, at least
>> in theory, and that escape_uri() was broken.
> 
> crikey, then escape_uri() should have been removed and replaced with
> a #define macro for os_escape_path.  I'll do that.

Here is the new patch.  I want this (or something like it) applied before
1.2b1 goes out, so please test it now.  I tested it here, +1.

.....Roy

Index: httpd.h
===================================================================
RCS file: /export/home/cvs/apache/src/httpd.h,v
retrieving revision 1.64
diff -c -r1.64 httpd.h
*** httpd.h	1996/11/25 17:18:19	1.64
--- httpd.h	1996/12/01 17:02:28
***************
*** 636,642 ****
  void getparents(char *name);
  char *escape_path_segment(pool *p, const char *s);
  char *os_escape_path(pool *p,const char *path,int partial);
! char *escape_uri (pool *p, const char *s);
  extern char *escape_html(pool *p, const char *s);
  char *construct_server(pool *p, const char *hostname, int port);
  char *construct_url (pool *p, const char *path, const server_rec *s);     
--- 636,642 ----
  void getparents(char *name);
  char *escape_path_segment(pool *p, const char *s);
  char *os_escape_path(pool *p,const char *path,int partial);
! #define escape_uri(ppool,path) os_escape_path(ppool,path,1)
  extern char *escape_html(pool *p, const char *s);
  char *construct_server(pool *p, const char *hostname, int port);
  char *construct_url (pool *p, const char *path, const server_rec *s);     
Index: util.c
===================================================================
RCS file: /export/home/cvs/apache/src/util.c,v
retrieving revision 1.33
diff -c -r1.33 util.c
*** util.c	1996/12/01 13:44:22	1.33
--- util.c	1996/12/01 17:02:28
***************
*** 841,863 ****
    return copy;
  }
  
! char *escape_uri(pool *p, const char *uri) {
!     register int x,y;
!     char *copy = palloc (p, 3 * strlen (uri) + 1);
!             
!     for (x=0,y=0; uri[x]; x++,y++) {
!         if ((uri[x] <= ' ') || (ind("\"%&+<=>?", uri[x]) != -1)) {
!             c2x(uri[x],&copy[y]);
!             y+=2;
!         }
!         else copy[y] = uri[x];
!     }
!     copy[y] = '\0';
!     return copy;
! }
  
! char *
! escape_html(pool *p, const char *s)
  {
      int i, j;
      char *x;
--- 841,849 ----
    return copy;
  }
  
! /* escape_uri is now a macro for os_escape_path */
  
! char *escape_html(pool *p, const char *s)
  {
      int i, j;
      char *x;

Mime
View raw message