summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--README7
-rw-r--r--src/cache.c43
-rw-r--r--src/html.cc12
4 files changed, 23 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index ca56b435..07dede0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -68,6 +68,7 @@ dillo-fltk2
- Added an experimental gzip decoder!
- Implemented "Load Images" in the page menu and cleaned up html.hh.
- Added shortcuts: PgDn=Spc PgUp=b Back=BackSpace|, Forw=Shift+Backspace|.
+ - Made a cleanup in cache's parse header code.
Patch: place, Jorge Arellano
+- Fixed a va_list-related SEGFAULT on 64bit-arch in dStr_vsprintfa().
Added const declarations in html parser.
diff --git a/README b/README
index 73ce0eb5..e3047717 100644
--- a/README
+++ b/README
@@ -34,9 +34,8 @@ Advanced * Form elements are not yet hooked/implemented. You can look
in dw2' test/dw_ui_test.cc to see what's already done.
Fixed * Sometimes pages don't load giving a warning on an already
closed IO. I'll try to look at this one soon.
-
- * no FRAMES rendering
- * no https -- read the FAQ to enable a protoype.
+ * no FRAMES rendering
+ * no https (there's a barebones prototype).
------------
@@ -80,4 +79,4 @@ Solaris
Jorge.-
(jcid@dillo.org)
-Sep 30, 2007
+Dec 03, 2007
diff --git a/src/cache.c b/src/cache.c
index 88d4cb30..74f26cca 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -458,19 +458,17 @@ static Dlist *Cache_parse_multiple_fields(const char *header,
* Scan, allocate, and set things according to header info.
* (This function needs the whole header to work)
*/
-static void Cache_parse_header(CacheEntry_t *entry,
- const char *buf, size_t buf_size, int HdrLen)
+static void Cache_parse_header(CacheEntry_t *entry)
{
char *header = entry->Header->str;
char *Length, *Type, *location_str, *encoding;
- Dstr *dbuf;
#ifndef DISABLE_COOKIES
Dlist *Cookies;
void *data;
int i;
#endif
- if (HdrLen > 12) {
+ if (entry->Header->len > 12) {
if (header[9] == '1' && header[10] == '0' && header[11] == '0') {
/* 100: Continue. The "real" header has not come yet. */
MSG("An actual 100 Continue header!\n");
@@ -540,12 +538,6 @@ static void Cache_parse_header(CacheEntry_t *entry,
entry->ContentDecoder = a_Decode_content_init(encoding);
dFree(encoding);
- dbuf = dStr_sized_new(buf_size - HdrLen);
- dStr_append_l(dbuf, buf + HdrLen, buf_size - HdrLen);
-
- dbuf = a_Decode_process(entry->TransferDecoder, dbuf);
- dbuf = a_Decode_process(entry->ContentDecoder, dbuf);
-
if (entry->ExpectedSize > 0) {
if (entry->ExpectedSize > HUGE_FILESIZE) {
entry->Flags |= CA_HugeFile;
@@ -556,8 +548,6 @@ static void Cache_parse_header(CacheEntry_t *entry,
dStr_free(entry->Data, 1);
entry->Data = dStr_sized_new(MIN(entry->ExpectedSize+1, MAX_INIT_BUF));
}
- dStr_append_l(entry->Data, dbuf->str, dbuf->len);
- dStr_free(dbuf, 1);
/* Get Content-Type */
if ((Type = Cache_parse_field(header, "Content-Type")) == NULL) {
@@ -611,7 +601,7 @@ static int Cache_get_header(CacheEntry_t *entry,
void a_Cache_process_dbuf(int Op, const char *buf, size_t buf_size,
const DilloUrl *Url)
{
- int start = 0;
+ int offset = 0;
int len;
CacheEntry_t *entry = Cache_entry_search(Url);
Dstr *dbuf;
@@ -651,25 +641,20 @@ void a_Cache_process_dbuf(int Op, const char *buf, size_t buf_size,
* Cache_parse_header() will unset it if the header turns out to have been
* merely an informational response from the server (i.e., 100 Continue)
*/
- if (!(entry->Flags & CA_GotHeader)) {
- while ((len = Cache_get_header(entry, buf + start, buf_size - start))) {
- /* Let's scan, allocate, and set things according to header info */
- Cache_parse_header(entry, buf + start, buf_size - start, len);
- start += len;
- if (entry->Flags & CA_GotHeader) {
- entry->TransferSize = buf_size - start; /* body */
- /* Now that we have it parsed, let's update our clients */
- Cache_process_queue(entry);
- return;
- }
- }
- return;
+ while (!(entry->Flags & CA_GotHeader) &&
+ (len = Cache_get_header(entry, buf + offset, buf_size - offset))) {
+ offset += len;
+ /* Let's scan, allocate, and set things according to header info */
+ Cache_parse_header(entry);
}
- entry->TransferSize += buf_size;
+ if (!(entry->Flags & CA_GotHeader))
+ return;
+
+ entry->TransferSize += buf_size - offset;
- dbuf = dStr_sized_new(buf_size);
- dStr_append_l(dbuf, buf, buf_size);
+ dbuf = dStr_sized_new(buf_size - offset);
+ dStr_append_l(dbuf, buf + offset, buf_size - offset);
/* Assert we have a Decoder.
* BUG: this is a workaround, more study and a proper design
diff --git a/src/html.cc b/src/html.cc
index c7e7b5f5..718e64ce 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -2065,7 +2065,7 @@ static void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize)
#ifdef USE_TABLES
Widget *table;
StyleAttrs style_attrs;
- Style *tstyle, *old_style;
+ Style *cell_style, *old_style;
const char *attrbuf;
int32_t border = 0, cellspacing = 1, cellpadding = 2, bgcolor;
#endif
@@ -2120,9 +2120,8 @@ static void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize)
}
}
- tstyle = Style::create (HT2LT(html), &style_attrs);
-
/* The style for the cells */
+ cell_style = Style::create (HT2LT(html), &style_attrs);
style_attrs = *S_TOP(html)->style;
/* When dillo was started with the --debug-rendering option, there
* is always a border around the cells. */
@@ -2130,9 +2129,8 @@ static void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize)
style_attrs.borderWidth.setVal (1);
else
style_attrs.borderWidth.setVal (border ? 1 : 0);
-
style_attrs.padding.setVal(cellpadding);
- style_attrs.setBorderColor (tstyle->borderColor.top);
+ style_attrs.setBorderColor (cell_style->borderColor.top);
style_attrs.setBorderStyle (BORDER_INSET);
old_style = S_TOP(html)->table_cell_style;
@@ -2142,8 +2140,8 @@ static void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize)
old_style->unref ();
table = new Table(false);
- DW2TB(html->dw)->addWidget (table, tstyle);
- tstyle->unref ();
+ DW2TB(html->dw)->addWidget (table, cell_style);
+ cell_style->unref ();
S_TOP(html)->table_mode = DILLO_HTML_TABLE_MODE_TOP;
S_TOP(html)->cell_text_align_set = FALSE;