Oops, forgot to attach it.
2011/2/2, Dmitry Matveev <[email protected]>:
> Hello,
>
> I have attached a patch that fixes the static content serving in Swazoo.
> The following code demonstrates the case:
>
> | site |
> site := Swazoo.SwazooSite newNamed: 'hello'.
> site host: '*' ip: '*' port: 8888.
> site addResource: (Swazoo.FileResource uriPattern: '/' filePath:
> 'index.html').
> site start.
>
>
> There were two issues. In Swazoo.FileResponse >> printEntityOn:
> aStream we have got MessageNotUnderstood exceptions on
> 1. rs lineEndTransparent
> 2. rs nextAvailable: 2000
> ...and no data were written on the stream.
>
> A dummy #lineEndTransparent message was inserted into a Stream class
> in swazoo-httpd/Extensions.st, but in Sport a SpFileStream (that is
> used in Swazoo) is derived from Object, not from a Stream.
>
> And then, a SpFileStream did not provided a #nextAvailable: message,
> I have added it.
>
> Dmitry
>
diff --git a/packages/swazoo-httpd/Extensions.st b/packages/swazoo-httpd/Extensions.st
index 6835c61..eedf892 100644
--- a/packages/swazoo-httpd/Extensions.st
+++ b/packages/swazoo-httpd/Extensions.st
@@ -36,6 +36,22 @@ Stream extend [
]
]
+SpFileStream extend [
+ lineEndTransparent [
+ "Do nothing. GNU Smalltalk streams do not muck with line endings."
+ <category: 'useless portability hacks'>
+ ]
+
+ nextAvailable: anInteger [
+ | data stream read |
+ data := Array new: anInteger.
+ stream := WriteStream on: data.
+ read := self underlyingStream nextAvailable: anInteger putAllOn: stream.
+ ^data copyFrom: 1 to: read
+ ]
+]
+
+
SpFilename extend [
_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk