29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#import "OFHTTPResponse.h"
#import "OFTCPSocket.h"
#import "OFTimer.h"
#import "OFAlreadyConnectedException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotConnectedException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
#import "OFWriteFailedException.h"
#import "socket_helpers.h"
#define BUFFER_SIZE 1024
|
|
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#import "OFHTTPResponse.h"
#import "OFTCPSocket.h"
#import "OFTimer.h"
#import "OFAlreadyConnectedException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotOpenException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
#import "OFWriteFailedException.h"
#import "socket_helpers.h"
#define BUFFER_SIZE 1024
|
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
- (void)lowlevelWriteBuffer: (const void*)buffer
length: (size_t)length
{
void *pool;
if (_socket == nil)
@throw [OFNotConnectedException exceptionWithSocket: self];
if (!_headersSent)
[self OF_sendHeaders];
if (!_chunked) {
[_socket writeBuffer: buffer
length: length];
|
|
|
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
- (void)lowlevelWriteBuffer: (const void*)buffer
length: (size_t)length
{
void *pool;
if (_socket == nil)
@throw [OFNotOpenException exceptionWithObject: self];
if (!_headersSent)
[self OF_sendHeaders];
if (!_chunked) {
[_socket writeBuffer: buffer
length: length];
|
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
[_socket writeBuffer: "\r\n"
length: 2];
}
- (void)close
{
if (_socket == nil)
@throw [OFNotConnectedException exceptionWithSocket: self];
if (!_headersSent)
[self OF_sendHeaders];
if (_chunked)
[_socket writeBuffer: "0\r\n\r\n"
length: 5];
|
|
|
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
[_socket writeBuffer: "\r\n"
length: 2];
}
- (void)close
{
if (_socket == nil)
@throw [OFNotOpenException exceptionWithObject: self];
if (!_headersSent)
[self OF_sendHeaders];
if (_chunked)
[_socket writeBuffer: "0\r\n\r\n"
length: 5];
|