Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

theseion
Copy link
Member

@theseion theseion commented Feb 16, 2021

This is a clone of #1159, which was opened against the now removed develop branch.

See also the discussion in #1159.

@theseion theseion force-pushed the wacomboresponse-doesnt-work-with-socket-streams branch from 611c4f2 to 19b44f4 Compare June 4, 2022 14:19
@theseion
Copy link
Member Author

theseion commented Jun 6, 2022

@jbrichau I have WAComboResponse working with streaming in Pharo 9 and 10, but below the converters don't behave like I need them too (i.e., there is no converter that can write strings to a ByteArray. In Pharo 10 Zinc does that and in Pharo 9 the UTF-8 converter does it too). I don't know how I should solve it. Maybe we need another delegating stream that converts from characters to bytes but I'm reluctant to do that.

@theseion theseion force-pushed the wacomboresponse-doesnt-work-with-socket-streams branch from 87e1aad to 5870946 Compare June 6, 2022 13:26
^ super response ifNil: [
response := WAComboResponse
onStream: (GRPlatform current writeCharacterStreamOn: (ByteArray new: 1024))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right. #writeCharacterStreamOn: wants a String, should we instead send #writeCharacterStreamOn:?

Copy link
Member Author

@theseion theseion Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be something else, yes. I presume, you meant to write writeBinaryStreamOn:?

We have to be careful though. I remember having to fight a lot with the wrapping streams (i.e., Zinc).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume, you meant to write writeBinaryStreamOn:?

Yes

I remember having to fight a lot with the wrapping streams (i.e., Zinc).

Let's figure out the problem and solve it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#writeCharacterStreamOn: simply delegates to WriteStream on:, which operates on collections, so in that sense it's fine. Also, this is in a test and there is no #writeBinaryStreamOn: so far. I'll just leave it if you don't object.

@marschall
Copy link
Contributor

(i.e., there is no converter that can write strings to a ByteArray. In Pharo 10 Zinc does that and in Pharo 9 the UTF-8 converter does it too). I don't know how I should solve it. Maybe we need another delegating stream that converts from characters to bytes but I'm reluctant to do that.

I think for 4.0 we should bite the bullet and make the codecs String -> ByteArray

@marschall
Copy link
Contributor

LGTM apart from my comments.

@theseion
Copy link
Member Author

Thanks @marschall. I'll make the changes soon.

@theseion theseion force-pushed the wacomboresponse-doesnt-work-with-socket-streams branch from 5870946 to dc76211 Compare September 18, 2023 13:23
@codecov
Copy link

codecov bot commented Sep 18, 2023

Codecov Report

Patch coverage: 96.70% and project coverage change: +0.29% 🎉

Comparison is base (b2d5425) 48.67% compared to head (dc76211) 48.97%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1240      +/-   ##
==========================================
+ Coverage   48.67%   48.97%   +0.29%     
==========================================
  Files        8946     8889      -57     
  Lines       80490    80050     -440     
==========================================
+ Hits        39178    39201      +23     
+ Misses      41312    40849     -463     
Files Changed Coverage Δ
...e.package/WAComboResponse.class/instance/binary.st 0.00% <0.00%> (ø)
....package/WAComboResponse.class/instance/destroy.st 0.00% <0.00%> (ø)
...Response.class/class/onStream.bufferSize.codec..st 100.00% <100.00%> (ø)
...re.package/WAComboResponse.class/instance/close.st 100.00% <100.00%> (+100.00%) ⬆️
...e.package/WAComboResponse.class/instance/commit.st 100.00% <100.00%> (+100.00%) ⬆️
...re.package/WAComboResponse.class/instance/flush.st 100.00% <100.00%> (+100.00%) ⬆️
...s/instance/initializeOnStream.bufferSize.codec..st 100.00% <100.00%> (ø)
...e/WAComboResponse.class/instance/nextChunk.put..st 100.00% <100.00%> (+100.00%) ⬆️
.../WAComboResponse.class/instance/writeHeadersOn..st 100.00% <100.00%> (ø)
...age/WAComboResponseTest.class/instance/response.st 100.00% <100.00%> (ø)
... and 2 more

... and 56 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants