[racket-dev] net/url - get-pure-port/headers
The documentation of get-pure-port/headers seems to suggest that it
returns the same thing
(call/input-url u
(lambda (p)
(define hs (purify-port p))
(values p hs)))
would, except that it also handles redirections
However, it does not actually give the value returned by
purify-port---it deletes the first line (the status line).
This means that a caller get-pure-port/headers can't tell the status
code returned by the server they've contacted and they may consider
the descriptive body of a 404 message as the data they want.
There's only one use of get-pure-port/headers in the core and it is
robust against adding this line back in. (It uses net/head, which does
not assume its input is only header lines, but uses regexps to find
the header. So if any line is not a valid header line, then it works
fine.) My guess is that most code also does that, so this change would
be unlikely to break things in the wild. (Although there are no uses
on Planet, so I can't tell.)
An alternative is to change the contract for get-pure-port/headers to
return three values rather than two, but I think that is more likely
to break external code.
Can I get a second opinion?
Jay
--
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay
"The glory of God is Intelligence" - D&C 93