Repository navigation
Closed
Description
This issue is capturing feedback from the PR which copied the sources of WinHttpHandler into GitHub.
While most of the original feedback was addressed in the PR, some feedback action items are deferred and are being tracked in this issue.
- Review use of SafeWinHttpHandle. Check for leaks etc. - Tracking with dotnet/corefx#2501
- Review TODO's in code. - Done. All TODO's have separate issues.
- Consolidate use of Safe*Handle code especially SafeHandleZeroOrMinusOneIsInvalid classes - Tracking with dotnet/corefx#2501
- Optimize error handling around chain.Build(). - Done Optimize error handling around chain.Build in WinHttpHandler corefx#4910
- Optimize closures in Task related lambdas - Done WinHttpHandler uses async WinHTTP patterns corefx#3867
- Optimize use of TaskCompletionSource regarding
RequestState- Done WinHttpHandler uses async WinHTTP patterns corefx#3867 - Propagate
CancellationTokenin calls toTrySetCanceled
Fixed w/ From Feedback in issue 2149, Propagate CancellationToken in calls to TrySetCanceled: corefx#2608 - Pass
CancellationTokentoCopyToAsync- Considered butHttpContent.CopyToAsyncdoes not have an overload that takes aCancellationToken. - Consider moving
HRESULT_FROM_WIN32method to Common/Interop folder. - Done Initial commit of System.Net.WebSockets.Client. corefx#2511 - Consider change DLL import signature of
GetModuleHandleto returnSafeHandleor useGetModuleExwithGET_MODULE_HANDLE_EX_FLAG_PINorGET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT- Considered but there are no race conditions since the 'winhttp.dll' is always loaded during the use of the WinHttpHandler class. - Add UnitTests to test fix with proxy authentication and redirection for PR Fix proxy authentication handling during redirects corefx#2463
- Move duplicate code in WinHttpCertificateHelper.cs and merge with similar code used in System.Net.Security - Tracked in dotnet/corefx#14542.
- Optimize auth scheme lookups in WinHttpAuthHelper.cs - WON'T FIX.
- Register callback on cancellation token to cancel WinHTTP operation for WinHttpRequestStream, WinHttpResponseStream - Issue dotnet/corefx#8627 for WinHttpResponseStream
- Add logging for failures in classes such as WinHttpResponseParser, WinHttpResponseStream - Tracked in dotnet/corefx#7856.
- Consider refactoring cache logic from WinHttpAuthHelper into separate class and avoid out parameters - WON'T FIX.
- Optimize algorithm used in scanning client certificate list in WinHttpCertificateHelper - WON'T FIX.
- Refactor cookie handling from WinHttpHandler into separate class. - Done Fix WinHttpHandler response handling for manual cookie parsing corefx#5001
Activity
darrelmiller commentedon Jun 27, 2015
Would there be any possibility that the credential management/redirection handling/cookie management could be refactored into distinct message handlers that could be chained together?
I see a few benefits of this:
I realize that this built in code can be disabled using policies, however, it would be really nice just to be able to pull the code completely out of the request/response pipeline.
davidsh commentedon Jul 1, 2015
@darrelmiller WinHttpHandler was designed to be tightly coupled against the native Windows WinHTTP component. In addition, many of the aspects you mentioned (credentials, cookies, redirection) are woven inside WinHTTP. This design gives the maximum performance characteristics.
Regarding your questions about the
www-authenticateheader, native WinHTTP supports the standard BASIC, DIGEST, NEGOTIATE schemes. In addition, developers can also manually add 'Authorization' header to an outgoing request to deal with things like OAuth or other custom authentication patterns.davidsh commentedon Jul 1, 2015
/cc @SidharthNabar
SidharthNabar commentedon Jul 1, 2015
A small point to add to David's response -
For changing the handling of redirect requests, developers can disable the automatic redirection policy property of WinHttpHandler and handle redirects themselves in an upstream handler.
Similar with Cookie management - developers can choose the cookie policy of "Use specified Cookie container" and then manage the cookie container themselves, instead of using the WinHTTP cookie handling code.
karelz commentedon Dec 14, 2016
@davidsh please spin off separate issue(s) which are worth tracking and close this one.
davidsh commentedon Dec 15, 2016
Closing this issue now since all items are either fixed or tracked separately.