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]];
|
|
|
|
|
|
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]) isEqual: @""])
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]];
|