Jeremy wrote:
...
I haven't looked into how anything fits together yet at all, but skimming through:
@@ -234,12 +236,13 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy) "User-Agent: Dillo/%s\r\n" "Content-Length: %ld\r\n" "Content-Type: %s\r\n" - "%s" + "%s" /* cookies */ + "%s" /* auth */ "\r\n", full_path->str, URL_AUTHORITY(url), proxy_auth->str, referer, VERSION, URL_DATA(url)->len, content_type->str, - cookies); + cookies, auth ? auth : ""); dStr_append_l(query, URL_DATA(url)->str, URL_DATA(url)->len); dStr_free(content_type, TRUE); } else {
Remember that there's a header ordering convention.
+/* + * Return the host that contains a URL, or NULL if there is no such host. + */ +static AuthHost *Host_from_url(const DilloUrl *url) +{ + AuthHost *host; + int i; + + for (i = 0; (host = dList_nth_data(auth_hosts, i)); i++) + if (((strcmp(URL_SCHEME(url), host->scheme) == 0) && + (strcmp(URL_AUTHORITY(url), host->authority) == 0))) + return host; + + return NULL; +}
dStrcasecmp
+static void Realm_add_path(AuthRealm *realm, const char *path) +{ + int len, i; + char *realm_path; + + len = strlen(path); + /* ignore a trailing '/' */ + if (len && path[len - 1] == '/') + len--; + + /* delete existing paths that are inside the new one */ + for (i = 0; (realm_path = dList_nth_data(realm->paths, i)); i++) { + if (path_is_inside(realm_path, path, len)) { + dList_remove_fast(realm->paths, realm_path); + i--; /* reconsider this slot */ + } + } + + dList_append(realm->paths, dStrndup(path, len)); +}
I think you need a dFree in there. PS I took the liberty of adding an entry for Basic auth to Plans.html