Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC implementation of WAComboResponse acting directly on a socket stream #1159

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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