Differences From Artifact [b1ffa26ad7]:
- File src/OFTCPSocket+SOCKS5.m — part of check-in [813c00ccf0] at 2013-01-09 22:24:47 on branch trunk — Update copyright. (user: js, size: 2406) [annotate] [blame] [check-ins using]
To Artifact [34ea1ba63e]:
- File
src/OFTCPSocket+SOCKS5.m
— part of check-in
[b96b150ce3]
at
2013-01-22 02:31:22
on branch trunk
— OFStream: Add property for writeBufferEnabled.
This also renames the getter to -[isWriteBufferEnabled]. (user: js, size: 2408) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
25 26 27 28 29 30 31 |
@implementation OFTCPSocket (SOCKS5)
- (void)OF_SOCKS5ConnectToHost: (OFString*)host
port: (uint16_t)port
{
const char request[] = { 5, 1, 0, 3 };
char reply[256];
| | | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
@implementation OFTCPSocket (SOCKS5)
- (void)OF_SOCKS5ConnectToHost: (OFString*)host
port: (uint16_t)port
{
const char request[] = { 5, 1, 0, 3 };
char reply[256];
BOOL wasWriteBufferEnabled;
/* 5 1 0 -> no authentication */
[self writeBuffer: request
length: 3];
[self readIntoBuffer: reply
exactLength: 2];
if (reply[0] != 5 || reply[1] != 0) {
[self close];
@throw [OFConnectionFailedException
exceptionWithClass: [self class]
socket: self
host: host
port: port];
}
wasWriteBufferEnabled = [self isWriteBufferEnabled];
[self setWriteBufferEnabled: YES];
/* CONNECT request */
[self writeBuffer: request
length: 4];
[self writeInt8: [host UTF8StringLength]];
[self writeBuffer: [host UTF8String]
length: [host UTF8StringLength]];
[self writeBigEndianInt16: port];
[self flushWriteBuffer];
[self setWriteBufferEnabled: wasWriteBufferEnabled];
[self readIntoBuffer: reply
exactLength: 4];
if (reply[0] != 5 || reply[1] != 0 || reply[2] != 0) {
[self close];
@throw [OFConnectionFailedException
|
| ︙ | ︙ |