Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/13a5b8f74a9024953a27e...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/13a5b8f74a9024953a27e4c...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/13a5b8f74a9024953a27e4c34...
The branch, master has been updated
via 13a5b8f74a9024953a27e4c34740d05e9a4e3e8e (commit)
from 57094c84edeb3540e13121dea742b1ae484d468b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=13a5b8f74a9024953a2...
commit 13a5b8f74a9024953a27e4c34740d05e9a4e3e8e
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
make curl fetcher log debug using NSLOG
stop curl fetcher logging being special case to standard error and
use the fetch catagory at DEBUG level instead.
The special suppress_curl_debug option is currently still obeyed
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index 4602f6a..63b9ea1 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -1,7 +1,7 @@
/*
- * Copyright 2006 Daniel Silverstone <dsilvers(a)digital-scurf.org>
+ * Copyright 2006-2019 Daniel Silverstone <dsilvers(a)digital-scurf.org>
+ * Copyright 2010-2018 Vincent Sanders <vince(a)netsurf-browser.org>
* Copyright 2007 James Bursa <bursa(a)users.sourceforge.net>
- * Copyright 2003 Phil Mellor <monkeyson(a)users.sourceforge.net>
*
* This file is part of NetSurf.
*
@@ -1282,16 +1282,28 @@ fetch_curl_progress(void *clientp,
/**
- * Ignore everything given to it.
- *
- * Used to ignore cURL debug.
+ * Format curl debug for nslog
*/
-static int fetch_curl_ignore_debug(CURL *handle,
- curl_infotype type,
- char *data,
- size_t size,
- void *userptr)
+static int
+fetch_curl_debug(CURL *handle,
+ curl_infotype type,
+ char *data,
+ size_t size,
+ void *userptr)
{
+ static const char s_infotype[CURLINFO_END][3] = {
+ "* ", "< ", "> ", "{ ", "} ",
"{ ", "} "
+ };
+ switch(type) {
+ case CURLINFO_TEXT:
+ case CURLINFO_HEADER_OUT:
+ case CURLINFO_HEADER_IN:
+ NSLOG(fetch, DEBUG, "%s%.*s", s_infotype[type], (int)size - 1, data);
+ break;
+
+ default:
+ break;
+ }
return 0;
}
@@ -1510,14 +1522,12 @@ nserror fetch_curl_register(void)
if (code != CURLE_OK) \
goto curl_easy_setopt_failed;
- if (verbose_log) {
- SETOPT(CURLOPT_VERBOSE, 1);
- } else {
- SETOPT(CURLOPT_VERBOSE, 0);
- }
SETOPT(CURLOPT_ERRORBUFFER, fetch_error_buffer);
+ SETOPT(CURLOPT_DEBUGFUNCTION, fetch_curl_debug);
if (nsoption_bool(suppress_curl_debug)) {
- SETOPT(CURLOPT_DEBUGFUNCTION, fetch_curl_ignore_debug);
+ SETOPT(CURLOPT_VERBOSE, 0);
+ } else {
+ SETOPT(CURLOPT_VERBOSE, 1);
}
/* Currently we explode if curl uses HTTP2, so force 1.1. */
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/curl.c | 42 ++++++++++++++++++++++++++----------------
1 file changed, 26 insertions(+), 16 deletions(-)
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index 4602f6a..63b9ea1 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -1,7 +1,7 @@
/*
- * Copyright 2006 Daniel Silverstone <dsilvers(a)digital-scurf.org>
+ * Copyright 2006-2019 Daniel Silverstone <dsilvers(a)digital-scurf.org>
+ * Copyright 2010-2018 Vincent Sanders <vince(a)netsurf-browser.org>
* Copyright 2007 James Bursa <bursa(a)users.sourceforge.net>
- * Copyright 2003 Phil Mellor <monkeyson(a)users.sourceforge.net>
*
* This file is part of NetSurf.
*
@@ -1282,16 +1282,28 @@ fetch_curl_progress(void *clientp,
/**
- * Ignore everything given to it.
- *
- * Used to ignore cURL debug.
+ * Format curl debug for nslog
*/
-static int fetch_curl_ignore_debug(CURL *handle,
- curl_infotype type,
- char *data,
- size_t size,
- void *userptr)
+static int
+fetch_curl_debug(CURL *handle,
+ curl_infotype type,
+ char *data,
+ size_t size,
+ void *userptr)
{
+ static const char s_infotype[CURLINFO_END][3] = {
+ "* ", "< ", "> ", "{ ", "} ",
"{ ", "} "
+ };
+ switch(type) {
+ case CURLINFO_TEXT:
+ case CURLINFO_HEADER_OUT:
+ case CURLINFO_HEADER_IN:
+ NSLOG(fetch, DEBUG, "%s%.*s", s_infotype[type], (int)size - 1, data);
+ break;
+
+ default:
+ break;
+ }
return 0;
}
@@ -1510,14 +1522,12 @@ nserror fetch_curl_register(void)
if (code != CURLE_OK) \
goto curl_easy_setopt_failed;
- if (verbose_log) {
- SETOPT(CURLOPT_VERBOSE, 1);
- } else {
- SETOPT(CURLOPT_VERBOSE, 0);
- }
SETOPT(CURLOPT_ERRORBUFFER, fetch_error_buffer);
+ SETOPT(CURLOPT_DEBUGFUNCTION, fetch_curl_debug);
if (nsoption_bool(suppress_curl_debug)) {
- SETOPT(CURLOPT_DEBUGFUNCTION, fetch_curl_ignore_debug);
+ SETOPT(CURLOPT_VERBOSE, 0);
+ } else {
+ SETOPT(CURLOPT_VERBOSE, 1);
}
/* Currently we explode if curl uses HTTP2, so force 1.1. */
--
NetSurf Browser