2008-05-24 16:05:49 +08:00
|
|
|
/* tinyproxy - A fast light-weight HTTP proxy
|
|
|
|
* Copyright (C) 2001 Robert James Kaes <rjkaes@users.sourceforge.net>
|
2001-10-26 00:58:09 +08:00
|
|
|
*
|
2008-05-24 16:05:49 +08:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2001-10-26 00:58:09 +08:00
|
|
|
*
|
2008-05-24 16:05:49 +08:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2001-10-26 00:58:09 +08:00
|
|
|
*
|
2008-05-24 16:05:49 +08:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2001-10-26 00:58:09 +08:00
|
|
|
*/
|
|
|
|
|
2008-05-24 16:05:49 +08:00
|
|
|
/* See 'conns.c' for detailed information. */
|
|
|
|
|
2001-10-26 00:58:09 +08:00
|
|
|
#ifndef TINYPROXY_CONNS_H
|
|
|
|
#define TINYPROXY_CONNS_H
|
|
|
|
|
2009-08-07 06:12:53 +08:00
|
|
|
#include "main.h"
|
2003-08-01 08:14:34 +08:00
|
|
|
#include "hashmap.h"
|
2001-11-26 06:06:20 +08:00
|
|
|
|
2001-10-26 00:58:09 +08:00
|
|
|
/*
|
|
|
|
* Connection Definition
|
|
|
|
*/
|
2009-09-15 03:41:25 +08:00
|
|
|
struct conn_s {
|
|
|
|
int client_fd;
|
|
|
|
int server_fd;
|
|
|
|
|
|
|
|
struct buffer_s *cbuffer;
|
|
|
|
struct buffer_s *sbuffer;
|
|
|
|
|
|
|
|
/* The request line (first line) from the client */
|
|
|
|
char *request_line;
|
|
|
|
|
|
|
|
/* Booleans */
|
|
|
|
unsigned int connect_method;
|
|
|
|
unsigned int show_stats;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This structure stores key -> value mappings for substitution
|
|
|
|
* in the error HTML files.
|
|
|
|
*/
|
|
|
|
hashmap_t error_variables;
|
|
|
|
|
|
|
|
int error_number;
|
|
|
|
char *error_string;
|
|
|
|
|
|
|
|
/* A Content-Length value from the remote server */
|
|
|
|
struct {
|
|
|
|
long int server;
|
|
|
|
long int client;
|
|
|
|
} content_length;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Store the server's IP (for BindSame)
|
|
|
|
*/
|
|
|
|
char *server_ip_addr;
|
|
|
|
|
|
|
|
/*
|
2018-12-31 23:47:40 +08:00
|
|
|
* Store the client's IP information
|
2009-09-15 03:41:25 +08:00
|
|
|
*/
|
|
|
|
char *client_ip_addr;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Store the incoming request's HTTP protocol.
|
|
|
|
*/
|
|
|
|
struct {
|
|
|
|
unsigned int major;
|
|
|
|
unsigned int minor;
|
|
|
|
} protocol;
|
2004-01-27 03:11:52 +08:00
|
|
|
|
|
|
|
#ifdef REVERSE_SUPPORT
|
2009-09-15 03:41:25 +08:00
|
|
|
/*
|
|
|
|
* Place to store the current per-connection reverse proxy path
|
|
|
|
*/
|
|
|
|
char *reversepath;
|
2004-01-27 03:11:52 +08:00
|
|
|
#endif
|
2004-08-11 05:24:24 +08:00
|
|
|
|
2009-09-15 03:41:25 +08:00
|
|
|
/*
|
|
|
|
* Pointer to upstream proxy.
|
|
|
|
*/
|
|
|
|
struct upstream *upstream_proxy;
|
2001-10-26 00:58:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Functions for the creation and destruction of a connection structure.
|
|
|
|
*/
|
2008-12-01 23:01:11 +08:00
|
|
|
extern struct conn_s *initialize_conn (int client_fd, const char *ipaddr,
|
2008-12-08 21:39:44 +08:00
|
|
|
const char *sock_ipaddr);
|
2008-12-01 23:01:11 +08:00
|
|
|
extern void destroy_conn (struct conn_s *connptr);
|
2001-10-26 00:58:09 +08:00
|
|
|
|
|
|
|
#endif
|