Ben Copsey

HEAD requests mimic their main request again (no idea how long this has been broken)

Closes gh-47

Also fix download content length test
... ... @@ -23,7 +23,7 @@
// Automatically set on build
NSString *ASIHTTPRequestVersion = @"v1.6.2-19 2010-06-17";
NSString *ASIHTTPRequestVersion = @"v1.6.2-20 2010-06-17";
NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain";
... ... @@ -1262,6 +1262,34 @@ static BOOL isiPhoneOS2;
- (ASIHTTPRequest *)HEADRequest
{
ASIHTTPRequest *headRequest = [[self class] requestWithURL:[self url]];
// Copy the properties that make sense for a HEAD request
[headRequest setRequestHeaders:[[[self requestHeaders] copy] autorelease]];
[headRequest setRequestCookies:[[[self requestCookies] copy] autorelease]];
[headRequest setUseCookiePersistence:[self useCookiePersistence]];
[headRequest setUseKeychainPersistence:[self useKeychainPersistence]];
[headRequest setUseSessionPersistence:[self useSessionPersistence]];
[headRequest setAllowCompressedResponse:[self allowCompressedResponse]];
[headRequest setUsername:[self username]];
[headRequest setPassword:[self password]];
[headRequest setDomain:[self domain]];
[headRequest setProxyUsername:[self proxyUsername]];
[headRequest setProxyPassword:[self proxyPassword]];
[headRequest setProxyDomain:[self proxyDomain]];
[headRequest setProxyHost:[self proxyHost]];
[headRequest setProxyPort:[self proxyPort]];
[headRequest setShouldPresentAuthenticationDialog:[self shouldPresentAuthenticationDialog]];
[headRequest setShouldPresentProxyAuthenticationDialog:[self shouldPresentProxyAuthenticationDialog]];
[headRequest setTimeOutSeconds:[self timeOutSeconds]];
[headRequest setUseHTTPVersionOne:[self useHTTPVersionOne]];
[headRequest setValidatesSecureCertificate:[self validatesSecureCertificate]];
[headRequest setPACurl:[self PACurl]];
[headRequest setShouldPresentCredentialsBeforeChallenge:[self shouldPresentCredentialsBeforeChallenge]];
[headRequest setNumberOfTimesToRetryOnTimeout:[self numberOfTimesToRetryOnTimeout]];
[headRequest setShouldUseRFC2616RedirectBehaviour:[self shouldUseRFC2616RedirectBehaviour]];
[headRequest setShouldAttemptPersistentConnection:[self shouldAttemptPersistentConnection]];
[headRequest setPersistentConnectionTimeoutSeconds:[self persistentConnectionTimeoutSeconds]];
[headRequest setMainRequest:self];
[headRequest setRequestMethod:@"HEAD"];
return headRequest;
... ...
... ... @@ -536,7 +536,7 @@
ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
[request startSynchronous];
BOOL success = ([request contentLength] == 18443);
BOOL success = ([request contentLength] == 27872);
GHAssertTrue(success,@"Got wrong content length");
}
... ...