-
Notifications
You must be signed in to change notification settings - Fork 5k
Exception in chuncked response #68581
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
Comments
The Streamed mode for responses doesn't change how the response is parsed. Basically Streamed vs Buffered is just about do you consume the entire request as a single buffer or consume what's needed for the next output to the application (eg when the return value of the operation is a Stream, reading 100 bytes from the stream will only read 100 bytes worth of encoded data from the SOAP message). So with WCF you can have a client send buffered, and the server receive it streamed, or vice versa. For HTTP it's only about memory consumption patterns. So now to your problem. it looks like this is a bug in the HttpClient. There's a Content-Length and Transfer-Encoding header. According to rfc7230 section 3.3.3, this isn't valid but does give precedence to the Transfer-Encoding header implying the client should handle this by ignoring the Content-Length. The fact that .NET Framework handles this as well as does Soap UI suggests that HttpClient should too:
The behavior that's happening is that the body isn't being treated as though it's been chunked so WCF is getting passed the XML with those extra lines in it which is understandably causing the XmlReader to claim the XML is invalid. I found where the bug is. In the code here the presence of a Content-Length value is checked before the presence of the Transfer-Encoding chunked header. I'm going to transfer this issue to the runtime repo as that's where the bug is. |
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @dotnet/ncl Issue DetailsHi there. Describe the bug
I think this is due to the fact that the response does not support chunking. I got response like this
Symbols "20d" and "33f" it's special symbol in chunked response, as far as I understand)) I tried using the TransferMode setting to enable chunking. I found this code in source
And I checked all three read methods. To Reproduce Expected behavior Additional context
|
You are correct that this is a bug and we should give priority to |
I would like to call out that there is no workaround for this bug. The person who reported the issue doesn't own the service, so this is a blocker to being able to adopt .NET Core. The server in question is the Java Jetty server which is a mainstream and popular server and not some obscure unusual implementation. |
Triage: We are going against RFC recommendation. We should follow it instead. The fix is simple - swapping 2 lines. Any takers? |
should we reopen this for servicing @karelz since there is no workaround and this violates RFC? |
I vote to back port this to .NET 6 as it's the LTS version. |
Reopening for backporting consideration. A technically possible workaround is for the user to check for both headers, and manually unwrap the chunk framing (e.g. wrapping the content in a copy of ChunkedEncodingReadStream), but that's quite horrible. |
#69085 should also be backported with it, because the test that I added in this breaks with NodeJs |
Triage: blocking migration to Core, we should backport the fix to 6.0. The only risk is if someone is relying on the current non RFC-compliant 6.0 behavior. |
Uh oh!
There was an error while loading. Please reload this page.
Hi there.
Describe the bug
I am migrating a project from .Net Framework 4.7.2 to .NET 6.
And I am getting error in response when it is serialized.
System.ServiceModel.ProtocolException: There is a problem with the XML data received from the network. See the description of the inner exception for details. ---> System.Xml.XmlException: The data at the root level is invalid. Line 1, position 1.
I think this is due to the fact that the response does not support chunking.
I got response like this
Symbols "20d" and "33f" it's special symbol in chunked response, as far as I understand))
I tried using the TransferMode setting to enable chunking.
But neither the TransferMode.Stream setting nor the TransferMode.StreamResponse setting helped and returned the same error.
I found this code in source
And I checked all three read methods.
They all throw the same exception.
To Reproduce
I'm working with a SOAP service that I don't have access to and it's written in Java.
So I don't know how to reproduce this code.
I can attach the full text of the response with headers.
Expected behavior
I expect that everything will work just as well as on the .NET Framework 4.7.2.
Additional context
Soap UI correctly parses this response.
The text was updated successfully, but these errors were encountered: