Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/f6fd9ecd49e16a9bc6ddfa0fd601d5a38cf2ad65
...commit
http://git.netsurf-browser.org/netsurf.git/commit/f6fd9ecd49e16a9bc6ddfa0fd601d5a38cf2ad65
...tree
http://git.netsurf-browser.org/netsurf.git/tree/f6fd9ecd49e16a9bc6ddfa0fd601d5a38cf2ad65
The branch, vince/curlapiupdates has been updated
via f6fd9ecd49e16a9bc6ddfa0fd601d5a38cf2ad65 (commit)
from 46328a4e206159c21fced3a19a01a40728d32b59 (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=f6fd9ecd49e16a9bc6ddfa0fd601d5a38cf2ad65
commit f6fd9ecd49e16a9bc6ddfa0fd601d5a38cf2ad65
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
address jmb review comments
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index c892429..40599f0 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -425,6 +425,41 @@ static void fetch_curl_free_postdata(struct fetch_postdata
*postdata)
}
/**
+ *construct a new fetch structure
+ */
+static struct curl_fetch_info *fetch_alloc(void)
+{
+ fetch = malloc(sizeof (*fetch));
+ if (fetch == NULL)
+ return NULL;
+
+ fetch->curl_handle = NULL;
+ fetch->sent_ssl_chain = false;
+ fetch->had_headers = false;
+ fetch->abort = false;
+ fetch->stopped = false;
+ fetch->only_2xx = only_2xx;
+ fetch->downgrade_tls = downgrade_tls;
+ fetch->headers = NULL;
+ fetch->url = NULL
+ fetch->host = NULL;
+ fetch->location = NULL;
+ fetch->content_length = 0;
+ fetch->http_code = 0;
+ fetch->cookie_string = NULL;
+ fetch->realm = NULL;
+ fetch->last_progress_update = 0;
+ fetch->postdata = NULL;
+ fetch->curl_postdata = NULL;
+
+ /* Clear certificate chain data */
+ memset(fetch->cert_data, 0, sizeof(fetch->cert_data));
+ fetch->cert_depth = -1;
+
+ return fetch;
+}
+
+/**
* Start fetching data for the given URL.
*
* The function returns immediately. The fetch may be queued for later
@@ -458,44 +493,22 @@ fetch_curl_setup(struct fetch *parent_fetch,
struct curl_slist *slist;
int i;
- fetch = malloc(sizeof (*fetch));
+ fetch = fetch_alloc();
if (fetch == NULL)
- return 0;
-
- fetch->fetch_handle = parent_fetch;
+ return NULL;
NSLOG(netsurf, INFO, "fetch %p, url '%s'", fetch, nsurl_access(url));
- /* construct a new fetch structure */
- fetch->curl_handle = NULL;
- fetch->sent_ssl_chain = false;
- fetch->had_headers = false;
- fetch->abort = false;
- fetch->stopped = false;
- fetch->only_2xx = only_2xx;
- fetch->downgrade_tls = downgrade_tls;
- fetch->headers = NULL;
+ fetch->fetch_handle = parent_fetch;
fetch->url = nsurl_ref(url);
fetch->host = nsurl_get_component(url, NSURL_HOST);
if (fetch->host == NULL) {
goto failed;
}
-
- fetch->location = NULL;
- fetch->content_length = 0;
- fetch->http_code = 0;
- fetch->cookie_string = NULL;
- fetch->realm = NULL;
- fetch->last_progress_update = 0;
fetch->postdata = fetch_curl_alloc_postdata(post_urlenc,
post_multipart);
if (fetch->postdata == NULL) {
goto failed;
}
- fetch->curl_postdata = NULL;
-
- /* Clear certificate chain data */
- memset(fetch->cert_data, 0, sizeof(fetch->cert_data));
- fetch->cert_depth = -1;
#define APPEND(list, value) \
slist = curl_slist_append(list, value); \
@@ -996,7 +1009,13 @@ fetch_curl_postdata_convert(CURL *chandle,
}
} else if(value_len > sizeof (struct curl_mime_ctx)) {
- /* reference the existing multipart data */
+ /* make the curl mime reference the existing multipart
+ * data which requires use of a callback and context.
+ * The use of existing data rather than allowing it to
+ * be copied into the curl mime handler is only
+ * efficient if the data is larger than a callback
+ * context.
+ */
struct curl_mime_ctx *cb_ctx;
cb_ctx = malloc(sizeof(struct curl_mime_ctx));
if (cb_ctx == NULL) {
@@ -1016,7 +1035,7 @@ fetch_curl_postdata_convert(CURL *chandle,
goto convert_failed;
}
} else {
- /* simple copy data */
+ /* data copied into the curl mime context */
code=curl_mime_data(part, multipart->value, value_len);
if (code != CURLE_OK) {
goto convert_failed;
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/curl.c | 73 +++++++++++++++++++++++++++++------------------
1 file changed, 46 insertions(+), 27 deletions(-)
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index c892429..40599f0 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -425,6 +425,41 @@ static void fetch_curl_free_postdata(struct fetch_postdata
*postdata)
}
/**
+ *construct a new fetch structure
+ */
+static struct curl_fetch_info *fetch_alloc(void)
+{
+ fetch = malloc(sizeof (*fetch));
+ if (fetch == NULL)
+ return NULL;
+
+ fetch->curl_handle = NULL;
+ fetch->sent_ssl_chain = false;
+ fetch->had_headers = false;
+ fetch->abort = false;
+ fetch->stopped = false;
+ fetch->only_2xx = only_2xx;
+ fetch->downgrade_tls = downgrade_tls;
+ fetch->headers = NULL;
+ fetch->url = NULL
+ fetch->host = NULL;
+ fetch->location = NULL;
+ fetch->content_length = 0;
+ fetch->http_code = 0;
+ fetch->cookie_string = NULL;
+ fetch->realm = NULL;
+ fetch->last_progress_update = 0;
+ fetch->postdata = NULL;
+ fetch->curl_postdata = NULL;
+
+ /* Clear certificate chain data */
+ memset(fetch->cert_data, 0, sizeof(fetch->cert_data));
+ fetch->cert_depth = -1;
+
+ return fetch;
+}
+
+/**
* Start fetching data for the given URL.
*
* The function returns immediately. The fetch may be queued for later
@@ -458,44 +493,22 @@ fetch_curl_setup(struct fetch *parent_fetch,
struct curl_slist *slist;
int i;
- fetch = malloc(sizeof (*fetch));
+ fetch = fetch_alloc();
if (fetch == NULL)
- return 0;
-
- fetch->fetch_handle = parent_fetch;
+ return NULL;
NSLOG(netsurf, INFO, "fetch %p, url '%s'", fetch, nsurl_access(url));
- /* construct a new fetch structure */
- fetch->curl_handle = NULL;
- fetch->sent_ssl_chain = false;
- fetch->had_headers = false;
- fetch->abort = false;
- fetch->stopped = false;
- fetch->only_2xx = only_2xx;
- fetch->downgrade_tls = downgrade_tls;
- fetch->headers = NULL;
+ fetch->fetch_handle = parent_fetch;
fetch->url = nsurl_ref(url);
fetch->host = nsurl_get_component(url, NSURL_HOST);
if (fetch->host == NULL) {
goto failed;
}
-
- fetch->location = NULL;
- fetch->content_length = 0;
- fetch->http_code = 0;
- fetch->cookie_string = NULL;
- fetch->realm = NULL;
- fetch->last_progress_update = 0;
fetch->postdata = fetch_curl_alloc_postdata(post_urlenc,
post_multipart);
if (fetch->postdata == NULL) {
goto failed;
}
- fetch->curl_postdata = NULL;
-
- /* Clear certificate chain data */
- memset(fetch->cert_data, 0, sizeof(fetch->cert_data));
- fetch->cert_depth = -1;
#define APPEND(list, value) \
slist = curl_slist_append(list, value); \
@@ -996,7 +1009,13 @@ fetch_curl_postdata_convert(CURL *chandle,
}
} else if(value_len > sizeof (struct curl_mime_ctx)) {
- /* reference the existing multipart data */
+ /* make the curl mime reference the existing multipart
+ * data which requires use of a callback and context.
+ * The use of existing data rather than allowing it to
+ * be copied into the curl mime handler is only
+ * efficient if the data is larger than a callback
+ * context.
+ */
struct curl_mime_ctx *cb_ctx;
cb_ctx = malloc(sizeof(struct curl_mime_ctx));
if (cb_ctx == NULL) {
@@ -1016,7 +1035,7 @@ fetch_curl_postdata_convert(CURL *chandle,
goto convert_failed;
}
} else {
- /* simple copy data */
+ /* data copied into the curl mime context */
code=curl_mime_data(part, multipart->value, value_len);
if (code != CURLE_OK) {
goto convert_failed;
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]