Created
August 5, 2013 18:45
-
-
Save nico159/6158335 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2010 (C) Dean Michael Berris | |
// 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) | |
#pragma once | |
namespace network { | |
namespace http { | |
template <int CODE> | |
struct status { | |
status() : code(CODE) { } | |
static const int code; | |
}; | |
template <> | |
struct status<200> { | |
static const int code = 200; | |
static const char buffer[] = "HTTP/1.0 200 OK\r\n"; | |
}; | |
typedef status_ok status<200>; | |
template <> | |
struct status<201> { | |
static const int code = 201; | |
static const char message_html[] = "<html>" | |
"<head><title>Created</title></head>" | |
"<body><h1>201 Created</h1></body>" | |
"</html>"; | |
static const char buffer[] = "HTTP/1.0 201 Created\r\n"; | |
}; | |
typedef status_crated status<201>; | |
template <> | |
struct status_base<202> { | |
static const int code = 202; | |
static const char message_html[] = "<html>" | |
"<head><title>Accepted</title></head>" | |
"<body><h1>202 Accepted</h1></body>" | |
"</html>"; | |
static const char buffer[] = "HTTP/1.0 202 Accepted\r\n"; | |
}; | |
typedef status_accepted status<202>; | |
template <> | |
struct status_base<204> { | |
static const int code = 204; | |
static const char message_html[] = "<html>" | |
"<head><title>No Content</title></head>" | |
"<body><h1>204 Content</h1></body>" | |
"</html>"; | |
static const char buffer[] = "HTTP/1.0 204 No Content\r\n"; | |
}; | |
typedef status_no_content status<204>; | |
} // namespace http | |
} // namespace network |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment