Overview
Comment: | OFString+URLEncoding.m: Better RFC 1738 compliance |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
2ca121fd19709f38322174d96b2f71b1 |
User & Date: | js on 2014-07-06 11:04:40 |
Other Links: | manifest | tags |
Context
2014-07-06
| ||
11:04 | OFString+*.m: Add a few missing autorelease pools check-in: b5c8b62533 user: js tags: trunk | |
11:04 | OFString+URLEncoding.m: Better RFC 1738 compliance check-in: 2ca121fd19 user: js tags: trunk | |
2014-07-05
| ||
09:14 | OFHTTPRequest: Add -[setEntityFromString:] check-in: 5109a3e7e4 user: js tags: trunk | |
Changes
Modified src/OFString+URLEncoding.m from [4769174b17] to [3a4097c573].
︙ | ︙ | |||
42 43 44 45 46 47 48 | * @"" literal. */ if ((retCString = malloc(([self UTF8StringLength] * 3) + 1)) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: ([self UTF8StringLength] * 3) + 1]; for (i = 0; *string != '\0'; string++) { | > > > > > > | | > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | * @"" literal. */ if ((retCString = malloc(([self UTF8StringLength] * 3) + 1)) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: ([self UTF8StringLength] * 3) + 1]; for (i = 0; *string != '\0'; string++) { /* * '+' is also listed in RFC 1738, however, '+' is sometimes * interpreted as space in HTTP. Therefore always escape it to * make sure it's always interpreted correctly. */ if (!(*string & 0x80) && (isalnum((int)*string) || *string == '$' || *string == '-' || *string == '_' || *string == '.' || *string == '!' || *string == '*' || *string == '(' || *string == ')' || *string == ',')) retCString[i++] = *string; else { uint8_t high, low; high = *string >> 4; low = *string & 0x0F; |
︙ | ︙ |
Modified tests/OFStringTests.m from [3e77d0dde3] to [52259e231b].
︙ | ︙ | |||
536 537 538 539 540 541 542 | TEST(@"-[MD5Hash]", [[@"asdfoobar" MD5Hash] isEqual: @"184dce2ec49b5422c7cfd8728864db4c"]) TEST(@"-[SHA1Hash]", [[@"asdfoobar" SHA1Hash] isEqual: @"f5f81ac0a8b5cbfdc4585ec1ad32e7b3a12b9b49"]) TEST(@"-[stringByURLEncoding]", | | | 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | TEST(@"-[MD5Hash]", [[@"asdfoobar" MD5Hash] isEqual: @"184dce2ec49b5422c7cfd8728864db4c"]) TEST(@"-[SHA1Hash]", [[@"asdfoobar" SHA1Hash] isEqual: @"f5f81ac0a8b5cbfdc4585ec1ad32e7b3a12b9b49"]) TEST(@"-[stringByURLEncoding]", [[@"foo\"ba'_~$" stringByURLEncoding] isEqual: @"foo%22ba%27_%7E$"]) TEST(@"-[stringByURLDecoding]", [[@"foo%20bar%22+%24" stringByURLDecoding] isEqual: @"foo bar\" $"]) TEST(@"-[insertString:atIndex:]", (s[0] = [OFMutableString stringWithString: @"πΓΆΓΆΓΆbΓ€β¬"]) && R([s[0] insertString: @"Àâü" |
︙ | ︙ |