ObjFW  Check-in [50035101ae]

Overview
Comment:Enable MPTCP for OFHTTPClient and OFHTTPServer
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | mptcp
Files: files | file ages | folders
SHA3-256: 50035101aefc8473cb8af03412473c6e6d588f918afcb0be7c59695b5619b4f5
User & Date: js on 2024-10-28 21:42:06
Other Links: branch diff | manifest | tags
Context
2024-10-28
23:46
Initial MPTCP implementation for macOS/iOS Leaf check-in: 4e763857b8 user: js tags: mptcp
21:42
Enable MPTCP for OFHTTPClient and OFHTTPServer check-in: 50035101ae user: js tags: mptcp
21:35
Initial MPTCP implementation for Linux check-in: 71834180cb user: js tags: mptcp
Changes

Modified src/OFHTTPClient.m from [8f9fbbe9f5] to [78cfc99be7].

728
729
730
731
732
733
734

735
736
737
738
739
740
741
		OFTCPSocket *sock;
		uint16_t port;
		OFNumber *IRIPort;

		[_client close];

		sock = [OFTCPSocket socket];


		if ([IRI.scheme caseInsensitiveCompare: @"https"] ==
		    OFOrderedSame)
			port = 443;
		else
			port = 80;








>







728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
		OFTCPSocket *sock;
		uint16_t port;
		OFNumber *IRIPort;

		[_client close];

		sock = [OFTCPSocket socket];
		sock.usesMPTCP = true;

		if ([IRI.scheme caseInsensitiveCompare: @"https"] ==
		    OFOrderedSame)
			port = 443;
		else
			port = 80;

Modified src/OFHTTPServer.m from [db59500413] to [0f92d8dbbf].

862
863
864
865
866
867
868

869
870
871
872
873
874
875
	if (_host == nil)
		@throw [OFInvalidArgumentException exception];

	if (_listeningSocket != nil)
		@throw [OFAlreadyOpenException exceptionWithObject: self];

	_listeningSocket = [[OFTCPSocket alloc] init];

	address = [_listeningSocket bindToHost: _host port: _port];
	_port = OFSocketAddressIPPort(&address);
	[_listeningSocket listen];

#ifdef OF_HAVE_THREADS
	if (_numberOfThreads > 1) {
		OFMutableArray *threads =







>







862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
	if (_host == nil)
		@throw [OFInvalidArgumentException exception];

	if (_listeningSocket != nil)
		@throw [OFAlreadyOpenException exceptionWithObject: self];

	_listeningSocket = [[OFTCPSocket alloc] init];
	_listeningSocket.usesMPTCP = true;
	address = [_listeningSocket bindToHost: _host port: _port];
	_port = OFSocketAddressIPPort(&address);
	[_listeningSocket listen];

#ifdef OF_HAVE_THREADS
	if (_numberOfThreads > 1) {
		OFMutableArray *threads =

Modified tests/OFHTTPClientTests.m from [e9b6e1eab7] to [962f5ae8ec].

146
147
148
149
150
151
152

153
154
155
156
157
158
159
	bool sawHost = false, sawContentLength = false, sawContentType = false;
	bool sawUserAgent = false;
	char buffer[5];

	[_condition lock];

	listener = [OFTCPSocket socket];

	address = [listener bindToHost: @"127.0.0.1" port: 0];
	_port = OFSocketAddressIPPort(&address);
	[listener listen];

	[_condition signal];
	[_condition unlock];
	client = [listener accept];







>







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
	bool sawHost = false, sawContentLength = false, sawContentType = false;
	bool sawUserAgent = false;
	char buffer[5];

	[_condition lock];

	listener = [OFTCPSocket socket];
	listener.usesMPTCP = true;
	address = [listener bindToHost: @"127.0.0.1" port: 0];
	_port = OFSocketAddressIPPort(&address);
	[listener listen];

	[_condition signal];
	[_condition unlock];
	client = [listener accept];