Skip to content

Commit 05c63b0

Browse files
committed
http: only wait for headers in HEAD calls
Speed up HTTP HEAD calls made via the HeadAsync extension method by only waiting until the headers have been received, rather than the entire message content.
1 parent 613d894 commit 05c63b0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/shared/Microsoft.Git.CredentialManager/HttpClientExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static Task<HttpResponseMessage> HeadAsync(this HttpClient client, string
1717

1818
public static Task<HttpResponseMessage> HeadAsync(this HttpClient client, Uri requestUri)
1919
{
20-
return client.HeadAsync(requestUri, HttpCompletionOption.ResponseContentRead);
20+
return client.HeadAsync(requestUri, HttpCompletionOption.ResponseHeadersRead);
2121
}
2222

2323
public static Task<HttpResponseMessage> HeadAsync(this HttpClient client, string requestUri, HttpCompletionOption completionOption)
@@ -37,7 +37,7 @@ public static Task<HttpResponseMessage> HeadAsync(this HttpClient client, string
3737

3838
public static Task<HttpResponseMessage> HeadAsync(this HttpClient client, Uri requestUri, CancellationToken cancellationToken)
3939
{
40-
return client.HeadAsync(requestUri, HttpCompletionOption.ResponseContentRead, cancellationToken);
40+
return client.HeadAsync(requestUri, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
4141
}
4242

4343
public static Task<HttpResponseMessage> HeadAsync(this HttpClient client, string requestUri, HttpCompletionOption completionOption, CancellationToken cancellationToken)

0 commit comments

Comments
 (0)