diff options
author | corvid <devnull@localhost> | 2014-09-10 19:28:31 +0000 |
---|---|---|
committer | corvid <devnull@localhost> | 2014-09-10 19:28:31 +0000 |
commit | bc04e1f6a84a538e385cb5f8d6422b1a3c490bcb (patch) | |
tree | 64d7533ddf6c9461b68681233466ed3a5feb2a46 /src/html.cc | |
parent | d4325a022b2dbd3c453e44f2f8d4e5dc39c03cd7 (diff) |
stylesheets: make cache query when cache buf is there but not completed yet
Happened to notice that if I ran:
$ dillo http://hg.dillo.org http://hg.dillo.org
only one of them got its stylesheet.
Diffstat (limited to 'src/html.cc')
-rw-r--r-- | src/html.cc | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/html.cc b/src/html.cc index fa1cf67d..356c6dda 100644 --- a/src/html.cc +++ b/src/html.cc @@ -3255,27 +3255,26 @@ void a_Html_load_stylesheet(DilloHtml *html, DilloUrl *url) dReturn_if (url == NULL || ! prefs.load_stylesheets); _MSG("Html_load_stylesheet: "); - if (a_Capi_get_buf(url, &data, &len)) { + if ((a_Capi_get_flags_with_redirection(url) & CAPI_Completed) && + a_Capi_get_buf(url, &data, &len)) { _MSG("cached URL=%s len=%d", URL_STR(url), len); - if (a_Capi_get_flags_with_redirection(url) & CAPI_Completed) { - if (strncmp("@charset \"", data, 10) == 0) { - char *endq = strchr(data+10, '"'); - - if (endq && (endq - data <= 51)) { - /* IANA limits charset names to 40 characters */ - char *content_type; - - *endq = '\0'; - content_type = dStrconcat("text/css; charset=", data+10, NULL); - *endq = '"'; - a_Capi_unref_buf(url); - a_Capi_set_content_type(url, content_type, "meta"); - dFree(content_type); - a_Capi_get_buf(url, &data, &len); - } + if (strncmp("@charset \"", data, 10) == 0) { + char *endq = strchr(data+10, '"'); + + if (endq && (endq - data <= 51)) { + /* IANA limits charset names to 40 characters */ + char *content_type; + + *endq = '\0'; + content_type = dStrconcat("text/css; charset=", data+10, NULL); + *endq = '"'; + a_Capi_unref_buf(url); + a_Capi_set_content_type(url, content_type, "meta"); + dFree(content_type); + a_Capi_get_buf(url, &data, &len); } - html->styleEngine->parse(html, url, data, len, CSS_ORIGIN_AUTHOR); } + html->styleEngine->parse(html, url, data, len, CSS_ORIGIN_AUTHOR); a_Capi_unref_buf(url); } else { /* Fill a Web structure for the cache query */ |