Differences From Artifact [7077269c5c]:
- File src/OFString.m — part of check-in [ea4a43461c] at 2013-01-23 21:52:54 on branch trunk — Never compare to @"", use length instead. (user: js, size: 54291) [annotate] [blame] [check-ins using]
To Artifact [537b9ea7bb]:
- File
src/OFString.m
— part of check-in
[bdf9c4d96b]
at
2013-01-26 00:13:56
on branch trunk
— Make OFHTTPRequestReply a stream.
This also implements chunked transfer encoding for OFHTTPServer and adds
a property for the protocol version to OFHTTPRequest(Reply).Additionally, this makes it possible to add an async version of
OFHTTPClient. (user: js, size: 54660) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFOpenFileFailedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "autorelease.h" #import "macros.h" #import "of_asprintf.h" #import "unicode.h" /* | > | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFOpenFileFailedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" #import "autorelease.h" #import "macros.h" #import "of_asprintf.h" #import "unicode.h" /* |
︙ | ︙ | |||
897 898 899 900 901 902 903 | - initWithContentsOfURL: (OFURL*)URL encoding: (of_string_encoding_t)encoding { void *pool; OFHTTPClient *client; OFHTTPRequest *request; OFHTTPRequestReply *reply; | > | > | 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | - initWithContentsOfURL: (OFURL*)URL encoding: (of_string_encoding_t)encoding { void *pool; OFHTTPClient *client; OFHTTPRequest *request; OFHTTPRequestReply *reply; OFDictionary *headers; OFString *contentType, *contentLength; OFDataArray *data; Class c; c = [self class]; [self release]; pool = objc_autoreleasePoolPush(); |
︙ | ︙ | |||
924 925 926 927 928 929 930 931 932 | reply = [client performRequest: request]; if ([reply statusCode] != 200) @throw [OFHTTPRequestFailedException exceptionWithClass: [request class] request: request reply: reply]; if (encoding == OF_STRING_ENCODING_AUTODETECT && | > > | > > > > > > > | | > | 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 | reply = [client performRequest: request]; if ([reply statusCode] != 200) @throw [OFHTTPRequestFailedException exceptionWithClass: [request class] request: request reply: reply]; headers = [reply headers]; if (encoding == OF_STRING_ENCODING_AUTODETECT && (contentType = [headers objectForKey: @"Content-Type"]) != nil) { 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; data = [reply readDataArrayTillEndOfStream]; if ((contentLength = [headers objectForKey: @"Content-Length"]) != nil) if ([data count] != (size_t)[contentLength decimalValue]) @throw [OFTruncatedDataException exceptionWithClass: [self class]]; self = [[c alloc] initWithCString: (char*)[data items] encoding: encoding length: [data count]]; objc_autoreleasePoolPop(pool); return self; } - initWithSerialization: (OFXMLElement*)element { @try { void *pool = objc_autoreleasePoolPush(); |
︙ | ︙ |