/* HTTP support.
- Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001
+ Free Software Foundation, Inc.
-This file is part of Wget.
+This file is part of GNU Wget.
-This program is free software; you can redistribute it and/or modify
+GNU Wget is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-This program is distributed in the hope that it will be useful,
+GNU Wget is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
+along with Wget; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <config.h>
#include "connect.h"
#include "fnmatch.h"
#include "netrc.h"
-#if USE_DIGEST
-# include "md5.h"
-#endif
#ifdef HAVE_SSL
# include "gen_sslfunc.h"
#endif /* HAVE_SSL */
{
logputs (LOG_VERBOSE, "\n");
logprintf (LOG_NOTQUIET, _("Unable to establish SSL connection.\n"));
+ ssl_printerrors ();
CLOSE (sock);
return CONSSLERR;
}
/* Construct the authentication, if userid is present. */
user = ou->user;
passwd = ou->passwd;
- search_netrc (u->host, (const char **)&user, (const char **)&passwd, 0);
+ search_netrc (ou->host, (const char **)&user, (const char **)&passwd, 0);
user = user ? user : opt.http_user;
passwd = passwd ? passwd : opt.http_passwd;
all_headers[all_length] = '\0';
}
- /* Print the header if requested. */
- if (opt.server_response && hcount != 1)
- logprintf (LOG_VERBOSE, "\n%d %s", hcount, hdr);
-
/* Check for status line. */
if (hcount == 1)
{
&& !opt.debug
#endif
)
- logprintf (LOG_VERBOSE, "%d %s", statcode, error);
+ {
+ if (opt.server_response)
+ logprintf (LOG_VERBOSE, "\n%2d %s", hcount, hdr);
+ else
+ logprintf (LOG_VERBOSE, "%2d %s", statcode, error);
+ }
goto done_header;
}
break;
}
+ /* Print the header if requested. */
+ if (opt.server_response && hcount != 1)
+ logprintf (LOG_VERBOSE, "\n%2d %s", hcount, hdr);
+
/* Try getting content-length. */
if (contlen == -1 && !opt.ignore_length)
if (header_process (hdr, "Content-Length", header_extract_number,
logprintf (LOG_NOTQUIET,
_("\
\n\
-The server does not support continued downloads, which conflicts with `-c'.\n\
+Continued download failed on this file, which conflicts with `-c'.\n\
Refusing to truncate existing file `%s'.\n\n"), u->local);
FREE_MAYBE (type);
FREE_MAYBE (all_headers);
/* Calculate the digest value. */
{
- struct md5_ctx ctx;
+ MD5_CONTEXT_TYPE ctx;
unsigned char hash[MD5_HASHLEN];
unsigned char a1buf[MD5_HASHLEN * 2 + 1], a2buf[MD5_HASHLEN * 2 + 1];
unsigned char response_digest[MD5_HASHLEN * 2 + 1];
/* A1BUF = H(user ":" realm ":" password) */
- md5_init_ctx (&ctx);
- md5_process_bytes (user, strlen (user), &ctx);
- md5_process_bytes (":", 1, &ctx);
- md5_process_bytes (realm, strlen (realm), &ctx);
- md5_process_bytes (":", 1, &ctx);
- md5_process_bytes (passwd, strlen (passwd), &ctx);
- md5_finish_ctx (&ctx, hash);
+ MD5_INIT (&ctx);
+ MD5_UPDATE (user, strlen (user), &ctx);
+ MD5_UPDATE (":", 1, &ctx);
+ MD5_UPDATE (realm, strlen (realm), &ctx);
+ MD5_UPDATE (":", 1, &ctx);
+ MD5_UPDATE (passwd, strlen (passwd), &ctx);
+ MD5_FINISH (&ctx, hash);
dump_hash (a1buf, hash);
/* A2BUF = H(method ":" path) */
- md5_init_ctx (&ctx);
- md5_process_bytes (method, strlen (method), &ctx);
- md5_process_bytes (":", 1, &ctx);
- md5_process_bytes (path, strlen (path), &ctx);
- md5_finish_ctx (&ctx, hash);
+ MD5_INIT (&ctx);
+ MD5_UPDATE (method, strlen (method), &ctx);
+ MD5_UPDATE (":", 1, &ctx);
+ MD5_UPDATE (path, strlen (path), &ctx);
+ MD5_FINISH (&ctx, hash);
dump_hash (a2buf, hash);
/* RESPONSE_DIGEST = H(A1BUF ":" nonce ":" A2BUF) */
- md5_init_ctx (&ctx);
- md5_process_bytes (a1buf, MD5_HASHLEN * 2, &ctx);
- md5_process_bytes (":", 1, &ctx);
- md5_process_bytes (nonce, strlen (nonce), &ctx);
- md5_process_bytes (":", 1, &ctx);
- md5_process_bytes (a2buf, MD5_HASHLEN * 2, &ctx);
- md5_finish_ctx (&ctx, hash);
+ MD5_INIT (&ctx);
+ MD5_UPDATE (a1buf, MD5_HASHLEN * 2, &ctx);
+ MD5_UPDATE (":", 1, &ctx);
+ MD5_UPDATE (nonce, strlen (nonce), &ctx);
+ MD5_UPDATE (":", 1, &ctx);
+ MD5_UPDATE (a2buf, MD5_HASHLEN * 2, &ctx);
+ MD5_FINISH (&ctx, hash);
dump_hash (response_digest, hash);
res = (char*) xmalloc (strlen (user)