From: Nelson, E. - 2 <eri...@ba...> - 2010-02-04 20:13:52
|
I didn't see one in the hello_world_server example... am I looking in the wrong place? Erik |
From: Glyn M. <gly...@gm...> - 2010-02-04 20:21:47
|
Hi Erik, On 4 February 2010 21:13, Nelson, Erik - 2 <eri...@ba...>wrote: > I didn't see one in the hello_world_server example... am I looking in > the wrong place? > > You're not, there isn't an HTTP URI example. Glyn |
From: Jeroen H. <vex...@gm...> - 2010-02-04 20:33:17
|
Hi, On Thu, Feb 4, 2010 at 21:21, Glyn Matthews <gly...@gm...> wrote: > Hi Erik, > > On 4 February 2010 21:13, Nelson, Erik - 2 <eri...@ba...> > wrote: >> >> I didn't see one in the hello_world_server example... am I looking in >> the wrong place? >> > > You're not, there isn't an HTTP URI example. > Glyn > There's this, http://github.com/mikhailberis/cpp-netlib/blob/0.5/libs/network/example/uri.cpp which uses http::uri, but it isn't much. The URI tests might offer some insight too, those can be found at http://github.com/mikhailberis/cpp-netlib/blob/0.5/libs/network/test/url_test.cpp. Jeroen |
From: Nelson, E. - 2 <eri...@ba...> - 2010-02-04 20:39:05
|
On Thursday, February 04, 2010 3:33 PM Jeroen Habraken [mailto:vex...@gm...] wrote: >There's this, http://github.com/mikhailberis/cpp-netlib/blob/0.5/libs/network/example/ uri.cpp >which uses http::uri, but it isn't much. The URI tests might offer some insight too, >those can be found at http://github.com/mikhailberis/cpp-netlib/blob/0.5/libs/network/test/url _test.cpp. Thanks, that's helpful Erik |
From: Nelson, E. - 2 <eri...@ba...> - 2010-02-04 21:12:09
|
On Thursday, February 04, 2010 3:33 PM Jeroen Habraken [mailto:vex...@gm...] wrote: >There's this, http://github.com/mikhailberis/cpp-netlib/blob/0.5/libs/network/example/ uri.cpp >which uses http::uri, but it isn't much. The URI tests might offer some insight too, >those can be found at http://github.com/mikhailberis/cpp-netlib/blob/0.5/libs/network/test/url _test.cpp. Okay, I'm playing around with it a little bit... If I use a URL like http://localhost:8000/test?arg=5 against the hello_world_server example, and in the handler do something like boost::network::uri::http::uri http_uri(request.uri) the request.uri is something like "/test?arg=5" and http_uri.valid() is false... Is this expected? I would have guessed that request.uri would parse okay. Is there some support for pulling apart the query string (separating the path from the arguments)? Thanks Erik |
From: Jeroen H. <vex...@gm...> - 2010-02-04 21:48:27
Attachments:
http_uri.cpp
|
Hi, On Thu, Feb 4, 2010 at 22:11, Nelson, Erik - 2 <eri...@ba...> wrote: > > On Thursday, February 04, 2010 3:33 PM Jeroen Habraken > [mailto:vex...@gm...] wrote: > >>There's this, > http://github.com/mikhailberis/cpp-netlib/blob/0.5/libs/network/example/ > uri.cpp >>which uses http::uri, but it isn't much. The URI tests might offer some > insight too, >>those can be found at > http://github.com/mikhailberis/cpp-netlib/blob/0.5/libs/network/test/url > _test.cpp. > > > Okay, I'm playing around with it a little bit... If I use a > URL like http://localhost:8000/test?arg=5 against the hello_world_server > example, and in the handler do something like > > boost::network::uri::http::uri http_uri(request.uri) > > the request.uri is something like "/test?arg=5" and http_uri.valid() is > false... Is this expected? I would have guessed that request.uri would > parse okay. Is there some support for pulling apart the query string > (separating the path from the arguments)? > > Thanks > > Erik > I can't reproduce this behaviour with the http::uri parser in netlib 0.5, so I'm uncertain where this goes wrong. I've added the test as a trivial example of how to use http::uri. Jeroen |
From: Nelson, E. - 2 <eri...@ba...> - 2010-02-04 22:05:42
|
Jeroen Habraken wrote: >I can't reproduce this behaviour with the http::uri parser in netlib 0.5, >so I'm uncertain where this goes wrong. I've added the test as a trivial >example of how to use http::uri. Thanks, but a better test might be something like string test = "/test?arg=5"; since that's what request.uri produces in this case Erik |
From: Jeroen H. <vex...@gm...> - 2010-02-04 22:11:26
|
On Thu, Feb 4, 2010 at 23:05, Nelson, Erik - 2 <eri...@ba...> wrote: > Jeroen Habraken wrote: >>I can't reproduce this behaviour with the http::uri parser in netlib > 0.5, >>so I'm uncertain where this goes wrong. I've added the test as a > trivial >>example of how to use http::uri. > > Thanks, but a better test might be something like > > string test = "/test?arg=5"; > > since that's what request.uri produces in this case > > Erik > Ah, in that case it makes sense, "/test?arg=5" is a relative URI, not an absolute one, and something we decided not to support in the URI parser. Jeroen |
From: Nelson, E. - 2 <eri...@ba...> - 2010-02-04 22:18:52
|
Jeroen Habraken wrote: >Ah, in that case it makes sense, "/test?arg=5" is a relative URI, not an > absolute one, and something we decided not to support in the URI parser. That's fair enough, though it does seem a little counter-intuitive that the value in request.uri can't be parsed. Is there support in cpp-netlib for digging out the arguments, or will I need to write my own parser to grab things like 'arg=5'? Erik |
From: Jeroen H. <vex...@gm...> - 2010-02-04 22:24:36
|
On Thu, Feb 4, 2010 at 23:18, Nelson, Erik - 2 <eri...@ba...> wrote: > Jeroen Habraken wrote: > >>Ah, in that case it makes sense, "/test?arg=5" is a relative URI, not > an >> absolute one, and something we decided not to support in the URI > parser. > > That's fair enough, though it does seem a little counter-intuitive that > the value in request.uri can't be parsed. Is there support in > cpp-netlib for digging out the arguments, or will I need to write my own > parser to grab things like 'arg=5'? > > Erik > You can call query() on a uri and http::uri to grab the query string, but we currently don't have a parser for them yet. It's on my TODO list though. You could give writing one yourself based on http://boost-spirit.com/home/articles/qi-example/parsing-a-list-of-key-value-pairs-using-spirit-qi/ a shot, it shouldn't be too hard. Jeroen |
From: Nelson, E. - 2 <eri...@ba...> - 2010-02-04 22:31:51
|
Jeroen Habraken wrote: >You can call query() on a uri and http::uri to grab the query string, but >we currently don't have a parser for them yet. It's on my TODO list though. >You could give writing one yourself based on >http://boost-spirit.com/home/articles/qi-example/parsing-a-list-of-key- value-pairs-using-spirit-qi/ >a shot, it shouldn't be too hard. Okay, I'll see if I can put together something that works well enough. Thanks Erik |