开发者

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:

  1. log in
  2. get some data
  3. let the user muck with the data
  4. send the modified data back
  5. 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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜