-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebHeaderCollection needs some internal APIs made public #21280
Comments
From my experience with the TLS Alerts work, adding new public APIs required by the implementation complicates packaging and may create issues when packaging netstandard 2.0. |
Legacy APIs Options:
Triage recommendation: option [2]. Doesn't fit in, moving to Future. |
This issue is blocking UWP work for S.N.HttpListener. I will disable those tests for now. |
@Caesar1995 Please add "disabled-test" label to the main issue which tracks the disabled test (is it this one?), thanks! |
Nice to have. Not needed for UWP. Won't break apps. Implementation is only needed to do extra error checking when adding to the collection. |
Triage: Similar problem affects also non-UWP (we may have another tracking issue for that). |
This issue was specific to the UAP implementation of the networking stack which had a different implementation for things like HTTP and WebSockets. As of PR dotnet/corefx#41759, we no longer build the separate implementation for the UAP platform. So, this issue can't occur anymore with .NET 5 because we now will be using the same .NET Core implementation as on Windows, Linux, Mac. |
While investigating failures in System.Net.Requests tests ( #20873), I discovered that
FtpWebResponse.Headers
andFileWebResponse.Headers
is returning aWebHeaderCollection
object that does not have the private fieldWebHeaderCollectionType
properly initialized within the collection.This causes code like this:
to pass on .NET Core (which is wrong). Instead, it should throw an exception
similar to what happens on .NET Framework. The exception is because FtpWebResponse/FileWebResponse don't have Http type headers.
So, the net result is that we don't have proper validation for WebHeaderCollection type.
The problem is that on .NET Core, the
WebHeaderCollection
is being created with the default contructor which doesn't pass it any specificWebHeaderCollectionType
enum value. On .NET Framework, it uses an internal constructor overload. Also, theWebHeaderCollectionType
enum is also marked as internal in .NET Framework and is not a public API.This was ok for .NET Framework since everything was in System.dll. But on .NET Core, WebHeaderCollection lives in a different library from System.Net.Requests where *WebRequest, *WebResponse classes live.
This is resulting in all WebHeaderCollection objects being set with the
WebHeaderCollectionType.Unknown
enum value.The text was updated successfully, but these errors were encountered: