ObjFW  Check-in [e0182a3e55]

Overview
Comment:OFHTTPClient: Only retry on ECONNRESET or EPIPE.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e0182a3e55401a8a61fb8c50a0000f4c91d23ca59b3c78dd67f3bc94a68a4d93
User & Date: js on 2013-06-28 18:48:14
Other Links: manifest | tags
Context
2013-06-28
19:00
configure: Use ${host_alias}- as BIN_PREFIX. check-in: 8bdc87deae user: js tags: trunk
18:48
OFHTTPClient: Only retry on ECONNRESET or EPIPE. check-in: e0182a3e55 user: js tags: trunk
18:44
Remove useless rethrows. check-in: ee849cd073 user: js tags: trunk
Changes

Modified src/OFHTTPClient.m from [fa59054e17] to [79a0572733].

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
			  length: (size_t)length
{
	if (_atEndOfStream) {
		OFReadFailedException *e;

		e = [OFReadFailedException exceptionWithStream: self
					       requestedLength: length];

#ifndef _WIN32
		e->_errNo = ENOTCONN;
#else
		e->_errNo = WSAENOTCONN;
#endif

		@throw e;
	}

	if (!_hasContentLength && !_chunked)
		return [_socket readIntoBuffer: buffer
					length: length];








<
<

<
<
<
<







124
125
126
127
128
129
130


131




132
133
134
135
136
137
138
			  length: (size_t)length
{
	if (_atEndOfStream) {
		OFReadFailedException *e;

		e = [OFReadFailedException exceptionWithStream: self
					       requestedLength: length];


		e->_errNo = ENOTCONN;




		@throw e;
	}

	if (!_hasContentLength && !_chunked)
		return [_socket readIntoBuffer: buffer
					length: length];

433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
		[requestString appendString: @"Connection: keep-alive\r\n"];

	[requestString appendString: @"\r\n"];

	@try {
		[socket writeString: requestString];
	} @catch (OFWriteFailedException *e) {
		/* Reconnect in case a keep-alive connection timed out */
		socket = [self OF_createSocketForRequest: request];
		[socket writeString: requestString];
	} @catch (OFNotConnectedException *e) {
		/* Reconnect in case a keep-alive connection timed out */
		socket = [self OF_createSocketForRequest: request];
		[socket writeString: requestString];
	}

	if (requestType == OF_HTTP_REQUEST_TYPE_POST)
		[socket writeBuffer: [POSTData items]







|
|
|
<







427
428
429
430
431
432
433
434
435
436

437
438
439
440
441
442
443
		[requestString appendString: @"Connection: keep-alive\r\n"];

	[requestString appendString: @"\r\n"];

	@try {
		[socket writeString: requestString];
	} @catch (OFWriteFailedException *e) {
		if ([e errNo] != ECONNRESET && [e errNo] != EPIPE)
			@throw e;


		/* Reconnect in case a keep-alive connection timed out */
		socket = [self OF_createSocketForRequest: request];
		[socket writeString: requestString];
	}

	if (requestType == OF_HTTP_REQUEST_TYPE_POST)
		[socket writeBuffer: [POSTData items]

Modified src/OFStreamSocket.m from [252939c90a] to [e9adb99946].

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
		@throw [OFNotConnectedException exceptionWithSocket: self];

	if (_atEndOfStream) {
		OFReadFailedException *e;

		e = [OFReadFailedException exceptionWithStream: self
					       requestedLength: length];
#ifndef _WIN32
		e->_errNo = ENOTCONN;
#else
		e->_errNo = WSAENOTCONN;
#endif

		@throw e;
	}

	if ((ret = recv(_socket, buffer, length, 0)) < 0)
		@throw [OFReadFailedException exceptionWithStream: self
						  requestedLength: length];








<

<
<
<
<







93
94
95
96
97
98
99

100




101
102
103
104
105
106
107
		@throw [OFNotConnectedException exceptionWithSocket: self];

	if (_atEndOfStream) {
		OFReadFailedException *e;

		e = [OFReadFailedException exceptionWithStream: self
					       requestedLength: length];

		e->_errNo = ENOTCONN;




		@throw e;
	}

	if ((ret = recv(_socket, buffer, length, 0)) < 0)
		@throw [OFReadFailedException exceptionWithStream: self
						  requestedLength: length];

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
		@throw [OFNotConnectedException exceptionWithSocket: self];

	if (_atEndOfStream) {
		OFWriteFailedException *e;

		e = [OFWriteFailedException exceptionWithStream: self
						requestedLength: length];
#ifndef _WIN32
		e->_errNo = ENOTCONN;
#else
		e->_errNo = WSAENOTCONN;
#endif

		@throw e;
	}

	if (send(_socket, buffer, length, 0) < length)
		@throw [OFWriteFailedException exceptionWithStream: self
						   requestedLength: length];
}







<

<
<
<
<







118
119
120
121
122
123
124

125




126
127
128
129
130
131
132
		@throw [OFNotConnectedException exceptionWithSocket: self];

	if (_atEndOfStream) {
		OFWriteFailedException *e;

		e = [OFWriteFailedException exceptionWithStream: self
						requestedLength: length];

		e->_errNo = ENOTCONN;




		@throw e;
	}

	if (send(_socket, buffer, length, 0) < length)
		@throw [OFWriteFailedException exceptionWithStream: self
						   requestedLength: length];
}