summaryrefslogtreecommitdiff
path: root/src/mod_maxminddb.c
Commit message (Collapse)AuthorAgeFilesLines
* [build] _WIN32 __declspec(dllexport) *_plugin_initGlenn Strauss2023-05-031-0/+1
| | | | _WIN32 __declspec(dllexport) on mod_*_plugin_init()
* [multiple] store ptrs to remote addr in request_st (#3192)Glenn Strauss2023-02-281-1/+1
| | | | | | | | | | | | | | | | | adds two pointers to (request_st *) (cost: 16 bytes in 64-bit builds) prepares for upcoming changes to mod_extforward to manage remote addr per request for HTTP/2 requests, rather than remote addr per connection. Modern load balancers often provide options to reuse connections for *different* clients, and therefore mod_extforward might change the remote addr per request. x-ref: "RFE: mod_extforward and multiplexed requests via HTTP/2" https://redmine.lighttpd.net/issues/3192 "Evaluation of remote_addr for mod_maxminddb for multiplexed connections" https://redmine.lighttpd.net/issues/3191
* [mod_maxminddb] check remote IP each request (fixes #3191)Glenn Strauss2023-02-281-33/+84
| | | | | | | | | | | Many load balancers have options to reuse the same connection for multiple clients, so check remote IP each request to detect if remote IP has changed for a subsequent requests on the same connection, e.g. due to mod_extforward. x-ref: "Evaluation of remote_addr for mod_maxminddb for multiplexed connections" https://redmine.lighttpd.net/issues/3191
* [multiple] employ ck_calloc, ck_malloc shared codeGlenn Strauss2022-12-101-8/+6
| | | | | employ ck_calloc(), ck_malloc() shared code to slightly reduce code size (centralize the ck_assert() to check that memory allocation succeeded)
* [multiple] mark mod_*_plugin_init() funcs coldGlenn Strauss2022-12-071-0/+1
|
* [multiple] reduce use of BUFFER_INTLEN_PTRGlenn Strauss2021-08-271-6/+6
| | | | reduce use of BUFFER_INTLEN_PTR where b->ptr known not to be NULL
* [multiple] reduce redundant NULL buffer checksGlenn Strauss2021-08-271-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is a large set of code changes and results in removal of hundreds, perhaps thousands, of CPU instructions, a portion of which are on hot code paths. Most (buffer *) used by lighttpd are not NULL, especially since buffers were inlined into numerous larger structs such as request_st and chunk. In the small number of instances where that is not the case, a NULL check is often performed earlier in a function where that buffer is later used with a buffer_* func. In the handful of cases that remained, a NULL check was added, e.g. with r->http_host and r->conf.server_tag. - check for empty strings at config time and set value to NULL if blank string will be ignored at runtime; at runtime, simple pointer check for NULL can be used to check for a value that has been set and is not blank ("") - use buffer_is_blank() instead of buffer_string_is_empty(), and use buffer_is_unset() instead of buffer_is_empty(), where buffer is known not to be NULL so that NULL check can be skipped - use buffer_clen() instead of buffer_string_length() when buffer is known not to be NULL (to avoid NULL check at runtime) - use buffer_truncate() instead of buffer_string_set_length() to truncate string, and use buffer_extend() to extend Examples where buffer known not to be NULL: - cpv->v.b from config_plugin_values_init is not NULL if T_CONFIG_BOOL (though we might set it to NULL if buffer_is_blank(cpv->v.b)) - address of buffer is arg (&foo) (compiler optimizer detects this in most, but not all, cases) - buffer is checked for NULL earlier in func - buffer is accessed in same scope without a NULL check (e.g. b->ptr) internal behavior change: callers must not pass a NULL buffer to some funcs. - buffer_init_buffer() requires non-null args - buffer_copy_buffer() requires non-null args - buffer_append_string_buffer() requires non-null args - buffer_string_space() requires non-null arg
* [mod_maxminddb] fix config validation typoGlenn Strauss2020-11-051-1/+1
| | | | | | | | | | (bug on master branch; never released) (thx maxentry) x-ref: "maxminddb.env error 1.4.56" https://redmine.lighttpd.net/boards/2/topics/9480
* [multiple] use sock_addr_get_family in more placesGlenn Strauss2020-10-111-1/+1
|
* [multiple] con hooks store ctx in con->plugin_ctxGlenn Strauss2020-08-021-7/+7
| | | | modules with connection level hooks now store ctx in con->plugin_ctx
* [multiple] add summaries to top of some modulesGlenn Strauss2020-07-081-0/+6
|
* [multiple] split con, request (very large change)Glenn Strauss2020-07-081-14/+16
| | | | | | | | | | | | | | | | NB: r->tmp_buf == srv->tmp_buf (pointer is copied for quicker access) NB: request read and write chunkqueues currently point to connection chunkqueues; per-request and per-connection chunkqueues are not distinct from one another con->read_queue == r->read_queue con->write_queue == r->write_queue NB: in the future, a separate connection config may be needed for connection-level module hooks. Similarly, might need to have per-request chunkqueues separate from per-connection chunkqueues. Should probably also have a request_reset() which is distinct from connection_reset().
* [multiple] copy small struct instead of memcpy()Glenn Strauss2020-07-081-1/+2
| | | | when patching config
* [core] move plugin_ctx into (request_st *)Glenn Strauss2020-07-081-4/+4
| | | | | NB: in the future, a separate plugin_ctx may be needed for connection-level plugins to keep state across multiple requests
* [multiple] generic config array type checkingGlenn Strauss2020-07-081-1/+1
|
* [multiple] plugin_stats arrayGlenn Strauss2020-07-081-22/+22
| | | | | | | use global rather than passing around (server *) just for that li_itostrn() and li_utostrn() return string length (rather than requiring subsequent strlen() to find length)
* [multiple] connection hooks no longer get (srv *)Glenn Strauss2020-07-081-2/+0
| | | | (explicit (server *) not passed; available in con->srv)
* [core] array_init() arg for initial sizeGlenn Strauss2020-07-081-1/+1
|
* [multiple] plugin.c handles common FREE_FUNC codeGlenn Strauss2020-07-081-16/+2
| | | | (simpler for modules; less boilerplate to cut-n-paste)
* [mod_maxminddb] use config_plugin_values_init()Glenn Strauss2020-07-081-164/+234
|
* [core] const char *name in struct pluginGlenn Strauss2020-05-231-4/+1
| | | | | | | | put void *data (always used) as first member of struct plugin add int nconfig member to PLUGIN_DATA calloc() inits p->data to NULL
* [core] simpler config_check_cond()Glenn Strauss2020-05-231-3/+2
| | | | | | | optimize for common case where condition has been evaluated for the request and a cached result exists (also: begin isolating data_config)
* [core] inline buffer as part of data_string valueGlenn Strauss2020-02-241-2/+2
| | | | (instead of value being (buffer *))
* [core] inline buffer key for *_patch_connection()Glenn Strauss2020-02-241-3/+3
| | | | | handle buffer key as part of DATA_UNSET in *_patch_connection() (instead of key being (buffer *))
* [core] inline buffer as part of DATA_UNSET keyGlenn Strauss2020-02-241-2/+2
| | | | (instead of key being (buffer *))
* [mod_maxminddb] MaxMind GeoIP2 supportGlenn Strauss2019-05-261-0/+405