HEAD requests mimic their main request again (no idea how long this has been broken)
Closes gh-47 Also fix download content length test
Showing
2 changed files
with
30 additions
and
2 deletions
| @@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | // Automatically set on build | 25 | // Automatically set on build |
| 26 | -NSString *ASIHTTPRequestVersion = @"v1.6.2-19 2010-06-17"; | 26 | +NSString *ASIHTTPRequestVersion = @"v1.6.2-20 2010-06-17"; |
| 27 | 27 | ||
| 28 | NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain"; | 28 | NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain"; |
| 29 | 29 | ||
| @@ -1262,6 +1262,34 @@ static BOOL isiPhoneOS2; | @@ -1262,6 +1262,34 @@ static BOOL isiPhoneOS2; | ||
| 1262 | - (ASIHTTPRequest *)HEADRequest | 1262 | - (ASIHTTPRequest *)HEADRequest |
| 1263 | { | 1263 | { |
| 1264 | ASIHTTPRequest *headRequest = [[self class] requestWithURL:[self url]]; | 1264 | ASIHTTPRequest *headRequest = [[self class] requestWithURL:[self url]]; |
| 1265 | + | ||
| 1266 | + // Copy the properties that make sense for a HEAD request | ||
| 1267 | + [headRequest setRequestHeaders:[[[self requestHeaders] copy] autorelease]]; | ||
| 1268 | + [headRequest setRequestCookies:[[[self requestCookies] copy] autorelease]]; | ||
| 1269 | + [headRequest setUseCookiePersistence:[self useCookiePersistence]]; | ||
| 1270 | + [headRequest setUseKeychainPersistence:[self useKeychainPersistence]]; | ||
| 1271 | + [headRequest setUseSessionPersistence:[self useSessionPersistence]]; | ||
| 1272 | + [headRequest setAllowCompressedResponse:[self allowCompressedResponse]]; | ||
| 1273 | + [headRequest setUsername:[self username]]; | ||
| 1274 | + [headRequest setPassword:[self password]]; | ||
| 1275 | + [headRequest setDomain:[self domain]]; | ||
| 1276 | + [headRequest setProxyUsername:[self proxyUsername]]; | ||
| 1277 | + [headRequest setProxyPassword:[self proxyPassword]]; | ||
| 1278 | + [headRequest setProxyDomain:[self proxyDomain]]; | ||
| 1279 | + [headRequest setProxyHost:[self proxyHost]]; | ||
| 1280 | + [headRequest setProxyPort:[self proxyPort]]; | ||
| 1281 | + [headRequest setShouldPresentAuthenticationDialog:[self shouldPresentAuthenticationDialog]]; | ||
| 1282 | + [headRequest setShouldPresentProxyAuthenticationDialog:[self shouldPresentProxyAuthenticationDialog]]; | ||
| 1283 | + [headRequest setTimeOutSeconds:[self timeOutSeconds]]; | ||
| 1284 | + [headRequest setUseHTTPVersionOne:[self useHTTPVersionOne]]; | ||
| 1285 | + [headRequest setValidatesSecureCertificate:[self validatesSecureCertificate]]; | ||
| 1286 | + [headRequest setPACurl:[self PACurl]]; | ||
| 1287 | + [headRequest setShouldPresentCredentialsBeforeChallenge:[self shouldPresentCredentialsBeforeChallenge]]; | ||
| 1288 | + [headRequest setNumberOfTimesToRetryOnTimeout:[self numberOfTimesToRetryOnTimeout]]; | ||
| 1289 | + [headRequest setShouldUseRFC2616RedirectBehaviour:[self shouldUseRFC2616RedirectBehaviour]]; | ||
| 1290 | + [headRequest setShouldAttemptPersistentConnection:[self shouldAttemptPersistentConnection]]; | ||
| 1291 | + [headRequest setPersistentConnectionTimeoutSeconds:[self persistentConnectionTimeoutSeconds]]; | ||
| 1292 | + | ||
| 1265 | [headRequest setMainRequest:self]; | 1293 | [headRequest setMainRequest:self]; |
| 1266 | [headRequest setRequestMethod:@"HEAD"]; | 1294 | [headRequest setRequestMethod:@"HEAD"]; |
| 1267 | return headRequest; | 1295 | return headRequest; |
| @@ -536,7 +536,7 @@ | @@ -536,7 +536,7 @@ | ||
| 536 | ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; | 536 | ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; |
| 537 | [request startSynchronous]; | 537 | [request startSynchronous]; |
| 538 | 538 | ||
| 539 | - BOOL success = ([request contentLength] == 18443); | 539 | + BOOL success = ([request contentLength] == 27872); |
| 540 | GHAssertTrue(success,@"Got wrong content length"); | 540 | GHAssertTrue(success,@"Got wrong content length"); |
| 541 | } | 541 | } |
| 542 | 542 |
-
Please register or login to post a comment