[Seaside] Re: Serving static images from Squeak 3.9

Matthias Berth matthias.berth at googlemail.com
Thu Mar 22 17:43:55 UTC 2007

Hi Alan,

here is a fix. I am using the squeak-dev image (#93), and I am also
using the method from


i.e. you use KomHttpServer to serve the files from the hard disk. As
you say, MultiByteFileStream is used for the response, so UTF-8
conversion is performed which mixes up the bits in the image.
Essentially, we want to treat the images as binary files that are
passed through unchanged.

The serving is done in ModFile, and I have patched this to make the
response stream binary for every request. Works for me. Would that be
a viable fix for the problem?

	| fullFilePath method response |
	method := ModCore method.
	(#(#GET #POST ) includes: method)
		ifFalse: [^ false].
	fullFilePath := ModDoc fullFilePath.
	(FileStream isAFileNamed: fullFilePath)
		ifFalse: [^ false].
	self processSubModules
		ifTrue: [^ true].
	response := HttpResponse
				fromStream: (FileDirectory default readOnlyFileNamed: fullFilePath).
	"Make the response contents stream binary. We are serving files
	so we want to serve them without any encoding / decoding interfering,
	right? "
	response contents binary.
	HttpResponse current: response.
	^ true



On 3/15/07, Alan Capewell <alan.capewell at softwareag.co.uk> wrote:
> [...]
> I think I'm getting a little further with this...
> I have been tracing the call through the KomHttpServer and discovered that in my
> 3.8 image the HttpResponse stream is of Class StandardFileStream  in my 3.9
> image it is a MultiByteFileStream.  Difference being that the latter is then
> getting passed through a UTF-8 conversion facility and I'm guessing my image is
> not UTF-8 encoded.
> Now all I need to do is work out why 3.9 is treating it as a
> MultiByteFileStream.  If anyone has any clues please let me know - otherwise
> I'll just kepp searching

More information about the Seaside mailing list