ObjFW  Check-in [7b6a706687]

Overview
Comment:OFHTTPRequest: Send a proper request in case path is nil.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7b6a706687ea87dae935591f047718f50f6aa476db60870af632241b409c465b
User & Date: js on 2011-02-25 16:05:24
Other Links: manifest | tags
Context
2011-02-26
14:23
Clean up exception descriptions a little. check-in: 29e981d99a user: js tags: trunk
2011-02-25
16:05
OFHTTPRequest: Send a proper request in case path is nil. check-in: 7b6a706687 user: js tags: trunk
15:22
Fix a stupid bug in OFHTTPRequest. check-in: 70e1297f87 user: js tags: trunk
Changes

Modified src/OFHTTPRequest.m from [063245d810] to [a6525bb066].

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]];