aesiniath / http-streams

Haskell HTTP client library for use with io-streams
https://hackage.haskell.org/package/http-streams
BSD 3-Clause "New" or "Revised" License
50 stars 48 forks source link

`get` doesn't handle relative redirects correctly #50

Closed lpsmith closed 10 years ago

lpsmith commented 11 years ago

e.g.

> get "http://www.melding-monads.com/redirect/example.php" concatHandler
*** Exception: Can't parse URI /redirect/success.html

Where example.php is just:

<?php
  header('Location: /redirect/success.html')
?>

While relative redirects are not specifically allowed by RFC 2616, this is considered a bug in the RFC and almost every http client supports them.

istathar commented 11 years ago

Oh. Great.

We can look at that. No reason not to support it, but seeing as how the RFC was clear about it... anyway. It will mean adding a bit of URL handling code.

What you want to do is look at path at line 259 of src/Network/Http/Inconvenience.hs. See if what you want can easily be done there, or whether it will be more complicated.

Thanks for demonstrating the problem. I didn't understand what you were talking about online. Cheers,

AfC

istathar commented 10 years ago

@lpsmith if you've got http-streams from Git lying around, perhaps you could pull and test this fix? Cheers.

AfC