aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dpi/https.c13
-rw-r--r--dw/image.cc15
-rw-r--r--dw/textblock.hh18
-rw-r--r--dw/widget.cc13
-rw-r--r--src/IO/http.c10
-rw-r--r--src/capi.c9
-rw-r--r--src/menu.cc35
-rw-r--r--src/png.c2
-rw-r--r--src/url.h9
9 files changed, 79 insertions, 45 deletions
diff --git a/dpi/https.c b/dpi/https.c
index e6d2b0e9..f0b4ec89 100644
--- a/dpi/https.c
+++ b/dpi/https.c
@@ -156,9 +156,11 @@ static void yes_ssl_support(void)
}
}
- /* Do not use the SSLv2 protocol. */
+ /* Do not use the obsolete insecure SSLv2 protocol, and everyone disabled
+ * TLS compression when the CRIME exploit became widely known in 2012.
+ */
if (exit_error == 0){
- SSL_CTX_set_options(ssl_context, SSL_OP_NO_SSLv2);
+ SSL_CTX_set_options(ssl_context, SSL_OP_NO_SSLv2|SSL_OP_NO_COMPRESSION);
}
/*Set directory to load certificates from*/
@@ -188,10 +190,11 @@ static void yes_ssl_support(void)
}
if (exit_error == 0){
- /* Need to do the following if we want to deal with all
- * possible ciphers
+ /* Don't want: eNULL, which has no encryption; aNULL, which has no
+ * authentication; LOW, which as of 2014 use 64 or 56-bit encryption;
+ * EXPORT40, which uses 40-bit encryption.
*/
- SSL_set_cipher_list(ssl_connection, "ALL");
+ SSL_CTX_set_cipher_list(ssl_context, "ALL:!aNULL:!eNULL:!LOW:!EXPORT40");
/* Need to do this if we want to have the option of dealing
* with self-signed certs
diff --git a/dw/image.cc b/dw/image.cc
index ded8d205..20460f33 100644
--- a/dw/image.cc
+++ b/dw/image.cc
@@ -239,7 +239,20 @@ void Image::sizeRequestImpl (core::Requisition *requisition)
void Image::getExtremesImpl (core::Extremes *extremes)
{
- int width = (buffer ? buffer->getRootWidth () : 0) + boxDiffWidth ();
+ int contentWidth;
+ if (buffer)
+ contentWidth =buffer->getRootWidth ();
+ else {
+ if (altText && altText[0]) {
+ if (altTextWidth == -1)
+ altTextWidth =
+ layout->textWidth (getStyle()->font, altText, strlen (altText));
+ contentWidth = altTextWidth;
+ } else
+ contentWidth = 0;
+ }
+
+ int width = contentWidth + + boxDiffWidth ();
// With percentage width, the image may be narrower than the buffer.
extremes->minWidth =
diff --git a/dw/textblock.hh b/dw/textblock.hh
index a4b341ec..df2a8343 100644
--- a/dw/textblock.hh
+++ b/dw/textblock.hh
@@ -850,14 +850,22 @@ protected:
inline bool mustBeWidenedToAvailWidth () {
DBG_OBJ_ENTER0 ("resize", 0, "mustBeWidenedToAvailWidth");
- bool b = getStyle()->display == core::style::DISPLAY_BLOCK &&
+ bool toplevel = getParent () == NULL,
+ block = getStyle()->display == core::style::DISPLAY_BLOCK,
+ vloat = testWidgetFloat (this),
+ abspos = testWidgetAbsolutelyPositioned (this),
+ fixpos = testWidgetFixedlyPositioned (this),
// In detail, this depends on what the respective OOFM does
// with the child widget:
- !(testWidgetFloat (this) || testWidgetAbsolutelyPositioned (this) ||
- testWidgetFixedlyPositioned (this));
- DBG_OBJ_MSGF ("resize", 0, "=> %s", b ? "true" : "false");
+ result = toplevel || (block && !(vloat || abspos || fixpos));
+ DBG_OBJ_MSGF ("resize", 0,
+ "=> %s (toplevel: %s, block: %s, float: %s, abspos: %s, "
+ "fixpos: %s)",
+ result ? "true" : "false", toplevel ? "true" : "false",
+ block ? "true" : "false", vloat ? "true" : "false",
+ abspos ? "true" : "false", fixpos ? "true" : "false");
DBG_OBJ_LEAVE ();
- return b;
+ return result;
}
public:
diff --git a/dw/widget.cc b/dw/widget.cc
index e2da20ad..68875158 100644
--- a/dw/widget.cc
+++ b/dw/widget.cc
@@ -761,6 +761,9 @@ void Widget::correctExtremes (Extremes *extremes)
DBG_OBJ_MSG_END ();
}
+ if (extremes->maxWidth < extremes->minWidth)
+ extremes->maxWidth = extremes->minWidth;
+
DBG_OBJ_MSGF ("resize", 1, "=> %d / %d",
extremes->minWidth, extremes->maxWidth);
DBG_OBJ_LEAVE ();
@@ -826,12 +829,12 @@ void Widget::calcFinalWidth (style::Style *style, int refWidth,
if (width != -1)
*finalWidth = width;
- if (minWidth != -1 && (*finalWidth == -1 || *finalWidth < minWidth))
+ if (minWidth != -1 && *finalWidth != -1 && *finalWidth < minWidth)
*finalWidth = minWidth;
- if (maxWidth != -1 && (*finalWidth == -1 || *finalWidth > maxWidth))
+ if (maxWidth != -1 && *finalWidth == -1 && *finalWidth > maxWidth)
*finalWidth = maxWidth;
- DBG_OBJ_MSGF ("resize", 1, "=> %d", width);
+ DBG_OBJ_MSGF ("resize", 1, "=> %d", *finalWidth);
DBG_OBJ_LEAVE ();
}
@@ -1435,9 +1438,7 @@ int Widget::getAvailWidthOfChild (Widget *child, bool forceValue)
int width;
- if (child->getStyle()->width == style::LENGTH_AUTO &&
- child->getStyle()->minWidth == style::LENGTH_AUTO &&
- child->getStyle()->maxWidth == style::LENGTH_AUTO) {
+ if (child->getStyle()->width == style::LENGTH_AUTO) {
DBG_OBJ_MSG ("resize", 1, "no specification");
if (forceValue)
width = misc::max (getAvailWidth (true) - boxDiffWidth (), 0);
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))
diff --git a/src/capi.c b/src/capi.c
index 71faf5b9..7524535b 100644
--- a/src/capi.c
+++ b/src/capi.c
@@ -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");
}
/*
diff --git a/src/png.c b/src/png.c
index 093e2600..652e861e 100644
--- a/src/png.c
+++ b/src/png.c
@@ -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;
diff --git a/src/url.h b/src/url.h
index bb20d789..ef532f76 100644
--- a/src/url.h
+++ b/src/url.h
@@ -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.