summaryrefslogtreecommitdiff
path: root/src/http_proxy_functions.c
diff options
context:
space:
mode:
authorJakub Sławiński2006-04-06 23:34:51 +0200
committerJoshua Judson Rosen2014-07-17 21:15:02 +0200
commit1361f0e88138653d2437f45ddf940206ed0e93b7 (patch)
tree3507c0e145a2674d99e9da65cd8dc7ebcc91bdc1 /src/http_proxy_functions.c
parentv0.8 (diff)
downloadapf-1361f0e88138653d2437f45ddf940206ed0e93b7.tar.gz
v0.8.1
- Fixed: enableproxy option in server's config file - Added: clients idle time - Added: 'maxidle' option - Modified: task scheduling subsystem has been completely rewritten - Fixed: segmentation fault in http tunnels after multiple simultaneous POST connections from the same source - Fixed: unexpected connection close when http proxy was too slow - Fixed: SIGSEGV in http proxy mode under cygwin - Added: enabled the SO_KEEPALIVE option for all the sockets used by the apf - Added: 60 seconds timeout for SSL_connect
Diffstat (limited to 'src/http_proxy_functions.c')
-rw-r--r--src/http_proxy_functions.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/http_proxy_functions.c b/src/http_proxy_functions.c
index 495d7d8..509b0a1 100644
--- a/src/http_proxy_functions.c
+++ b/src/http_proxy_functions.c
@@ -284,9 +284,11 @@ read_message(int fd, int length, connection* client, char* tab, int ptr)
int tmp = 0;
while (j < length) {
if (client->curreceived + length-j > client->toreceive) {
- writen(fd, (unsigned char*) (tab+ptr+j), client->toreceive - client->curreceived);
- j += client->toreceive - client->curreceived;
- client->curreceived += client->toreceive - client->curreceived;
+ if (client->toreceive - client->curreceived > 0) {
+ writen(fd, (unsigned char*) (tab+ptr+j), client->toreceive - client->curreceived);
+ j += client->toreceive - client->curreceived;
+ client->curreceived += client->toreceive - client->curreceived;
+ }
if (client->read_state == 0) {
switch (tab[ptr + j]) {
case 'M': {
@@ -311,6 +313,13 @@ read_message(int fd, int length, connection* client, char* tab, int ptr)
++j;
break;
}
+ case 'A': {
+ ++j;
+ if (client->state == C_CLOSED) {
+ client->state = C_OPEN;
+ }
+ break;
+ }
default: {
return 1;
}
@@ -332,7 +341,7 @@ read_message(int fd, int length, connection* client, char* tab, int ptr)
}
}
}
- else {
+ else if (length-j > 0) {
client->curreceived += length-j;
writen(fd, (unsigned char*) (tab+ptr+j), length-j);
j += length-j;
@@ -342,7 +351,7 @@ read_message(int fd, int length, connection* client, char* tab, int ptr)
}
/*
- * Function name: clear sslFd
+ * Function name: clear_sslFd
* Description: Close the socket encapsulated in SslFd structure, remove this file descriptor
* from fd_set and clear ssl structure.
* Arguments: sf - pointer to SslFd structure