From b457fec36399c1f7de093d5e92bb4fa453b79c86 Mon Sep 17 00:00:00 2001 From: Jakub Sławiński Date: Sun, 5 Feb 2006 15:14:03 +0100 Subject: v0.8 - Fixed: infinite loop after buffering message - Fixed: corrupt packets after closing connections in the stopped state - Fixed: bug in mapping user numbers between afclient and afserver - Fixed: premature close of the service connection - Fixed: invalid buffering when the connection is closing - Added: Multiple tunnels in one afclient<->afserver connection --- src/http_proxy_server.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/http_proxy_server.c') diff --git a/src/http_proxy_server.c b/src/http_proxy_server.c index 6e41bb5..6da2c30 100644 --- a/src/http_proxy_server.c +++ b/src/http_proxy_server.c @@ -40,6 +40,16 @@ typedef struct { SSL_CTX* ctx; } sproxy_argT; +/* + * Function name: afserver_connect + * Description: Connects new http proxy connection to the afserver. + * Arguments: sockfd - the file descriptor which will be used for communication with afserver + * afserverfd - the afserver's file descriptor + * cliaddr - pointer to sockaddr structure + * addrlenp - pointer to the length of the sockaddr structure + * type - the type of the connection + */ + int afserver_connect(int* sockfd, int afserverfd, struct sockaddr* cliaddr, socklen_t* addrlenp, char type) { @@ -54,7 +64,7 @@ afserver_connect(int* sockfd, int afserverfd, struct sockaddr* cliaddr, socklen_ return 3; } if (write(afserverfd, addrlenp, 4) != 4) { - return 3; + return 4; } if (write(afserverfd, cliaddr, *addrlenp) != *addrlenp) { return 5; @@ -63,6 +73,12 @@ afserver_connect(int* sockfd, int afserverfd, struct sockaddr* cliaddr, socklen_ return 0; } +/* + * Function name: http_proxy_server + * Description: Function responsible for the server part of the http proxy connection. + * Arguments: vptr - the structure with all the information needed for http proxy tunnel. + */ + void* http_proxy_server(void *vptr) { @@ -486,6 +502,20 @@ http_proxy_server(void *vptr) return 0; } +/* + * Function name: initialize_http_proxy_server + * Description: Initializes the thread responsible for http proxy connection. + * Arguments: sockfd - the new connection descriptor will be stored here + * host - the name of the host on which we will be listening on + * serv - the port on which we will be listening on + * addrlenp - pointer to the length of the sockaddr structure + * type - the type of the connection + * limit - the limit for user's connections + * https - if the connection should be https instead of http + * ctx - the pointer to SSL_CTX structure + * Returns: 0 - success, + * !0 - failure. + */ int initialize_http_proxy_server(int* sockfd, const char *host, const char *serv, socklen_t *addrlenp, const char type, int limit, char https, SSL_CTX* ctx) -- cgit v1.1