Why do I get an ErrorClosed when delaying HTTP requests in Windows?
I'm trying to implement the following pattern in a program that interfaces with the DGS website using the HTTP library:
- log in
- get some data
- let the user muck with the data
- send the modified data back
- start again at step two
It works great on Linux, but from Windows, the program prints Network.Browser.request: Error raised ErrorClosed
at step four. I've distilled the above pattern into a minimal test case below:
import Control.Concurrent
import Network.Browser
import Network.HTTP
import Network.URI
auth = URIAuth
{ uriRegName = "dragongoserver.sourceforge.net"
, uriUserInfo = ""
, uriPort 开发者_C百科= ""
}
uri path = nullURI
{ uriScheme = "http:"
, uriAuthority = Just auth
, uriPath = '/' : path
}
get path = request . formToRequest . Form GET (uri path)
main = browse $ do
get "login.php" [("quick_mode", "1"), ("userid", "smartypants"), ("passwd", "smartypants")]
ioAction (threadDelay 5000000)
get "sgf.php" [("gid", "491179")]
How can I keep the connection open?
精彩评论