aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjcid <devnull@localhost>2008-01-31 14:37:32 +0100
committerjcid <devnull@localhost>2008-01-31 14:37:32 +0100
commita5b7b23aab62f681a59125185ec0d9a4dae44527 (patch)
treeb1a59eee1e2e7795f9a190941ba0a8960aca766d
parent04b9283ab8718eea29b17bd97b7807caf6fd8de5 (diff)
- Set the url resolver to escape illegal chars instead of stripping.
-rw-r--r--ChangeLog2
-rw-r--r--src/dialog.cc2
-rw-r--r--src/html.cc11
-rw-r--r--src/url.c18
4 files changed, 21 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index b5d5d935..886c20aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -89,6 +89,8 @@ dillo-fltk2
Patch: Vincent Thomasset
+- Fixed void to int conversions for 64bit-arch.
Patch: Jorge Arellano Cid, higuita
++- Set the url resolver to escape illegal chars instead of stripping.
+ Patch: Jorge Arellano Cid, Jeremy Henty
+- Added a strndup() replacement in dw2
Patch: Alexander Becher, Johannes Hofmann, Jorge Arellano Cid
+- Fixed calcHashValue() to only return non-negative numbers (was SEGFAULT).
diff --git a/src/dialog.cc b/src/dialog.cc
index 08316d7d..9b53d5c6 100644
--- a/src/dialog.cc
+++ b/src/dialog.cc
@@ -103,7 +103,7 @@ char *a_Dialog_open_file(const char *msg,
*/
void a_Dialog_text_window(const char *txt, const char *title)
{
- int wh = 500, ww = 480, bh = 30;
+ int wh = 600, ww = 650, bh = 30;
int lines, line_num_width;
TextBuffer *text_buf = new TextBuffer();
text_buf->text(txt);
diff --git a/src/html.cc b/src/html.cc
index 64e72433..ca9b9ef4 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -468,15 +468,16 @@ static DilloUrl *Html_url_new(DilloHtml *html,
const char *suffix = (n_ic) > 1 ? "s" : "";
n_ic_spc = URL_ILLEGAL_CHARS_SPC(url);
if (n_ic == n_ic_spc) {
- MSG_HTML("URL has %d illegal character%s [%d space%s]\n",
+ MSG_HTML("URL has %d illegal character%s (%d space%s)\n",
n_ic, suffix, n_ic_spc, suffix);
} else if (n_ic_spc == 0) {
- MSG_HTML("URL has %d illegal character%s [%d in (00-1F or 7F)]\n",
+ MSG_HTML("URL has %d illegal character%s (%d in {00-1F, 7F} range)\n",
n_ic, suffix, n_ic);
} else {
- MSG_HTML("URL has %d illegal character%s "
- "[%d space%s and %d in (00-1F or 7F)]\n",
- n_ic, suffix, n_ic_spc, n_ic_spc ? "s" : "", n_ic-n_ic_spc);
+ MSG_HTML("URL has %d illegal character%s: "
+ "%d space%s, and %d in {00-1F, 7F} range\n",
+ n_ic, suffix,
+ n_ic_spc, n_ic_spc > 1 ? "s" : "", n_ic-n_ic_spc);
}
}
return url;
diff --git a/src/url.c b/src/url.c
index c21a458a..2a81e74b 100644
--- a/src/url.c
+++ b/src/url.c
@@ -53,6 +53,8 @@
//#define DEBUG_LEVEL 2
#include "debug.h"
+static const char *HEX = "0123456789ABCDEF";
+
/*
* Return the url as a string.
@@ -358,12 +360,17 @@ DilloUrl* a_Url_new(const char *url_str, const char *base_url,
n_ic += (*p != ' ' && *p > 0x1F && *p != 0x7F) ? 0 : 1;
}
if (n_ic) {
- /* Strip illegal characters (they could also be encoded).
- * There's no standard for illegal chars; we chose to strip. */
- p = str1 = dNew(char, strlen(url_str)); /* Yes, enough memory! */
+ /* Encode illegal characters (they could also be stripped).
+ * There's no standard for illegal chars; we chose to encode. */
+ p = str1 = dNew(char, strlen(url_str) + 2*n_ic + 1);
for (i = 0; url_str[i]; ++i)
if (url_str[i] > 0x1F && url_str[i] != 0x7F && url_str[i] != ' ')
*p++ = url_str[i];
+ else {
+ *p++ = '%';
+ *p++ = HEX[(url_str[i] >> 4) & 15];
+ *p++ = HEX[url_str[i] & 15];
+ }
*p = 0;
urlstr = str1;
}
@@ -572,7 +579,6 @@ char *a_Url_decode_hex_str(const char *str)
char *a_Url_encode_hex_str(const char *str)
{
static const char *verbatim = "-_.*";
- static const char *hex = "0123456789ABCDEF";
char *newstr, *c;
if (!str)
@@ -595,8 +601,8 @@ char *a_Url_encode_hex_str(const char *str)
*c++ = 'A';
} else {
*c++ = '%';
- *c++ = hex[(*str >> 4) & 15];
- *c++ = hex[*str & 15];
+ *c++ = HEX[(*str >> 4) & 15];
+ *c++ = HEX[*str & 15];
}
*c = 0;