Before you spend too much time :
https://github.com/rejectedsoftware/vibe.d/tree/master/source/vibe/http
On Monday, 19 November 2012 at 20:38:56 UTC, Tyler Jameson Little
wrote:
I'd like to see an HTTP module in Phobos, but I wanted to gauge
interest first and see if this has been discussed before.
An example of how I would like to interface with it (for
creating a server):
interface HTTPHandler {
void serveHTTP(Request, Response);
}
class CustomHandler : HTTPHandler {
....
void serveHTTP(Request req, Response res) {
}
}
auto handler = new CustomHandler(); // implements
http.Handler
auto server = new HttpServer(handler);
server.listen("0.0.0.0", 80);
As long as serveHttp() is thread safe, the http server could be
concurrent or evented (with libev or similar) and the custom
handler code wouldn't have to change.
I'm willing to put in the lion's share of the work (I've
already written a bunch of it), but I'd naturally like to get
some community input so I don't go in a completely wrong
direction. I'm thinking of emulating Go's http library
(http://golang.org/pkg/net/http), but of course D style.
I think the following are necessary:
* Access to underlying TcpSocket (for protocol upgrades, like
WebSocket)
* HTTP body is a stream
* Simple HTTP requests
* Errors can be recovered from (allow user-defined error
handlers):
* User settable size limits
* Size of request line (1024 bytes by default)
* Size of each header (1024 bytes by default)
* Total size of header block (4096 bytes by default)
So, basically I'm looking for two things:
1. Interest level: willing to writ code, willing to test, want
to use
2. Suggestions for the API/behavior