Overview
Context
Changes
Modified src/OFHTTPRequest.h
from [3bcfe6b2bf]
to [665d821683].
︙ | | |
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
-
|
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFObject.h"
#import "OFString.h"
#import "OFHTTPCookie.h"
OF_ASSUME_NONNULL_BEGIN
@class OFURL;
@class OFDictionary OF_GENERIC(KeyType, ObjectType);
@class OFDataArray;
@class OFString;
|
︙ | | |
69
70
71
72
73
74
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
|
68
69
70
71
72
73
74
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
|
-
-
-
-
-
-
-
|
*/
@interface OFHTTPRequest: OFObject <OFCopying>
{
OFURL *_URL;
of_http_request_method_t _method;
of_http_request_protocol_version_t _protocolVersion;
OFDictionary OF_GENERIC(OFString *, OFString *) *_headers;
OFArray OF_GENERIC(OFHTTPCookie *) *_cookies;
OFDataArray *_body;
OFString *_remoteAddress;
}
/*!
* The URL of the HTTP request.
*/
@property (nonatomic, copy) OFURL *URL;
/*!
* The request method of the HTTP request.
*/
@property (nonatomic) of_http_request_method_t method;
/*!
* The headers for the HTTP request.
*/
@property OF_NULLABLE_PROPERTY (nonatomic, copy)
OFDictionary OF_GENERIC(OFString *, OFString *) *headers;
/*!
* The cookies for the HTTP request.
*/
@property OF_NULLABLE_PROPERTY (nonatomic, copy)
OFArray OF_GENERIC(OFHTTPCookie *) *cookies;
/*!
* The entity body of the HTTP request.
*/
@property OF_NULLABLE_PROPERTY (nonatomic, retain) OFDataArray *body;
/*!
* The remote address from which the request originates.
|
︙ | | |
Modified src/OFHTTPRequest.m
from [c7f95080da]
to [41b78f73e9].
︙ | | |
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
-
-
+
+
|
if (strcmp(string, "CONNECT") == 0)
return OF_HTTP_REQUEST_METHOD_CONNECT;
@throw [OFInvalidFormatException exception];
}
@implementation OFHTTPRequest
@synthesize URL = _URL, method = _method, headers = _headers;
@synthesize cookies = _cookies, body = _body, remoteAddress = _remoteAddress;
@synthesize URL = _URL, method = _method, headers = _headers, body = _body;
@synthesize remoteAddress = _remoteAddress;
+ (instancetype)request
{
return [[[self alloc] init] autorelease];
}
+ (instancetype)requestWithURL: (OFURL *)URL
|
︙ | | |
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
-
|
return self;
}
- (void)dealloc
{
[_URL release];
[_headers release];
[_cookies release];
[_body release];
[_remoteAddress release];
[super dealloc];
}
- copy
|
︙ | | |
Modified src/OFHTTPResponse.h
from [8c2cdf93f1]
to [96ba448907].
︙ | | |
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
-
-
-
-
-
-
-
-
|
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFStream.h"
#import "OFHTTPRequest.h"
#import "OFHTTPCookie.h"
OF_ASSUME_NONNULL_BEGIN
@class OFDictionary OF_GENERIC(KeyType, ObjectType);
@class OFArray OF_GENERIC(ObjectType);
/*!
* @class OFHTTPResponse OFHTTPResponse.h ObjFW/OFHTTPResponse.h
*
* @brief A class for representing an HTTP request reply as a stream.
*/
@interface OFHTTPResponse: OFStream
{
of_http_request_protocol_version_t _protocolVersion;
short _statusCode;
OFDictionary OF_GENERIC(OFString *, OFString *) *_headers;
OFArray OF_GENERIC(OFHTTPCookie *) *_cookies;
}
/*!
* The status code of the reply to the HTTP request.
*/
@property (nonatomic) short statusCode;
/*!
* The headers of the reply to the HTTP request.
*/
@property OF_NULLABLE_PROPERTY (nonatomic, copy)
OFDictionary OF_GENERIC(OFString *, OFString *) *headers;
/*!
* The cookies to set of the reply to the HTTP request.
*/
@property OF_NULLABLE_PROPERTY (nonatomic, copy)
OFArray OF_GENERIC(OFHTTPCookie *) *cookies;
/*!
* @brief Sets the protocol version of the HTTP request reply.
*
* @param protocolVersion The protocol version of the HTTP request reply
*/
- (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion;
|
︙ | | |
Modified src/OFHTTPResponse.m
from [a5f10ef207]
to [76d4694db2].
︙ | | |
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
-
|
#include "config.h"
#import "OFHTTPResponse.h"
#import "OFString.h"
#import "OFDictionary.h"
#import "OFArray.h"
#import "OFDataArray.h"
#import "OFHTTPCookie.h"
#import "OFInvalidEncodingException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"
#import "OFUnsupportedVersionException.h"
|
︙ | | |
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
-
+
-
|
ret = OF_STRING_ENCODING_AUTODETECT;
}
return ret;
}
@implementation OFHTTPResponse
@synthesize statusCode = _statusCode, headers = _headers, cookies = _cookies;
@synthesize statusCode = _statusCode, headers = _headers;
- init
{
self = [super init];
_protocolVersion.major = 1;
_protocolVersion.minor = 1;
return self;
}
- (void)dealloc
{
[_headers release];
[_cookies release];
[super dealloc];
}
- (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion
{
if (protocolVersion.major != 1 || protocolVersion.minor > 1)
|
︙ | | |