[Haskell-cafe] Simple HTTP lib for Windows?

Daniel McAllansmith dm.maillists at gmail.com
Sat Jan 27 23:31:08 EST 2007

On Sunday 28 January 2007 10:53, Neil Mitchell wrote:
> Thanks, it certainly gets more things, but has a nasty habit of taking
> a very long time in Hugs on certain URLs:
> research.microsoft.com/, 

Looks like IIS is waiting until it receives a Connection header, a bit of a 
variation from spec I think...
Adding in 
  hPutStrLn h ("Connection: close\r\n")
  hPutStrLn h ("Connection: keep-alive\r\n")
as appropriate should sort that.

> www.cs.york.ac.uk/ 

This is responding with a 302, the resource has been found but is temporarily 
at another location indicated in the responses Location header.
So, now you'll have to start parsing responses.
In this case the Location header is www.cs.york.ac.uk/public.php

> And on some urls, ie http://research.microsoft.com/~simonpj/, it still
> ends up with IO.hGetChar: illegal operation
> Any ideas why?

Hmmm, if you putStrLn the values of closed and eof it looks to be hanging 
during the eof check.  Don't know why.

Oh yeah, all the carriage-returns should be carriage-return line-feeds from 
memory.  Not that that seems to help with this problem.

The cheap and cheerful solution might be to invoke cURL.


More information about the Haskell-Cafe mailing list