Differences From Artifact [367a20fe47]:
- File src/OFTCPSocket.m — part of check-in [48708f2435] at 2011-10-04 18:17:10 on branch trunk — Move SOCKS5 support to OFTCPSocket. (user: js, size: 11068) [annotate] [blame] [check-ins using]
To Artifact [59c9f9facb]:
- File
src/OFTCPSocket.m
— part of check-in
[a3b3333128]
at
2011-12-08 02:25:45
on branch trunk
— Make it possible to set a default SOCKS5 proxy for all OFTCPSockets.
For example, this is useful if you want to use
+[OFString stringWithContentsOfURL:] with a proxy or if you just want
to use anything that uses an OFTCPSocket with a proxy (even 3rd party
libraries). (user: js, size: 11658) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | /* References for static linking */ void _references_to_categories_of_OFTCPSocket(void) { _OFTCPSocket_SOCKS5_reference = 1; } @implementation OFTCPSocket #if defined(OF_THREADS) && !defined(HAVE_THREADSAFE_GETADDRINFO) + (void)initialize { if (self == [OFTCPSocket class]) mutex = [[OFMutex alloc] init]; } #endif - init { self = [super init]; | > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | > > > > > > > > > > > | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | /* References for static linking */ void _references_to_categories_of_OFTCPSocket(void) { _OFTCPSocket_SOCKS5_reference = 1; } static OFString *defaultSOCKS5Host = nil; static uint16_t defaultSOCKS5Port = 1080; @implementation OFTCPSocket #if defined(OF_THREADS) && !defined(HAVE_THREADSAFE_GETADDRINFO) + (void)initialize { if (self == [OFTCPSocket class]) mutex = [[OFMutex alloc] init]; } #endif + (void)setSOCKS5Host: (OFString*)host { id old = defaultSOCKS5Host; defaultSOCKS5Host = [host copy]; [old release]; } + (OFString*)SOCKS5Host { return [[defaultSOCKS5Host copy] autorelease]; } + (void)setSOCKS5Port: (uint16_t)port { defaultSOCKS5Port = port; } + (uint16_t)SOCKS5Port { return defaultSOCKS5Port; } - init { self = [super init]; @try { sock = INVALID_SOCKET; sockAddr = NULL; SOCKS5Host = [defaultSOCKS5Host copy]; SOCKS5Port = defaultSOCKS5Port; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [SOCKS5Host release]; [super dealloc]; } - (void)setSOCKS5Host: (OFString*)host { OF_SETTER(SOCKS5Host, host, YES, YES) } - (OFString*)SOCKS5Host |
︙ | ︙ |