How would I go about getting the Request data from the happstack-lite API? I'm trying to get the client's IP address. From what I can tell it's in Request::rqPeer, and I get confused trying to dive into the monadic-layers of the happstack API.
Asked
Active
Viewed 234 times
1 Answers
3
You can use askRq
in any ServerMonad to get at the Request, which you could pattern match on with record syntax to get the client hostname:
do Request {rqPeer = (host,_)} <- askRq
ok $ "Your IP: " ++ host

Dag
- 682
- 5
- 10
-
And it looks like ServerPartT m meets the requirements for a ServerMonad. Great, thanks. – David Jul 23 '12 at 00:03