Closed atauenis closed 10 months ago
Started some attempts to implement chunked transfer in 88b9747, but at this moment it's not very successful.
The code for chunked transfer support can be enabled by uncommenting in WebOne.csproj file these lines:
<PropertyGroup>
<DefineConstants>EnableChunkedTransfer</DefineConstants>
</PropertyGroup>
Found that Firefox 3.6 also prefers chunked transfer for video, and don't start video playback until full download if there's simple data flow instead of chunks. Added chunked transfer, and Firefox is now playing video even when it's not fully downloaded.
Great, we're may be glad, but after more deep testing found that situation is not so happy. Other stuffs begins broken. Converted images on Firefox are not downloading/displaying (it rejects file). On old Netscape they are attempted to download, but are broken as chunks are not well decoded.
(169E\r\n
is chunk size of 5790-byte GIF file, and the file became 5803-byte long, with extra garbage)
So needs to fix the bug, and only then the feature can be enabled.
At this moment I'm don't understand why it's not working. Probably need for help.
Continuing to debug chunked transfer. Improved support (will push the commit in few minutes), now Firefox works okay. But Netscape still not. Very strange thing. Same server code, same test file. But with Firefox 3.6 it's working, and with Netscape not. Wireshark dump of both connections is attached. Strange, but Wireshark also don't decodes the response to Netscape. Somewhy. Even however they're identical at first look. NS304 and FF36 same SVG-PNG.zip
I've studied the traffic dumps with more attention, and found that I've incorrectly understood RFCs for HTTP/1.0 and 1.1 (and ways how to debug them via Wireshark).
The HTTP/1.0 have optional support for keep-alive
and no support at all for chunked
transfer. If length is unknown, simply all should be transferred, then connection close forcely.
The HTTP/1.1 have better keep-alive
support (almost obligatorily) and for length-less content chunked
transfer is also important. Some browsers like MSIE 5.0 however sending 1.0 requests, really supporting 1.1 protocol fully. But not Windows Media Player 6 (strange, but fact).
So in recent commits I've implemented correct detect of protocol version, and HTTP/1.0 clients are recieving simply data stream, and HTTP/1.1 clients (excluding MSIE6, but it's not a problem) are recieving chunked-encoded data.
OS/2 Flash players are tested with IBM Web Browser and Opera 5, all playing videos w/o problems now.
Upcoming WebOne 0.16.2 will be free from this bug. :)
What's broken
When using recommended settings for video playback under WMP 6.4 (screenshot from wiki is below), it no longer playing videos. The log says:
This is how in the version from Git repo head. The v0.16-beta3 is displaying a HTTP 500 error message here, meaning the exactly same error, but with lost description message. The message saying that TCP connection with client is lost.
Another bug. Mozilla 0.9 at OS/2 4.52 is crashing when playing Flash video.
Workaround for Windows
Microsoft ASF (Stream)
video container in selector. However, previously, both formats worked.Workaround for OS/2
None found at current time. May be try other versions of Flash plug-in and/or Web Browser (Mozilla).
Debugging
If set
UseMsHttpApi=enable
in config file, both errors gone (but together with many new features of v0.16).Seems that this is caused because at this moment WebOne 0.16's new HTTP processing code (used instead of MS HTTPAPI) does not provide full support for chunked transfer. Converted videos are example of content where full length of file is unknown until end of download. So traditional
Content-Length
header is not send here, and the client expects other content length info to configure network stack (it can download only content with known length, else memory may overload). HTTP/1.1 specifies chunked transfer (send data by small chunks of fixed length), which is used by most of modern servers, but not implemented in WebOne because of difficulty and lack of free time of main developer. Only old MS HTTPAPI-based server code is properly supporting chunks.To prevent crash, WMP 6.4 plug-in stops ASF file download if there are no Content Length or Chunk Length specified. And in stream format, it still trying to download and got success here.
OS/2 Flash player, unlike Windows version, is crashing on such video access.
Newer browsers like Firefox 3.x can work with WebOne because they understand HTTP traffic with undefined content length.
So, it's need to implement some kind of chunked transfer encoding support in WebOne by analogy with .NET internal HttpListener architecture. Ideas: https://source.dot.net/#System.Net.HttpListener/System/Net/Managed/HttpResponseStream.Managed.cs,dfc7620c0b548fb5 .