dlang-requests
dlang-requests copied to clipboard
external URI parser
Giles Bathgate:
This uri abstraction might be a useful sub component of these http libs: https://github.com/rikkimax/alphaPhobos/blob/master/source/std/experimental/uri.d
@ikod I am putting together a testsuite to test various uri backends: https://github.com/GilesBathgate/uri This should give an idea of performance and robustness.
I commited ftp code and unittests, will look on uri lib.
What is the best practice for using modules from alpha libraries? Is it ok if I just place it in my source tree?
ping @wilzbach
Why not? (but I don't have detailed experience in best practices for this either) Anyways as long as you haven't reached 1.0, you shouldn't worry about this too much.
@ikod I would like to say that I am not getting good results from the alphaPhobos library, I am trying vibe.d implementation instead.
Is it ok if I just place it in my source tree?
To clarify you mean using git submodules? You can also tell dub to use master of its already released there..
To clarify you mean using git submodules?
Never tried git submodules, but they should work, thanks for idea.
@ikod Here are some initial results of the various Uri parsing libraries. (A reference implementation was made by wrapping the c library liburiparser)
- liburiparser 54 ms, 970 μs
- vibe.d (url.d) 194 ms, 850 μs
- arsd (http2.d) 1249 ms, 602 μs
- alphaPhobos (uri.d) core.exception.InvalidMemoryOperationError@/home/giles/ldc/runtime/druntime/src/core/exception.d(679): Invalid memory operation
The test was just a simple one run in a loop 10,000 times
auto u = new Uri("http://user:pass@host:99/foo/bar?baz#qux");
assert(u.scheme == "http");
assert(u.username == "user");
assert(u.password == "pass");
assert(u.host == "host");
assert(u.port == 99);
assert(u.absolutePath == "/foo/bar");
assert(u.query == "baz");
assert(u.fragment == "qux");
@ikod Here is another test run:
- liburiparser 89 ms, 341 μs
- vibe.d (url.d) 273 ms, 522 μs
- arsd (http2.d with ctRegex) 429 ms, 416 μs
- uriparse.d 53 ms, 104 μs
uriparse.d is my attempt at creating a new uriparsing library. It will probably only currently parse the most basic of urls, but its still the fastest ;)
@GilesBathgate Finally pushed http and ftp requests joined under single structure. One of the goal was not to break API and give user unified interface for http and ftp, which at the same time can give different details on responses. I'm not happy with proposed code, and will try to improve it. Anyway if you have any final results on URI tests, I will try to incorporate another URI parser. Thanks.
@ikod, @GilesBathgate What about urld ?