[Haskell-cafe] HTTP actions & proxy server

Jim Burton jim at sdf-eu.org
Thu Nov 15 12:01:15 EST 2007


How would I go about converting the little get program at
http://darcs.haskell.org/http/test/get.hs to use a proxy server? I tried
adding a call to setProxy like this but it doesn't work:

get :: URI -> IO String
get uri =
    do
      browse $ setProxy (Proxy "myproxy:80" Nothing)
      eresp <- simpleHTTP (request uri)
      resp <- handleE (err . show) eresp
      case rspCode resp of
        (2,0,0) -> return (rspBody resp)
        _ -> err (httpError resp)
          where
            showRspCode (a,b,c) = map intToDigit [a,b,c]
            httpError resp = showRspCode (rspCode resp) ++ " " ++
rspReason resp

Thanks.
-- 
View this message in context: http://www.nabble.com/HTTP-actions---proxy-server-tf4815272.html#a13775608
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list