From 94eac3d8b901eedf903ffa24f73e65b6010e293e Mon Sep 17 00:00:00 2001 From: Shane Bryldt Date: Thu, 28 Sep 2017 14:15:07 -0500 Subject: [PATCH] FS-10690: Temporary commit to work on linux build for civetweb stuff --- libs/libblade/Makefile.am | 9 +++++---- libs/libblade/src/blade_restmgr.c | 18 +++++++++--------- libs/libblade/src/include/blade.h | 11 +++++++++++ libs/libblade/switchblade/Makefile.am | 4 ++-- libs/libblade/switchblade/restroot/test.lp | 14 ++++++++++++++ libs/libblade/test/Makefile.am | 4 ++-- 6 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 libs/libblade/switchblade/restroot/test.lp diff --git a/libs/libblade/Makefile.am b/libs/libblade/Makefile.am index 13d68615f8..0943a67676 100644 --- a/libs/libblade/Makefile.am +++ b/libs/libblade/Makefile.am @@ -3,7 +3,8 @@ EXTRA_DIST = SUBDIRS = . test switchblade AUTOMAKE_OPTIONS = subdir-objects -AM_CFLAGS += -I$(top_srcdir)/src -I$(top_srcdir)/src/include +AM_CFLAGS += -I$(top_srcdir)/src -I$(top_srcdir)/src/include -I$(top_srcdir)/../civetweb-1.9.1/include +AM_LDFLAGS += -L$(top_srcdir)/../civetweb-1.9.1 noinst_LTLIBRARIES = libunqlite.la libunqlite_la_SOURCES = src/unqlite.c @@ -13,19 +14,19 @@ libunqlite_la_LIBADD = -lpthread lib_LTLIBRARIES = libblade.la libblade_la_SOURCES = src/blade.c src/blade_stack.c libblade_la_SOURCES += src/blade_transportmgr.c src/blade_rpcmgr.c src/blade_routemgr.c src/blade_subscriptionmgr.c -libblade_la_SOURCES += src/blade_mastermgr.c src/blade_connectionmgr.c src/blade_sessionmgr.c +libblade_la_SOURCES += src/blade_mastermgr.c src/blade_connectionmgr.c src/blade_sessionmgr.c src/blade_restmgr.c libblade_la_SOURCES += src/blade_identity.c src/blade_rpc.c src/blade_connection.c src/blade_session.c libblade_la_SOURCES += src/blade_protocol.c src/blade_subscription.c src/blade_channel.c libblade_la_SOURCES += src/blade_transport.c src/blade_transport_wss.c libblade_la_CFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -libblade_la_LDFLAGS = -version-info 0:1:0 -lncurses -lpthread -lm -lconfig $(AM_LDFLAGS) +libblade_la_LDFLAGS = -version-info 0:1:0 -lncurses -lpthread -lm -lconfig -lcivetweb $(AM_LDFLAGS) libblade_la_LIBADD = libunqlite.la library_includedir = $(prefix)/include library_include_HEADERS = src/include/blade.h src/include/blade_types.h src/include/blade_stack.h library_include_HEADERS += src/include/blade_transportmgr.h src/include/blade_rpcmgr.h src/include/blade_routemgr.h src/include/blade_subscriptionmgr.h -library_include_HEADERS += src/include/blade_mastermgr.h src/include/blade_connectionmgr.h src/include/blade_sessionmgr.h +library_include_HEADERS += src/include/blade_mastermgr.h src/include/blade_connectionmgr.h src/include/blade_sessionmgr.h src/include/blade_restmgr.h library_include_HEADERS += src/include/blade_identity.h src/include/blade_rpc.h src/include/blade_connection.h src/include/blade_session.h library_include_HEADERS += src/include/blade_protocol.h src/include/blade_subscription.h src/include/blade_channel.h library_include_HEADERS += src/include/blade_transport.h src/include/blade_transport_wss.h diff --git a/libs/libblade/src/blade_restmgr.c b/libs/libblade/src/blade_restmgr.c index 9f1f8b8ad9..f819f61a21 100644 --- a/libs/libblade/src/blade_restmgr.c +++ b/libs/libblade/src/blade_restmgr.c @@ -1,23 +1,23 @@ /* * Copyright (c) 2017, Shane Bryldt * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * * Neither the name of the original author; nor the names of any contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * - * + * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -85,7 +85,7 @@ KS_DECLARE(ks_status_t) blade_restmgr_create(blade_restmgr_t **brestmgrP, blade_ blade_restmgr_t *brestmgr = NULL; ks_assert(brestmgrP); - + ks_pool_open(&pool); ks_assert(pool); @@ -123,7 +123,7 @@ KS_DECLARE(ks_status_t) blade_restmgr_destroy(blade_restmgr_t **brestmgrP) #define CONFIG_LOADSTR(k) \ tmp = config_lookup_from(rest, k); \ if (tmp && config_setting_type(tmp) != CONFIG_TYPE_STRING) return KS_STATUS_FAIL; \ -if (tmp) ks_hash_insert(brestmgr->config.options, (const void *)k, (void *)ks_pstrdup(pool, config_setting_get_string(tmp))); +if (tmp) ks_hash_insert(brestmgr->config.options, (void *)k, (void *)ks_pstrdup(pool, config_setting_get_string(tmp))); ks_status_t blade_restmgr_config(blade_restmgr_t *brestmgr, config_setting_t *config) { @@ -298,7 +298,7 @@ int blade_restmgr_handle_begin_request(struct mg_connection *conn) void blade_restmgr_handle_end_request(const struct mg_connection *conn, int reply_status_code) { - + } int blade_restmgr_handle_log_message(const struct mg_connection *conn, const char *message) diff --git a/libs/libblade/src/include/blade.h b/libs/libblade/src/include/blade.h index cbe612868b..def7d1acf3 100644 --- a/libs/libblade/src/include/blade.h +++ b/libs/libblade/src/include/blade.h @@ -33,6 +33,17 @@ #ifndef _BLADE_H_ #define _BLADE_H_ + +#define USE_STACK_SIZE 102400 +#define MAX_REQUEST_SIZE 16384 +#define USE_DUKTAPE 1 +#define USE_IPV6 1 +#define LUA_COMPAT_ALL 1 +#define USE_LUA 1 +#define USE_LUA_SQLITE3 1 +#define USE_LUA_FILE_SYSTEM 1 +#define USE_WEBSOCKET 1 + #include #include #include diff --git a/libs/libblade/switchblade/Makefile.am b/libs/libblade/switchblade/Makefile.am index 0b842ce6d1..5c6be0e6ba 100644 --- a/libs/libblade/switchblade/Makefile.am +++ b/libs/libblade/switchblade/Makefile.am @@ -1,5 +1,5 @@ -AM_CFLAGS += -I$(abs_top_srcdir)/src/include -g -ggdb -O0 -TEST_LDADD = $(abs_top_builddir)/libblade.la -lconfig -lm -lpthread +AM_CFLAGS += -I$(abs_top_srcdir)/src/include -g -ggdb -O0 -I$(top_srcdir)/../civetweb-1.9.1/include +TEST_LDADD = $(abs_top_builddir)/libblade.la -L$(top_srcdir)/../civetweb-1.9.1 -lconfig -lm -lpthread -lcivetweb check_PROGRAMS = diff --git a/libs/libblade/switchblade/restroot/test.lp b/libs/libblade/switchblade/restroot/test.lp new file mode 100644 index 0000000000..d3794d07ff --- /dev/null +++ b/libs/libblade/switchblade/restroot/test.lp @@ -0,0 +1,14 @@ +HTTP/1.0 200 OK +Content-Type: text/html + + + +

+Today is: + +

+

+URI is +

+ + diff --git a/libs/libblade/test/Makefile.am b/libs/libblade/test/Makefile.am index 1884b5847e..8218b74572 100644 --- a/libs/libblade/test/Makefile.am +++ b/libs/libblade/test/Makefile.am @@ -1,5 +1,5 @@ -AM_CFLAGS += -I$(abs_top_srcdir)/src/include -g -ggdb -O0 -TEST_LDADD = $(abs_top_builddir)/libblade.la -lconfig -lm -lpthread +AM_CFLAGS += -I$(abs_top_srcdir)/src/include -g -ggdb -O0 -I$(top_srcdir)/../civetweb-1.9.1/include +TEST_LDADD = $(abs_top_builddir)/libblade.la -L$(top_srcdir)/../civetweb-1.9.1 -lconfig -lm -lpthread -lcivetweb check_PROGRAMS =