xine-lib: xine-lib-1.2.13/src/input/http_helper.c File Reference

xine-lib 1.2.13-20230125hg15249

Data Structures | Functions | Variables
http_helper.c File Reference
`#include <string.h>`
`#include <stdint.h>`
`#include <xine/xine_internal.h>`
`#include "http_helper.h"`

## Data Structures
struct | mrlp_t

## Functions
static void | unescape (char **d, const char *s, size_t len)
static size_t | esclen (const char *s, size_t len)
static void | escape (char **d, const char *s, size_t len)
int | _x_url_parse2 (const char *mrl, xine_url_t *url)
void | _x_url_init (xine_url_t *url)
void | _x_url_cleanup (xine_url_t *url)
size_t | _x_merge_mrl (char *dest, size_t dsize, const char *base_mrl, const char *new_mrl)
| merge a new, possibly relative mrl with a given base. result will always be 0 terminated.
const char * | _x_url_user_agent (const char *url)

## Variables
static const int8_t | tab_unhex [256]
static const uint8_t | tab_esclen [256]
static const uint8_t | tab_hex [16] = "0123456789abcdef"
static const uint8_t | tab_type [256]

## Function Documentation

## ◆ _x_merge_mrl()

size_t _x_merge_mrl | ( | char * | dest,
|  | size_t | dsize,
|  | const char * | base_mrl,
|  | const char * | new_mrl )

merge a new, possibly relative mrl with a given base. result will always be 0 terminated.

Parameters

  dest | the buffer to write the result to. may be NULL.
  dsize | the size of *dest in bytes.
  base_mrl | the base to fill missing parts with. may be the same as dest, or NULL.
  new_mrl | the new mrl. may be NULL.

Returns
  the string length of result. will be >= dsize when truncated.

References tab_type.

Referenced by hls_input_open(), hls_input_open_bump(), hls_input_open_item(), http_plugin_handshake(), and mpd_build_mrl().

## ◆ _x_url_cleanup()

void _x_url_cleanup | ( | xine_url_t * | url | ) |

References xine_url_t::args, xine_url_t::buf, xine_url_t::host, NULL, xine_url_t::password, xine_url_t::path, xine_url_t::port, xine_url_t::proto, xine_url_t::uri, and xine_url_t::user.

Referenced by _ftp_open(), _get_dir(), _get_dir_common(), _open_plugin(), http_close(), http_restart(), mms_close(), mms_connect(), mmsh_close(), mmsh_connect(), and net_plugin_open().

## ◆ _x_url_init()

void _x_url_init | ( | xine_url_t * | url | ) |

References xine_url_t::args, xine_url_t::buf, xine_url_t::host, NULL, xine_url_t::password, xine_url_t::path, xine_url_t::port, xine_url_t::proto, xine_url_t::uri, and xine_url_t::user.

Referenced by net_plugin_open().

## ◆ _x_url_parse2()

int _x_url_parse2 | ( | const char * | mrl,
|  | xine_url_t * | url )

References xine_url_t::args, mrlp_t::args_start, mrlp_t::args_stop, xine_url_t::buf, escape(), esclen(), xine_url_t::host, mrlp_t::host_start, mrlp_t::host_stop, mrlp_t::info_start, mrlp_t::info_stop, NULL, mrlp_t::pass_start, mrlp_t::pass_stop, xine_url_t::password, xine_url_t::path, mrlp_t::path_start, mrlp_t::path_stop, mrlp_t::port, xine_url_t::port, mrlp_t::prot_start, mrlp_t::prot_stop, xine_url_t::proto, tab_type, unescape(), xine_url_t::uri, xine_url_t::user, mrlp_t::user_start, mrlp_t::user_stop, v, and z.

Referenced by _ftp_open(), _get_dir(), _get_dir_common(), _open_plugin(), http_plugin_open(), mms_connect(), mmsh_connect(), and net_plugin_open().

## ◆ _x_url_user_agent()

const char * _x_url_user_agent | ( | const char * | url | ) |

References NULL.

Referenced by http_can_handle(), and http_plugin_open().

## ◆ escape()

static void escape | ( | char ** | d,
|  | const char * | s,
|  | size_t | len )
| static

References tab_esclen, and tab_hex.

Referenced by _x_url_parse2().

## ◆ esclen()

static size_t esclen | ( | const char * | s,
|  | size_t | len )
| static

References tab_esclen.

Referenced by _x_url_parse2().

## ◆ unescape()

static void unescape | ( | char ** | d,
|  | const char * | s,
|  | size_t | len )
| static

References tab_unhex, and v.

Referenced by _x_url_parse2().

## Variable Documentation

## ◆ tab_esclen

const uint8_t tab_esclen[256]
| static

Initial value:
= {
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
}

Referenced by escape(), and esclen().

## ◆ tab_hex

const uint8_t tab_hex[16] = "0123456789abcdef"
| static

Referenced by escape().

## ◆ tab_type

const uint8_t tab_type[256]
| static

Initial value:
= {
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0, 0, 0,0xdd, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0xc5,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0x41,0xc1, 0, 0, 0,0xcd,
0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0x01, 0,0x02, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
}

Referenced by _x_mrl_unescape(), hexstr2uint32(), and unescape().