Skip to content

Commit

Permalink
POC implementation of WAComboResponse acting directly on a socket stream
Browse files Browse the repository at this point in the history
  • Loading branch information
theseion committed Aug 26, 2019
1 parent c674809 commit 611c4f2
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
instance creation
external: anExternalStream
^ self
onBuffered: (GRPlatform current writeCharacterStreamOn: (String new: 4096))
external: anExternalStream
onStream: anExternalStream
bufferSize: 4096
codec: GRNullCodec new

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
instance creation
onStream: aStream bufferSize: anInteger codec: aGRCodec
^ self basicNew
initializeOnStream: aStream bufferSize: anInteger codec: aGRCodec;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
codec: aCodec
^ codec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
codec
^ codec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ commit
self headerAt: 'Transfer-Encoding' put: 'chunked'.

committed := true.
self writeStatusOn: externalStream.
self writeHeadersOn: externalStream.
self writeCookiesOn: externalStream.
externalStream crlf; flush
self
writeStatusOn: externalStream;
writeHeadersOn: externalStream;
writeCookiesOn: externalStream.
externalStream
crlf;
flush
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ destroy

super destroy.
bufferedStream := nil.
externalStream := nil
externalStream := nil.
codec := nil

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
initialization
initializeOnStream: aStream bufferSize: anInteger codec: aGRCodec
"Initialize the receiver"

| rawBufferedStream |
self initialize.
codec := aGRCodec.
rawBufferedStream := GRPlatform current writeCharacterStreamOn: (String new: anInteger).
bufferedStream := GRCountingStream on: (aGRCodec encoderFor: rawBufferedStream).
externalStream := GRBinaryConvertingStream on: aStream.
committed := false.
closed := false
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"commentStamp" : "pmm 8/25/2019 11:14",
"super" : "WAResponse",
"category" : "Seaside-Core-HTTP",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "ar 8/4/2010 20:31",
"instvars" : [
"bufferedStream",
"externalStream",
"codec",
"committed",
"closed"
],
"externalStream",
"closed",
"bufferedStream" ],
"name" : "WAComboResponse",
"type" : "normal"
}
"pools" : [
],
"super" : "WAResponse",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
tests
testWithBinaryStream
(FileSystem memory / 'socket') binaryWriteStreamDo: [ :binaryStream |
response := WAComboResponse
onStream: binaryStream
bufferSize: 4096
codec: GRPharoUtf8Codec new.

response
nextPut: Character space;
flush;
close ]


Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
converting
responseFor: aZnRequest
| bufferedStream codecStream |
bufferedStream := GRPlatform current writeCharacterStreamOn: (String new: 4096).
codecStream := self codec encoderFor: bufferedStream.
^ WAComboResponse
onBuffered: (GRCountingStream on: codecStream)
external: aZnRequest stream
onStream: aZnRequest stream
bufferSize: 4096
codec: self codec

0 comments on commit 611c4f2

Please sign in to comment.