NetSurf
Data Structures | Functions | Variables
data.c File Reference

data scheme handling. More...

#include <stdbool.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <libwapcaplet/libwapcaplet.h>
#include <nsutils/base64.h>
#include "netsurf/inttypes.h"
#include "utils/url.h"
#include "utils/nsurl.h"
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/ring.h"
#include "content/fetch.h"
#include "content/fetchers.h"
#include "content/fetchers/data.h"
Include dependency graph for data.c:

Go to the source code of this file.

Data Structures

struct  fetch_data_context
 

Functions

static bool fetch_data_initialise (lwc_string *scheme)
 
static void fetch_data_finalise (lwc_string *scheme)
 
static bool fetch_data_can_fetch (const nsurl *url)
 
static void fetch_data_send_callback (const fetch_msg *msg, struct fetch_data_context *c)
 
static void fetch_data_send_header (struct fetch_data_context *ctx, const char *fmt,...)
 
static void * fetch_data_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)
 
static bool fetch_data_start (void *ctx)
 
static void fetch_data_free (void *ctx)
 
static void fetch_data_abort (void *ctx)
 
static bool fetch_data_process (struct fetch_data_context *c)
 
static void fetch_data_poll (lwc_string *scheme)
 
nserror fetch_data_register (void)
 Register data scheme handler. More...
 

Variables

static struct fetch_data_contextring = NULL
 

Detailed Description

data scheme handling.

See http://tools.ietf.org/html/rfc2397

Definition in file data.c.

Function Documentation

◆ fetch_data_abort()

static void fetch_data_abort ( void *  ctx)
static

Definition at line 141 of file data.c.

References fetch_data_context::aborted.

Referenced by fetch_data_register().

Here is the caller graph for this function:

◆ fetch_data_can_fetch()

static bool fetch_data_can_fetch ( const nsurl url)
static

Definition at line 73 of file data.c.

Referenced by fetch_data_register().

Here is the caller graph for this function:

◆ fetch_data_finalise()

static void fetch_data_finalise ( lwc_string *  scheme)
static

Definition at line 67 of file data.c.

References NSLOG.

Referenced by fetch_data_register().

Here is the caller graph for this function:

◆ fetch_data_free()

static void fetch_data_free ( void *  ctx)
static

Definition at line 131 of file data.c.

References fetch_data_context::data, fetch_data_context::mimetype, nsurl_unref(), and fetch_data_context::url.

Referenced by fetch_data_register().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_data_initialise()

static bool fetch_data_initialise ( lwc_string *  scheme)
static

Definition at line 59 of file data.c.

References NSLOG.

Referenced by fetch_data_register().

Here is the caller graph for this function:

◆ fetch_data_poll()

static void fetch_data_poll ( lwc_string *  scheme)
static

Definition at line 244 of file data.c.

References fetch_data_context::aborted, fetch_msg::buf, fetch_msg::data, fetch_data_context::data, fetch_data_context::datalen, FETCH_DATA, fetch_data_process(), fetch_data_send_callback(), fetch_data_send_header(), FETCH_FINISHED, fetch_free(), fetch_remove_from_queues(), fetch_set_http_code(), fetch_msg::header_or_data, fetch_msg::len, fetch_data_context::locked, fetch_data_context::mimetype, NSLOG, nsurl_access(), fetch_data_context::parent_fetch, PRIsizet, ring, RING_INSERT, RING_REMOVE, fetch_msg::type, and fetch_data_context::url.

Referenced by fetch_data_register().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_data_process()

static bool fetch_data_process ( struct fetch_data_context c)
static

Definition at line 152 of file data.c.

References fetch_data_context::base64, fetch_msg::data, fetch_data_context::data, fetch_data_context::datalen, fetch_msg::error, fetch_data_send_callback(), FETCH_ERROR, fetch_data_context::mimetype, NSERROR_OK, NSLOG, nsurl_access(), nsurl_length(), SLEN, strndup(), fetch_msg::type, fetch_data_context::url, and url_unescape().

Referenced by fetch_data_poll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_data_register()

nserror fetch_data_register ( void  )

Register data scheme handler.

Returns
NSERROR_OK on successful registration or error code on failure.

Definition at line 324 of file data.c.

References fetch_data_abort(), fetch_data_can_fetch(), fetch_data_finalise(), fetch_data_free(), fetch_data_initialise(), fetch_data_poll(), fetch_data_setup(), fetch_data_start(), fetcher_add(), and fetcher_operation_table::initialise.

Referenced by fetcher_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_data_send_callback()

static void fetch_data_send_callback ( const fetch_msg msg,
struct fetch_data_context c 
)
static

Definition at line 78 of file data.c.

References fetch_send_callback(), fetch_data_context::locked, and fetch_data_context::parent_fetch.

Referenced by fetch_data_poll(), fetch_data_process(), and fetch_data_send_header().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_data_send_header()

static void fetch_data_send_header ( struct fetch_data_context ctx,
const char *  fmt,
  ... 
)
static

Definition at line 86 of file data.c.

References fetch_msg::buf, fetch_msg::data, fetch_data_send_callback(), FETCH_HEADER, fetch_msg::header_or_data, fetch_msg::len, and fetch_msg::type.

Referenced by fetch_data_poll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_data_setup()

static void * fetch_data_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 
)
static

Definition at line 108 of file data.c.

References nsurl_ref(), fetch_data_context::parent_fetch, ring, RING_INSERT, and fetch_data_context::url.

Referenced by fetch_data_register().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_data_start()

static bool fetch_data_start ( void *  ctx)
static

Definition at line 126 of file data.c.

Referenced by fetch_data_register().

Here is the caller graph for this function:

Variable Documentation

◆ ring

struct fetch_data_context* ring = NULL
static

Definition at line 57 of file data.c.

Referenced by fetch_data_poll(), and fetch_data_setup().