Skip to content

Commit

Permalink
Merge branch 'http-client-refactoring'
Browse files Browse the repository at this point in the history
  • Loading branch information
deanberris committed Mar 26, 2012
2 parents 64dd8cc + a0f68a7 commit 10244c6
Show file tree
Hide file tree
Showing 281 changed files with 10,041 additions and 8,611 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ Testing
*.gch
libs/mime/test/mime-roundtrip
*.a
bin/
tests/
_build
168 changes: 25 additions & 143 deletions boost/network/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,151 +6,33 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <boost/network/support/is_default_string.hpp>
#include <boost/network/support/is_default_wstring.hpp>
#include <boost/mpl/if.hpp>

namespace boost { namespace network {

namespace impl {
template <class Tag>
struct constants_narrow {

static char const * crlf() {
static char crlf_[] = { '\r', '\n', 0 };
return crlf_;
}

static char const * dot() {
static char dot_[] = { '.', 0 };
return dot_;
}

static char dot_char() { return '.'; }

static char const * http_slash() {
static char http_slash_[] = { 'H', 'T', 'T', 'P', '/', 0 };
return http_slash_;
}

static char const * space() {
static char space_[] = {' ', 0};
return space_;
}

static char space_char() { return ' '; }

static char const * slash() {
static char slash_[] = {'/', 0};
return slash_;
}

static char slash_char() { return '/'; }

static char const * host() {
static char host_[] = {'H', 'o', 's', 't', 0};
return host_;
}

static char const * colon() {
static char colon_[] = {':', 0};
return colon_;
}

static char colon_char() { return ':'; }

static char const * accept() {
static char accept_[] = {'A', 'c', 'c', 'e', 'p', 't', 0};
return accept_;
}

static char const * default_accept_mime() {
static char mime_[] = {
'*', '/', '*', 0
};
return mime_;
}

static char const * accept_encoding() {
static char accept_encoding_[] = {
'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',0
};
return accept_encoding_;
}

static char const * default_accept_encoding() {
static char default_accept_encoding_[] = {
'i','d','e','n','t','i','t','y',';','q','=','1','.','0',',',' ','*',';','q','=','0',0
};
return default_accept_encoding_;
}

static char const * user_agent() {
static char user_agent_[] = {
'U','s','e','r','-','A','g','e','n','t',0
};
return user_agent_;
}

static char const * cpp_netlib_slash() {
static char cpp_netlib_slash_[] = {
'c','p','p','-','n','e','t','l','i','b','/',0
};
return cpp_netlib_slash_;
}

static char question_mark_char() {
return '?';
}

static char hash_char() {
return '#';
}

static char const * connection() {
static char connection_[] = {
'C','o','n','n','e','c','t','i','o','n',0
};
return connection_;
}

static char const * close() {
static char close_[] = {
'C','l','o','s','e', 0
};
return close_;
}

static char const * https() {
static char https_[] = "https";
return https_;
}

};

template <class Tag>
struct constants_wide {

static wchar_t const * https() {
static wchar_t https_[] = L"https";
return https_;
}

};
}

template <class Tag>
struct constants :
mpl::if_<
is_default_string<Tag>,
impl::constants_narrow<Tag>,
typename mpl::if_<
is_default_wstring<Tag>,
impl::constants_wide<Tag>,
unsupported_tag<Tag>
>::type
>::type
{};
struct constants {
static char const * crlf();
static char const * dot();
static char dot_char();
static char const * http_slash();
static char const * space();
static char space_char();
static char const * slash();
static char slash_char();
static char const * host();
static char const * colon();
static char colon_char();
static char const * accept();
static char const * default_accept_mime();
static char const * accept_encoding();
static char const * default_accept_encoding();
static char const * user_agent();
static char const * default_user_agent();
static char const * cpp_netlib_slash();
static char question_mark_char();
static char hash_char();
static char const * connection();
static char const * close();
static char const * https();
};

} // namespace network

Expand Down
130 changes: 130 additions & 0 deletions boost/network/constants.ipp
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#ifndef BOOST_NETWORK_CONSTANTS_HPP_20111008
#define BOOST_NETWORK_CONSTANTS_HPP_20111008

// Copyright 2011 Dean Michael Berris <dberris@google.com>.
// Copyright 2011 Google, Inc.
// 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)

#include <boost/network/constants.hpp>
#include <boost/network/version.hpp>

namespace boost { namespace network {

char const * constants::crlf() {
static char crlf_[] = "\r\n";
return crlf_;
}

char const * constants::dot() {
static char dot_[] = ".";
return dot_;
}

char constants::dot_char() { return '.'; }

char const * constants::http_slash() {
static char http_slash_[] = "HTTP/";
return http_slash_;
}

char const * constants::space() {
static char space_[] = {' ', 0};
return space_;
}

char constants::space_char() { return ' '; }

char const * constants::slash() {
static char slash_[] = {'/', 0};
return slash_;
}

char constants::slash_char() { return '/'; }

char const * constants::host() {
static char host_[] = {'H', 'o', 's', 't', 0};
return host_;
}

char const * constants::colon() {
static char colon_[] = {':', 0};
return colon_;
}

char constants::colon_char() { return ':'; }

char const * constants::accept() {
static char accept_[] = {'A', 'c', 'c', 'e', 'p', 't', 0};
return accept_;
}

char const * constants::default_accept_mime() {
static char mime_[] = {
'*', '/', '*', 0
};
return mime_;
}

char const * constants::accept_encoding() {
static char accept_encoding_[] = {
'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',0
};
return accept_encoding_;
}

char const * constants::default_accept_encoding() {
static char default_accept_encoding_[] = {
'i','d','e','n','t','i','t','y',';','q','=','1','.','0',',',' ','*',';','q','=','0',0
};
return default_accept_encoding_;
}

char const * constants::user_agent() {
static char user_agent_[] = {
'U','s','e','r','-','A','g','e','n','t',0
};
return user_agent_;
}

char const * constants::cpp_netlib_slash() {
static char cpp_netlib_slash_[] = {
'c','p','p','-','n','e','t','l','i','b','/',0
};
return cpp_netlib_slash_;
}

char constants::question_mark_char() {
return '?';
}

char constants::hash_char() {
return '#';
}

char const * constants::connection() {
static char connection_[] = "Connection";
return connection_;
}

char const * constants::close() {
static char close_[] = "close";
return close_;
}

char const * constants::https() {
static char https_[] = "https";
return https_;
}

char const * constants::default_user_agent() {
static char user_agent_[] = "cpp-netlib/" BOOST_NETLIB_VERSION;
return user_agent_;
}

} /* network */

} /* boost */

#endif /* BOOST_NETWORK_CONSTANTS_HPP_20111008 */
6 changes: 6 additions & 0 deletions boost/network/include/http/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
// This is the modular include file for using the HTTP Client

#include <boost/network/protocol/http/client.hpp>
#include <boost/network/message/wrappers.hpp>
#include <boost/network/protocol/http/message/directives.hpp>
#include <boost/network/protocol/http/message/modifiers.hpp>
#include <boost/network/protocol/http/message/wrappers.hpp>
#include <boost/network/message/directives.hpp>
#include <boost/network/message/transformers.hpp>

#endif // BOOST_NETWORK_INCLUDE_HTTP_CLIENT_HPP_

6 changes: 5 additions & 1 deletion boost/network/include/http/server.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#ifndef BOOST_NETWORK_INCLUDE_HTTP_SERVER_HPP_
#define BOOST_NETWORK_INCLUDE_HTTP_SERVER_HPP_

// Copyright 2010 Dean Michael Berris
// Copyright 2010-2012 Dean Michael Berris <dberris@google.com>.
// Copyright 2012 Google, Inc.
// 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)
//
// This is the modular include file for using the HTTP Client

#include <boost/asio/io_service.hpp>
#include <boost/network/protocol/http/server.hpp>
#include <boost/network/utils/thread_pool.hpp>
#include <boost/network/detail/debug.hpp>

#endif
1 change: 0 additions & 1 deletion boost/network/include/message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
//
// This is the modular include file for using the basic message type

#include <boost/network/tags.hpp>
#include <boost/network/message.hpp>

#endif // BOOST_NETWORK_INCLUDE_MESSAGE_HPP_
Expand Down
Loading

0 comments on commit 10244c6

Please sign in to comment.