You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Brian Behlendorf <br...@hyperreal.com> on 1996/06/07 19:30:07 UTC

cvs commit: apache/src mod_imap.c

brian       96/06/07 10:30:07

  Modified:    src       mod_imap.c
  Log:
  Reviewed by:	Mark Cox
  
  This patches several things:
  
  1) brings back complete URL's in Location: headers
  2) makes the default "base" into the URI for the mapfile
     rather than ""
  3) pointinrect() now can take any two opposing corners in
     any order
  4) closes potential for an infinite loop in mod_imap.c
  5) if a mapfile isn't found, returns NOT_FOUND instead of SERVER_ERROR.
  
  Revision  Changes    Path
  1.8       +23 -6     apache/src/mod_imap.c
  
  Index: mod_imap.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_imap.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -C3 -r1.7 -r1.8
  *** mod_imap.c	1996/05/29 11:46:42	1.7
  --- mod_imap.c	1996/06/07 17:30:05	1.8
  ***************
  *** 105,110 ****
  --- 105,111 ----
    
    #define IMAP_MENU_DEFAULT "formatted"
    #define IMAP_DEFAULT_DEFAULT "nocontent"
  + #define IMAP_BASE_DEFAULT "map"
    
    #ifdef SUNOS4
    double strtod();   /* SunOS needed this */
  ***************
  *** 158,165 ****
    
    int pointinrect(double point[2], double coords[MAXVERTS][2])
    {
  !     return ((point[X] >= coords[0][X] && point[X] <= coords[1][X]) &&
  ! 	    (point[Y] >= coords[0][Y] && point[Y] <= coords[1][Y]));
    }
    
    int pointincircle(double point[2], double coords[MAXVERTS][2])
  --- 159,183 ----
    
    int pointinrect(double point[2], double coords[MAXVERTS][2])
    {
  !     double max[2], min[2];
  !     if (coords[0][X] > coords[1][X]) {
  !         max[0] = coords[0][X];
  !         min[0] = coords[1][X];
  !     } else {
  !         max[0] = coords[1][X];
  !         min[0] = coords[0][X];
  !     }
  ! 
  !     if (coords[0][Y] > coords[1][Y]) {
  !         max[1] = coords[0][Y];
  !         min[1] = coords[1][Y];
  !     } else {
  !         max[1] = coords[1][Y];
  !         min[1] = coords[0][Y];
  !     }
  ! 
  !     return ((point[X] >= min[0] && point[X] <= max[0]) &&
  ! 	    (point[Y] >= min[1] && point[Y] <= max[1]));
    }
    
    int pointincircle(double point[2], double coords[MAXVERTS][2])
  ***************
  *** 441,446 ****
  --- 459,465 ----
    	      if ((string_pos = strrchr(directory, '/')))
    		  *string_pos = '\0';
    	      clen = strlen (directory);
  + 	      if (clen == 0) break;
    	  }
    
    	  value += 2;      /* jump over the '..' that we found in the value */
  ***************
  *** 606,617 ****
      char *imap_default = icr->imap_default ? 
        icr->imap_default : IMAP_DEFAULT_DEFAULT;
      char *imap_base = icr->imap_base ?
  !     icr->imap_base : "";   /* "" gets treated as http://servername/ */
    
      FILE *imap = pfopen(r->pool, r->filename, "r"); 
    
      if ( ! imap ) 
  !     return SERVER_ERROR;
    
      imap_url(r, NULL, imap_base, base);       /* set base according to default */
      imap_url(r, NULL, imap_default, mapdflt); /* and default to global default */
  --- 625,636 ----
      char *imap_default = icr->imap_default ? 
        icr->imap_default : IMAP_DEFAULT_DEFAULT;
      char *imap_base = icr->imap_base ?
  !     icr->imap_base : IMAP_BASE_DEFAULT;
    
      FILE *imap = pfopen(r->pool, r->filename, "r"); 
    
      if ( ! imap ) 
  !     return NOT_FOUND;
    
      imap_url(r, NULL, imap_base, base);       /* set base according to default */
      imap_url(r, NULL, imap_default, mapdflt); /* and default to global default */
  ***************
  *** 632,639 ****
      if (showmenu) {        /* send start of imagemap menu if we're going to */
        menu_header(r, imap_menu);
      }
  - 
  -   imap_url(r, NULL, r->uri, base); /* Fake our base to allow relative URLs */
    
      while (!cfg_getline(input, LARGEBUF, imap)) {
        string_pos = input;   /* always start at the beginning of line */
  --- 651,656 ----