Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/976eca99580339c8cbb81819b54134de9ac8b97e
...commit
http://git.netsurf-browser.org/netsurf.git/commit/976eca99580339c8cbb81819b54134de9ac8b97e
...tree
http://git.netsurf-browser.org/netsurf.git/tree/976eca99580339c8cbb81819b54134de9ac8b97e
The branch, master has been updated
via 976eca99580339c8cbb81819b54134de9ac8b97e (commit)
from 22d84a587b299f028dbff4d3f8d8ecd56b275c2f (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=976eca99580339c8cbb81819b54134de9ac8b97e
commit 976eca99580339c8cbb81819b54134de9ac8b97e
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
msplit public url database API out for frontends
diff --git a/content/handlers/css/select.c b/content/handlers/css/select.c
index 6af2014..69a1b2f 100644
--- a/content/handlers/css/select.c
+++ b/content/handlers/css/select.c
@@ -23,7 +23,8 @@
#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "utils/log.h"
-#include "content/urldb.h"
+#include "utils/nsurl.h"
+#include "netsurf/url_db.h"
#include "desktop/system_colour.h"
#include "css/internal.h"
diff --git a/content/urldb.c b/content/urldb.c
index 5230438..2f7b4a7 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -104,6 +104,7 @@
#include "utils/utils.h"
#include "utils/bloom.h"
#include "utils/time.h"
+#include "utils/nsurl.h"
#include "netsurf/bitmap.h"
#include "desktop/cookie_manager.h"
#include "desktop/gui_internal.h"
@@ -112,6 +113,9 @@
#include "content/urldb.h"
struct cookie_internal_data {
+ struct cookie_internal_data *prev; /**< Previous in list */
+ struct cookie_internal_data *next; /**< Next in list */
+
char *name; /**< Cookie name */
char *value; /**< Cookie value */
bool value_was_quoted; /**< Value was quoted in Set-Cookie: */
@@ -124,12 +128,10 @@ struct cookie_internal_data {
time_t last_used; /**< Last used time */
bool secure; /**< Only send for HTTPS requests */
bool http_only; /**< Only expose to HTTP(S) requests */
- cookie_version version; /**< Specification compliance */
+ enum cookie_version version; /**< Specification compliance */
bool no_destroy; /**< Never destroy this cookie,
* unless it's expired */
- struct cookie_internal_data *prev; /**< Previous in list */
- struct cookie_internal_data *next; /**< Next in list */
};
/* A protection space is defined as a tuple canonical_root_url and realm.
diff --git a/content/urldb.h b/content/urldb.h
index ddbac6a..1246401 100644
--- a/content/urldb.h
+++ b/content/urldb.h
@@ -16,54 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Unified URL information database (interface)
+/**
+ * \file
+ * Unified URL information database internal interface.
*/
#ifndef _NETSURF_CONTENT_URLDB_H_
#define _NETSURF_CONTENT_URLDB_H_
-#include <stdbool.h>
-#include <time.h>
-
-#include "utils/nsurl.h"
-#include "netsurf/content_type.h"
-
-typedef enum {
- COOKIE_NETSCAPE = 0,
- COOKIE_RFC2109 = 1,
- COOKIE_RFC2965 = 2
-} cookie_version;
-
-struct url_data {
- const char *title; /**< Resource title */
- unsigned int visits; /**< Visit count */
- time_t last_visit; /**< Last visit time */
- content_type type; /**< Type of resource */
-};
-
-struct cookie_data {
- const char *name; /**< Cookie name */
- const char *value; /**< Cookie value */
- const bool value_was_quoted; /**< Value was quoted in Set-Cookie: */
- const char *comment; /**< Cookie comment */
- const bool domain_from_set; /**< Domain came from Set-Cookie:
header */
- const char *domain; /**< Domain */
- const bool path_from_set; /**< Path came from Set-Cookie: header
*/
- const char *path; /**< Path */
- const time_t expires; /**< Expiry timestamp, or 1 for session
*/
- const time_t last_used; /**< Last used time */
- const bool secure; /**< Only send for HTTPS requests */
- const bool http_only; /**< Only expose to HTTP(S) requests */
- cookie_version version; /**< Specification compliance */
- const bool no_destroy; /**< Never destroy this cookie,
- * unless it's expired */
-
- const struct cookie_data *prev; /**< Previous in list */
- const struct cookie_data *next; /**< Next in list */
-};
-
-struct bitmap;
+#include <libwapcaplet/libwapcaplet.h>
+
+#include "netsurf/url_db.h"
+#include "netsurf/cookie_db.h"
/**
* Destroy urldb
@@ -71,32 +35,14 @@ struct bitmap;
void urldb_destroy(void);
-/* Persistence support */
-
-/**
- * Import an URL database from file, replacing any existing database
- *
- * \param filename Name of file containing data
- */
-nserror urldb_load(const char *filename);
-
-/**
- * Export the current database to file
- *
- * \param filename Name of file to export to
- */
-nserror urldb_save(const char *filename);
-
/**
* Set the cross-session persistence of the entry for an URL
*
* \param url Absolute URL to persist
* \param persist True to persist, false otherwise
*/
-void urldb_set_url_persistence(nsurl *url, bool persist);
-
+void urldb_set_url_persistence(struct nsurl *url, bool persist);
-/* URL insertion */
/**
* Insert an URL into the database
@@ -104,10 +50,8 @@ void urldb_set_url_persistence(nsurl *url, bool persist);
* \param url Absolute URL to insert
* \return true on success, false otherwise
*/
-bool urldb_add_url(nsurl *url);
-
+bool urldb_add_url(struct nsurl *url);
-/* URL data modification / lookup */
/**
* Set an URL's title string, replacing any existing one
@@ -115,7 +59,8 @@ bool urldb_add_url(nsurl *url);
* \param url The URL to look for
* \param title The title string to use (copied)
*/
-void urldb_set_url_title(nsurl *url, const char *title);
+void urldb_set_url_title(struct nsurl *url, const char *title);
+
/**
* Set an URL's content type
@@ -123,29 +68,24 @@ void urldb_set_url_title(nsurl *url, const char *title);
* \param url The URL to look for
* \param type The type to set
*/
-void urldb_set_url_content_type(nsurl *url, content_type type);
+void urldb_set_url_content_type(struct nsurl *url, content_type type);
+
/**
* Update an URL's visit data
*
* \param url The URL to update
*/
-void urldb_update_url_visit_data(nsurl *url);
+void urldb_update_url_visit_data(struct nsurl *url);
+
/**
* Reset an URL's visit statistics
*
* \param url The URL to reset
*/
-void urldb_reset_url_visit_data(nsurl *url);
+void urldb_reset_url_visit_data(struct nsurl *url);
-/**
- * Find data for an URL.
- *
- * \param url Absolute URL to look for
- * \return Pointer to result struct, or NULL
- */
-const struct url_data *urldb_get_url_data(nsurl *url);
/**
* Extract an URL from the db
@@ -153,41 +93,9 @@ const struct url_data *urldb_get_url_data(nsurl *url);
* \param url URL to extract
* \return Pointer to database's copy of URL or NULL if not found
*/
-nsurl *urldb_get_url(nsurl *url);
-
-
-/* Authentication modification / lookup */
-
-/**
- * Set authentication data for an URL
- *
- * \param url The URL to consider
- * \param realm The authentication realm
- * \param auth The authentication details (in form username:password)
- */
-void urldb_set_auth_details(nsurl *url, const char *realm, const char *auth);
-
-/**
- * Look up authentication details in database
- *
- * \param url Absolute URL to search for
- * \param realm When non-NULL, it is realm which can be used to determine
- * the protection space when that's not been done before for given URL.
- * \return Pointer to authentication details, or NULL if not found
- */
-const char *urldb_get_auth_details(nsurl *url, const char *realm);
+struct nsurl *urldb_get_url(struct nsurl *url);
-/* SSL certificate permissions */
-
-/**
- * Set certificate verification permissions
- *
- * \param url URL to consider
- * \param permit Set to true to allow invalid certificates
- */
-void urldb_set_cert_permissions(nsurl *url, bool permit);
-
/**
* Retrieve certificate verification permissions from database
*
@@ -195,59 +103,17 @@ void urldb_set_cert_permissions(nsurl *url, bool permit);
* \return true to permit connections to hosts with invalid certificates,
* false otherwise.
*/
-bool urldb_get_cert_permissions(nsurl *url);
+bool urldb_get_cert_permissions(struct nsurl *url);
-/* Thumbnail handling */
-
/**
* Set thumbnail for url, replacing any existing thumbnail
*
* \param url Absolute URL to consider
* \param bitmap Opaque pointer to thumbnail data, or NULL to invalidate
*/
-void urldb_set_thumbnail(nsurl *url, struct bitmap *bitmap);
+void urldb_set_thumbnail(struct nsurl *url, struct bitmap *bitmap);
-/**
- * Retrieve thumbnail data for given URL
- *
- * \param url Absolute URL to search for
- * \return Pointer to thumbnail data, or NULL if not found.
- */
-struct bitmap *urldb_get_thumbnail(nsurl *url);
-
-
-/* URL completion */
-
-/**
- * Iterate over entries in the database which match the given prefix
- *
- * \param prefix Prefix to match
- * \param callback Callback function
- */
-void urldb_iterate_partial(const char *prefix,
- bool (*callback)(nsurl *url, const struct url_data *data));
-
-
-/* Iteration */
-
-/**
- * Iterate over all entries in database
- *
- * \param callback Function to callback for each entry
- */
-void urldb_iterate_entries(bool (*callback)(nsurl *url,
- const struct url_data *data));
-
-/**
- * Iterate over all cookies in database
- *
- * \param callback Function to callback for each entry
- */
-void urldb_iterate_cookies(bool (*callback)(const struct cookie_data *cookie));
-
-
-/* Cookies */
/**
* Parse Set-Cookie header and insert cookie(s) into database
@@ -257,7 +123,8 @@ void urldb_iterate_cookies(bool (*callback)(const struct
cookie_data *cookie));
* \param referer Referring resource, or 0 for verifiable transaction
* \return true on success, false otherwise
*/
-bool urldb_set_cookie(const char *header, nsurl *url, nsurl *referer);
+bool urldb_set_cookie(const char *header, struct nsurl *url, struct nsurl
*referer);
+
/**
* Retrieve cookies for an URL
@@ -266,41 +133,8 @@ bool urldb_set_cookie(const char *header, nsurl *url,
nsurl *referer);
* \param include_http_only Whether to include HTTP(S) only cookies.
* \return Cookies string for libcurl (on heap), or NULL on error/no cookies
*/
-char *urldb_get_cookie(nsurl *url, bool include_http_only);
+char *urldb_get_cookie(struct nsurl *url, bool include_http_only);
-/**
- * Delete a cookie
- *
- * \param domain The cookie's domain
- * \param path The cookie's path
- * \param name The cookie's name
- */
-void urldb_delete_cookie(const char *domain, const char *path, const char
*name);
-
-/**
- * Load a cookie file into the database
- *
- * \param filename File to load
- */
-void urldb_load_cookies(const char *filename);
-
-/**
- * Save persistent cookies to file
- *
- * \param filename Path to save to
- */
-void urldb_save_cookies(const char *filename);
-
-
-/* Debug */
-
-/**
- * Dump URL database to stderr
- */
-void urldb_dump(void);
-
-
-/* test harness only */
/**
* Add a host to the database, creating any intermediate entries
@@ -310,6 +144,7 @@ void urldb_dump(void);
*/
struct host_part *urldb_add_host(const char *host);
+
/**
* Add a path to the database, creating any intermediate entries
*
@@ -323,6 +158,7 @@ struct host_part *urldb_add_host(const char *host);
*/
struct path_data *urldb_add_path(lwc_string *scheme, unsigned int port,
const struct host_part *host, char *path_query,
- lwc_string *fragment, nsurl *url);
+ lwc_string *fragment, struct nsurl *url);
+
#endif
diff --git a/desktop/global_history.c b/desktop/global_history.c
index 01b7dee..ac4790f 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -19,12 +19,14 @@
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/utf8.h"
#include "utils/libdom.h"
#include "utils/log.h"
+#include "utils/nsurl.h"
#include "content/urldb.h"
#include "desktop/global_history.h"
diff --git a/desktop/hotlist.c b/desktop/hotlist.c
index eae5ad8..de26ff6 100644
--- a/desktop/hotlist.c
+++ b/desktop/hotlist.c
@@ -31,6 +31,7 @@
#include "utils/utf8.h"
#include "utils/libdom.h"
#include "utils/log.h"
+#include "utils/nsurl.h"
#include "content/urldb.h"
#include "netsurf/misc.h"
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 9bd1cd4..afb49a5 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -103,9 +103,10 @@
#include "netsurf/netsurf.h"
#include "netsurf/content.h"
#include "netsurf/browser_window.h"
+#include "netsurf/cookie_db.h"
+#include "netsurf/url_db.h"
#include "content/backing_store.h"
#include "content/fetchers.h"
-#include "content/urldb.h"
#include "desktop/browser_history.h"
#include "desktop/hotlist.h"
#include "desktop/version.h"
diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c
index d54c2fa..3b338bf 100755
--- a/frontends/amiga/login.c
+++ b/frontends/amiga/login.c
@@ -39,10 +39,10 @@
#include <reaction/reaction_macros.h>
#include "utils/messages.h"
-#include "utils/errors.h"
-#include "content/urldb.h"
+#include "utils/nsurl.h"
#include "netsurf/mouse.h"
#include "netsurf/window.h"
+#include "netsurf/url_db.h"
#include "amiga/gui.h"
#include "amiga/libs.h"
diff --git a/frontends/amiga/stringview/urlhistory.c
b/frontends/amiga/stringview/urlhistory.c
index c58a377..7405fbb 100644
--- a/frontends/amiga/stringview/urlhistory.c
+++ b/frontends/amiga/stringview/urlhistory.c
@@ -26,10 +26,11 @@
#include "amiga/os3support.h"
-#include "urlhistory.h"
-
-#include "content/urldb.h"
#include "utils/nsoption.h"
+#include "utils/nsurl.h"
+#include "netsurf/url_db.h"
+
+#include "urlhistory.h"
static struct List PageList;
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
index 7a6f8b3..033e356 100644
--- a/frontends/amiga/tree.c
+++ b/frontends/amiga/tree.c
@@ -55,7 +55,6 @@
#include "utils/messages.h"
#include "netsurf/browser_window.h"
#include "netsurf/window.h"
-#include "content/urldb.h"
#include "content/llcache.h"
#include "desktop/cookie_manager.h"
#include "desktop/global_history.h"
diff --git a/frontends/atari/gui.c b/frontends/atari/gui.c
index 36ef527..713db8b 100644
--- a/frontends/atari/gui.c
+++ b/frontends/atari/gui.c
@@ -37,7 +37,8 @@
#include "netsurf/misc.h"
#include "netsurf/netsurf.h"
#include "netsurf/content.h"
-#include "content/urldb.h"
+#include "netsurf/cookie_db.h"
+#include "netsurf/url_db.h"
#include "content/backing_store.h"
#include "desktop/treeview.h"
diff --git a/frontends/beos/cookies.cpp b/frontends/beos/cookies.cpp
index 0a417a2..8e6801e 100644
--- a/frontends/beos/cookies.cpp
+++ b/frontends/beos/cookies.cpp
@@ -24,7 +24,7 @@ extern "C" {
#include "utils/log.h"
#include "netsurf/mouse.h"
#include "netsurf/plotters.h"
-#include "content/urldb.h"
+#include "netsurf/cookie_db.h"
#include "desktop/cookie_manager.h"
#include "desktop/tree.h"
#include "desktop/textinput.h"
diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp
index 6337825..0dcbd6b 100644
--- a/frontends/beos/gui.cpp
+++ b/frontends/beos/gui.cpp
@@ -54,6 +54,7 @@ extern "C" {
#include "utils/corestrings.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "utils/nsurl.h"
#include "netsurf/misc.h"
#include "netsurf/clipboard.h"
#include "netsurf/search.h"
@@ -61,8 +62,9 @@ extern "C" {
#include "netsurf/netsurf.h"
#include "netsurf/content.h"
#include "netsurf/browser_window.h"
+#include "netsurf/cookie_db.h"
+#include "netsurf/url_db.h"
#include "content/fetchers.h"
-#include "content/urldb.h"
}
diff --git a/frontends/beos/window.cpp b/frontends/beos/window.cpp
index dd1e729..2944033 100644
--- a/frontends/beos/window.cpp
+++ b/frontends/beos/window.cpp
@@ -39,13 +39,14 @@ extern "C" {
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "utils/nsurl.h"
#include "netsurf/content_type.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
#include "netsurf/plotters.h"
#include "netsurf/window.h"
#include "netsurf/clipboard.h"
-#include "content/urldb.h"
+#include "netsurf/url_db.h"
#include "desktop/textinput.h"
}
diff --git a/frontends/cocoa/NetsurfApp.m b/frontends/cocoa/NetsurfApp.m
index 7584f4f..5206591 100644
--- a/frontends/cocoa/NetsurfApp.m
+++ b/frontends/cocoa/NetsurfApp.m
@@ -32,11 +32,13 @@
#import "utils/messages.h"
#import "utils/utils.h"
#import "utils/nsoption.h"
+#import "utils/nsurl.h"
#import "netsurf/plotters.h"
#import "netsurf/mouse.h"
#import "netsurf/netsurf.h"
#import "netsurf/browser_window.h"
-#import "content/urldb.h"
+#import "netsurf/cookie_db.h"
+#import "netsurf/url_db.h"
#import "desktop/save_complete.h"
#import "desktop/textinput.h"
#import "desktop/tree.h"
diff --git a/frontends/cocoa/URLFieldCell.m b/frontends/cocoa/URLFieldCell.m
index 1b4344b..e9e6647 100644
--- a/frontends/cocoa/URLFieldCell.m
+++ b/frontends/cocoa/URLFieldCell.m
@@ -18,7 +18,8 @@
#import "cocoa/URLFieldCell.h"
-#import "content/urldb.h"
+#import "utils/nsurl.h"
+#import "netsurf/url_db.h"
@interface URLFieldCell ()
diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c
index 7ef64b0..6879886 100644
--- a/frontends/framebuffer/gui.c
+++ b/frontends/framebuffer/gui.c
@@ -41,7 +41,7 @@
#include "netsurf/window.h"
#include "netsurf/misc.h"
#include "netsurf/netsurf.h"
-#include "content/urldb.h"
+#include "netsurf/cookie_db.h"
#include "content/fetch.h"
#include "framebuffer/gui.h"
diff --git a/frontends/gtk/completion.c b/frontends/gtk/completion.c
index 9b76411..eea0a78 100644
--- a/frontends/gtk/completion.c
+++ b/frontends/gtk/completion.c
@@ -26,9 +26,10 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
-#include "content/urldb.h"
-#include "desktop/searchweb.h"
+#include "utils/nsurl.h"
+#include "netsurf/url_db.h"
#include "netsurf/browser_window.h"
+#include "desktop/searchweb.h"
#include "gtk/warn.h"
#include "gtk/scaffolding.h"
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index 3c7cdeb..16d9199 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -39,7 +39,8 @@
#include "utils/file.h"
#include "utils/nsoption.h"
#include "content/fetchers.h"
-#include "content/urldb.h"
+#include "netsurf/url_db.h"
+#include "netsurf/cookie_db.h"
#include "content/backing_store.h"
#include "netsurf/browser_window.h"
#include "desktop/save_complete.h"
diff --git a/frontends/gtk/login.c b/frontends/gtk/login.c
index ee77052..3e29903 100644
--- a/frontends/gtk/login.c
+++ b/frontends/gtk/login.c
@@ -22,7 +22,7 @@
#include "utils/log.h"
#include "utils/nsurl.h"
-#include "content/urldb.h"
+#include "netsurf/url_db.h"
#include "gtk/resources.h"
#include "gtk/login.h"
diff --git a/frontends/monkey/main.c b/frontends/monkey/main.c
index c9bb8ab..0ddfd9a 100644
--- a/frontends/monkey/main.c
+++ b/frontends/monkey/main.c
@@ -33,7 +33,8 @@
#include "utils/nsurl.h"
#include "netsurf/misc.h"
#include "netsurf/netsurf.h"
-#include "content/urldb.h"
+#include "netsurf/url_db.h"
+#include "netsurf/cookie_db.h"
#include "content/fetchers.h"
#include "monkey/dispatch.h"
diff --git a/frontends/riscos/401login.c b/frontends/riscos/401login.c
index 35402ec..a23c01c 100644
--- a/frontends/riscos/401login.c
+++ b/frontends/riscos/401login.c
@@ -26,7 +26,7 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsurl.h"
-#include "content/urldb.h"
+#include "netsurf/url_db.h"
#include "riscos/gui.h"
#include "riscos/dialog.h"
diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c
index 2e8f433..2b369ec 100644
--- a/frontends/riscos/gui.c
+++ b/frontends/riscos/gui.c
@@ -52,9 +52,10 @@
#include "netsurf/content.h"
#include "netsurf/netsurf.h"
#include "netsurf/browser_window.h"
+#include "netsurf/cookie_db.h"
+#include "netsurf/url_db.h"
#include "desktop/save_complete.h"
#include "desktop/treeview.h"
-#include "content/urldb.h"
#include "content/backing_store.h"
#include "riscos/gui.h"
diff --git a/frontends/riscos/hotlist.c b/frontends/riscos/hotlist.c
index 1f5fc21..6041658 100644
--- a/frontends/riscos/hotlist.c
+++ b/frontends/riscos/hotlist.c
@@ -35,10 +35,11 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
-#include "content/urldb.h"
+#include "utils/nsurl.h"
+#include "netsurf/url_db.h"
+#include "netsurf/window.h"
#include "desktop/hotlist.h"
#include "desktop/tree.h"
-#include "netsurf/window.h"
#include "riscos/gui.h"
#include "riscos/dialog.h"
diff --git a/frontends/riscos/url_complete.c b/frontends/riscos/url_complete.c
index eebb764..3ca9be4 100644
--- a/frontends/riscos/url_complete.c
+++ b/frontends/riscos/url_complete.c
@@ -30,7 +30,8 @@
#include "utils/log.h"
#include "utils/nsoption.h"
-#include "content/urldb.h"
+#include "utils/nsurl.h"
+#include "netsurf/url_db.h"
#include "netsurf/browser_window.h"
#include "riscos/global_history.h"
diff --git a/frontends/riscos/url_suggest.c b/frontends/riscos/url_suggest.c
index ef1fcc7..0d7b0eb 100644
--- a/frontends/riscos/url_suggest.c
+++ b/frontends/riscos/url_suggest.c
@@ -26,7 +26,8 @@
#include <oslib/wimp.h>
#include "utils/messages.h"
-#include "content/urldb.h"
+#include "utils/nsurl.h"
+#include "netsurf/url_db.h"
#include "riscos/menus.h"
#include "riscos/url_suggest.h"
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index 35efefb..152bff3 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -51,12 +51,13 @@
#include "utils/utils.h"
#include "utils/messages.h"
#include "utils/string.h"
+#include "utils/nsurl.h"
#include "netsurf/content.h"
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
#include "netsurf/window.h"
#include "netsurf/bitmap.h"
-#include "content/urldb.h"
+#include "netsurf/url_db.h"
#include "desktop/browser_history.h"
#include "desktop/cookie_manager.h"
#include "desktop/scrollbar.h"
diff --git a/include/netsurf/cookie_db.h b/include/netsurf/cookie_db.h
new file mode 100644
index 0000000..54d0145
--- /dev/null
+++ b/include/netsurf/cookie_db.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2006 John M Bell <[email protected]>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Unified cookie database public interface.
+ */
+
+#ifndef _NETSURF_COOKIE_DB_H_
+#define _NETSURF_COOKIE_DB_H_
+
+#include <stdbool.h>
+#include <time.h>
+
+enum cookie_version {
+ COOKIE_NETSCAPE = 0,
+ COOKIE_RFC2109 = 1,
+ COOKIE_RFC2965 = 2
+};
+
+struct cookie_data {
+ const struct cookie_data *prev; /**< Previous in list */
+ const struct cookie_data *next; /**< Next in list */
+
+ const char *name; /**< Cookie name */
+ const char *value; /**< Cookie value */
+ const bool value_was_quoted; /**< Value was quoted in Set-Cookie: */
+ const char *comment; /**< Cookie comment */
+ const bool domain_from_set; /**< Domain came from Set-Cookie: header */
+ const char *domain; /**< Domain */
+ const bool path_from_set; /**< Path came from Set-Cookie: header */
+ const char *path; /**< Path */
+ const time_t expires; /**< Expiry timestamp, or 1 for session */
+ const time_t last_used; /**< Last used time */
+ const bool secure; /**< Only send for HTTPS requests */
+ const bool http_only; /**< Only expose to HTTP(S) requests */
+ enum cookie_version version; /**< Specification compliance */
+
+ /** Never destroy this cookie, unless it's expired */
+ const bool no_destroy;
+};
+
+/**
+ * Iterate over all cookies in database
+ *
+ * \param callback Function to callback for each entry
+ */
+void urldb_iterate_cookies(bool (*callback)(const struct cookie_data *cookie));
+
+/**
+ * Delete a cookie
+ *
+ * \param domain The cookie's domain
+ * \param path The cookie's path
+ * \param name The cookie's name
+ */
+void urldb_delete_cookie(const char *domain, const char *path, const char
*name);
+
+/**
+ * Load a cookie file into the database
+ *
+ * \param filename File to load
+ */
+void urldb_load_cookies(const char *filename);
+
+/**
+ * Save persistent cookies to file
+ *
+ * \param filename Path to save to
+ */
+void urldb_save_cookies(const char *filename);
+
+
+
+#endif
diff --git a/include/netsurf/url_db.h b/include/netsurf/url_db.h
new file mode 100644
index 0000000..be2c656
--- /dev/null
+++ b/include/netsurf/url_db.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2006 John M Bell <[email protected]>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Unified URL information database public interface
+ */
+
+#ifndef _NETSURF_URL_DB_H_
+#define _NETSURF_URL_DB_H_
+
+#include <stdbool.h>
+#include <time.h>
+
+#include "utils/errors.h"
+#include "netsurf/content_type.h"
+
+struct nsurl;
+struct bitmap;
+
+struct url_data {
+ const char *title; /**< Resource title */
+ unsigned int visits; /**< Visit count */
+ time_t last_visit; /**< Last visit time */
+ content_type type; /**< Type of resource */
+};
+
+
+/**
+ * Import an URL database from file, replacing any existing database
+ *
+ * \param filename Name of file containing data
+ */
+nserror urldb_load(const char *filename);
+
+
+/**
+ * Export the current database to file
+ *
+ * \param filename Name of file to export to
+ */
+nserror urldb_save(const char *filename);
+
+
+/**
+ * Set authentication data for an URL
+ *
+ * \param url The URL to consider
+ * \param realm The authentication realm
+ * \param auth The authentication details (in form username:password)
+ */
+void urldb_set_auth_details(struct nsurl *url, const char *realm, const char
*auth);
+
+
+/**
+ * Look up authentication details in database
+ *
+ * \param url Absolute URL to search for
+ * \param realm When non-NULL, it is realm which can be used to determine
+ * the protection space when that's not been done before for given URL.
+ * \return Pointer to authentication details, or NULL if not found
+ */
+const char *urldb_get_auth_details(struct nsurl *url, const char *realm);
+
+
+/**
+ * Iterate over entries in the database which match the given prefix
+ *
+ * \param prefix Prefix to match
+ * \param callback Callback function
+ */
+void urldb_iterate_partial(const char *prefix, bool (*callback)(struct nsurl
*url, const struct url_data *data));
+
+
+/**
+ * Iterate over all entries in database
+ *
+ * \param callback Function to callback for each entry
+ */
+void urldb_iterate_entries(bool (*callback)(struct nsurl *url, const struct
url_data *data));
+
+
+/**
+ * Retrieve thumbnail data for given URL
+ *
+ * \param url Absolute URL to search for
+ * \return Pointer to thumbnail data, or NULL if not found.
+ */
+struct bitmap *urldb_get_thumbnail(struct nsurl *url);
+
+
+/**
+ * Find data for an URL.
+ *
+ * \param url Absolute URL to look for
+ * \return Pointer to result struct, or NULL
+ */
+const struct url_data *urldb_get_url_data(struct nsurl *url);
+
+
+/**
+ * Set certificate verification permissions
+ *
+ * \param url URL to consider
+ * \param permit Set to true to allow invalid certificates
+ */
+void urldb_set_cert_permissions(struct nsurl *url, bool permit);
+
+
+/**
+ * Dump URL database to stderr
+ */
+void urldb_dump(void);
+
+#endif
-----------------------------------------------------------------------
Summary of changes:
content/handlers/css/select.c | 3 +-
content/urldb.c | 8 +-
content/urldb.h | 214 ++++---------------------------
desktop/global_history.c | 2 +
desktop/hotlist.c | 1 +
frontends/amiga/gui.c | 3 +-
frontends/amiga/login.c | 4 +-
frontends/amiga/stringview/urlhistory.c | 7 +-
frontends/amiga/tree.c | 1 -
frontends/atari/gui.c | 3 +-
frontends/beos/cookies.cpp | 2 +-
frontends/beos/gui.cpp | 4 +-
frontends/beos/window.cpp | 3 +-
frontends/cocoa/NetsurfApp.m | 4 +-
frontends/cocoa/URLFieldCell.m | 3 +-
frontends/framebuffer/gui.c | 2 +-
frontends/gtk/completion.c | 5 +-
frontends/gtk/gui.c | 3 +-
frontends/gtk/login.c | 2 +-
frontends/monkey/main.c | 3 +-
frontends/riscos/401login.c | 2 +-
frontends/riscos/gui.c | 3 +-
frontends/riscos/hotlist.c | 5 +-
frontends/riscos/url_complete.c | 3 +-
frontends/riscos/url_suggest.c | 3 +-
frontends/riscos/window.c | 3 +-
include/netsurf/cookie_db.h | 90 +++++++++++++
include/netsurf/url_db.h | 130 +++++++++++++++++++
28 files changed, 297 insertions(+), 219 deletions(-)
create mode 100644 include/netsurf/cookie_db.h
create mode 100644 include/netsurf/url_db.h
diff --git a/content/handlers/css/select.c b/content/handlers/css/select.c
index 6af2014..69a1b2f 100644
--- a/content/handlers/css/select.c
+++ b/content/handlers/css/select.c
@@ -23,7 +23,8 @@
#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "utils/log.h"
-#include "content/urldb.h"
+#include "utils/nsurl.h"
+#include "netsurf/url_db.h"
#include "desktop/system_colour.h"
#include "css/internal.h"
diff --git a/content/urldb.c b/content/urldb.c
index 5230438..2f7b4a7 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -104,6 +104,7 @@
#include "utils/utils.h"
#include "utils/bloom.h"
#include "utils/time.h"
+#include "utils/nsurl.h"
#include "netsurf/bitmap.h"
#include "desktop/cookie_manager.h"
#include "desktop/gui_internal.h"
@@ -112,6 +113,9 @@
#include "content/urldb.h"
struct cookie_internal_data {
+ struct cookie_internal_data *prev; /**< Previous in list */
+ struct cookie_internal_data *next; /**< Next in list */
+
char *name; /**< Cookie name */
char *value; /**< Cookie value */
bool value_was_quoted; /**< Value was quoted in Set-Cookie: */
@@ -124,12 +128,10 @@ struct cookie_internal_data {
time_t last_used; /**< Last used time */
bool secure; /**< Only send for HTTPS requests */
bool http_only; /**< Only expose to HTTP(S) requests */
- cookie_version version; /**< Specification compliance */
+ enum cookie_version version; /**< Specification compliance */
bool no_destroy; /**< Never destroy this cookie,
* unless it's expired */
- struct cookie_internal_data *prev; /**< Previous in list */
- struct cookie_internal_data *next; /**< Next in list */
};
/* A protection space is defined as a tuple canonical_root_url and realm.
diff --git a/content/urldb.h b/content/urldb.h
index ddbac6a..1246401 100644
--- a/content/urldb.h
+++ b/content/urldb.h
@@ -16,54 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Unified URL information database (interface)
+/**
+ * \file
+ * Unified URL information database internal interface.
*/
#ifndef _NETSURF_CONTENT_URLDB_H_
#define _NETSURF_CONTENT_URLDB_H_
-#include <stdbool.h>
-#include <time.h>
-
-#include "utils/nsurl.h"
-#include "netsurf/content_type.h"
-
-typedef enum {
- COOKIE_NETSCAPE = 0,
- COOKIE_RFC2109 = 1,
- COOKIE_RFC2965 = 2
-} cookie_version;
-
-struct url_data {
- const char *title; /**< Resource title */
- unsigned int visits; /**< Visit count */
- time_t last_visit; /**< Last visit time */
- content_type type; /**< Type of resource */
-};
-
-struct cookie_data {
- const char *name; /**< Cookie name */
- const char *value; /**< Cookie value */
- const bool value_was_quoted; /**< Value was quoted in Set-Cookie: */
- const char *comment; /**< Cookie comment */
- const bool domain_from_set; /**< Domain came from Set-Cookie:
header */
- const char *domain; /**< Domain */
- const bool path_from_set; /**< Path came from Set-Cookie: header
*/
- const char *path; /**< Path */
- const time_t expires; /**< Expiry timestamp, or 1 for session
*/
- const time_t last_used; /**< Last used time */
- const bool secure; /**< Only send for HTTPS requests */
- const bool http_only; /**< Only expose to HTTP(S) requests */
- cookie_version version; /**< Specification compliance */
- const bool no_destroy; /**< Never destroy this cookie,
- * unless it's expired */
-
- const struct cookie_data *prev; /**< Previous in list */
- const struct cookie_data *next; /**< Next in list */
-};
-
-struct bitmap;
+#include <libwapcaplet/libwapcaplet.h>
+
+#include "netsurf/url_db.h"
+#include "netsurf/cookie_db.h"
/**
* Destroy urldb
@@ -71,32 +35,14 @@ struct bitmap;
void urldb_destroy(void);
-/* Persistence support */
-
-/**
- * Import an URL database from file, replacing any existing database
- *
- * \param filename Name of file containing data
- */
-nserror urldb_load(const char *filename);
-
-/**
- * Export the current database to file
- *
- * \param filename Name of file to export to
- */
-nserror urldb_save(const char *filename);
-
/**
* Set the cross-session persistence of the entry for an URL
*
* \param url Absolute URL to persist
* \param persist True to persist, false otherwise
*/
-void urldb_set_url_persistence(nsurl *url, bool persist);
-
+void urldb_set_url_persistence(struct nsurl *url, bool persist);
-/* URL insertion */
/**
* Insert an URL into the database
@@ -104,10 +50,8 @@ void urldb_set_url_persistence(nsurl *url, bool persist);
* \param url Absolute URL to insert
* \return true on success, false otherwise
*/
-bool urldb_add_url(nsurl *url);
-
+bool urldb_add_url(struct nsurl *url);
-/* URL data modification / lookup */
/**
* Set an URL's title string, replacing any existing one
@@ -115,7 +59,8 @@ bool urldb_add_url(nsurl *url);
* \param url The URL to look for
* \param title The title string to use (copied)
*/
-void urldb_set_url_title(nsurl *url, const char *title);
+void urldb_set_url_title(struct nsurl *url, const char *title);
+
/**
* Set an URL's content type
@@ -123,29 +68,24 @@ void urldb_set_url_title(nsurl *url, const char *title);
* \param url The URL to look for
* \param type The type to set
*/
-void urldb_set_url_content_type(nsurl *url, content_type type);
+void urldb_set_url_content_type(struct nsurl *url, content_type type);
+
/**
* Update an URL's visit data
*
* \param url The URL to update
*/
-void urldb_update_url_visit_data(nsurl *url);
+void urldb_update_url_visit_data(struct nsurl *url);
+
/**
* Reset an URL's visit statistics
*
* \param url The URL to reset
*/
-void urldb_reset_url_visit_data(nsurl *url);
+void urldb_reset_url_visit_data(struct nsurl *url);
-/**
- * Find data for an URL.
- *
- * \param url Absolute URL to look for
- * \return Pointer to result struct, or NULL
- */
-const struct url_data *urldb_get_url_data(nsurl *url);
/**
* Extract an URL from the db
@@ -153,41 +93,9 @@ const struct url_data *urldb_get_url_data(nsurl *url);
* \param url URL to extract
* \return Pointer to database's copy of URL or NULL if not found
*/
-nsurl *urldb_get_url(nsurl *url);
-
-
-/* Authentication modification / lookup */
-
-/**
- * Set authentication data for an URL
- *
- * \param url The URL to consider
- * \param realm The authentication realm
- * \param auth The authentication details (in form username:password)
- */
-void urldb_set_auth_details(nsurl *url, const char *realm, const char *auth);
-
-/**
- * Look up authentication details in database
- *
- * \param url Absolute URL to search for
- * \param realm When non-NULL, it is realm which can be used to determine
- * the protection space when that's not been done before for given URL.
- * \return Pointer to authentication details, or NULL if not found
- */
-const char *urldb_get_auth_details(nsurl *url, const char *realm);
+struct nsurl *urldb_get_url(struct nsurl *url);
-/* SSL certificate permissions */
-
-/**
- * Set certificate verification permissions
- *
- * \param url URL to consider
- * \param permit Set to true to allow invalid certificates
- */
-void urldb_set_cert_permissions(nsurl *url, bool permit);
-
/**
* Retrieve certificate verification permissions from database
*
@@ -195,59 +103,17 @@ void urldb_set_cert_permissions(nsurl *url, bool permit);
* \return true to permit connections to hosts with invalid certificates,
* false otherwise.
*/
-bool urldb_get_cert_permissions(nsurl *url);
+bool urldb_get_cert_permissions(struct nsurl *url);
-/* Thumbnail handling */
-
/**
* Set thumbnail for url, replacing any existing thumbnail
*
* \param url Absolute URL to consider
* \param bitmap Opaque pointer to thumbnail data, or NULL to invalidate
*/
-void urldb_set_thumbnail(nsurl *url, struct bitmap *bitmap);
+void urldb_set_thumbnail(struct nsurl *url, struct bitmap *bitmap);
-/**
- * Retrieve thumbnail data for given URL
- *
- * \param url Absolute URL to search for
- * \return Pointer to thumbnail data, or NULL if not found.
- */
-struct bitmap *urldb_get_thumbnail(nsurl *url);
-
-
-/* URL completion */
-
-/**
- * Iterate over entries in the database which match the given prefix
- *
- * \param prefix Prefix to match
- * \param callback Callback function
- */
-void urldb_iterate_partial(const char *prefix,
- bool (*callback)(nsurl *url, const struct url_data *data));
-
-
-/* Iteration */
-
-/**
- * Iterate over all entries in database
- *
- * \param callback Function to callback for each entry
- */
-void urldb_iterate_entries(bool (*callback)(nsurl *url,
- const struct url_data *data));
-
-/**
- * Iterate over all cookies in database
- *
- * \param callback Function to callback for each entry
- */
-void urldb_iterate_cookies(bool (*callback)(const struct cookie_data *cookie));
-
-
-/* Cookies */
/**
* Parse Set-Cookie header and insert cookie(s) into database
@@ -257,7 +123,8 @@ void urldb_iterate_cookies(bool (*callback)(const struct
cookie_data *cookie));
* \param referer Referring resource, or 0 for verifiable transaction
* \return true on success, false otherwise
*/
-bool urldb_set_cookie(const char *header, nsurl *url, nsurl *referer);
+bool urldb_set_cookie(const char *header, struct nsurl *url, struct nsurl
*referer);
+
/**
* Retrieve cookies for an URL
@@ -266,41 +133,8 @@ bool urldb_set_cookie(const char *header, nsurl *url,
nsurl *referer);
* \param include_http_only Whether to include HTTP(S) only cookies.
* \return Cookies string for libcurl (on heap), or NULL on error/no cookies
*/
-char *urldb_get_cookie(nsurl *url, bool include_http_only);
+char *urldb_get_cookie(struct nsurl *url, bool include_http_only);
-/**
- * Delete a cookie
- *
- * \param domain The cookie's domain
- * \param path The cookie's path
- * \param name The cookie's name
- */
-void urldb_delete_cookie(const char *domain, const char *path, const char
*name);
-
-/**
- * Load a cookie file into the database
- *
- * \param filename File to load
- */
-void urldb_load_cookies(const char *filename);
-
-/**
- * Save persistent cookies to file
- *
- * \param filename Path to save to
- */
-void urldb_save_cookies(const char *filename);
-
-
-/* Debug */
-
-/**
- * Dump URL database to stderr
- */
-void urldb_dump(void);
-
-
-/* test harness only */
/**
* Add a host to the database, creating any intermediate entries
@@ -310,6 +144,7 @@ void urldb_dump(void);
*/
struct host_part *urldb_add_host(const char *host);
+
/**
* Add a path to the database, creating any intermediate entries
*
@@ -323,6 +158,7 @@ struct host_part *urldb_add_host(const char *host);
*/
struct path_data *urldb_add_path(lwc_string *scheme, unsigned int port,
const struct host_part *host, char *path_query,
- lwc_string *fragment, nsurl *url);
+ lwc_string *fragment, struct nsurl *url);
+
#endif
diff --git a/desktop/global_history.c b/desktop/global_history.c
index 01b7dee..ac4790f 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -19,12 +19,14 @@
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/utf8.h"
#include "utils/libdom.h"
#include "utils/log.h"
+#include "utils/nsurl.h"
#include "content/urldb.h"
#include "desktop/global_history.h"
diff --git a/desktop/hotlist.c b/desktop/hotlist.c
index eae5ad8..de26ff6 100644
--- a/desktop/hotlist.c
+++ b/desktop/hotlist.c
@@ -31,6 +31,7 @@
#include "utils/utf8.h"
#include "utils/libdom.h"
#include "utils/log.h"
+#include "utils/nsurl.h"
#include "content/urldb.h"
#include "netsurf/misc.h"
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 9bd1cd4..afb49a5 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -103,9 +103,10 @@
#include "netsurf/netsurf.h"
#include "netsurf/content.h"
#include "netsurf/browser_window.h"
+#include "netsurf/cookie_db.h"
+#include "netsurf/url_db.h"
#include "content/backing_store.h"
#include "content/fetchers.h"
-#include "content/urldb.h"
#include "desktop/browser_history.h"
#include "desktop/hotlist.h"
#include "desktop/version.h"
diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c
index d54c2fa..3b338bf 100755
--- a/frontends/amiga/login.c
+++ b/frontends/amiga/login.c
@@ -39,10 +39,10 @@
#include <reaction/reaction_macros.h>
#include "utils/messages.h"
-#include "utils/errors.h"
-#include "content/urldb.h"
+#include "utils/nsurl.h"
#include "netsurf/mouse.h"
#include "netsurf/window.h"
+#include "netsurf/url_db.h"
#include "amiga/gui.h"
#include "amiga/libs.h"
diff --git a/frontends/amiga/stringview/urlhistory.c
b/frontends/amiga/stringview/urlhistory.c
index c58a377..7405fbb 100644
--- a/frontends/amiga/stringview/urlhistory.c
+++ b/frontends/amiga/stringview/urlhistory.c
@@ -26,10 +26,11 @@
#include "amiga/os3support.h"
-#include "urlhistory.h"
-
-#include "content/urldb.h"
#include "utils/nsoption.h"
+#include "utils/nsurl.h"
+#include "netsurf/url_db.h"
+
+#include "urlhistory.h"
static struct List PageList;
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
index 7a6f8b3..033e356 100644
--- a/frontends/amiga/tree.c
+++ b/frontends/amiga/tree.c
@@ -55,7 +55,6 @@
#include "utils/messages.h"
#include "netsurf/browser_window.h"
#include "netsurf/window.h"
-#include "content/urldb.h"
#include "content/llcache.h"
#include "desktop/cookie_manager.h"
#include "desktop/global_history.h"
diff --git a/frontends/atari/gui.c b/frontends/atari/gui.c
index 36ef527..713db8b 100644
--- a/frontends/atari/gui.c
+++ b/frontends/atari/gui.c
@@ -37,7 +37,8 @@
#include "netsurf/misc.h"
#include "netsurf/netsurf.h"
#include "netsurf/content.h"
-#include "content/urldb.h"
+#include "netsurf/cookie_db.h"
+#include "netsurf/url_db.h"
#include "content/backing_store.h"
#include "desktop/treeview.h"
diff --git a/frontends/beos/cookies.cpp b/frontends/beos/cookies.cpp
index 0a417a2..8e6801e 100644
--- a/frontends/beos/cookies.cpp
+++ b/frontends/beos/cookies.cpp
@@ -24,7 +24,7 @@ extern "C" {
#include "utils/log.h"
#include "netsurf/mouse.h"
#include "netsurf/plotters.h"
-#include "content/urldb.h"
+#include "netsurf/cookie_db.h"
#include "desktop/cookie_manager.h"
#include "desktop/tree.h"
#include "desktop/textinput.h"
diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp
index 6337825..0dcbd6b 100644
--- a/frontends/beos/gui.cpp
+++ b/frontends/beos/gui.cpp
@@ -54,6 +54,7 @@ extern "C" {
#include "utils/corestrings.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "utils/nsurl.h"
#include "netsurf/misc.h"
#include "netsurf/clipboard.h"
#include "netsurf/search.h"
@@ -61,8 +62,9 @@ extern "C" {
#include "netsurf/netsurf.h"
#include "netsurf/content.h"
#include "netsurf/browser_window.h"
+#include "netsurf/cookie_db.h"
+#include "netsurf/url_db.h"
#include "content/fetchers.h"
-#include "content/urldb.h"
}
diff --git a/frontends/beos/window.cpp b/frontends/beos/window.cpp
index dd1e729..2944033 100644
--- a/frontends/beos/window.cpp
+++ b/frontends/beos/window.cpp
@@ -39,13 +39,14 @@ extern "C" {
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "utils/nsurl.h"
#include "netsurf/content_type.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
#include "netsurf/plotters.h"
#include "netsurf/window.h"
#include "netsurf/clipboard.h"
-#include "content/urldb.h"
+#include "netsurf/url_db.h"
#include "desktop/textinput.h"
}
diff --git a/frontends/cocoa/NetsurfApp.m b/frontends/cocoa/NetsurfApp.m
index 7584f4f..5206591 100644
--- a/frontends/cocoa/NetsurfApp.m
+++ b/frontends/cocoa/NetsurfApp.m
@@ -32,11 +32,13 @@
#import "utils/messages.h"
#import "utils/utils.h"
#import "utils/nsoption.h"
+#import "utils/nsurl.h"
#import "netsurf/plotters.h"
#import "netsurf/mouse.h"
#import "netsurf/netsurf.h"
#import "netsurf/browser_window.h"
-#import "content/urldb.h"
+#import "netsurf/cookie_db.h"
+#import "netsurf/url_db.h"
#import "desktop/save_complete.h"
#import "desktop/textinput.h"
#import "desktop/tree.h"
diff --git a/frontends/cocoa/URLFieldCell.m b/frontends/cocoa/URLFieldCell.m
index 1b4344b..e9e6647 100644
--- a/frontends/cocoa/URLFieldCell.m
+++ b/frontends/cocoa/URLFieldCell.m
@@ -18,7 +18,8 @@
#import "cocoa/URLFieldCell.h"
-#import "content/urldb.h"
+#import "utils/nsurl.h"
+#import "netsurf/url_db.h"
@interface URLFieldCell ()
diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c
index 7ef64b0..6879886 100644
--- a/frontends/framebuffer/gui.c
+++ b/frontends/framebuffer/gui.c
@@ -41,7 +41,7 @@
#include "netsurf/window.h"
#include "netsurf/misc.h"
#include "netsurf/netsurf.h"
-#include "content/urldb.h"
+#include "netsurf/cookie_db.h"
#include "content/fetch.h"
#include "framebuffer/gui.h"
diff --git a/frontends/gtk/completion.c b/frontends/gtk/completion.c
index 9b76411..eea0a78 100644
--- a/frontends/gtk/completion.c
+++ b/frontends/gtk/completion.c
@@ -26,9 +26,10 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
-#include "content/urldb.h"
-#include "desktop/searchweb.h"
+#include "utils/nsurl.h"
+#include "netsurf/url_db.h"
#include "netsurf/browser_window.h"
+#include "desktop/searchweb.h"
#include "gtk/warn.h"
#include "gtk/scaffolding.h"
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index 3c7cdeb..16d9199 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -39,7 +39,8 @@
#include "utils/file.h"
#include "utils/nsoption.h"
#include "content/fetchers.h"
-#include "content/urldb.h"
+#include "netsurf/url_db.h"
+#include "netsurf/cookie_db.h"
#include "content/backing_store.h"
#include "netsurf/browser_window.h"
#include "desktop/save_complete.h"
diff --git a/frontends/gtk/login.c b/frontends/gtk/login.c
index ee77052..3e29903 100644
--- a/frontends/gtk/login.c
+++ b/frontends/gtk/login.c
@@ -22,7 +22,7 @@
#include "utils/log.h"
#include "utils/nsurl.h"
-#include "content/urldb.h"
+#include "netsurf/url_db.h"
#include "gtk/resources.h"
#include "gtk/login.h"
diff --git a/frontends/monkey/main.c b/frontends/monkey/main.c
index c9bb8ab..0ddfd9a 100644
--- a/frontends/monkey/main.c
+++ b/frontends/monkey/main.c
@@ -33,7 +33,8 @@
#include "utils/nsurl.h"
#include "netsurf/misc.h"
#include "netsurf/netsurf.h"
-#include "content/urldb.h"
+#include "netsurf/url_db.h"
+#include "netsurf/cookie_db.h"
#include "content/fetchers.h"
#include "monkey/dispatch.h"
diff --git a/frontends/riscos/401login.c b/frontends/riscos/401login.c
index 35402ec..a23c01c 100644
--- a/frontends/riscos/401login.c
+++ b/frontends/riscos/401login.c
@@ -26,7 +26,7 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsurl.h"
-#include "content/urldb.h"
+#include "netsurf/url_db.h"
#include "riscos/gui.h"
#include "riscos/dialog.h"
diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c
index 2e8f433..2b369ec 100644
--- a/frontends/riscos/gui.c
+++ b/frontends/riscos/gui.c
@@ -52,9 +52,10 @@
#include "netsurf/content.h"
#include "netsurf/netsurf.h"
#include "netsurf/browser_window.h"
+#include "netsurf/cookie_db.h"
+#include "netsurf/url_db.h"
#include "desktop/save_complete.h"
#include "desktop/treeview.h"
-#include "content/urldb.h"
#include "content/backing_store.h"
#include "riscos/gui.h"
diff --git a/frontends/riscos/hotlist.c b/frontends/riscos/hotlist.c
index 1f5fc21..6041658 100644
--- a/frontends/riscos/hotlist.c
+++ b/frontends/riscos/hotlist.c
@@ -35,10 +35,11 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
-#include "content/urldb.h"
+#include "utils/nsurl.h"
+#include "netsurf/url_db.h"
+#include "netsurf/window.h"
#include "desktop/hotlist.h"
#include "desktop/tree.h"
-#include "netsurf/window.h"
#include "riscos/gui.h"
#include "riscos/dialog.h"
diff --git a/frontends/riscos/url_complete.c b/frontends/riscos/url_complete.c
index eebb764..3ca9be4 100644
--- a/frontends/riscos/url_complete.c
+++ b/frontends/riscos/url_complete.c
@@ -30,7 +30,8 @@
#include "utils/log.h"
#include "utils/nsoption.h"
-#include "content/urldb.h"
+#include "utils/nsurl.h"
+#include "netsurf/url_db.h"
#include "netsurf/browser_window.h"
#include "riscos/global_history.h"
diff --git a/frontends/riscos/url_suggest.c b/frontends/riscos/url_suggest.c
index ef1fcc7..0d7b0eb 100644
--- a/frontends/riscos/url_suggest.c
+++ b/frontends/riscos/url_suggest.c
@@ -26,7 +26,8 @@
#include <oslib/wimp.h>
#include "utils/messages.h"
-#include "content/urldb.h"
+#include "utils/nsurl.h"
+#include "netsurf/url_db.h"
#include "riscos/menus.h"
#include "riscos/url_suggest.h"
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index 35efefb..152bff3 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -51,12 +51,13 @@
#include "utils/utils.h"
#include "utils/messages.h"
#include "utils/string.h"
+#include "utils/nsurl.h"
#include "netsurf/content.h"
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
#include "netsurf/window.h"
#include "netsurf/bitmap.h"
-#include "content/urldb.h"
+#include "netsurf/url_db.h"
#include "desktop/browser_history.h"
#include "desktop/cookie_manager.h"
#include "desktop/scrollbar.h"
diff --git a/include/netsurf/cookie_db.h b/include/netsurf/cookie_db.h
new file mode 100644
index 0000000..54d0145
--- /dev/null
+++ b/include/netsurf/cookie_db.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2006 John M Bell <[email protected]>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Unified cookie database public interface.
+ */
+
+#ifndef _NETSURF_COOKIE_DB_H_
+#define _NETSURF_COOKIE_DB_H_
+
+#include <stdbool.h>
+#include <time.h>
+
+enum cookie_version {
+ COOKIE_NETSCAPE = 0,
+ COOKIE_RFC2109 = 1,
+ COOKIE_RFC2965 = 2
+};
+
+struct cookie_data {
+ const struct cookie_data *prev; /**< Previous in list */
+ const struct cookie_data *next; /**< Next in list */
+
+ const char *name; /**< Cookie name */
+ const char *value; /**< Cookie value */
+ const bool value_was_quoted; /**< Value was quoted in Set-Cookie: */
+ const char *comment; /**< Cookie comment */
+ const bool domain_from_set; /**< Domain came from Set-Cookie: header */
+ const char *domain; /**< Domain */
+ const bool path_from_set; /**< Path came from Set-Cookie: header */
+ const char *path; /**< Path */
+ const time_t expires; /**< Expiry timestamp, or 1 for session */
+ const time_t last_used; /**< Last used time */
+ const bool secure; /**< Only send for HTTPS requests */
+ const bool http_only; /**< Only expose to HTTP(S) requests */
+ enum cookie_version version; /**< Specification compliance */
+
+ /** Never destroy this cookie, unless it's expired */
+ const bool no_destroy;
+};
+
+/**
+ * Iterate over all cookies in database
+ *
+ * \param callback Function to callback for each entry
+ */
+void urldb_iterate_cookies(bool (*callback)(const struct cookie_data *cookie));
+
+/**
+ * Delete a cookie
+ *
+ * \param domain The cookie's domain
+ * \param path The cookie's path
+ * \param name The cookie's name
+ */
+void urldb_delete_cookie(const char *domain, const char *path, const char
*name);
+
+/**
+ * Load a cookie file into the database
+ *
+ * \param filename File to load
+ */
+void urldb_load_cookies(const char *filename);
+
+/**
+ * Save persistent cookies to file
+ *
+ * \param filename Path to save to
+ */
+void urldb_save_cookies(const char *filename);
+
+
+
+#endif
diff --git a/include/netsurf/url_db.h b/include/netsurf/url_db.h
new file mode 100644
index 0000000..be2c656
--- /dev/null
+++ b/include/netsurf/url_db.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2006 John M Bell <[email protected]>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Unified URL information database public interface
+ */
+
+#ifndef _NETSURF_URL_DB_H_
+#define _NETSURF_URL_DB_H_
+
+#include <stdbool.h>
+#include <time.h>
+
+#include "utils/errors.h"
+#include "netsurf/content_type.h"
+
+struct nsurl;
+struct bitmap;
+
+struct url_data {
+ const char *title; /**< Resource title */
+ unsigned int visits; /**< Visit count */
+ time_t last_visit; /**< Last visit time */
+ content_type type; /**< Type of resource */
+};
+
+
+/**
+ * Import an URL database from file, replacing any existing database
+ *
+ * \param filename Name of file containing data
+ */
+nserror urldb_load(const char *filename);
+
+
+/**
+ * Export the current database to file
+ *
+ * \param filename Name of file to export to
+ */
+nserror urldb_save(const char *filename);
+
+
+/**
+ * Set authentication data for an URL
+ *
+ * \param url The URL to consider
+ * \param realm The authentication realm
+ * \param auth The authentication details (in form username:password)
+ */
+void urldb_set_auth_details(struct nsurl *url, const char *realm, const char
*auth);
+
+
+/**
+ * Look up authentication details in database
+ *
+ * \param url Absolute URL to search for
+ * \param realm When non-NULL, it is realm which can be used to determine
+ * the protection space when that's not been done before for given URL.
+ * \return Pointer to authentication details, or NULL if not found
+ */
+const char *urldb_get_auth_details(struct nsurl *url, const char *realm);
+
+
+/**
+ * Iterate over entries in the database which match the given prefix
+ *
+ * \param prefix Prefix to match
+ * \param callback Callback function
+ */
+void urldb_iterate_partial(const char *prefix, bool (*callback)(struct nsurl
*url, const struct url_data *data));
+
+
+/**
+ * Iterate over all entries in database
+ *
+ * \param callback Function to callback for each entry
+ */
+void urldb_iterate_entries(bool (*callback)(struct nsurl *url, const struct
url_data *data));
+
+
+/**
+ * Retrieve thumbnail data for given URL
+ *
+ * \param url Absolute URL to search for
+ * \return Pointer to thumbnail data, or NULL if not found.
+ */
+struct bitmap *urldb_get_thumbnail(struct nsurl *url);
+
+
+/**
+ * Find data for an URL.
+ *
+ * \param url Absolute URL to look for
+ * \return Pointer to result struct, or NULL
+ */
+const struct url_data *urldb_get_url_data(struct nsurl *url);
+
+
+/**
+ * Set certificate verification permissions
+ *
+ * \param url URL to consider
+ * \param permit Set to true to allow invalid certificates
+ */
+void urldb_set_cert_permissions(struct nsurl *url, bool permit);
+
+
+/**
+ * Dump URL database to stderr
+ */
+void urldb_dump(void);
+
+#endif
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org