summaryrefslogtreecommitdiff
path: root/src/mod_vhostdb_pgsql.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2020-01-12 21:51:12 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2020-07-08 19:54:29 -0400
commit7c7f8c467c8b6af678faf10078d7a59c3856045a (patch)
tree491b6c04ef37043a51e230825aab4deb0a347c47 /src/mod_vhostdb_pgsql.c
parentcc2134c88badd541cfe1954c80e371db5f28ede3 (diff)
downloadlighttpd-git-7c7f8c467c8b6af678faf10078d7a59c3856045a.tar.gz
[multiple] split con, request (very large change)
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().
Diffstat (limited to 'src/mod_vhostdb_pgsql.c')
-rw-r--r--src/mod_vhostdb_pgsql.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mod_vhostdb_pgsql.c b/src/mod_vhostdb_pgsql.c
index 43610f9c..1c87145f 100644
--- a/src/mod_vhostdb_pgsql.c
+++ b/src/mod_vhostdb_pgsql.c
@@ -99,9 +99,9 @@ static int mod_vhostdb_dbconf_setup (server *srv, const array *opts, void **vdat
return 0;
}
-static void mod_vhostdb_patch_config(connection * const con, plugin_data * const p);
+static void mod_vhostdb_patch_config(request_st * const r, plugin_data * const p);
-static int mod_vhostdb_pgsql_query(connection *con, void *p_d, buffer *docroot)
+static int mod_vhostdb_pgsql_query(request_st * const r, void *p_d, buffer *docroot)
{
plugin_data *p = (plugin_data *)p_d;
vhostdb_config *dbconf;
@@ -112,7 +112,7 @@ static int mod_vhostdb_pgsql_query(connection *con, void *p_d, buffer *docroot)
buffer *sqlquery = docroot;
buffer_clear(sqlquery); /*(also resets docroot (alias))*/
- mod_vhostdb_patch_config(con, p);
+ mod_vhostdb_patch_config(r, p);
if (NULL == p->conf.vdata) return 0; /*(after resetting docroot)*/
dbconf = (vhostdb_config *)p->conf.vdata;
@@ -122,10 +122,10 @@ static int mod_vhostdb_pgsql_query(connection *con, void *p_d, buffer *docroot)
size_t len;
int err;
buffer_append_string_len(sqlquery, b, (size_t)(d - b));
- buffer_string_prepare_append(sqlquery, buffer_string_length(con->uri.authority) * 2);
+ buffer_string_prepare_append(sqlquery, buffer_string_length(&r->uri.authority) * 2);
len = PQescapeStringConn(dbconf->dbconn,
sqlquery->ptr + buffer_string_length(sqlquery),
- CONST_BUF_LEN(con->uri.authority), &err);
+ CONST_BUF_LEN(&r->uri.authority), &err);
buffer_commit(sqlquery, len);
if (0 != err) return -1;
} else {
@@ -140,7 +140,7 @@ static int mod_vhostdb_pgsql_query(connection *con, void *p_d, buffer *docroot)
buffer_clear(docroot); /*(reset buffer to store result)*/
if (PGRES_TUPLES_OK != PQresultStatus(res)) {
- log_error(con->conf.errh, __FILE__, __LINE__, "%s",
+ log_error(r->conf.errh, __FILE__, __LINE__, "%s",
PQerrorMessage(dbconf->dbconn));
PQclear(res);
return -1;
@@ -207,11 +207,11 @@ static void mod_vhostdb_merge_config(plugin_config * const pconf, const config_p
} while ((++cpv)->k_id != -1);
}
-static void mod_vhostdb_patch_config(connection * const con, plugin_data * const p) {
+static void mod_vhostdb_patch_config(request_st * const r, plugin_data * const p) {
p->conf = p->defaults; /* copy small struct instead of memcpy() */
/*memcpy(&p->conf, &p->defaults, sizeof(plugin_config));*/
for (int i = 1, used = p->nconfig; i < used; ++i) {
- if (config_check_cond(con, (uint32_t)p->cvlist[i].k_id))
+ if (config_check_cond(r, (uint32_t)p->cvlist[i].k_id))
mod_vhostdb_merge_config(&p->conf,p->cvlist + p->cvlist[i].v.u2[0]);
}
}