1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Announce the beginning and the end of the SSL handshake when in debug mode.

Avoid the use of the %p format.
This commit is contained in:
hniksic 2005-05-14 12:36:30 -07:00
parent c1ba8c2111
commit 2307fcc5c2
5 changed files with 26 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2005-05-14 Hrvoje Niksic <hniksic@xemacs.org>
* openssl.c (ssl_connect): Announce the beginning and the end of
the SSL handshake when in debug mode.
* wget.h (PTR_FORMAT): New macro for easier printing of pointer
values. Use %0*lx along with PTR_FORMAT instead of %p.
2005-05-14 Hrvoje Niksic <hniksic@xemacs.org>
* http.c (gethttp): Would forget to close the connection when

View File

@ -311,10 +311,11 @@ void
address_list_release (struct address_list *al)
{
--al->refcount;
DEBUGP (("Releasing %p (new refcount %d).\n", al, al->refcount));
DEBUGP (("Releasing 0x%0*lx (new refcount %d).\n", PTR_FORMAT (al),
al->refcount));
if (al->refcount <= 0)
{
DEBUGP (("Deleting unused %p.\n", al));
DEBUGP (("Deleting unused 0x%0*lx.\n", PTR_FORMAT (al)));
address_list_delete (al);
}
}

View File

@ -321,6 +321,8 @@ ssl_connect (int fd)
{
SSL *ssl;
DEBUGP (("Initiating SSL handshake.\n"));
assert (ssl_ctx != NULL);
ssl = SSL_new (ssl_ctx);
if (!ssl)
@ -335,11 +337,12 @@ ssl_connect (int fd)
functions are used for reading, writing, and polling. */
fd_register_transport (fd, openssl_read, openssl_write, openssl_poll,
openssl_peek, openssl_close, ssl);
DEBUGP (("Connected %d to SSL 0x%0*lx\n", fd, 2 * sizeof (void *),
(unsigned long) ssl));
DEBUGP (("Handshake successful; connected socket %d to SSL handle 0x%0*lx\n",
fd, PTR_FORMAT (ssl)));
return 1;
error:
DEBUGP (("SSL handshake failed.\n"));
print_errors ();
if (ssl)
SSL_free (ssl);
@ -478,6 +481,8 @@ ssl_check_certificate (int fd, const char *host)
/* The certificate was found, verified, and matched HOST. */
success = 1;
DEBUGP (("X509 certificate successfully verified and matches host %s\n",
escnonprint (host)));
out:
if (cert)

View File

@ -224,6 +224,12 @@ typedef off_t wgint;
basevar = (type *)xrealloc (basevar, DR_newsize * sizeof (type)); \
} while (0)
/* Used to print pointers (usually for debugging). Print pointers
using printf ("%0*lx", PTR_FORMAT (p)). (%p is too unpredictable;
some implementations prepend 0x, while some don't, and most don't
0-pad the address.) */
#define PTR_FORMAT(p) 2 * sizeof (void *), (unsigned long) (p)
extern const char *exec_name;
/* Document type ("dt") flags */

View File

@ -304,8 +304,7 @@ print_malloc_debug_stats (void)
malloc_count, free_count, malloc_count - free_count);
for (i = 0; i < SZ; i++)
if (malloc_table[i].ptr != NULL)
printf ("0x%0*lx: %s:%d\n", 2 * sizeof (void *),
(long) malloc_table[i].ptr,
printf ("0x%0*lx: %s:%d\n", PTR_FORMAT (malloc_table[i].ptr),
malloc_table[i].file, malloc_table[i].line);
}
@ -368,8 +367,7 @@ debugging_free (void *ptr, const char *source_file, int source_line)
if (!unregister_ptr (ptr))
{
fprintf (stderr, "%s: bad xfree(%0*lx) at %s:%d\n",
exec_name, 2 * sizeof (void *), (long) ptr,
source_file, source_line);
exec_name, PTR_FORMAT (ptr), source_file, source_line);
abort ();
}
++free_count;