diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..e70ba6d --- /dev/null +++ b/build.rs @@ -0,0 +1,10 @@ +fn main() { + // On macOS, we need to link against the nginx object files + // because dynamic libraries can't have undefined symbols + #[cfg(target_os = "macos")] + { + println!("cargo:rustc-link-arg=-undefined"); + println!("cargo:rustc-link-arg=dynamic_lookup"); + } +} + diff --git a/src/lib.rs b/src/lib.rs index 2e6c1b1..c5214cc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,16 +2,15 @@ use handlebars::Handlebars; use ngx::core::Buffer; use ngx::ffi::{ NGX_CONF_TAKE1, NGX_HTTP_LOC_CONF, NGX_HTTP_MODULE, NGX_RS_HTTP_LOC_CONF_OFFSET, - NGX_RS_MODULE_SIGNATURE, nginx_version, ngx_array_push, ngx_buf_t, ngx_chain_t, ngx_command_t, - ngx_conf_t, ngx_http_core_module, ngx_http_discard_request_body, ngx_http_handler_pt, + NGX_RS_MODULE_SIGNATURE, nginx_version, ngx_array_push, ngx_chain_t, ngx_command_t, + ngx_conf_t, ngx_http_core_module, ngx_http_handler_pt, ngx_http_module_t, ngx_http_phases_NGX_HTTP_ACCESS_PHASE, ngx_http_request_t, ngx_int_t, ngx_module_t, ngx_str_t, ngx_uint_t, }; -use ngx::http::{HTTPModule, HTTPStatus, MergeConfigError}; +use ngx::http::{HTTPModule, MergeConfigError}; use ngx::{core, core::Status, http}; use ngx::{http_request_handler, ngx_log_debug_http, ngx_modules, ngx_null_command, ngx_string}; use rusqlite::{Connection, Result}; -use serde; use serde_json::json; use std::os::raw::{c_char, c_void}; use std::ptr::addr_of;