get-url with "list debug" option is buggy

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
kosh
Posts: 72
Joined: Sun Sep 13, 2009 5:38 am
Location: Japan
Contact:

get-url with "list debug" option is buggy

Post by kosh »

Code: Select all

newLISP v.10.2.4 on Linux IPv4 UTF-8, execute 'newlisp -h' for more info.

> ; "list" option works well.
> (read-file "[url]http://www.newlisp.org/example.lsp[/url]" "list")
("Last-Modified: Tue, 01 Jul 2008 13:54:24 GMT\r\nAccept-Ranges: bytes\r\nContent-Length: 58\r\nContent-Type: text/plain\r\nDate: Fri, 30 Apr 2010 13:06:12 GMT\r\nServer: Apache\r\nETag: \"c018d4-3a-486a3710\"\r\nVia: 1.1 vhost.phx3.nearlyfreespeech.net:3128 (squid/2.7.STABLE7)\r\nConnection: close\r\n\r\n" 
 "; example program\n\n(println \"Welcome to newLISP\")\n(exit)\n\n")

> ; "list debug" option returns string (not a list)
> (read-file "http://www.newlisp.org/example.lsp" "list debug")
"; example program\n\n(println \"Welcome to newLISP\")\n(exit)\n\n"
Here is patch:

Code: Select all

--- nl-web.c	2010-04-30 21:46:04.000000000 +0900
+++ nl-web.c~	2010-04-19 07:29:17.000000000 +0900
@@ -349,15 +349,15 @@
     option = (char *)result->contents;    
     if(my_strnicmp(option, "header", 6) == 0)
       headRequest = TRUE;
-    if(my_strnicmp(option, "list", 4) == 0)
+    if(my_strnicmp(option, "list", 5) == 0)
       listFlag = TRUE;
     /* "debug" or "header debug" or "list-debug" options
        print all outgoing informatiopn on the console */	
 	if(my_strnicmp(option, "debug", 5) == 0)
       debugFlag = TRUE;
-	if(my_strnicmp(option + 7, "debug", 5) == 0) /* "header debug" */
+	if(my_strnicmp(option + 7, "debug", 5) == 0)
       debugFlag = TRUE;
-	if(my_strnicmp(option + 5, "debug", 5) == 0) /* "list debug" */
+	if(my_strnicmp(option + 6, "debug", 5) == 0)
       debugFlag = TRUE;
     if(params != nilCell)
         params = getInteger(params, (UINT*)&socketTimeout);

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: get-url with "list debug" option is buggy

Post by Lutz »

Thanks Kosh.

Locked