Macros | Functions | Variables
proxy.c File Reference
#include "syshead.h"
#include "common.h"
#include "misc.h"
#include "crypto.h"
#include "win32.h"
#include "socket.h"
#include "fdmisc.h"
#include "proxy.h"
#include "base64.h"
#include "httpdigest.h"
#include "ntlm.h"
#include "memdbg.h"
#include "forward.h"
Include dependency graph for proxy.c:

Go to the source code of this file.


#define UP_TYPE_PROXY   "HTTP Proxy"


struct http_proxy_optionsinit_http_proxy_options_once (struct http_proxy_options **hpo, struct gc_arena *gc)
static bool recv_line (socket_descriptor_t sd, char *buf, int len, const int timeout_sec, const bool verbose, struct buffer *lookahead, volatile int *signal_received)
static bool send_line (socket_descriptor_t sd, const char *buf)
static bool send_line_crlf (socket_descriptor_t sd, const char *src)
static bool send_crlf (socket_descriptor_t sd)
uint8_tmake_base64_string2 (const uint8_t *str, int src_len, struct gc_arena *gc)
uint8_tmake_base64_string (const uint8_t *str, struct gc_arena *gc)
static const char * username_password_as_base64 (const struct http_proxy_info *p, struct gc_arena *gc)
static void clear_user_pass_http (void)
static void get_user_pass_http (struct http_proxy_info *p, const bool force)
static int get_proxy_authenticate (socket_descriptor_t sd, int timeout, char **data, volatile int *signal_received)
static void store_proxy_authenticate (struct http_proxy_info *p, char *data)
static bool get_key_value (const char *str, char *key, char *value, int max_key_len, int max_value_len, const char **endptr)
static char * get_pa_var (const char *key, const char *pa, struct gc_arena *gc)
struct http_proxy_infohttp_proxy_new (const struct http_proxy_options *o)
void http_proxy_close (struct http_proxy_info *hp)
static bool add_proxy_headers (struct http_proxy_info *p, socket_descriptor_t sd, const char *host, const char *port)
bool establish_http_proxy_passthru (struct http_proxy_info *p, socket_descriptor_t sd, const char *host, const char *port, struct event_timeout *server_poll_timeout, struct buffer *lookahead, volatile int *signal_received)


static struct user_pass static_proxy_user_pass

Macro Definition Documentation


#define UP_TYPE_PROXY   "HTTP Proxy"

Definition at line 45 of file proxy.c.

Referenced by get_user_pass_http().

Function Documentation

◆ add_proxy_headers()

static bool add_proxy_headers ( struct http_proxy_info p,
socket_descriptor_t  sd,
const char *  host,
const char *  port 

◆ clear_user_pass_http()

static void clear_user_pass_http ( void  )

Definition at line 256 of file proxy.c.

References purge_user_pass(), and static_proxy_user_pass.

Referenced by establish_http_proxy_passthru(), and get_user_pass_http().

◆ establish_http_proxy_passthru()

bool establish_http_proxy_passthru ( struct http_proxy_info p,
socket_descriptor_t  sd,
const char *  host,
const char *  port,
struct event_timeout server_poll_timeout,
struct buffer lookahead,
volatile int *  signal_received 

◆ get_key_value()

static bool get_key_value ( const char *  str,
char *  key,
char *  value,
int  max_key_len,
int  max_value_len,
const char **  endptr 

Definition at line 381 of file proxy.c.

Referenced by get_pa_var().

◆ get_pa_var()

static char* get_pa_var ( const char *  key,
const char *  pa,
struct gc_arena gc 

Definition at line 462 of file proxy.c.

References get_key_value(), status, and string_alloc().

Referenced by establish_http_proxy_passthru().

◆ get_proxy_authenticate()

static int get_proxy_authenticate ( socket_descriptor_t  sd,
int  timeout,
char **  data,
volatile int *  signal_received 

◆ get_user_pass_http()

static void get_user_pass_http ( struct http_proxy_info p,
const bool  force 

◆ http_proxy_close()

void http_proxy_close ( struct http_proxy_info hp)

Definition at line 557 of file proxy.c.

References free.

Referenced by uninit_proxy_dowork().

◆ http_proxy_new()

struct http_proxy_info* http_proxy_new ( const struct http_proxy_options o)

◆ init_http_proxy_options_once()

struct http_proxy_options* init_http_proxy_options_once ( struct http_proxy_options **  hpo,
struct gc_arena gc 

Definition at line 48 of file proxy.c.


Referenced by add_option(), and management_callback_proxy_cmd().

◆ make_base64_string()

uint8_t* make_base64_string ( const uint8_t str,
struct gc_arena gc 

Definition at line 240 of file proxy.c.

References make_base64_string2().

Referenced by username_password_as_base64().

◆ make_base64_string2()

uint8_t* make_base64_string2 ( const uint8_t str,
int  src_len,
struct gc_arena gc 

◆ recv_line()

static bool recv_line ( socket_descriptor_t  sd,
char *  buf,
int  len,
const int  timeout_sec,
const bool  verbose,
struct buffer lookahead,
volatile int *  signal_received 

◆ send_crlf()

static bool send_crlf ( socket_descriptor_t  sd)

Definition at line 223 of file proxy.c.

References send_line_crlf().

Referenced by establish_http_proxy_passthru().

◆ send_line()

static bool send_line ( socket_descriptor_t  sd,
const char *  buf 

Definition at line 196 of file proxy.c.

References D_LINK_ERRORS, M_ERRNO, msg, MSG_NOSIGNAL, and ssize_t.

Referenced by send_line_crlf().

◆ send_line_crlf()

static bool send_line_crlf ( socket_descriptor_t  sd,
const char *  src 

◆ store_proxy_authenticate()

static void store_proxy_authenticate ( struct http_proxy_info p,
char *  data 

Definition at line 367 of file proxy.c.

References buffer::data, free, and http_proxy_info::proxy_authenticate.

Referenced by establish_http_proxy_passthru().

◆ username_password_as_base64()

static const char* username_password_as_base64 ( const struct http_proxy_info p,
struct gc_arena gc 

Variable Documentation

◆ static_proxy_user_pass

struct user_pass static_proxy_user_pass

Definition at line 62 of file proxy.c.

Referenced by clear_user_pass_http(), and get_user_pass_http().