Bug: Unable to ignore Request Content-Length for RTSP-over-HTTP to allow reading a HTTP POST until the socket closes or dies
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
RTSP over HTTP Protocol (used in FFMPEG, VLC, Live555 and SharpRTSP etc) uses a Long Running HTTP POST.
I have to keep reading from the POST until the TCP socket closes (or dies).
I have to ignore any Content Length in the request, which is often set to 32767.
To ignore the Content Length I wrote Middleware to modify the ContentLength to _MaxLong_
Bug 1: Kestrel has already created a Http1ContentLengthMessageBody by the time my Middleware runs and it does not pass the new _MaxLong_ value into _Http1ContentLengthMessageBody_
Http1ContentMessageBody then stops at 32767 bytes which is not what I want.
Bug 2: Or looking at it another way, Kestrel does not identify "Content-Type: application/x-rtsp-tunnelled" and use a Body Reader that can read forever (until the socket closes or dies)
### Expected Behavior
For Bug 1 - Expected behaviour is for Kestrel to use the new Content Length (MaxLong) so I can read the TCP Socket forever (until the socket closes or dies)
OR for Bug 2 - the expected behaviour is for Kestrel to identify RTSP-Over-HTTP and ignore the Content Length automatically.
### Steps To Reproduce
Full demo of the issue is at
[https://github.com/RogerHardiman/kestrel_ignore_content_length](https://github.com/RogerHardiman/kestrel_ignore_content_length)
This creates two tasks.
Task 1 is a Server with Middleware to change Content Length to MaxLong
Task 2 uses TCPClient to send a POST request with a Content Length of 200. It then sends more than 200 data bytes.
Kestrel stops receiving data from the POST after 200 bytes. I need Kestrel to receive data on the POST forever, until the Socket closes or dies
### Exceptions (if any)
It is not an exception.
I see the issue as HTTPRequest.Body.ReadAsync returning a read length of 0 (zero) bytes.
### .NET Version
10
### Anything else?
I'd be happy with any way to read from a POST until the socket closes or dies and ignore Content Length
Contributor guide
Assessment
This issue has not been assessed yet.