digitalmars.D - URI parsing
- John C (4/4) Oct 05 2016 What packages do people use when they want to parse URIs? I
- rikki cattermole (9/12) Oct 05 2016 I developed[0] with the hopes that at some point in the future I could
- John C (3/8) Oct 05 2016 Looks good, thanks.
- Basile B. (5/9) Oct 05 2016 It's not easy to make a true URI implementation, by "true" I mean
- rikki cattermole (6/13) Oct 05 2016 Yeah the spec is quite nasty.
- Jonathan M Davis via Digitalmars-d (6/10) Oct 05 2016 Yeah, like _far_ too many of the RFCs relating to the web, it's a mess. ...
- ketmar (5/7) Oct 05 2016 yeah. everything after scheme is highly dependent of scheme
- Adam D. Ruppe (11/12) Oct 05 2016 I did one based on the regex found in the RFC for my cgi and http
- Eugene Wissner (4/8) Oct 05 2016 I also wrote a function for extended url parsing based on php
- Nick Sabalausky (2/5) Oct 05 2016 IIRC there's one in vibe I used not too long ago.
- John Carter (11/12) Oct 05 2016 Different John C here :-)
What packages do people use when they want to parse URIs? I rolled my own but it's incomplete and as it's a fairly common need there must be one out there? In fact, I'm surprised there isn't one in Phobos yet.
Oct 05 2016
On 05/10/2016 11:19 PM, John C wrote:What packages do people use when they want to parse URIs? I rolled my own but it's incomplete and as it's a fairly common need there must be one out there? In fact, I'm surprised there isn't one in Phobos yet.I developed[0] with the hopes that at some point in the future I could bring that over to Phobos. But before that I'm waiting for allocators to be moved out of experimental first. [0] https://github.com/rikkimax/alphaPhobos/blob/master/source/std/experimental/uri.d --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Oct 05 2016
On Wednesday, 5 October 2016 at 10:28:44 UTC, rikki cattermole wrote:I developed[0] with the hopes that at some point in the future I could bring that over to Phobos. But before that I'm waiting for allocators to be moved out of experimental first. [0] https://github.com/rikkimax/alphaPhobos/blob/master/source/std/experimental/uri.dLooks good, thanks.
Oct 05 2016
On Wednesday, 5 October 2016 at 10:19:08 UTC, John C wrote:What packages do people use when they want to parse URIs? I rolled my own but it's incomplete and as it's a fairly common need there must be one out there? In fact, I'm surprised there isn't one in Phobos yet.It's not easy to make a true URI implementation, by "true" I mean "conform" with https://tools.ietf.org/html/rfc3986. But for the URL subset there's url.d: https://code.dlang.org/packages/urld.
Oct 05 2016
On 06/10/2016 12:12 AM, Basile B. wrote:On Wednesday, 5 October 2016 at 10:19:08 UTC, John C wrote:Yeah the spec is quite nasty. Luckily nobody uses Gopher anymore! --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirusWhat packages do people use when they want to parse URIs? I rolled my own but it's incomplete and as it's a fairly common need there must be one out there? In fact, I'm surprised there isn't one in Phobos yet.It's not easy to make a true URI implementation, by "true" I mean "conform" with https://tools.ietf.org/html/rfc3986. But for the URL subset there's url.d: https://code.dlang.org/packages/urld.
Oct 05 2016
On Thursday, October 06, 2016 00:13:03 rikki cattermole via Digitalmars-d wrote:On 06/10/2016 12:12 AM, Basile B. wrote:Yeah, like _far_ too many of the RFCs relating to the web, it's a mess. From what I recall, it's not even possible to parse a URL in a completely unambiguous manner. *sigh* - Jonathan M DavisIt's not easy to make a true URI implementation, by "true" I mean "conform" with https://tools.ietf.org/html/rfc3986.Yeah the spec is quite nasty.
Oct 05 2016
On Wednesday, 5 October 2016 at 12:14:06 UTC, Jonathan M Davis wrote:a mess. From what I recall, it's not even possible to parse a URL in a completely unambiguous manner. *sigh*yeah. everything after scheme is highly dependent of scheme itself, so your parser should know about various schemes and their syntax. and even with "http:" it sometimes a guesswork.
Oct 05 2016
On Wednesday, 5 October 2016 at 10:19:08 UTC, John C wrote:What packages do people use when they want to parse URIs?I did one based on the regex found in the RFC for my cgi and http libs. cgi version (more complete) https://github.com/adamdruppe/arsd/blob/master/cgi.d#L2163 http version (just what i needed for handling relative links in html) https://github.com/adamdruppe/arsd/blob/master/http2.d#L114 If you just need to parse a complete uri though, go ahead and use the regex from the RFC. My thing is more about making uris based on other uris for handling those links.
Oct 05 2016
On Wednesday, 5 October 2016 at 10:19:08 UTC, John C wrote:What packages do people use when they want to parse URIs? I rolled my own but it's incomplete and as it's a fairly common need there must be one out there? In fact, I'm surprised there isn't one in Phobos yet.I also wrote a function for extended url parsing based on php source code. it is in dlib: https://github.com/gecko0307/dlib dlib.network.url
Oct 05 2016
On 10/05/2016 06:19 AM, John C wrote:What packages do people use when they want to parse URIs? I rolled my own but it's incomplete and as it's a fairly common need there must be one out there? In fact, I'm surprised there isn't one in Phobos yet.IIRC there's one in vibe I used not too long ago.
Oct 05 2016
On Wednesday, 5 October 2016 at 10:19:08 UTC, John C wrote:In fact, I'm surprised there isn't one in Phobos yet.Different John C here :-) I'm sadly forced to do a bit of C++ recently and found they don't have one in the standard library either... That feels archaic and out of the 1980's compared to the ecosystem around Ruby or Perl. The downstream fallout of refusing to just "pick one", is that packages depending on such functionality each "roll their own", and users have to provide compatibility shims all over the place. Part of the success of Ruby has been it comes "With Batteries included".
Oct 05 2016