Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/c313524998377db92e5387d209e1ea79fbc30ba6
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/c313524998377db92e5387d209e1ea79fbc30ba6
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/c313524998377db92e5387d209e1ea79fbc30ba6

The branch, master has been updated
       via  c313524998377db92e5387d209e1ea79fbc30ba6 (commit)
      from  c523bb47a0c884f58ab267eb9ad699ccbed907d5 (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=c313524998377db92e5387d209e1ea79fbc30ba6
commit c313524998377db92e5387d209e1ea79fbc30ba6
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    reduce curl usage to fetcher, url unescaping and time parsing

diff --git a/desktop/browser.c b/desktop/browser.c
index 453db2f..5f99a84 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -59,7 +59,6 @@
 #include "render/form_internal.h"
 #include "render/html.h"
 #include "render/box.h"
-#include "curl/curl.h"
 #include "javascript/js.h"
 
 #include "desktop/browser_history.h"
diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c
index 1fc0373..39a4bbf 100755
--- a/frontends/amiga/misc.c
+++ b/frontends/amiga/misc.c
@@ -217,7 +217,7 @@ static nserror amiga_nsurl_to_path(struct nsurl *url, char 
**path_out)
                return NSERROR_BAD_PARAMETER;
        }
 
-       res = url_unescape(lwc_string_data(urlpath) + 1, &path);
+       res = url_unescape(lwc_string_data(urlpath) + 1, 0, &path);
        lwc_string_unref(urlpath);
        if (res != NSERROR_OK) {
                return res;
diff --git a/frontends/atari/file.c b/frontends/atari/file.c
index 499edd6..7bc11da 100644
--- a/frontends/atari/file.c
+++ b/frontends/atari/file.c
@@ -138,7 +138,9 @@ static nserror atari_nsurl_to_path(struct nsurl *url, char 
**path_out)
                return NSERROR_BAD_PARAMETER;
        }
 
-       res = url_unescape(lwc_string_data(urlpath), &path);
+       res = url_unescape(lwc_string_data(urlpath),
+                          lwc_string_length(urlpath),
+                          &path);
        lwc_string_unref(urlpath);
        if (res != NSERROR_OK) {
                return res;
diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp
index 93b304a..53387ad 100644
--- a/frontends/beos/gui.cpp
+++ b/frontends/beos/gui.cpp
@@ -30,7 +30,6 @@
 #include <sys/select.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <curl/curl.h>
 
 #include <Alert.h>
 #include <Application.h>
@@ -795,12 +794,14 @@ static void gui_quit(void)
 
 static char *url_to_path(const char *url)
 {
-       char *url_path = curl_unescape(url, 0);
-       char *path;
+       char *url_path;
+       char *path = NULL;
 
-       /* return the absolute path including leading / */
-       path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN - 1));
-       curl_free(url_path);
+       if (url_unescape(url, 0, &url_path) == NSERROR_OK) {
+               /* return the absolute path including leading / */
+               path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN - 1));
+               free(url_path);
+       }
 
        return path;
 }
diff --git a/frontends/riscos/download.c b/frontends/riscos/download.c
index 7dd61b7..1a0249e 100644
--- a/frontends/riscos/download.c
+++ b/frontends/riscos/download.c
@@ -33,7 +33,6 @@
 #include <assert.h>
 #include <string.h>
 #include <time.h>
-#include <curl/curl.h>
 #include <libwapcaplet/libwapcaplet.h>
 
 #include "oslib/mimemap.h"
@@ -53,6 +52,7 @@
 #include "utils/utf8.h"
 #include "utils/utils.h"
 #include "utils/string.h"
+#include "utils/url.h"
 #include "utils/corestrings.h"
 #include "netsurf/download.h"
 #include "desktop/download.h"
@@ -239,11 +239,11 @@ static nserror download_ro_filetype(download_context 
*ctx, bits *ftype_out)
                        lwc_string *path = nsurl_get_component(url, NSURL_PATH);
                        if (path != NULL && lwc_string_length(path) != 0) {
                                char *raw_path;
-                               raw_path = curl_unescape(lwc_string_data(path),
-                                               lwc_string_length(path));
-                               if (raw_path != NULL) {
+                               if (url_unescape(lwc_string_data(path),
+                                                lwc_string_length(path),
+                                                &raw_path) == NSERROR_OK) {
                                        ftype = 
ro_filetype_from_unix_path(raw_path);
-                                       curl_free(raw_path);
+                                       free(raw_path);
                                }
                        }
                }
diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c
index 2b369ec..f55392f 100644
--- a/frontends/riscos/gui.c
+++ b/frontends/riscos/gui.c
@@ -1513,7 +1513,9 @@ static nserror ro_nsurl_to_path(struct nsurl *url, char 
**path_out)
                return NSERROR_BAD_PARAMETER;
        }
 
-       res = url_unescape(lwc_string_data(urlpath), &unpath);
+       res = url_unescape(lwc_string_data(urlpath),
+                          lwc_string_length(urlpath),
+                          &unpath);
        lwc_string_unref(urlpath);
        if (res != NSERROR_OK) {
                return res;
diff --git a/frontends/windows/download.c b/frontends/windows/download.c
index f1a0287..9c8cefa 100644
--- a/frontends/windows/download.c
+++ b/frontends/windows/download.c
@@ -17,9 +17,7 @@
  */
 
 #include <limits.h>
-
-#include "utils/config.h"
-
+#include "utils/inet.h" /* get correct winsock ordering */
 #include <shlobj.h>
 #include <windows.h>
 
diff --git a/frontends/windows/file.c b/frontends/windows/file.c
index 5c5b1f0..7583790 100644
--- a/frontends/windows/file.c
+++ b/frontends/windows/file.c
@@ -141,7 +141,9 @@ static nserror windows_nsurl_to_path(struct nsurl *url, 
char **path_out)
                return NSERROR_BAD_PARAMETER;
        }
 
-       res = url_unescape(lwc_string_data(urlpath), &path);
+       res = url_unescape(lwc_string_data(urlpath),
+                          lwc_string_length(urlpath),
+                          &path);
        lwc_string_unref(urlpath);
        if (res != NSERROR_OK) {
                return res;
diff --git a/frontends/windows/findfile.c b/frontends/windows/findfile.c
index 8c8906a..e1c9595 100644
--- a/frontends/windows/findfile.c
+++ b/frontends/windows/findfile.c
@@ -27,9 +27,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-
-#include <curl/curl.h>
-
 #include "utils/log.h"
 #include "utils/url.h"
 #include "utils/utils.h"
diff --git a/test/Makefile b/test/Makefile
index 66b8aa7..9fdb3f2 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -80,7 +80,7 @@ TESTCFLAGS := -std=c99 -g -Wall \
                -D_BSD_SOURCE \
                -D_POSIX_C_SOURCE=200809L \
                -D_XOPEN_SOURCE=600 \
-               -Itest -Iinclude -Ifrontends -I. -I.. \
+               -Itest -Iinclude -Icontent/handlers -Ifrontends -I. -I.. \
                -Dnsgtk \
                $(shell pkg-config --cflags libcurl libparserutils libwapcaplet 
libdom libnsutils libutf8proc libidn) \
                $(LIB_CFLAGS) \
diff --git a/test/llcache.c b/test/llcache.c
index 850f060..df51386 100644
--- a/test/llcache.c
+++ b/test/llcache.c
@@ -20,8 +20,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <curl/curl.h>
-
 #include "content/fetch.h"
 #include "content/llcache.h"
 #include "utils/ring.h"
@@ -94,12 +92,14 @@ char *path_to_url(const char *path)
 /* utils/url.h */
 char *url_to_path(const char *url)
 {
-       char *url_path = curl_unescape(url, 0);
-       char *path;
+       char *url_path;
+       char *path = NULL;
 
-       /* return the absolute path including leading / */
-       path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN - 1));
-       curl_free(url_path);
+       if (url_unescape(url, 0, &url_path) == NSERROR_OK) {
+               /* return the absolute path including leading / */
+               path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN - 1));
+               free(url_path);
+       }
 
        return path;
 }
diff --git a/test/urldbtest.c b/test/urldbtest.c
index 2d14c0f..338ce1f 100644
--- a/test/urldbtest.c
+++ b/test/urldbtest.c
@@ -27,8 +27,6 @@
 #include <strings.h>
 #include <time.h>
 
-#include <curl/curl.h>
-
 #include "utils/errors.h"
 #include "utils/nsurl.h"
 #include "netsurf/bitmap.h"
diff --git a/utils/file.c b/utils/file.c
index 8888110..6224d1c 100644
--- a/utils/file.c
+++ b/utils/file.c
@@ -136,7 +136,9 @@ static nserror posix_nsurl_to_path(struct nsurl *url, char 
**path_out)
                return NSERROR_BAD_PARAMETER;
        }
 
-       res = url_unescape(lwc_string_data(urlpath), &path);
+       res = url_unescape(lwc_string_data(urlpath),
+                          lwc_string_length(urlpath),
+                          &path);
        lwc_string_unref(urlpath);
        if (res != NSERROR_OK) {
                return res;
diff --git a/utils/url.c b/utils/url.c
index 1e3ef42..4fcbccd 100644
--- a/utils/url.c
+++ b/utils/url.c
@@ -33,12 +33,12 @@
 
 
 /* exported interface documented in utils/url.h */
-nserror url_unescape(const char *str, char **result)
+nserror url_unescape(const char *str, int length, char **result)
 {
        char *curlstr;
        char *retstr;
 
-       curlstr = curl_unescape(str, 0);
+       curlstr = curl_unescape(str, length);
        if (curlstr == NULL) {
                return NSERROR_NOMEM;
        }
diff --git a/utils/url.h b/utils/url.h
index aafdf1e..94579e3 100644
--- a/utils/url.h
+++ b/utils/url.h
@@ -46,9 +46,10 @@ nserror url_escape(const char *unescaped, size_t toskip, 
bool sptoplus,
  * Convert an escaped string to plain.
  *
  * \param[in] str String to unescape.
+ * \parm[in] length Length of string or 0 to use strlen
  * \param[out] result unescaped string owned by caller must be freed with 
free()
- * \return  NSERROR_OK on success
+ * \return NSERROR_OK on success
  */
-nserror url_unescape(const char *str, char **result);
+nserror url_unescape(const char *str, int length, char **result);
 
 #endif


-----------------------------------------------------------------------

Summary of changes:
 desktop/browser.c            |    1 -
 frontends/amiga/misc.c       |    2 +-
 frontends/atari/file.c       |    4 +++-
 frontends/beos/gui.cpp       |   13 +++++++------
 frontends/riscos/download.c  |   10 +++++-----
 frontends/riscos/gui.c       |    4 +++-
 frontends/windows/download.c |    4 +---
 frontends/windows/file.c     |    4 +++-
 frontends/windows/findfile.c |    3 ---
 test/Makefile                |    2 +-
 test/llcache.c               |   14 +++++++-------
 test/urldbtest.c             |    2 --
 utils/file.c                 |    4 +++-
 utils/url.c                  |    4 ++--
 utils/url.h                  |    5 +++--
 15 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/desktop/browser.c b/desktop/browser.c
index 453db2f..5f99a84 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -59,7 +59,6 @@
 #include "render/form_internal.h"
 #include "render/html.h"
 #include "render/box.h"
-#include "curl/curl.h"
 #include "javascript/js.h"
 
 #include "desktop/browser_history.h"
diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c
index 1fc0373..39a4bbf 100755
--- a/frontends/amiga/misc.c
+++ b/frontends/amiga/misc.c
@@ -217,7 +217,7 @@ static nserror amiga_nsurl_to_path(struct nsurl *url, char 
**path_out)
                return NSERROR_BAD_PARAMETER;
        }
 
-       res = url_unescape(lwc_string_data(urlpath) + 1, &path);
+       res = url_unescape(lwc_string_data(urlpath) + 1, 0, &path);
        lwc_string_unref(urlpath);
        if (res != NSERROR_OK) {
                return res;
diff --git a/frontends/atari/file.c b/frontends/atari/file.c
index 499edd6..7bc11da 100644
--- a/frontends/atari/file.c
+++ b/frontends/atari/file.c
@@ -138,7 +138,9 @@ static nserror atari_nsurl_to_path(struct nsurl *url, char 
**path_out)
                return NSERROR_BAD_PARAMETER;
        }
 
-       res = url_unescape(lwc_string_data(urlpath), &path);
+       res = url_unescape(lwc_string_data(urlpath),
+                          lwc_string_length(urlpath),
+                          &path);
        lwc_string_unref(urlpath);
        if (res != NSERROR_OK) {
                return res;
diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp
index 93b304a..53387ad 100644
--- a/frontends/beos/gui.cpp
+++ b/frontends/beos/gui.cpp
@@ -30,7 +30,6 @@
 #include <sys/select.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <curl/curl.h>
 
 #include <Alert.h>
 #include <Application.h>
@@ -795,12 +794,14 @@ static void gui_quit(void)
 
 static char *url_to_path(const char *url)
 {
-       char *url_path = curl_unescape(url, 0);
-       char *path;
+       char *url_path;
+       char *path = NULL;
 
-       /* return the absolute path including leading / */
-       path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN - 1));
-       curl_free(url_path);
+       if (url_unescape(url, 0, &url_path) == NSERROR_OK) {
+               /* return the absolute path including leading / */
+               path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN - 1));
+               free(url_path);
+       }
 
        return path;
 }
diff --git a/frontends/riscos/download.c b/frontends/riscos/download.c
index 7dd61b7..1a0249e 100644
--- a/frontends/riscos/download.c
+++ b/frontends/riscos/download.c
@@ -33,7 +33,6 @@
 #include <assert.h>
 #include <string.h>
 #include <time.h>
-#include <curl/curl.h>
 #include <libwapcaplet/libwapcaplet.h>
 
 #include "oslib/mimemap.h"
@@ -53,6 +52,7 @@
 #include "utils/utf8.h"
 #include "utils/utils.h"
 #include "utils/string.h"
+#include "utils/url.h"
 #include "utils/corestrings.h"
 #include "netsurf/download.h"
 #include "desktop/download.h"
@@ -239,11 +239,11 @@ static nserror download_ro_filetype(download_context 
*ctx, bits *ftype_out)
                        lwc_string *path = nsurl_get_component(url, NSURL_PATH);
                        if (path != NULL && lwc_string_length(path) != 0) {
                                char *raw_path;
-                               raw_path = curl_unescape(lwc_string_data(path),
-                                               lwc_string_length(path));
-                               if (raw_path != NULL) {
+                               if (url_unescape(lwc_string_data(path),
+                                                lwc_string_length(path),
+                                                &raw_path) == NSERROR_OK) {
                                        ftype = 
ro_filetype_from_unix_path(raw_path);
-                                       curl_free(raw_path);
+                                       free(raw_path);
                                }
                        }
                }
diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c
index 2b369ec..f55392f 100644
--- a/frontends/riscos/gui.c
+++ b/frontends/riscos/gui.c
@@ -1513,7 +1513,9 @@ static nserror ro_nsurl_to_path(struct nsurl *url, char 
**path_out)
                return NSERROR_BAD_PARAMETER;
        }
 
-       res = url_unescape(lwc_string_data(urlpath), &unpath);
+       res = url_unescape(lwc_string_data(urlpath),
+                          lwc_string_length(urlpath),
+                          &unpath);
        lwc_string_unref(urlpath);
        if (res != NSERROR_OK) {
                return res;
diff --git a/frontends/windows/download.c b/frontends/windows/download.c
index f1a0287..9c8cefa 100644
--- a/frontends/windows/download.c
+++ b/frontends/windows/download.c
@@ -17,9 +17,7 @@
  */
 
 #include <limits.h>
-
-#include "utils/config.h"
-
+#include "utils/inet.h" /* get correct winsock ordering */
 #include <shlobj.h>
 #include <windows.h>
 
diff --git a/frontends/windows/file.c b/frontends/windows/file.c
index 5c5b1f0..7583790 100644
--- a/frontends/windows/file.c
+++ b/frontends/windows/file.c
@@ -141,7 +141,9 @@ static nserror windows_nsurl_to_path(struct nsurl *url, 
char **path_out)
                return NSERROR_BAD_PARAMETER;
        }
 
-       res = url_unescape(lwc_string_data(urlpath), &path);
+       res = url_unescape(lwc_string_data(urlpath),
+                          lwc_string_length(urlpath),
+                          &path);
        lwc_string_unref(urlpath);
        if (res != NSERROR_OK) {
                return res;
diff --git a/frontends/windows/findfile.c b/frontends/windows/findfile.c
index 8c8906a..e1c9595 100644
--- a/frontends/windows/findfile.c
+++ b/frontends/windows/findfile.c
@@ -27,9 +27,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-
-#include <curl/curl.h>
-
 #include "utils/log.h"
 #include "utils/url.h"
 #include "utils/utils.h"
diff --git a/test/Makefile b/test/Makefile
index 66b8aa7..9fdb3f2 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -80,7 +80,7 @@ TESTCFLAGS := -std=c99 -g -Wall \
                -D_BSD_SOURCE \
                -D_POSIX_C_SOURCE=200809L \
                -D_XOPEN_SOURCE=600 \
-               -Itest -Iinclude -Ifrontends -I. -I.. \
+               -Itest -Iinclude -Icontent/handlers -Ifrontends -I. -I.. \
                -Dnsgtk \
                $(shell pkg-config --cflags libcurl libparserutils libwapcaplet 
libdom libnsutils libutf8proc libidn) \
                $(LIB_CFLAGS) \
diff --git a/test/llcache.c b/test/llcache.c
index 850f060..df51386 100644
--- a/test/llcache.c
+++ b/test/llcache.c
@@ -20,8 +20,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <curl/curl.h>
-
 #include "content/fetch.h"
 #include "content/llcache.h"
 #include "utils/ring.h"
@@ -94,12 +92,14 @@ char *path_to_url(const char *path)
 /* utils/url.h */
 char *url_to_path(const char *url)
 {
-       char *url_path = curl_unescape(url, 0);
-       char *path;
+       char *url_path;
+       char *path = NULL;
 
-       /* return the absolute path including leading / */
-       path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN - 1));
-       curl_free(url_path);
+       if (url_unescape(url, 0, &url_path) == NSERROR_OK) {
+               /* return the absolute path including leading / */
+               path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN - 1));
+               free(url_path);
+       }
 
        return path;
 }
diff --git a/test/urldbtest.c b/test/urldbtest.c
index 2d14c0f..338ce1f 100644
--- a/test/urldbtest.c
+++ b/test/urldbtest.c
@@ -27,8 +27,6 @@
 #include <strings.h>
 #include <time.h>
 
-#include <curl/curl.h>
-
 #include "utils/errors.h"
 #include "utils/nsurl.h"
 #include "netsurf/bitmap.h"
diff --git a/utils/file.c b/utils/file.c
index 8888110..6224d1c 100644
--- a/utils/file.c
+++ b/utils/file.c
@@ -136,7 +136,9 @@ static nserror posix_nsurl_to_path(struct nsurl *url, char 
**path_out)
                return NSERROR_BAD_PARAMETER;
        }
 
-       res = url_unescape(lwc_string_data(urlpath), &path);
+       res = url_unescape(lwc_string_data(urlpath),
+                          lwc_string_length(urlpath),
+                          &path);
        lwc_string_unref(urlpath);
        if (res != NSERROR_OK) {
                return res;
diff --git a/utils/url.c b/utils/url.c
index 1e3ef42..4fcbccd 100644
--- a/utils/url.c
+++ b/utils/url.c
@@ -33,12 +33,12 @@
 
 
 /* exported interface documented in utils/url.h */
-nserror url_unescape(const char *str, char **result)
+nserror url_unescape(const char *str, int length, char **result)
 {
        char *curlstr;
        char *retstr;
 
-       curlstr = curl_unescape(str, 0);
+       curlstr = curl_unescape(str, length);
        if (curlstr == NULL) {
                return NSERROR_NOMEM;
        }
diff --git a/utils/url.h b/utils/url.h
index aafdf1e..94579e3 100644
--- a/utils/url.h
+++ b/utils/url.h
@@ -46,9 +46,10 @@ nserror url_escape(const char *unescaped, size_t toskip, 
bool sptoplus,
  * Convert an escaped string to plain.
  *
  * \param[in] str String to unescape.
+ * \parm[in] length Length of string or 0 to use strlen
  * \param[out] result unescaped string owned by caller must be freed with 
free()
- * \return  NSERROR_OK on success
+ * \return NSERROR_OK on success
  */
-nserror url_unescape(const char *str, char **result);
+nserror url_unescape(const char *str, int length, char **result);
 
 #endif


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to