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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
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
110
111
112
113
114
115
|
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
|
@throw [OFInvalidArgumentException exception];
}
@implementation OFHTTPRequest
@synthesize URL = _URL, method = _method, headers = _headers;
+ (instancetype)request
{
return [[[self alloc] init] autorelease];
}
+ (instancetype)requestWithURL: (OFURL *)URL
{
return [[[self alloc] initWithURL: URL] autorelease];
}
- (instancetype)init
- (instancetype)initWithURL: (OFURL *)URL
{
self = [super init];
@try {
_URL = [URL copy];
_method = OFHTTPRequestMethodGet;
_protocolVersion.major = 1;
_protocolVersion.minor = 1;
_method = OFHTTPRequestMethodGet;
_protocolVersion.major = 1;
_protocolVersion.minor = 1;
return self;
}
- (instancetype)initWithURL: (OFURL *)URL
{
self = [self init];
@try {
_URL = [URL copy];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (void)dealloc
{
[_URL release];
[_headers release];
[super dealloc];
|
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
-
+
-
|
return &_remoteAddress;
return NULL;
}
- (id)copy
{
OFHTTPRequest *copy = [[OFHTTPRequest alloc] init];
OFHTTPRequest *copy = [[OFHTTPRequest alloc] initWithURL: _URL];
@try {
copy->_method = _method;
copy->_protocolVersion = _protocolVersion;
copy.URL = _URL;
copy.headers = _headers;
copy.remoteAddress = self.remoteAddress;
} @catch (id e) {
[copy release];
@throw e;
}
|