[squeak-dev] Sockets, WebClient, HttpClient and friends

H. Hirzel hannes.hirzel at gmail.com
Thu Mar 21 19:12:56 UTC 2019


The following (slighlty adapted) comes up with an error

'image format not recognized'

I put it in another process because today I crashed the image trying
out variants of this (infinitive loop somewhere, could not analyze
why).

| theUrl |
[ theUrl := 'https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Leopard_%2837072888293%29.jpg/640px-Leopard_%2837072888293%29.jpg'.

(ImageReadWriter formFromStream: ((WebClient httpGet: theUrl) content
readStream)) inspect] fork.

HH.

On 3/21/19, Tobias Pape <Das.Linux at gmx.de> wrote:
>
>> On 21.03.2019, at 13:14, H. Hirzel <hannes.hirzel at gmail.com> wrote:
>>
>> Hello
>>
>> This thread is related to my question how to get a picture from the web.
>>
>> I understand that I probably have to use WebClient.
>>
>> How would one of the convenience methods of WebClient be used to get a
>> picture from the web?
>
> maybe:
>
> ImageReadWriter formFromStream: ((WebClient httpGet: 'the-url') contents
> readStream)
>
> -t
>>
>> --Hannes
>>
>> On 1/18/19, tim Rowledge <tim at rowledge.org> wrote:
>>>
>>>
>>>> On 2019-01-18, at 1:30 AM, Tobias Pape <Das.Linux at gmx.de> wrote:
>>>>
>>>> TL;DR: It's just WebClient with differing layers of icing on top.
>>>
>>> Hah; so it is. That's good, I guess. Evidently diving a dozen or so
>>> layers
>>> down wasn't enough to discover that. ;-)
>>>
>>>>
>>>> But, yes, it could all be a bit more clear cut.
>>>
>>> It certainly could; but more importantly it could do much better for
>>> raising
>>> and handling errors helpfully. I note with wry amusement how the last
>>> part
>>> of HTTPSocket class>>#httpGetDocument:args:accept:request: carefully
>>> takes
>>> the helpful error info of WebClient and ensures that the less helpful
>>> HttpSocket response is generated.
>>>
>>> And of course none of this alters the fact that a good few methods could
>>> do
>>> with changing to handle network errors, whichever flavour of WebClient
>>> icing
>>> they use!
>>>
>>>
>>> tim
>>> --
>>> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
>>> Useful random insult:- Proof that evolution CAN go in reverse.
>>>
>>>
>>>
>>>
>>
>
>
>
>


More information about the Squeak-dev mailing list