Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Renames a whole lot of 'conn' variables to 'req'. The target is to

clean the namespace a little bit, so the actual work of implementing
the new classes can be started safely.
  • Loading branch information...
commit eac0a2c6d1f48f9a0ce7733cbe59a21ab93b24bf 1 parent 1caa31e
@alobbs alobbs authored
Showing with 2,269 additions and 2,266 deletions.
  1. +36 −36 cherokee/avl_flcache.c
  2. +1 −1  cherokee/avl_flcache.h
  3. +4 −4 cherokee/balancer.c
  4. +4 −4 cherokee/balancer_failover.c
  5. +4 −4 cherokee/balancer_ip_hash.c
  6. +4 −4 cherokee/balancer_round_robin.c
  7. +1 −1  cherokee/cherokee.h
  8. +2 −2 cherokee/cryptor.c
  9. +2 −2 cherokee/cryptor.h
  10. +18 −18 cherokee/cryptor_libssl.c
  11. +3 −3 cherokee/encoder.c
  12. +4 −4 cherokee/encoder.h
  13. +2 −2 cherokee/encoder_deflate.c
  14. +1 −1  cherokee/encoder_deflate.h
  15. +4 −4 cherokee/encoder_gzip.c
  16. +1 −1  cherokee/encoder_gzip.h
  17. +72 −72 cherokee/flcache.c
  18. +29 −27 cherokee/gen_evhost.c
  19. +23 −23 cherokee/handler_admin.c
  20. +37 −37 cherokee/handler_cgi.c
  21. +141 −140 cherokee/handler_cgi_base.c
  22. +46 −48 cherokee/handler_common.c
  23. +20 −20 cherokee/handler_dbslayer.c
  24. +31 −31 cherokee/handler_dirlist.c
  25. +28 −27 cherokee/handler_error.c
  26. +20 −20 cherokee/handler_error_nn.c
  27. +24 −24 cherokee/handler_error_redir.c
  28. +39 −39 cherokee/handler_fcgi.c
  29. +104 −103 cherokee/handler_file.c
  30. +14 −14 cherokee/handler_post_report.c
  31. +121 −121 cherokee/handler_proxy.c
  32. +70 −70 cherokee/handler_redir.c
  33. +34 −34 cherokee/handler_render_rrd.c
  34. +30 −30 cherokee/handler_scgi.c
  35. +27 −27 cherokee/handler_secdownload.c
  36. +6 −6 cherokee/handler_server_info.c
  37. +20 −20 cherokee/handler_ssi.c
  38. +31 −31 cherokee/handler_streaming.c
  39. +25 −25 cherokee/handler_uwsgi.c
  40. +8 −8 cherokee/logger.c
  41. +2 −2 cherokee/logger.h
  42. +71 −71 cherokee/logger_custom.c
  43. +2 −2 cherokee/nonce.c
  44. +46 −46 cherokee/post.c
  45. +753 −753 cherokee/request.c
  46. +304 −304 cherokee/thread.c
View
72 cherokee/avl_flcache.c
@@ -34,23 +34,23 @@
static ret_t
-conn_to_node (cherokee_request_t *conn,
- cherokee_avl_flcache_node_t *node)
+req_to_node (cherokee_request_t *req,
+ cherokee_avl_flcache_node_t *node)
{
cherokee_avl_generic_node_init (AVL_GENERIC_NODE(node));
/* Request */
cherokee_buffer_init (&node->request);
- if (conn->request_original.len > 0) {
- cherokee_buffer_add_buffer (&node->request, &conn->request_original);
+ if (req->request_original.len > 0) {
+ cherokee_buffer_add_buffer (&node->request, &req->request_original);
} else {
- cherokee_buffer_add_buffer (&node->request, &conn->request);
+ cherokee_buffer_add_buffer (&node->request, &req->request);
}
/* Query string */
cherokee_buffer_init (&node->query_string);
- cherokee_buffer_add_buffer (&node->query_string, &conn->query_string);
+ cherokee_buffer_add_buffer (&node->query_string, &req->query_string);
/* Encoder:
* It will be filled in when the encoder object is instanced
@@ -63,7 +63,7 @@ conn_to_node (cherokee_request_t *conn,
static ret_t
node_new (cherokee_avl_flcache_node_t **node,
- cherokee_request_t *conn)
+ cherokee_request_t *req)
{
CHEROKEE_NEW_STRUCT (n, avl_flcache_node);
@@ -71,14 +71,14 @@ node_new (cherokee_avl_flcache_node_t **node,
cherokee_buffer_init (&n->file);
CHEROKEE_MUTEX_INIT (&n->ref_count_mutex, CHEROKEE_MUTEX_FAST);
- n->conn_ref = NULL;
+ n->req_ref = NULL;
n->status = flcache_status_undef;
n->ref_count = 0;
n->file_size = 0;
n->valid_until = TIME_MAX;
n->created_at = cherokee_bogonow_now;
- conn_to_node (conn, n);
+ req_to_node (req, n);
*node = n;
return ret_ok;
@@ -115,27 +115,27 @@ cmp_request (cherokee_avl_flcache_node_t *A,
cherokee_avl_flcache_node_t *B)
{
int re;
- cherokee_request_t *conn;
+ cherokee_request_t *req;
cherokee_avl_flcache_node_t *node;
cherokee_boolean_t invert;
/* Comparing against a cherokee_request_t
*/
- if (A->conn_ref || B->conn_ref) {
- if (A->conn_ref) {
- conn = A->conn_ref;
+ if (A->req_ref || B->req_ref) {
+ if (A->req_ref) {
+ req = A->req_ref;
node = B;
invert = false;
} else {
- conn = B->conn_ref;
+ req = B->req_ref;
node = A;
invert = true;
}
- if (conn->request_original.len > 0) {
- re = cherokee_buffer_case_cmp_buf (&conn->request_original, &node->request);
+ if (req->request_original.len > 0) {
+ re = cherokee_buffer_case_cmp_buf (&req->request_original, &node->request);
} else {
- re = cherokee_buffer_case_cmp_buf (&conn->request, &node->request);
+ re = cherokee_buffer_case_cmp_buf (&req->request, &node->request);
}
return (invert) ? -re : re;
@@ -151,27 +151,27 @@ cmp_query_string (cherokee_avl_flcache_node_t *A,
cherokee_avl_flcache_node_t *B)
{
int re;
- cherokee_request_t *conn;
+ cherokee_request_t *req;
cherokee_avl_flcache_node_t *node;
cherokee_boolean_t invert;
/* Comparing against a cherokee_request_t
*/
- if (A->conn_ref || B->conn_ref) {
- if (A->conn_ref) {
- conn = A->conn_ref;
+ if (A->req_ref || B->req_ref) {
+ if (A->req_ref) {
+ req = A->req_ref;
node = B;
invert = false;
} else {
- conn = B->conn_ref;
+ req = B->req_ref;
node = A;
invert = true;
}
- if (conn->query_string_original.len > 0) {
- re = cherokee_buffer_case_cmp_buf (&conn->query_string_original, &node->query_string);
+ if (req->query_string_original.len > 0) {
+ re = cherokee_buffer_case_cmp_buf (&req->query_string_original, &node->query_string);
} else {
- re = cherokee_buffer_case_cmp_buf (&conn->query_string, &node->query_string);
+ re = cherokee_buffer_case_cmp_buf (&req->query_string, &node->query_string);
}
return (invert) ? -re : re;
@@ -189,7 +189,7 @@ cmp_encoding (cherokee_avl_flcache_node_t *A,
ret_t ret;
int re;
char *p;
- cherokee_request_t *conn;
+ cherokee_request_t *req;
cherokee_avl_flcache_node_t *node;
cherokee_boolean_t invert;
char *header = NULL;
@@ -197,20 +197,20 @@ cmp_encoding (cherokee_avl_flcache_node_t *A,
/* Comparing against a cherokee_request_t
*/
- if (A->conn_ref || B->conn_ref) {
- if (A->conn_ref) {
- conn = A->conn_ref;
+ if (A->req_ref || B->req_ref) {
+ if (A->req_ref) {
+ req = A->req_ref;
node = B;
invert = false;
} else {
- conn = B->conn_ref;
+ req = B->req_ref;
node = A;
invert = true;
}
/* No "Content-encoding:"
*/
- ret = cherokee_header_get_known (&conn->header, header_accept_encoding, &header, &header_len);
+ ret = cherokee_header_get_known (&req->header, header_accept_encoding, &header, &header_len);
if (ret != ret_ok) {
/* Node not encoded */
if (cherokee_buffer_is_empty (&node->content_encoding)) {
@@ -319,7 +319,7 @@ node_is_empty (cherokee_avl_flcache_node_t *key)
* 1.- A reference to a cherokee_request_t object
* 2.- An object storing information
*/
- if (key->conn_ref)
+ if (key->req_ref)
return false;
return cherokee_buffer_is_empty (&key->request);
@@ -354,13 +354,13 @@ cherokee_avl_flcache_mrproper (cherokee_avl_flcache_t *avl,
ret_t
cherokee_avl_flcache_add (cherokee_avl_flcache_t *avl,
- cherokee_request_t *conn,
+ cherokee_request_t *req,
cherokee_avl_flcache_node_t **node)
{
ret_t ret;
cherokee_avl_flcache_node_t *n = NULL;
- ret = node_new (&n, conn);
+ ret = node_new (&n, req);
if ((ret != ret_ok) || (n == NULL)) {
node_free (n);
return ret;
@@ -382,13 +382,13 @@ cherokee_avl_flcache_add (cherokee_avl_flcache_t *avl,
ret_t
cherokee_avl_flcache_get (cherokee_avl_flcache_t *avl,
- cherokee_request_t *conn,
+ cherokee_request_t *req,
cherokee_avl_flcache_node_t **node)
{
ret_t ret;
cherokee_avl_flcache_node_t tmp;
- tmp.conn_ref = conn;
+ tmp.req_ref = req;
CHEROKEE_RWLOCK_READER (&avl->base_rwlock);
ret = cherokee_avl_generic_get (AVL_GENERIC(avl), AVL_GENERIC_NODE(&tmp), (void **)node);
View
2  cherokee/avl_flcache.h
@@ -54,7 +54,7 @@ typedef struct {
cherokee_buffer_t query_string;
cherokee_buffer_t content_encoding;
- cherokee_request_t *conn_ref;
+ cherokee_request_t *req_ref;
cherokee_flcache_status_t status;
cherokee_buffer_t file;
View
8 cherokee/balancer.c
@@ -156,25 +156,25 @@ cherokee_balancer_configure_base (cherokee_balancer_t *balancer,
ret_t
cherokee_balancer_dispatch (cherokee_balancer_t *balancer,
- cherokee_request_t *conn,
+ cherokee_request_t *req,
cherokee_source_t **source)
{
if (unlikely (balancer->dispatch == NULL))
return ret_error;
- return balancer->dispatch (balancer, conn, source);
+ return balancer->dispatch (balancer, req, source);
}
ret_t
cherokee_balancer_report_fail (cherokee_balancer_t *balancer,
- cherokee_request_t *conn,
+ cherokee_request_t *req,
cherokee_source_t *source)
{
if (unlikely (balancer->report_fail == NULL))
return ret_error;
- return balancer->report_fail (balancer, conn, source);
+ return balancer->report_fail (balancer, req, source);
}
View
8 cherokee/balancer_failover.c
@@ -118,7 +118,7 @@ reactivate_all_entries (cherokee_balancer_failover_t *balancer)
static ret_t
report_fail (cherokee_balancer_failover_t *balancer,
- cherokee_request_t *conn,
+ cherokee_request_t *req,
cherokee_source_t *src)
{
ret_t ret;
@@ -126,7 +126,7 @@ report_fail (cherokee_balancer_failover_t *balancer,
cherokee_balancer_entry_t *entry;
cherokee_buffer_t tmp = CHEROKEE_BUF_INIT;
- UNUSED(conn);
+ UNUSED(req);
CHEROKEE_MUTEX_LOCK (&balancer->mutex);
@@ -169,14 +169,14 @@ report_fail (cherokee_balancer_failover_t *balancer,
static ret_t
dispatch (cherokee_balancer_failover_t *balancer,
- cherokee_request_t *conn,
+ cherokee_request_t *req,
cherokee_source_t **src)
{
cherokee_list_t *i;
cherokee_balancer_entry_t *entry = NULL;
cherokee_balancer_t *gbal = BAL(balancer);
- UNUSED(conn);
+ UNUSED(req);
CHEROKEE_MUTEX_LOCK (&balancer->mutex);
/* Pick the first available source
View
8 cherokee/balancer_ip_hash.c
@@ -104,7 +104,7 @@ reactivate_entry (cherokee_balancer_ip_hash_t *balancer,
static ret_t
report_fail (cherokee_balancer_ip_hash_t *balancer,
- cherokee_request_t *conn,
+ cherokee_request_t *req,
cherokee_source_t *src)
{
ret_t ret;
@@ -112,7 +112,7 @@ report_fail (cherokee_balancer_ip_hash_t *balancer,
cherokee_balancer_entry_t *entry;
cherokee_buffer_t tmp = CHEROKEE_BUF_INIT;
- UNUSED(conn);
+ UNUSED(req);
CHEROKEE_MUTEX_LOCK (&balancer->mutex);
@@ -157,7 +157,7 @@ report_fail (cherokee_balancer_ip_hash_t *balancer,
static ret_t
dispatch (cherokee_balancer_ip_hash_t *balancer,
- cherokee_request_t *conn,
+ cherokee_request_t *req,
cherokee_source_t **src)
{
cint_t n;
@@ -166,7 +166,7 @@ dispatch (cherokee_balancer_ip_hash_t *balancer,
cherokee_list_t *i;
cherokee_balancer_entry_t *entry = NULL;
culong_t hash = 0;
- cherokee_socket_t *socket = &conn->socket;
+ cherokee_socket_t *socket = &req->socket;
CHEROKEE_MUTEX_LOCK (&balancer->mutex);
View
8 cherokee/balancer_round_robin.c
@@ -87,14 +87,14 @@ reactivate_entry (cherokee_balancer_entry_t *entry)
static ret_t
dispatch (cherokee_balancer_round_robin_t *balancer,
- cherokee_request_t *conn,
+ cherokee_request_t *req,
cherokee_source_t **src)
{
cherokee_balancer_entry_t *entry;
cuint_t tries = 0;
cherokee_balancer_t *gbal = BAL(balancer);
- UNUSED(conn);
+ UNUSED(req);
CHEROKEE_MUTEX_LOCK (&balancer->mutex);
/* Pick the next entry */
@@ -135,7 +135,7 @@ dispatch (cherokee_balancer_round_robin_t *balancer,
static ret_t
report_fail (cherokee_balancer_round_robin_t *balancer,
- cherokee_request_t *conn,
+ cherokee_request_t *req,
cherokee_source_t *src)
{
ret_t ret;
@@ -143,7 +143,7 @@ report_fail (cherokee_balancer_round_robin_t *balancer,
cherokee_balancer_entry_t *entry;
cherokee_buffer_t tmp = CHEROKEE_BUF_INIT;
- UNUSED(conn);
+ UNUSED(req);
CHEROKEE_MUTEX_LOCK (&balancer->mutex);
list_for_each (i, &BAL(balancer)->entries) {
View
2  cherokee/cherokee.h
@@ -74,7 +74,7 @@
/* Config library
*/
#include <cherokee/admin_client.h>
-#include <cherokee/connection_info.h>
+#include <cherokee/request_info.h>
#undef CHEROKEE_INSIDE_CHEROKEE_H
View
4 cherokee/cryptor.c
@@ -204,13 +204,13 @@ ret_t
cherokee_cryptor_socket_init_tls (cherokee_cryptor_socket_t *cryp,
void *sock,
void *vsrv,
- void *conn,
+ void *req,
void *blocking)
{
if (unlikely (cryp->init_tls == NULL))
return ret_error;
- return cryp->init_tls (cryp, sock, vsrv, conn, blocking);
+ return cryp->init_tls (cryp, sock, vsrv, req, blocking);
}
ret_t
View
4 cherokee/cryptor.h
@@ -52,7 +52,7 @@ typedef ret_t (* cryptor_vsrv_func_free_t) (void *cryp);
/* Cryptor: Socket */
typedef ret_t (* cryptor_socket_func_free_t) (void *cryp);
typedef ret_t (* cryptor_socket_func_clean_t) (void *cryp);
-typedef ret_t (* cryptor_socket_func_init_tls_t)(void *cryp, void *sock, void *vsrv, void *conn, void *blocking);
+typedef ret_t (* cryptor_socket_func_init_tls_t)(void *cryp, void *sock, void *vsrv, void *req, void *blocking);
typedef ret_t (* cryptor_socket_func_shutdown_t)(void *cryp);
typedef ret_t (* cryptor_socket_func_read_t) (void *cryp, char *buf, int len, size_t *re_len);
typedef ret_t (* cryptor_socket_func_write_t) (void *cryp, char *buf, int len, size_t *re_len);
@@ -161,7 +161,7 @@ ret_t cherokee_cryptor_socket_shutdown (cherokee_cryptor_socket_t *cryp);
ret_t cherokee_cryptor_socket_init_tls (cherokee_cryptor_socket_t *cryp,
void *sock,
void *vsrv,
- void *conn,
+ void *req,
void *blocking);
ret_t cherokee_cryptor_socket_read (cherokee_cryptor_socket_t *cryp,
char *buf,
View
36 cherokee/cryptor_libssl.c
@@ -198,10 +198,10 @@ _vserver_free (cherokee_cryptor_vserver_libssl_t *cryp_vsrv)
}
ret_t
-cherokee_cryptor_libssl_find_vserver (SSL *ssl,
- cherokee_server_t *srv,
- cherokee_buffer_t *servername,
- cherokee_request_t *conn)
+cherokee_cryptor_libssl_find_vserver (SSL *ssl,
+ cherokee_server_t *srv,
+ cherokee_buffer_t *servername,
+ cherokee_request_t *req)
{
ret_t ret;
cherokee_virtual_server_t *vsrv = NULL;
@@ -210,7 +210,7 @@ cherokee_cryptor_libssl_find_vserver (SSL *ssl,
/* Try to match the connection to a server
*/
- ret = cherokee_server_get_vserver(srv, servername, conn, &vsrv);
+ ret = cherokee_server_get_vserver(srv, servername, req, &vsrv);
if ((ret != ret_ok) || (vsrv == NULL)) {
LOG_ERROR (CHEROKEE_ERROR_SSL_SRV_MATCH, servername->buf);
return ret_error;
@@ -257,17 +257,17 @@ openssl_sni_servername_cb (SSL *ssl, int *ad, void *arg)
ret_t ret;
int re;
const char *servername;
- cherokee_request_t *conn;
+ cherokee_request_t *req;
cherokee_buffer_t tmp;
- cherokee_server_t *srv = SRV(arg);
- cherokee_virtual_server_t *vsrv = NULL;
+ cherokee_server_t *srv = SRV(arg);
+ cherokee_virtual_server_t *vsrv = NULL;
UNUSED(ad);
/* Get the pointer to the socket
*/
- conn = SSL_get_app_data (ssl);
- if (unlikely (conn == NULL)) {
+ req = SSL_get_app_data (ssl);
+ if (unlikely (req == NULL)) {
LOG_ERROR (CHEROKEE_ERROR_SSL_SOCKET, ssl);
return SSL_TLSEXT_ERR_ALERT_FATAL;
}
@@ -281,7 +281,7 @@ openssl_sni_servername_cb (SSL *ssl, int *ad, void *arg)
if (servername == NULL) {
/* Set the server name to the IP address if we couldn't get the host name via SNI
*/
- cherokee_socket_ntop (&conn->socket, tmp.buf, tmp.size);
+ cherokee_socket_ntop (&req->socket, tmp.buf, tmp.size);
TRACE (ENTRIES, "No SNI: Did not provide a server name, using IP='%s' as servername.\n", tmp.buf);
} else {
cherokee_buffer_add (&tmp, servername, strlen(servername));
@@ -290,7 +290,7 @@ openssl_sni_servername_cb (SSL *ssl, int *ad, void *arg)
/* Look up and change the vserver
*/
- ret = cherokee_cryptor_libssl_find_vserver(ssl, srv, &tmp, conn);
+ ret = cherokee_cryptor_libssl_find_vserver(ssl, srv, &tmp, req);
if (ret != ret_ok) {
re = SSL_TLSEXT_ERR_NOACK;
}
@@ -533,7 +533,7 @@ static ret_t
socket_initialize (cherokee_cryptor_socket_libssl_t *cryp,
cherokee_socket_t *socket,
cherokee_virtual_server_t *vserver,
- cherokee_request_t *conn)
+ cherokee_request_t *req)
{
int re;
const char *error;
@@ -581,13 +581,13 @@ socket_initialize (cherokee_cryptor_socket_libssl_t *cryp,
}
#ifndef OPENSSL_NO_TLSEXT
- SSL_set_app_data (cryp->session, conn);
+ SSL_set_app_data (cryp->session, req);
#else
/* Attempt to determine the vserver without SNI.
*/
cherokee_buffer_ensure_size(&servername, 40);
- cherokee_socket_ntop (&conn->socket, servername.buf, servername.size);
- cherokee_cryptor_libssl_find_vserver (cryp->session, REQ_SRV(conn), &servername, conn);
+ cherokee_socket_ntop (&req->socket, servername.buf, servername.size);
+ cherokee_cryptor_libssl_find_vserver (cryp->session, REQ_SRV(req), &servername, req);
cherokee_buffer_mrproper (&servername);
#endif
@@ -599,7 +599,7 @@ static ret_t
_socket_init_tls (cherokee_cryptor_socket_libssl_t *cryp,
cherokee_socket_t *sock,
cherokee_virtual_server_t *vsrv,
- cherokee_request_t *conn,
+ cherokee_request_t *req,
cherokee_socket_status_t *blocking)
{
int re;
@@ -608,7 +608,7 @@ _socket_init_tls (cherokee_cryptor_socket_libssl_t *cryp,
/* Initialize
*/
if (CRYPTOR_SOCKET(cryp)->initialized == false) {
- ret = socket_initialize (cryp, sock, vsrv, conn);
+ ret = socket_initialize (cryp, sock, vsrv, req);
if (ret != ret_ok) {
return ret_error;
}
View
6 cherokee/encoder.c
@@ -127,13 +127,13 @@ cherokee_encoder_add_headers (cherokee_encoder_t *enc, cherokee_buffer_t *buf)
ret_t
-cherokee_encoder_init (cherokee_encoder_t *enc, void *conn)
+cherokee_encoder_init (cherokee_encoder_t *enc, void *req)
{
encoder_func_init_t init_func;
/* Properties
*/
- enc->conn = conn;
+ enc->req = req;
/* Call the virtual method
*/
@@ -141,7 +141,7 @@ cherokee_encoder_init (cherokee_encoder_t *enc, void *conn)
if (init_func == NULL)
return ret_error;
- return init_func (enc, conn);
+ return init_func (enc, req);
}
View
8 cherokee/encoder.h
@@ -48,7 +48,7 @@ typedef enum {
typedef ret_t (* encoder_func_new_t) (void **encoder, void *props);
typedef ret_t (* encoder_func_free_t) (void *encoder);
typedef ret_t (* encoder_func_add_headers_t) (void *encoder, cherokee_buffer_t *buf);
-typedef ret_t (* encoder_func_init_t) (void *encoder, void *conn);
+typedef ret_t (* encoder_func_init_t) (void *encoder, void *req);
typedef ret_t (* encoder_func_encode_t) (void *encoder, cherokee_buffer_t *in, cherokee_buffer_t *out);
typedef ret_t (* encoder_func_flush_t) (void *encoder, cherokee_buffer_t *in, cherokee_buffer_t *out);
typedef ret_t (* encoder_func_configure_t) (cherokee_config_node_t *, cherokee_server_t *, cherokee_module_props_t **);
@@ -78,11 +78,11 @@ typedef struct {
/* Properties
*/
- void *conn;
+ void *req;
} cherokee_encoder_t;
#define ENCODER(x) ((cherokee_encoder_t *)(x))
-#define ENCODER_REQ(x) (REQ(ENCODER(x)->conn))
+#define ENCODER_REQ(x) (REQ(ENCODER(x)->req))
/* Easy initialization
@@ -126,7 +126,7 @@ ret_t cherokee_encoder_props_free_base (cherokee_encoder_props_t *encoder_props)
*/
ret_t cherokee_encoder_free (cherokee_encoder_t *enc);
ret_t cherokee_encoder_add_headers (cherokee_encoder_t *enc, cherokee_buffer_t *buf);
-ret_t cherokee_encoder_init (cherokee_encoder_t *enc, void *conn);
+ret_t cherokee_encoder_init (cherokee_encoder_t *enc, void *req);
ret_t cherokee_encoder_encode (cherokee_encoder_t *enc, cherokee_buffer_t *in, cherokee_buffer_t *out);
ret_t cherokee_encoder_flush (cherokee_encoder_t *enc, cherokee_buffer_t *in, cherokee_buffer_t *out);
View
4 cherokee/encoder_deflate.c
@@ -161,12 +161,12 @@ get_deflate_error_string (int err)
ret_t
cherokee_encoder_deflate_init (cherokee_encoder_deflate_t *encoder,
- cherokee_request_t *conn)
+ cherokee_request_t *req)
{
int err;
z_stream *z = &encoder->stream;
- UNUSED (conn);
+ UNUSED (req);
/* Set the workspace
*/
View
2  cherokee/encoder_deflate.h
@@ -64,7 +64,7 @@ ret_t cherokee_encoder_deflate_new (cherokee_encoder_deflate_t **encoder
ret_t cherokee_encoder_deflate_free (cherokee_encoder_deflate_t *encoder);
ret_t cherokee_encoder_deflate_add_headers (cherokee_encoder_deflate_t *encoder, cherokee_buffer_t *buf);
-ret_t cherokee_encoder_deflate_init (cherokee_encoder_deflate_t *encoder, cherokee_request_t *conn);
+ret_t cherokee_encoder_deflate_init (cherokee_encoder_deflate_t *encoder, cherokee_request_t *req);
ret_t cherokee_encoder_deflate_encode (cherokee_encoder_deflate_t *encoder, cherokee_buffer_t *in, cherokee_buffer_t *out);
ret_t cherokee_encoder_deflate_flush (cherokee_encoder_deflate_t *encoder, cherokee_buffer_t *in, cherokee_buffer_t *out);
View
8 cherokee/encoder_gzip.c
@@ -210,7 +210,7 @@ get_gzip_error_string (int err)
}
static cherokee_boolean_t
-is_user_agent_IE_16 (cherokee_request_t *conn)
+is_user_agent_IE_16 (cherokee_request_t *req)
{
ret_t ret;
char *m;
@@ -219,7 +219,7 @@ is_user_agent_IE_16 (cherokee_request_t *conn)
/* Get the User-Agent header
*/
- ret = cherokee_header_get_known (&conn->header, header_user_agent, &ref, &ref_len);
+ ret = cherokee_header_get_known (&req->header, header_user_agent, &ref, &ref_len);
if ((ret != ret_ok) || (ref == NULL) || (ref_len <= 7)) {
return false;
}
@@ -240,7 +240,7 @@ is_user_agent_IE_16 (cherokee_request_t *conn)
ret_t
cherokee_encoder_gzip_init (cherokee_encoder_gzip_t *encoder,
- cherokee_request_t *conn)
+ cherokee_request_t *req)
{
int err;
z_stream *z = &encoder->stream;
@@ -248,7 +248,7 @@ cherokee_encoder_gzip_init (cherokee_encoder_gzip_t *encoder,
/* Disable GZip for IE 1-6 clients
*/
if (likely (ENC_GZIP_PROP(encoder)->disable_old_IE)) {
- if (is_user_agent_IE_16 (conn)) {
+ if (is_user_agent_IE_16 (req)) {
TRACE (ENTRIES, "Disabling encoder: %s\n", "MSIE [1-6] detected\n");
return ret_deny;
}
View
2  cherokee/encoder_gzip.h
@@ -67,7 +67,7 @@ ret_t cherokee_encoder_gzip_new (cherokee_encoder_gzip_t **encoder, cher
ret_t cherokee_encoder_gzip_free (cherokee_encoder_gzip_t *encoder);
ret_t cherokee_encoder_gzip_add_headers (cherokee_encoder_gzip_t *encoder, cherokee_buffer_t *buf);
-ret_t cherokee_encoder_gzip_init (cherokee_encoder_gzip_t *encoder, cherokee_request_t *conn);
+ret_t cherokee_encoder_gzip_init (cherokee_encoder_gzip_t *encoder, cherokee_request_t *req);
ret_t cherokee_encoder_gzip_encode (cherokee_encoder_gzip_t *encoder, cherokee_buffer_t *in, cherokee_buffer_t *out);
ret_t cherokee_encoder_gzip_flush (cherokee_encoder_gzip_t *encoder, cherokee_buffer_t *in, cherokee_buffer_t *out);
View
144 cherokee/flcache.c
@@ -173,18 +173,18 @@ cherokee_flcache_configure (cherokee_flcache_t *flcache,
ret_t
-cherokee_flcache_req_get_cached (cherokee_flcache_t *flcache,
- cherokee_request_t *conn)
+cherokee_flcache_req_get_cached (cherokee_flcache_t *flcache,
+ cherokee_request_t *req)
{
ret_t ret;
cherokee_avl_flcache_node_t *entry = NULL;
/* Check the cache
*/
- ret = cherokee_avl_flcache_get (&flcache->request_map, conn, &entry);
+ ret = cherokee_avl_flcache_get (&flcache->request_map, req, &entry);
if ((ret != ret_ok) || (entry == NULL)) {
TRACE (ENTRIES, "Front Line Cache: miss: '%s' qs='%s'\n",
- conn->request.buf, conn->query_string.buf ? conn->query_string.buf : "");
+ req->request.buf, req->query_string.buf ? req->query_string.buf : "");
return ret_not_found;
}
@@ -192,7 +192,7 @@ cherokee_flcache_req_get_cached (cherokee_flcache_t *flcache,
*/
if (entry->status != flcache_status_ready) {
TRACE (ENTRIES, "Front Line Cache: almost-hit; '%s' being cached (%d refs)\n",
- conn->request.buf, entry->ref_count);
+ req->request.buf, entry->ref_count);
return ret_deny;
}
@@ -200,7 +200,7 @@ cherokee_flcache_req_get_cached (cherokee_flcache_t *flcache,
*/
if (entry->valid_until < cherokee_bogonow_now) {
TRACE (ENTRIES, "Front Line Cache: almost-hit; '%s' expired already (%d refs)\n",
- conn->request.buf, entry->ref_count);
+ req->request.buf, entry->ref_count);
if (entry->ref_count == 0) {
cherokee_flcache_del_entry (flcache, entry);
@@ -211,13 +211,13 @@ cherokee_flcache_req_get_cached (cherokee_flcache_t *flcache,
/* Cache hit: Open the cached file
*/
- conn->flcache.fd = cherokee_open (entry->file.buf, O_RDONLY | O_NOFOLLOW, 0);
- if (unlikely (conn->flcache.fd == -1)) {
+ req->flcache.fd = cherokee_open (entry->file.buf, O_RDONLY | O_NOFOLLOW, 0);
+ if (unlikely (req->flcache.fd == -1)) {
return ret_error;
}
TRACE (ENTRIES, "Front Line Cache: hit; '%s' -> '%s' (%d refs)\n",
- conn->request.buf, entry->file.buf, entry->ref_count);
+ req->request.buf, entry->file.buf, entry->ref_count);
/* Store the reference to the object
*/
@@ -225,60 +225,60 @@ cherokee_flcache_req_get_cached (cherokee_flcache_t *flcache,
entry->ref_count += 1;
CHEROKEE_MUTEX_UNLOCK (&entry->ref_count_mutex);
- conn->flcache.avl_node_ref = entry;
- conn->flcache.mode = flcache_mode_out;
+ req->flcache.avl_node_ref = entry;
+ req->flcache.mode = flcache_mode_out;
return ret_ok;
}
ret_t
-cherokee_flcache_req_is_storable (cherokee_flcache_t *flcache,
- cherokee_request_t *conn)
+cherokee_flcache_req_is_storable (cherokee_flcache_t *flcache,
+ cherokee_request_t *req)
{
UNUSED (flcache);
/* HTTP Method
*/
- if (conn->header.method != http_get) {
- TRACE (ENTRIES, "Not storable: method(%d) != GET\n", conn->header.method);
+ if (req->header.method != http_get) {
+ TRACE (ENTRIES, "Not storable: method(%d) != GET\n", req->header.method);
return ret_deny;
}
/* HTTPs
*/
- if (conn->socket.is_tls == TLS) {
+ if (req->socket.is_tls == TLS) {
TRACE (ENTRIES, "Not storable: Connection is %s\n", "TLS");
return ret_deny;
}
/* Authenticated
*/
- if (conn->validator != NULL) {
+ if (req->validator != NULL) {
TRACE (ENTRIES, "Not storable: Content requires %s\n", "authentication");
return ret_deny;
}
/* Expiration
*/
- if (conn->expiration == cherokee_expiration_epoch) {
+ if (req->expiration == cherokee_expiration_epoch) {
TRACE (ENTRIES, "Not storable: Alredy expired at '%s'\n", "epoch");
return ret_deny;
}
- if ((conn->expiration_prop & cherokee_expiration_prop_no_cache) ||
- (conn->expiration_prop & cherokee_expiration_prop_no_store) ||
- (conn->expiration_prop & cherokee_expiration_prop_must_revalidate) ||
- (conn->expiration_prop & cherokee_expiration_prop_proxy_revalidate))
+ if ((req->expiration_prop & cherokee_expiration_prop_no_cache) ||
+ (req->expiration_prop & cherokee_expiration_prop_no_store) ||
+ (req->expiration_prop & cherokee_expiration_prop_must_revalidate) ||
+ (req->expiration_prop & cherokee_expiration_prop_proxy_revalidate))
{
- TRACE (ENTRIES, "Not storable: Expiration props: %d\n", conn->expiration_prop);
+ TRACE (ENTRIES, "Not storable: Expiration props: %d\n", req->expiration_prop);
return ret_deny;
}
/* Range
*/
- if ((conn->range_end != -1) || (conn->range_start != -1)) {
- TRACE (ENTRIES, "Not storable: Requested a range (%d, %d)\n", conn->range_start, conn->range_end);
+ if ((req->range_end != -1) || (req->range_start != -1)) {
+ TRACE (ENTRIES, "Not storable: Requested a range (%d, %d)\n", req->range_start, req->range_end);
return ret_deny;
}
@@ -318,8 +318,8 @@ cherokee_flcache_conn_init (cherokee_flcache_conn_t *flcache_conn)
ret_t
-cherokee_flcache_req_set_store (cherokee_flcache_t *flcache,
- cherokee_request_t *conn)
+cherokee_flcache_req_set_store (cherokee_flcache_t *flcache,
+ cherokee_request_t *req)
{
ret_t ret;
int dir;
@@ -328,7 +328,7 @@ cherokee_flcache_req_set_store (cherokee_flcache_t *flcache,
/* Add it to the tree
*/
- ret = cherokee_avl_flcache_add (&flcache->request_map, conn, &entry);
+ ret = cherokee_avl_flcache_add (&flcache->request_map, req, &entry);
if ((ret != ret_ok) || (entry == NULL)) {
return ret;
}
@@ -356,8 +356,8 @@ cherokee_flcache_req_set_store (cherokee_flcache_t *flcache,
/* Status
*/
- conn->flcache.mode = flcache_mode_in;
- conn->flcache.avl_node_ref = entry;
+ req->flcache.mode = flcache_mode_in;
+ req->flcache.avl_node_ref = entry;
return ret_ok;
}
@@ -366,7 +366,7 @@ cherokee_flcache_req_set_store (cherokee_flcache_t *flcache,
static ret_t
inspect_header (cherokee_flcache_conn_t *flcache_conn,
cherokee_buffer_t *header,
- cherokee_request_t *conn)
+ cherokee_request_t *req)
{
ret_t ret;
char *value;
@@ -379,13 +379,13 @@ inspect_header (cherokee_flcache_conn_t *flcache_conn,
cherokee_boolean_t overwrite_control;
cherokee_avl_flcache_node_t *node = flcache_conn->avl_node_ref;
cherokee_boolean_t via_found = false;
- cherokee_buffer_t *tmp = THREAD_TMP_BUF2(REQ_THREAD(conn));
+ cherokee_buffer_t *tmp = THREAD_TMP_BUF2(REQ_THREAD(req));
cherokee_boolean_t do_cache = false;
begin = header->buf;
header_end = header->buf + header->len;
- overwrite_control = (conn->expiration != cherokee_expiration_none);
+ overwrite_control = (req->expiration != cherokee_expiration_none);
while ((begin < header_end)) {
end = cherokee_header_get_next_line (begin);
@@ -495,13 +495,13 @@ inspect_header (cherokee_flcache_conn_t *flcache_conn,
/* Set-cookie
*/
else if (strncasecmp (begin, "Set-cookie:", 11) == 0) {
- if (conn->config_entry.flcache_cookies_disregard) {
+ if (req->config_entry.flcache_cookies_disregard) {
int re;
void *pcre;
cherokee_list_t *i;
cherokee_boolean_t matched = false;
- list_for_each (i, conn->config_entry.flcache_cookies_disregard) {
+ list_for_each (i, req->config_entry.flcache_cookies_disregard) {
pcre = LIST_ITEM_INFO(i);
re = pcre_exec (pcre, NULL, begin, end-begin, 0, 0, NULL, 0);
@@ -536,7 +536,7 @@ inspect_header (cherokee_flcache_conn_t *flcache_conn,
/* Build string */
cherokee_buffer_clean (tmp);
cherokee_buffer_add_str (tmp, ", ");
- cherokee_request_build_host_port_string (conn, tmp);
+ cherokee_request_build_host_port_string (req, tmp);
cherokee_buffer_add_str (tmp, " (Cherokee/"PACKAGE_VERSION")");
/* Insert at the end */
@@ -570,7 +570,7 @@ inspect_header (cherokee_flcache_conn_t *flcache_conn,
/* Check the caching policy
*/
if ((! do_cache) &&
- (conn->config_entry.flcache_policy == flcache_policy_explicitly_allowed))
+ (req->config_entry.flcache_policy == flcache_policy_explicitly_allowed))
{
TRACE(ENTRIES, "Doesn't explicitly allow caching.%s", "\n");
return ret_deny;
@@ -580,14 +580,14 @@ inspect_header (cherokee_flcache_conn_t *flcache_conn,
*/
if (! via_found) {
cherokee_buffer_add_str (header, "Via: ");
- cherokee_request_build_host_port_string (conn, header);
+ cherokee_request_build_host_port_string (req, header);
cherokee_buffer_add_str (header, " (Cherokee/"PACKAGE_VERSION")" CRLF);
}
/* Overwritten Cache-Control / Expiration
*/
if (overwrite_control) {
- cherokee_request_add_expiration_header (conn, header, false);
+ cherokee_request_add_expiration_header (req, header, false);
}
return ret_ok;
@@ -595,15 +595,15 @@ inspect_header (cherokee_flcache_conn_t *flcache_conn,
static ret_t
-create_flconn_file (cherokee_flcache_t *flcache,
- cherokee_request_t *conn)
+create_flconn_file (cherokee_flcache_t *flcache,
+ cherokee_request_t *req)
{
ret_t ret;
cherokee_buffer_t tmp = CHEROKEE_BUF_INIT;
- cherokee_avl_flcache_node_t *entry = conn->flcache.avl_node_ref;
+ cherokee_avl_flcache_node_t *entry = req->flcache.avl_node_ref;
- conn->flcache.fd = cherokee_open (entry->file.buf, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, S_IRUSR|S_IWUSR);
- if (conn->flcache.fd == -1) {
+ req->flcache.fd = cherokee_open (entry->file.buf, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, S_IRUSR|S_IWUSR);
+ if (req->flcache.fd == -1) {
char *p;
/* Try to create 'dir'
@@ -625,14 +625,14 @@ create_flconn_file (cherokee_flcache_t *flcache,
/* Second chance
*/
- conn->flcache.fd = cherokee_open (entry->file.buf, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, S_IRUSR|S_IWUSR);
- if (conn->flcache.fd == -1) {
+ req->flcache.fd = cherokee_open (entry->file.buf, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, S_IRUSR|S_IWUSR);
+ if (req->flcache.fd == -1) {
LOG_ERRNO (errno, cherokee_err_error, CHEROKEE_ERROR_FLCACHE_CREATE_FILE, tmp.buf);
goto error;
}
}
- TRACE (ENTRIES, "Created flcache file %s, fd=%d\n", entry->file.buf, conn->flcache.fd);
+ TRACE (ENTRIES, "Created flcache file %s, fd=%d\n", entry->file.buf, req->flcache.fd);
cherokee_buffer_mrproper (&tmp);
return ret_ok;
@@ -644,38 +644,38 @@ create_flconn_file (cherokee_flcache_t *flcache,
ret_t
cherokee_flcache_conn_commit_header (cherokee_flcache_conn_t *flcache_conn,
- cherokee_request_t *conn)
+ cherokee_request_t *req)
{
ret_t ret;
ssize_t written;
- cherokee_avl_flcache_node_t *entry = conn->flcache.avl_node_ref;
+ cherokee_avl_flcache_node_t *entry = req->flcache.avl_node_ref;
/* Do not cache non-200 responses
*/
- if (conn->error_code != http_ok) {
+ if (req->error_code != http_ok) {
TRACE (ENTRIES, "Front Line Cache: Non %d response. Cache object cancelled.\n", 200);
cherokee_flcache_conn_clean (flcache_conn);
- cherokee_flcache_del_entry (REQ_VSRV(conn)->flcache, entry);
+ cherokee_flcache_del_entry (REQ_VSRV(req)->flcache, entry);
return ret_deny;
}
/* Inspect header
*/
- ret = inspect_header (flcache_conn, &flcache_conn->header, conn);
+ ret = inspect_header (flcache_conn, &flcache_conn->header, req);
if (ret == ret_deny) {
cherokee_flcache_conn_clean (flcache_conn);
- cherokee_flcache_del_entry (REQ_VSRV(conn)->flcache, entry);
+ cherokee_flcache_del_entry (REQ_VSRV(req)->flcache, entry);
return ret_ok;
}
/* Create the cache file
*/
- ret = create_flconn_file (REQ_VSRV(conn)->flcache, conn);
+ ret = create_flconn_file (REQ_VSRV(req)->flcache, req);
if (ret != ret_ok) {
- cherokee_flcache_del_entry (REQ_VSRV(conn)->flcache, entry);
+ cherokee_flcache_del_entry (REQ_VSRV(req)->flcache, entry);
return ret_error;
}
@@ -710,18 +710,18 @@ cherokee_flcache_conn_commit_header (cherokee_flcache_conn_t *flcache_conn,
ret_t
cherokee_flcache_conn_write_body (cherokee_flcache_conn_t *flcache_conn,
- cherokee_request_t *conn)
+ cherokee_request_t *req)
{
ssize_t written;
do {
- written = write (flcache_conn->fd, conn->buffer.buf, conn->buffer.len);
+ written = write (flcache_conn->fd, req->buffer.buf, req->buffer.len);
} while ((written == -1) && (errno == EINTR));
TRACE (ENTRIES, "Writing body: %d bytes to fd=%d (%d has been written)\n",
- conn->buffer.len, flcache_conn->fd, written);
+ req->buffer.len, flcache_conn->fd, written);
- if (unlikely (written != conn->buffer.len)) {
+ if (unlikely (written != req->buffer.len)) {
return ret_error;
}
@@ -732,7 +732,7 @@ cherokee_flcache_conn_write_body (cherokee_flcache_conn_t *flcache_conn,
ret_t
cherokee_flcache_conn_send_header (cherokee_flcache_conn_t *flcache_conn,
- cherokee_request_t *conn)
+ cherokee_request_t *req)
{
ret_t ret;
ssize_t got;
@@ -755,28 +755,28 @@ cherokee_flcache_conn_send_header (cherokee_flcache_conn_t *flcache_conn,
TRACE (ENTRIES, "Reading header: len %d from fd=%d\n", len, flcache_conn->fd);
- ret = cherokee_buffer_read_from_fd (&conn->header_buffer, flcache_conn->fd, len, &got2);
+ ret = cherokee_buffer_read_from_fd (&req->header_buffer, flcache_conn->fd, len, &got2);
if (unlikely (ret != ret_ok)) {
return ret_error;
}
/* Add Content-Length
*/
- cherokee_buffer_add_str (&conn->header_buffer, "Content-Length: ");
- cherokee_buffer_add_ullong10 (&conn->header_buffer, flcache_conn->avl_node_ref->file_size);
- cherokee_buffer_add_str (&conn->header_buffer, CRLF);
+ cherokee_buffer_add_str (&req->header_buffer, "Content-Length: ");
+ cherokee_buffer_add_ullong10 (&req->header_buffer, flcache_conn->avl_node_ref->file_size);
+ cherokee_buffer_add_str (&req->header_buffer, CRLF);
/* X-Cache
*/
- cherokee_buffer_add_str (&conn->header_buffer, "X-Cache: HIT from ");
- cherokee_request_build_host_port_string (conn, &conn->header_buffer);
- cherokee_buffer_add_str (&conn->header_buffer, CRLF);
+ cherokee_buffer_add_str (&req->header_buffer, "X-Cache: HIT from ");
+ cherokee_request_build_host_port_string (req, &req->header_buffer);
+ cherokee_buffer_add_str (&req->header_buffer, CRLF);
/* Age (RFC2616, section 14.6)
*/
- cherokee_buffer_add_str (&conn->header_buffer, "Age: ");
- cherokee_buffer_add_long10 (&conn->header_buffer, cherokee_bogonow_now - flcache_conn->avl_node_ref->created_at);
- cherokee_buffer_add_str (&conn->header_buffer, CRLF);
+ cherokee_buffer_add_str (&req->header_buffer, "Age: ");
+ cherokee_buffer_add_long10 (&req->header_buffer, cherokee_bogonow_now - flcache_conn->avl_node_ref->created_at);
+ cherokee_buffer_add_str (&req->header_buffer, CRLF);
return ret_ok;
}
@@ -784,7 +784,7 @@ cherokee_flcache_conn_send_header (cherokee_flcache_conn_t *flcache_conn,
ret_t
cherokee_flcache_conn_send_body (cherokee_flcache_conn_t *flcache_conn,
- cherokee_request_t *conn)
+ cherokee_request_t *req)
{
ret_t ret;
size_t got = 0;
@@ -792,7 +792,7 @@ cherokee_flcache_conn_send_body (cherokee_flcache_conn_t *flcache_conn,
TRACE (ENTRIES, "Reading body from fd=%d\n", flcache_conn->fd);
- ret = cherokee_buffer_read_from_fd (&conn->buffer, flcache_conn->fd, DEFAULT_READ_SIZE, &got);
+ ret = cherokee_buffer_read_from_fd (&req->buffer, flcache_conn->fd, DEFAULT_READ_SIZE, &got);
if (got != 0) {
flcache_conn->response_sent += got;
View
56 cherokee/gen_evhost.c
@@ -45,7 +45,7 @@ _free (cherokee_generic_evhost_t *evhost)
}
static ret_t
-_check_document_root (cherokee_request_t *conn)
+_check_document_root (cherokee_request_t *req)
{
ret_t ret;
@@ -53,9 +53,9 @@ _check_document_root (cherokee_request_t *conn)
struct stat *info;
cherokee_iocache_entry_t *io_entry = NULL;
- ret = cherokee_io_stat (REQ_SRV(conn)->iocache,
- &conn->local_directory,
- (REQ_SRV(conn)->iocache != NULL),
+ ret = cherokee_io_stat (REQ_SRV(req)->iocache,
+ &req->local_directory,
+ (REQ_SRV(req)->iocache != NULL),
&stat_mem, &io_entry, &info);
if (ret != ret_ok) {
@@ -79,14 +79,14 @@ _check_document_root (cherokee_request_t *conn)
static ret_t
_render_document_root (cherokee_generic_evhost_t *evhost,
- cherokee_request_t *conn)
+ cherokee_request_t *req)
{
ret_t ret;
/* Render the document root
*/
ret = cherokee_template_render (&evhost->tpl_document_root,
- &conn->local_directory, conn);
+ &req->local_directory, req);
if (unlikely (ret != ret_ok))
return ret_error;
@@ -95,13 +95,13 @@ _render_document_root (cherokee_generic_evhost_t *evhost,
/* Check the Document Root
*/
- ret = _check_document_root (conn);
+ ret = _check_document_root (req);
if (ret != ret_ok) {
- TRACE(ENTRIES, "Dynamic Document Root '%s' doesn't exist\n", conn->local_directory.buf);
+ TRACE(ENTRIES, "Dynamic Document Root '%s' doesn't exist\n", req->local_directory.buf);
return ret_not_found;
}
- TRACE(ENTRIES, "Dynamic Document Root '%s' exists\n", conn->local_directory.buf);
+ TRACE(ENTRIES, "Dynamic Document Root '%s' exists\n", req->local_directory.buf);
return ret_ok;
}
@@ -137,10 +137,12 @@ add_domain (cherokee_template_t *template,
cherokee_buffer_t *output,
void *param)
{
- cherokee_request_t *conn = REQ(param);
+ cherokee_request_t *req = REQ(param);
+
UNUSED(template);
UNUSED(token);
- return cherokee_buffer_add_buffer (output, &conn->host);
+
+ return cherokee_buffer_add_buffer (output, &req->host);
}
@@ -150,14 +152,14 @@ add_tld (cherokee_template_t *template,
cherokee_buffer_t *output,
void *param)
{
- const char *p;
- const char *end;
- cherokee_request_t *conn = REQ(param);
+ const char *p;
+ const char *end;
+ cherokee_request_t *req = REQ(param);
UNUSED(template);
UNUSED(token);
- end = conn->host.buf + conn->host.len;
+ end = req->host.buf + req->host.len;
p = end - 1;
if (unlikely (*p == '.')) {
@@ -165,7 +167,7 @@ add_tld (cherokee_template_t *template,
return ret_deny;
}
- while (p > conn->host.buf) {
+ while (p > req->host.buf) {
if (*p != '.') {
p--;
continue;
@@ -186,14 +188,14 @@ add_domain_no_tld (cherokee_template_t *template,
cherokee_buffer_t *output,
void *param)
{
- const char *p;
- const char *end;
- cherokee_request_t *conn = REQ(param);
+ const char *p;
+ const char *end;
+ cherokee_request_t *req = REQ(param);
UNUSED(template);
UNUSED(token);
- end = conn->host.buf + conn->host.len;
+ end = req->host.buf + req->host.len;
p = end - 1;
if (unlikely (*p == '.')) {
@@ -201,13 +203,13 @@ add_domain_no_tld (cherokee_template_t *template,
return ret_deny;
}
- while (p > conn->host.buf) {
+ while (p > req->host.buf) {
if (*p != '.') {
p--;
continue;
}
- cherokee_buffer_add (output, conn->host.buf, p - conn->host.buf);
+ cherokee_buffer_add (output, req->host.buf, p - req->host.buf);
return ret_ok;
}
@@ -217,15 +219,15 @@ add_domain_no_tld (cherokee_template_t *template,
static ret_t
-_add_subdomain (cherokee_buffer_t *output,
- cherokee_request_t *conn,
- int starting_dot)
+_add_subdomain (cherokee_buffer_t *output,
+ cherokee_request_t *req,
+ int starting_dot)
{
const char *p;
const char *end;
const char *dom_end = NULL;
- end = conn->host.buf + conn->host.len;
+ end = req->host.buf + req->host.len;
p = end - 1;
if (unlikely (*p == '.')) {
@@ -233,7 +235,7 @@ _add_subdomain (cherokee_buffer_t *output,
return ret_deny;
}
- while (p > conn->host.buf) {
+ while (p > req->host.buf) {
if (*p != '.') {
p--;
continue;
View
46 cherokee/handler_admin.c
@@ -135,19 +135,19 @@ static ret_t
front_line_cache_purge (cherokee_handler_admin_t *hdl)
{
ret_t ret;
- cherokee_request_t *conn = HANDLER_REQ(hdl);
+ cherokee_request_t *req = HANDLER_REQ(hdl);
cherokee_virtual_server_t *vsrv = HANDLER_VSRV(hdl);
/* FLCache not active in the Virtual Server
*/
if (vsrv->flcache == NULL) {
- conn->error_code = http_not_found;
+ req->error_code = http_not_found;
return ret_error;
}
/* Remove the cache objects
*/
- ret = cherokee_flcache_purge_path (vsrv->flcache, &conn->request);
+ ret = cherokee_flcache_purge_path (vsrv->flcache, &req->request);
switch (ret) {
case ret_ok:
@@ -155,11 +155,11 @@ front_line_cache_purge (cherokee_handler_admin_t *hdl)
return ret_ok;
case ret_not_found:
cherokee_dwriter_cstring (&hdl->dwriter, "not found");
- conn->error_code = http_not_found;
+ req->error_code = http_not_found;
return ret_error;
default:
cherokee_dwriter_cstring (&hdl->dwriter, "error");
- conn->error_code = http_internal_error;
+ req->error_code = http_internal_error;
return ret_error;
}
@@ -172,10 +172,10 @@ front_line_cache_purge (cherokee_handler_admin_t *hdl)
ret_t
cherokee_handler_admin_init (cherokee_handler_admin_t *hdl)
{
- cherokee_request_t *conn = HANDLER_REQ(hdl);
+ cherokee_request_t *req = HANDLER_REQ(hdl);
-#define finishes_by(s) ((conn->request.len > sizeof(s)-1) && \
- (!strncmp (conn->request.buf + conn->request.len - (sizeof(s)-1), s, sizeof(s)-1)))
+#define finishes_by(s) ((req->request.len > sizeof(s)-1) && \
+ (!strncmp (req->request.buf + req->request.len - (sizeof(s)-1), s, sizeof(s)-1)))
if (finishes_by ("/py")) {
hdl->dwriter.lang = dwriter_python;
@@ -189,7 +189,7 @@ cherokee_handler_admin_init (cherokee_handler_admin_t *hdl)
/* Front-Line Cache's PURGE
*/
- if (conn->header.method == http_purge) {
+ if (req->header.method == http_purge) {
return front_line_cache_purge (hdl);
}
@@ -201,29 +201,29 @@ cherokee_handler_admin_init (cherokee_handler_admin_t *hdl)
ret_t
cherokee_handler_admin_read_post (cherokee_handler_admin_t *hdl)
{
- int re;
- ret_t ret;
- char *tmp;
- cherokee_buffer_t post = CHEROKEE_BUF_INIT;
- cherokee_buffer_t line = CHEROKEE_BUF_INIT;
- cherokee_request_t *conn = HANDLER_REQ(hdl);
+ int re;
+ ret_t ret;
+ char *tmp;
+ cherokee_buffer_t post = CHEROKEE_BUF_INIT;
+ cherokee_buffer_t line = CHEROKEE_BUF_INIT;
+ cherokee_request_t *req = HANDLER_REQ(hdl);
/* Check for the post info
*/
- if (! conn->post.has_info) {
- conn->error_code = http_bad_request;
+ if (! req->post.has_info) {
+ req->error_code = http_bad_request;
return ret_error;
}
/* Process line per line
*/
- ret = cherokee_post_read (&conn->post, &conn->socket, &post);
+ ret = cherokee_post_read (&req->post, &req->socket, &post);
switch (ret) {
case ret_ok:
case ret_eagain:
break;
default:
- conn->error_code = http_bad_request;
+ req->error_code = http_bad_request;
return ret_error;
}
@@ -251,7 +251,7 @@ cherokee_handler_admin_read_post (cherokee_handler_admin_t *hdl)
*/
ret = process_request_line (hdl, &line);
if (ret == ret_error) {
- conn->error_code = http_bad_request;
+ req->error_code = http_bad_request;
ret = ret_error;
goto exit2;
}
@@ -265,7 +265,7 @@ cherokee_handler_admin_read_post (cherokee_handler_admin_t *hdl)
/* There might be more POST to read
*/
- re = cherokee_post_read_finished (&conn->post);
+ re = cherokee_post_read_finished (&req->post);
ret = re ? ret_ok : ret_eagain;
exit2:
@@ -278,11 +278,11 @@ cherokee_handler_admin_read_post (cherokee_handler_admin_t *hdl)
ret_t
cherokee_handler_admin_add_headers (cherokee_handler_admin_t *hdl, cherokee_buffer_t *buffer)
{
- cherokee_request_t *conn = HANDLER_REQ(hdl);
+ cherokee_request_t *req = HANDLER_REQ(hdl);
/* Regular request
*/
- if (cherokee_request_should_include_length(conn)) {
+ if (cherokee_request_should_include_length(req)) {
HANDLER(hdl)->support = hsupport_length;
cherokee_buffer_add_va (buffer, "Content-Length: %lu" CRLF, hdl->reply.len);
}
View
74 cherokee/handler_cgi.c
@@ -81,7 +81,7 @@ read_from_cgi (cherokee_handler_cgi_base_t *cgi_base, cherokee_buffer_t *buffer)
ret_t ret;
size_t read_ = 0;
cherokee_handler_cgi_t *cgi = HDL_CGI(cgi_base);
- cherokee_request_t *conn = HANDLER_REQ(cgi);
+ cherokee_request_t *req = HANDLER_REQ(cgi);
/* Sanity check: pipe() accessed
*/
@@ -96,8 +96,8 @@ read_from_cgi (cherokee_handler_cgi_base_t *cgi_base, cherokee_buffer_t *buffer)
switch (ret) {
case ret_eagain:
- conn->polling_aim.fd = cgi->pipeInput;
- conn->polling_aim.mode = poll_mode_read;
+ req->polling_aim.fd = cgi->pipeInput;
+ req->polling_aim.mode = poll_mode_read;
return ret_eagain;
case ret_ok:
@@ -355,21 +355,21 @@ cherokee_handler_cgi_add_env_pair (cherokee_handler_cgi_base_t *cgi_base,
static ret_t
add_environment (cherokee_handler_cgi_t *cgi,
- cherokee_request_t *conn)
+ cherokee_request_t *req)
{
ret_t ret;
cherokee_handler_cgi_base_t *cgi_base = HDL_CGI_BASE(cgi);
- cherokee_buffer_t *tmp = THREAD_TMP_BUF2(REQ_THREAD(conn));
+ cherokee_buffer_t *tmp = THREAD_TMP_BUF2(REQ_THREAD(req));
- ret = cherokee_handler_cgi_base_build_envp (HDL_CGI_BASE(cgi), conn);
+ ret = cherokee_handler_cgi_base_build_envp (HDL_CGI_BASE(cgi), req);
if (unlikely (ret != ret_ok))
return ret;
/* CONTENT_LENGTH
*/
- if (http_method_with_input (conn->header.method)) {
+ if (http_method_with_input (req->header.method)) {
cherokee_buffer_clean (tmp);
- cherokee_buffer_add_ullong10 (tmp, conn->post.len);
+ cherokee_buffer_add_ullong10 (tmp, req->post.len);
set_env (cgi_base, "CONTENT_LENGTH", tmp->buf, tmp->len);
}
@@ -391,7 +391,7 @@ cherokee_handler_cgi_init (cherokee_handler_cgi_t *cgi)
{
ret_t ret;
cherokee_handler_cgi_base_t *cgi_base = HDL_CGI_BASE(cgi);
- cherokee_request_t *conn = HANDLER_REQ(cgi);
+ cherokee_request_t *req = HANDLER_REQ(cgi);
switch (cgi_base->init_phase) {
case hcgi_phase_build_headers:
@@ -409,7 +409,7 @@ cherokee_handler_cgi_init (cherokee_handler_cgi_t *cgi)
* otherwhise the server will drop it for the CGI
* isn't fast enough
*/
- conn->timeout = cherokee_bogonow_now + CGI_TIMEOUT;
+ req->timeout = cherokee_bogonow_now + CGI_TIMEOUT;
cgi_base->init_phase = hcgi_phase_connect;
case hcgi_phase_connect:
@@ -432,26 +432,26 @@ cherokee_handler_cgi_init (cherokee_handler_cgi_t *cgi)
ret_t
cherokee_handler_cgi_read_post (cherokee_handler_cgi_t *cgi)
{
- ret_t ret;
- cherokee_request_t *conn = HANDLER_REQ(cgi);
- cherokee_boolean_t did_IO = false;
+ ret_t ret;
+ cherokee_request_t *req = HANDLER_REQ(cgi);
+ cherokee_boolean_t did_IO = false;
- if (! conn->post.has_info) {
+ if (! req->post.has_info) {
return ret_ok;
}
- ret = cherokee_post_send_to_fd (&conn->post, &conn->socket,
+ ret = cherokee_post_send_to_fd (&req->post, &req->socket,
cgi->pipeOutput, NULL, &did_IO);
if (did_IO) {
- cherokee_request_update_timeout (conn);
+ cherokee_request_update_timeout (req);
}
switch (ret) {
case ret_ok:
break;
case ret_eagain:
- /* conn->polling_aim.{fd,mode} was previously set by
+ /* req->polling_aim.{fd,mode} was previously set by
* cherokee_post_send_to_fd()
*/
return ret_eagain;
@@ -501,7 +501,7 @@ manage_child_cgi_process (cherokee_handler_cgi_t *cgi, int pipe_cgi[2], int pipe
*/
int re;
char *script;
- cherokee_request_t *conn = HANDLER_REQ(cgi);
+ cherokee_request_t *req = HANDLER_REQ(cgi);
cherokee_handler_cgi_base_t *cgi_base = HDL_CGI_BASE(cgi);
char *absolute_path = cgi_base->executable.buf;
char *argv[2] = { NULL, NULL };
@@ -509,8 +509,8 @@ manage_child_cgi_process (cherokee_handler_cgi_t *cgi, int pipe_cgi[2], int pipe
#ifdef TRACE_ENABLED
TRACE(ENTRIES, "About to execute: '%s'\n", absolute_path);
- if (! cherokee_buffer_is_empty (&conn->effective_directory))
- TRACE(ENTRIES, "Effective directory: '%s'\n", conn->effective_directory.buf);
+ if (! cherokee_buffer_is_empty (&req->effective_directory))
+ TRACE(ENTRIES, "Effective directory: '%s'\n", req->effective_directory.buf);
else
TRACE(ENTRIES, "No Effective directory %s", "\n");
#endif
@@ -538,11 +538,11 @@ manage_child_cgi_process (cherokee_handler_cgi_t *cgi, int pipe_cgi[2], int pipe
/* Redirect the stderr
*/
- if ((REQ_VSRV(conn)->error_writer != NULL) &&
- (REQ_VSRV(conn)->error_writer->fd != -1))
+ if ((REQ_VSRV(req)->error_writer != NULL) &&
+ (REQ_VSRV(req)->error_writer->fd != -1))
{
cherokee_fd_close (STDERR_FILENO);
- dup2 (REQ_VSRV(conn)->error_writer->fd, STDERR_FILENO);
+ dup2 (REQ_VSRV(req)->error_writer->fd, STDERR_FILENO);
}
# if 0
@@ -560,12 +560,12 @@ manage_child_cgi_process (cherokee_handler_cgi_t *cgi, int pipe_cgi[2], int pipe
/* Sets the new environ.
*/
- add_environment (cgi, conn);
+ add_environment (cgi, req);
/* Change the directory
*/
- if (! cherokee_buffer_is_empty (&conn->effective_directory)) {
- re = chdir (conn->effective_directory.buf);
+ if (! cherokee_buffer_is_empty (&req->effective_directory)) {
+ re = chdir (req->effective_directory.buf);
} else {
char *file = strrchr (absolute_path, '/');
@@ -650,9 +650,9 @@ manage_child_cgi_process (cherokee_handler_cgi_t *cgi, int pipe_cgi[2], int pipe
static ret_t
fork_and_execute_cgi_unix (cherokee_handler_cgi_t *cgi)
{
- int re;
- int pid;
- cherokee_request_t *conn = HANDLER_REQ(cgi);
+ int re;
+ int pid;
+ cherokee_request_t *req = HANDLER_REQ(cgi);
struct {
int cgi[2];
@@ -665,7 +665,7 @@ fork_and_execute_cgi_unix (cherokee_handler_cgi_t *cgi)
re |= cherokee_pipe (pipes.server);
if (re != 0) {
- conn->error_code = http_internal_error;
+ req->error_code = http_internal_error;
return ret_error;
}
@@ -686,7 +686,7 @@ fork_and_execute_cgi_unix (cherokee_handler_cgi_t *cgi)
cherokee_fd_close (pipes.server[0]);
cherokee_fd_close (pipes.server[1]);
- conn->error_code = http_internal_error;
+ req->error_code = http_internal_error;
return ret_error;
}
@@ -725,7 +725,7 @@ fork_and_execute_cgi_win32 (cherokee_handler_cgi_t *cgi)
char *cmd;
cherokee_buffer_t cmd_line = CHEROKEE_BUF_INIT;
cherokee_buffer_t exec_dir = CHEROKEE_BUF_INIT;
- cherokee_request_t *conn = HANDLER_REQ(cgi);
+ cherokee_request_t *req = HANDLER_REQ(cgi);
SECURITY_ATTRIBUTES saSecAtr;
HANDLE hProc;
@@ -736,7 +736,7 @@ fork_and_execute_cgi_win32 (cherokee_handler_cgi_t *cgi)
/* Create the environment for the process
*/
- add_environment (cgi, conn);
+ add_environment (cgi, req);
cherokee_buffer_add (&cgi->envp, "\0", 1);
/* Command line
@@ -747,8 +747,8 @@ fork_and_execute_cgi_win32 (cherokee_handler_cgi_t *cgi)
/* Execution directory
*/
- if (! cherokee_buffer_is_empty (&conn->effective_directory)) {
- cherokee_buffer_add_buffer (&exec_dir, &conn->effective_directory);
+ if (! cherokee_buffer_is_empty (&req->effective_directory)) {
+ cherokee_buffer_add_buffer (&exec_dir, &req->effective_directory);
} else {
char *file = strrchr (cmd, '/');
char *end = HDL_CGI_BASE(cgi)->executable.buf + HDL_CGI_BASE(cgi)->executable.len;
@@ -822,7 +822,7 @@ fork_and_execute_cgi_win32 (cherokee_handler_cgi_t *cgi)
CloseHandle (pi.hProcess);
CloseHandle (pi.hThread);
- conn->error_code = http_internal_error;
+ req->error_code = http_internal_error;
return ret_error;
}
@@ -840,7 +840,7 @@ fork_and_execute_cgi_win32 (cherokee_handler_cgi_t *cgi)
*/
cgi->pipeInput = _open_osfhandle((LONG)hChildStdoutRd, O_BINARY|_O_RDONLY);
- if (! conn->post.len <= 0) {
+ if (! req->post.len <= 0) {
CloseHandle (hChildStdinWr);
} else {
cgi->pipeOutput = _open_osfhandle((LONG)hChildStdinWr, O_BINARY|_O_WRONLY);
View
281 cherokee/handler_cgi_base.c
@@ -42,7 +42,7 @@ static cherokee_handler_file_props_t handler_file_props;
ret_t
cherokee_handler_cgi_base_init (cherokee_handler_cgi_base_t *cgi,
- cherokee_request_t *conn,
+ cherokee_request_t *req,
cherokee_plugin_info_handler_t *info,
cherokee_handler_props_t *props,
cherokee_handler_cgi_base_add_env_pair_t add_env_pair,
@@ -50,7 +50,7 @@ cherokee_handler_cgi_base_init (cherokee_handler_cgi_base_t *cgi,
{
/* Init the base class object
*/
- cherokee_handler_init_base (HANDLER(cgi), conn, props, info);
+ cherokee_handler_init_base (HANDLER(cgi), req, props, info);
/* Init to default values
*/
@@ -254,7 +254,7 @@ ret_t
cherokee_handler_cgi_base_build_basic_env (
cherokee_handler_cgi_base_t *cgi,
cherokee_handler_cgi_base_add_env_pair_t set_env_pair,
- cherokee_request_t *conn,
+ cherokee_request_t *req,
cherokee_buffer_t *tmp)
{
int re;
@@ -294,14 +294,14 @@ cherokee_handler_cgi_base_build_basic_env (
/* Document Root:
*/
- if (REQ_VSRV(conn)->evhost) {
+ if (REQ_VSRV(req)->evhost) {
set_env (cgi, "DOCUMENT_ROOT",
- conn->local_directory.buf,
- conn->local_directory.len);
+ req->local_directory.buf,
+ req->local_directory.len);
} else {
set_env (cgi, "DOCUMENT_ROOT",
- REQ_VSRV(conn)->root.buf,
- REQ_VSRV(conn)->root.len);
+ REQ_VSRV(req)->root.buf,
+ REQ_VSRV(req)->root.len);
}
/* REMOTE_(ADDR/PORT): X-Real-IP
@@ -311,17 +311,17 @@ cherokee_handler_cgi_base_build_basic_env (
if (cgi_props->x_real_ip.enabled)
{
/* The request has a X-REAL-IP entry */
- cherokee_header_get_known (&conn->header, header_x_real_ip, &p, &p_len);
+ cherokee_header_get_known (&req->header, header_x_real_ip, &p, &p_len);
/* The request has a X-Forwared-For entry */
if (p == NULL) {
- cherokee_header_get_known (&conn->header, header_x_forwarded_for, &p, &p_len);
+ cherokee_header_get_known (&req->header, header_x_forwarded_for, &p, &p_len);
}
if (p != NULL)
{
/* The remote host is allowed to send it */
- ret = cherokee_x_real_ip_is_allowed (&cgi_props->x_real_ip, &conn->socket);
+ ret = cherokee_x_real_ip_is_allowed (&cgi_props->x_real_ip, &req->socket);
if (ret == ret_ok) {
cuint_t i;
const char *port_end = NULL;
@@ -370,11 +370,11 @@ cherokee_handler_cgi_base_build_basic_env (
if (! remote_addr_set) {
/* REMOTE_ADDR */
memset (remote_ip, 0, sizeof(remote_ip));
- cherokee_socket_ntop (&conn->socket, remote_ip, sizeof(remote_ip)-1);
+ cherokee_socket_ntop (&req->socket, remote_ip, sizeof(remote_ip)-1);
set_env (cgi, "REMOTE_ADDR", remote_ip, strlen(remote_ip));
/* REMOTE_PORT */
- re = snprintf (temp, temp_size, "%d", SOCKET_SIN_PORT(&conn->socket));
+ re = snprintf (temp, temp_size, "%d", SOCKET_SIN_PORT(&req->socket));
if (re > 0) {
set_env (cgi, "REMOTE_PORT", temp, re);
}
@@ -384,7 +384,7 @@ cherokee_handler_cgi_base_build_basic_env (
* HTTP_HOST can include the «:PORT» text, and SERVER_NAME only
* the name
*/
- cherokee_header_copy_known (&conn->header, header_host, tmp);
+ cherokee_header_copy_known (&req->header, header_host, tmp);
if (! cherokee_buffer_is_empty(tmp)) {
set_env (cgi, "HTTP_HOST", tmp->buf, tmp->len);
@@ -406,7 +406,7 @@ cherokee_handler_cgi_base_build_basic_env (
/* Content-Type
*/
cherokee_buffer_clean (tmp);
- ret = cherokee_header_copy_known (&conn->header, header_content_type, tmp);
+ ret = cherokee_header_copy_known (&req->header, header_content_type, tmp);
if (ret == ret_ok) {
set_env (cgi, "CONTENT_TYPE", tmp->buf, tmp->len);
}
@@ -419,34 +419,34 @@ cherokee_handler_cgi_base_build_basic_env (
/* Query string
*/
- if (conn->query_string.len > 0)
- set_env (cgi, "QUERY_STRING", conn->query_string.buf, conn->query_string.len);
+ if (req->query_string.len > 0)
+ set_env (cgi, "QUERY_STRING", req->query_string.buf, req->query_string.len);
else
set_env (cgi, "QUERY_STRING", "", 0);
/* HTTP protocol version
*/
- ret = cherokee_http_version_to_string (conn->header.version, (const char **) &p, &p_len);
+ ret = cherokee_http_version_to_string (req->header.version, (const char **) &p, &p_len);
if (ret >= ret_ok)
set_env (cgi, "SERVER_PROTOCOL", p, p_len);
/* Set the method
*/
- ret = cherokee_http_method_to_string (conn->header.method, (const char **) &p, &p_len);
+ ret = cherokee_http_method_to_string (req->header.method, (const char **) &p, &p_len);
if (ret >= ret_ok)
set_env (cgi, "REQUEST_METHOD", p, p_len);
/* Remote user
*/
- if (conn->validator && !cherokee_buffer_is_empty (&conn->validator->user)) {
+ if (req->validator && !cherokee_buffer_is_empty (&req->validator->user)) {
/* Only set when user authenticated (bug #467) */
- set_env (cgi, "REMOTE_USER", conn->validator->user.buf, conn->validator->user.len);
+ set_env (cgi, "REMOTE_USER", req->validator->user.buf, req->validator->user.len);
}
/* Set PATH_INFO
*/
- if (! cherokee_buffer_is_empty (&conn->pathinfo))
- set_env (cgi, "PATH_INFO", conn->pathinfo.buf, conn->pathinfo.len);
+ if (! cherokee_buffer_is_empty (&req->pathinfo))
+ set_env (cgi, "PATH_INFO", req->pathinfo.buf, req->pathinfo.len);
else
set_env (cgi, "PATH_INFO", "", 0);
@@ -457,27 +457,27 @@ cherokee_handler_cgi_base_build_basic_env (
*/
cherokee_buffer_clean (tmp);
- if (conn->options & conn_op_root_index) {
- cherokee_header_copy_request_w_args (&conn->header, tmp);
+ if (req->options & conn_op_root_index) {
+ cherokee_header_copy_request_w_args (&req->header, tmp);
}
else {
- if (! cherokee_buffer_is_empty (&conn->userdir)) {
+ if (! cherokee_buffer_is_empty (&req->userdir)) {
cherokee_buffer_add_str (tmp, "/~");
- cherokee_buffer_add_buffer (tmp, &conn->userdir);
+ cherokee_buffer_add_buffer (tmp, &req->userdir);
}
- if (! cherokee_buffer_is_empty (&conn->request_original)) {
- cherokee_buffer_add_buffer (tmp, &conn->request_original);
- if (! cherokee_buffer_is_empty (&conn->query_string_original)) {
+ if (! cherokee_buffer_is_empty (&req->request_original)) {
+ cherokee_buffer_add_buffer (tmp, &req->request_original);
+ if (! cherokee_buffer_is_empty (&req->query_string_original)) {
cherokee_buffer_add_char (tmp, '?');
- cherokee_buffer_add_buffer (tmp, &conn->query_string_original);
+ cherokee_buffer_add_buffer (tmp, &req->query_string_original);
}
} else {
- cherokee_buffer_add_buffer (tmp, &conn->request);
+ cherokee_buffer_add_buffer (tmp, &req->request);
- if (! cherokee_buffer_is_empty (&conn->query_string)) {
+ if (! cherokee_buffer_is_empty (&req->query_string)) {
cherokee_buffer_add_char (tmp, '?');
- cherokee_buffer_add_buffer (tmp, &conn->query_string);
+ cherokee_buffer_add_buffer (tmp, &req->query_string);
}
}
}
@@ -485,19 +485,19 @@ cherokee_handler_cgi_base_build_basic_env (
/* Set SCRIPT_URL
*/
- if (! cherokee_buffer_is_empty (&conn->userdir)) {
+ if (! cherokee_buffer_is_empty (&req->userdir)) {
cherokee_buffer_clean (tmp);
cherokee_buffer_add_str (tmp, "/~");
- cherokee_buffer_add_buffer (tmp, &conn->userdir);
- cherokee_buffer_add_buffer (tmp, &conn->request);
+ cherokee_buffer_add_buffer (tmp, &req->userdir);
+ cherokee_buffer_add_buffer (tmp, &req->request);
set_env (cgi, "SCRIPT_URL", tmp->buf, tmp->len);
} else {
- set_env (cgi, "SCRIPT_URL", conn->request.buf, conn->request.len);
+ set_env (cgi, "SCRIPT_URL", req->request.buf, req->request.len);
}
/* Set HTTPS and SERVER_PORT
*/
- if (conn->socket.is_tls) {
+ if (req->socket.is_tls) {
set_env (cgi, "HTTPS", "on", 2);
} else {
set_env (cgi, "HTTPS", "off", 3);
@@ -515,7 +515,7 @@ cherokee_handler_cgi_base_build_basic_env (
char ip_str[CHE_INET_ADDRSTRLEN+1];
my_address_len = sizeof(my_address);
- re = getsockname (SOCKET_FD(&conn->socket),
+ re = getsockname (SOCKET_FD(&req->socket),
(struct sockaddr *)&my_address,
&my_address_len);
if (re == 0) {
@@ -535,19 +535,19 @@ cherokee_handler_cgi_base_build_basic_env (
/* Internal error redirection:
* It is okay if the QS is empty.