mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 20:16:54 +03:00
[project @ 2003-03-15 15:53:20 by bursa]
MIME types for local files, new test files. svn path=/import/netsurf/; revision=107
This commit is contained in:
parent
e517a39dfb
commit
91f8a679db
@ -1,17 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Bugs in NetSurf</title>
|
||||
</head>
|
||||
<body>
|
||||
<center><h1>Known bugs</h1></center>
|
||||
<h3>Memory usage</h3>
|
||||
<p>NetSurf soon runs out of memory. This is because the memory claimed for the parsed HTML and box structures is not released when another page is requested. To get around this drag the <b>Next</b> bar in the <b>Task Manager</b> up to something ridiculous before running <i>NetSurf</i>. When NetSurf runs out of memory it will quit without warning.</p>
|
||||
<h3>Relative links</h3>
|
||||
<p>Following a relative link does not work if the current URL does not end with a leafname or a slash. Eg: <a href="http://www.riscos.com">http://www.riscos.com</a> would cause problems whereas <a href="http://www.riscos.com/">http://www.riscos.com/</a> would not.</p>
|
||||
<h3>Multiple fetches</h3>
|
||||
<p>Multiple fetches (in different windows) don't seem to work yet.</p>
|
||||
<center><h1>Possibly fixed bugs</h1></center>
|
||||
<p>This version includes new table code that should allow <i>NetSurf</i> to work with pages containing malformed tables.</p>
|
||||
<p style="text-align: center"><a href="intro.html">Return to the main page</a></p>
|
||||
</body>
|
||||
</html>
|
70
!NetSurf/Resources/intro,faf
Normal file
70
!NetSurf/Resources/intro,faf
Normal file
@ -0,0 +1,70 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head><title>Welcome to NetSurf</title></head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1 style="color: #f00; text-align: center">NetSurf - the RISC OS web
|
||||
browser</h1>
|
||||
<p><em style="color: #f00">NetSurf</em> is a new web browser for computers
|
||||
running <em>RISC OS</em>.</p>
|
||||
|
||||
<div style='float: right; width: 25%; background-color: #ccc'>
|
||||
<h2>Test Pages</h2>
|
||||
<ul>
|
||||
<li><a href="test1">Test page 1</a></li>
|
||||
<li><a href="jpeg">JPEG image</a></li>
|
||||
<li><a href="text">Plain text</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h2>Currently Implemented</h2>
|
||||
<ul>
|
||||
<li>Basic <a href='http://www.w3.org/TR/html401/'>HTML 4</a>, including
|
||||
tables</li>
|
||||
<li>Parts of <a href='http://www.w3.org/TR/REC-CSS2/'>CSS</a> (display,
|
||||
text-align, float, width & height)</li>
|
||||
<li>Local and
|
||||
<a href='http://www.w3.org/Protocols/rfc2616/rfc2616.html'>HTTP</a>
|
||||
fetching</li>
|
||||
<li>Memory cache</li>
|
||||
</ul>
|
||||
|
||||
<h2>In Progress</h2>
|
||||
<ul>
|
||||
<li>Improved memory handling (currently exits when memory is exhausted)</li>
|
||||
<li>Forms (display but don't submit)</li>
|
||||
<li>Images (stand-alone JPEGs so far)</li>
|
||||
<li>External CSS files</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>Links</h2>
|
||||
<ul>
|
||||
<li><a href="http://sourceforge.net/projects/netsurf/">SourceForge development
|
||||
area</a></li>
|
||||
<li><a href="http://netsurf.strcprstskrzkrk.co.uk/">Latest builds</a></li>
|
||||
<li><a href="http://cvs.semichrome.net/netsurf/">Browse CVS</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Mailing List</h2>
|
||||
<p>There is a <a href="http://sourceforge.net/mail/?group_id=51719">mailing
|
||||
list</a> where you can discuss development (from a user's
|
||||
perspective as well as a programmer's) or point out any bugs you have
|
||||
spotted.</p>
|
||||
|
||||
<h2>Libraries</h2>
|
||||
<p>NetSurf currently uses the following libraries:</p>
|
||||
<table>
|
||||
<tr><td><a href='http://xmlsoft.org/'>libxml</a></td>
|
||||
<td>(XML and HTML parser)</td></tr>
|
||||
<tr><td><a href='http://curl.haxx.se/libcurl/'>libcurl</a></td>
|
||||
<td>(HTTP, etc.)</td></tr>
|
||||
<tr><td><a href='http://ro-oslib.sourceforge.net/'>OSLib</a></td>
|
||||
<td>(C interface to RISC OS SWIs)</td>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,30 +0,0 @@
|
||||
<html>
|
||||
<head><title>Welcome to NetSurf</title></head>
|
||||
<body>
|
||||
<p> </p>
|
||||
<center><h1 style="color: #f00">NetSurf - the RISC OS web browser</h1></center>
|
||||
<p> </p>
|
||||
<p><i style="color: #f00">NetSurf</i> is a new web browser for computers running <i>RISC OS</i>.
|
||||
This welcome page needs more work. In the mean time, why not visit the <a href="http://sourceforge.net/projects/netsurf/">SourceForge development area</a>?</p>
|
||||
<p>To use <i>NetSurf</i>, type in a http:// or file:/ URL at the top of the window, then hit Return. Drag with Select or Adjust to highlight text; clicking Select clears any current selection. Click on a link with Select to follow it, or with Adjust to open it in a new window. Links are currently shown in bold and italic rather than the traditional underlined blue.</p>
|
||||
<p>You can now quit <i>NetSurf</i> using the icon bar menu.</p>
|
||||
<p> </p>
|
||||
<table>
|
||||
<tr><td width=50%>
|
||||
<h2>Mailing list</h2>
|
||||
<p>There is a mailing list where you can discuss development (from a user's perspective as well as a programmer's) or point out any bugs you have spotted.</p>
|
||||
<p>To subscribe, send a message to <a href="mailto:netsurf-develop-request@lists.sourceforge.net">netsurf-develop-request@lists.sourceforge.net</a> with the subject <i>subscribe password</i>, replacing <i>password</i> with an identification of your choice. (The password is only used for subsequently configuring your account; it is not secure).</p>
|
||||
</td><td width=50%>
|
||||
<h2>Test pages</h2>
|
||||
<p><a href="http://www.jpeg.org/images/public_01.jpg">Test JPEG image</a></p>
|
||||
<p><a href="http://www.alanwood.net/unicode/latin_extended_a.html">Test for Unicode support</a></p>
|
||||
<p> </p>
|
||||
<h2>Known bugs</h2>
|
||||
<p>Please see the <a href="bugs.html">known bugs page</a>.</p>
|
||||
<p> </p>
|
||||
<h2>Contacting the developers</h2>
|
||||
<p>Details are available from the <a href="http://sourceforge.net/projects/netsurf/">development area</a>.
|
||||
</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
BIN
!NetSurf/Resources/jpeg,c85
Normal file
BIN
!NetSurf/Resources/jpeg,c85
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.7 KiB |
23
!NetSurf/Resources/test1,faf
Normal file
23
!NetSurf/Resources/test1,faf
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head><title>Test 1</title></head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Heading 1</h1>
|
||||
<h2>Heading 2</h2>
|
||||
<h3>Heading 3</h3>
|
||||
<h4>Heading 4</h4>
|
||||
<h5>Heading 5</h5>
|
||||
<h6>Heading 6</h6>
|
||||
|
||||
<p style='text-align: left'>Left aligned paragraph. Left aligned paragraph. Left aligned paragraph. Left aligned paragraph. Left aligned paragraph. Left aligned paragraph. Left aligned paragraph. Left aligned paragraph. Left aligned paragraph. Left aligned paragraph.</p>
|
||||
|
||||
<p style='text-align: center'>Centered paragraph. Centered paragraph. Centered paragraph. Centered paragraph. Centered paragraph. Centered paragraph. Centered paragraph. Centered paragraph. Centered paragraph.</p>
|
||||
|
||||
<p style='text-align: right'>Right aligned paragraph. Right aligned paragraph. Right aligned paragraph. Right aligned paragraph. Right aligned paragraph. Right aligned paragraph. Right aligned paragraph. Right aligned paragraph. Right aligned paragraph. Right aligned paragraph.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
1
!NetSurf/Resources/text
Normal file
1
!NetSurf/Resources/text
Normal file
@ -0,0 +1 @@
|
||||
This is a plain text file.
|
@ -1,8 +1,9 @@
|
||||
/**
|
||||
* $Id: fetch.c,v 1.2 2003/02/25 21:00:27 bursa Exp $
|
||||
* $Id: fetch.c,v 1.3 2003/03/15 15:53:20 bursa Exp $
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "curl/curl.h"
|
||||
#include "netsurf/content/fetch.h"
|
||||
@ -112,13 +113,6 @@ struct fetch * fetch_start(char *url, char *referer,
|
||||
codem = curl_multi_add_handle(curl_multi, fetch->curl_handle);
|
||||
assert(codem == CURLM_OK || codem == CURLM_CALL_MULTI_PERFORM);
|
||||
|
||||
/* do any possible work on the fetch */
|
||||
while (codem == CURLM_CALL_MULTI_PERFORM) {
|
||||
int running;
|
||||
codem = curl_multi_perform(curl_multi, &running);
|
||||
assert(codem == CURLM_OK || codem == CURLM_CALL_MULTI_PERFORM);
|
||||
}
|
||||
|
||||
return fetch;
|
||||
}
|
||||
|
||||
@ -212,14 +206,21 @@ size_t fetch_curl_data(void * data, size_t size, size_t nmemb, struct fetch *f)
|
||||
|
||||
if (!f->had_headers) {
|
||||
/* find the content type and inform the caller */
|
||||
char *type;
|
||||
const char *type;
|
||||
CURLcode code;
|
||||
|
||||
code = curl_easy_getinfo(f->curl_handle, CURLINFO_CONTENT_TYPE, &type);
|
||||
assert(code == CURLE_OK);
|
||||
|
||||
if (type == 0)
|
||||
type = "text/html"; /* TODO: find type of file: urls */
|
||||
if (type == 0) {
|
||||
type = "text/html";
|
||||
if (strncmp(f->url, "file:///", 8) == 0) {
|
||||
char *url_path;
|
||||
url_path = curl_unescape(f->url + 8, (int) strlen(f->url) - 8);
|
||||
type = fetch_filetype(url_path);
|
||||
free(url_path);
|
||||
}
|
||||
}
|
||||
|
||||
LOG(("FETCH_TYPE, '%s'", type));
|
||||
f->callback(FETCH_TYPE, f->p, type, 0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* $Id: fetch.h,v 1.1 2003/02/09 12:58:14 bursa Exp $
|
||||
* $Id: fetch.h,v 1.2 2003/03/15 15:53:20 bursa Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETSURF_DESKTOP_FETCH_H_
|
||||
@ -16,5 +16,6 @@ struct fetch * fetch_start(char *url, char *referer,
|
||||
void fetch_abort(struct fetch *f);
|
||||
void fetch_poll(void);
|
||||
void fetch_quit(void);
|
||||
const char *fetch_filetype(const char *unix_path);
|
||||
|
||||
#endif
|
||||
|
4
makefile
4
makefile
@ -1,4 +1,4 @@
|
||||
# $Id: makefile,v 1.14 2003/02/25 21:00:27 bursa Exp $
|
||||
# $Id: makefile,v 1.15 2003/03/15 15:53:20 bursa Exp $
|
||||
|
||||
all: !NetSurf/!RunImage,ff8
|
||||
clean:
|
||||
@ -24,7 +24,7 @@ OBJECTS = \
|
||||
render/arm-riscos-aof/layout.o render/arm-riscos-aof/textplain.o \
|
||||
riscos/arm-riscos-aof/font.o riscos/arm-riscos-aof/gui.o \
|
||||
riscos/arm-riscos-aof/theme.o riscos/arm-riscos-aof/jpeg.o \
|
||||
utils/arm-riscos-aof/utils.o
|
||||
riscos/arm-riscos-aof/filetype.o utils/arm-riscos-aof/utils.o
|
||||
HEADERS = \
|
||||
content/cache.h content/content.h content/fetch.h content/fetchcache.h \
|
||||
desktop/browser.h desktop/gui.h desktop/netsurf.h render/box.h \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* $Id: textplain.c,v 1.2 2003/02/25 21:00:27 bursa Exp $
|
||||
* $Id: textplain.c,v 1.3 2003/03/15 15:53:20 bursa Exp $
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
@ -8,6 +8,7 @@
|
||||
#include "libxml/HTMLparser.h"
|
||||
#include "netsurf/render/html.h"
|
||||
#include "netsurf/render/textplain.h"
|
||||
#include "netsurf/utils/log.h"
|
||||
|
||||
|
||||
static const char header[] = "<html><body><pre>";
|
||||
@ -17,7 +18,7 @@ static const char footer[] = "</pre></body></html>";
|
||||
void textplain_create(struct content *c)
|
||||
{
|
||||
html_create(c);
|
||||
htmlParseChunk(c->data.html.parser, header, sizeof(header), 0);
|
||||
htmlParseChunk(c->data.html.parser, header, sizeof(header) - 1, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -29,7 +30,7 @@ void textplain_process_data(struct content *c, char *data, unsigned long size)
|
||||
|
||||
int textplain_convert(struct content *c, unsigned int width, unsigned int height)
|
||||
{
|
||||
htmlParseChunk(c->data.html.parser, footer, sizeof(footer), 0);
|
||||
htmlParseChunk(c->data.html.parser, footer, sizeof(footer) - 1, 0);
|
||||
c->type = CONTENT_HTML;
|
||||
return html_convert(c, width, height);
|
||||
}
|
||||
|
72
riscos/filetype.c
Normal file
72
riscos/filetype.c
Normal file
@ -0,0 +1,72 @@
|
||||
/**
|
||||
* $Id: filetype.c,v 1.1 2003/03/15 15:53:20 bursa Exp $
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unixlib/local.h>
|
||||
#include "oslib/osfile.h"
|
||||
#include "netsurf/content/fetch.h"
|
||||
#include "netsurf/utils/log.h"
|
||||
#include "netsurf/utils/utils.h"
|
||||
|
||||
/* type_map must be in sorted order by file_type */
|
||||
struct type_entry {
|
||||
bits file_type;
|
||||
char mime_type[16];
|
||||
};
|
||||
static const struct type_entry type_map[] = {
|
||||
{0xc85, "image/jpeg"},
|
||||
{0xfaf, "text/html"},
|
||||
{0xfff, "text/plain"},
|
||||
};
|
||||
#define TYPE_MAP_COUNT (sizeof(type_map) / sizeof(type_map[0]))
|
||||
|
||||
|
||||
static int cmp_type(const void *x, const void *y);
|
||||
|
||||
|
||||
/**
|
||||
* filetype -- determine the MIME type of a local file
|
||||
*/
|
||||
|
||||
const char *fetch_filetype(const char *unix_path)
|
||||
{
|
||||
struct type_entry *t;
|
||||
unsigned int len = strlen(unix_path) + 100;
|
||||
char *path = xcalloc(len, 1);
|
||||
char *r;
|
||||
os_error *error;
|
||||
bits file_type;
|
||||
|
||||
LOG(("unix_path = '%s'", unix_path));
|
||||
|
||||
/* convert path to RISC OS format and read file type */
|
||||
r = __riscosify(unix_path, 0, 0, path, len, 0);
|
||||
if (r == 0) {
|
||||
LOG(("__riscosify failed"));
|
||||
return "application/riscos";
|
||||
}
|
||||
LOG(("riscos path '%s'", path));
|
||||
|
||||
error = xosfile_read_stamped_no_path(path, 0, 0, 0, 0, 0, &file_type);
|
||||
if (error != 0) {
|
||||
LOG(("xosfile_read_stamped_no_path failed: %s", error->errmess));
|
||||
return "application/riscos";
|
||||
}
|
||||
|
||||
/* search for MIME type */
|
||||
t = bsearch(&file_type, type_map, TYPE_MAP_COUNT, sizeof(type_map[0]), cmp_type);
|
||||
if (t == 0)
|
||||
return "application/riscos";
|
||||
LOG(("mime type '%s'", t->mime_type));
|
||||
return t->mime_type;
|
||||
}
|
||||
|
||||
|
||||
int cmp_type(const void *x, const void *y)
|
||||
{
|
||||
const bits *p = x;
|
||||
const struct type_entry *q = y;
|
||||
return *p < q->file_type ? -1 : (*p == q->file_type ? 0 : +1);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* $Id: gui.c,v 1.21 2003/03/08 20:26:31 bursa Exp $
|
||||
* $Id: gui.c,v 1.22 2003/03/15 15:53:20 bursa Exp $
|
||||
*/
|
||||
|
||||
#include "netsurf/riscos/font.h"
|
||||
@ -23,7 +23,7 @@
|
||||
int gadget_subtract_x;
|
||||
int gadget_subtract_y;
|
||||
#define browser_menu_flags (wimp_ICON_TEXT | wimp_ICON_FILLED | (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) | (wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT))
|
||||
const char* HOME_URL = "file:///%3CNetSurf$Dir%3E/Resources/intro.html\0";
|
||||
const char* HOME_URL = "file:///%3CNetSurf$Dir%3E/Resources/intro";
|
||||
|
||||
wimp_MENU(2) netsurf_iconbar_menu =
|
||||
{
|
||||
@ -1085,7 +1085,8 @@ void gui_init(int argc, char** argv)
|
||||
void ro_gui_throb(void)
|
||||
{
|
||||
gui_window* g = netsurf_gui_windows;
|
||||
float nowtime = (float) (clock() + 0) / CLOCKS_PER_SEC; /* workaround compiler warning */
|
||||
//float nowtime = (float) (clock() + 0) / CLOCKS_PER_SEC; /* workaround compiler warning */
|
||||
float nowtime = (float) clock() / CLOCKS_PER_SEC;
|
||||
|
||||
while (g != NULL)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user