Commit graph

63 commits

Author SHA1 Message Date
Brandon Martin
050aa21b9d Response with Head to all Get requests
Signed-off-by: Brandon Martin <zmbmartin@gmail.com>
2015-08-01 07:58:56 -06:00
Alp Mestanogullari
f39d57c6b3 add HttpVersion, IsSecure, RemoteHost and Vault combinators with instances for all interpretations (all but the server ones being 'ignore that combinator')
tighter version bounds for network

cleanup

document the new combinators

servant-server: add some tests for HttpVersion, IsSecure, RemoteHost and Vault

update changelogs

address Julian's feedback

remove vault test in servant-server

servant-server tests: -Werror friendly
2015-07-10 14:00:01 +02:00
Andres Loeh
31b12d4bf4 Refactoring: abstracting common parts of method handlers.
This change makes an attempt of abstracting out some of the common
functionality found in the handlers for the different request methods.
There's still a bit of code duplication between the cases for headers
and no headers and empty responses. But it's a significant relative
improvement already.
2015-06-04 13:14:51 +02:00
Andres Loeh
eb86a82105 Refactoring: one module per concept.
The main `Server.Internal` module was getting a bit large for my taste.
It now contains just the instances. All the administrative utilities
are in their own dedicated modules.
2015-06-04 13:14:31 +02:00
Andres Loeh
f9b1e7fc50 Switch server interpretation to a datatype for efficiency.
Instead of directly interpreting a server as a `RoutingApplication`,
this change introduces the concept of a `Router`, which is a datatype
with several constructors.

In particular, the type of the `route` function changes from

    route :: Proxy layout -> Server layout -> RoutingApplication

to

    route :: Proxy layout -> IO (RouteResult (Server layout)) -> Router

Most important in practice is the case of the `StaticRouter` constructor
in `Router`. For choices between statically known paths, we can now use
a lookup table to dispatch requests rather than trying each request
individually.

This brings down routing complexity of a common case from
O(n) to O(log n).

Another important change is that the handler that is passed down by
`route` is no longer of type `Server layout`, but of type
`IO (RouteResult (Server layout))`. This means that API constructs
can "delay" checks and failure. For example, `ReqBody` does not have
to fetch the request body and feed it to the handler immediately; it
can instead record these actions in the handler that is passed down.
The code will only be executed at a leaf / endpoint of the API.

This is desired behaviour: We prefer to save work by doing all matching
on static path components first. Furthermore, we get better error codes
by doing so.
2015-06-04 13:07:53 +02:00
Julian K. Arni
5de9daf528 Fix outdated docs 2015-05-29 10:59:24 +02:00
Brandon Martin
10a6020ca2 modify delete to allow for response body 2015-05-06 13:21:35 -06:00
Julian K. Arni
50b05860b7 Remove Canonicalize 2015-05-03 01:45:17 +02:00
Julian K. Arni
a2b8d6ae58 Better servant-server left 2015-05-02 03:38:53 +01:00
Julian K. Arni
5531ada22b Headers for all 2015-05-02 02:21:03 +01:00
Julian K. Arni
7cb2ca05c4 7.10 CPP
Including some annoying hacks to work around CPP comments.
2015-04-22 14:57:30 +02:00
Julian K. Arni
f82ca76f7d 7.10 changes 2015-04-22 12:27:18 +02:00
Julian K. Arni
ed502f5f21 Prepare merge 2015-04-20 11:13:18 +02:00
Renamed from src/Servant/Server/Internal.hs (Browse further)