Yellow-Camper / libevhtp

Create extremely-fast and secure embedded HTTP servers with ease.
https://criticalstack.com/
BSD 3-Clause "New" or "Revised" License
426 stars 162 forks source link

Cmake option EVHTP_DEBUG does not work #120

Closed gshakir closed 5 years ago

gshakir commented 5 years ago

I don't see any debug messages. I am trying to debug a closed connection on 5xx errors. Thank you.

NathanFrench commented 5 years ago

Should be fixed in develop now. See https://github.com/criticalstack/libevhtp/commit/517256cf35a46ad7619b34fee2a74af77b6aa841

gshakir commented 5 years ago

Thank you. That worked. But setting the connection closed hook gives an error. Appreciate the help. I am doing what the examples are doing.

evpostkeys.cc:802:5: error: no matching function for call to 'evhtp_connection_set_hook' evhtp_connection_set_hook(conn, evhtp_hook_on_conn_error, &conn_error_cb, NULL); ^~~~~~~~~ ./libevhtp/include/evhtp/evhtp.h:779:18: note: candidate function not viable: no known conversion from 'evhtp_res ()(evhtp_connection_t , evhtp_error_flags, void )' (aka 'unsigned short ()(evhtp_connection_s , unsigned char, void )') to 'evhtp_hook' (aka 'unsigned short ()()') for 3rd argument EVHTP_EXPORT int evhtp_connection_set_hook(evhtp_connection_t c, evhtp_hook_type type, evhtp_hook cb, void * arg); ^

NathanFrench commented 5 years ago

you seem to be passing a double pointer to your callback.

Change

evhtp_connection_set_hook(conn, evhtp_hook_on_conn_error, &conn_error_cb, NULL);

to

evhtp_connection_set_hook(conn, evhtp_hook_on_conn_error, conn_error_cb, NULL);