Possible URL fetcher/documentation bug
Rick Murray (539) 13850 posts |
With reference to the URL fetcher specification: If I call URL_GetURL according to the specification, it fails and returns the headers: R0 = 0 (no length in R5, no user-agent line) R1 = session ID R2 = 1 (HTTP GET) R3 = URI R4 = "" R5 = 2 R6 = "" The problem comes down to the fact that the documentation states, for R5:
This is, put simply, wrong. The correct approach is to either specify a length in R5 and set it to zero, or just ignore the API and set R5 to 0 instead of 2 if not using a length. |
Rick Murray (539) 13850 posts |
While I’m here writing this, other stuff in URL that is annoying:
|
nemo (145) 2554 posts |
2=Head+Body surely? So it’s not “wrong”, it’s just failing to mention that other television listings magazines are available. |
Rick Murray (539) 13850 posts |
No – it’s only returning the headers. Probably wants 3 for the head and shoulders… Of course, if this was documented…
Documentation states ‘X’. |
nemo (145) 2554 posts |
So you’re saying that the HTTP documentation is wrong, not the URL documentation. |
Rick Murray (539) 13850 posts |
Oh, I see, it’s documented elsewhere under something else. Maybe. I don’t know. I am using URL, not directly talking to AcornHTTP. I’m guessing that the value is passed through, but… Note: in the link, change “blob” for “raw” to have a hope of seeing it on NetSurf. |
Chris Mahoney (1684) 2165 posts |
URL is a “generic” interface to other protocol modules, although these days AcornHTTP is probably the only one in common use. Until last year, AcornHTTP would always return both the headers and the body regardless of the value of R2 (note that I’m talking about AcornHTTP’s interface, not URL’s). This was despite the docs saying that 0 returns the body, 1 returns the headers, and 2 returns both. AcornHTTP 0.98 fixed that, and R2 now does what the docs say. But I can’t say whether URL is doing the right thing! I had a suspicion that the “must be 2” comment in the URL docs was to work around the bug in AcornHTTP. Now that that’s fixed, the URL docs might need an update… It doesn’t help that there are two different versions floating around (GitLab, Wiki). |
Rick Murray (539) 13850 posts |
<cough> One of the primary benefits of the URL module is that changing “http://” to “https://” just works. It’s not hard to write a simple HTTP fetcher.
Hmmm… So stick a ‘fix’ into the docs instead of fixing the bug in AcornHTTP? Way to go, Acorn… |
Chris Mahoney (1684) 2165 posts |
Well technically it’s AcornHTTP (not URL) that’s calling AcornSSL, so I stand by my claim that AcornHTTP is the only commonly-used URL fetcher :) |
nemo (145) 2554 posts |
Of course the documentation must describe what actually happens on the end-user’s machine, and not what we would like to happen. Hence my comments about PreFilters the other day, and Service_International,7 some time ago. |
Rick Murray (539) 13850 posts |
Are you sure about that? I thought that fetchers registered themselves with the URL module according to what protocol they supported. Re. |
Rick Murray (539) 13850 posts |
Seems to be something of a running theme, doesn’t it? |
Chris Mahoney (1684) 2165 posts |
No :) |