diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-09-25 02:57:21 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-09-25 02:57:21 +0200 |
commit | 6ac53d4c783340ae9139c7f4dcfe9bfddace5892 (patch) | |
tree | 2637740546dcf002fbfe39eb94d6f722a2c5c7d6 /Makefile.am | |
parent | 0c916e2c8b56c320fdc81f68d445194559479041 (diff) | |
download | blogc-6ac53d4c783340ae9139c7f4dcfe9bfddace5892.tar.gz blogc-6ac53d4c783340ae9139c7f4dcfe9bfddace5892.tar.bz2 blogc-6ac53d4c783340ae9139c7f4dcfe9bfddace5892.zip |
runserver: reimplemented http server without libevent
yeah, this patch implements a "complete" http server for static files.
It is not the best code possible, and would be easily DDoS'able if used
in production, as it spawns a thread for each request, without limiting.
I'm sickish and this is the best code I can deliver now. At least it
works! ;)
Diffstat (limited to 'Makefile.am')
-rw-r--r-- | Makefile.am | 72 |
1 files changed, 70 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index 7ecb21a..12cfad8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,6 +39,9 @@ noinst_HEADERS = \ src/blogc/renderer.h \ src/blogc/source-parser.h \ src/blogc/template-parser.h \ + src/blogc-runserver/httpd.h \ + src/blogc-runserver/httpd-utils.h \ + src/blogc-runserver/mime.h \ src/common/config-parser.h \ src/common/error.h \ src/common/file.h \ @@ -68,6 +71,10 @@ if BUILD_RUNSERVER bin_PROGRAMS += \ blogc-runserver \ $(NULL) + +noinst_LTLIBRARIES += \ + libblogc_runserver.la \ + $(NULL) endif check_PROGRAMS = \ @@ -142,13 +149,29 @@ blogc_runserver_SOURCES = \ blogc_runserver_CFLAGS = \ $(AM_CFLAGS) \ - $(LIBEVENT_CFLAGS) \ + $(PTHREAD_CFLAGS) \ $(NULL) blogc_runserver_LDADD = \ - $(LIBEVENT_LIBS) \ + $(PTHREAD_LIBS) \ + libblogc_runserver.la \ libblogc_common.la \ $(NULL) + +libblogc_runserver_la_SOURCES = \ + src/blogc-runserver/httpd.c \ + src/blogc-runserver/httpd-utils.c \ + src/blogc-runserver/mime.c \ + $(NULL) + +libblogc_runserver_la_CFLAGS = \ + $(AM_CFLAGS) \ + $(PTHREAD_CFLAGS) \ + $(NULL) + +libblogc_runserver_la_LIBADD = \ + $(PTHREAD_LIBS) \ + $(NULL) endif @@ -456,6 +479,51 @@ tests_common_check_utils_LDADD = \ libblogc_common.la \ $(NULL) +if BUILD_RUNSERVER +check_PROGRAMS += \ + tests/blogc-runserver/check_httpd_utils \ + tests/blogc-runserver/check_mime \ + $(NULL) + +tests_blogc_runserver_check_httpd_utils_SOURCES = \ + tests/blogc-runserver/check_httpd_utils.c \ + $(NULL) + +tests_blogc_runserver_check_httpd_utils_CFLAGS = \ + $(CMOCKA_CFLAGS) \ + $(NULL) + +tests_blogc_runserver_check_httpd_utils_LDFLAGS = \ + -no-install \ + -Wl,--wrap=read \ + $(NULL) + +tests_blogc_runserver_check_httpd_utils_LDADD = \ + $(CMOCKA_LIBS) \ + libblogc_runserver.la \ + libblogc_common.la \ + $(NULL) + +tests_blogc_runserver_check_mime_SOURCES = \ + tests/blogc-runserver/check_mime.c \ + $(NULL) + +tests_blogc_runserver_check_mime_CFLAGS = \ + $(CMOCKA_CFLAGS) \ + $(NULL) + +tests_blogc_runserver_check_mime_LDFLAGS = \ + -no-install \ + -Wl,--wrap=access \ + $(NULL) + +tests_blogc_runserver_check_mime_LDADD = \ + $(CMOCKA_LIBS) \ + libblogc_runserver.la \ + libblogc_common.la \ + $(NULL) +endif + endif TESTS = \ |