Commit 739c44af authored by Andrew Hodgkinson's avatar Andrew Hodgkinson
Browse files

Customer work complete, and this version just shipped. Had to comment out the...

Customer work complete, and this version just shipped. Had to comment out the code in Main.c that sets the user agent string to fake Netscape, as the persistent problems with forms in tables showed up much more on a modem link - net result was that the customer's log in page didn't work. Not faking Netscape gives an authorisation dialogue instead, allowing access to the site even if not by the most elegant of methods.
parent afce4224
......@@ -3,8 +3,7 @@ Set Browse$Path <Browse$Dir>.
| HTTP fetcher controls
Set Browse$FakeNetscape off
Set Browes$AcceptAllCookies off
Set Browes$AcceptAllCookies on
UnSet Browse$CookiePath
| Ensure specific versions of Toolbox modules (or later ones)
......
......@@ -3,8 +3,7 @@ Set Browse$Path <Browse$Dir>.
| HTTP fetcher controls
Set Browse$FakeNetscape off
Set Browse$AcceptAllCookies off
Set Browes$AcceptAllCookies on
UnSet Browse$CookiePath
| Ensure specific versions of Toolbox modules (or later ones)
......
......@@ -32,6 +32,7 @@ WhatSave:Internal error - Save dialogue origin not understood in save_fill_in().
BadType:Internal error - Bad typeface definition in %0().
BadTRef:Internal error - Reference to undefined typeface in %0().
NoContxt:Serious internal error - Block is already free or was not HtmlAlloc'd in html_close(); must exit immediately.
HSHOvrrn:Serious internal error - HtmlStripHeaders has failed; must exit immediately.
STCUnkwn:Serious internal error - Unknown chunk ID in memory_set_chunk_size(); must exit immediately.
......
......@@ -32,6 +32,7 @@ WhatSave:Internal error - Save dialogue origin not understood in save_fill_in().
BadType:Internal error - Bad typeface definition in %0().
BadTRef:Internal error - Reference to undefined typeface in %0().
NoContxt:Serious internal error - Block is already free or was not HtmlAlloc'd in html_close(); must exit immediately.
HSHOvrrn:Serious internal error - HtmlStripHeaders has failed; must exit immediately.
STCUnkwn:Serious internal error - Unknown chunk ID in memory_set_chunk_size(); must exit immediately.
......
......@@ -553,7 +553,10 @@ HStream * browser_find_selectable_top_r(browser_data * b, reformat_cell * cell,
{
int extent = cell->ldata[cell->nlines - 1].y;
int average = extent / cell->nlines;
int startat = ytop / average;
int startat;
if (average) startat = ytop / average;
else startat =0;
if (startat < 0) startat = 0;
if (startat >= cell->nlines) startat = cell->nlines - 1;
......
......@@ -86,8 +86,6 @@ _kernel_oserror * cookies_process_cookie(browser_data * b)
if (e) return e;
if (!handle) break;
Printf("cookie name: '%s'\n",name);
}
return NULL;
......
......@@ -462,9 +462,68 @@ void fetch_preprocess_token(browser_data * b, HStream * tptr)
}
else b->formflag = 0;
/* Closure of long if to see if the HStream structure represented */
/* a body tag or header information - the code is run if it's a */
/* body tag. */
/* Tables - need to preprocess any HStreams attached as part of a table */
/* tag. Because any one token is only run through this preprocessor */
/* once, and because when this table tag is run through it all of the */
/* HStreams within may not have arrived yet (the page is only partially */
/* fetched), it is still necessary to rescan the attached HStreams at a */
/* later date (e.g. as part of the reformatting process) to ensure they */
/* are all preprocessed correctly. */
if (tptr->tag == TABLE)
{
table_stream * table = (table_stream *) tptr;
table_row * R;
table_headdata * D;
HStream * attached, * temp;
R = table->List;
/* Scan the rows and cells */
while (R)
{
D = R->List;
while (D)
{
if (D->Tag)
{
switch (D->Tag)
{
case TagTableData:
case TagTableHead:
{
attached = (HStream *) D->List;
/* Preprocess any attached HStream list */
while (attached)
{
if (!(attached->flags & HFlags_DealtWithToken))
{
temp = b->finaltoken;
fetch_preprocess_token(b, attached);
b->finaltoken = temp;
}
attached = attached->next;
}
}
break;
}
}
D = D->Next;
}
R = R->Next;
}
}
/* Closure of long 'if' to see if the HStream structure represented */
/* a body tag or header information - the code is run if it's a */
/* body tag. */
}
#ifdef FRAMES_SUPPORT
......@@ -1707,7 +1766,11 @@ _kernel_oserror * html_get(char * url, char * extradata, int * handle, int metho
fetch_list = up;
/* If there is any extra data for POST or whatever, deal with it */
/* If there is any extra data for POST or whatever, deal with it. */
/* The POST request entries must come first in the extra header */
/* info, so that the browser can make the assumption that */
/* everything from Content-Type forwards may be stripped in the */
/* event of a redirection when the current fetch method is POST. */
if (extradata)
{
......@@ -1745,7 +1808,9 @@ _kernel_oserror * html_get(char * url, char * extradata, int * handle, int metho
strcpy(up->extradata + 2, extradata);
/* Header entry for the extra data */
/* Header entry for the extra data - again, the removal routines in the */
/* fetcher's redirection code assume that this comes before Content-Type */
/* and the actual body content to make life easy there. */
sprintf(head, "Content-Length: %d", len);
......@@ -2008,7 +2073,51 @@ _kernel_oserror * html_close(unsigned int handle)
}
#endif
if (up->stream) HtmlStreamFree(up->stream);
if (up->stream)
{
unsigned int context = HtmlReturnContext(up->stream);
browser_data * browser = last_browser;
/* Should Never Happen...! */
if (!context)
{
erb.errnum = Utils_Error_Custom_Fatal;
StrNCpy0(erb.errmess,
lookup_token("NoContxt:Serious internal error - Block is already free or was not HtmlAlloc'd in html_close(); must exit immediately.",
0,
0));
return &erb;
}
/* Ensure that any HStream pointers inside any current browser_data */
/* structures are not part of this stream - if so, clear them. */
while (browser)
{
/* For now, just a few selected items */
if (browser->selected && HtmlReturnContext(browser->selected) == context)
{
browser_clear_selection(browser, 0);
browser->selected = NULL;
}
if (browser->highlight && HtmlReturnContext(browser->highlight) == context)
{
browser_clear_highlight(browser, 0);
browser->highlight = NULL;
}
if (browser->pointer_over && HtmlReturnContext(browser->pointer_over) == context) browser->pointer_over = NULL;
browser = browser->previous;
}
HtmlStreamFree(up->stream);
}
if (up->context)
{
......@@ -2638,11 +2747,68 @@ _kernel_oserror * html_get_next_token(browser_data * b, unsigned int handle, int
flex_free(source);
*source = NULL;
/* Ensure POST requests are now cleared (we shouldn't continue */
/* POSTing to redirected URLs) */
if (up->method == URL_Method_http_POST)
{
/* When the headers are build, the POST data (starting with a Content-Length */
/* entry) are put in first and everything else is inserted above it. As the */
/* comments on this code say, this is organised so we can simplify things */
/* here and just chop off everything at Content-Length and below, rather */
/* than having to carefully remove the appropriate header lines and body.  */
if (up->extradata)
{
char * strip = strstr(up->extradata, "Content-Length");
if (strip)
{
int len;
/* How much do we want to keep? */
len = strstr(up->extradata, "Content-Length") - up->extradata; /* Don't use 'strip' in case flex shifted when 'len' was stacked */
#ifdef TRACE
{
int rmv = flex_size((flex_ptr) &up->extradata) - len;
flexcount -= rmv;
if (tl & (1u<<13)) Printf("** flexcount: %d\n",flexcount);
}
#endif
/* Resize the block */
flex_extend((flex_ptr) &up->extradata, len);
}
}
/* Change the fetch method to GET */
up->method = URL_Method_http_GET;
}
#ifdef TRACE
if (up->extradata)
{
flexcount -= flex_size((flex_ptr) &up->extradata);
if (tl & (1u<<13)) Printf("** flexcount: %d\n",flexcount);
}
#endif
if (up->extradata) flex_free((flex_ptr) &up->extradata);
up->method = URL_Method_http_GET;
/* Customer specific */
#ifdef CUSTOMER_SPECIAL
if (!strcmp(redirect,"http://www.customer.net/login.cgi"))
if (
!strcmp(redirect,"http://www.customer.net/login.cgi") ||
!strcmp(redirect,"http://www.customer.com/index.html")
)
{
// Send out cookie...
......
......@@ -1628,131 +1628,147 @@ int handle_link_clicks(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_
{
if (p->anchor)
{
int ignore = 0;
/* First, do we have JavaScript code to deal with? */
if (p->onclick && *p->onclick) ChkError(javascript_href_onclick(handle, p));
if (p->onclick && *p->onclick) ChkError(javascript_href_onclick(handle, p, &ignore));
/* Image maps */
/* If ignore is zero, we're supposed to deal with the HREF attribute */
/* on the link - otherwise, ignore it. */
if ((p->style & IMG) && (p->type & TYPE_ISMAP))
if (!ignore)
{
WimpGetWindowStateBlock s;
char coords[64];
browser_data * targetted;
BBox box;
int x, y;
/* Image maps */
if (eventcode < 0)
if ((p->style & IMG) && (p->type & TYPE_ISMAP))
{
ChkError(wimp_get_pointer_info(&i));
p = browser_get_pointer_token(handle, &i, NULL, NULL);
if (!p) return 0;
}
WimpGetWindowStateBlock s;
char coords[64];
browser_data * targetted;
BBox box;
int x, y;
/* Get the image's size and position on screen */
if (eventcode < 0)
{
ChkError(wimp_get_pointer_info(&i));
p = browser_get_pointer_token(handle, &i, NULL, NULL);
if (!p) return 0;
}
s.window_handle = handle->window_handle;
if (wimp_get_window_state(&s)) return 0;
/* Get the image's size and position on screen */
if (image_get_token_image_size(handle, p, &box)) return 0;
if (image_get_token_image_position(handle, p, &x, &y)) return 0;
s.window_handle = handle->window_handle;
if (wimp_get_window_state(&s)) return 0;
x = coords_x_toscreen(x, (WimpRedrawWindowBlock *) &s);
y = coords_y_toscreen(y, (WimpRedrawWindowBlock *) &s);
if (image_get_token_image_size(handle, p, &box)) return 0;
if (image_get_token_image_position(handle, p, &x, &y)) return 0;
/* Get the offset of the pointer position from the top left */
/* of the image in ox and oy */
x = coords_x_toscreen(x, (WimpRedrawWindowBlock *) &s);
y = coords_y_toscreen(y, (WimpRedrawWindowBlock *) &s);
ox = i.x - x;
oy = y + (box.ymax - box.ymin) - i.y;
/* Get the offset of the pointer position from the top left */
/* of the image in ox and oy */
if (ox >= 0 && oy >= 0)
{
/* Convert the coordinate to pixels and build an appropriate */
/* CGI string including this information. */
ox = i.x - x;
oy = y + (box.ymax - box.ymin) - i.y;
image_convert_to_pixels(handle, p, &ox, &oy);
sprintf(coords, "?%d,%d", ox, oy);
if (ox >= 0 && oy >= 0)
{
/* Convert the coordinate to pixels and build an appropriate */
/* CGI string including this information. */
history_record_global(p->anchor);
targetted = frames_find_target(handle, p);
image_convert_to_pixels(handle, p, &ox, &oy);
sprintf(coords, "?%d,%d", ox, oy);
if (targetted || choices.full_screen)
{
/* If a named target was found, open in that. Otherwise we must */
/* be running full screen, so can't open a new window; in this */
/* case, open in the ancestor. */
history_record_global(p->anchor);
targetted = frames_find_target(handle, p);
ChkError(fetchpage_new_add(targetted ? targetted : ancestor,
p->anchor,
1,
coords,
adj));
}
else
{
/* If we've reached here, a named target wasn't found but the */
/* browser isn't running full screen either, so open a new */
/* window with the name specified in the link. */
ChkError(windows_create_browser(p->anchor,
NULL,
NULL,
p->target));
if (targetted || choices.full_screen)
{
/* If a named target was found, open in that. Otherwise we must */
/* be running full screen, so can't open a new window; in this */
/* case, open in the ancestor. */
ChkError(fetchpage_new_add(targetted ? targetted : ancestor,
p->anchor,
1,
coords,
adj));
}
else
{
/* If we've reached here, a named target wasn't found but the */
/* browser isn't running full screen either, so open a new */
/* window with the name specified in the link. */
ChkError(windows_create_browser(p->anchor,
NULL,
NULL,
p->target));
}
}
}
used = 1;
}
used = 1;
}
/* Otherwise, a simple link */
/* Otherwise, a simple link */
else
{
if (!adj)
else
{
browser_data * targetted;
if (!adj)
{
browser_data * targetted;
history_record_global(p->anchor);
targetted = frames_find_target(handle, p);
history_record_global(p->anchor);
targetted = frames_find_target(handle, p);
/* Don't want to ever open a new window if configured */
/* to run full screen. */
/* Don't want to ever open a new window if configured */
/* to run full screen. */
if (targetted || choices.full_screen)
{
/* If a named target was found, open in that. Otherwise we must */
/* be running full screen, so can't open a new window; in this */
/* case, open in the ancestor. */
if (targetted || choices.full_screen)
{
/* If a named target was found, open in that. Otherwise we must */
/* be running full screen, so can't open a new window; in this */
/* case, open in the ancestor. */
ChkError(fetchpage_new(targetted ? targetted : ancestor,
p->anchor,
1));
}
else
{
/* If we've reached here, a named target wasn't found but the */
/* browser isn't running full screen either, so open a new */
/* window with the name specified in the link. */
ChkError(windows_create_browser(p->anchor,
NULL,
NULL,
p->target));
ChkError(fetchpage_new(targetted ? targetted : ancestor,
p->anchor,
1));
}
else
{
/* If we've reached here, a named target wasn't found but the */
/* browser isn't running full screen either, so open a new */
/* window with the name specified in the link. */
ChkError(windows_create_browser(p->anchor,
NULL,
NULL,
p->target));
}
}
}
/* Yes, this 'else' would mean that even if running */
/* full screen, an Adjust click would open a new */
/* window - but note the fixed.ignoreadjust choices */
/* option, which disables the use of adjust and can */
/* be used in conjunction with the full screen */
/* option. */
else ChkError(windows_create_browser(p->anchor,
NULL,
NULL,
NULL));
/* Yes, this 'else' would mean that even if running */
/* full screen, an Adjust click would open a new */
/* window - but note the fixed.ignoreadjust choices */
/* option, which disables the use of adjust and can */
/* be used in conjunction with the full screen */
/* option. */
else ChkError(windows_create_browser(p->anchor,
NULL,
NULL,
NULL));
used = 1;
}
}
else
{
/* The JavaScript routines said that the HREF contents of the link */
/* should be ignored; so just flag that we've dealt with this, but */
/* do nothing else. */
used = 1;
}
......
......@@ -92,10 +92,18 @@ _kernel_oserror * javascript_body_onload(browser_data * b)
/* relevant to the item clicked on; */
/* */
/* Pointer to the token representing */
/* that item. */
/* that item; */
/* */
/* Pointer to an int, in which 1 is */
/* written if the contents of the */
/* HREF attribute in the link that */
/* held the onClick should be */
/* ignored (else 0 is written) - */
/* this may be NULL if you're not */
/* interested. */
/*************************************************/
_kernel_oserror * javascript_href_onclick(browser_data * b, HStream * t)
_kernel_oserror * javascript_href_onclick(browser_data * b, HStream * t, int * ignore)
{
_kernel_oserror * e = NULL;
......@@ -103,13 +111,15 @@ _kernel_oserror * javascript_href_onclick(browser_data * b, HStream * t)
if (tl & (1u<<24)) Printf("javascript_href_onclick: Called\n");
#endif
if (ignore) *ignore = 0;
#ifdef CUSTOMER_SPECIAL
/* Only call customer_ functions if on the customer's site */
if (strstr(browser_current_url(b), "www.customer.com"))
{
e = customer_href_onclick(b, t);
e = customer_href_onclick(b, t, ignore);
}
#endif
......
......@@ -482,7 +482,7 @@ static void initialise_app(void)
/* Try and set the user agent string for HTTP fetches. */
show_error(utils_set_http_agent());
// show_error(utils_set_http_agent());
/* Find out window tool sizes */
......
......@@ -354,7 +354,7 @@ static _kernel_oserror * reformat_token_width(reformat_width_data * w, unsigned
convert_box_to_points(&box, &box);
w->width = (box.xmax - box.xmin) * length + 16*400 + extra;
w->width = (((box.xmax - box.xmin) * length * 2) / 3) + 16 * 400 + extra;
fm_lose_font(NULL, h);
w->bytes = 0;
......@@ -1299,9 +1299,15 @@ int reformat_bullet_height(int bullet)
int reformat_y_offset (browser_data * b)
{
int offset = toolbars_button_height(b) + toolbars_url_height(b);
/* The '4' accounts for the bottom window frame of the toolbars */
return -(toolbars_button_height(b) + toolbars_url_height(b) + b->leading + 4);
if (offset) offset += wimpt_dy();
if (!b->ancestor) offset += b->leading; /* Only put a gap at the top for base browsers, not for frames */
return -offset;
}
/*************************************************/
......
......@@ -95,11 +95,13 @@ void tokenutils_anchor_range(browser_data * b, HStream * token, HStream ** first
if (first) *first = NULL;
if (last) *last = NULL;
if (!b || !token) return;
/* Can only proceed if the given token represents a link */
if (token && (token->style & A) && token->anchor)
{
top = token;
store = top = token;
/* Move up the token list for as long as the token given matches */
/* the details of the token being looked at. */
......@@ -123,9 +125,9 @@ void tokenutils_anchor_range(browser_data * b, HStream * token, HStream ** first
!strcmp(top->anchor, token->anchor)
)
)
top = top->next ? top->next : NULL;
top = top->next;
end = token;
store = end = token;
/* Similary, move down the token list to find the first token after */
/* all those involved in the link. */
......@@ -151,7 +153,7 @@ void tokenutils_anchor_range(browser_data * b, HStream * token, HStream ** first
!strcmp(end->anchor, token->anchor)
)
)
end = end->prev ? end->prev : NULL;
end = end->prev;
}
else top = end = token;
......
......@@ -71,7 +71,7 @@
static int trace_dump_head (FILE * file, table_headdata * head, int depth);
/*************************************************/
/* trace_dump_tokens_by_line */
/* trace_dump_tokens_by_line() */
/* */
/* Outputs a diagnostic description of the */
/* token list of a browser. The browser is */
......@@ -401,7 +401,7 @@ tdtbl_fo_err: /* If there's an error whilst writing to the file */
}
/*************************************************/
/* trace_dump_tokens_by_stream */
/* trace_dump_tokens_by_stream() */
/* */
/* Outputs a diagnostic description of the */
/* token list of a browser. The browser is */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment