Index: src/OFHTTPClient.h ================================================================== --- src/OFHTTPClient.h +++ src/OFHTTPClient.h @@ -99,11 +99,11 @@ * @param request The request for which the headers and status code have been * received */ - (void)client: (OFHTTPClient *)client didReceiveHeaders: (OFDictionary OF_GENERIC(OFString *, OFString *) *)headers - statusCode: (int)statusCode + statusCode: (short)statusCode request: (OFHTTPRequest *)request; /** * @brief A callback which is called when an OFHTTPClient wants to follow a * redirect. @@ -128,11 +128,11 @@ * @param response The response indicating the redirect * @return A boolean whether the OFHTTPClient should follow the redirect */ - (bool)client: (OFHTTPClient *)client shouldFollowRedirect: (OFURL *)URL - statusCode: (int)statusCode + statusCode: (short)statusCode request: (OFHTTPRequest *)request response: (OFHTTPResponse *)response; @end /** Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -60,11 +60,11 @@ OFHTTPClient *_client; OFHTTPRequest *_request; unsigned int _redirects; bool _firstLine; OFString *_version; - int _status; + short _status; OFMutableDictionary OF_GENERIC(OFString *, OFString *) *_serverHeaders; } - (instancetype)initWithClient: (OFHTTPClient *)client request: (OFHTTPRequest *)request @@ -239,11 +239,11 @@ str++; } } static bool -defaultShouldFollow(of_http_request_method_t method, int statusCode) +defaultShouldFollow(of_http_request_method_t method, short statusCode) { bool follow; /* * 301, 302 and 307 should only redirect with user confirmation if the @@ -469,11 +469,11 @@ status = [line substringWithRange: of_range(9, 3)].longLongValue; if (status < 0 || status > 599) @throw [OFInvalidServerReplyException exception]; - _status = (int)status; + _status = (short)status; return true; } - (bool)handleServerHeader: (OFString *)line @@ -1180,11 +1180,11 @@ request: request]; } - (void)client: (OFHTTPClient *)client didReceiveHeaders: (OFDictionary OF_GENERIC(OFString *, OFString *) *)headers - statusCode: (int)statusCode + statusCode: (short)statusCode request: (OFHTTPRequest *)request { if ([_delegate respondsToSelector: @selector(client:didReceiveHeaders:statusCode:request:)]) [_delegate client: client @@ -1193,11 +1193,11 @@ request: request]; } - (bool)client: (OFHTTPClient *)client shouldFollowRedirect: (OFURL *)URL - statusCode: (int)statusCode + statusCode: (short)statusCode request: (OFHTTPRequest *)request response: (OFHTTPResponse *)response { if ([_delegate respondsToSelector: @selector(client: shouldFollowRedirect:statusCode:request:response:)]) Index: src/OFHTTPResponse.m ================================================================== --- src/OFHTTPResponse.m +++ src/OFHTTPResponse.m @@ -348,15 +348,15 @@ stringByReplacingOccurrencesOfString: @"\n" withString: @"\n\t"]; ret = [[OFString alloc] initWithFormat: @"<%@:\n" - @"\tStatus code = %d\n" + @"\tStatus code = %hd\n" @"\tHeaders = %@\n" @">", self.class, _statusCode, indentedHeaders]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } @end Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -182,11 +182,11 @@ void *pool = objc_autoreleasePoolPush(); OFMutableDictionary OF_GENERIC(OFString *, OFString *) *headers; OFEnumerator *keyEnumerator, *valueEnumerator; OFString *key, *value; - [_socket writeFormat: @"HTTP/%@ %d %@\r\n", + [_socket writeFormat: @"HTTP/%@ %hd %@\r\n", self.protocolVersionString, _statusCode, of_http_status_code_to_string(_statusCode)]; headers = [[_headers mutableCopy] autorelease]; @@ -503,11 +503,11 @@ - (bool)sendErrorAndClose: (short)statusCode { OFString *date = [[OFDate date] dateStringWithFormat: @"%a, %d %b %Y %H:%M:%S GMT"]; - [_socket writeFormat: @"HTTP/1.1 %d %@\r\n" + [_socket writeFormat: @"HTTP/1.1 %hd %@\r\n" @"Date: %@\r\n" @"Server: %@\r\n" @"\r\n", statusCode, of_http_status_code_to_string(statusCode), Index: src/exceptions/OFHTTPRequestFailedException.m ================================================================== --- src/exceptions/OFHTTPRequestFailedException.m +++ src/exceptions/OFHTTPRequestFailedException.m @@ -64,9 +64,9 @@ - (OFString *)description { const char *method = of_http_request_method_to_string(_request.method); return [OFString stringWithFormat: - @"An HTTP %s request with URL %@ failed with code %d!", method, + @"An HTTP %s request with URL %@ failed with code %hd!", method, _request.URL, _response.statusCode]; } @end Index: utils/ofhttp/OFHTTP.m ================================================================== --- utils/ofhttp/OFHTTP.m +++ utils/ofhttp/OFHTTP.m @@ -604,11 +604,11 @@ } } - (bool)client: (OFHTTPClient *)client shouldFollowRedirect: (OFURL *)URL - statusCode: (int)statusCode + statusCode: (short)statusCode request: (OFHTTPRequest *)request response: (OFHTTPResponse *)response { if (_verbose) { void *pool = objc_autoreleasePoolPush(); @@ -705,11 +705,11 @@ @"url", request.URL.string, @"error", error, @"exception", e)]; } else if ([e isKindOfClass: [OFHTTPRequestFailedException class]]) { short statusCode = [[e response] statusCode]; - OFString *codeString = [OFString stringWithFormat: @"%d %@", + OFString *codeString = [OFString stringWithFormat: @"%hd %@", statusCode, of_http_status_code_to_string(statusCode)]; [of_stderr writeLine: OF_LOCALIZED(@"download_failed", @"%[prog]: Failed to download <%[url]>!\n" @" HTTP status code: %[code]", @"prog", [OFApplication programName], @@ -784,11 +784,11 @@ return true; } - (void)client: (OFHTTPClient *)client didReceiveHeaders: (OFDictionary OF_GENERIC(OFString *, OFString *) *)headers - statusCode: (int)statusCode + statusCode: (short)statusCode request: (OFHTTPRequest *)request { if (statusCode != 206) _resumedFrom = 0; @@ -795,11 +795,11 @@ if (!_quiet) { OFString *lengthString = [headers objectForKey: @"Content-Length"]; OFString *type = [headers objectForKey: @"Content-Type"]; - [of_stdout writeFormat: @" ➜ %d\n", statusCode]; + [of_stdout writeFormat: @" ➜ %hd\n", statusCode]; if (type == nil) type = OF_LOCALIZED(@"type_unknown", @"unknown"); if (lengthString != nil) {