summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/content.c12
-rw-r--r--content/content.h5
-rw-r--r--content/content_protected.h7
-rw-r--r--content/fetchers/resource.c1
-rw-r--r--content/fetchers/resource.h13
-rw-r--r--content/hlcache.c34
-rw-r--r--content/hlcache.h4
7 files changed, 18 insertions, 58 deletions
diff --git a/content/content.c b/content/content.c
index 081674676..7b722a274 100644
--- a/content/content.c
+++ b/content/content.c
@@ -785,17 +785,17 @@ lwc_string *content__get_mime_type(struct content *c)
* \param c Content to retrieve URL from
* \return Pointer to URL, or NULL if not found.
*/
-const char *content_get_url(hlcache_handle *h)
+nsurl *content_get_url(hlcache_handle *h)
{
return content__get_url(hlcache_handle_get_content(h));
}
-const char *content__get_url(struct content *c)
+nsurl *content__get_url(struct content *c)
{
if (c == NULL)
return NULL;
- return nsurl_access(llcache_handle_get_url(c->llcache));
+ return llcache_handle_get_url(c->llcache);
}
/**
@@ -970,12 +970,12 @@ void content__invalidate_reuse_data(struct content *c)
* \param c Content to retrieve refresh URL from
* \return Pointer to URL, or NULL if none
*/
-const char *content_get_refresh_url(hlcache_handle *h)
+nsurl *content_get_refresh_url(hlcache_handle *h)
{
return content__get_refresh_url(hlcache_handle_get_content(h));
}
-const char *content__get_refresh_url(struct content *c)
+nsurl *content__get_refresh_url(struct content *c)
{
if (c == NULL)
return NULL;
@@ -1159,7 +1159,7 @@ nserror content__clone(const struct content *c, struct content *nc)
}
if (c->refresh != NULL) {
- nc->refresh = talloc_strdup(nc, c->refresh);
+ nc->refresh = nsurl_ref(c->refresh);
if (nc->refresh == NULL) {
return NSERROR_NOMEM;
}
diff --git a/content/content.h b/content/content.h
index 21c8954c9..b288cb61e 100644
--- a/content/content.h
+++ b/content/content.h
@@ -33,6 +33,7 @@
#include "utils/config.h"
#include "utils/errors.h"
#include "utils/http.h"
+#include "utils/nsurl.h"
#include "utils/types.h"
#include "content/content_factory.h"
#include "content/content_type.h"
@@ -164,7 +165,7 @@ void content_get_contextual_content(struct hlcache_handle *h,
/* Member accessors */
content_type content_get_type(struct hlcache_handle *c);
lwc_string *content_get_mime_type(struct hlcache_handle *c);
-const char *content_get_url(struct hlcache_handle *c);
+nsurl *content_get_url(struct hlcache_handle *c);
const char *content_get_title(struct hlcache_handle *c);
content_status content_get_status(struct hlcache_handle *c);
const char *content_get_status_message(struct hlcache_handle *c);
@@ -174,7 +175,7 @@ int content_get_available_width(struct hlcache_handle *c);
const char *content_get_source_data(struct hlcache_handle *c,
unsigned long *size);
void content_invalidate_reuse_data(struct hlcache_handle *c);
-const char *content_get_refresh_url(struct hlcache_handle *c);
+nsurl *content_get_refresh_url(struct hlcache_handle *c);
struct bitmap *content_get_bitmap(struct hlcache_handle *c);
bool content_get_opaque(struct hlcache_handle *h);
bool content_get_quirks(struct hlcache_handle *c);
diff --git a/content/content_protected.h b/content/content_protected.h
index 633f33241..eeaa67cbf 100644
--- a/content/content_protected.h
+++ b/content/content_protected.h
@@ -106,8 +106,7 @@ struct content {
bool quirks; /**< Content is in quirks mode */
char *fallback_charset; /**< Fallback charset, or NULL */
- /** URL for refresh request, in standard form as from url_join. */
- char *refresh;
+ nsurl *refresh; /**< URL for refresh request */
unsigned int time; /**< Creation time,
if LOADING or READY,
@@ -169,7 +168,7 @@ void content__request_redraw(struct content *c,
bool content__set_title(struct content *c, const char *title);
lwc_string *content__get_mime_type(struct content *c);
-const char *content__get_url(struct content *c);
+nsurl *content__get_url(struct content *c);
const char *content__get_title(struct content *c);
const char *content__get_status_message(struct content *c);
int content__get_width(struct content *c);
@@ -177,7 +176,7 @@ int content__get_height(struct content *c);
int content__get_available_width(struct content *c);
const char *content__get_source_data(struct content *c, unsigned long *size);
void content__invalidate_reuse_data(struct content *c);
-const char *content__get_refresh_url(struct content *c);
+nsurl *content__get_refresh_url(struct content *c);
struct bitmap *content__get_bitmap(struct content *c);
bool content__get_opaque(struct content *c);
diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c
index f217d6e53..c8557b6ea 100644
--- a/content/fetchers/resource.c
+++ b/content/fetchers/resource.c
@@ -41,6 +41,7 @@
#include "content/fetch.h"
#include "content/fetchers/resource.h"
#include "content/urldb.h"
+#include "desktop/gui.h"
#include "desktop/netsurf.h"
#include "desktop/options.h"
#include "utils/log.h"
diff --git a/content/fetchers/resource.h b/content/fetchers/resource.h
index 35c397310..79d8e37c4 100644
--- a/content/fetchers/resource.h
+++ b/content/fetchers/resource.h
@@ -37,17 +37,4 @@
*/
void fetch_resource_register(void);
-/**
- * Callback to translate resource to full url.
- *
- * Transforms a resource: filename into a full URL. The returned URL
- * is used as the target for a redirect. The caller takes ownership of
- * the returned string including freeing it when finished with it.
- *
- * \param filename The filename of the resource to locate.
- * \return A string containing the full URL of the target object or
- * NULL if no suitable resource can be found.
- */
-char* gui_get_resource_url(const char *filename);
-
#endif
diff --git a/content/hlcache.c b/content/hlcache.c
index f7da968b5..cb5438a8b 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -225,16 +225,14 @@ nserror hlcache_poll(void)
}
/* See hlcache.h for documentation */
-nserror hlcache_handle_retrieve(const char *url, uint32_t flags,
- const char *referer, llcache_post_data *post,
+nserror hlcache_handle_retrieve(nsurl *url, uint32_t flags,
+ nsurl *referer, llcache_post_data *post,
hlcache_handle_callback cb, void *pw,
hlcache_child_context *child,
content_type accepted_types, hlcache_handle **result)
{
hlcache_retrieval_ctx *ctx;
nserror error;
- nsurl *nsref = NULL;
- nsurl *nsurl;
assert(cb != NULL);
@@ -266,42 +264,16 @@ nserror hlcache_handle_retrieve(const char *url, uint32_t flags,
ctx->handle->cb = cb;
ctx->handle->pw = pw;
- error = nsurl_create(url, &nsurl);
- if (error != NSERROR_OK) {
- free((char *) ctx->child.charset);
- free(ctx->handle);
- free(ctx);
- return error;
- }
-
- if (referer != NULL) {
- error = nsurl_create(referer, &nsref);
- if (error != NSERROR_OK) {
- free((char *) ctx->child.charset);
- free(ctx->handle);
- free(ctx);
- nsurl_unref(nsurl);
- return error;
- }
- }
-
- error = llcache_handle_retrieve(nsurl, flags, nsref, post,
+ error = llcache_handle_retrieve(url, flags, referer, post,
hlcache_llcache_callback, ctx,
&ctx->llcache);
if (error != NSERROR_OK) {
- nsurl_unref(nsurl);
- if (nsref != NULL)
- nsurl_unref(nsref);
free((char *) ctx->child.charset);
free(ctx->handle);
free(ctx);
return error;
}
- nsurl_unref(nsurl);
- if (nsref != NULL)
- nsurl_unref(nsref);
-
RING_INSERT(hlcache->retrieval_ctx_ring, ctx);
*result = ctx->handle;
diff --git a/content/hlcache.h b/content/hlcache.h
index 196e689bb..a817b0fbd 100644
--- a/content/hlcache.h
+++ b/content/hlcache.h
@@ -129,8 +129,8 @@ nserror hlcache_poll(void);
*
* \todo Is there any way to sensibly reduce the number of parameters here?
*/
-nserror hlcache_handle_retrieve(const char *url, uint32_t flags,
- const char *referer, llcache_post_data *post,
+nserror hlcache_handle_retrieve(nsurl *url, uint32_t flags,
+ nsurl *referer, llcache_post_data *post,
hlcache_handle_callback cb, void *pw,
hlcache_child_context *child,
content_type accepted_types, hlcache_handle **result);