xine-lib 1.2.13-20230125hg15249
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <zlib.h>
#include <xine/xine_internal.h>
#include <xine/xineutils.h>
#include <xine/input_plugin.h>
#include "tls/xine_tls.h"
#include "group_network.h"
#include "http_helper.h"
#include "input_helper.h"
Data Structures | |
struct | http_input_plugin_t |
struct | http_input_class_t |
Macros | |
#define | LOG_MODULE "input_http" |
#define | LOG_VERBOSE |
#define | BUFSIZE 1024 |
#define | DEFAULT_HTTP_PORT 80 |
#define | DEFAULT_HTTPS_PORT 443 |
#define | MODE_CHUNKED 0x0001 /* content sent portion-wise */ |
#define | MODE_DEFLATED 0x0002 /* content needs inflating */ |
#define | MODE_HAS_TYPE 0x0004 /* there is (at least the type of) content */ |
#define | MODE_HAS_LENGTH 0x0008 /* content size is known */ |
#define | MODE_AGAIN 0x0010 /* follow a redirection */ |
#define | MODE_INFLATING 0x0020 /* zlib inflater is up */ |
#define | MODE_DONE 0x0040 /* end of content reached */ |
#define | MODE_HAVE_CHUNK 0x0100 /* there are content portions left */ |
#define | MODE_HAVE_SBUF 0x0200 /* there are content bytes in sbuf */ |
#define | MODE_HAVE_READ 0x0400 /* socket still has data to read */ |
#define | MODE_SEEKABLE 0x1000 /* server supports byte ranges */ |
#define | MODE_NSV 0x2000 /* we have a nullsoft stream */ |
#define | MODE_LASTFM 0x4000 /* we have a last.fm stream */ |
#define | MODE_SHOUTCAST 0x8000 /* content has info inserts */ |
#define | SIZEOF_LITERALS 205 |
#define | SIZEOF_NUMS (1 * 24) |
#define | ADDLIT(s) { static const char ls[] = s; memcpy (q, s, sizeof (ls)); q += sizeof (ls) - 1; } |
#define | ADDSTR(s) q += strlcpy (q, s, e - q); if (q > e) q = e |
#define | V_NSV (('N' << 24) | ('S' << 16) | ('V' << 8)) |
Enumerations | |
enum | _k_t { _K_NONE = 0 , _K_content_length , _K_content_type , _K_content_encoding , _K_content_range , _K_transfer_encoding , _K_accept_ranges , _K_location , _K_server , _K_www_authenticate , _K_icy_name , _K_icy_genre , _K_icy_notice2 , _K_icy_metaint , _K_LAST } |
Functions | |
static void | uint64_2str (char **s, uint64_t v) |
static void | uint32_2str (char **s, uint32_t u) |
static uint64_t | str2uint64 (uint8_t **s) |
static uint32_t | str2uint32 (uint8_t **s) |
static uint32_t | hexstr2uint32 (uint8_t **s) |
static void | sbuf_init (http_input_plugin_t *this) |
static void | sbuf_reset (http_input_plugin_t *this) |
static int32_t | sbuf_get_string (http_input_plugin_t *this, uint8_t **buf) |
static int | sbuf_skip_gzip_head (uint8_t *buf, uint32_t len) |
static ssize_t | sbuf_get_bytes (http_input_plugin_t *this, uint8_t *buf, size_t len) |
static void | proxy_host_change_cb (void *this_gen, xine_cfg_entry_t *cfg) |
static void | proxy_port_change_cb (void *this_gen, xine_cfg_entry_t *cfg) |
static void | proxy_user_change_cb (void *this_gen, xine_cfg_entry_t *cfg) |
static void | proxy_password_change_cb (void *this_gen, xine_cfg_entry_t *cfg) |
static void | no_proxy_list_change_cb (void *this_gen, xine_cfg_entry_t *cfg) |
static void | prot_version_change_cb (void *this_gen, xine_cfg_entry_t *cfg) |
static void | head_dump_name_change_cb (void *this_gen, xine_cfg_entry_t *cfg) |
static int | _x_use_proxy (xine_t *xine, http_input_class_t *this, const char *host) |
static size_t | http_plugin_basicauth (const char *user, const char *password, char *dest, size_t len) |
static int | http_plugin_read_metainf (http_input_plugin_t *this) |
static ssize_t | http_plugin_read_int (http_input_plugin_t *this, uint8_t *buf, size_t total) |
static off_t | http_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t nlen) |
static off_t | http_plugin_get_length (input_plugin_t *this_gen) |
static uint32_t | http_plugin_get_capabilities (input_plugin_t *this_gen) |
static off_t | http_plugin_get_current_pos (input_plugin_t *this_gen) |
static void | http_close (http_input_plugin_t *this) |
static int | http_restart (http_input_plugin_t *this, off_t abs_offset) |
static off_t | http_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) |
static const char * | http_plugin_get_mrl (input_plugin_t *this_gen) |
static void | http_plugin_dispose (input_plugin_t *this_gen) |
static void | report_progress (xine_stream_t *stream, int p) |
static _k_t | http_key_num (const char *key, uint32_t klen) |
static xio_handshake_status_t | http_plugin_handshake (void *userdata, int fh) |
static int | http_plugin_open (input_plugin_t *this_gen) |
static int | http_can_handle (xine_stream_t *stream, const char *mrl) |
static int | http_plugin_get_optional_data (input_plugin_t *this_gen, void *const data, int data_type) |
static input_plugin_t * | http_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *mrl) |
static void | http_class_dispose (input_class_t *this_gen) |
void * | input_http_init_class (xine_t *xine, const void *data) |
#define ADDLIT | ( | s | ) | { static const char ls[] = s; memcpy (q, s, sizeof (ls)); q += sizeof (ls) - 1; } |
#define ADDSTR | ( | s | ) | q += strlcpy (q, s, e - q); if (q > e) q = e |
#define BUFSIZE 1024 |
#define DEFAULT_HTTP_PORT 80 |
Referenced by http_plugin_handshake(), http_plugin_open(), and input_http_init_class().
#define DEFAULT_HTTPS_PORT 443 |
Referenced by http_plugin_open().
#define LOG_MODULE "input_http" |
Referenced by http_plugin_handshake(), and http_restart().
#define LOG_VERBOSE |
#define MODE_AGAIN 0x0010 /* follow a redirection */ |
Referenced by http_plugin_handshake(), and http_plugin_open().
#define MODE_CHUNKED 0x0001 /* content sent portion-wise */ |
Referenced by http_plugin_handshake(), and sbuf_get_bytes().
#define MODE_DEFLATED 0x0002 /* content needs inflating */ |
Referenced by http_plugin_handshake(), http_plugin_open(), and sbuf_get_bytes().
#define MODE_DONE 0x0040 /* end of content reached */ |
Referenced by http_plugin_get_optional_data(), http_plugin_handshake(), and sbuf_get_bytes().
#define MODE_HAS_LENGTH 0x0008 /* content size is known */ |
Referenced by http_plugin_handshake().
#define MODE_HAS_TYPE 0x0004 /* there is (at least the type of) content */ |
Referenced by http_plugin_handshake().
#define MODE_HAVE_CHUNK 0x0100 /* there are content portions left */ |
Referenced by http_plugin_handshake(), and sbuf_get_bytes().
#define MODE_HAVE_READ 0x0400 /* socket still has data to read */ |
Referenced by sbuf_get_bytes(), and sbuf_get_string().
#define MODE_HAVE_SBUF 0x0200 /* there are content bytes in sbuf */ |
Referenced by http_plugin_handshake(), sbuf_get_bytes(), sbuf_get_string(), sbuf_init(), and sbuf_reset().
#define MODE_INFLATING 0x0020 /* zlib inflater is up */ |
Referenced by sbuf_get_bytes(), sbuf_init(), and sbuf_reset().
#define MODE_LASTFM 0x4000 /* we have a last.fm stream */ |
Referenced by http_plugin_get_optional_data(), http_plugin_handshake(), and http_plugin_read_int().
#define MODE_NSV 0x2000 /* we have a nullsoft stream */ |
#define MODE_SEEKABLE 0x1000 /* server supports byte ranges */ |
#define MODE_SHOUTCAST 0x8000 /* content has info inserts */ |
Referenced by http_plugin_get_optional_data(), http_plugin_handshake(), and http_plugin_read_int().
#define SIZEOF_LITERALS 205 |
#define SIZEOF_NUMS (1 * 24) |
#define V_NSV (('N' << 24) | ('S' << 16) | ('V' << 8)) |
enum _k_t |
|
static |
References _, lprintf, NULL, xine_log(), and XINE_LOG_MSG.
Referenced by http_plugin_open().
|
static |
References xine_cfg_entry_s::str_value.
Referenced by input_http_init_class().
|
inlinestatic |
References tab_unhex, v, and z.
Referenced by sbuf_get_bytes().
|
static |
References _x_tls_available(), _x_url_user_agent(), xine_stream_s::xine, xine_log(), and XINE_LOG_MSG.
Referenced by http_class_get_instance(), and http_plugin_get_optional_data().
|
static |
References NULL, and config_values_s::unregister_callbacks.
Referenced by input_http_init_class().
|
static |
References _x_input_default_get_blocksize(), _x_input_default_read_block(), http_input_class_t::head_dump_name, http_can_handle(), http_plugin_dispose(), http_plugin_get_capabilities(), http_plugin_get_current_pos(), http_plugin_get_length(), http_plugin_get_mrl(), http_plugin_get_optional_data(), http_plugin_open(), http_plugin_read(), http_plugin_seek(), mode(), NULL, sbuf_init(), http_input_class_t::xine, and xine_nbc_init().
Referenced by input_http_init_class().
|
static |
References _x_io_tcp_close(), _x_tls_deinit(), and _x_url_cleanup().
Referenced by http_plugin_dispose(), http_plugin_get_optional_data(), and http_plugin_open().
|
static |
References _K_accept_ranges, _K_content_encoding, _K_content_length, _K_content_range, _K_content_type, _K_icy_genre, _K_icy_metaint, _K_icy_name, _K_icy_notice2, _K_location, _K_NONE, _K_server, _K_transfer_encoding, _K_www_authenticate, and key.
Referenced by http_plugin_handshake().
|
static |
References xine_base64_encode(), and xine_small_memcpy.
Referenced by http_plugin_handshake().
|
static |
References http_close(), NULL, sbuf_reset(), and xine_nbc_close().
Referenced by http_class_get_instance().
|
static |
References INPUT_CAP_LIVE, INPUT_CAP_NEW_MRL, INPUT_CAP_PREVIEW, INPUT_CAP_RIP_FORBIDDEN, INPUT_CAP_SIZED_PREVIEW, INPUT_CAP_SLOW_SEEKABLE, mode(), MODE_NSV, and MODE_SEEKABLE.
Referenced by http_class_get_instance().
|
static |
Referenced by http_class_get_instance().
|
static |
Referenced by http_class_get_instance().
|
static |
Referenced by http_class_get_instance().
|
static |
References _x_freep(), http_can_handle(), http_close(), http_plugin_read_int(), INPUT_OPTIONAL_DATA_DEMUX_MIME_TYPE, INPUT_OPTIONAL_DATA_MIME_TYPE, INPUT_OPTIONAL_DATA_NEW_MRL, INPUT_OPTIONAL_DATA_NEW_PREVIEW, INPUT_OPTIONAL_DATA_PREVIEW, INPUT_OPTIONAL_DATA_SIZED_PREVIEW, INPUT_OPTIONAL_SUCCESS, INPUT_OPTIONAL_UNSUPPORTED, mode(), MODE_DONE, MODE_LASTFM, MODE_NSV, MODE_SEEKABLE, MODE_SHOUTCAST, sbuf_reset(), XINE_VERBOSITY_DEBUG, and xprintf.
Referenced by http_class_get_instance().
|
static |
References _, _K_accept_ranges, _K_content_encoding, _K_content_length, _K_content_range, _K_content_type, _K_icy_genre, _K_icy_metaint, _K_icy_name, _K_icy_notice2, _K_location, _K_server, _K_transfer_encoding, _K_www_authenticate, _x_action_pending(), _x_assert, _x_io_select(), _x_merge_mrl(), _x_message(), _x_meta_info_set(), _x_query_network_timeout(), _x_tls_deinit(), _x_tls_handshake(), _x_tls_init(), _x_tls_write(), ADDLIT, ADDSTR, DEFAULT_HTTP_PORT, http_key_num(), http_plugin_basicauth(), http_input_class_t::input_class, key, LOG_MODULE, lprintf, mode(), MODE_AGAIN, MODE_CHUNKED, MODE_DEFLATED, MODE_DONE, MODE_HAS_LENGTH, MODE_HAS_TYPE, MODE_HAVE_CHUNK, MODE_HAVE_SBUF, MODE_LASTFM, MODE_NSV, MODE_SEEKABLE, MODE_SHOUTCAST, NULL, http_input_class_t::prot_version, http_input_class_t::proxypassword, http_input_class_t::proxyuser, report_progress(), sbuf_get_bytes(), sbuf_get_string(), sbuf_reset(), SIZEOF_LITERALS, SIZEOF_NUMS, str2uint32(), str2uint64(), tab_tolower, uint32_2str(), uint64_2str(), VERSION, xine_log(), XINE_LOG_MSG, XINE_META_INFO_ALBUM, XINE_META_INFO_COMMENT, XINE_META_INFO_GENRE, XINE_META_INFO_TITLE, XINE_MSG_AUTHENTICATION_NEEDED, XINE_MSG_CONNECTION_REFUSED, XINE_MSG_FILE_NOT_FOUND, XINE_MSG_NETWORK_UNREACHABLE, XINE_MSG_PERMISSION_ERROR, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, XIO_HANDSHAKE_INTR, XIO_HANDSHAKE_OK, XIO_HANDSHAKE_TRY_NEXT, XIO_READY, XIO_TIMEOUT, XIO_WRITE_READY, and xprintf.
Referenced by http_plugin_open().
|
static |
References _, _x_io_tcp_close(), _x_io_tcp_handshake_connect(), _x_message(), _x_tls_deinit(), _x_url_parse2(), _x_url_user_agent(), _x_use_proxy(), DEFAULT_HTTP_PORT, DEFAULT_HTTPS_PORT, http_close(), http_plugin_handshake(), http_plugin_read_int(), http_input_class_t::input_class, lprintf, mode(), MODE_AGAIN, MODE_DEFLATED, MODE_NSV, NULL, http_input_class_t::proxyhost, http_input_class_t::proxyport, v, V_NSV, xine_log(), XINE_LOG_MSG, XINE_MSG_GENERAL_WARNING, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.
Referenced by http_class_get_instance().
|
static |
References http_plugin_read_int(), and lprintf.
Referenced by http_class_get_instance().
|
static |
References _, _x_action_pending(), _x_message(), http_plugin_read_metainf(), lprintf, mode(), MODE_LASTFM, MODE_SHOUTCAST, NULL, read_bytes(), sbuf_get_bytes(), xine_event_t::type, xine_event_send(), XINE_EVENT_UI_CHANNELS_CHANGED, xine_log(), XINE_LOG_MSG, and XINE_MSG_READ_ERROR.
Referenced by http_plugin_get_optional_data(), http_plugin_open(), and http_plugin_read().
|
static |
References _x_meta_info_get(), _x_meta_info_set(), xine_event_t::data, xine_event_t::data_length, lprintf, sbuf_get_bytes(), xine_ui_data_t::str, xine_ui_data_t::str_len, xine_event_t::stream, xine_event_t::type, xine_event_send(), XINE_EVENT_UI_SET_TITLE, XINE_META_INFO_ALBUM, and XINE_META_INFO_TITLE.
Referenced by http_plugin_read_int().
|
static |
References _x_input_seek_preview(), _x_input_translate_seek(), http_restart(), mode(), MODE_SEEKABLE, XINE_VERBOSITY_LOG, and xprintf.
Referenced by http_class_get_instance().
|
static |
References _x_io_tcp_close(), _x_tls_deinit(), _x_url_cleanup(), LOG_MODULE, NULL, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.
Referenced by http_plugin_seek().
void * input_http_init_class | ( | xine_t * | xine, |
const void * | data ) |
References _, _x_freep(), xine_s::config, DEFAULT_HTTP_PORT, head_dump_name_change_cb(), http_class_dispose(), http_class_get_instance(), N_, no_proxy_list_change_cb(), NULL, prot_version_change_cb(), proxy_host_change_cb(), proxy_password_change_cb(), proxy_port_change_cb(), proxy_user_change_cb(), config_values_s::register_enum, config_values_s::register_num, config_values_s::register_string, config_values_s::update_num, and config_values_s::update_string.
|
static |
References xine_cfg_entry_s::str_value.
Referenced by input_http_init_class().
|
static |
References xine_cfg_entry_s::num_value.
Referenced by input_http_init_class().
|
static |
References xine_cfg_entry_s::str_value.
Referenced by input_http_init_class().
|
static |
References xine_cfg_entry_s::str_value.
Referenced by input_http_init_class().
|
static |
References xine_cfg_entry_s::num_value.
Referenced by input_http_init_class().
|
static |
References xine_cfg_entry_s::str_value.
Referenced by input_http_init_class().
|
static |
References _, xine_progress_data_t::description, xine_progress_data_t::percent, XINE_EVENT_PROGRESS, and xine_event_send().
Referenced by http_plugin_handshake().
|
static |
References _x_tls_read(), hexstr2uint32(), mode(), MODE_CHUNKED, MODE_DEFLATED, MODE_DONE, MODE_HAVE_CHUNK, MODE_HAVE_READ, MODE_HAVE_SBUF, MODE_INFLATING, NULL, sbuf_get_string(), sbuf_skip_gzip_head(), xine_small_memcpy, XINE_VERBOSITY_DEBUG, and xprintf.
Referenced by http_plugin_handshake(), http_plugin_read_int(), and http_plugin_read_metainf().
|
static |
References _x_tls_part_read(), mode(), MODE_HAVE_READ, and MODE_HAVE_SBUF.
Referenced by http_plugin_handshake(), and sbuf_get_bytes().
|
static |
References mode(), MODE_HAVE_SBUF, and MODE_INFLATING.
Referenced by http_class_get_instance().
|
static |
References mode(), MODE_HAVE_SBUF, and MODE_INFLATING.
Referenced by http_plugin_dispose(), http_plugin_get_optional_data(), and http_plugin_handshake().
|
static |
Referenced by sbuf_get_bytes().
|
inlinestatic |
Referenced by http_plugin_handshake().
|
inlinestatic |
Referenced by http_plugin_handshake().
|
inlinestatic |
Referenced by http_plugin_handshake().
|
inlinestatic |
References v.
Referenced by http_plugin_handshake().