Re: Compile problem (and possible fix)
On 7 Nov 2001, at 23:07, Hack Kampbjørn wrote: > Ed Powell wrote: > > I had to change: > > > > assert (ch == '\'' || ch == '"'); > > > > to: > > > > assert (ch == '\'' || ch == '\"'); > > > > Otherwise, it would not compile... it was, I think, interpreting the ", > > rather than using it literally. Escaping it appears to have fixed the > > problem. > > Right conclusion, wrong fix. Fix the broken software not the correct > one, i.e. your fix breaks wget on another broken platform (read the > below links if cannot guess which). You don't want to use Apple's > precompiler anyway. Agreed that you don't want to use Apple's precompiler, but I couldn't tell from the links you posted what platform the "fix" fails to compile on. There was one reference to VC++ 5.0 breaking, but that was for the "unfixed" version.
New option for wget
Hello, I'm using wget a lot for my work, but there is one option which is actually missing : to be able to override the Host: HTTP header in a request. This option is usefull to query a specific machine (in a web farm) by its IP address, while giving the virtual host in the Host: header. I have added this option to the 1.7 source, here is the patch file: diff -Naur wget-1.7.orig/src/http.c wget-1.7/src/http.c --- wget-1.7.orig/src/http.cSun May 27 22:35:02 2001 +++ wget-1.7/src/http.c Thu Nov 08 16:23:46 2001 @@ -831,7 +831,7 @@ Host: %s%s\r\n\ Accept: %s\r\n\ %s%s%s%s%s%s%s%s\r\n", - command, path, useragent, remhost, + command, path, useragent, opt.http_host ? opt.http_host : remhost, port_maybe ? port_maybe : "", HTTP_ACCEPT, request_keep_alive ? request_keep_alive : "", diff -Naur wget-1.7.orig/src/init.c wget-1.7/src/init.c --- wget-1.7.orig/src/init.cSun May 27 22:35:04 2001 +++ wget-1.7/src/init.c Thu Nov 08 16:34:00 2001 @@ -131,6 +131,7 @@ { "header", NULL, cmd_spec_header }, { "htmlextension", &opt.html_extension,cmd_boolean }, { "htmlify", NULL, cmd_spec_htmlify }, + { "httphost",&opt.http_host, cmd_string }, { "httpkeepalive", &opt.http_keep_alive, cmd_boolean }, { "httppasswd", &opt.http_passwd, cmd_string }, { "httpproxy", &opt.http_proxy,cmd_string }, @@ -1086,6 +1087,7 @@ FREE_MAYBE (opt.http_user); FREE_MAYBE (opt.http_passwd); FREE_MAYBE (opt.user_header); + FREE_MAYBE (opt.http_host); #ifdef HAVE_SSL FREE_MAYBE (opt.sslcertkey); FREE_MAYBE (opt.sslcertfile); diff -Naur wget-1.7.orig/src/main.c wget-1.7/src/main.c --- wget-1.7.orig/src/main.cSun May 27 22:35:06 2001 +++ wget-1.7/src/main.c Thu Nov 08 16:20:48 2001 @@ -188,6 +188,7 @@ -E, --html-extension save all text/html documents with .html extension.\n\ --ignore-length ignore `Content-Length\' header field.\n\ --header=STRING insert STRING among the headers.\n\ + --http-host=STRINGoverride Host header with STRING.\n\ --proxy-user=USER set USER as proxy username.\n\ --proxy-passwd=PASS set PASS as proxy password.\n\ --referer=URL include `Referer: URL\' header in HTTP request.\n\ @@ -302,6 +303,7 @@ { "htmlify", required_argument, NULL, 135 }, { "http-passwd", required_argument, NULL, 130 }, { "http-user", required_argument, NULL, 129 }, +{ "http-host", required_argument, NULL, 163 }, { "ignore-tags", required_argument, NULL, 'G' }, { "include-directories", required_argument, NULL, 'I' }, { "input-file", required_argument, NULL, 'i' }, @@ -528,6 +530,9 @@ break; case 162: setval ("savecookies", optarg); + break; + case 163: + setval ("httphost", optarg); break; case 157: setval ("referer", optarg); diff -Naur wget-1.7.orig/src/options.h wget-1.7/src/options.h --- wget-1.7.orig/src/options.h Sun May 27 22:35:08 2001 +++ wget-1.7/src/options.h Thu Nov 08 16:17:34 2001 @@ -86,6 +86,7 @@ int ftp_glob;/* FTP globbing */ int ftp_pasv;/* Passive FTP. */ + char *http_host; /* HTTP host header value */ char *http_user; /* HTTP user. */ char *http_passwd; /* HTTP password. */ char *user_header; /* User-defined header(s). */ Is it possible to import this change ? Best regards, Georges - Georges Menie - [EMAIL PROTECTED] Senior Integration Consultant Akamai Technologies France Cel: +33 6 61 78 31 41 Tel: +33 1 56 97 30 23 Fax: +33 1 56 97 30 01
Bug in wget 1.7 & prev init.c: wgetrc environment var
In wget 1.7 and 1.6, if the WGETRC environment variable is set but the file specified is inaccessible, the message: wget: (null): No such file or directory. is displayed and the program exits with status 1. Debugging traces the problem to the following function in init.c (ca. line 261) /* Return the path to the user's .wgetrc. This is either the value of `WGETRC' environment variable, or `$HOME/.wgetrc'. If the `WGETRC' variable exists but the file does not exist, the function will exit(). */ static char * wgetrc_file_name (void) { char *env, *home; char *file = NULL; /* Try the environment. */ env = getenv ("WGETRC"); if (env && *env) { if (!file_exists_p (env)) { fprintf (stderr, "%s: %s: %s.\n", exec_name, file, strerror (errno)); exit (1); } return xstrdup (env); } where the error message is printed Firstly, file is a null pointer at the time that this error message is printed; env is the correct pointer to use here. Secondly, there is no explanation of why the program is looking for this file. A possible fix is as follows: 278c278 < fprintf (stderr, "%s: Unable to access WGETRC specified in environment: %s: %s.\n", exec_name, env, strerror (errno)); --- > fprintf (stderr, "%s: %s: %s.\n", exec_name, file, strerror (errno)); the resultant output is now (when WGETRC is set to c:\.wgetrc, and this file doesn't exist): wget: Unable to access WGETRC specified in environment: c:\.wgetrc: No such file or directory. Note: debugging and patching was done with version 1.6 source. I have upgraded my executable to 1.7 and the bug still exists, but I haven't obtained the source code to see if there are any changes in this function between ver 1.6 and 1.7. Warm Regards, Chris
A question for use wget!
hi administrator; how can i use the speed limited with wget? ¼Óн£¬ÉýÖ°ÃÜóÅ http://www.englishtown.com/master/home/courseoverview.asp?etag=TOCN&ctr=cn === ÊÖ»úºÅÂëÊǵçÓÊ£¬´Ó´Ë½»·Ñ²»ÓóһºÅÔÚÊÖ¡°ËæÉíÓÊ¡± ¡ª¡ª 163¡°ËæÉíÓÊ¡±ÊÖ»úÓÊÏä ¡ª¡ª ¡ò ÊÖ»úºÅÂë¾ÍÊǵç×ÓÓÊÏäµØÖ·£¬·½±ã¼ÇÒä ¡ò ²»ÓÃÉÏÍø£¬Í¸¹ýÊÖ»ú¶ÌÐÅ£¬ËæʱÕÆÎÕÓʼþµÄ½ÓÊÕÇé¿ö ¡ò ¾ö²»´í¹ýÈκÎÉÌÒµÁ¼»ú ¡ò ·½±ãµÄ°´ÔÂÊÕ·Ñ·½Ê½£¬×îµÍÿÔÂÖ»Ðè5Ôª ÏêÇéÇëä¯ÀÀ http://vip.163.net/mobile/mobile.htm ===
WGET: core dump in 1.7 and latest CVS?
Hi, With the latest CVS version of wget (and the 1.7 distribution) is there a known reason and fix why wget core dumps on the following site? ./wget -nh -nH -r -N -nr -l0 -k -K --debug -X /cgi-bin \ -R.pdf,.exe,.zip -np http://www.bk.psu.edu/faculty/litvin/ --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ Converting faculty/litvin/Download.html... done. Converting faculty/litvin/index.html... done. FINISHED --15:01:55-- Downloaded: 9,623,116 bytes in 35 files Converting faculty/litvin/index.html... Segmentation fault (core dumped) sv1 230% --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ Without sending the entire debug information: the offending part seems to be : newpath: /faculty/litvin/Cv.html http://www.bk.psu.edu/faculty/litvin/Cv.html marked for conversion, local facult y/litvin/Cv.html Converting faculty/litvin/index.html... TO_RELATIVE: http://www.bk.psu.edu/facul ty/litvin/Dr__D.JPG to Dr__D.JPG at position 414 in faculty/litvin/index.html. Segmentation fault (core dumped) --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ Lachlan. -- --- Lachlan M. D. Cranswick Collaborative Computational Project No 14 (CCP14) for Single Crystal and Powder Diffraction Birkbeck University of London and Daresbury Laboratory Postal Address: CCP14 - School of Crystallography, Birkbeck College, Malet Street, Bloomsbury, WC1E 7HX, London, UK Tel: (+44) 020 7631 6849 Fax: (+44) 020 7631 6803 E-mail: [EMAIL PROTECTED] WWW: http://www.ccp14.ac.uk/