Merge lp://staging/~pete-woods/net-cpp/uri-builder into lp://staging/net-cpp

Proposed by Pete Woods
Status: Merged
Approved by: Thomas Voß
Approved revision: 43
Merged at revision: 38
Proposed branch: lp://staging/~pete-woods/net-cpp/uri-builder
Merge into: lp://staging/net-cpp
Diff against target: 369 lines (+230/-14)
10 files modified
CMakeLists.txt (+1/-1)
debian/changelog (+7/-0)
debian/libnet-cpp1.symbols (+2/-0)
include/core/net/http/client.h (+5/-0)
include/core/net/uri.h (+94/-0)
src/CMakeLists.txt (+1/-0)
src/core/net/http/client.cpp (+38/-1)
src/core/net/http/impl/curl/client.h (+1/-0)
src/core/net/uri.cpp (+27/-0)
tests/http_client_test.cpp (+54/-12)
To merge this branch: bzr merge lp://staging/~pete-woods/net-cpp/uri-builder
Reviewer Review Type Date Requested Status
Thomas Voß (community) Approve
Ubuntu Phablet Team Pending
Review via email: mp+222614@code.staging.launchpad.net

Commit message

Add URI building API

Description of the change

Add URI building API

To post a comment you must log in.
Revision history for this message
Thomas Voß (thomas-voss) wrote :

Thanks for getting started on this. I have a few comments:

(1.) I would propose to have a

struct Uri
{
struct Endpoint
{
};

struct Parameters
{
};
};

Where Endpoint and Parameters could just be appropriate typedefs. We could put it into core/net/uri.h, being ready for consumption by core/net/http/client.h.

(2.) We should provide a default implementation of build_uri, that can be reused by any implementation that provides implementations for url_escape.

(3.) There are some manual uri setups in the test-cases. I would appreciate it if you could change those to leverage the new interface.

review: Needs Fixing
Revision history for this message
Pete Woods (pete-woods) wrote :

Before I go changing the rest of the test suite, is this more what you wanted?

Revision history for this message
Thomas Voß (thomas-voss) wrote :

> Before I go changing the rest of the test suite, is this more what you wanted?

Yes, that matches my mental model :) thanks.

Revision history for this message
Pete Woods (pete-woods) wrote :

Hmm, just started looking at this, and the httpbin paths aren't really in a useful form for this.

i.e. they provide:

base = "http://127.0.0.1:5000"
path = "/get/banana"

To put these in a useful form for the API, I'd first have to split them into their components, then pass those into the URI builder. Seems like a lot of effort to go through.

If I just ran them through like this:
    net::make_uri(httpbin::host, {httpbin::resources::get()})
then it will URI escape the slash characters, which is not what we want at all.

The alternative would be to do this:
    net::make_uri(httpbin::host + httpbin::resources::get())
but I'm not sure if that's any better than just using a string?

31. By PS Jenkins bot

Empty MP for landing.

32. By PS Jenkins bot

Update symbols

33. By PS Jenkins bot

Releasing 0.0.1+14.10.20140611-0ubuntu1

Revision history for this message
Thomas Voß (thomas-voss) wrote :

Fair point, let's leave the httpbin tests as they are then.

review: Needs Fixing
35. By Pete Woods

Clean up

36. By Pete Woods

URL escape the endpoint

37. By Pete Woods

Extract out Uri class

38. By Pete Woods

Add some documentation to Uri

39. By Pete Woods

Rename endpoints -> endpoint

40. By Pete Woods

Bump version number for new API method

41. By Pete Woods

Remove un-necessary include

Revision history for this message
Pete Woods (pete-woods) wrote :

Hopefully I should have addressed your remaining concerns now. :)

42. By Pete Woods

Make docs "compile"

43. By Pete Woods

Rename Uri components

Revision history for this message
Pete Woods (pete-woods) wrote :

Okay, I've renamed the URI components to host, path, and query_parameters now.

Revision history for this message
Thomas Voß (thomas-voss) wrote :

LGTM, thanks for the changes.

review: Approve
44. By Pete Woods

Merge trunk

45. By Pete Woods

Merge trunk

46. By Pete Woods

Add new symbols

47. By Pete Woods

Increment the minor revision, instead of the patch one

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches