Is there interest in a std.http?

Tyler Jameson Little beatgammit at gmail.com
Mon Nov 19 19:49:54 PST 2012


>> * HTTP body is a stream
>
> No Content-Size, no multiple requests per connection (unless 
> you use chunked encoding?).

Not sure what you mean. I meant incoming stream. There would be a 
request object with access to all other headers, it just wouldn't 
be read in until the user actually wanted it.

>> * 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)
>
> I think this is pointless. Use an appender and the RFC limits. 
> Unless you are serving VERY simple pages, the cost of a few 
> allocations for handling the HTTP protocol's overhead will not 
> be noticeable compared to the application's. (Slowloris is 
> something to keep in mind, though.)

I just made up those limits, but the point is I'd like the user 
to be able to tweak those. The default will work for most people 
though.

> My HTTP library, which is used for this forum and several other 
> "production" projects, is here: 
> https://github.com/CyberShadow/ae
> The main problem with getting it into Phobos is that it's tied 
> to a lot of other related code, such as the asynchronous 
> sockets module, the unmanaged memory wrapper type, etc.

Cool, I didn't know that this was served by D code. I'll take a 
look at it.

> Also, what about vibe.d?

vibe.d does a lot of things, and it probably does those things 
very well. It seems well maintained, and generally a good 
project. I think that a lot of the things it does well could be 
brought into the standard library. As this thread pointed out, 
there are several HTTP parsers floating around out there. For 
some, vibe.d might not be a perfect fit for whatever reason, but 
everyone can benefit from a simple HTTP library.

Maybe it shouldn't be as high-level as Go's http library, but it 
should at least make writing a simple HTTP server trivial.

Would a minor refactor of vibe.d be acceptable? This is pretty 
much what I'm looking for:

https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/http/common.d
https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/http/server.d

Except that I'd remove some parts of it, like JSON parsing.

I think that vibe.d could benefit from moving some of the code 
there into Phobos. I guess it comes down to whether it makes 
sense to make a standard HTTP library.


More information about the Digitalmars-d mailing list