MXS-1220: Expand HttpResponse class

The class now generates default headers. The ETag and Last-Modified tags
do not represent any actual modification time or resource hash.

The basic functionality of the HTTP responses is tested by the core test
suite. More advanced testing of the whole REST API is still required.

Removed the static `create` functions as only the JSON parsing version
could generated errors and even then the errors were unlikely. By
replacing the static creator function with a normal constructor, the
HttpResponse class can now also be created on the stack making its use
easier.
This commit is contained in:
Markus Mäkelä
2017-04-17 03:13:22 +03:00
committed by Markus Mäkelä
parent a73d3e9276
commit 9d0d394361
7 changed files with 114 additions and 42 deletions

View File

@ -11,8 +11,7 @@
* Public License.
*/
#include "maxscale/admin.hh"
#include "maxscale/hk_heartbeat.h"
#include <maxscale/cppdefs.hh>
#include <climits>
#include <new>
@ -22,15 +21,19 @@
#include <maxscale/thread.h>
#include <maxscale/utils.h>
#include "maxscale/admin.hh"
#include "maxscale/hk_heartbeat.h"
#define DEFAULT_ADMIN_HOST "127.0.0.1"
#define DEFAULT_ADMIN_PORT 8080
#define DEFAULT_ADMIN_AUTH HTTP_AUTH_NONE
static AdminListener* admin = NULL;
static THREAD admin_thread;
static THREAD timeout_thread;
// TODO: Read values from the configuration
static AdminConfig config = {DEFAULT_ADMIN_HOST, DEFAULT_ADMIN_PORT};
static AdminConfig config = {DEFAULT_ADMIN_HOST, DEFAULT_ADMIN_PORT, DEFAULT_ADMIN_AUTH};
void admin_main(void* data)
{