22#define __STDBOOL_H__ 1
30#include <sys/select.h>
32#include <sys/utsname.h>
36#include <libwapcaplet/libwapcaplet.h>
74 NSLOG(netsurf, INFO,
"fetch_rsrc_initialise called for %s",
75 lwc_string_data(scheme));
81 NSLOG(netsurf, INFO,
"fetch_rsrc_finalise called for %s",
82 lwc_string_data(scheme));
91 bool only_2xx,
bool downgrade_tls,
const char *post_urlenc,
105 if (ctx->
url == NULL) {
167 NSLOG(netsurf, INFO,
"*** Processing %s", c->
url);
169 if (strlen(c->
url) < 7) {
178 params = c->
url +
sizeof(
"rsrc://") - 1;
181 if ( (slash = strchr(params,
'/')) == NULL) {
190 c->
name = strdup(slash + 1);
195 "Unable to allocate memory for mimetype in rsrc: URL";
200 if (params[0] !=
'/') {
201 uint8 c1, c2, c3, c4;
202 if (sscanf(params,
"%c%c%c%c", &c1, &c2, &c3, &c4) > 3) {
203 type = c1 << 24 | c2 << 16 | c3 << 8 | c4;
204 NSLOG(netsurf, INFO,
"fetch_rsrc: type:%4.4s\n",
209 NSLOG(netsurf, INFO,
"fetch_rsrc: 0x%08lx, %ld, '%s'\n",
type,
id,
218 BString error(
"Cannot locate resource: ");
238 msg.
data.
error =
"Cannot load rsrc: URL";
245 if (c->
data == NULL) {
247 msg.
data.
error =
"Unable to allocate memory for rsrc: URL";
261 if (
ring == NULL)
return;
286 "setting rsrc: MIME type to %s, length to %zd",
293 snprintf(header,
sizeof header,
"Content-Type: %s",
300 snprintf(header,
sizeof header,
"Content-Length: %zd",
318 NSLOG(netsurf, INFO,
"Processing of %s failed!",
324 assert(c->
locked ==
false);
333 }
while ( (c = next) !=
ring &&
ring != NULL);
342 char path[B_PATH_NAME_LENGTH];
347 BFile file(
path, B_READ_ONLY);
348 if (file.InitCheck() < 0)
349 return file.InitCheck();
390 if (lwc_intern_string(
"rsrc",
SLEN(
"rsrc"), &scheme) != lwc_error_ok) {
391 die(
"Failed to initialise the fetch module "
392 "(couldn't intern \"rsrc\").");
397 die(
"unable to add rsrc fetcher.");
const char * fetch_filetype(const char *unix_path)
Determine the MIME type of a local file.
void die(const char *error)
Cause an abnormal program termination.
void fetch_set_http_code(struct fetch *fetch, long http_code)
set the http code of a fetch
nserror fetcher_add(lwc_string *scheme, const struct fetcher_operation_table *ops)
Register a fetcher for a scheme.
void fetch_send_callback(const fetch_msg *msg, struct fetch *fetch)
send message to fetch
void fetch_free(struct fetch *f)
Free a fetch structure and associated resources.
void fetch_remove_from_queues(struct fetch *fetch)
remove a queued fetch
Fetching of data from a URL (interface).
nserror
Enumeration of error codes.
BResources * gAppResources
static void fetch_rsrc_finalise(lwc_string *scheme)
static int find_app_resources()
static void fetch_rsrc_free(void *ctx)
static bool fetch_rsrc_process(struct fetch_rsrc_context *c)
static void fetch_rsrc_poll(lwc_string *scheme)
static bool fetch_rsrc_start(void *ctx)
static void fetch_rsrc_send_callback(const fetch_msg *msg, struct fetch_rsrc_context *c)
static struct fetch_rsrc_context * ring
void fetch_rsrc_unregister(void)
void fetch_rsrc_register(void)
static void fetch_rsrc_abort(void *ctx)
static bool fetch_rsrc_can_fetch(const nsurl *url)
BResources * get_app_resources()
static bool fetch_rsrc_initialise(lwc_string *scheme)
static void * fetch_rsrc_setup(struct fetch *parent_fetch, nsurl *url, bool only_2xx, bool downgrade_tls, const char *post_urlenc, const struct fetch_multipart_data *post_multipart, const char **headers)
Interface for fetchers factory.
image_id nsbeos_find_app_path(char *path)
nserror beos_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
#define NSLOG(catname, level, logmsg, args...)
Localised message support (interface).
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
size_t nsurl_length(const nsurl *url)
Find the length of a NetSurf URL object's URL, as returned by nsurl_access.
struct nsurl nsurl
NetSurf URL object.
#define RING_REMOVE(ring, element)
Remove the given element from the specified ring.
#define RING_INSERT(ring, element)
Insert the given item into the specified ring.
Interface to utility string handling.
struct fetch_msg::@118::@119 header_or_data
union fetch_msg::@118 data
Fetch POST multipart data.
struct fetch_rsrc_context * r_next
struct fetch_rsrc_context * r_prev
struct fetch * parent_fetch
Information for a single fetch.
Interface to time operations.
Option reading and saving interface.
Interface to a number of general purpose functionality.
#define SLEN(x)
Calculate length of constant C string.
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.