127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
URL: URL];
sock = [[[of_http_request_tls_socket_class alloc] init]
autorelease];
}
@try {
OFString *line;
OFMutableDictionary *s_headers;
OFDataArray *data;
OFEnumerator *enumerator;
OFString *key;
int status;
const char *t;
|
|
|
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
URL: URL];
sock = [[[of_http_request_tls_socket_class alloc] init]
autorelease];
}
@try {
OFString *line, *path;
OFMutableDictionary *s_headers;
OFDataArray *data;
OFEnumerator *enumerator;
OFString *key;
int status;
const char *t;
|
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
if (requestType == OF_HTTP_REQUEST_TYPE_GET)
t = "GET";
if (requestType == OF_HTTP_REQUEST_TYPE_HEAD)
t = "HEAD";
if (requestType == OF_HTTP_REQUEST_TYPE_POST)
t = "POST";
if ([URL query] != nil)
[sock writeFormat: @"%s /%@?%@ HTTP/1.0\r\n",
t, [URL path], [URL query]];
else
[sock writeFormat: @"%s /%@ HTTP/1.0\r\n",
t, [URL path]];
if ([URL port] == 80)
[sock writeFormat: @"Host: %@\r\n", [URL host]];
else
[sock writeFormat: @"Host: %@:%d\r\n", [URL host],
[URL port]];
|
>
>
>
|
|
<
|
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
if (requestType == OF_HTTP_REQUEST_TYPE_GET)
t = "GET";
if (requestType == OF_HTTP_REQUEST_TYPE_HEAD)
t = "HEAD";
if (requestType == OF_HTTP_REQUEST_TYPE_POST)
t = "POST";
if ((path = [URL path]) == nil)
path = @"";
if ([URL query] != nil)
[sock writeFormat: @"%s /%@?%@ HTTP/1.0\r\n",
t, path, [URL query]];
else
[sock writeFormat: @"%s /%@ HTTP/1.0\r\n", t, path];
if ([URL port] == 80)
[sock writeFormat: @"Host: %@\r\n", [URL host]];
else
[sock writeFormat: @"Host: %@:%d\r\n", [URL host],
[URL port]];
|