NetSurf
Data Structures | Typedefs | Functions | Variables
css_fetcher.c File Reference

HTML fetcher for CSS objects. More...

#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <dom/dom.h>
#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/inttypes.h"
#include "utils/config.h"
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/ring.h"
#include "utils/nsurl.h"
#include "utils/utils.h"
#include "content/fetch.h"
#include "content/fetchers.h"
#include "html/private.h"
Include dependency graph for css_fetcher.c:

Go to the source code of this file.

Data Structures

struct  html_css_fetcher_item
 
struct  html_css_fetcher_context
 

Typedefs

typedef struct html_css_fetcher_item html_css_fetcher_item
 
typedef struct html_css_fetcher_context html_css_fetcher_context
 

Functions

static bool html_css_fetcher_initialise (lwc_string *scheme)
 
static void html_css_fetcher_finalise (lwc_string *scheme)
 
static bool html_css_fetcher_can_fetch (const nsurl *url)
 
static void * html_css_fetcher_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 html_css_fetcher_start (void *ctx)
 
static void html_css_fetcher_free (void *ctx)
 
static void html_css_fetcher_abort (void *ctx)
 
static void html_css_fetcher_send_callback (const fetch_msg *msg, html_css_fetcher_context *c)
 
static void html_css_fetcher_poll (lwc_string *scheme)
 
nserror html_css_fetcher_register (void)
 Register the fetcher for the pseudo x-ns-css scheme. More...
 
nserror html_css_fetcher_add_item (dom_string *data, nsurl *base_url, uint32_t *key)
 

Variables

static uint32_t current_key = 0
 
static html_css_fetcher_itemitems = NULL
 
static html_css_fetcher_contextring = NULL
 

Detailed Description

HTML fetcher for CSS objects.

Definition in file css_fetcher.c.

Typedef Documentation

◆ html_css_fetcher_context

◆ html_css_fetcher_item

Function Documentation

◆ html_css_fetcher_abort()

static void html_css_fetcher_abort ( void *  ctx)
static

Definition at line 164 of file css_fetcher.c.

References html_css_fetcher_context::aborted.

Referenced by html_css_fetcher_register().

Here is the caller graph for this function:

◆ html_css_fetcher_add_item()

nserror html_css_fetcher_add_item ( dom_string *  data,
nsurl base_url,
uint32_t *  key 
)

Definition at line 305 of file css_fetcher.c.

References html_css_fetcher_item::base_url, current_key, html_css_fetcher_item::data, items, html_css_fetcher_item::key, NSERROR_NOMEM, NSERROR_OK, nsurl_ref(), and RING_INSERT.

Referenced by html_stylesheet_from_domnode().

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

◆ html_css_fetcher_can_fetch()

static bool html_css_fetcher_can_fetch ( const nsurl url)
static

Definition at line 81 of file css_fetcher.c.

Referenced by html_css_fetcher_register().

Here is the caller graph for this function:

◆ html_css_fetcher_finalise()

static void html_css_fetcher_finalise ( lwc_string *  scheme)
static

Definition at line 75 of file css_fetcher.c.

References NSLOG.

Referenced by html_css_fetcher_register().

Here is the caller graph for this function:

◆ html_css_fetcher_free()

static void html_css_fetcher_free ( void *  ctx)
static

Definition at line 149 of file css_fetcher.c.

References html_css_fetcher_item::base_url, html_css_fetcher_item::data, html_css_fetcher_context::item, items, nsurl_unref(), ring, RING_REMOVE, and html_css_fetcher_context::url.

Referenced by html_css_fetcher_register().

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

◆ html_css_fetcher_initialise()

static bool html_css_fetcher_initialise ( lwc_string *  scheme)
static

Definition at line 68 of file css_fetcher.c.

References NSLOG.

Referenced by html_css_fetcher_register().

Here is the caller graph for this function:

◆ html_css_fetcher_poll()

static void html_css_fetcher_poll ( lwc_string *  scheme)
static

Definition at line 183 of file css_fetcher.c.

References html_css_fetcher_context::aborted, html_css_fetcher_item::base_url, fetch_msg::buf, fetch_msg::data, html_css_fetcher_item::data, FETCH_DATA, FETCH_FINISHED, fetch_free(), FETCH_HEADER, fetch_remove_from_queues(), fetch_set_http_code(), fetch_msg::header_or_data, html_css_fetcher_send_callback(), html_css_fetcher_context::item, fetch_msg::len, html_css_fetcher_context::locked, NSLOG, nsurl_access(), nsurl_length(), html_css_fetcher_context::parent_fetch, PRIsizet, html_css_fetcher_context::r_next, ring, fetch_msg::type, and html_css_fetcher_context::url.

Referenced by html_css_fetcher_register().

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

◆ html_css_fetcher_register()

nserror html_css_fetcher_register ( void  )

Register the fetcher for the pseudo x-ns-css scheme.

Returns
NSERROR_OK on successful registration or error code on failure.

Definition at line 286 of file css_fetcher.c.

References fetcher_add(), html_css_fetcher_abort(), html_css_fetcher_can_fetch(), html_css_fetcher_finalise(), html_css_fetcher_free(), html_css_fetcher_initialise(), html_css_fetcher_poll(), html_css_fetcher_setup(), html_css_fetcher_start(), and fetcher_operation_table::initialise.

Referenced by html_css_init().

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

◆ html_css_fetcher_send_callback()

static void html_css_fetcher_send_callback ( const fetch_msg msg,
html_css_fetcher_context c 
)
static

Definition at line 175 of file css_fetcher.c.

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

Referenced by html_css_fetcher_poll().

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

◆ html_css_fetcher_setup()

static void * html_css_fetcher_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 86 of file css_fetcher.c.

References html_css_fetcher_context::item, items, html_css_fetcher_item::key, nsurl_get_component(), NSURL_PATH, nsurl_ref(), html_css_fetcher_context::parent_fetch, path(), html_css_fetcher_item::r_next, ring, RING_INSERT, and html_css_fetcher_context::url.

Referenced by html_css_fetcher_register().

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

◆ html_css_fetcher_start()

static bool html_css_fetcher_start ( void *  ctx)
static

Definition at line 144 of file css_fetcher.c.

Referenced by html_css_fetcher_register().

Here is the caller graph for this function:

Variable Documentation

◆ current_key

uint32_t current_key = 0
static

Definition at line 64 of file css_fetcher.c.

Referenced by html_css_fetcher_add_item().

◆ items

html_css_fetcher_item* items = NULL
static

◆ ring

html_css_fetcher_context* ring = NULL
static