[Haskell-cafe] Trying to write a very simple HTTP Client
eeoam at ukfsn.org
Fri May 23 09:27:52 EDT 2008
I've written the following program to connect to a submit an HTTP GET
request to a server and print the response:
module Main where
main = withSocketsDo go
go = do putStrLn "Connecting..."
out <- connectTo "haskell.org" (PortNumber 80)
hPutStrLn out "GET /\r"
hPutStrLn out "Host: haskell.org\r"
hPutStrLn out "\r"
cs <- hGetLine out
When I run the program, however, I get the following error:
HTTPClient: <socket: 1872>: hGetLine: end of file
Can anyone see what's wrong?
More information about the Haskell-Cafe