diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/IO/http.c | 10 | ||||
-rw-r--r-- | src/capi.c | 9 | ||||
-rw-r--r-- | src/menu.cc | 35 | ||||
-rw-r--r-- | src/png.c | 2 | ||||
-rw-r--r-- | src/url.h | 9 |
5 files changed, 37 insertions, 28 deletions
diff --git a/src/IO/http.c b/src/IO/http.c index 16800dcf..f85e23ff 100644 --- a/src/IO/http.c +++ b/src/IO/http.c @@ -48,6 +48,8 @@ D_STMT_START { \ #define _MSG_BW(web, root, ...) +static const int HTTP_PORT = 80; + static const int HTTP_SOCKET_USE_PROXY = 0x1; static const int HTTP_SOCKET_QUEUED = 0x4; static const int HTTP_SOCKET_TO_BE_FREED = 0x8; @@ -156,6 +158,7 @@ void a_Http_set_proxy_passwd(const char *str) static int Http_sock_new(void) { SocketData_t *S = dNew0(SocketData_t, 1); + S->SockFD = -1; return a_Klist_insert(&ValidSocks, S); } @@ -231,6 +234,8 @@ static void Http_socket_free(int SKey) if (S->flags & HTTP_SOCKET_QUEUED) { S->flags |= HTTP_SOCKET_TO_BE_FREED; } else { + if (S->SockFD != -1) + Http_fd_map_remove_entry(S->SockFD); if (S->connected_to) { HostConnection_t *hc = Http_host_connection_get(S->connected_to); hc->active_conns--; @@ -238,7 +243,6 @@ static void Http_socket_free(int SKey) if (hc->active_conns == 0) Http_host_connection_remove(hc); } - Http_fd_map_remove_entry(S->SockFD); dFree(S); } } @@ -455,7 +459,7 @@ static int Http_connect_socket(ChainLink *Info) struct sockaddr_in *sin = (struct sockaddr_in *)&name; socket_len = sizeof(struct sockaddr_in); sin->sin_family = dh->af; - sin->sin_port = S->port ? htons(S->port) : htons(DILLO_URL_HTTP_PORT); + sin->sin_port = S->port ? htons(S->port) : htons(HTTP_PORT); memcpy(&sin->sin_addr, dh->data, (size_t)dh->alen); if (a_Web_valid(S->web) && (S->web->flags & WEB_RootUrl)) MSG("Connecting to %s\n", inet_ntoa(sin->sin_addr)); @@ -469,7 +473,7 @@ static int Http_connect_socket(ChainLink *Info) socket_len = sizeof(struct sockaddr_in6); sin6->sin6_family = dh->af; sin6->sin6_port = - S->port ? htons(S->port) : htons(DILLO_URL_HTTP_PORT); + S->port ? htons(S->port) : htons(HTTP_PORT); memcpy(&sin6->sin6_addr, dh->data, dh->alen); inet_ntop(dh->af, dh->data, buf, sizeof(buf)); if (a_Web_valid(S->web) && (S->web->flags & WEB_RootUrl)) @@ -750,8 +750,13 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info, DataBuf *dbuf = Data1; bool_t finished = a_Cache_process_dbuf(IORead, dbuf->Buf, dbuf->Size, conn->url); - if (finished) - a_Chain_bcb(OpSend, Info, NULL, "reply_complete"); + if (finished && Capi_conn_valid(conn) && conn->InfoRecv) { + /* If we have a persistent connection where cache tells us + * that we've received the full response, and cache didn't + * trigger an abort and tear everything down, tell upstream. + */ + a_Chain_bcb(OpSend, conn->InfoRecv, NULL, "reply_complete"); + } } else if (strcmp(Data2, "send_status_message") == 0) { a_UIcmd_set_msg(conn->bw, "%s", Data1); } else if (strcmp(Data2, "chat") == 0) { diff --git a/src/menu.cc b/src/menu.cc index b93106e1..e86c3a06 100644 --- a/src/menu.cc +++ b/src/menu.cc @@ -232,17 +232,31 @@ static void Menu_stylesheet_cb(Fl_Widget*, void *vUrl) } } +static void Menu_bugmeter_validate(const char *validator_url) +{ + if (popup_url && + dStrAsciiCasecmp(URL_SCHEME(popup_url), "dpi")) { + const char *popup_str = URL_STR(popup_url), + *ptr = strrchr(popup_str, '#'); + char *no_fragment = ptr ? dStrndup(popup_str, ptr - popup_str) + : dStrdup(popup_str); + char *encoded = a_Url_encode_hex_str(no_fragment); + Dstr *dstr = dStr_sized_new(128); + + dStr_sprintf(dstr, validator_url, encoded); + a_UIcmd_open_urlstr(popup_bw, dstr->str); + dStr_free(dstr, 1); + dFree(encoded); + dFree(no_fragment); + } +} + /* * Validate URL with the W3C */ static void Menu_bugmeter_validate_w3c_cb(Fl_Widget*, void*) { - Dstr *dstr = dStr_sized_new(128); - - dStr_sprintf(dstr, "http://validator.w3.org/check?uri=%s", - URL_STR(popup_url)); - a_UIcmd_open_urlstr(popup_bw, dstr->str); - dStr_free(dstr, 1); + Menu_bugmeter_validate("http://validator.w3.org/check?uri=%s"); } /* @@ -250,13 +264,8 @@ static void Menu_bugmeter_validate_w3c_cb(Fl_Widget*, void*) */ static void Menu_bugmeter_validate_wdg_cb(Fl_Widget*, void*) { - Dstr *dstr = dStr_sized_new(128); - - dStr_sprintf(dstr, - "http://www.htmlhelp.org/cgi-bin/validate.cgi?url=%s&warnings=yes", - URL_STR(popup_url)); - a_UIcmd_open_urlstr(popup_bw, dstr->str); - dStr_free(dstr, 1); + Menu_bugmeter_validate( + "http://www.htmlhelp.org/cgi-bin/validate.cgi?url=%s&warnings=yes"); } /* @@ -103,8 +103,8 @@ void Png_error_handling(png_structp png_ptr, png_const_charp msg) { DilloPng *png; - MSG("Png_error_handling: %s\n", msg); png = png_get_error_ptr(png_ptr); + MSG("Png_error_handling: %s: %s\n", URL_STR(png->url), msg); png->error = 1; png->state = IS_finished; @@ -13,15 +13,6 @@ #include "../dlib/dlib.h" -#define DILLO_URL_HTTP_PORT 80 -#define DILLO_URL_HTTPS_PORT 443 -#define DILLO_URL_FTP_PORT 21 -#define DILLO_URL_MAILTO_PORT 25 -#define DILLO_URL_NEWS_PORT 119 -#define DILLO_URL_TELNET_PORT 23 -#define DILLO_URL_GOPHER_PORT 70 - - /* * Values for DilloUrl->flags. * Specifies which which action to perform with an URL. |