Protocols.HTTP.get_url_data and Protocols.HTTP.get_url_nice are in my opinion flawed. According to the docs "0 is returned upon failure". That failure will have to be pretty severe though. It will return data as long as the server responds properly. Error codes are ignored.
They would gain usefullness if at least the 4xx and 5xx series of errors are considered "failures". Unless the 1xx and 3xx-series are handle somewhere they should also return 0.
I'll fix the code if noone protests.
May I suggest a Protocols.HTTP.Session class instead, that can maintain cookies and HTTP/1.1 connection(s), and do things the Right way?
Though that sounds fine, it is beside the point. When you fetch a page, should a 4xx response be considered an error? When you use the KISS-interface I agree with Zino and think it should.
/ Martin Nilsson (Fake Build Master)
Previous text:
2002-09-29 00:54: Subject: Re: get_url_data
May I suggest a Protocols.HTTP.Session class instead, that can maintain cookies and HTTP/1.1 connection(s), and do things the Right way?
/ Brevbäraren
Wouldn't there be considerable compatibility issues with such a change? It might be better to instead add new functions which behave better.
/ Martin Stjernholm, Roxen IS
Previous text:
2002-09-29 00:56: Subject: Re: get_url_data
Though that sounds fine, it is beside the point. When you fetch a page, should a 4xx response be considered an error? When you use the KISS-interface I agree with Zino and think it should.
/ Martin Nilsson (Fake Build Master)
I thought so first, but after some contemplation I changed my mind. This only affects people who actually want to download the error pages.
/ Martin Nilsson (Fake Build Master)
Previous text:
2002-09-29 01:00: Subject: Re: get_url_data
Wouldn't there be considerable compatibility issues with such a change? It might be better to instead add new functions which behave better.
/ Martin Stjernholm, Roxen IS
You're probably right. Just Protocols.HTTP.get_url stays the same I have no objections.
/ Martin Stjernholm, Roxen IS
Previous text:
2002-09-29 01:01: Subject: Re: get_url_data
I thought so first, but after some contemplation I changed my mind. This only affects people who actually want to download the error pages.
/ Martin Nilsson (Fake Build Master)
Yes, if people expect get_url_(data|nice) to to return the error page when you get an error it will, but that was certanly not how I had read the docs, so it's more likely to fix bugs.
/ Peter Bortas
Previous text:
2002-09-29 01:00: Subject: Re: get_url_data
Wouldn't there be considerable compatibility issues with such a change? It might be better to instead add new functions which behave better.
/ Martin Stjernholm, Roxen IS
There will be a compatibility layer of course.
/ Peter Bortas
Previous text:
2002-09-29 01:08: Subject: Re: get_url_data
Yes, if people expect get_url_(data|nice) to to return the error page when you get an error it will, but that was certanly not how I had read the docs, so it's more likely to fix bugs.
/ Peter Bortas
pike-devel@lists.lysator.liu.se