[Bug-wget] Marking Release v1.17.1?

2015-12-08 Thread Darshit Shah
With my last set of patches, we have fixed all the issues reported / identified 
after the 1.17 release. Hence, maybe we should consider releasing a 1.17.1 
bugfix release?



--
Thanking You,
Darshit Shah


signature.asc
Description: PGP signature


[Bug-wget] Fixing progress bar assertions in multibyte locales

2015-12-08 Thread Darshit Shah

Hi everyone,

As mentioned earlier, there was a bug in the progress bar implementation that 
caused the tests in multi-byte and multi-column locales to fail. I've rectified 
the issue by re-working each part of the progress bar to ensure that they are 
indeed using exactly the amount of space that has been allocated.


I also tried to clean up some of the code. I tested these commits on Travis and 
there seem to be no issues. All tests are passing with Russian, Turkish and C 
locales.


Please review the patch, and if good, I'll push it to master. Since it touches 
the most user-centric part of Wget, I'd like to see it as well reviewed and 
tested as possible.


--
Thanking You,
Darshit Shah
From 1b4793de27b20d00c3ad11c510002398121993c6 Mon Sep 17 00:00:00 2001
From: Darshit Shah 
Date: Tue, 8 Dec 2015 20:03:37 +0100
Subject: [PATCH 1/2] Fix progress bar assertion with multibyte locales

* src/progress.c (bar_create): Define size of progress buffer explicitly
  (create_image): Clean up progress bar image creation. Use memset
  instead of for loops to create arrays of the same byte.
---
 src/progress.c | 89 ++
 1 file changed, 34 insertions(+), 55 deletions(-)

diff --git a/src/progress.c b/src/progress.c
index 61b635d..861f5ce 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -594,7 +594,8 @@ bar_create (const char *f_download, wgint initial, wgint total)
   bp->width = screen_width - 1;
   /* + enough space for the terminating zero, and hopefully enough room
* for multibyte characters. */
-  bp->buffer = xmalloc (bp->width + 100);
+#define BUF_LEN (bp->width + 100)
+  bp->buffer = xmalloc (BUF_LEN);
 
   logputs (LOG_VERBOSE, "\n");
 
@@ -899,12 +900,11 @@ get_eta (int *bcd)
 static void
 create_image (struct bar_progress *bp, double dl_total_time, bool done)
 {
+  memset (bp->buffer, '\0', BUF_LEN);
   const int MAX_FILENAME_COLS = bp->width / 4;
   char *p = bp->buffer;
   wgint size = bp->initial_length + bp->count;
 
-  int size_grouped_pad; /* Used to pad the field width for size_grouped. */
-
   struct bar_progress_hist *hist = >hist;
   int orig_filename_cols = count_cols (bp->f_download);
 
@@ -951,10 +951,9 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
   if (orig_filename_cols <= MAX_FILENAME_COLS)
 {
   int padding = MAX_FILENAME_COLS - orig_filename_cols;
-  sprintf (p, "%s ", bp->f_download);
-  p += orig_filename_cols + 1;
-  for (;padding;padding--)
-*p++ = ' ';
+  p += sprintf (p, "%s ", bp->f_download);
+  memset (p, ' ', padding);
+  p += padding;
 }
   else
 {
@@ -992,9 +991,8 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
   memcpy (p, bp->f_download + offset_bytes, bytes_in_filename);
   p += bytes_in_filename;
   padding = MAX_FILENAME_COLS - (padding + *cols_ret);
-  for (;padding;padding--)
-  *p++ = ' ';
-  *p++ = ' ';
+  memset (p, ' ', padding + 1);
+  p += padding + 1;
 }
 
   /* "xx% " */
@@ -1002,15 +1000,13 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
 {
   int percentage = 100.0 * size / bp->total_length;
   assert (percentage <= 100);
-
-  if (percentage < 100)
-sprintf (p, "%3d%%", percentage);
-  else
-strcpy (p, "100%");
-  p += 4;
+  p += sprintf (p, "%3d%%", percentage);
 }
   else
-APPEND_LITERAL ("");
+{
+  memset (p, ' ', PROGRESS_PERCENT_LEN);
+  p += PROGRESS_PERCENT_LEN;
+}
 
   /* The progress bar: "[>  ]" or "[++==>  ]". */
   if (progress_size && bp->total_length > 0)
@@ -1022,7 +1018,6 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
   int dlsz = (double)size / bp->total_length * progress_size;
 
   char *begin;
-  int i;
 
   assert (dlsz <= progress_size);
   assert (insz <= dlsz);
@@ -1032,18 +1027,19 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
 
   /* Print the initial portion of the download with '+' chars, the
  rest with '=' and one '>'.  */
-  for (i = 0; i < insz; i++)
-*p++ = '+';
+  memset (p, '+', insz);
+  p += insz;
+
   dlsz -= insz;
   if (dlsz > 0)
 {
-  for (i = 0; i < dlsz - 1; i++)
-*p++ = '=';
+  memset (p, '=', dlsz-1);
+  p += dlsz - 1;
   *p++ = '>';
 }
 
-  while (p - begin < progress_size)
-*p++ = ' ';
+  memset (p, ' ', (progress_size - (p - begin)));
+  p += (progress_size - (p - begin));
   *p++ = ']';
 }
   else if (progress_size)
@@ -1071,27 +1067,14 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
   *p++ = ']';
 
 }
- ++bp->tick;
+  ++bp->tick;
 
   /* " 234.56M" */
   down_size = human_readable (size, 1000, 2);
-  cols_diff = 7 - count_cols (down_size);
- 

Re: [Bug-wget] Marking Release v1.17.1?

2015-12-08 Thread Giuseppe Scrivano
Darshit Shah  writes:

> With my last set of patches, we have fixed all the issues reported /
> identified after the 1.17 release. Hence, maybe we should consider
> releasing a 1.17.1 bugfix release?

yes, we should do that.  I can tag a new release tomorrow or on Friday.

Regards,
Giuseppe



Re: [Bug-wget] Marking Release v1.17.1?

2015-12-08 Thread Darshit Shah

On 12/09, Giuseppe Scrivano wrote:

Darshit Shah  writes:


With my last set of patches, we have fixed all the issues reported /
identified after the 1.17 release. Hence, maybe we should consider
releasing a 1.17.1 bugfix release?


yes, we should do that.  I can tag a new release tomorrow or on Friday.

There's one patch by Tim that's pending and my fixes for the progress bar. We 
should get them in before tagging.


Regards,
Giuseppe


--
Thanking You,
Darshit Shah


signature.asc
Description: PGP signature


[Bug-wget] Windows cert store support

2015-12-08 Thread Random Coder
I'm not sure if the wget maintainers would be interested, but I've
been carrying this patch around in my private builds of wget for a
while.  It allows wget to load SSL certs from the default Windows cert
store.

The patch itself is fairly straightforward, but as it changes the
default SSL behavior, and no care was taken to follow coding convents
when I wrote it, so it's probably not ready for inclusion in the
codebase.  Still, if it's useful, feel free to use it for ideas.


openssl.patch
Description: Binary data


Re: [Bug-wget] wget 1.17 does not use .netrc for http auth

2015-12-08 Thread Darshit Shah
Axel hasn't responded, but this is a valid fix. Tim could you please push it in 
time for the bug fix release?

On 11/23, Tim Rühsen wrote:

Thanks Axel !

You are right, it is a regression introduced ~ half a year ago.

Could you try this patch ?

Tim

On Monday 23 November 2015 15:16:41 Axel Reinhold wrote:

Dear wget-Maintainers,

wget-1.17 does not more use .netrc for getting http-auth-info
this is a regression i think.

==
with wget-1.17:
==
$ /opt/wget/bin/wget -v -O- http://calea.wpack.de/sites/active
==
--2015-11-23 15:11:05--  http://calea.wpack.de/sites/active
Resolving calea.wpack.de (calea.wpack.de)... 188.138.31.224
Connecting to calea.wpack.de (calea.wpack.de)|188.138.31.224|:80...
connected. HTTP request sent, awaiting response... 401 Unauthorized
Username/Password Authentication Failed.
==
$ /opt/wget/bin/wget --http-user=rcon --http-password=wefhhoG -O-
http://calea.wpack.de/sites/active
==
--2015-11-23 15:11:24--  http://calea.wpack.de/sites/active
Resolving calea.wpack.de (calea.wpack.de)... 188.138.31.224
Connecting to calea.wpack.de (calea.wpack.de)|188.138.31.224|:80...
connected. HTTP request sent, awaiting response... 401 Unauthorized
Authentication selected: Digest realm="wpack",
nonce="a1LgzDUlBQA=54905863b96f04dca4ae0810eb594fdcf4066221",
algorithm=MD5, qop="auth" Reusing existing connection to calea.wpack.de:80.
HTTP request sent, awaiting response... 200 OK
Length: 146 [text/html]
Saving to: 'STDOUT'
-  0%[
  ]   0  --.-KB/s 1 city7 201511231325
city7OKwp 212.114.252.79 City-Hotel München ***Superior 7 bambini
201511231326 Juli24Mg 84.57.88.108 Bambini Kinderwelt GmbH -

100%[>] 146
 --.-KB/s   in 0s 2015-11-23 15:11:24 (15.5 MB/s) - written to stdout
[146/146]
==

==
with wget-1.16.3:
==
$ /opt/wget/bin/wget -v -O- http://calea.wpack.de/sites/active
==
--2015-11-23 15:14:01--  http://calea.wpack.de/sites/active
Resolving calea.wpack.de (calea.wpack.de)... 188.138.31.224
Connecting to calea.wpack.de (calea.wpack.de)|188.138.31.224|:80...
connected. HTTP request sent, awaiting response... 401 Unauthorized
Authentication selected: Digest realm="wpack",
nonce="fnlD1jUlBQA=cbebe19e1ffead899e352fb4e77f5fd8d64803f6",
algorithm=MD5, qop="auth" Reusing existing connection to calea.wpack.de:80.
HTTP request sent, awaiting response... 200 OK
Length: 146 [text/html]
Saving to: 'STDOUT'
-  0%[
  ]   0  --.-KB/s 1 city7 201511231325
city7OKwp 212.114.252.79 City-Hotel München ***Superior 7 bambini
201511231326 Juli24Mg 84.57.88.108 Bambini Kinderwelt GmbH -

100%[>] 146
 --.-KB/s   in 0s 2015-11-23 15:14:01 (13.9 MB/s) - written to stdout
[146/146]
==



From a1da7fd960dba9e733e36a47bf144827c7d0e154 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= 
Date: Mon, 23 Nov 2015 17:50:59 +0100
Subject: [PATCH] Fix regression in HTTP authentication

* src/http.c (initialize_request): Fix wrong params to search_netrc()

Regression introduced in commit 29850e77
---
src/http.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/http.c b/src/http.c
index 9d71483..8916d2b 100644
--- a/src/http.c
+++ b/src/http.c
@@ -1872,7 +1872,7 @@ initialize_request (struct url *u, struct http_stat *hs, 
int *dt, struct url *pr
  /* Find the username and password for authentication. */
  *user = u->user;
  *passwd = u->passwd;
-  search_netrc (u->host, (const char **), (const char **), 0);
+  search_netrc (u->host, (const char **)user, (const char **)passwd, 0);
  *user = *user ? *user : (opt.http_user ? opt.http_user : opt.user);
  *passwd = *passwd ? *passwd : (opt.http_passwd ? opt.http_passwd : 
opt.passwd);

--
2.6.2




--
Thanking You,
Darshit Shah


signature.asc
Description: PGP signature


Re: [Bug-wget] Marking Release v1.17.1?

2015-12-08 Thread Mike Frysinger
On 08 Dec 2015 21:45, Darshit Shah wrote:
> With my last set of patches, we have fixed all the issues reported / 
> identified 
> after the 1.17 release. Hence, maybe we should consider releasing a 1.17.1 
> bugfix release?

a bugfix release would be great.  specifically, one that builds when
IPv6 or SSL support has been disabled.
-mike


signature.asc
Description: Digital signature