Skip to content

Agent changes to use HTTP 1.1 on Linux and OSX - #1970

Merged
Tingluo Huang (TingluoHuang) merged 4 commits into
microsoft:masterfrom
juliobbv:users/juliobv/useHttp11Linux
Nov 20, 2018
Merged

Tingluo Huang (TingluoHuang) merged 4 commits into
microsoft:masterfrom
juliobbv:users/juliobv/useHttp11Linux

Conversation

@juliobbv

@juliobbv Julio Barba (juliobbv) commented Nov 13, 2018 •

Copy link
Copy Markdown
Contributor

The .NET Core 2.1 runtime switched its HTTP default from HTTP 1.1 to HTTP 2.
This causes problems with some versions of the Curl handler.
See https://github.com/dotnet/corefx/issues/32376 for more details.

protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
#if OS_LINUX
request.Version = HttpVersion.Version11;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think we need this, this is still using the vsshttpmessagehandler

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let me double check. I introduced this code back from when I took the original approach of specifying the version when getting the HTTP client.

@juliobbv Julio Barba (juliobbv) Nov 13, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This override is not needed now. Removed.

CancellationToken cancellationToken)
{
#if OS_LINUX
request.Version = HttpVersion.Version11;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about this, check where HttpRetryOnTimeoutMessageHandler was added.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this handler is configured independently, and never calls the VSS handler. I'll keep the override in this case.

Comment thread src/Agent.Sdk/Util/VssUtil.cs Outdated

VssClientHttpRequestSettings.Default.UserAgent = headerValues;
VssClientHttpRequestSettings.Default.ClientCertificateManager = clientCert;
#if OS_LINUX

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about OSX?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does OSX also use Curl as the HTTP request backend? If so, I'm good with including OSX as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://spin.atomicobject.com/2017/09/28/net-core-osx-libcurl-openssl/

OSX does use Curl as the backend. I'll update the condition.

@juliobbv Julio Barba (juliobbv) changed the title Agent changes to use HTTP 1.1 on Linux Agent changes to use HTTP 1.1 on Linux and OSX Nov 13, 2018
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra stuff. :D

@TingluoHuang

Copy link
Copy Markdown
Contributor

Julio Barba (@juliobbv) i build vss-api 0.5.88-private from master for you.
https://dev.azure.com/mseng/AzureDevOps/_build/results?buildId=7760026&view=logs

@juliobbv

Copy link
Copy Markdown
Contributor Author

Tingluo Huang (@TingluoHuang) thanks Ting! I'll update my PR tomorrow to consume the new bits.

Comment thread src/Agent.Plugins/GitSourceProvider.cs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we need ToString()?

@juliobbv Julio Barba (juliobbv) Nov 20, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ToString() is needed to react to the changes Zac made where the Endpoint.Name is now an ExpressionValue<string> instead of string. I synced up with Zac, and this is the preferred way to get the resolved name.

Comment thread src/Agent.Worker/Build/BuildServer.cs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have to remove this?

@juliobbv Julio Barba (juliobbv) Nov 20, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UpdateBuildAsync() overload with the projectId and buildId parameters passed in is now deprecated (I got a build warning alerting me of this fact).

The new overload reads projectIdand buildId from the build object, which we're already doing in the code anyways, so there's effectively no functional change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i worried about back compat, latest client talk to TFS2017, double check with Build Team, make sure their client is back compat.

Comment thread src/Agent.Sdk/Util/VssUtil.cs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

search for InitializeVssConnection, there might be 2 more places we need to change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You were right. I updated those two places to also specify UseHttp11

@TingluoHuang
Tingluo Huang (TingluoHuang) merged commit d3d62d8 into microsoft:master Nov 20, 2018
@juliobbv

Copy link
Copy Markdown
Contributor Author

Hey Tingluo Huang (@TingluoHuang), thanks for merging my PR! 😄

@juliobbv
Julio Barba (juliobbv) deleted the users/juliobv/useHttp11Linux branch November 27, 2018 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants