On 22.03.2019, at 09:35, H. Hirzel hannes.hirzel@gmail.com wrote:
Yes, WebResponse >> #contentStream is there but if I use it I get an error message, see my earlier mail in this thread where I include the details.
It seems that the stream is asked for #reset and that does not go well with the stream WebResponse uses.
SecureSocketStream(Object)>>doesNotUnderstand: #reset
So getting the whole content first and then to ask for a new stream is a workaround. It is a solution but maybe not the solution.
More investigation needed....
No. The WebResponse stream is a non-resettable stream, it comes effectively from the network, so you can't meaningfully #reset it :) I can think of several ways to counter that, but not today :D
Best regards -Tobias
HH
On 3/22/19, Marcel Taeumel marcel.taeumel@hpi.de wrote:
Huh? WebResponse >> #contentStream has been there since 2012.
Best, Marcel Am 21.03.2019 20:37:40 schrieb H. Hirzel hannes.hirzel@gmail.com: It works if I replace
#contentStream
with
content asByteArray readStream
Form fromBinaryStream: (WebClient httpGet: 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Squeak-x11.png/617...') content asByteArray readStream.
On 3/21/19, H. Hirzel wrote:
Thanks for answering, Marcel
On 3/21/19, Marcel Taeumel wrote:
What about ...
Form fromBinaryStream: (WebClient httpGet: 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Squeak-x11.png/617...') contentStream.
Unfortunately a debugger window comes up [1]
... I think we should add a #fromUrl: besides Form class >> #fromFileNamed: and there distinguish between file paths and HTTP urls etc:
Form fromUrl: 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Squeak-x11.png/617...'.
Yes, that would be fine to create a new convenience method
Form fromUrl:
after we have figured out the solution.
-- Hannes
[1] SecureSocketStream(Object)>>doesNotUnderstand: #reset Receiver: SecureSocketStream[inbuf:4kb/outbuf:4kb] Arguments and temporary variables: aMessage: reset exception: MessageNotUnderstood: SecureSocketStream>>reset resumeValue: nil Receiver's instance variables: recentlyRead: 0 socket: a Socket[destroyed] inBuffer: #[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...etc... outBuffer: #[71 69 84 32 47 119 105 107 105 112 101 100 105 97 47 99 111 109 10...etc... inNextToWrite: 1 outNextToWrite: 1 lastRead: 0 timeout: 45 autoFlush: true bufferSize: 4096 binary: true shouldSignal: true ssl: nil sendBuf: #[23 3 3 0 232 61 247 6 24 144 238 146 249 51 100 82 127 29 104 195 17...etc... readBuf: #[203 4 102 97 151 46 237 173 196 165 168 136 21 56 21 225 6 113 183 1...etc... decoded: a ReadStream certIssues: 0
[] in ImageReadWriter class>>formFromStream: Receiver: ImageReadWriter Arguments and temporary variables:
Receiver's instance variables: superclass: Object methodDict: a MethodDictionary(#atEnd->(ImageReadWriter>>#atEnd "a CompiledMethod...etc... format: 65537 instanceVariables: #('stream') organization: ('accessing' nextImage nextPutImage:) ('stream access' atEnd close...etc... subclasses: {PCXReadWriter . XBMReadWriter . JPEGReadWriter . JPEGReadWriter2 ....etc... name: #ImageReadWriter classPool: a Dictionary(#ImageNotStoredSignal->nil #MagicNumberErrorSignal->nil...etc... sharedPools: nil environment: nil category: #'Graphics-Files'