Differences From Artifact [c322fa746c]:
- File
src/OFTCPSocket+SOCKS5.m
— part of check-in
[2ae01218ef]
at
2017-06-12 22:29:41
on branch trunk
— OFWriteFailedException: Add -[bytesWritten]
This allows retrieving the number of bytes already written before the
write failed, allowing to retry without writing data that has already
been written. (user: js, size: 4427) [annotate] [blame] [check-ins using]
To Artifact [08455d53f4]:
- File src/OFTCPSocket+SOCKS5.m — part of check-in [c8f7b90082] at 2017-07-22 20:50:27 on branch trunk — Split OFDataArray into OFData and OFMutableData (user: js, size: 4421) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
15 16 17 18 19 20 21 | */ #include "config.h" #include <errno.h> #import "OFTCPSocket+SOCKS5.h" | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | */ #include "config.h" #include <errno.h> #import "OFTCPSocket+SOCKS5.h" #import "OFData.h" #import "OFConnectionFailedException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" #import "socket_helpers.h" |
︙ | ︙ | |||
75 76 77 78 79 80 81 | @implementation OFTCPSocket (SOCKS5) - (void)OF_SOCKS5ConnectToHost: (OFString *)host port: (uint16_t)port { char request[] = { 5, 1, 0, 3 }; char reply[256]; void *pool; | | | | 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 | @implementation OFTCPSocket (SOCKS5) - (void)OF_SOCKS5ConnectToHost: (OFString *)host port: (uint16_t)port { char request[] = { 5, 1, 0, 3 }; char reply[256]; void *pool; OFMutableData *connectRequest; if ([host UTF8StringLength] > 255) @throw [OFOutOfRangeException exception]; /* 5 1 0 -> no authentication */ send_or_exception(self, _socket, request, 3); recv_exact(self, _socket, reply, 2); if (reply[0] != 5 || reply[1] != 0) { [self close]; @throw [OFConnectionFailedException exceptionWithHost: host port: port socket: self errNo: EPROTONOSUPPORT]; } /* CONNECT request */ pool = objc_autoreleasePoolPush(); connectRequest = [OFMutableData data]; [connectRequest addItems: request count: 4]; request[0] = [host UTF8StringLength]; [connectRequest addItem: request]; [connectRequest addItems: [host UTF8String] |
︙ | ︙ |