Permalink
Browse files

Merge branch 'release/0.3.7'

  • Loading branch information...
Mark Ellzey
Mark Ellzey committed Jul 25, 2011
2 parents 05e7003 + 64db298 commit 8e7390ce8bff02ce82dc511a713d670b9c2c3c52
View
No changes.
View
@@ -4,12 +4,11 @@ project(reason)
set(PROJECT_MAJOR_VERSION 0)
set(PROJECT_MINOR_VERSION 3)
-set(PROJECT_PATCH_VERSION 6)
+set(PROJECT_PATCH_VERSION 7)
set (PROJECT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION})
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
-
INCLUDE (CheckFunctionExists)
INCLUDE (CheckIncludeFiles)
INCLUDE (CheckTypeSize)
@@ -84,7 +83,10 @@ set(ONIG_SOURCES
OPTION(DISABLE_SSL "Disable ssl support" OFF)
OPTION(DISABLE_EVTHR "Disable evthread support" OFF)
+OPTION(EXPAND_HTTP_PARSER_MACROS "Enable pre-processor expansion" OFF)
+
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
+SET(EXPAND_HTTP_PARSER_MACROS ON)
include(BaseConfig)
@@ -96,11 +98,11 @@ message("Rel CFLAGS: ${CMAKE_C_FLAGS_RELEASE}")
find_package(LibEvent)
include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}/libhtparse
${CMAKE_CURRENT_BINARY_DIR}/oniguruma
${CMAKE_CURRENT_SOURCE_DIR}/oniguruma
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/evthr
- ${CMAKE_CURRENT_SOURCE_DIR}/http_parser
)
set(LIBEVHTP_EXTERNAL_LIBS ${LIBEVENT_LIBRARY} ${LIBEVENT_PTHREADS_LIBRARY} ${LIBEVENT_OPENSSL_LIBRARY})
@@ -114,32 +116,20 @@ if (NOT ${LIBEVENT_OPENSSL_FOUND})
endif(NOT ${LIBEVENT_OPENSSL_FOUND})
if (DISABLE_EVTHR)
- set(LIBEVHTP_SOURCES http_parser/http_parser.c evhtp.c)
+ set(LIBEVHTP_SOURCES evhtp.c libhtparse/htparse.c)
else()
- set(LIBEVHTP_SOURCES evthr/evthr.c http_parser/http_parser.c evhtp.c)
+ set(LIBEVHTP_SOURCES evthr/evthr.c evhtp.c libhtparse/htparse.c)
endif(DISABLE_EVTHR)
-
-#add_library(libevhtp STATIC ${LIBEVHTP_SOURCES} ${ONIG_SOURCES})
add_library(libevhtp SHARED ${LIBEVHTP_SOURCES} ${ONIG_SOURCES})
+
set_target_properties(libevhtp PROPERTIES OUTPUT_NAME "evhtp")
+
install (TARGETS libevhtp DESTINATION lib)
install (FILES evhtp.h DESTINATION include)
+install (FILES libhtparse/htparse.h DESTINATION include)
install (FILES evthr/evthr.h DESTINATION include)
-install (FILES http_parser/http_parser.h DESTINATION include)
add_executable(test test.c)
target_link_libraries(test libevhtp ${LIBEVHTP_EXTERNAL_LIBS})
-add_executable(oniguruma_test_posix ${CMAKE_CURRENT_SOURCE_DIR}/oniguruma/sample/posix.c)
-add_executable(oniguruma_test_listcap ${CMAKE_CURRENT_SOURCE_DIR}/oniguruma/sample/listcap.c)
-add_executable(oniguruma_test_names ${CMAKE_CURRENT_SOURCE_DIR}/oniguruma/sample/names.c)
-add_executable(oniguruma_test_simple ${CMAKE_CURRENT_SOURCE_DIR}/oniguruma/sample/simple.c)
-add_executable(oniguruma_test_sql ${CMAKE_CURRENT_SOURCE_DIR}/oniguruma/sample/sql.c)
-add_executable(oniguruma_test_syntax ${CMAKE_CURRENT_SOURCE_DIR}/oniguruma/sample/syntax.c)
-target_link_libraries(oniguruma_test_posix libevhtp ${LIBEVHTP_EXTERNAL_LIBS})
-target_link_libraries(oniguruma_test_listcap libevhtp ${LIBEVHTP_EXTERNAL_LIBS})
-target_link_libraries(oniguruma_test_names libevhtp ${LIBEVHTP_EXTERNAL_LIBS})
-target_link_libraries(oniguruma_test_simple libevhtp ${LIBEVHTP_EXTERNAL_LIBS})
-target_link_libraries(oniguruma_test_sql libevhtp ${LIBEVHTP_EXTERNAL_LIBS})
-target_link_libraries(oniguruma_test_syntax libevhtp ${LIBEVHTP_EXTERNAL_LIBS})
@@ -1,15 +1,15 @@
if (CMAKE_COMPILER_IS_GNUCC)
- set(RSN_BASE_C_FLAGS "-Wall")
+ set(RSN_BASE_C_FLAGS "-Wall -Wextra")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${RSN_BASE_C_FLAGS} -DPROJECT_VERSION=\"${PROJECT_VERSION}\"")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${RSN_BASE_C_FLAGS} -ggdb")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RSN_BASE_C_FLAGS}")
- if(APPLE)
+ if(APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshorten-64-to-32 -D_BSD_SOURCE")
endif(APPLE)
- if (UNIX)
+ if (UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE -D_POSIX_C_SOURCE=199309L")
endif(UNIX)
View
@@ -1,3 +1,77 @@
+v0.3.7
+ - Due to various problems http-parser (ry/http-parser) I have written my own
+ parser (derived and ispired from various nginx functions) (./libhtparse).
+
+ - Re-introduced the pre_accept_cb and post_accept_cb which deprecates the
+ evhtp_set_connection_hooks (which would call a defined function immediately
+ after a connection was accepted, so it was confusing I think).
+
+ The new functions to set the pre/post accepts are:
+ * evhtp_set_pre_accept_cb(evhtp_t *, evhtp_pre_accept cb, void * arg);
+ * evhtp_set_post_accept_cb(evhtp_t *, evhtp_post_accept cb, void * arg);
+ - evhtp_pre_accept functions have the following attributes:
+ * int fd : (the allocated file descriptor)
+ * struct sockaddr * : self-explanitory
+ * int slen : size of sockaddr
+ * void * arg : argument passed to evhtp_set_pre_accept_cb
+ - evhtp_post_accept functions have the following attributes:
+ * evhtp_conn_t * : self explanitory
+ * void * arg : argument passed to evhtp_set_post_accept_cb
+
+
+ - libevhtp now properly honors all return evhtp_res's from defined request hooks.
+ Meaning if you return something other than EVHTP_RES_OK, the proper error
+ handling is done with the exception of EVHTP_RES_PAUSE (see notes on pausing)
+
+ - Added [currently only half-working] methods to allow for suspending and
+ resuming parser execution and connection handling.
+
+ A hook which returns an evhtp_res value can now return "EVHTP_RES_PAUSE" which
+ informs libevhtp to stop all request processing on a connection. Alternatively
+ you can use the functions evhtp_request_pause(evhtp_request_t *);
+
+ You may also get a copy of the suspend/resume event timer directly via the
+ function evhtp_request_get_resume_ev()
+
+ To resume execution/processing one must call the function
+ evhtp_request_resume(evhtp_request_t *);
+
+ To completely disable this functionality you may call the function
+ evhtp_disable_pausing(evhtp_t *) before dropping into your event loop
+
+ - Removed unnecessary bufferevent_[enable|disable] calls, it was too tedious
+ to work with as it could cause shitty race-like conditions if the client
+ bufferevent was needed outside of the library.
+
+ - EVHTP_CLOSE_* flags have been renamed to EVHTP_FLAG_CLOSE_* and length
+ extended to 16 bits.
+
+ - added functionality to both set and get user-set htp_request args:
+ evhtp_request_set_cbargs()
+ evhtp_request_get_cbargs()
+
+ - added a hook which is called just prior to a evhtp_request_t being free()'d
+
+ - Added the ability to define per-callback hooks. Much like per-connection hooks,
+ you can set various hooks which are called when a uri|regex (defined by the
+ set_cb functions) was matched.
+
+ In order to do this properly, set_cb functions now return a evhtp_callback_t which
+ can be passed to the evhtp_set_callback_hook() functions.
+
+ For example:
+ evhtp_callback_t * cb = evhtp_set_cb(htp, "/derp", derp_cb, NULL);
+ evhtp_set_callback_hook(cb, EVHTP_HOOK_HDRS_READ, derp_hdrs_cb, NULL);
+
+ In the case above once evhtp has found that the incoming request is destined
+ for the "/derp" specific callback, it will call "derp_hdrs_cb" after all
+ headers have been read.
+
+ These act just like normal per-connection hooks, but it should be noted that
+ if a per-callback hook has been enabled, the per-connection hook will be ignored
+ for that hook.
+
+
v0.3.6
- Removed submodule dependencies
- Added various evhtp_hdr functions
View
@@ -1,29 +1,29 @@
#!/bin/bash
# This shouldn't be used by anyone but me...kthx
-rm -rf http_parser/
+rm -rf libhtparse/
rm -rf evthr/
rm -rf oniguruma/
-rm -rf build/http-parser-latest*
+rm -rf build/libhtparse-latest*
rm -rf build/libevthr-latest*
rm -rf build/oniguruma-latest*
-cd build && wget http://ackers.net/packages/http-parser-latest.tar http://ackers.net/packages/libevthr-latest.tar http://ackers.net/packages/oniguruma-latest.tar
+cd build && wget http://ackers.net/packages/libhtparse-latest.tar http://ackers.net/packages/libevthr-latest.tar http://ackers.net/packages/oniguruma-latest.tar
cd ..
-httparser_dirname=`tar --to-stdout -tf build/http-parser-latest.tar 2>&1 | head -n 1`
+httparser_dirname=`tar --to-stdout -tf build/libhtparse-latest.tar 2>&1 | head -n 1`
libevthr_dirname=`tar --to-stdout -tf build/libevthr-latest.tar 2>&1 | head -n 1`
oniguruma_dirname=`tar --to-stdout -tf build/oniguruma-latest.tar 2>&1 | head -n 1`
-tar -xf build/http-parser-latest.tar
+tar -xf build/libhtparse-latest.tar
tar -xf build/libevthr-latest.tar
tar -xf build/oniguruma-latest.tar
-mv $httparser_dirname http_parser
+mv $httparser_dirname libhtparse
mv $libevthr_dirname evthr
mv $oniguruma_dirname oniguruma
-rm -rf build/http-parser-latest*
+rm -rf build/libhtparse-latest*
rm -rf build/libevthr-latest*
rm -rf build/oniguruma-latest*
Oops, something went wrong.

0 comments on commit 8e7390c

Please sign in to comment.