Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

First iteration of the HTTP client for cpp-netlib v1.0.0a#350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
deanberris merged 105 commits intocpp-netlib:masterfromglynos:master
Dec 18, 2013
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
105 commits
Select commitHold shift + click to select a range
faade8a
Cleaned up thread_pool so that I can read it more clearly.
glynosJun 23, 2013
19a8b0f
Started HTTP client rewriting by removing some redundant files.
glynosJun 23, 2013
2b2c2d3
Removed a redundant header from the message framework.
glynosJun 23, 2013
e1bbd36
Removed basic_storage_* types that were not being used.
glynosJun 23, 2013
e888689
Removed some more redundant files.
glynosJun 23, 2013
f169c24
Removed some more files that were not being used.
glynosJun 23, 2013
297a773
Removed redundant tests.
glynosJun 23, 2013
8bcce7a
First commit of network::http::v2::client.
glynosJun 12, 2013
fb7eecf
Updated first set of HTTP client tests.
glynosJun 19, 2013
6b51a82
Updated client_options tests.
glynosJun 20, 2013
07e1e8e
Moved some of the tests around; added class that will represent HTTP …
glynosJun 20, 2013
4eac522
Added a some extra options for the client and the request; removed so…
glynosJun 23, 2013
71757f1
Updated client sources, adding some more tests.
glynosJul 1, 2013
73b0831
Added some additional tests for the HTTP URL.
glynosJul 27, 2013
70a99a9
Added a message_base class.
glynosJul 27, 2013
40e3b59
Added HTTP constants for client 1.0.x.
glynosJul 27, 2013
f23c827
Updated and added HTTP constants.
glynosJul 27, 2013
72ea85e
Updated constants and message headers.
glynosJul 30, 2013
06cd005
Updated build scripts so as not to build the old client and server; a…
glynosAug 27, 2013
5ecb5c7
Next iteration of improvements, still a long way from a working HTTP …
glynosAug 28, 2013
41f4ec2
Added a client_errors file and invalid_scheme class.
glynosAug 28, 2013
b700bcc
Added tests and methods to the HTTP request.
glynosAug 30, 2013
6540a84
Added async_resolver.
glynosAug 31, 2013
7f9f50e
Added logging again to project.
glynosSep 1, 2013
d653b4b
Added connection_timeout exception.
glynosSep 1, 2013
055e513
Added resolver_error.
glynosSep 1, 2013
06b8b94
Added resolver delegate.
glynosSep 1, 2013
5b82479
Added connection_delegate and test files (no test cases yet).
glynosSep 1, 2013
88f6faf
Removed message_base.hpp
glynosSep 1, 2013
0610d08
Updated errors and the HTTP request.
glynosSep 1, 2013
d9174e6
Updated method type.
glynosSep 2, 2013
5e68836
Updated requests test to check the port number.
glynosSep 2, 2013
83cca78
A few updates to the client - next step is to test the components ind…
glynosSep 5, 2013
b0cdd9a
Added igloo BDD-style feature testing framework.
glynosSep 5, 2013
7bcf001
Moved the unit tests around.
glynosSep 5, 2013
b895062
Async resolver tests now use igloo.
glynosSep 5, 2013
85830b0
Updated feature tests for client and connections.
glynosSep 6, 2013
dc2d4cb
Updated some stuff that's not important.
glynosSep 6, 2013
3faaa69
Updated Doxygen comments on almost all files. Added a response_parser…
glynosSep 7, 2013
3442d76
Resolver now uses asynchronous futures.
glynosSep 8, 2013
b80ab15
Little hack to make async connection test pass (it's actually synchro…
glynosSep 8, 2013
22df4eb
Done a lot of stuff to play around with HTTP - it successfully makes …
glynosSep 8, 2013
7415d62
Updated the resolver to avoid using futures,as this turned to be very…
glynosSep 10, 2013
8295fb8
Well these test all pass...
glynosSep 10, 2013
8976b43
Updated response parser tests.
glynosSep 11, 2013
ebd7567
Updated tests for the response parser, added cancellation member func…
glynosSep 12, 2013
6a7205e
Mostly updates to documentation.
glynosSep 21, 2013
3d0cc92
Some more, incomplete documentation.
glynosSep 23, 2013
af77702
Updates to some of the tests.
glynosSep 23, 2013
40a2309
Renamed async_resolver_delegate, and removed some of the framework cr…
glynosOct 4, 2013
bcd5554
Renamed connection_delegate.
glynosOct 4, 2013
00654de
Removed some unnecessary files.
glynosOct 6, 2013
3382000
Replaced std::function handler with a template in async_resolver.
glynosOct 6, 2013
41a1e67
Removed warnings from CMakeLists.txt files, because of the noise from…
glynosOct 24, 2013
d100aaa
Removed date_time from Boost_COMPONENTS because it is header-only in …
glynosOct 25, 2013
8847a53
Renamed tests.
glynosOct 27, 2013
4b1fd17
Rewrote constants.
glynosOct 27, 2013
ae2c6d8
Updated uri submodule.
glynosOct 27, 2013
84a555b
Reworked status and HTTP client request.
glynosOct 27, 2013
603547c
Modification to connection test.
glynosNov 15, 2013
58a7782
Added an HTTP response error.
glynosNov 15, 2013
9345bed
Updated tests for the response_parser.
glynosNov 15, 2013
bb006d6
Added free swap functions to client_options, request_options, request…
glynosNov 15, 2013
b7e7aa5
Updated the connection and the connection tests.
glynosNov 15, 2013
28ffad1
Minor refactoring in request, response, client.
glynosNov 24, 2013
609ed29
Used macro NETWORK_NOEXCEPT instead of keyword noexcept.
glynosNov 24, 2013
bb42b4f
Fixed include guards.
glynosNov 24, 2013
7a3e856
Updated uri submodule.
glynosNov 24, 2013
d945654
Minor changes to the thread_pool class and headers.
glynosNov 27, 2013
e8d9262
Reverted changes where I used a macro for a noexcept replacement - we…
glynosNov 27, 2013
74d99b8
Merge remote-tracking branch 'upstream/master' into client-v2
glynosNov 30, 2013
0c85833
Updated tests for client.
glynosDec 1, 2013
0739a4a
Added some new HTTP status codes.
glynosDec 1, 2013
184d278
Updated some HTTP client errors.
glynosDec 2, 2013
d68fb57
Added a small project for generic network errors.
glynosDec 2, 2013
d043072
Added doxygen documentation for error handling.
glynosDec 2, 2013
b469278
Renamed concurrency library.
glynosDec 2, 2013
4be2b5a
Commented out stuff so the HTTP client test did not crash, at least.
glynosDec 2, 2013
7afed49
Updated README documentation.
glynosDec 2, 2013
695e074
Updated the Doxyfile.
glynosDec 7, 2013
4373fc1
Updated error handling for general networking errors. Added a network…
glynosDec 7, 2013
b02948f
Replaced the Handler template with std::function.
glynosDec 7, 2013
29ec7e2
Renamed base class connection to async_connection.
glynosDec 7, 2013
416fe04
Added an endpoint_cache class; refactored async_resolver.
glynosDec 7, 2013
58d5f94
Made async_resolver and ABC; added implementation in tcp_resolver.
glynosDec 7, 2013
44b9185
Test fails with an exception instead of a crash - progress of a kind...
glynosDec 7, 2013
2012b58
Fixed crash in HTTP client, 'get' now only returns an empty response.
glynosDec 7, 2013
a8bad17
Continued to work on the HTTP client.
glynosDec 7, 2013
619255a
Updated the client and response classes in order to make a successful…
glynosDec 8, 2013
ce3bccf
Validated that the HEAD response returns the headers.
glynosDec 8, 2013
6eb8e03
Lower case enum for HTTP status code for consistency.
glynosDec 8, 2013
b6c2bee
Updated client errors and added code to allow the processing of a res…
glynosDec 8, 2013
8f5ea83
Re-added and updated HTTP examples.
glynosDec 8, 2013
5d8d744
Added .clang-format for source code formatting.
glynosDec 8, 2013
6441091
Allow the v0.x HTTP server to be built; Refactored HTTP v2 client req…
glynosDec 11, 2013
d5b65ee
Refactored client connections into a client_connection namespace.
glynosDec 11, 2013
23ef8d0
Fixed bug in parsing the HTTP headers in the HTTP client.
glynosDec 11, 2013
6830eba
Refactored internals of client.
glynosDec 13, 2013
6ff897f
Continued to refactor the HTTP client; made the method enum class low…
glynosDec 14, 2013
1238f44
Continued to refactor and document the HTTP client source and tests.
glynosDec 14, 2013
3e33f13
Continued refactoring, improved read_headers and simple_wget examples.
glynosDec 14, 2013
a465cd8
Updated uri submodule.
glynosDec 16, 2013
49310b1
Added a flag to turn on/off the feature tests, which may access the n…
glynosDec 16, 2013
ebc7762
Added .travis.yml
glynosDec 16, 2013
e639f47
Fixed some warnings in the HTTP client request and client_exception.
glynosDec 16, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Added an endpoint_cache class; refactored async_resolver.
  • Loading branch information
@glynos
glynos committedDec 7, 2013
commit416fe040e62a7fa7ffa41e61434f699032fd4af7
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,13 +11,12 @@
#include <stdexcept>
#include <cstdint>
#include <string>
#include <unordered_map>
#include <boost/asio/io_service.hpp>
#include <boost/asio/strand.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/exception/all.hpp>
#include <network/config.hpp>
#include <network/http/v2/client/connection/endpoint_cache.hpp>

namespace network {
namespace http {
Expand DownExpand Up@@ -74,15 +73,14 @@ namespace network {
*/
void async_resolve(const std::string &host, std::uint16_t port, resolve_callback handler) {
if (cache_resolved_) {
endpoint_cache::iterator it = endpoint_cache_.find(boost::to_lower_copy(host));
auto it = endpoint_cache_.find(host);
if (it != endpoint_cache_.end()) {
boost::system::error_code ec;
handler(ec, it->second);
return;
}
}


resolver::query query(host, std::to_string(port));
resolver_.async_resolve(query,
resolver_strand_->wrap(
Expand All@@ -93,7 +91,7 @@ namespace network {
}
else {
if (cache_resolved_) {
endpoint_cache_.insert(std::make_pair(host, endpoint_iterator));
endpoint_cache_.insert(host, endpoint_iterator);
}
handler(ec, endpoint_iterator);
}
Expand All@@ -104,13 +102,12 @@ namespace network {
* \brief Clears the cache of already resolved endpoints.
*/
void clear_resolved_cache() {
endpoint_cache().swap(endpoint_cache_);
endpoint_cache_.clear();
}

private:

typedef boost::asio::io_service::strand strand;
typedef std::unordered_map<std::string, resolver_iterator> endpoint_cache;

resolver resolver_;
std::unique_ptr<strand> resolver_strand_;
Expand Down
66 changes: 66 additions & 0 deletionshttp/src/network/http/v2/client/connection/endpoint_cache.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
// Copyright (C) 2013 by Glyn Matthews
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#ifndef NETWORK_HTTP_V2_CLIENT_CONNECTION_ENDPOINT_CACHE_INC
#define NETWORK_HTTP_V2_CLIENT_CONNECTION_ENDPOINT_CACHE_INC

#include <string>
#include <unordered_map>
#include <boost/asio/ip/tcp.hpp>
#include <boost/algorithm/string/case_conv.hpp>

namespace network {
namespace http {
namespace v2 {

class endpoint_cache {

typedef boost::asio::ip::tcp::resolver resolver;

typedef resolver::iterator resolver_iterator;

typedef std::unordered_map<std::string,
resolver_iterator> cache_type;

public:

typedef cache_type::iterator iterator;

cache_type::iterator begin() {
return endpoints_.begin();
}

cache_type::iterator end() {
return endpoints_.end();
}

void insert(const std::string &host,
resolver_iterator endpoint_iterator) {
endpoints_.insert(std::make_pair(host, endpoint_iterator));
}

iterator find(const std::string &host) {
return endpoints_.find(boost::to_lower_copy(host));
}

void clear() {
endpoint_cache().swap(*this);
}

void swap(endpoint_cache &other) noexcept {
endpoints_.swap(other.endpoints_);
}

private:

cache_type endpoints_;

};

} // namespace v2
} // namespace http
} // namespace network

#endif // NETWORK_HTTP_V2_CLIENT_CONNECTION_ENDPOINT_CACHE_INC

[8]ページ先頭

©2009-2025 Movatter.jp