Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Cameron Cawley
Browse
Commits
68c33afa
Commit
68c33afa
authored
27 years ago
by
Andrew Hodgkinson
Browse files
Options
Download
Email Patches
Plain Diff
In the middle of customer support work.
parent
f814da6f
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
468 additions
and
60 deletions
+468
-60
Resources/UK/Browse/!Run,feb
Resources/UK/Browse/!Run,feb
+3
-2
Resources/UK/Browse/!RunD,feb
Resources/UK/Browse/!RunD,feb
+4
-3
Resources/UK/Browse/Choices
Resources/UK/Browse/Choices
+1
-1
Resources/UK/Browse/Messages
Resources/UK/Browse/Messages
+12
-1
Resources/UK/Phoenix/!RunD,feb
Resources/UK/Phoenix/!RunD,feb
+2
-2
Resources/UK/Phoenix/Messages
Resources/UK/Phoenix/Messages
+2
-2
Resources/UK/Ursula/!Run,feb
Resources/UK/Ursula/!Run,feb
+1
-1
Resources/UK/Ursula/!RunD,feb
Resources/UK/Ursula/!RunD,feb
+2
-2
Resources/UK/Ursula/Messages
Resources/UK/Ursula/Messages
+1
-1
c/Cookies
c/Cookies
+94
-0
c/Fetch
c/Fetch
+29
-13
c/Forms
c/Forms
+1
-1
c/Frames
c/Frames
+14
-12
c/Global
c/Global
+1
-0
c/Handlers
c/Handlers
+7
-2
c/JavaScript
c/JavaScript
+157
-5
c/Main
c/Main
+5
-0
c/TokenUtils
c/TokenUtils
+3
-0
c/Utils
c/Utils
+124
-5
c/meta
c/meta
+5
-7
No files found.
Resources/UK/Browse/!Run,feb
View file @
68c33afa
...
...
@@ -3,7 +3,8 @@ Set Browse$Path <Browse$Dir>.
| HTTP fetcher controls
Set Browse$FakeNetscape on
Set Browse$FakeNetscape off
Set Browes$AcceptAllCookies off
UnSet Browse$CookiePath
| Ensure specific versions of Toolbox modules (or later ones)
...
...
@@ -82,4 +83,4 @@ Set Alias$@RunType_F91 /<Browse$Dir>.!Run -uri %%*0
WimpSlot -Min 420K -Max 420K
Run <Browse$Dir>.!RunImage %*0
\ No newline at end of file
Run <Browse$Dir>.!RunImage %*0
This diff is collapsed.
Click to expand it.
Resources/UK/Browse/!RunD,feb
View file @
68c33afa
...
...
@@ -3,7 +3,8 @@ Set Browse$Path <Browse$Dir>.
| HTTP fetcher controls
Set Browse$FakeNetscape on
Set Browse$FakeNetscape off
Set Browse$AcceptAllCookies off
UnSet Browse$CookiePath
| Ensure specific versions of Toolbox modules (or later ones)
...
...
@@ -80,8 +81,8 @@ Set Alias$@RunType_F91 /<Browse$Dir>.!Run -uri %%*0
| And finally, run the application.
WimpSlot -Min
16
00K -Max
16
00K
WimpSlot -Min
20
00K -Max
20
00K
%UnSet ChangeFSI$Dir
|Run <Browse$Dir>.!RunImage -debug CMal,CFle %*0 2> Pipe:$.StdErr
Run <Browse$Dir>.!RunImage %*0
\ No newline at end of file
Run <Browse$Dir>.!RunImage -debug JScr %*0
This diff is collapsed.
Click to expand it.
Resources/UK/Browse/Choices
View file @
68c33afa
...
...
@@ -238,7 +238,7 @@ ShowURLs:no
SaveHistory:yes
SaveHotlist:yes
RefoWait:
no
RefoWait:
yes
RefoHang:no
RefoTime:500
BrickWall:no
...
...
This diff is collapsed.
Click to expand it.
Resources/UK/Browse/Messages
View file @
68c33afa
_TaskName
:
Browse
_SpriName
:
!browse
Version
:
1.1
7
(
2
3-Jul-97)
Version
:
1.1
8
(3
1
-Jul-97)
# Errors, ranked roughly in order of increasing severity
...
...
@@ -317,6 +317,17 @@ BackOffAt:128
ClientPull
:
yes
# Debugging support - for testing, report inline JavaScript? Report
# unknown function calls? Report illegal parameters to hard coded
# function calls?
#
# This section of the Messages file should only be present in Customer
# builds (don't merge it to others).
DBS_ReportInline
:
yes
DBS_ReportUnknown
:
yes
DBS_ReportIllegal
:
yes
# Dynamically created pages. Note that MessageTrans will deal with '%'s,
# so you need two if you want one.
...
...
This diff is collapsed.
Click to expand it.
Resources/UK/Phoenix/!RunD,feb
View file @
68c33afa
...
...
@@ -58,8 +58,8 @@ Set Alias$@RunType_F91 /<Browse$Dir>.!Run -uri %%*0
| And finally, run the application.
WimpSlot -Min
16
00K -Max
16
00K
WimpSlot -Min
20
00K -Max
20
00K
%UnSet ChangeFSI$Dir
|Run <Browse$Dir>.!RunImage -debug CMal,CFle %*0 2> Pipe:$.StdErr
Run <Browse$Dir>.!RunImage %*0
\ No newline at end of file
Run <Browse$Dir>.!RunImage %*0
This diff is collapsed.
Click to expand it.
Resources/UK/Phoenix/Messages
View file @
68c33afa
_TaskName
:
Browse
_TaskName
:
Phoenix
_SpriName
:
!browse
Version
:
1.1
7
(
2
3-Jul-97)
Version
:
1.1
8
(3
1
-Jul-97)
# Errors, ranked roughly in order of increasing severity
...
...
This diff is collapsed.
Click to expand it.
Resources/UK/Ursula/!Run,feb
View file @
68c33afa
...
...
@@ -77,4 +77,4 @@ Set Alias$@RunType_F91 /<Browse$Dir>.!Run -uri %%*0
WimpSlot -Min 420K -Max 420K
Run <Browse$Dir>.!RunImage %*0
\ No newline at end of file
Run <Browse$Dir>.!RunImage %*0
This diff is collapsed.
Click to expand it.
Resources/UK/Ursula/!RunD,feb
View file @
68c33afa
...
...
@@ -75,8 +75,8 @@ Set Alias$@RunType_F91 /<Browse$Dir>.!Run -uri %%*0
| And finally, run the application.
WimpSlot -Min
16
00K -Max
16
00K
WimpSlot -Min
20
00K -Max
20
00K
%UnSet ChangeFSI$Dir
|Run <Browse$Dir>.!RunImage -debug CMal,CFle %*0 2> Pipe:$.StdErr
Run <Browse$Dir>.!RunImage %*0
\ No newline at end of file
Run <Browse$Dir>.!RunImage %*0
This diff is collapsed.
Click to expand it.
Resources/UK/Ursula/Messages
View file @
68c33afa
_TaskName
:
Browse
_SpriName
:
!browse
Version
:
1.1
7
(
2
3-Jul-97)
Version
:
1.1
8
(3
1
-Jul-97)
# Errors, ranked roughly in order of increasing severity
...
...
This diff is collapsed.
Click to expand it.
c/Cookies
0 → 100644
View file @
68c33afa
/* Copyright 1997 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*************************************************/
/* File : Cookies.c */
/* Purpose: Browser-end HTTP Cookie support. */
/* Author : A.D.Hodgkinson */
/* History: 28-Jul-96: Created */
/*************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "swis.h"
#include "HTMLLib.h"
/* HTML library API, Which will include html2_ext.h, tags.h and struct.h */
#include "wimp.h"
#include "wimplib.h"
#include "event.h"
#include "svcprint.h"
#include "Global.h"
#include "Utils.h"
#include "MiscDefs.h"
#include "Cookies.h"
/*************************************************/
/* cookies_process_cookie() */
/* */
/* If a call to URL_ReadData flags (through bit */
/* 16 of the returned status word being set) */
/* that a cookie / some cookies have arrived, */
/* this function deals with sending that cookie */
/* on or getting rid of it. This may or may not */
/* involve user level interaction. */
/* */
/* Parameters: Pointer to a browser_data struct */
/* relevant to the fetch. */
/*************************************************/
_kernel_oserror
*
cookies_process_cookie
(
browser_data
*
b
)
{
_kernel_oserror
*
e
;
int
handle
=
0
;
int
flags
;
int
ncookies
;
int
unread
=
1
;
char
*
domain
;
char
*
name
;
char
*
value
;
char
*
path
;
while
(
unread
)
{
e
=
_swix
(
HTTP_EnumerateCookies
,
_INR
(
0
,
1
)
|
_OUTR
(
0
,
7
),
0
,
handle
,
&
flags
,
&
handle
,
&
ncookies
,
&
unread
,
&
domain
,
&
name
,
&
value
,
&
path
);
/* Exit conditions */
if
(
e
)
return
e
;
if
(
!
handle
)
break
;
Printf
(
"cookie name: '%s'
\n
"
,
name
);
}
return
NULL
;
}
This diff is collapsed.
Click to expand it.
c/Fetch
View file @
68c33afa
...
...
@@ -42,6 +42,7 @@
#include "Authorise.h"
#include "Browser.h"
#include "Cookies.h"
#include "FontManage.h"
#include "Forms.h"
#include "Frames.h"
...
...
@@ -2169,13 +2170,15 @@ _kernel_oserror * html_get_next_token(browser_data * b, unsigned int handle, int
return
&
erb
;
}
/* Only look for an anchor and use url_read_data
()
for URLs which */
/* Only look for an anchor and use url_read_data for URLs which */
/* are not internal. */
StrNCpy0
(
ref_url
,
url
);
if
(
image
||
b
->
displayed
==
Display_Fetched_Page
)
{
int
status
=
0
;
/* Want to make sure we work on a URL which doesn't */
/* have an anchor in it, so copy over the url to */
/* a local buffer and if there's a '#' marking an */
...
...
@@ -2191,13 +2194,21 @@ _kernel_oserror * html_get_next_token(browser_data * b, unsigned int handle, int
/* module. The url_read_data call puts the number of bytes read */
/* into r. */
if
(
!
authorising
&&
up
->
fetching
&&
(
up
->
authorised
!=
1
))
e
=
url_read_data
(
0
,
/* Flags - must be 0 at present */
handle
,
/* Session handle */
fetch_buffer
,
/* Buffer to receive data */
FetchBufferSize
,
/* The buffer's size */
NULL
,
/* (Would be protocol status) */
&
r
,
/* Number of bytes read */
remaining
);
/* Number of bytes left to get */
if
(
!
authorising
&&
up
->
fetching
&&
(
up
->
authorised
!=
1
))
{
e
=
url_read_data
(
0
,
/* Flags - must be 0 at present */
handle
,
/* Session handle */
fetch_buffer
,
/* Buffer to receive data */
FetchBufferSize
,
/* The buffer's size */
&
status
,
/* Protocol status */
&
r
,
/* Number of bytes read */
remaining
);
/* Number of bytes left to get */
/* Deal with cookies */
if
(
!
e
&&
(
status
&
(
1u
<<
16
)))
e
=
cookies_process_cookie
(
b
);
}
}
else
{
...
...
@@ -2910,20 +2921,20 @@ _kernel_oserror * html_get_next_token(browser_data * b, unsigned int handle, int
/* if it was not) */
}
/* Closure of 'if' statement that followed the url_read_data
()
*/
/* Closure of 'if' statement that followed the url_read_data
*/
/* function call and associated memory allocation procedures, */
/* and only proceeded if data had been fetched and authoristion */
/* was not flagged as being in progress. */
}
/* If no data has been fetched from the url_read_data
()
call */
/* If no data has been fetched from the url_read_data call
*/
/* from earlier on, and there hasn't been an error flagged */
/* so far, and both the general 'authorisation taking place' */
/* and urlstat-based 'authorisation in progress' flags are */
/* clear, ask the URL module for its current status. If it */
/* says it has finished (which would explain this set of */
/* circumstances - basically, having no data from the */
/* url_read_data
()
call but nothing else is wrong), set the */
/* url_read_data call but nothing else is wrong), set the
*/
/* urlstat structure flag to say fetching is no longer in */
/* progress. */
...
...
@@ -3272,6 +3283,7 @@ _kernel_oserror * url_get_url(unsigned int flags, unsigned int handle, int metho
_kernel_oserror
*
url_read_data
(
unsigned
int
flags
,
unsigned
int
handle
,
void
*
buffer
,
int
size
,
int
*
status
,
int
*
read
,
int
*
pending
)
{
_kernel_oserror
*
e
;
int
s
,
r
,
p
=
0
;
...
...
@@ -3281,8 +3293,8 @@ _kernel_oserror * url_read_data(unsigned int flags, unsigned int handle, void *
/* Ensure all returned data is set to a sensible default to start with */
if
(
status
)
*
status
=
0
;
if
(
read
)
*
read
=
0
;
if
(
status
)
*
status
=
0
;
if
(
read
)
*
read
=
0
;
if
(
pending
)
*
pending
=
0
;
/* Call the URL module */
...
...
@@ -3299,6 +3311,10 @@ _kernel_oserror * url_read_data(unsigned int flags, unsigned int handle, void *
&
r
,
&
p
);
#ifdef TRACE
if
(
tl
&
(
1u
<<
6
))
Printf
(
"url_read_data: Status %p, error %p returned
\n
"
,
s
,
e
);
#endif
/* In the absence of any errors, fill in the relevant returned data */
if
(
!
e
)
...
...
This diff is collapsed.
Click to expand it.
c/Forms
View file @
68c33afa
...
...
@@ -2865,7 +2865,7 @@ static _kernel_oserror * form_build_data(browser_data * b, HStream * token, int
tp
=
hp
->
token
;
if
(
HtmlFORMmethod
(
tp
)
==
formmethod_GET
&&
HtmlFORMaction
(
tp
))
if
(
HtmlFORMmethod
(
tp
)
==
formmethod_GET
&&
HtmlFORMaction
(
tp
))
{
/* A GET form - put the URL in */
...
...
This diff is collapsed.
Click to expand it.
c/Frames
View file @
68c33afa
...
...
@@ -27,8 +27,6 @@
#include "swis.h"
#include "flex.h"
#include "unixlib.h"
/* For case insensitive strcmps only */
#include "HTMLLib.h"
/* HTML library API, Which will include html2_ext.h, tags.h and struct.h */
#include "wimp.h"
...
...
@@ -1495,13 +1493,11 @@ browser_data * frames_find_named(browser_data * parent, char * name)
{
int
child
=
0
;
/* Can't proceed with this browser window if it hasn't got a name */
if
(
!
parent
||
!
name
||
(
name
&&
!*
name
))
return
NULL
;
/* If the parent matches the given name, return it */
if
(
parent
->
window_name
&&
*
parent
->
window_name
&&
!
strcasecmp
(
parent
->
window_name
,
name
))
return
parent
;
if
(
parent
->
window_name
&&
*
parent
->
window_name
&&
!
utils_
strcasecmp
(
parent
->
window_name
,
name
))
return
parent
;
/* Otherwise, go through the list of children */
...
...
@@ -1528,6 +1524,12 @@ browser_data * frames_find_named(browser_data * parent, char * name)
/* lies in, the browser to which the target */
/* refers. */
/* */
/* If you want to pass in a specific target */
/* string, just throw an HStream on the stack */
/* and make the 'target' field point to the */
/* string - the function doesn't look at any */
/* other field in the HStream. */
/* */
/* Parameters: Pointer to a browser_data struct */
/* that the tag lies in; */
/* */
...
...
@@ -1568,7 +1570,7 @@ browser_data * frames_find_target(browser_data * b, HStream * t)
if
(
tl
&
(
1u
<<
17
))
Printf
(
"frames_find_target: Target='%s'
\n
"
,
t
->
target
);
#endif
if
(
!
strcasecmp
(
t
->
target
,
"_top"
))
/* Open in the top level window */
if
(
!
utils_
strcasecmp
(
t
->
target
,
"_top"
))
/* Open in the top level window */
{
ancestor
=
b
->
ancestor
;
if
(
!
ancestor
)
ancestor
=
b
->
real_parent
;
...
...
@@ -1576,15 +1578,15 @@ browser_data * frames_find_target(browser_data * b, HStream * t)
return
ancestor
;
}
else
if
(
!
strcasecmp
(
t
->
target
,
"_self"
))
/* Open within the frame */
else
if
(
!
utils_
strcasecmp
(
t
->
target
,
"_self"
))
/* Open within the frame */
{
return
b
;
}
else
if
(
!
strcasecmp
(
t
->
target
,
"_blank"
))
/* Open in a new, blank window */
else
if
(
!
utils_
strcasecmp
(
t
->
target
,
"_blank"
))
/* Open in a new, blank window */
{
return
NULL
;
}
else
if
(
!
strcasecmp
(
t
->
target
,
"_parent"
))
/* Open in the frame's parent */
else
if
(
!
utils_
strcasecmp
(
t
->
target
,
"_parent"
))
/* Open in the frame's parent */
{
browser_data
*
parent
=
b
->
real_parent
;
...
...
@@ -1631,9 +1633,9 @@ browser_data * frames_find_target(browser_data * b, HStream * t)
while
(
named
&&
!
found
)
{
if
(
named
->
window_name
&&
*
named
->
window_name
&&
!
strcasecmp
(
named
->
window_name
,
t
->
target
)
named
->
window_name
&&
*
named
->
window_name
&&
!
utils_
strcasecmp
(
named
->
window_name
,
t
->
target
)
)
found
=
named
;
...
...
This diff is collapsed.
Click to expand it.
c/Global
View file @
68c33afa
...
...
@@ -82,6 +82,7 @@
/* 21 URI handler interfacing URIH 2097152 */
/* 22 Keyboard control functions KeyC 4194304 */
/* 23 Redraw rectangle display RBox 8388608 */
/* 24 JavaScript functinos JScr 16777216 */
/* */
/* To use, put -debug or -d into the command line args */
/* for running !RunImage, followed by a series of comma */
...
...
This diff is collapsed.
Click to expand it.
c/Handlers
View file @
68c33afa
...
...
@@ -29,8 +29,6 @@
#include "kernel.h"
#include "flex.h"
#include "unixlib.h"
/* For case insensitive strcmps only */
#include "HTMLLib.h"
/* HTML library API, Which will include html2_ext.h, tags.h and struct.h */
#include "URI.h"
/* URI handler API, in URILib:h */
...
...
@@ -59,6 +57,7 @@
#include "Frames.h"
#include "History.h"
#include "Images.h"
#include "JavaScript.h"
#include "MiscDefs.h"
#include "Mouse.h"
#include "Printing.h"
...
...
@@ -1629,6 +1628,10 @@ int handle_link_clicks(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_
{
if
(
p
->
anchor
)
{
/* First, do we have JavaScript code to deal with? */
if
(
p
->
onclick
&&
*
p
->
onclick
)
ChkError
(
javascript_href_onclick
(
handle
,
p
));
/* Image maps */
if
((
p
->
style
&
IMG
)
&&
(
p
->
type
&
TYPE_ISMAP
))
...
...
@@ -1775,6 +1778,8 @@ int handle_link_clicks(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_
/* a link, then again, follow that link. */
/* */
/* This behaviour is due to change (save link contents). */
/* Note that JavaScript onClick events are not activated */
/* if you shift+click (this is deliberate!). */
if
(
p
->
anchor
&&
!
(
p
->
style
&
IMG
))
{
...
...
This diff is collapsed.
Click to expand it.
c/JavaScript
View file @
68c33afa
...
...
@@ -24,7 +24,6 @@
#include <string.h>
#include "swis.h"
#include "flex.h"
#include "HTMLLib.h"
/* HTML library API, Which will include html2_ext.h, tags.h and struct.h */
...
...
@@ -36,6 +35,9 @@
#include "Global.h"
#include "Utils.h"
#include "Browser.h"
#include "FetchPage.h"
#include "Frames.h"
#include "Customer.h"
#include "JavaScript.h"
...
...
@@ -56,14 +58,164 @@
_kernel_oserror
*
javascript_body_onload
(
browser_data
*
b
)
{
_kernel_oserror
*
e
=
NULL
;
#ifdef TRACE
if
(
tl
&
(
1u
<<
24
))
Printf
(
"javascript_body_onload: Called
\n
"
);
#endif
#ifdef CUSTOMER_SPECIAL
return
customer_body_onload
(
b
);
/* Only call customer_ functions if on the customer's site */
if
(
strstr
(
browser_current_url
(
b
),
"www.customer.com"
))
{
e
=
customer_body_onload
(
b
);
}
#endif
// Don't forget to set the onload field to NULL after use,
// or this'll keep getting called as images fetch!
b
->
onload
=
NULL
;
return
e
;
}
/*************************************************/
/* javascript_href_onclick() */
/* */
/* When something is clicked upon that has an */
/* onClick attribute specified for it, this */
/* function is called with the details of that */
/* attribute. */
/* */
/* Parameters: Pointer to a browser_data struct */
/* relevant to the item clicked on; */
/* */
/* Pointer to the token representing */
/* that item. */
/*************************************************/
_kernel_oserror
*
javascript_href_onclick
(
browser_data
*
b
,
HStream
*
t
)
{
_kernel_oserror
*
e
=
NULL
;
#ifdef TRACE
if
(
tl
&
(
1u
<<
24
))
Printf
(
"javascript_href_onclick: Called
\n
"
);
#endif
#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
);
}
#endif
return
e
;
}
/*************************************************/
/* javascript_window_open() */
/* */
/* Opens a given URL in a given target window. */
/* */
/* Parameters: Pointer to a browser_data struct */
/* relevant to the window_open call; */
/* */
/* 1 if the specified target window */
/* must be found to proceed, else 0 */
/* (if the target isn't found the */
/* URL is opened in the given */
/* browser instead); */
/* */
/* 1 if the URL displayed in the */
/* target is to be recorded in the */
/* History before the new one is */
/* fetched, else 0; */
/* */
/* Pointer to the URL to fetch; */
/* */
/* Pointer to the target (or NULL / */
/* a null string for the given */
/* browser). */
/*************************************************/
_kernel_oserror
*
javascript_window_open
(
browser_data
*
b
,
int
must_find
,
int
record
,
char
*
url
,
char
*
target
)
{
browser_data
*
targetted
=
b
;
#ifdef TRACE
if
(
tl
&
(
1u
<<
24
))
Printf
(
"javascript_window_open: Called for %p with '%s' and target '%s'
\n
"
,
b
,
url
,
target
);
#endif
/* Exit if no URL or base browser is given */
if
(
!
b
||
!
url
||
!*
url
)
return
NULL
;
/* If a target is specified, try and find it */
if
(
target
&&
*
target
)
{
browser_data
*
ancestor
=
b
->
ancestor
;
if
(
!
ancestor
)
ancestor
=
b
;
#ifdef TRACE
if
(
tl
&
(
1u
<<
24
))
Printf
(
"javascript_window_open: Proceeding with target '%s'
\n
"
,
target
);
#endif
targetted
=
frames_find_named
(
ancestor
,
target
);
#ifdef TRACE
if
(
tl
&
(
1u
<<
24
))
Printf
(
"javascript_window_open: targetted = %p
\n
"
,
targetted
);
#endif
/* If the target can't be found and the parameters specify it must be, */
/* then exit; else target the base browser instead. */
if
(
!
targetted
)
{
if
(
must_find
)
return
NULL
;
else
targetted
=
b
;
}
}
/* Open the URL */
#ifdef TRACE
if
(
tl
&
(
1u
<<
24
))
Printf
(
"javascript_window_open: Opening to target %p
\n
"
,
targetted
);
#endif
/* Relativise the URL if necessary */
if
(
!
strstr
(
url
,
"http://"
))
{
browser_data
*
ancestor
=
targetted
->
ancestor
;
char
*
r_url
;
if
(
!
ancestor
)
ancestor
=
targetted
;
#ifdef TRACE
if
(
tl
&
(
1u
<<
24
))
Printf
(
"javascript_window_open: Relativising URL
\n
"
);
#endif
/* Need to go down a sequence of options for which URL to relativise to! */
r_url
=
browser_current_url
(
targetted
);
if
(
!
r_url
)
r_url
=
browser_fetch_url
(
targetted
);
if
(
!
r_url
)
r_url
=
browser_current_url
(
ancestor
);
if
(
!
r_url
)
r_url
=
browser_fetch_url
(
ancestor
);
url
=
HtmlRelativiseURL
(
r_url
,
url
,
targetted
->
stream
);
#ifdef TRACE
if
(
tl
&
(
1u
<<
24
))
Printf
(
"javascript_window_open: Relativised URL is '%s'
\n
"
,
url
);
#endif
}
return
NULL
;
return
fetchpage_new
(
targetted
,
url
,
record
)
;
}
This diff is collapsed.
Click to expand it.
c/Main
View file @
68c33afa
...
...
@@ -480,6 +480,10 @@ static void initialise_app(void)
else
if
(
version
>=
5
)
uri_module_present
=
1
;
}
/* Try and set the user agent string for HTTP fetches. */
show_error
(
utils_set_http_agent
());
/* Find out window tool sizes */
ChkError
(
windows_initialise_tool_sizes
());
...
...
@@ -972,6 +976,7 @@ int main(int argc, char * argv[])
if
(
strstr
(
argv
[
argp
+
1
],
"URIH"
))
tl
|=
(
1u
<<
21
);
if
(
strstr
(
argv
[
argp
+
1
],
"KeyC"
))
tl
|=
(
1u
<<
22
);
if
(
strstr
(
argv
[
argp
+
1
],
"RBox"
))
tl
|=
(
1u
<<
23
);
if
(
strstr
(
argv
[
argp
+
1
],
"JScr"
))
tl
|=
(
1u
<<
24
);
if
(
strstr
(
argv
[
argp
+
1
],
"All"
))
tl
=
0xffffffff
;
...
...
This diff is collapsed.
Click to expand it.
c/TokenUtils
View file @
68c33afa
...
...
@@ -92,6 +92,9 @@ void tokenutils_anchor_range(browser_data * b, HStream * token, HStream ** first
HStream
*
end
=
NULL
;
HStream
*
store
=
NULL
;
if
(
first
)
*
first
=
NULL
;
if
(
last
)
*
last
=
NULL
;
/* Can only proceed if the given token represents a link */
if
(
token
&&
(
token
->
style
&
A
)
&&
token
->
anchor
)
...
...
This diff is collapsed.
Click to expand it.
c/Utils
View file @
68c33afa
...
...
@@ -66,7 +66,11 @@
#include "Utils.h"
/* Constant definitions */
/* Local definitions */
#define AGENT_START "Mozilla/2.0 (compatible; Acorn "
#define AGENT_MIDDLE "; RISC OS "
#define AGENT_END ")"
#define MillipointsPerOSUnit 400
...
...
@@ -2087,15 +2091,38 @@ int encode_base64(const char * in, int len, char * out)
return
out
-
out_ptr
;
}
/*************************************************/
/* utils_strcasecmp() */
/* */
/* Case insensitive comparison of two given */
/* strings. */
/* */
/* Parameters: As strcmp. */
/* */
/* Returns: As strcmp. */
/*************************************************/
int
utils_strcasecmp
(
const
char
*
a
,
const
char
*
b
)
{
while
(
*
a
&&
*
b
)
{
if
(
tolower
(
*
a
++
)
!=
tolower
(
*
b
++
))
return
1
;
}
if
(
!*
a
&&
!*
b
)
return
0
;
return
1
;
}
/*************************************************/
/* utils_strncasecmp() */
/* */
/* Case insensitive comparis
s
on of n chars of
*/
/*
two
given strings. */
/* Case insensitive comparison of n chars of
two
*/
/* given strings.
*/
/* */
/* Parameters: As strncmp
*/
/* Parameters: As strncmp
.
*/
/* */
/* Returns: As strncmp
*/
/* Returns: As strncmp
.
*/
/*************************************************/
int
utils_strncasecmp
(
const
char
*
a
,
const
char
*
b
,
unsigned
int
n
)
...
...
@@ -2201,3 +2228,95 @@ _kernel_oserror * utils_stop_webserv(void)
}
/*************************************************/
/* utils_set_http_agent() */
/* */
/* Works out an appropriate HTTP agent string */
/* and attempts to tell the HTTP module to use */
/* this in headers for fetches. */
/* */
/* If HTTP is not present, the routine will fail */
/* silently. */
/*************************************************/
_kernel_oserror
*
utils_set_http_agent
(
void
)
{
_kernel_oserror
*
e
;
char
agent
[
1024
];
char
ver
[
32
];
int
modnum
,
bcdver
=
0
;
/* The AGENT_... definitions are at the top of ths file. */
/* */
/* First, the string start, e.g. 'Mozilla/2.0 (compatible; ' */
StrNCpy0
(
agent
,
AGENT_START
);
/* The browser name */
*
lasttokn
=
0
;
/* Being very (maybe over?) cautions here */
*
tokens
=
0
;
lookup_token
(
"_TaskName"
,
1
,
0
);
if
(
strlen
(
tokens
)
+
strlen
(
agent
)
+
2
<
sizeof
(
agent
))
{
strcat
(
agent
,
tokens
);
strcat
(
agent
,
" "
);
}
/* The browser version */
*
lasttokn
=
0
;
*
tokens
=
0
;
lookup_token
(
"Version"
,
1
,
0
);
if
(
strlen
(
tokens
)
+
strlen
(
agent
)
+
1
<
sizeof
(
agent
))
strcat
(
agent
,
tokens
);
/* Intermediate string */
if
(
strlen
(
agent
)
+
strlen
(
AGENT_MIDDLE
)
+
1
<
sizeof
(
agent
))
strcat
(
agent
,
AGENT_MIDDLE
);
/* Extract the Utility Module version number */
e
=
_swix
(
OS_Module
,
_INR
(
0
,
1
)
|
_OUT
(
1
),
18
,
"UtilityModule"
,
&
modnum
);
if
(
e
)
return
e
;
e
=
_swix
(
OS_Module
,
_INR
(
0
,
2
)
|
_OUT
(
6
),
20
,
modnum
,
-
1
,
&
bcdver
);
if
(
e
)
return
e
;
/* Write the version number and put it into the agent string */
sprintf
(
ver
,
"%d.%02x"
,
bcdver
>>
16
,
(
bcdver
&
0xffff
)
>>
8
);
if
(
strlen
(
agent
)
+
strlen
(
ver
)
+
1
<
sizeof
(
agent
))
strcat
(
agent
,
ver
);
/* Finish things off */
if
(
strlen
(
agent
)
+
strlen
(
AGENT_END
)
+
1
<
sizeof
(
agent
))
strcat
(
agent
,
AGENT_END
);
/* Set the agent string, ignoring errors (as, say, the HTTP */
/* module may not be present at all) */
_swix
(
HTTP_UserAgent
,
_IN
(
0
),
agent
);
/* Finished. */
return
NULL
;
}
/*************************************************/
This diff is collapsed.
Click to expand it.
c/meta
View file @
68c33afa
...
...
@@ -26,8 +26,6 @@
#include "swis.h"
#include "flex.h"
#include "unixlib.h"
/* For case insensitive strcmps only */
#include "HTMLLib.h"
/* HTML library API, Which will include html2_ext.h, tags.h and struct.h */
#include "wimp.h"
...
...
@@ -75,14 +73,14 @@ _kernel_oserror * meta_process_tag(browser_data * b, HStream * t)
/* Extract information from the token */
name
=
HtmlMETAname
(
t
);
equiv
=
HtmlMETAhttp_equiv
(
t
);
content
=
HtmlMETAcontent
(
t
);
scheme
=
HtmlMETAscheme
(
t
);
name
=
HtmlMETAname
(
t
);
equiv
=
HtmlMETAhttp_equiv
(
t
);
content
=
HtmlMETAcontent
(
t
);
scheme
=
HtmlMETAscheme
(
t
);
/* Work out what to do */
if
(
!
strcasecmp
(
equiv
,
"refresh"
))
if
(
!
utils_
strcasecmp
(
equiv
,
"refresh"
))
{
/* Refresh - load a new page or reload the current page */
/* after a certain amount of time */
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment