PDA

View Full Version : error callback in SimpleAsyncHTTP



mherger
2005-07-14, 03:26
Is the error callback function only called when there's a communication
problem on some lower level?

There was a guy in the german forum who received big error messages in the
middle of home.html (see screenshot). When I had a look at the html code I
realised it was the feedback from his MS ISA proxy that was returned in
$::newVersion. Obviously checkVersionCB accepted this as the new version
info, though the proxy gave a 407 error.

Shouldn't there be some sanity check in checkVersionCB which will verify
the content? That user always went restarting slimserver as the error
message prominently said "page can't be displayed" in an otherwise correct
page.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

Grotus
2005-07-14, 18:16
Michael Herger blurted out:
> Is the error callback function only called when there's a communication
> problem on some lower level?
>
> There was a guy in the german forum who received big error messages in
> the middle of home.html (see screenshot). When I had a look at the html
> code I realised it was the feedback from his MS ISA proxy that was
> returned in $::newVersion. Obviously checkVersionCB accepted this as
> the new version info, though the proxy gave a 407 error.
>
> Shouldn't there be some sanity check in checkVersionCB which will
> verify the content? That user always went restarting slimserver as the
> error message prominently said "page can't be displayed" in an
> otherwise correct page.
>

Try wrapping the setting and chomping of $::newVersion in this:
if ($http->{'code'} ~= /^2\d\d/) { ... }

That should reject any non-valid http responses.

mherger
2005-07-14, 23:13
> Try wrapping the setting and chomping of $::newVersion in this:
> if ($http->{'code'} ~= /^2\d\d/) { ... }
>
> That should reject any non-valid http responses.

Thanks! That's what I'm now using in a suggested fix:

http://bugs.slimdevices.com/attachment.cgi?id=640&action=view

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

Grotus
2005-07-15, 07:42
Michael Herger wrote:
>> Try wrapping the setting and chomping of $::newVersion in this:
>> if ($http->{'code'} ~= /^2\d\d/) { ... }
>>
>> That should reject any non-valid http responses.
>
>
> Thanks! That's what I'm now using in a suggested fix:
>
> http://bugs.slimdevices.com/attachment.cgi?id=640&action=view
>

Hmm, I notice that you are checking for both 2## and 3## responses. I
wouldn't think that the 300 responses would have valid data, just a link
to the new URL. Plus, SimpleAsyncHTTP will follow redirects if there is
a Location header.

dean
2005-07-15, 07:47
That's right. The 3xx responses should be followed automatically by
the HTTP handler, so 200 is probably the only success case.


On Jul 15, 2005, at 7:42 AM, Robert Moser wrote:

> Michael Herger wrote:
>
>>> Try wrapping the setting and chomping of $::newVersion in this:
>>> if ($http->{'code'} ~= /^2\d\d/) { ... }
>>>
>>> That should reject any non-valid http responses.
>>>
>> Thanks! That's what I'm now using in a suggested fix:
>> http://bugs.slimdevices.com/attachment.cgi?id=640&action=view
>>
>
> Hmm, I notice that you are checking for both 2## and 3##
> responses. I wouldn't think that the 300 responses would have
> valid data, just a link to the new URL. Plus, SimpleAsyncHTTP will
> follow redirects if there is a Location header.
>

mherger
2005-07-15, 07:57
> That's right. The 3xx responses should be followed automatically by the
> HTTP handler, so 200 is probably the only success case.

Thanks! I wasn't sure about this (hey, I even asked for your opinion).
Otherwise ok?

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

Grotus
2005-07-15, 08:51
Michael Herger wrote:
>> That's right. The 3xx responses should be followed automatically by
>> the HTTP handler, so 200 is probably the only success case.
>
>
> Thanks! I wasn't sure about this (hey, I even asked for your opinion).
> Otherwise ok?
>

Yep, otherwise looked fine.

mherger
2005-07-15, 08:58
> Yep, otherwise looked fine.

Even the english strings? :-)

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

Grotus
2005-07-15, 12:29
Michael Herger wrote:
>> Yep, otherwise looked fine.
>
>
> Even the english strings? :-)
>

Well, if you want me to nitpick:
There was a problem while checking for updates to SlimServer update.
(Error code %s)

This would be better as:
There was a problem while checking for updates to SlimServer. (Error
code %s)

mherger
2005-07-15, 16:09
> Well, if you want me to nitpick:

Thanks, I asked you to. Committed as change 3716.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)