NetSurf
|
URL handling for the "about" scheme. More...
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include "netsurf/inttypes.h"
#include "netsurf/plot_style.h"
#include "utils/log.h"
#include "testament.h"
#include "utils/corestrings.h"
#include "utils/nscolour.h"
#include "utils/nsoption.h"
#include "utils/utils.h"
#include "utils/messages.h"
#include "utils/ring.h"
#include "content/fetch.h"
#include "content/fetchers.h"
#include "content/fetchers/about.h"
#include "image/image_cache.h"
#include "desktop/system_colour.h"
Go to the source code of this file.
Data Structures | |
struct | fetch_about_context |
Context for an about fetch. More... | |
struct | about_handlers |
handler info for about scheme More... | |
struct | ns_cert_name |
certificate name parameters More... | |
struct | ns_cert_pkey |
Certificate public key parameters. More... | |
struct | ns_cert_san |
Certificate subject alternative name. More... | |
struct | ns_cert_info |
certificate information for certificate chain More... | |
struct | modification_t |
Macros | |
#define | about_handler_list_len (sizeof(about_handler_list) / sizeof(struct about_handlers)) |
Typedefs | |
typedef bool(* | fetch_about_handler) (struct fetch_about_context *) |
Functions | |
static bool | fetch_about_send_callback (const fetch_msg *msg, struct fetch_about_context *ctx) |
issue fetch callbacks with locking More... | |
static bool | fetch_about_send_finished (struct fetch_about_context *ctx) |
static bool | fetch_about_send_header (struct fetch_about_context *ctx, const char *fmt,...) |
static nserror | ssenddataf (struct fetch_about_context *ctx, const char *fmt,...) |
send formatted data on a fetch More... | |
static bool | fetch_about_srverror (struct fetch_about_context *ctx) |
Generate a 500 server error respnse. More... | |
static bool | fetch_about_blank_handler (struct fetch_about_context *ctx) |
Handler to generate about scheme cache page. More... | |
static bool | fetch_about_credits_handler (struct fetch_about_context *ctx) |
Handler to generate about scheme credits page. More... | |
static bool | fetch_about_licence_handler (struct fetch_about_context *ctx) |
Handler to generate about scheme licence page. More... | |
static bool | fetch_about_imagecache_handler (struct fetch_about_context *ctx) |
Handler to generate about:imagecache page. More... | |
static nserror | free_ns_cert_info (struct ns_cert_info *cinfo) |
free all resources associated with a certificate information structure More... | |
static nserror | convert_chain_to_cert_info (const struct cert_chain *chain, struct ns_cert_info **cert_info_out) |
static nserror | format_certificate_name (struct fetch_about_context *ctx, struct ns_cert_name *cert_name) |
static nserror | format_certificate_san (struct fetch_about_context *ctx, struct ns_cert_san *san) |
output formatted certificate subject alternate names More... | |
static nserror | format_certificate_public_key (struct fetch_about_context *ctx, struct ns_cert_pkey *public_key) |
static nserror | format_certificate_fingerprint (struct fetch_about_context *ctx, struct ns_cert_info *cert_info) |
static nserror | format_certificate (struct fetch_about_context *ctx, struct ns_cert_info *cert_info, size_t depth) |
static bool | fetch_about_certificate_handler (struct fetch_about_context *ctx) |
Handler to generate about:certificate page. More... | |
static bool | fetch_about_config_handler (struct fetch_about_context *ctx) |
Handler to generate about scheme config page. More... | |
static bool | fetch_about_nscolours_handler (struct fetch_about_context *ctx) |
Handler to generate the nscolours stylesheet. More... | |
static bool | fetch_about_choices_handler (struct fetch_about_context *ctx) |
Generate the text of a Choices file which represents the current in use options. More... | |
static bool | fetch_about_testament_handler (struct fetch_about_context *ctx) |
Generate the text of an svn testament which represents the current build-tree status. More... | |
static bool | fetch_about_logo_handler (struct fetch_about_context *ctx) |
Handler to generate about scheme logo page. More... | |
static bool | fetch_about_welcome_handler (struct fetch_about_context *ctx) |
Handler to generate about scheme welcome page. More... | |
static nserror | get_authentication_description (struct nsurl *url, const char *realm, const char *username, const char *password, char **out_str) |
generate the description of the login query More... | |
static nserror | get_query_description (struct nsurl *url, const char *key, char **out_str) |
generate a generic query description More... | |
static bool | fetch_about_query_auth_handler (struct fetch_about_context *ctx) |
Handler to generate about scheme authentication query page. More... | |
static bool | fetch_about_query_privacy_handler (struct fetch_about_context *ctx) |
Handler to generate about scheme privacy query page. More... | |
static bool | fetch_about_query_timeout_handler (struct fetch_about_context *ctx) |
Handler to generate about scheme timeout query page. More... | |
static bool | fetch_about_query_fetcherror_handler (struct fetch_about_context *ctx) |
Handler to generate about scheme fetch error query page. More... | |
static bool | fetch_about_about_handler (struct fetch_about_context *ctx) |
List all the valid about: paths available. More... | |
static bool | fetch_about_404_handler (struct fetch_about_context *ctx) |
static bool | fetch_about_initialise (lwc_string *scheme) |
callback to initialise the about scheme fetcher. More... | |
static void | fetch_about_finalise (lwc_string *scheme) |
callback to finalise the about scheme fetcher. More... | |
static bool | fetch_about_can_fetch (const nsurl *url) |
static void * | fetch_about_setup (struct fetch *fetchh, nsurl *url, bool only_2xx, bool downgrade_tls, const char *post_urlenc, const struct fetch_multipart_data *post_multipart, const char **headers) |
callback to set up a about scheme fetch. More... | |
static void | fetch_about_free (void *ctx) |
callback to free a about scheme fetch More... | |
static bool | fetch_about_start (void *ctx) |
callback to start an about scheme fetch More... | |
static void | fetch_about_abort (void *ctx) |
callback to abort a about fetch More... | |
static void | fetch_about_poll (lwc_string *scheme) |
callback to poll for additional about fetch contents More... | |
nserror | fetch_about_register (void) |
Register about scheme handler. More... | |
Variables | |
static struct fetch_about_context * | ring = NULL |
struct about_handlers | about_handler_list [] |
List of about paths and their handlers. More... | |
URL handling for the "about" scheme.
Based on the data fetcher by Rob Kendrick This fetcher provides a simple scheme for the user to access information from the browser from a known, fixed URL.
Definition in file about.c.
#define about_handler_list_len (sizeof(about_handler_list) / sizeof(struct about_handlers)) |
Definition at line 2701 of file about.c.
Referenced by fetch_about_about_handler(), fetch_about_finalise(), fetch_about_initialise(), and fetch_about_setup().
typedef bool(* fetch_about_handler) (struct fetch_about_context *) |
|
static |
Definition at line 1144 of file about.c.
References NSERROR_NOT_IMPLEMENTED.
Referenced by fetch_about_certificate_handler(), and free_ns_cert_info().
|
static |
Definition at line 2764 of file about.c.
References fetch_about_send_finished(), fetch_about_send_header(), fetch_set_http_code(), fetch_about_context::fetchh, NSERROR_OK, nsurl_access(), ssenddataf(), and fetch_about_context::url.
Referenced by fetch_about_poll().
|
static |
callback to abort a about fetch
Definition at line 2903 of file about.c.
References fetch_about_context::aborted.
Referenced by fetch_about_register().
|
static |
List all the valid about: paths available.
ctx | The fetch context. |
Definition at line 2710 of file about.c.
References about_handler_list_len, fetch_about_send_finished(), fetch_about_send_header(), fetch_set_http_code(), fetch_about_context::fetchh, about_handlers::hidden, about_handlers::name, NSERROR_OK, and ssenddataf().
Referenced by fetch_about_query_fetcherror_handler().
|
static |
Handler to generate about scheme cache page.
ctx | The fetcher context. |
Definition at line 217 of file about.c.
References buffer, fetch_msg::data, fetch_about_send_callback(), fetch_about_send_header(), FETCH_DATA, FETCH_FINISHED, fetch_set_http_code(), fetch_about_context::fetchh, fetch_msg::header_or_data, and fetch_msg::type.
|
static |
Definition at line 2822 of file about.c.
Referenced by fetch_about_register().
|
static |
Handler to generate about:certificate page.
Shows details of a certificate chain
ctx | The fetcher context. |
Definition at line 1493 of file about.c.
References cert_chain_free(), cert_chain_from_query(), convert_chain_to_cert_info(), cert_chain::depth, fetch_about_send_finished(), fetch_about_send_header(), fetch_set_http_code(), fetch_about_context::fetchh, format_certificate(), free_ns_cert_info(), NSERROR_OK, PRIsizet, ssenddataf(), ns_cert_info::subject_name, and fetch_about_context::url.
|
static |
Generate the text of a Choices file which represents the current in use options.
ctx | The fetcher context. |
Definition at line 1747 of file about.c.
References buffer, fetch_msg::data, fetch_about_send_callback(), fetch_about_send_finished(), fetch_about_send_header(), FETCH_DATA, fetch_set_http_code(), fetch_about_context::fetchh, fetch_msg::header_or_data, nsoption_snoptionf(), and fetch_msg::type.
|
static |
Handler to generate about scheme config page.
ctx | The fetcher context. |
Definition at line 1599 of file about.c.
References buffer, fetch_msg::data, fetch_about_send_callback(), fetch_about_send_finished(), fetch_about_send_header(), FETCH_DATA, fetch_set_http_code(), fetch_about_context::fetchh, fetch_msg::header_or_data, NSERROR_OK, nsoption_snoptionf(), ssenddataf(), and fetch_msg::type.
|
static |
Handler to generate about scheme credits page.
ctx | The fetcher context. |
Definition at line 253 of file about.c.
References fetch_msg::data, fetch_about_send_callback(), FETCH_REDIRECT, fetch_set_http_code(), fetch_about_context::fetchh, fetch_msg::redirect, and fetch_msg::type.
|
static |
callback to finalise the about scheme fetcher.
Definition at line 2813 of file about.c.
References about_handler_list_len, and about_handlers::lname.
Referenced by fetch_about_register().
|
static |
callback to free a about scheme fetch
Definition at line 2883 of file about.c.
References nsurl_unref(), and fetch_about_context::url.
Referenced by fetch_about_register().
|
static |
Handler to generate about:imagecache page.
Shows details of current image cache.
ctx | The fetcher context. |
Definition at line 299 of file about.c.
References buffer, fetch_msg::data, fetch_about_send_callback(), fetch_about_send_finished(), fetch_about_send_header(), FETCH_DATA, fetch_set_http_code(), fetch_about_context::fetchh, fetch_msg::header_or_data, image_cache_snentryf(), image_cache_snsummaryf(), NSERROR_OK, ssenddataf(), and fetch_msg::type.
|
static |
callback to initialise the about scheme fetcher.
Definition at line 2789 of file about.c.
References about_handler_list_len, about_handlers::lname, about_handlers::name, and about_handlers::name_len.
Referenced by fetch_about_register().
|
static |
Handler to generate about scheme licence page.
ctx | The fetcher context. |
Definition at line 275 of file about.c.
References fetch_msg::data, fetch_about_send_callback(), FETCH_REDIRECT, fetch_set_http_code(), fetch_about_context::fetchh, fetch_msg::redirect, and fetch_msg::type.
|
static |
Handler to generate about scheme logo page.
ctx | The fetcher context. |
Definition at line 1907 of file about.c.
References fetch_msg::data, fetch_about_send_callback(), FETCH_REDIRECT, fetch_set_http_code(), fetch_about_context::fetchh, fetch_msg::redirect, and fetch_msg::type.
|
static |
Handler to generate the nscolours stylesheet.
ctx | The fetcher context. |
Definition at line 1701 of file about.c.
References fetch_about_context::aborted, colour_rb_swap, fetch_about_send_finished(), fetch_about_send_header(), fetch_set_http_code(), fetch_about_context::fetchh, nscolour_get_stylesheet(), NSCOLOUR_WIN_ODD_BG, nscolours, NSERROR_OK, and ssenddataf().
|
static |
callback to poll for additional about fetch contents
Definition at line 2918 of file about.c.
References fetch_about_context::aborted, fetch_about_404_handler(), fetch_free(), fetch_remove_from_queues(), fetch_about_context::fetchh, fetch_about_context::handler, fetch_about_context::locked, ring, RING_INSERT, and RING_REMOVE.
Referenced by fetch_about_register().
|
static |
Handler to generate about scheme authentication query page.
ctx | The fetcher context. |
Definition at line 2027 of file about.c.
References fetch_about_send_finished(), fetch_about_send_header(), fetch_about_srverror(), fetch_set_http_code(), fetch_about_context::fetchh, get_authentication_description(), messages_get(), fetch_about_context::multipart, fetch_multipart_data::name, fetch_multipart_data::next, NSERROR_OK, NSURL_COMPLETE, nsurl_create(), nsurl_get(), nsurl_unref(), ssenddataf(), and fetch_multipart_data::value.
|
static |
Handler to generate about scheme fetch error query page.
ctx | The fetcher context. |
Definition at line 2454 of file about.c.
References fetch_about_about_handler(), fetch_about_send_finished(), fetch_about_send_header(), fetch_about_srverror(), fetch_set_http_code(), fetch_about_context::fetchh, get_query_description(), messages_get(), fetch_about_context::multipart, fetch_multipart_data::name, fetch_multipart_data::next, NSERROR_OK, NSURL_COMPLETE, nsurl_create(), nsurl_get(), nsurl_unref(), ssenddataf(), and fetch_multipart_data::value.
|
static |
Handler to generate about scheme privacy query page.
ctx | The fetcher context. |
Definition at line 2193 of file about.c.
References fetch_about_send_finished(), fetch_about_send_header(), fetch_about_srverror(), fetch_set_http_code(), fetch_about_context::fetchh, get_query_description(), messages_get(), fetch_about_context::multipart, fetch_multipart_data::name, fetch_multipart_data::next, NSERROR_OK, NSURL_COMPLETE, nsurl_create(), nsurl_get(), nsurl_unref(), ssenddataf(), and fetch_multipart_data::value.
|
static |
Handler to generate about scheme timeout query page.
ctx | The fetcher context. |
Definition at line 2331 of file about.c.
References fetch_about_send_finished(), fetch_about_send_header(), fetch_about_srverror(), fetch_set_http_code(), fetch_about_context::fetchh, get_query_description(), messages_get(), fetch_about_context::multipart, fetch_multipart_data::name, fetch_multipart_data::next, NSERROR_OK, NSURL_COMPLETE, nsurl_create(), nsurl_get(), nsurl_unref(), ssenddataf(), and fetch_multipart_data::value.
nserror fetch_about_register | ( | void | ) |
Register about scheme handler.
Definition at line 2961 of file about.c.
References fetch_about_abort(), fetch_about_can_fetch(), fetch_about_finalise(), fetch_about_free(), fetch_about_initialise(), fetch_about_poll(), fetch_about_setup(), fetch_about_start(), fetcher_add(), and fetcher_operation_table::initialise.
Referenced by fetcher_init().
|
inlinestatic |
issue fetch callbacks with locking
Definition at line 93 of file about.c.
References fetch_about_context::aborted, fetch_send_callback(), fetch_about_context::fetchh, and fetch_about_context::locked.
Referenced by fetch_about_blank_handler(), fetch_about_choices_handler(), fetch_about_config_handler(), fetch_about_credits_handler(), fetch_about_imagecache_handler(), fetch_about_licence_handler(), fetch_about_logo_handler(), fetch_about_send_finished(), fetch_about_send_header(), fetch_about_welcome_handler(), and ssenddataf().
|
inlinestatic |
Definition at line 103 of file about.c.
References fetch_about_send_callback(), FETCH_FINISHED, and fetch_msg::type.
Referenced by fetch_about_404_handler(), fetch_about_about_handler(), fetch_about_certificate_handler(), fetch_about_choices_handler(), fetch_about_config_handler(), fetch_about_imagecache_handler(), fetch_about_nscolours_handler(), fetch_about_query_auth_handler(), fetch_about_query_fetcherror_handler(), fetch_about_query_privacy_handler(), fetch_about_query_timeout_handler(), fetch_about_srverror(), and fetch_about_testament_handler().
|
static |
Definition at line 111 of file about.c.
References fetch_msg::data, fetch_about_send_callback(), FETCH_HEADER, fetch_msg::header_or_data, and fetch_msg::type.
Referenced by fetch_about_404_handler(), fetch_about_about_handler(), fetch_about_blank_handler(), fetch_about_certificate_handler(), fetch_about_choices_handler(), fetch_about_config_handler(), fetch_about_imagecache_handler(), fetch_about_nscolours_handler(), fetch_about_query_auth_handler(), fetch_about_query_fetcherror_handler(), fetch_about_query_privacy_handler(), fetch_about_query_timeout_handler(), fetch_about_srverror(), and fetch_about_testament_handler().
|
static |
callback to set up a about scheme fetch.
post_urlenc | post data in urlenc format, owned by the llcache object hence valid the entire lifetime of the fetch. |
post_multipart | post data in multipart format, owned by the llcache object hence valid the entire lifetime of the fetch. |
Definition at line 2837 of file about.c.
References about_handler_list_len, fetch_about_context::fetchh, fetch_about_context::handler, about_handlers::handler, fetch_about_context::multipart, nsurl_get_component(), NSURL_PATH, nsurl_ref(), path(), RING_INSERT, and fetch_about_context::url.
Referenced by fetch_about_register().
|
static |
Generate a 500 server error respnse.
ctx | The fetcher context. |
Definition at line 190 of file about.c.
References fetch_about_send_finished(), fetch_about_send_header(), fetch_set_http_code(), fetch_about_context::fetchh, NSERROR_OK, and ssenddataf().
Referenced by fetch_about_query_auth_handler(), fetch_about_query_fetcherror_handler(), fetch_about_query_privacy_handler(), and fetch_about_query_timeout_handler().
|
static |
callback to start an about scheme fetch
Definition at line 2894 of file about.c.
Referenced by fetch_about_register().
|
static |
Generate the text of an svn testament which represents the current build-tree status.
ctx | The fetcher context. |
Definition at line 1815 of file about.c.
References fetch_about_send_finished(), fetch_about_send_header(), fetch_set_http_code(), fetch_about_context::fetchh, NSERROR_OK, and ssenddataf().
|
static |
Handler to generate about scheme welcome page.
ctx | The fetcher context. |
Definition at line 1929 of file about.c.
References fetch_msg::data, fetch_about_send_callback(), FETCH_REDIRECT, fetch_set_http_code(), fetch_about_context::fetchh, fetch_msg::redirect, and fetch_msg::type.
|
static |
Definition at line 1358 of file about.c.
References ns_cert_name::common_name, ns_cert_info::err, format_certificate_fingerprint(), format_certificate_name(), format_certificate_public_key(), format_certificate_san(), ns_cert_info::issuer_name, messages_get_sslcode(), ns_cert_info::not_after, ns_cert_info::not_before, NSERROR_OK, PRIsizet, ns_cert_info::public_key, ns_cert_info::san, ns_cert_info::serialnum, ns_cert_info::sig_algor, ssenddataf(), SSL_CERT_ERR_OK, ns_cert_info::subject_name, and ns_cert_info::version.
Referenced by fetch_about_certificate_handler().
|
static |
Definition at line 1315 of file about.c.
References NSERROR_OK, ns_cert_info::sha1fingerprint, ns_cert_info::sha256fingerprint, and ssenddataf().
Referenced by format_certificate().
|
static |
Definition at line 1153 of file about.c.
References ns_cert_name::common_name, ns_cert_name::country, ns_cert_name::locality, NSERROR_OK, ns_cert_name::organisation, ns_cert_name::organisation_unit, ns_cert_name::province, and ssenddataf().
Referenced by format_certificate().
|
static |
Definition at line 1251 of file about.c.
References ns_cert_pkey::algor, ns_cert_pkey::curve, ns_cert_pkey::exponent, ns_cert_pkey::modulus, NSERROR_OK, ns_cert_pkey::public, ns_cert_pkey::size, and ssenddataf().
Referenced by format_certificate().
|
static |
output formatted certificate subject alternate names
Definition at line 1216 of file about.c.
References ns_cert_san::name, ns_cert_san::next, NSERROR_OK, and ssenddataf().
Referenced by format_certificate().
|
static |
free all resources associated with a certificate information structure
Definition at line 493 of file about.c.
References ns_cert_pkey::algor, cert_chain::certs, ns_cert_name::common_name, convert_chain_to_cert_info(), ns_cert_name::country, ns_cert_pkey::curve, cert_chain::depth, cert_chain::der, cert_chain::der_length, cert_chain::err, ns_cert_info::err, ns_cert_pkey::exponent, ns_cert_info::issuer_name, ns_cert_name::locality, ns_cert_pkey::modulus, ns_cert_san::name, ns_cert_san::next, ns_cert_info::not_after, ns_cert_info::not_before, NSERROR_BAD_PARAMETER, NSERROR_INVALID, NSERROR_NOMEM, NSERROR_NOT_IMPLEMENTED, NSERROR_OK, NSLOG, ns_cert_name::organisation, ns_cert_name::organisation_unit, ns_cert_name::province, ns_cert_pkey::public, ns_cert_info::public_key, ns_cert_info::san, ns_cert_info::serialnum, ns_cert_info::sha1fingerprint, ns_cert_info::sha256fingerprint, ns_cert_info::sig_algor, ns_cert_info::sig_type, ns_cert_pkey::size, ns_cert_info::subject_name, and ns_cert_info::version.
Referenced by fetch_about_certificate_handler().
|
static |
generate the description of the login query
Definition at line 1949 of file about.c.
References messages_get_buff(), NSERROR_NOMEM, NSERROR_OK, NSLOG, nsurl_get(), and NSURL_HOST.
Referenced by fetch_about_query_auth_handler().
|
static |
generate a generic query description
Definition at line 1992 of file about.c.
References messages_get_buff(), NSERROR_NOMEM, NSERROR_OK, nsurl_get(), and NSURL_HOST.
Referenced by fetch_about_query_fetcherror_handler(), fetch_about_query_privacy_handler(), and fetch_about_query_timeout_handler().
|
static |
send formatted data on a fetch
Definition at line 133 of file about.c.
References buffer, fetch_msg::data, fetch_about_send_callback(), FETCH_DATA, fetch_msg::header_or_data, NSERROR_INVALID, NSERROR_NOSPACE, NSERROR_OK, and fetch_msg::type.
Referenced by fetch_about_404_handler(), fetch_about_about_handler(), fetch_about_certificate_handler(), fetch_about_config_handler(), fetch_about_imagecache_handler(), fetch_about_nscolours_handler(), fetch_about_query_auth_handler(), fetch_about_query_fetcherror_handler(), fetch_about_query_privacy_handler(), fetch_about_query_timeout_handler(), fetch_about_srverror(), fetch_about_testament_handler(), format_certificate(), format_certificate_fingerprint(), format_certificate_name(), format_certificate_public_key(), and format_certificate_san().
struct about_handlers about_handler_list[] |
|
static |
Definition at line 75 of file about.c.
Referenced by fetch_about_poll().