Overview
Comment: | OFURL: Include the / in the path for http(s). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
3d041cd4bfe8830f5894c29771e08907 |
User & Date: | js on 2011-02-27 00:09:04 |
Other Links: | manifest | tags |
Context
2011-02-27
| ||
00:35 | Rename -[result] to -[perform] in OFHTTPRequest. check-in: 53213f1d41 user: js tags: trunk | |
00:09 | OFURL: Include the / in the path for http(s). check-in: 3d041cd4bf user: js tags: trunk | |
2011-02-26
| ||
19:40 | Use class swizzling as an optimization. check-in: 06f539766f user: js tags: trunk | |
Changes
Modified src/OFHTTPRequest.m from [238deadfe5] to [f906f98e49].
︙ | ︙ | |||
151 152 153 154 155 156 157 | 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"; | | | | | | 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]]; |
︙ | ︙ |
Modified src/OFURL.m from [dd90f55a48] to [77a2a36083].
︙ | ︙ | |||
195 196 197 198 199 200 201 | if ((tmp = strchr(str_c, ';')) != NULL) { *tmp = '\0'; parameters = [[OFString alloc] initWithCString: tmp + 1]; } | | | > | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | if ((tmp = strchr(str_c, ';')) != NULL) { *tmp = '\0'; parameters = [[OFString alloc] initWithCString: tmp + 1]; } path = [[OFString alloc] initWithFormat: @"/%s", str_c]; } else path = @""; } @catch (id e) { [self release]; @throw e; } @finally { free(str_c2); } |
︙ | ︙ | |||
250 251 252 253 254 255 256 | if ((tmp = strchr(str_c, ';')) != NULL) { *tmp = '\0'; parameters = [[OFString alloc] initWithCString: tmp + 1]; } if (*str_c == '/') | | | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | if ((tmp = strchr(str_c, ';')) != NULL) { *tmp = '\0'; parameters = [[OFString alloc] initWithCString: tmp + 1]; } if (*str_c == '/') path = [[OFString alloc] initWithCString: str_c]; else { OFAutoreleasePool *pool; OFString *s; pool = [[OFAutoreleasePool alloc] init]; if ([url->path hasSuffix: @"/"]) |
︙ | ︙ | |||
435 436 437 438 439 440 441 | - (OFString*)path { return [[path copy] autorelease]; } - (void)setPath: (OFString*)path_ { | | > > > > > > > | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | - (OFString*)path { return [[path copy] autorelease]; } - (void)setPath: (OFString*)path_ { OFString *old; if (([scheme isEqual: @"http"] || [scheme isEqual: @"https"]) && ![path_ hasPrefix: @"/"]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; old = path; path = [path_ copy]; [old release]; } - (OFString*)parameters { return [[parameters copy] autorelease]; |
︙ | ︙ | |||
501 502 503 504 505 506 507 | if (([scheme isEqual: @"http"] && port == 80) || ([scheme isEqual: @"https"] && port == 443)) needPort = NO; if (needPort) [desc appendFormat: @":%d", port]; | < | | 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | if (([scheme isEqual: @"http"] && port == 80) || ([scheme isEqual: @"https"] && port == 443)) needPort = NO; if (needPort) [desc appendFormat: @":%d", port]; [desc appendString: path]; if (parameters != nil) [desc appendFormat: @";%@", parameters]; if (query != nil) [desc appendFormat: @"?%@", query]; |
︙ | ︙ |
Modified tests/OFURLTests.m from [8cc6f93e13] to [239dafd02e].
︙ | ︙ | |||
61 62 63 64 65 66 67 | [[u1 scheme] isEqual: @"http"] && [[u4 scheme] isEqual: @"file"]) TEST(@"-[user]", [[u1 user] isEqual: @"u"] && [u4 user] == nil) TEST(@"-[password]", [[u1 password] isEqual: @"p"] && [u4 password] == nil) TEST(@"-[host]", [[u1 host] isEqual: @"h"] && [u4 port] == 0) TEST(@"-[port]", [u1 port] == 1234) TEST(@"-[path]", | | | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | [[u1 scheme] isEqual: @"http"] && [[u4 scheme] isEqual: @"file"]) TEST(@"-[user]", [[u1 user] isEqual: @"u"] && [u4 user] == nil) TEST(@"-[password]", [[u1 password] isEqual: @"p"] && [u4 password] == nil) TEST(@"-[host]", [[u1 host] isEqual: @"h"] && [u4 port] == 0) TEST(@"-[port]", [u1 port] == 1234) TEST(@"-[path]", [[u1 path] isEqual: @"/f"] && [[u4 path] isEqual: @"/etc/passwd"]) TEST(@"-[parameters]", [[u1 parameters] isEqual: @"p"] && [u4 parameters] == nil) TEST(@"-[query]", [[u1 query] isEqual: @"q"] && [u4 query] == nil) TEST(@"-[fragment]", [[u1 fragment] isEqual: @"f"] && [u4 fragment] == nil) TEST(@"-[copy]", R(u4 = [[u1 copy] autorelease])) |
︙ | ︙ |