On May 19, 2010, at 11:02 20AM, Markus Kahl wrote:
> Hey,
>
> I'm writing a very simple HTTP server and it seems to work except for one problem: Content-Length.
> To write this HTTP header I need to find out the size of a string (the response body) in bytes.
>
> I tried 'aString asByteArray size' which results in 1742 in one instance.
> When I open the page in Firefox, though, it says that the content length is actually 1838.
> Opera and Chrome do in fact trust the content length and only display 1742/1838 of the page.
>
> Any ideas?
>
> _______________________________________________
> vwnc mailing list
>
[hidden email]
>
http://lists.cs.uiuc.edu/mailman/listinfo/vwncA quick guess is you do some encoding as part of sending it to the client. (f.ex. from default bytestring encoding to utf8)
The closest thing to what you already got, would probably be
(aString asByteArrayEncoding: #whatYouSendOutIsActuallyEncodeAs) size.
Not very efficient though :)
Cheers,
Henry
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc