20 #include <ripple/basics/Log.h>
21 #include <ripple/json/to_string.h>
22 #include <ripple/protocol/BuildInfo.h>
23 #include <ripple/protocol/SystemParameters.h>
24 #include <ripple/protocol/jss.h>
25 #include <ripple/server/impl/JSONRPCUtil.h>
26 #include <boost/algorithm/string.hpp>
43 gmtime_r(&now, &now_gmt);
45 gmtime_s(&now_gmt, &now);
50 "Date: %a, %d %b %Y %H:%M:%S +0000\r\n",
62 JLOG(j.
trace()) <<
"HTTP Reply " << nStatus <<
" " << content;
64 if (content.empty() && nStatus == 401)
66 output(
"HTTP/1.0 401 Authorization Required\r\n");
72 output(
"Server: " +
systemName() +
"-json-rpc/v1");
79 "WWW-Authenticate: Basic realm=\"jsonrpc\"\r\n"
80 "Content-Type: text/html\r\n"
81 "Content-Length: 296\r\n"
83 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 "
84 "Transitional//EN\"\r\n"
85 "\"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"
89 "<TITLE>Error</TITLE>\r\n"
90 "<META HTTP-EQUIV='Content-Type' "
91 "CONTENT='text/html; charset=ISO-8859-1'>\r\n"
93 "<BODY><H1>401 Unauthorized.</H1></BODY>\r\n");
101 output(
"HTTP/1.1 200 OK\r\n");
104 output(
"HTTP/1.1 202 Accepted\r\n");
107 output(
"HTTP/1.1 400 Bad Request\r\n");
110 output(
"HTTP/1.1 401 Authorization Required\r\n");
113 output(
"HTTP/1.1 403 Forbidden\r\n");
116 output(
"HTTP/1.1 404 Not Found\r\n");
119 output(
"HTTP/1.1 405 Method Not Allowed\r\n");
122 output(
"HTTP/1.1 429 Too Many Requests\r\n");
125 output(
"HTTP/1.1 500 Internal Server Error\r\n");
128 output(
"HTTP/1.1 501 Not Implemented\r\n");
131 output(
"HTTP/1.1 503 Server is overloaded\r\n");
138 "Connection: Keep-Alive\r\n"
148 "Content-Type: application/json; charset=UTF-8\r\n");
150 output(
"Server: " +
systemName() +
"-json-rpc/");
Stream trace() const
Severity stream access functions.
std::string getHTTPHeaderTimestamp()
void HTTPReply(int nStatus, std::string const &content, Json::Output const &output, beast::Journal j)
A generic endpoint for log messages.
std::string const & getFullVersionString()
Full server version string.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
static std::string const & systemName()