Hello All,
I am using the WebToolKit and I was trying to use the webserver example in the OpenTalk as well. One thing always puzzled me -- if I get a binary file from the webserver such as Apache the IE or FireFox always gives me a size of the download, calculates rates, etc., But if the file is sent by WTK itself, then there is no size information available... here is the example-- inspect something like: Net.HttpClient new get:'http://www.google.com/intl/en_ALL/images/logo.gif' results in the stream with information like: "HTTP/1.1 200 OK Content-Type: image/gif Last-Modified: Wed, 07 Jun 2006 19:38:24 GMT Expires: Sun, 17 Jan 2038 19:14:07 GMT Server: GWS/2.1 Content-Length: 8558....." Anytime you ask for the single file you will get contents-lengh defined in the responses. I checked it with Yahoo, Google, various other sites. When the similar file is being transmitted through WTK the size information never displayed. After some poking around I came across the following code: in VW 7.5 it looks like follow: printHeader: aMessageHeader " Print header fields " | fields | self digestMode ifFalse: [aMessageHeader removeKey: 'content-length' ]. fields := self selectFieldsFrom: aMessageHeader. stream text. self printHeaderFields: fields. In the first line the contents size information is being explicitly stripped off. What is the reason for that ? It looks like that there is deficiency there -- the WTK does not distinguish between web page with all sort of information on it with uncompressed single binary file where at least byte size should be known... TIA --Mark |
I don't think that particular code is actually used by the
Web Toolkit.
It seems to me that the problem is that the WebSiteFile servlet never sets the content length. That would be relatively easy to fix, I would think. One question is whether the content-length could just be derived from the file size, or if we need to read the contents and put it into the appropriate encoding in order to know the length. The latter would be trickier for streaming. But then, that doesn't stream right now anyway, so it's not an issue :-) At 10:25 AM 6/15/2007, Mark Pirogovsky wrote: Hello All, --
Alan Knight [|], Cincom Smalltalk Development
|
In reply to this post by Mark Pirogovsky-3
Mark,
The code you quote below is from the HTTP package. We have yet to finish integration of that into WTK/Wave, so the code you're quoting below shouldn't really have any impact on what you get from a WTK/Wave server. Mark Pirogovsky wrote: > Anytime you ask for the single file you will get contents-lengh defined > in the responses. I checked it with Yahoo, Google, various other sites. > > When the similar file is being transmitted through WTK the size > information never displayed. > > After some poking around I came across the following code: > in VW 7.5 it looks like follow: > > printHeader: aMessageHeader > " Print header fields " > | fields | > > self digestMode ifFalse: [aMessageHeader removeKey: > 'content-length' ]. > fields := self selectFieldsFrom: aMessageHeader. > stream text. > self printHeaderFields: fields. > > > > In the first line the contents size information is being explicitly > stripped off. What is the reason for that ? In 7.5 we rewrote the HTTP stack significantly to allow direct streaming of content between sockets and external files. To deal with large content you really need to employ what's called 'chunking' in HTTP. If a message gets chunked, there must not be a content-length header, each chunk carries its own size with it instead. The removal above is precautionary so that if we end up chunking the message we don't send the content-length header. If the message doesn't end up chunked, we will add the true (byte-size) content-length back later on. Again, that's how the HTTP package works, and that's not what's currently employed by WTK/Wave. Hopefully we'll finish the integration soon. HTH, Martin |
Free forum by Nabble | Edit this page |