ObjFW  Diff

Differences From Artifact [9fddf9f0fe]:

To Artifact [777126a470]:


78
79
80
81
82
83
84
85

86
87
88
89
90
91
92
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92







-
+







#ifdef OF_HAVE_BLOCKS
	if (_block != NULL)
		_block(_exception);
	else {
#endif
		if ([_delegate respondsToSelector:
		    @selector(socket:didConnectToHost:port:exception:)])
			[_delegate    socket: _socket
			[_delegate socket: _socket
			    didConnectToHost: _host
					port: _port
				   exception: _exception];
#ifdef OF_HAVE_BLOCKS
	}
#endif
}
100
101
102
103
104
105
106
107

108
109
110
111
112
113
114
115
100
101
102
103
104
105
106

107

108
109
110
111
112
113
114







-
+
-








	if (exception != nil) {
		_exception = [exception retain];
		[self didConnect];
		return;
	}

	data = [OFData dataWithItems: "\x05\x01\x00"
	data = [OFData dataWithItems: "\x05\x01\x00" count: 3];
			       count: 3];

	_SOCKS5State = OF_SOCKS5_STATE_SEND_AUTHENTICATION;
	[_socket asyncWriteData: data
		    runLoopMode: [OFRunLoop currentRunLoop].currentMode];
}

-      (bool)stream: (OFStream *)sock
144
145
146
147
148
149
150
151

152
153
154
155
156

157
158
159
160
161

162
163
164
165

166
167
168
169
170
171
172
173
143
144
145
146
147
148
149

150

151
152
153

154

155
156
157

158

159
160

161

162
163
164
165
166
167
168







-
+
-



-
+
-



-
+
-


-
+
-







			[self didConnect];
			return false;
		}

		[_request release];
		_request = [[OFMutableData alloc] init];

		[_request addItems: "\x05\x01\x00\x03"
		[_request addItems: "\x05\x01\x00\x03" count: 4];
			     count: 4];

		hostLength = (uint8_t)_host.UTF8StringLength;
		[_request addItem: &hostLength];
		[_request addItems: _host.UTF8String
		[_request addItems: _host.UTF8String count: hostLength];
			     count: hostLength];

		port[0] = _port >> 8;
		port[1] = _port & 0xFF;
		[_request addItems: port
		[_request addItems: port count: 2];
			     count: 2];

		_SOCKS5State = OF_SOCKS5_STATE_SEND_REQUEST;
		[_socket asyncWriteData: _request
		[_socket asyncWriteData: _request runLoopMode: runLoopMode];
			    runLoopMode: runLoopMode];
		return false;
	case OF_SOCKS5_STATE_READ_RESPONSE:
		response = buffer;

		if (response[0] != 5 || response[2] != 0) {
			_exception = [[OFConnectionFailedException alloc]
			    initWithHost: _host