Skip to content

Commit 4c9b4a7

Browse files
author
Sebastiano Merlino
committed
Changed http_resource to use virtual istead of CRTP
1 parent 02df5e7 commit 4c9b4a7

20 files changed

+97
-346
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Sat Jan 26 15:08:22 2016 +0100
2+
Changed http_resource to use classic C++ polymorphism using virtual instead of CRTP
3+
14
Fri Jul 17 21:38:54 2015 +0000
25
Removed build dependency on pkg-config
36

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
AC_PREREQ(2.57)
2323
m4_define([libhttpserver_MAJOR_VERSION],[0])dnl
24-
m4_define([libhttpserver_MINOR_VERSION],[9])dnl
25-
m4_define([libhttpserver_REVISION],[1])dnl
24+
m4_define([libhttpserver_MINOR_VERSION],[10])dnl
25+
m4_define([libhttpserver_REVISION],[0])dnl
2626
m4_define([libhttpserver_PKG_VERSION],[libhttpserver_MAJOR_VERSION.libhttpserver_MINOR_VERSION.libhttpserver_REVISION])dnl
2727
m4_define([libhttpserver_LDF_VERSION],[libhttpserver_MAJOR_VERSION:libhttpserver_MINOR_VERSION:libhttpserver_REVISION])dnl
2828
AC_INIT([libhttpserver], libhttpserver_PKG_VERSION, [electrictwister2000@gmail.com])

debian/changelog.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
libhttpserver (0.10.0) unstable; urgency=low
2+
* Changed http_resource to use classic C++ polymorphism using virtual instead of CRTP
3+
4+
-- Sebastiano Merlino <electrictwister2000@gmail.com> Sat, 26 Jan 2016 15:08:22 +0100
5+
16
libhttpserver (0.9.1) unstable; urgency=low
27
* Eliminated build dependency on pkg-config
38

examples/hello_world.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
using namespace httpserver;
2525

26-
class hello_world_resource : public http_resource<hello_world_resource> {
26+
class hello_world_resource : public http_resource {
2727
public:
2828
void render(const http_request&, http_response**);
2929
void set_some_data(const std::string &s) {data = s;}

examples/service.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ using namespace httpserver;
2727

2828
bool verbose=false;
2929

30-
class service_resource: public http_resource<service_resource> {
30+
class service_resource: public http_resource {
3131
public:
3232
service_resource();
3333

src/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ METASOURCES = AUTO
2121
lib_LTLIBRARIES = libhttpserver.la
2222
libhttpserver_la_SOURCES = string_utilities.cpp webserver.cpp http_utils.cpp http_request.cpp http_response.cpp http_resource.cpp details/comet_manager.cpp details/http_endpoint.cpp
2323
noinst_HEADERS = httpserver/string_utilities.hpp httpserver/details/modded_request.hpp httpserver/details/http_response_ptr.hpp httpserver/details/cache_entry.hpp httpserver/details/comet_manager.hpp gettext.h
24-
nobase_include_HEADERS = httpserver.hpp httpserver/create_webserver.hpp httpserver/webserver.hpp httpserver/http_utils.hpp httpserver/details/http_endpoint.hpp httpserver/http_request.hpp httpserver/http_response.hpp httpserver/http_resource.hpp httpserver/binders.hpp httpserver/event_supplier.hpp httpserver/details/event_tuple.hpp httpserver/details/http_resource_mirror.hpp httpserver/http_response_builder.hpp
24+
nobase_include_HEADERS = httpserver.hpp httpserver/create_webserver.hpp httpserver/webserver.hpp httpserver/http_utils.hpp httpserver/details/http_endpoint.hpp httpserver/http_request.hpp httpserver/http_response.hpp httpserver/http_resource.hpp httpserver/binders.hpp httpserver/event_supplier.hpp httpserver/details/event_tuple.hpp httpserver/http_response_builder.hpp
2525

2626
AM_CXXFLAGS += -fPIC -Wall
2727

src/http_resource.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "details/event_tuple.hpp"
2828
#include "webserver.hpp"
2929
#include "string_utilities.hpp"
30+
#include "http_response_builder.hpp"
3031

3132
using namespace std;
3233

@@ -45,4 +46,14 @@ void resource_init(map<string, bool>& allowed_methods)
4546
allowed_methods[MHD_HTTP_METHOD_OPTIONS] = true;
4647
}
4748

49+
namespace details
50+
{
51+
52+
void empty_render(const http_request& r, http_response** res)
53+
{
54+
*res = new http_response(http_response_builder("", 200).string_response());
55+
}
56+
57+
};
58+
4859
};

src/http_response.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include <fcntl.h>
2626
#include <unistd.h>
2727
#include "http_utils.hpp"
28-
#include "details/http_resource_mirror.hpp"
2928
#include "details/event_tuple.hpp"
3029
#include "webserver.hpp"
3130
#include "http_response.hpp"
@@ -36,6 +35,8 @@ using namespace std;
3635
namespace httpserver
3736
{
3837

38+
class webserver;
39+
3940
http_response::http_response(const http_response_builder& builder):
4041
content(builder._content_hook),
4142
response_code(builder._response_code),

src/httpserver.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "httpserver/http_request.hpp"
3232
#include "httpserver/event_supplier.hpp"
3333
#include "httpserver/details/event_tuple.hpp"
34-
#include "httpserver/details/http_resource_mirror.hpp"
3534
#include "httpserver/webserver.hpp"
3635

3736
#endif

src/httpserver/details/cache_entry.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include <pthread.h>
2929
#include <set>
3030
#include "httpserver/details/http_response_ptr.hpp"
31-
#include "httpserver/http_response.hpp"
3231

3332
namespace httpserver
3433
{

0 commit comments

Comments
 (0)