summaryrefslogtreecommitdiff
path: root/src/network.c
diff options
context:
space:
mode:
authorJakub Sławiński2005-08-05 21:45:31 +0200
committerJoshua Judson Rosen2014-07-17 21:14:59 +0200
commit43e8714797d40bcf63efab428dcd25f9caf1d52b (patch)
tree796974a873a97f2a44f872f3dd3587508e35aa64 /src/network.c
parentv0.7.1 (diff)
downloadapf-43e8714797d40bcf63efab428dcd25f9caf1d52b.tar.gz
v0.7.2
- Added: http proxy basic authorization - Fixed: logging initialization after some value checking - Fixed: auto-reconnect failure when --nossl option is set - Added: auto-reconnect when afserver is not reachable on start - Added: auto-reconnect after normal afserver quit - Added: per user statistics: idle time, amount of downloaded/uploaded bytes and current download/upload rate - Added: support for https proxies - Added: possibility to bind sockets on different interfaces - Fixed: receiving incomplete headers from afclient - Fixed: close user connections by afclient
Diffstat (limited to 'src/network.c')
-rw-r--r--src/network.c96
1 files changed, 0 insertions, 96 deletions
diff --git a/src/network.c b/src/network.c
index 0903b4f..38569cc 100644
--- a/src/network.c
+++ b/src/network.c
@@ -389,99 +389,3 @@ readn(int fd, unsigned char* buf, int amount)
return amount;
}
-
-int
-send_message(char type, clifd fd, unsigned char* buf, int amount)
-{
- unsigned long clen;
- int length;
- static unsigned char bufor[9000];
- aflog(LOG_T_MAIN, LOG_I_DEBUG,
- "send_message: ssl:%s zlib:%s length:%d", (TYPE_IS_SSL(type))?"yes":"no",
- (TYPE_IS_ZLIB(type))?"yes":"no", amount);
- clen = 8995;
- length = amount - 5;
- if (TYPE_IS_ZLIB(type)) {
- memcpy(bufor, buf, 5);
- if (amount > 5) {
- compress(&bufor[5], &clen, &buf[5], length);
- if (clen < length) {
- length = clen;
- TYPE_SET_COMP(length);
- bufor[3] = length >> 8; /* high bits of message length */
- bufor[4] = length; /* low bits of message length */
- addtocg(amount-5 - clen);
- }
- }
- if (TYPE_IS_SSL(type)) {
- if (TYPE_IS_COMP(length)) {
- return SSL_writen(fd.ssl, bufor, clen+5);
- }
- else {
- return SSL_writen(fd.ssl, buf, amount);
- }
- }
- else {
- if (TYPE_IS_COMP(length)) {
- return writen(fd.commfd, bufor, clen+5);
- }
- else {
- return writen(fd.commfd, buf, amount);
- }
- }
- }
- else {
- if (TYPE_IS_SSL(type)) {
- return SSL_writen(fd.ssl, buf, amount);
- }
- else {
- return writen(fd.commfd, buf, amount);
- }
- }
-}
-
-int
-get_message(char type, clifd fd, unsigned char* buf, int amount)
-{
- int length;
- unsigned long elen;
- static unsigned char bufor[9000];
- aflog(LOG_T_MAIN, LOG_I_DEBUG,
- "get_message: ssl:%s zlib:%s length:%d", (TYPE_IS_SSL(type))?"yes":"no",
- (TYPE_IS_ZLIB(type))?"yes":"no", amount);
- if (amount == -5) {
- if (TYPE_IS_SSL(type)) {
- return SSL_read(fd.ssl, buf, 5);
- }
- else {
- return read(fd.commfd, buf, 5);
- }
- }
- if (TYPE_IS_ZLIB(type)) {
- if (TYPE_IS_SSL(type)) {
- length = SSL_readn(fd.ssl, bufor, amount&0xBFFF);
- }
- else {
- length = readn(fd.commfd, bufor, amount&0xBFFF);
- }
- if (length <= 0) return length;
- elen = 8096;
- if (TYPE_IS_COMP(amount)) {
- uncompress(buf, &elen, bufor, length);
- }
- else {
- memcpy(buf, bufor, length);
- elen = length;
- }
- return elen;
- }
- else
- {
- if (TYPE_IS_SSL(type)) {
- return SSL_readn(fd.ssl, buf, amount);
- }
- else {
- return readn(fd.commfd, buf, amount);
- }
- }
-}