Diff for /XML/uri.c between versions 1.17 and 1.18

version 1.17, 2000/09/04 10:58:55 version 1.18, 2000/09/05 10:07:37
Line 1470  xmlBuildURI(const xmlChar *URI, const xm Line 1470  xmlBuildURI(const xmlChar *URI, const xm
     /*      /*
      * 1) The URI reference is parsed into the potential four components and       * 1) The URI reference is parsed into the potential four components and
      *    fragment identifier, as described in Section 4.3.       *    fragment identifier, as described in Section 4.3.
        *
        *    NOTE that a completely empty URI is treated by modern browsers
        *    as a reference to "." rather than as a synonym for the current
        *    URI.  Should we do that here?
      */       */
     ref = xmlCreateURI();      ref = xmlCreateURI();
     if (ref == NULL)      if (ref == NULL)
Line 1489  xmlBuildURI(const xmlChar *URI, const xm Line 1493  xmlBuildURI(const xmlChar *URI, const xm
     /*      /*
      * 2) If the path component is empty and the scheme, authority, and       * 2) If the path component is empty and the scheme, authority, and
      *    query components are undefined, then it is a reference to the       *    query components are undefined, then it is a reference to the
      *    current document.  However, since we need to inherit these       *    current document and we are done.  Otherwise, the reference URI's
      *    values from the base, we keep on going.       *    query and fragment components are defined as found (or not found)
        *    within the URI reference and not inherited from the base URI.
      *       *
      *  NOTE: this is a divergence from the RFC which says:       *    NOTE that in modern browsers, the parsing differs from the above
      *     current document and we are done.  Otherwise, the reference URI's       *    in the following aspect:  the query component is allowed to be
      *     query and fragment components are defined as found (or not found)       *    defined while still treating this as a reference to the current
      *     within the URI reference and not inherited from the base URI.       *    document.
      */       */
     res = xmlCreateURI();      res = xmlCreateURI();
     if (res == NULL)      if (res == NULL)
         goto done;          goto done;
 #if 0  
     if ((ref->scheme == NULL) && (ref->path == NULL) &&      if ((ref->scheme == NULL) && (ref->path == NULL) &&
         ((ref->authority == NULL) && (ref->server == NULL)) &&          ((ref->authority == NULL) && (ref->server == NULL))) {
         (ref->query == NULL)) {          if (bas->scheme != NULL)
         if (ref->fragment == NULL)              res->scheme = xmlMemStrdup(bas->scheme);
             goto done;          if (bas->authority != NULL)
         res->fragment = xmlMemStrdup(ref->fragment);              res->authority = xmlMemStrdup(bas->authority);
         val = xmlSaveUri(res);          else if (bas->server != NULL) {
         goto done;              res->server = xmlMemStrdup(bas->server);
               if (bas->user != NULL)
                   res->user = xmlMemStrdup(bas->user);
               res->port = bas->port;              
           }
           if (bas->path != NULL)
               res->path = xmlMemStrdup(bas->path);
           if (ref->query != NULL)
               res->query = xmlMemStrdup(ref->query);
           else if (bas->query != NULL)
               res->query = xmlMemStrdup(bas->query);
           if (ref->fragment != NULL)
               res->fragment = xmlMemStrdup(ref->fragment);
           goto step_7;
     }      }
 #endif  
     
       if (ref->query != NULL)
           res->query = xmlMemStrdup(ref->query);
       if (ref->fragment != NULL)
           res->fragment = xmlMemStrdup(ref->fragment);
   
     /*      /*
      * 3) If the scheme component is defined, indicating that the reference       * 3) If the scheme component is defined, indicating that the reference
Line 1544  xmlBuildURI(const xmlChar *URI, const xm Line 1564  xmlBuildURI(const xmlChar *URI, const xm
         }          }
         if (ref->path != NULL)          if (ref->path != NULL)
             res->path = xmlMemStrdup(ref->path);              res->path = xmlMemStrdup(ref->path);
         if (ref->query != NULL)  
             res->query = xmlMemStrdup(ref->query);  
         if (ref->fragment != NULL)  
             res->fragment = xmlMemStrdup(ref->fragment);  
         goto step_7;          goto step_7;
     }      }
     if (bas->authority != NULL)      if (bas->authority != NULL)
Line 1562  xmlBuildURI(const xmlChar *URI, const xm Line 1578  xmlBuildURI(const xmlChar *URI, const xm
     /*      /*
      * 5) If the path component begins with a slash character ("/"), then       * 5) If the path component begins with a slash character ("/"), then
      *    the reference is an absolute-path and we skip to step 7.       *    the reference is an absolute-path and we skip to step 7.
      *       */
      *    If it is not defined, inherit the whole path from the base.      if ((ref->path != NULL) && (ref->path[0] == '/')) {
      *    The query and the fragment are inherited too, unless specified  
      *    in the reference.  
      */  
     if (ref->path == NULL) {  
         res->path = xmlMemStrdup(bas->path);  
         if (ref->query == NULL && ref->fragment == NULL) {  
             if (bas->query != NULL)  
                 res->query = xmlMemStrdup(bas->query);  
             if (bas->fragment != NULL)  
                 res->fragment = xmlMemStrdup(bas->fragment);  
         } else {  
             if (ref->query != NULL)  
                 res->query = xmlMemStrdup(ref->query);  
             if (ref->fragment != NULL)  
                 res->fragment = xmlMemStrdup(ref->fragment);  
         }  
         goto step_7;  
     }  
     if (ref->path[0] == '/') {  
         res->path = xmlMemStrdup(ref->path);          res->path = xmlMemStrdup(ref->path);
         if (ref->query != NULL)  
             res->query = xmlMemStrdup(ref->query);  
         if (ref->fragment != NULL)  
             res->fragment = xmlMemStrdup(ref->fragment);  
         goto step_7;          goto step_7;
     }      }
   
Line 1659  xmlBuildURI(const xmlChar *URI, const xm Line 1652  xmlBuildURI(const xmlChar *URI, const xm
      */       */
     xmlNormalizeURIPath(res->path);      xmlNormalizeURIPath(res->path);
   
     if (ref->query != NULL)  
         res->query = xmlMemStrdup(ref->query);  
     if (ref->fragment != NULL)  
         res->fragment = xmlMemStrdup(ref->fragment);  
   
 step_7:  step_7:
   
     /*      /*

Removed from v.1.17  
changed lines
  Added in v.1.18


Webmaster