diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2011-01-29 15:17:42 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2011-01-29 15:17:42 +0000 |
commit | 27924aa38c0099ada9695530206c7a4633d03c81 (patch) | |
tree | a68e7c31def5ade6d1b4cc2820d4c2e298a35faa /content | |
parent | 850160c40f4eb7d1aaa3be575ada842eec584dbb (diff) | |
download | netsurf-27924aa38c0099ada9695530206c7a4633d03c81.tar.gz netsurf-27924aa38c0099ada9695530206c7a4633d03c81.tar.bz2 |
Minor fix for path defaulting: retain rightmost / iff it's the first character in the path
svn path=/trunk/netsurf/; revision=11524
Diffstat (limited to 'content')
-rw-r--r-- | content/urldb.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/content/urldb.c b/content/urldb.c index ef0222d2e..67ba5701d 100644 --- a/content/urldb.c +++ b/content/urldb.c @@ -2954,7 +2954,7 @@ struct cookie_internal_data *urldb_parse_cookie(const char *url, assert(url && cookie && *cookie); c = calloc(1, sizeof(struct cookie_internal_data)); - if (!c) + if (c == NULL) return NULL; c->expires = -1; @@ -3140,7 +3140,7 @@ struct cookie_internal_data *urldb_parse_cookie(const char *url, } /* Now fix-up default values */ - if (!c->domain) { + if (c->domain == NULL) { res = url_host(url, &c->domain); if (res != URL_FUNC_OK) { urldb_free_cookie(c); @@ -3148,7 +3148,7 @@ struct cookie_internal_data *urldb_parse_cookie(const char *url, } } - if (!c->path) { + if (c->path == NULL) { char *path; char *slash; @@ -3160,7 +3160,11 @@ struct cookie_internal_data *urldb_parse_cookie(const char *url, /* Strip leafname and trailing slash (4.3.1) */ slash = strrchr(path, '/'); - if (slash) { + if (slash != NULL) { + /* Special case: retain first slash in path */ + if (slash == path) + slash++; + slash = strndup(path, slash - path); if (slash == NULL) { free(path); |