Commit Graph
2033 Commits
Author SHA1 Message Date
Stephen Toub 43b2241491 Change DiagnosticsHandler to special-case base cancellation exception (dotnet/corefx#38601)
It should be treating all OperationCanceledExceptions as cancellation, not just TaskCanceledException.

Commit migrated from https://github.com/dotnet/corefx/commit/dd6b0669bec5ac3b72b2b3a015f42c403c3ec0f1
2019-06-17 16:25:23 -04:00
Viktor Hofer 5f98ba6a2b Enable project restore for test projects (dotnet/corefx#38151)
* Factor out repo restore into seperate props/targets

* Use configuration system msbuild sdk

* Remove XUnit.Runtime.depproj

* Remove TargetGroup usages in test projects

* Fix ILLink configuration

The ILLink package contains netcoreapp2.0 assets which are compatible
with netstandard2.0. Removing the old TargetFramework to restore
successfully.

* Remove usages from TargetGroup in Directory.Build.props

* Remove dead net4* configurations

* Change tests.builds to tests.proj sdk proj

* Make externals dir proj an sdk project

* Consume Microsoft.DotNet.CoreFxTesting as an msbuild sdk

* Use runtimeconfig.template.json

* Remove SupplementalTestData

* Map shared framework version to product version

* Stop binplacing tests

* Move some tool depprojs to targets during restore

* Remove dead code

* Use PackageReference instead of RefFromRuntime in test

* Disable using an apphost

* Copy compression testdata manually cause unicode bug

* Remove target batching in optimizationData

* Reference packaging tools from CoreFx.Private.TestUtilities


Commit migrated from https://github.com/dotnet/corefx/commit/c4c1985531cc1f25c805bbc4801b85c98e0dfee0
2019-06-15 21:27:13 +02:00
Cory Nelson ae79b2383f HPACK fixes and tests (dotnet/corefx#38324)
* HPACK correctness tests/updates. Resolves dotnet/corefx#31316.

Fixes:
- Fix check allowing out-of-bounds write in IntegerEncoder when an integer requires more than one byte and there is not enough buffer space.
- Encode Content-Type with a "Literal Header Without Indexing -- Indexed Name" rather than with a literal name.

Updates: (ported from ASP.NET HPACK code)
- Dynamic table size update must be the first instruction in the header block. Throw an exception when not the case.
- Throw an exception when we've reached the end of header data and we are still mid-parse.

New:
- Asserts, documentation, and tests for IntegerEncoder and IntegerDecoder.
- Tests to verify HttpClient is correctly encoding the different variants of headers.
- HPackDecoder tests (ported from ASP.NET)

* Address review feedback and fix CI.

* Address review feedback.

* Fix licensing to use ASP.NET's licensing. Add a TPN.


Commit migrated from https://github.com/dotnet/corefx/commit/ed526597f3f0d4653588ba0129fcaf18e2e5a4ef
2019-06-12 09:46:28 -07:00
David Shulman 78c12983dd Use HTTP Host header for Kerberos auth SPN calculation (dotnet/corefx#38465)
Fixed SocketsHttpHandler so that it will use the request's Host header,
if present, as part of building the Service Principal Name (SPN) when
doing Kerberos authentication. This now matches .NET Framework behavior.

Contributes to dotnet/corefx#34697 and dotnet/corefx#27745

Commit migrated from https://github.com/dotnet/corefx/commit/6cb854630083aac733d5b8001b266b872b56748e
2019-06-11 19:53:55 -07:00
Stephen Toub c61ef9bace Change EstablishConnectionAndProcessOneRequestAsync test method to use WhenAllOrAnyFailed (dotnet/corefx#38462)
* Change EstablishConnectionAndProcessOneRequestAsync test method to use WhenAllOrAnyFailed

CI is currently hanging when the client operation fails in a way that the server never hears about the request, and waits forever.

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/0b5479dde70fc565c5edefac4259578865496e84
2019-06-11 13:01:14 -07:00
Cory Nelson 13097de229 Resolves dotnet/corefx#37250. Re-enable tests that dotnet/corefx#38038 resolved. (dotnet/corefx#38461)
Commit migrated from https://github.com/dotnet/corefx/commit/5f5925c0c1a3a87e870db36ca6acce81dedf3bc9
2019-06-11 11:11:16 -07:00
Stephen Toub 5636b5e703 Add debug state machine tracking to GoAwayFrame_NoPendingStreams_ConnectionClosed test (dotnet/corefx#38438)
Commit migrated from https://github.com/dotnet/corefx/commit/0b0df51dab6f641e2988846dd6913de2db30789c
2019-06-10 20:22:05 -07:00
Liudmila Molkova 78938b4b54 Fix review comments in dotnet/corefx#38280 (dotnet/corefx#38406)
Commit migrated from https://github.com/dotnet/corefx/commit/6d37591d13dd58abc90b7f15b707f605e809be29
2019-06-10 19:09:37 -07:00
Liudmila Molkova 4541251707 Enable tracing context propagation without listener in presence of parent Activity (dotnet/corefx#38280)
* Enable tracing context propagation without listener in presence of parent Activity
* tests for AppContext switch


Commit migrated from https://github.com/dotnet/corefx/commit/35ebd462cc03bddc7ac135b7ec218ebd8357f7b2
2019-06-08 18:55:56 -07:00
Krzysztof Wicher a5b8971c8d HttpClient: Try decode Location header using UTF-8 (dotnet/corefx#37852)
* Use desktop logic for parsing Location (try decode using UTF-8)

* Tests and feedback

* fix netfx

* Convert UTF-8 in non-allocating way without try .. catch


Commit migrated from https://github.com/dotnet/corefx/commit/02026907370c57380a9f091b54ee77873f276a68
2019-06-07 14:38:02 -07:00
Stephen Toub b585c84595 Add debug data to help diagnose HTTP2 test failure (dotnet/corefx#38345)
The GoAwayFrame_AbortAllPendingStreams_StreamFailWithExpectedException test has been frequently hanging on some Linux distros.  This adds some diagnostics to help track it down in CI: every minute, it'll dump out the fields of the async state machine, which if nothing else will let us see which await it's stuck on and what is the state of each of the tasks.

Commit migrated from https://github.com/dotnet/corefx/commit/410a162f68eb319e8066ac7bf2d7bcd6e2ce47d0
2019-06-07 16:09:38 -04:00
Marco Rossignoli bdc76b180d Fix digest authentication on SocketsHttpHandler (dotnet/corefx#38225)
* fix digest

* improve test

* address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/94c5f1384c9b6477d164050de964cf6dcf99b2a9
2019-06-05 11:33:31 -07:00
Martin Baulig 0b774e783c HttpClient.SendAsync() should not attempt to read response body on a HEAD or PUT request. (dotnet/corefx#38129)
* HttpClient.SendAsync() should not attempt to read response body on a HEAD or PUT request.

* Update HttpMethod.cs

* Address feedback.

* Cleanup.

* Update HttpRequestMessageTest.cs


Commit migrated from https://github.com/dotnet/corefx/commit/73e610f847f9c5100a0cec4a80692969836ff35d
2019-06-04 16:52:27 -04:00
Stephen Toub fc7622a806 Fix catch block for cancellation in ConnectHelper.ConnectAsync (dotnet/corefx#38211)
There are logic errors in ConnectHelper's catch blocks regarding cancellation.  It's catching all exceptions and then trying to decide whether it should wrap the exception in an OperationCanceledException (based on whether cancellation was requested), but it's ignoring the possibility that the exception already is an OperationCanceledException.

Commit migrated from https://github.com/dotnet/corefx/commit/80252bbc5cf2f933aef1f30d6bec7deaa3064f54
2019-06-04 16:03:25 -04:00
Stephen ToubandDavid Shulman c09abb97ba Change use of AllowRenegotiation in HttpConnectionPool (dotnet/corefx#38127)
* Change use of AllowRenegotation in HttpConnectionPool

* Address PR feedback

Fix typos in comments

Co-Authored-By: David Shulman <[email protected]>


Commit migrated from https://github.com/dotnet/corefx/commit/cada442a1385e4ecaf9139eb9f98e522776043e2
2019-06-01 15:27:50 -04:00
Tomas Weinfurt 031db203d9 add support for 100-continue for H/2 (dotnet/corefx#36884)
* expect100

* updates

* remove dead code

* fix tests

* use configured value for allowExpect100ToContinue timer

* feedback from review

* dispose expect100Timer

* feedback from review

* feedback from review

* feedback from review

* small updates to sync up with master changes

* add concurent send/recive and more tests

* fix netfx

* feedback from review

* feedback from review

* feedback from review

* feedback from review

* feedback from review

* kick ci


Commit migrated from https://github.com/dotnet/corefx/commit/b4fa2006c2e9757e4446e3fdad413bdbf265eedc
2019-05-31 14:39:12 -07:00
dotnet-maestro[bot] 10f72f160b [master] Update dependencies from dotnet/coreclr (dotnet/corefx#38099)
* Update dependencies from https://github.com/dotnet/coreclr build 20190530.2

- Microsoft.NET.Sdk.IL - 3.0.0-preview6.19280.2
- Microsoft.NETCore.ILAsm - 3.0.0-preview6.19280.2
- Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-preview6.19280.2

* Expose, test, and use Environment.TickCount64

* Back out change to WinInetProxyHelper.cs


Commit migrated from https://github.com/dotnet/corefx/commit/06f25eaa8592b49c65373d0cdcbdac9a4bdf0f35
2019-05-31 13:25:15 -07:00
Viktor Hofer b661c58b1c Replace netstandard test projects with tfms
Netstandard test projects are broken by design and don't support the
Microsoft.Net.Test.SDK. Replacing the netstandard tfm with the concrete
implementation tfms.


Commit migrated from https://github.com/dotnet/corefx/commit/d29c16c99c6045ee67444a7a693dd4476861c463
2019-05-30 16:18:41 +02:00
Tomas Weinfurt 06b43bd28e Enable MaxConnectionsPerServer_WaitingConnectionsAreCancelable again (dotnet/corefx#37933)
* enable MaxConnectionsPerServer_WaitingConnectionsAreCancelable afain

* skip with curl handler


Commit migrated from https://github.com/dotnet/corefx/commit/c6fc43c6f2b92d8e13a444217f29368159e015eb
2019-05-29 19:33:18 -07:00
Stephen Toub ec22adc0cb Remove SSL cancellation workaround from SocketsHttpHandler (dotnet/corefx#37990)
Both sockets cancellation and SslStream auth cancellation have been implemented.

Commit migrated from https://github.com/dotnet/corefx/commit/46800900077920534038be00d7bc73236e1a5fa7
2019-05-29 11:30:52 -04:00
Marco Rossignoli dbb09e4ab9 User-Agent header is ignored in "CONNECT" requests (dotnet/corefx#37785)
* flow UserAgent on CONNECT

* Apply Stephen feedback

* address PR feedback

* update test

* fix style


Commit migrated from https://github.com/dotnet/corefx/commit/1064d0352c007fd2d8fb32d7f6e286fbb6d41264
2019-05-28 09:36:25 -07:00
Tomas Weinfurt ed528dcdcb Move tests with external servers to outerloop (dotnet/corefx#37934)
* move tests with external servers to outerloop

* fix Set_ValidValues_Success


Commit migrated from https://github.com/dotnet/corefx/commit/d58a8ade31b4731759c92df00d0f6398c52f3d83
2019-05-27 14:48:04 -07:00
Viktor Hofer ba11d53cc1 Use Arcade DotNetTool and NuGetPackageRoot (dotnet/corefx#37647)
* Use Arcade props

* Use global dotnet if applicable

Commit migrated from https://github.com/dotnet/corefx/commit/f42e04b8d4be76b1818cf263ff06234d0e25ada0
2019-05-17 03:39:21 +02:00
Stephen Toub 377c37c140 Use CancellationToken.UnsafeRegister in a few more places (dotnet/corefx#37551)
CancellationToken.Register captures the current ExecutionContext and uses it to invoke the callback if/when it's invoked.  That's generally desirable and is the right default, but in cases where we know for certain the callback doesn't care about EC (e.g. we're not invoking any 3rd-party code), we can use UnsafeRegister instead (newly added in 3.0), which skips capturing the ExecutionContext, as if Capture returned null.  This helps few a couple of small costs:
- Avoids thread local lookups to capture the current EC.
- Avoids additional delegate invocations and thread local gets/sets to invoke the callback with the captured EC.
- Avoids holding on to the EC in case it's needed, which can potentially keep alive an unbounded amount of state due to AsyncLocals.

Commit migrated from https://github.com/dotnet/corefx/commit/b1a1bfa0997ce35e8540fbbe74276858e315807e
2019-05-16 11:08:10 -07:00
Tomas Weinfurt 936c296657 update HTTP2 responce header processing (dotnet/corefx#37572)
* update HTTP2 responce header processing

* fix also trailinbg headers


Commit migrated from https://github.com/dotnet/corefx/commit/269a37755c788252385ceec472c619e68d676032
2019-05-14 09:52:45 -07:00
Stephen Toub bae550ef90 Move UseDefaultCredentials_SetToFalseAndServerNeedsAuth_StatusCodeUnauthorized test to OuterLoop (dotnet/corefx#37556)
Commit migrated from https://github.com/dotnet/corefx/commit/ae3262aa29e860eaee9fc5d96eba539a3b4fe084
2019-05-09 17:24:57 -04:00
Stephen Toub 57fb682075 Disable PostAsyncExpect100Continue_FailsAfterContentSendStarted_Throws on non-SocketsHttpHandler (dotnet/corefx#37553)
Commit migrated from https://github.com/dotnet/corefx/commit/a010364670e9a5a8df39d3d7eac97f0e129aaaa1
2019-05-09 17:24:31 -04:00
Stephen Toub 7101ea8780 Fix unnecessary culture-aware comparisons in System.Net (dotnet/corefx#37499)
- string.IndexOf(string) and string.IndexOf(string, int) are culture-aware.  For most situations in System.Net, that's undesirable and Ordinal is both more correct and faster.
- string.IndexOf("c", StringComparison.Ordinal) is better off as string.IndexOf('c') for perf and simplicity.
- string.IndexOf('c') >= 0 is better off as string.Contains('c') for perf and simplicity.

Commit migrated from https://github.com/dotnet/corefx/commit/6acc044c36df2138d86620e2c27d3234c4fa0d3d
2019-05-08 20:24:41 -04:00
Tomas Weinfurt f6462f5a26 handle Http2Stream add/remove better (dotnet/corefx#37505)
* handle sream add/remove better

* abort connection only if it is not already disposed

* feedback from review


Commit migrated from https://github.com/dotnet/corefx/commit/184bbc41f7e51b025e7a3c041895af8d83bc6864
2019-05-08 14:28:13 -07:00
Jose Perez Rodriguez 7d8177c8c3 Fix VS Configurations for all projects in corefx (dotnet/corefx#37477)
Commit migrated from https://github.com/dotnet/corefx/commit/1c48331eb5784c58b81309665257f454abd7d322
2019-05-06 14:46:10 -07:00
Stephen Toub 9399808614 Log exceptions from asynchronously failing Expect: 100-continue sends (dotnet/corefx#37391)
* Log exceptions from asynchronously failing Expect: 100-continue sends

When Expect: 100-continue is used, the sending of the request body content is allowed to run concurrently with the receipt of the response headers.  If the processing of the response headers encounters an exception, we currently fail to ever join with that send task, which results in a TaskScheduler.UnobservedTaskException event.  This PR changes to observe the exception in such cases and log it.

(In doing so, I also came across an async void method, and changed all of the remaining ones in the assembly to be async Task instead.  The current implementation of async void isn't any cheaper than async Task, and is actually more expensive in certain ways, plus it unnecessarily interacts with any SynchronizationContext that may exist.)

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/0bc3ee4a4f1debaa0dd3c957d5201ae2a47757a1
2019-05-03 17:33:55 -04:00
Viktor Hofer 5b301aac62 Fix build break in HttpClientHandlerTest
Caused by https://github.com/dotnet/corefx/commit/dotnet/corefx@c412fa7dc60559dc38050c63b2e34b5156a2499e

Commit migrated from https://github.com/dotnet/corefx/commit/3075793b035cfa51d5b2a8aa0d388ee41faf2bf9
2019-05-03 12:23:37 +02:00
Tomas Weinfurt c5bf93e35c improve error handling on failed Http/2 handshake (dotnet/corefx#37050)
* improve error handling on failed Http/2 handshake

* remove extra space

* add test for HTTP2 client talking to HTTP1 server.

* fix broken tests

* improve exception handling

* update exception handling

* ws update

* fix bad merge

* update test and changes from dotnet/corefx#37223

* use _abortException only if the stream is not aborted already

* fix IsAborted check

* updates to syncup with recent changes


Commit migrated from https://github.com/dotnet/corefx/commit/c412fa7dc60559dc38050c63b2e34b5156a2499e
2019-05-02 23:31:53 -07:00
Tomas Weinfurt dcb8c42cc4 reject invalid pseudo-headers (dotnet/corefx#37069)
* reject invalid pseudo-headers

* feedback from review

* feedback from review

* fix typo in comment

* feedback from review

* syncup with recent changes


Commit migrated from https://github.com/dotnet/corefx/commit/1f159018b21e1f70fa2ade50d5e341f5ce457654
2019-05-02 23:23:27 -07:00
Stephen Toub 2c0c31e8e1 Fix SendAsync_No100ContinueReceived_RequestBodySentEventually test flakiness (dotnet/corefx#37371)
The server in the test was sending down the entire response and then trying to read the data from the client.  If the client sent its whole payload and read the response before the server go around to doing the read, the client might close the connection, in which case the read might fail.  The fix just changes the server code to only send down the headers, then read the data from the client, and only then finish the response, at which point it's fine if the client closes the connection.

Commit migrated from https://github.com/dotnet/corefx/commit/772aa2d1029caa8be3b360168b63dadd42ae788b
2019-05-02 14:56:19 -04:00
Stephen Toub e71767ffb2 Enable HTTP/2 in SocketsHttpHandler via HttpRequestMessage.Version (dotnet/corefx#37234)
We now respect the version: if it's 1.1, we use 1.1, and if it's 2.0, we try to use HTTP/2.  At the same time, the default for HttpRequestMessage.Version goes back to 1.1, so to use HTTP/2, you opt-in by setting the version explicitly to 2.0.

Commit migrated from https://github.com/dotnet/corefx/commit/d69d441dfb0710c2a34155c7c4745db357b14c96
2019-05-02 00:15:28 -04:00
Stephen Toub 36e9813414 Disable GetAsync_UnicodeHostName_SuccessStatusCodeInResponse test
Commit migrated from https://github.com/dotnet/corefx/commit/419a1fe5da1698ea3a380166ab70b11ab37dbde0
2019-05-02 00:12:02 -04:00
David Shulman 5ef49c6883 Implement HttpClient.DefaultProxy property (dotnet/corefx#37333)
This PR implements the new static HttpClient.DefaultProxy property which was approved
during API review.

Modify the SystemProxyInfo.ConstructSystemProxy method to a Singleton.

Modify SocketsHttpHandler to use the HttpClient.DefaultProxy property.

Rename the HttpSystemProxy class to HttpWindowsProxy.

Add some HttpClient tests for the new property.

Closes dotnet/corefx#36553


Commit migrated from https://github.com/dotnet/corefx/commit/c661db6ce2da91033671c0000afc185de1ad3fe9
2019-05-01 15:17:21 -07:00
Viktor Hofer 3c80118cf0 Publish test artifacts to AzDO (dotnet/corefx#37296)
* Publish test artifacts to AzDO

* Disable two flaky UAP tests

* Remove leftover buildconfiguration for netfx

* Disable flaky printer test

* Disable flaky PipeWriter test


Commit migrated from https://github.com/dotnet/corefx/commit/75a54c95e2d31370bf8b5024a5b68b3e83cefb2e
2019-05-01 23:48:48 +02:00
Stephen Toub da9012fbfb Disable AutomaticOrManual_DoesntFailRegardlessOfWhetherClientCertsAreAvailable test (dotnet/corefx#37339)
Commit migrated from https://github.com/dotnet/corefx/commit/07e6ac3476467af0b9825259de1cfa9487f0d9fa
2019-05-01 17:01:07 -04:00
Stephen Toub bf219ee41c Allow Http2Connection header-related processing buffers to grow (dotnet/corefx#37337)
They're currently hard-coded to have a max size.  We need to allow them to grow to deal with arbitrarily large headers. (Separately we'll want to enforce the max header size limit.)

Commit migrated from https://github.com/dotnet/corefx/commit/9bb0c8fd8865fc282ea44b67b0738ffbfef96410
2019-05-01 16:53:28 -04:00
David Shulman 3b63495bbe Internal Http SystemProxyInfo object should never be null (dotnet/corefx#37306)
In order to provide a consistent experience with the HttpClient IWebProxy objects,
the returned internal proxy object which represent the system/platform proxy settings
should never be null. If the platform's settings indicate that no proxy is being used,
then return an instance of the internal HttpNoProxy object.

Note that even if the platform settings indicate that a proxy could be used, any
particular Http request might still not go thru a proxy. The final determination of
what proxy is being used for a request is still governed by the return of the
IWebProxy.IsBypassed and IWebProxy.GetProxy methods.

Contributes to dotnet/corefx#36553


Commit migrated from https://github.com/dotnet/corefx/commit/830bf7fc0346d9453d85ad4ec726c92ac3e72998
2019-04-30 21:14:02 -07:00
Stephen Toub d59bb4ad4f Harden several SocketsHttpHandler streams against unexpected Dispose (dotnet/corefx#37299)
A few tweaks:
- We hand out the ChunkedEncodingWriteStream and ContentLengthWriteStream to an HttpContent.SerializeToStreamAsync.  If that user code disposes of the Stream, then we end up null ref'ing when we try to finish the processing.  We should instead throw a more descriptive error about the misuse.
- Make the non-pooled response streams slightly more robust against concurrent disposal (which is not a supported use, but it happens).

Commit migrated from https://github.com/dotnet/corefx/commit/422565673deb849b42f656f4a68bec791ee4bed9
2019-04-30 14:58:25 -04:00
Stephen Toub 484b1c373d Clean up HTTP/2 protocol exception handling (dotnet/corefx#37223)
* Clean up HTTP/2 protocol exception handling

- Propagate the GOAWAY and RST_STREAM error codes to the calling code via an exception.
- Propagate to the Http2Stream exceptions incurred in the Http2Connection and that result in an Abort.
- Don't Dispose of the Http2Stream before we try to Cancel it.
- Make Http2ProtocolException serializable, as we generally do that for all of our exception types.
- Add tests that verify sufficient HTTP/2 protocol details are in the exception messages.
- Clean up the error message for the exception.
- Separate the error code and exception into their own files.
- Leave Http2ProtocolException internal for now; we can expose it publicly when we design the all-up public error model for HttpClient.

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/7237da089c09531c36a2110a3bdd9ccaf7c05d77
2019-04-29 13:51:29 -04:00
David Shulman f5f0e003f1 Add proxy environment variables support for Windows (dotnet/corefx#37238)
Changed the Windows version of SocketsHttpHandler so that it will honor the same environment
variables similar to the Linux and OSX versions. If the environment variables are not set
then it reverts back to the Windows WinInet/IE settings behavior.

I added several kinds of unit and end-to-end tests to verify the SystemProxyInfo class is
making the correct choice for all the different platforms regarding whether the
HttpEnvironmentProxy or platform proxy (HttpSystemProxy for Windows and MacProxy for OSX)
is used.

Fixes dotnet/corefx#37187


Commit migrated from https://github.com/dotnet/corefx/commit/4f27d0f84c17850ef02ea7b330908fddcdf73c86
2019-04-27 17:06:35 -07:00
Stephen Toub 70589036ee Give SocketsHttpHandler more descriptive error messages (dotnet/corefx#37251)
Currently lots of parsing failures just result in an exception stating "The server returned an invalid or unrecognized response."  We can instead be more descriptive about what the problem is in most cases.

Commit migrated from https://github.com/dotnet/corefx/commit/8e551d4dc7464a465b00ac1bf9a632ea9c3bb5a1
2019-04-27 19:22:33 -04:00
Stephen Toub 32191265f4 Disable sporadically failing HttpClientHandler test (dotnet/corefx#37253)
Commit migrated from https://github.com/dotnet/corefx/commit/610fa286999c78b841e17ea0c301c0986426635d
2019-04-27 17:11:53 -04:00
Tomas Weinfurt f9cf895271 deal with empty response headers for HTTP2 (dotnet/corefx#37160)
* deal with empty response headers for HTTP2

* fix test for http1.1

* feedback from review

* feedback from review


Commit migrated from https://github.com/dotnet/corefx/commit/e95b369aa20d551cef59f7bda3aff0ddbd4119c7
2019-04-26 11:02:06 -07:00
David Shulman 4f71ca43ed Allow uppercase HTTP_PROXY and NO_PROXY variables (dotnet/corefx#37200)
This is a redo of PR dotnet/corefx#35887.

Added support for uppercase HTTP_PROXY and NO_PROXY environment variables.
The uppercase versions are being used by Docker and other tools. This now
completes the set of environment variables that are already handling both
lower and upper case variants.

Note: This HttpEnvironmentProxy class is currently only used on Linux and OSX.
It is not used on Windows yet. I do plan to add support for this to Windows
at a later time, see dotnet/corefx#37187.

Added detection of CGI environments in order to suppress using the uppercase
HTTP_PROXY environment variable. See https://httpoxy.org/

Fixed some typos in the CSPROJ of the Http Unit Tests.


Commit migrated from https://github.com/dotnet/corefx/commit/dfe7593397bf5c598548486c6cb774ebf60e9d69
2019-04-26 06:23:55 -07:00
David Shulman 42d1f38c7d Fix SocketsHttpHandler system proxy usage logic (dotnet/corefx#37153)
SocketsHttpHandler was not using the proxy bypass list specified in IE settings in cases where
there is a combination of both 'AutoDetect' and 'Manual' settings in the IE settings dialog.

SocketsHttpHandler uses WinHttpHandler's WinInetProxyHelper class as part of the HttpSystemProxy
class. But it was consuming it in an incorrect way. WinInetProxyHelper was originally written to
be used only with the rest of the WinHTTP stack for WinHttpHandler. When WinHTTP GetProxyForUrl() was returning a ProxyBypass string, HttpSystemProxy was ignoring it. It was
assuming that the string for Proxy was correct. But in cases where ProxyBypass is returned, the
Proxy string is only used if the destination uri doesn't match any of the strings in the ProxyBypass
list. That logic would normally be handled automatically by WinHttpHandler. But HttpSystemProxy
was simply discarding the ProxyBypass string returned by WinHTTP GetProxyForUrl().

In order to address this fix, I added new tests for HttpSystemProxy. I utilized the existing mock
layers for registry and WinHTTP interop that are contained in the WinHttpHandler Unit Tests. It might
seem weird to have tests for the internal HttpSystemProxy class located in the WinHttpHandler folder.
But, we already pull in the source code for WinInetProxyHelper from WinHttpHandler into the
SocketsHttpHandler compilation. Using these Unit Tests with the mocking layers allows us to test a
broad range of scenarios (registry settings and network failures) that are normally difficult to test.
I have a plan, though, to refactor the system proxy code and tests as part of implementing dotnet/corefx#36553.
That will result in the system proxy code and tests ending up in a more logical place.

Fixes dotnet/corefx#33866


Commit migrated from https://github.com/dotnet/corefx/commit/6da9a3b80c2ac56c641fa22157607860f6b9387f
2019-04-25 10:58:44 -07:00