summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@netsurf-browser.org>2010-12-20 10:32:15 +0000
committerDaniel Silverstone <dsilvers@netsurf-browser.org>2010-12-20 10:32:15 +0000
commitb85b1f5ba5ae6a49811c1799296dc07d2ef8e7e7 (patch)
tree63b4efc0e310bddfab00ba569580a4d3ad8868af /content
parent8f734e5b7af77517cb9b14fbc92c1aa10f3ce797 (diff)
downloadnetsurf-b85b1f5ba5ae6a49811c1799296dc07d2ef8e7e7.tar.gz
netsurf-b85b1f5ba5ae6a49811c1799296dc07d2ef8e7e7.tar.bz2
Make fetch.c use new RING_COUNTBYLWCHOST
svn path=/trunk/netsurf/; revision=11108
Diffstat (limited to 'content')
-rw-r--r--content/fetch.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/content/fetch.c b/content/fetch.c
index 4cd1ed31a..433a06fd9 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -34,6 +34,8 @@
#include <strings.h>
#include <time.h>
+#include <libwapcaplet/libwapcaplet.h>
+
#include "utils/config.h"
#include "content/fetch.h"
#include "content/fetchers/fetch_curl.h"
@@ -78,6 +80,7 @@ struct fetch {
bool verifiable; /**< Transaction is verifiable */
void *p; /**< Private data for callback. */
char *host; /**< Host part of URL. */
+ lwc_string *lwc_host; /**< Host part of URL, interned */
long http_code; /**< HTTP response code, or 0. */
scheme_fetcher *ops; /**< Fetcher operations for this fetch,
NULL if not set. */
@@ -271,7 +274,11 @@ struct fetch * fetch_start(const char *url, const char *referer,
fetch->fetcher_handle = NULL;
fetch->ops = NULL;
fetch->fetch_is_active = false;
-
+ fetch->lwc_host = NULL;
+
+ if (lwc_intern_string(host, strlen(host), &fetch->lwc_host) != lwc_error_ok)
+ goto failed;
+
if (referer != NULL) {
fetch->referer = strdup(referer);
if (fetch->referer == NULL)
@@ -338,6 +345,8 @@ failed:
free(scheme);
free(fetch->url);
free(fetch->referer);
+ if (fetch->lwc_host != NULL)
+ lwc_string_unref(fetch->lwc_host);
free(fetch);
return NULL;
@@ -415,8 +424,8 @@ bool fetch_choose_and_dispatch(void)
* fetch ring
*/
int countbyhost;
- RING_COUNTBYHOST(struct fetch, fetch_ring, countbyhost,
- queueitem->host);
+ RING_COUNTBYLWCHOST(struct fetch, fetch_ring, countbyhost,
+ queueitem->lwc_host);
if (countbyhost < option_max_fetchers_per_host) {
/* We can dispatch this item in theory */
return fetch_dispatch_job(queueitem);
@@ -477,7 +486,9 @@ void fetch_free(struct fetch *f)
free(f->host);
if (f->referer)
free(f->referer);
- free(f);
+ if (f->lwc_host != NULL)
+ lwc_string_unref(f->lwc_host);
+ free(f);
}