Re: libwww bug report

If the list is the appropriate place for bug fixes, then I have a simple
one for HTParse.c . HTSimplify incorrect simplifies file url of the form
file:/path1/../path2/file.  The resulting url is file:/ppath2/file .

Attached is a patch and a small fragment of code that invokes the problem.



James


Henrik Frystyk Nielsen wrote:

> Hi Takuya.
>
> If you send a patch to the <www-lib@w3.org> mailing list then I am sure
> that it can make it into the code base.
>
> Thanks,
>
> Henrik Frystyk Nielsen,
> mailto:frystyk@microsoft.com
> ----- Original Message -----
> From: "T.Nakashima" <asuka01@mbox.kyoto-inet.or.jp>
> To: <frystyk@microsoft.com>
> Sent: Monday, September 20, 1999 04:06
> Subject: libwww bug report
>
> > Dear Henrik Frystyk Nielsen.
> >
> > Please forgive my boldness in writing to you for the first time.
> >
> > It is reported because a bug was discovered in Libwww.
> >
> > When HTProfile_newPreemptiveClient is used with Windows
> > without a WWW_WIN_ASYNC option, HTEventInit is not called.
> > Therefore WSAStartup is not called and an error happens when
> > it tries to connect it.
> >
> > I hope this mail becomes the reference of the future development.
> >
> >
> > Best regards,
> >
> > Takuya Nakashima( I can understand English little.)
> > asuka01@mbox.kyoto-inet.or.jp
> >
#include <iostream>

#include "WWWCore.h"
#include "HTParse.h"

int main(){

  char buff[255] = "file:/path1/../path2/path3/../file";

  char *buffPtr = buff; 

  cerr << buff <<endl;

  buffPtr = HTSimplify( &buffPtr );

  cerr << buffPtr << endl;

  return(0);

}
--- /home/james/libwww/Library/src/HTParse.c	Tue Feb 23 12:30:09 1999
+++ ./Library/src/HTParse.c	Mon Aug 23 08:39:20 1999
@@ -405,7 +405,9 @@
 		    char *q = p;
 		    while (q>path && *--q!='/');	       /* prev slash */
 		    if (strncmp(q, "/../", 4)) {
-			char *orig = q+1;
+		        /*orginal char *orig = q+1; */ 
+                        /*appears to be a bug changed 17/8/1999 */
+		        char *orig = (*(q)=='/') ? q+1 : q; 
 			char *dest = (*(p+3)!='/') ? p+3 : p+4;
 			while ((*orig++ = *dest++));	   /* Remove /xxx/.. */
 			end = orig-1;

Received on Monday, 20 September 1999 20:14:34 UTC