From f979c87530c232bf7d9f4b97d1917ad8ab22b502 Mon Sep 17 00:00:00 2001 From: jcid Date: Fri, 11 Apr 2008 21:45:14 +0200 Subject: - Fixed a cookies-related dillo freeze bug happening at: http://www.fltk.org/newsgroups.php?gfltk.general+v:24912 --- src/IO/http.c | 2 +- src/cookies.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/IO/http.c b/src/IO/http.c index a6acc031..00ccc0e6 100644 --- a/src/IO/http.c +++ b/src/IO/http.c @@ -278,7 +278,7 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy) dStr_free(s_port, TRUE); dStr_free(full_path, TRUE); dStr_free(proxy_auth, TRUE); - DEBUG_MSG(4, "Query:\n%s\n", dStr_printable(query, 8192)); + _MSG("Query: {%s}\n", dStr_printable(query, 8192)); return query; } diff --git a/src/cookies.c b/src/cookies.c index 4acb4c7f..20b166fd 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -95,7 +95,7 @@ static FILE *Cookies_fopen(const char *filename, char *init_str) close(fd); DEBUG_MSG(10, "Cookies: Created file: %s\n", filename); - F_in = Cookies_fopen(filename, NULL); + F_in = fopen(filename, "r"); } else { DEBUG_MSG(10, "Cookies: Could not create file: %s!\n", filename); } @@ -141,7 +141,7 @@ void a_Cookies_freeall() void a_Cookies_set(Dlist *cookie_strings, const DilloUrl *set_url) { CookieControlAction action; - char *cmd, *cookie_string, numstr[16]; + char *cmd, *cookie_string, *dpip_tag, numstr[16]; const char *path; int i; @@ -162,7 +162,13 @@ void a_Cookies_set(Dlist *cookie_strings, const DilloUrl *set_url) path ? path : "/", numstr); DEBUG_MSG(5, "Cookies.c: a_Cookies_set \n\t \"%s\" \n",cmd ); - a_Capi_dpi_send_cmd(NULL, NULL, cmd, "cookies", 1); + /* This call is commented because it doesn't guarantee the order + * in which cookies are set and got. (It may deadlock too) */ + //a_Capi_dpi_send_cmd(NULL, NULL, cmd, "cookies", 1); + + dpip_tag = a_Dpi_send_blocking_cmd("cookies", cmd); + _MSG("a_Cookies_set: dpip_tag = {%s}\n", dpip_tag); + dFree(dpip_tag); dFree(cmd); } } @@ -192,7 +198,9 @@ char *a_Cookies_get_query(const DilloUrl *request_url) URL_HOST(request_url), path ? path : "/", numstr); /* Get the answer from cookies.dpi */ + _MSG("cookies.c: a_Dpi_send_blocking_cmd cmd = {%s}\n", cmd); dpip_tag = a_Dpi_send_blocking_cmd("cookies", cmd); + _MSG("cookies.c: after a_Dpi_send_blocking_cmd resp={%s}\n", dpip_tag); dFree(cmd); query = dStrdup("Cookie2: $Version=\"1\"\r\n"); -- cgit v1.2.3