Re: [Haskell-cafe] HTTP actions proxy server

2007-11-20 Thread Jim Burton

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@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.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HTTP actions proxy server

2007-11-19 Thread Stefan Kersten

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@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HTTP actions proxy server

2007-11-16 Thread Jim Burton


Justin Bailey wrote:
 
 
 I think it needs to be a real URL:
 
   setProxy (Proxy http://myproxy:80; Nothing)
 
 Justin
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
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?

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

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HTTP actions proxy server

2007-11-15 Thread Justin Bailey
On Nov 15, 2007 9:01 AM, Jim Burton [EMAIL PROTECTED] wrote:
 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:

I think it needs to be a real URL:

  setProxy (Proxy http://myproxy:80; Nothing)

Justin
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] HTTP actions proxy server

2007-11-15 Thread Jim Burton

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.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe