Differences From Artifact [8288fa97d2]:
- File src/OFString.m — part of check-in [b98fd10000] at 2012-12-26 19:55:26 on branch trunk — Add -[OFString stringByStandardizing(URL)Path]. (user: js, size: 46568) [annotate] [blame] [check-ins using]
To Artifact [f223cdd779]:
- File
src/OFString.m
— part of check-in
[75f187cef5]
at
2012-12-26 20:55:27
on branch trunk
— OFHTTPRequestResult -> OFHTTPRequestReply.
The class also has its own file now. (user: js, size: 46591) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #import "OFString_UTF8.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFFile.h" #import "OFURL.h" #import "OFHTTPClient.h" #import "OFHTTPRequest.h" #import "OFDataArray.h" #import "OFXMLElement.h" #import "OFHTTPRequestFailedException.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" | > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #import "OFString_UTF8.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFFile.h" #import "OFURL.h" #import "OFHTTPClient.h" #import "OFHTTPRequest.h" #import "OFHTTPRequestReply.h" #import "OFDataArray.h" #import "OFXMLElement.h" #import "OFHTTPRequestFailedException.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" |
︙ | ︙ | |||
803 804 805 806 807 808 809 | - initWithContentsOfURL: (OFURL*)URL encoding: (of_string_encoding_t)encoding { void *pool; OFHTTPClient *client; OFHTTPRequest *request; | | | | | | | | | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | - initWithContentsOfURL: (OFURL*)URL encoding: (of_string_encoding_t)encoding { void *pool; OFHTTPClient *client; OFHTTPRequest *request; OFHTTPRequestReply *reply; OFString *contentType; Class c; c = [self class]; [self release]; pool = objc_autoreleasePoolPush(); if ([[URL scheme] isEqual: @"file"]) { if (encoding == OF_STRING_ENCODING_AUTODETECT) encoding = OF_STRING_ENCODING_UTF_8; self = [[c alloc] initWithContentsOfFile: [URL path] encoding: encoding]; objc_autoreleasePoolPop(pool); return self; } client = [OFHTTPClient client]; request = [OFHTTPRequest requestWithURL: URL]; reply = [client performRequest: request]; if ([reply statusCode] != 200) @throw [OFHTTPRequestFailedException exceptionWithClass: [request class] request: request reply: reply]; if (encoding == OF_STRING_ENCODING_AUTODETECT && (contentType = [[reply headers] objectForKey: @"Content-Type"])) { contentType = [contentType lowercaseString]; if ([contentType hasSuffix: @"charset=utf-8"]) encoding = OF_STRING_ENCODING_UTF_8; if ([contentType hasSuffix: @"charset=iso-8859-1"]) encoding = OF_STRING_ENCODING_ISO_8859_1; if ([contentType hasSuffix: @"charset=iso-8859-15"]) encoding = OF_STRING_ENCODING_ISO_8859_15; if ([contentType hasSuffix: @"charset=windows-1252"]) encoding = OF_STRING_ENCODING_WINDOWS_1252; } if (encoding == OF_STRING_ENCODING_AUTODETECT) encoding = OF_STRING_ENCODING_UTF_8; self = [[c alloc] initWithCString: (char*)[[reply data] items] encoding: encoding length: [[reply data] count]]; objc_autoreleasePoolPop(pool); return self; } - initWithSerialization: (OFXMLElement*)element { |
︙ | ︙ |