Gitweb links:

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

The branch, tlsa/401 has been updated
       via  696a46d9802a88ae45c148a135de3222070a3f24 (commit)
      from  60d40bb8e3fcee4b018e6c286c6b201d9b1d99b5 (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=696a46d9802a88ae45c148a135de3222070a3f24
commit 696a46d9802a88ae45c148a135de3222070a3f24
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    HTTP auth: The colon is required, even with no password.

diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index ae1a062..4713492 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -108,15 +108,18 @@ static nserror netsurf__build_userpass(
                const char *password,
                char **userpass_out)
 {
-       char *userpass = NULL;
-       size_t len = 0;
-       nserror err;
+       char *userpass;
+       size_t len;
 
-       err = snstrjoin(&userpass, &len, ':', 2, username, password);
-       if (err != NSERROR_OK) {
-               return err;
+       len = strlen(username) + 1 + strlen(password) + 1;
+
+       userpass = malloc(len);
+       if (userpass == NULL) {
+               return NSERROR_NOMEM;
        }
 
+       snprintf(userpass, len, "%s:%s", username, password);
+
        *userpass_out = userpass;
        return NSERROR_OK;
 }
@@ -155,16 +158,7 @@ static nserror netsurf__unpack_userpass(
 
        tmp = strchr(userpass, ':');
        if (tmp == NULL) {
-               len = strlen(userpass);
-
-               username = malloc(len + 1);
-               password = malloc(1);
-               if (username == NULL || password == NULL) {
-                       return NSERROR_NOMEM;
-               }
-               memcpy(username, userpass, len);
-               username[len] = '\0';
-               password[0] = '\0';
+               return NSERROR_BAD_PARAMETER;
        } else {
                size_t len2;
                len = tmp - userpass;


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

Summary of changes:
 desktop/netsurf.c |   26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index ae1a062..4713492 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -108,15 +108,18 @@ static nserror netsurf__build_userpass(
                const char *password,
                char **userpass_out)
 {
-       char *userpass = NULL;
-       size_t len = 0;
-       nserror err;
+       char *userpass;
+       size_t len;
 
-       err = snstrjoin(&userpass, &len, ':', 2, username, password);
-       if (err != NSERROR_OK) {
-               return err;
+       len = strlen(username) + 1 + strlen(password) + 1;
+
+       userpass = malloc(len);
+       if (userpass == NULL) {
+               return NSERROR_NOMEM;
        }
 
+       snprintf(userpass, len, "%s:%s", username, password);
+
        *userpass_out = userpass;
        return NSERROR_OK;
 }
@@ -155,16 +158,7 @@ static nserror netsurf__unpack_userpass(
 
        tmp = strchr(userpass, ':');
        if (tmp == NULL) {
-               len = strlen(userpass);
-
-               username = malloc(len + 1);
-               password = malloc(1);
-               if (username == NULL || password == NULL) {
-                       return NSERROR_NOMEM;
-               }
-               memcpy(username, userpass, len);
-               username[len] = '\0';
-               password[0] = '\0';
+               return NSERROR_BAD_PARAMETER;
        } else {
                size_t len2;
                len = tmp - userpass;


-- 
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