Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/11d2921bbfca6c00ec1d68bdb6ddd25beacbec3d
...commit
http://git.netsurf-browser.org/netsurf.git/commit/11d2921bbfca6c00ec1d68bdb6ddd25beacbec3d
...tree
http://git.netsurf-browser.org/netsurf.git/tree/11d2921bbfca6c00ec1d68bdb6ddd25beacbec3d
The branch, master has been updated
via 11d2921bbfca6c00ec1d68bdb6ddd25beacbec3d (commit)
via a91c7cdf04436af33aa6e8656889add097ca15e8 (commit)
via fa1af79e7ca9cd2e0923f21bb6fd7069cf827f12 (commit)
from e0c3e929f50396b8598fdcdbd9a1d2aa35ed2162 (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=11d2921bbfca6c00ec1d68bdb6ddd25beacbec3d
commit 11d2921bbfca6c00ec1d68bdb6ddd25beacbec3d
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
improve cookie time display and document locale interaction
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
index b0c48a7..3f48dad 100644
--- a/desktop/cookie_manager.c
+++ b/desktop/cookie_manager.c
@@ -16,8 +16,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Cookie Manager (implementation).
+/**
+ * \file
+ * Implementation of Cookie Management
+ *
+ * This allows users to view and remove their web cookies.
+ *
+ * \todo the viewing of cookies is pretty basic and it would be good
+ * to apply more processing of the values and perhaps top level domain
+ * suffix highlighting to give a better user information as to how the
+ * cookies interact with the users sessions.
+ *
+ * \todo In addition to removing cookies it might be useful to allow
+ * users to edit them, especially to alter expiry times.
*/
@@ -205,10 +216,10 @@ static void cookie_manager_free_treeview_field_data(
* \param value Text to set in field, ownership yielded
* \return NSERROR_OK on success, appropriate error otherwise
*/
-static inline nserror cookie_manager_field_builder(
- enum cookie_manager_field field,
- struct treeview_field_data *data,
- const char *value)
+static inline nserror
+cookie_manager_field_builder(enum cookie_manager_field field,
+ struct treeview_field_data *data,
+ const char *value)
{
data->field = cm_ctx.fields[field].field;
data->value = value;
@@ -217,6 +228,46 @@ static inline nserror cookie_manager_field_builder(
return NSERROR_OK;
}
+/**
+ * Build a cookie manager treeview field from given time
+ *
+ * The time should be converted to text in the users locacle
+ *
+ * \todo This should probably generate the user text using localtime
+ * and strftime with the c format specifier. Currently ctime will
+ * always generate output in the C locale.
+ *
+ * \param field Cookie manager treeview field to build
+ * \param fdata Cookie manager entry field data to set
+ * \param value Time to show in field
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static inline nserror
+cookie_manager_field_builder_time(enum cookie_manager_field field,
+ struct treeview_field_data *fdata,
+ const time_t *value)
+{
+ const char *date;
+ char *date2;
+
+ fdata->field = cm_ctx.fields[field].field;
+
+ date = ctime(value);
+ date2 = strdup(date);
+ if (date2 == NULL) {
+ fdata->value = NULL;
+ fdata->value_len = 0;
+ } else {
+ assert(date2[24] == '\n');
+ date2[24] = '\0';
+
+ fdata->value = date2;
+ fdata->value_len = strlen(date2);
+ }
+
+ return NSERROR_OK;
+}
+
/**
* Set a cookie manager entry's data from the cookie_data.
@@ -225,13 +276,10 @@ static inline nserror cookie_manager_field_builder(
* \param data Data associated with entry's cookie
* \return NSERROR_OK on success, appropriate error otherwise
*/
-static nserror cookie_manager_set_treeview_field_data(
- struct cookie_manager_entry *e,
- const struct cookie_data *data)
+static nserror
+cookie_manager_set_treeview_field_data(struct cookie_manager_entry *e,
+ const struct cookie_data *data)
{
- const char *date;
- char *date2;
-
assert(e != NULL);
assert(data != NULL);
@@ -246,53 +294,45 @@ static nserror cookie_manager_set_treeview_field_data(
&e->data[COOKIE_M_PATH], strdup(data->path));
/* Set the Expires date field */
- date = ctime(&data->expires);
- date2 = strdup(date);
- if (date2 != NULL) {
- assert(date2[24] == '\n');
- date2[24] = '\0';
- }
- cookie_manager_field_builder(COOKIE_M_EXPIRES,
- &e->data[COOKIE_M_EXPIRES], date2);
+ cookie_manager_field_builder_time(COOKIE_M_EXPIRES,
+ &e->data[COOKIE_M_EXPIRES], &data->expires);
/* Set the Last used date field */
- date = ctime(&data->last_used);
- date2 = strdup(date);
- if (date2 != NULL) {
- assert(date2[24] == '\n');
- date2[24] = '\0';
- }
- cookie_manager_field_builder(COOKIE_M_LAST_USED,
- &e->data[COOKIE_M_LAST_USED], date2);
+ cookie_manager_field_builder_time(COOKIE_M_LAST_USED,
+ &e->data[COOKIE_M_LAST_USED], &data->last_used);
/* Set the Restrictions text */
- if (data->secure && data->http_only)
+ if (data->secure && data->http_only) {
e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_HTTPS];
- else if (data->secure)
+ } else if (data->secure) {
e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_SECURE];
- else if (data->http_only)
+ } else if (data->http_only) {
e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_HTTP];
- else
+ } else {
e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_NONE];
+ }
/* Set the Version text */
switch (data->version) {
case COOKIE_NETSCAPE:
e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_NETSCAPE];
break;
+
case COOKIE_RFC2109:
e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_RFC2109];
break;
+
case COOKIE_RFC2965:
e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_RFC2965];
break;
}
/* Set the Persistent text */
- if (data->no_destroy)
+ if (data->no_destroy) {
e->data[COOKIE_M_PERSISTENT] = cm_ctx.values[COOKIE_M_YES];
- else
+ } else {
e->data[COOKIE_M_PERSISTENT] = cm_ctx.values[COOKIE_M_NO];
+ }
return NSERROR_OK;
}
@@ -329,10 +369,13 @@ static nserror cookie_manager_create_cookie_node(
return err;
}
- err = treeview_create_node_entry(cm_ctx.tree, &(cookie->entry),
- parent->folder, TREE_REL_FIRST_CHILD,
- cookie->data, cookie,
- cm_ctx.built ? TREE_OPTION_NONE :
+ err = treeview_create_node_entry(cm_ctx.tree,
+ &(cookie->entry),
+ parent->folder,
+ TREE_REL_FIRST_CHILD,
+ cookie->data,
+ cookie,
+ cm_ctx.built ? TREE_OPTION_NONE :
TREE_OPTION_SUPPRESS_RESIZE |
TREE_OPTION_SUPPRESS_REDRAW);
if (err != NSERROR_OK) {
@@ -677,7 +720,7 @@ static nserror cookie_manager_init_common_values(void)
/**
* Delete cookie manager entries (and optionally delete from urldb)
*
- * \param e Cookie manager entry to delete.
+ * \param e Cookie manager entry to delete.
*/
static void cookie_manager_delete_entry(struct cookie_manager_entry *e)
{
@@ -724,6 +767,8 @@ static nserror cookie_manager_tree_node_folder_cb(
return NSERROR_OK;
}
+
+
static nserror cookie_manager_tree_node_entry_cb(
struct treeview_node_msg msg, void *data)
{
@@ -744,6 +789,8 @@ static nserror cookie_manager_tree_node_entry_cb(
}
return NSERROR_OK;
}
+
+
struct treeview_callback_table cm_tree_cb_t = {
.folder = cookie_manager_tree_node_folder_cb,
.entry = cookie_manager_tree_node_entry_cb
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=a91c7cdf04436af33aa6e8656889add097ca15e8
commit a91c7cdf04436af33aa6e8656889add097ca15e8
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
make urldb parsing of ascii data explicit
diff --git a/content/urldb.c b/content/urldb.c
index 8c2a3ae..b27e23c 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -88,7 +88,6 @@
*/
#include <assert.h>
-#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -105,6 +104,7 @@
#include "utils/bloom.h"
#include "utils/time.h"
#include "utils/nsurl.h"
+#include "utils/ascii.h"
#include "netsurf/bitmap.h"
#include "desktop/cookie_manager.h"
#include "desktop/gui_internal.h"
@@ -1023,10 +1023,11 @@ static struct search_node
**urldb_get_search_tree_direct(const char *host)
{
assert(host);
- if (urldb__host_is_ip_address(host))
+ if (urldb__host_is_ip_address(host)) {
return &search_trees[ST_IP];
- else if (isalpha(*host))
- return &search_trees[ST_DN + tolower(*host) - 'a'];
+ } else if (ascii_is_alpha(*host)) {
+ return &search_trees[ST_DN + ascii_to_lower(*host) - 'a'];
+ }
return &search_trees[ST_EE];
}
@@ -1607,9 +1608,11 @@ static bool urldb_parse_avpair(struct
cookie_internal_data *c, char *n,
/* Strip dayname from date (these are hugely variable
* and liable to break the parser. They also serve no
* useful purpose) */
- for (datenoday = v; *datenoday && !isdigit(*datenoday);
- datenoday++)
- ; /* do nothing */
+ for (datenoday = v;
+ *datenoday && !ascii_is_digit(*datenoday);
+ datenoday++) {
+ /* do nothing */
+ }
res = nsc_strntimet(datenoday, strlen(datenoday), &expires);
if (res != NSERROR_OK) {
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=fa1af79e7ca9cd2e0923f21bb6fd7069cf827f12
commit fa1af79e7ca9cd2e0923f21bb6fd7069cf827f12
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
document file fetcher being locale dependant
diff --git a/content/fetchers/file.c b/content/fetchers/file.c
index 04184d2..6ffa638 100644
--- a/content/fetchers/file.c
+++ b/content/fetchers/file.c
@@ -20,6 +20,8 @@
* \file
*
* file scheme URL handling. Based on the data fetcher by Rob Kendrick
+ *
+ * output dates and directory ordering are affected by the current locale
*/
#include "utils/config.h"
@@ -536,7 +538,9 @@ process_dir_ent(struct fetch_file_context *ctx,
datebuf[0] = 0;
timebuf[0] = 0;
} else {
- /* Get date in output format */
+ /* Get date in output format. a (day of week) and b
+ * (month) are both affected by the locale
+ */
if (strftime((char *)&datebuf, sizeof datebuf, "%a %d %b %Y",
localtime(&ent_stat.st_mtime)) == 0) {
datebuf[0] = '-';
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/file.c | 6 ++-
content/urldb.c | 17 ++++---
desktop/cookie_manager.c | 125 +++++++++++++++++++++++++++++++---------------
3 files changed, 101 insertions(+), 47 deletions(-)
diff --git a/content/fetchers/file.c b/content/fetchers/file.c
index 04184d2..6ffa638 100644
--- a/content/fetchers/file.c
+++ b/content/fetchers/file.c
@@ -20,6 +20,8 @@
* \file
*
* file scheme URL handling. Based on the data fetcher by Rob Kendrick
+ *
+ * output dates and directory ordering are affected by the current locale
*/
#include "utils/config.h"
@@ -536,7 +538,9 @@ process_dir_ent(struct fetch_file_context *ctx,
datebuf[0] = 0;
timebuf[0] = 0;
} else {
- /* Get date in output format */
+ /* Get date in output format. a (day of week) and b
+ * (month) are both affected by the locale
+ */
if (strftime((char *)&datebuf, sizeof datebuf, "%a %d %b %Y",
localtime(&ent_stat.st_mtime)) == 0) {
datebuf[0] = '-';
diff --git a/content/urldb.c b/content/urldb.c
index 8c2a3ae..b27e23c 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -88,7 +88,6 @@
*/
#include <assert.h>
-#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -105,6 +104,7 @@
#include "utils/bloom.h"
#include "utils/time.h"
#include "utils/nsurl.h"
+#include "utils/ascii.h"
#include "netsurf/bitmap.h"
#include "desktop/cookie_manager.h"
#include "desktop/gui_internal.h"
@@ -1023,10 +1023,11 @@ static struct search_node
**urldb_get_search_tree_direct(const char *host)
{
assert(host);
- if (urldb__host_is_ip_address(host))
+ if (urldb__host_is_ip_address(host)) {
return &search_trees[ST_IP];
- else if (isalpha(*host))
- return &search_trees[ST_DN + tolower(*host) - 'a'];
+ } else if (ascii_is_alpha(*host)) {
+ return &search_trees[ST_DN + ascii_to_lower(*host) - 'a'];
+ }
return &search_trees[ST_EE];
}
@@ -1607,9 +1608,11 @@ static bool urldb_parse_avpair(struct
cookie_internal_data *c, char *n,
/* Strip dayname from date (these are hugely variable
* and liable to break the parser. They also serve no
* useful purpose) */
- for (datenoday = v; *datenoday && !isdigit(*datenoday);
- datenoday++)
- ; /* do nothing */
+ for (datenoday = v;
+ *datenoday && !ascii_is_digit(*datenoday);
+ datenoday++) {
+ /* do nothing */
+ }
res = nsc_strntimet(datenoday, strlen(datenoday), &expires);
if (res != NSERROR_OK) {
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
index b0c48a7..3f48dad 100644
--- a/desktop/cookie_manager.c
+++ b/desktop/cookie_manager.c
@@ -16,8 +16,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Cookie Manager (implementation).
+/**
+ * \file
+ * Implementation of Cookie Management
+ *
+ * This allows users to view and remove their web cookies.
+ *
+ * \todo the viewing of cookies is pretty basic and it would be good
+ * to apply more processing of the values and perhaps top level domain
+ * suffix highlighting to give a better user information as to how the
+ * cookies interact with the users sessions.
+ *
+ * \todo In addition to removing cookies it might be useful to allow
+ * users to edit them, especially to alter expiry times.
*/
@@ -205,10 +216,10 @@ static void cookie_manager_free_treeview_field_data(
* \param value Text to set in field, ownership yielded
* \return NSERROR_OK on success, appropriate error otherwise
*/
-static inline nserror cookie_manager_field_builder(
- enum cookie_manager_field field,
- struct treeview_field_data *data,
- const char *value)
+static inline nserror
+cookie_manager_field_builder(enum cookie_manager_field field,
+ struct treeview_field_data *data,
+ const char *value)
{
data->field = cm_ctx.fields[field].field;
data->value = value;
@@ -217,6 +228,46 @@ static inline nserror cookie_manager_field_builder(
return NSERROR_OK;
}
+/**
+ * Build a cookie manager treeview field from given time
+ *
+ * The time should be converted to text in the users locacle
+ *
+ * \todo This should probably generate the user text using localtime
+ * and strftime with the c format specifier. Currently ctime will
+ * always generate output in the C locale.
+ *
+ * \param field Cookie manager treeview field to build
+ * \param fdata Cookie manager entry field data to set
+ * \param value Time to show in field
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static inline nserror
+cookie_manager_field_builder_time(enum cookie_manager_field field,
+ struct treeview_field_data *fdata,
+ const time_t *value)
+{
+ const char *date;
+ char *date2;
+
+ fdata->field = cm_ctx.fields[field].field;
+
+ date = ctime(value);
+ date2 = strdup(date);
+ if (date2 == NULL) {
+ fdata->value = NULL;
+ fdata->value_len = 0;
+ } else {
+ assert(date2[24] == '\n');
+ date2[24] = '\0';
+
+ fdata->value = date2;
+ fdata->value_len = strlen(date2);
+ }
+
+ return NSERROR_OK;
+}
+
/**
* Set a cookie manager entry's data from the cookie_data.
@@ -225,13 +276,10 @@ static inline nserror cookie_manager_field_builder(
* \param data Data associated with entry's cookie
* \return NSERROR_OK on success, appropriate error otherwise
*/
-static nserror cookie_manager_set_treeview_field_data(
- struct cookie_manager_entry *e,
- const struct cookie_data *data)
+static nserror
+cookie_manager_set_treeview_field_data(struct cookie_manager_entry *e,
+ const struct cookie_data *data)
{
- const char *date;
- char *date2;
-
assert(e != NULL);
assert(data != NULL);
@@ -246,53 +294,45 @@ static nserror cookie_manager_set_treeview_field_data(
&e->data[COOKIE_M_PATH], strdup(data->path));
/* Set the Expires date field */
- date = ctime(&data->expires);
- date2 = strdup(date);
- if (date2 != NULL) {
- assert(date2[24] == '\n');
- date2[24] = '\0';
- }
- cookie_manager_field_builder(COOKIE_M_EXPIRES,
- &e->data[COOKIE_M_EXPIRES], date2);
+ cookie_manager_field_builder_time(COOKIE_M_EXPIRES,
+ &e->data[COOKIE_M_EXPIRES], &data->expires);
/* Set the Last used date field */
- date = ctime(&data->last_used);
- date2 = strdup(date);
- if (date2 != NULL) {
- assert(date2[24] == '\n');
- date2[24] = '\0';
- }
- cookie_manager_field_builder(COOKIE_M_LAST_USED,
- &e->data[COOKIE_M_LAST_USED], date2);
+ cookie_manager_field_builder_time(COOKIE_M_LAST_USED,
+ &e->data[COOKIE_M_LAST_USED], &data->last_used);
/* Set the Restrictions text */
- if (data->secure && data->http_only)
+ if (data->secure && data->http_only) {
e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_HTTPS];
- else if (data->secure)
+ } else if (data->secure) {
e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_SECURE];
- else if (data->http_only)
+ } else if (data->http_only) {
e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_HTTP];
- else
+ } else {
e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_NONE];
+ }
/* Set the Version text */
switch (data->version) {
case COOKIE_NETSCAPE:
e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_NETSCAPE];
break;
+
case COOKIE_RFC2109:
e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_RFC2109];
break;
+
case COOKIE_RFC2965:
e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_RFC2965];
break;
}
/* Set the Persistent text */
- if (data->no_destroy)
+ if (data->no_destroy) {
e->data[COOKIE_M_PERSISTENT] = cm_ctx.values[COOKIE_M_YES];
- else
+ } else {
e->data[COOKIE_M_PERSISTENT] = cm_ctx.values[COOKIE_M_NO];
+ }
return NSERROR_OK;
}
@@ -329,10 +369,13 @@ static nserror cookie_manager_create_cookie_node(
return err;
}
- err = treeview_create_node_entry(cm_ctx.tree, &(cookie->entry),
- parent->folder, TREE_REL_FIRST_CHILD,
- cookie->data, cookie,
- cm_ctx.built ? TREE_OPTION_NONE :
+ err = treeview_create_node_entry(cm_ctx.tree,
+ &(cookie->entry),
+ parent->folder,
+ TREE_REL_FIRST_CHILD,
+ cookie->data,
+ cookie,
+ cm_ctx.built ? TREE_OPTION_NONE :
TREE_OPTION_SUPPRESS_RESIZE |
TREE_OPTION_SUPPRESS_REDRAW);
if (err != NSERROR_OK) {
@@ -677,7 +720,7 @@ static nserror cookie_manager_init_common_values(void)
/**
* Delete cookie manager entries (and optionally delete from urldb)
*
- * \param e Cookie manager entry to delete.
+ * \param e Cookie manager entry to delete.
*/
static void cookie_manager_delete_entry(struct cookie_manager_entry *e)
{
@@ -724,6 +767,8 @@ static nserror cookie_manager_tree_node_folder_cb(
return NSERROR_OK;
}
+
+
static nserror cookie_manager_tree_node_entry_cb(
struct treeview_node_msg msg, void *data)
{
@@ -744,6 +789,8 @@ static nserror cookie_manager_tree_node_entry_cb(
}
return NSERROR_OK;
}
+
+
struct treeview_callback_table cm_tree_cb_t = {
.folder = cookie_manager_tree_node_folder_cb,
.entry = cookie_manager_tree_node_entry_cb
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org