From 63d492c0bae0411d3117185c24924fdcf5292919 Mon Sep 17 00:00:00 2001 From: hniksic Date: Sat, 29 Nov 2003 14:24:55 -0800 Subject: [PATCH] [svn] Initialize SSL only the first time when an SSL URL is encountered. --- src/ChangeLog | 5 +++++ src/http.c | 51 +++++++++++++++++++++++++++------------------------ 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 12931071..a4bc3972 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2003-11-29 Hrvoje Niksic + + * http.c (gethttp): Initialize SSL only the first time when SSL + URL is downloaded. + 2003-11-29 Hrvoje Niksic * cookies.c (cookie_header): Only generate the contents of the diff --git a/src/http.c b/src/http.c index 7087d71f..f514452b 100644 --- a/src/http.c +++ b/src/http.c @@ -1033,31 +1033,34 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy) int host_lookup_failed = 0; #ifdef HAVE_SSL - /* Initialize the SSL context. After the first run, this is a - no-op. */ - switch (ssl_init ()) + if (u->scheme == SCHEME_HTTPS) { - case SSLERRCTXCREATE: - /* this is fatal */ - logprintf (LOG_NOTQUIET, _("Failed to set up an SSL context\n")); - return SSLERRCTXCREATE; - case SSLERRCERTFILE: - /* try without certfile */ - logprintf (LOG_NOTQUIET, - _("Failed to load certificates from %s\n"), - opt.sslcertfile); - logprintf (LOG_NOTQUIET, - _("Trying without the specified certificate\n")); - break; - case SSLERRCERTKEY: - logprintf (LOG_NOTQUIET, - _("Failed to get certificate key from %s\n"), - opt.sslcertkey); - logprintf (LOG_NOTQUIET, - _("Trying without the specified certificate\n")); - break; - default: - break; + /* Initialize the SSL context. After this has once been done, + it becomes a no-op. */ + switch (ssl_init ()) + { + case SSLERRCTXCREATE: + /* this is fatal */ + logprintf (LOG_NOTQUIET, _("Failed to set up an SSL context\n")); + return SSLERRCTXCREATE; + case SSLERRCERTFILE: + /* try without certfile */ + logprintf (LOG_NOTQUIET, + _("Failed to load certificates from %s\n"), + opt.sslcertfile); + logprintf (LOG_NOTQUIET, + _("Trying without the specified certificate\n")); + break; + case SSLERRCERTKEY: + logprintf (LOG_NOTQUIET, + _("Failed to get certificate key from %s\n"), + opt.sslcertkey); + logprintf (LOG_NOTQUIET, + _("Trying without the specified certificate\n")); + break; + default: + break; + } } #endif /* HAVE_SSL */ -- 2.39.2