[Haskell-cafe] HTTP actions & proxy server

Jim Burton jim at sdf-eu.org
Tue Nov 20 04:32:18 EST 2007


Thank you, that's perfect.

Jim 

stefan kersten-2 wrote:
> 
> On 16.11.2007, at 13:55, Jim Burton wrote:
>> The docs say "Should be of the form http://host:port, host,  
>> host:port, or
>> http://host" but none of the variations work. Any ideas where I  
>> might find
>> an example of code that does this?
> 
> this works for me (modulo error handling):
> 
> simpleHTTP' :: Request -> IO (Result Response)
> simpleHTTP' req = do
>      proxy <- catch
>                  (getEnv "HTTP_PROXY" >>= return . (flip Proxy Nothing))
>                  (\_ -> return NoProxy)
>      (_, resp) <- browse (setProxy proxy >> request req)
>      return (Right resp)
> 
> i.e. run the request in the browser monad.
> 
> <sk>
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 

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



More information about the Haskell-Cafe mailing list