Project

General

Profile

elsecond.patch

Gwenlliana, 2014-11-01 14:53

View differences:

src/response.c (working copy)
248 248
		if (con->conf.log_condition_handling) {
249 249
			log_error_write(srv, __FILE__, __LINE__,  "s",  "run condition");
250 250
		}
251
		config_patch_connection(srv, con, COMP_SERVER_SOCKET); /* SERVERsocket */
252 251

  
253 252
		/**
254 253
		 * prepare strings
......
281 280
		buffer_copy_string_buffer(con->uri.authority, con->request.http_host);
282 281
		buffer_to_lower(con->uri.authority);
283 282

  
284
		config_patch_connection(srv, con, COMP_HTTP_SCHEME);    /* Scheme:      */
285
		config_patch_connection(srv, con, COMP_HTTP_HOST);      /* Host:        */
286
		config_patch_connection(srv, con, COMP_HTTP_REMOTE_IP); /* Client-IP */
287
		config_patch_connection(srv, con, COMP_HTTP_REFERER);   /* Referer:     */
288
		config_patch_connection(srv, con, COMP_HTTP_USER_AGENT);/* User-Agent:  */
289
		config_patch_connection(srv, con, COMP_HTTP_LANGUAGE);  /* Accept-Language:  */
290
		config_patch_connection(srv, con, COMP_HTTP_COOKIE);    /* Cookie:  */
291
		config_patch_connection(srv, con, COMP_HTTP_REQUEST_METHOD); /* REQUEST_METHOD */
292

  
293 283
		/** their might be a fragment which has to be cut away */
294 284
		if (NULL != (qstr = strchr(con->request.uri->ptr, '#'))) {
295 285
			con->request.uri->used = qstr - con->request.uri->ptr;
......
321 311
			buffer_path_simplify(con->uri.path, srv->tmp_buf);
322 312
		}
323 313

  
324
		config_patch_connection(srv, con, COMP_HTTP_URL); /* HTTPurl */
325
		config_patch_connection(srv, con, COMP_HTTP_QUERY_STRING); /* HTTPqs */
314
		/** apply specific configurations to this connection */
315
		con->conditional_is_valid[COMP_SERVER_SOCKET] = 1;       /* SERVERsocket   */
316
		con->conditional_is_valid[COMP_HTTP_HOST] = 1;	         /* Scheme:        */
317
		con->conditional_is_valid[COMP_HTTP_REMOTE_IP] = 1;      /* Host:          */
318
		con->conditional_is_valid[COMP_HTTP_REFERER] = 1;        /* Client-IP:     */
319
		con->conditional_is_valid[COMP_HTTP_USER_AGENT] = 1;     /* Referer:       */
320
		con->conditional_is_valid[COMP_HTTP_LANGUAGE] = 1;       /* User-Agent:    */
321
		con->conditional_is_valid[COMP_HTTP_COOKIE] = 1;         /* Cookie:        */
322
		con->conditional_is_valid[COMP_HTTP_REQUEST_METHOD] = 1; /* REQUEST_METHOD */
323
		con->conditional_is_valid[COMP_HTTP_URL] = 1;            /* HTTPurl        */
324
		con->conditional_is_valid[COMP_HTTP_QUERY_STRING] = 1;   /* HTTPqs         */
325
		config_patch_connection(srv, con);
326 326

  
327 327
#ifdef USE_OPENSSL
328 328
		if (con->srv_socket->is_ssl && con->conf.ssl_verifyclient) {
src/configfile.c (working copy)
367 367
	return 0;
368 368
}
369 369

  
370
int config_patch_connection(server *srv, connection *con, comp_key_t comp) {
370
int config_patch_connection(server *srv, connection *con) {
371 371
	size_t i, j;
372 372

  
373
	con->conditional_is_valid[comp] = 1;
374

  
375 373
	/* skip the first, the global context */
376 374
	for (i = 1; i < srv->config_context->used; i++) {
377 375
		data_config *dc = (data_config *)srv->config_context->data[i];
src/network.c (working copy)
108 108
	config_cond_cache_reset(srv, con);
109 109
	config_setup_connection(srv, con);
110 110

  
111
	config_patch_connection(srv, con, COMP_SERVER_SOCKET);
112
	config_patch_connection(srv, con, COMP_HTTP_SCHEME);
113
	config_patch_connection(srv, con, COMP_HTTP_HOST);
111
	con->conditional_is_valid[COMP_SERVER_SOCKET] = 1;
112
	con->conditional_is_valid[COMP_HTTP_SCHEME] = 1;
113
	con->conditional_is_valid[COMP_HTTP_HOST] = 1;
114
	config_patch_connection(srv, con);
114 115

  
115 116
	if (NULL == con->conf.ssl_pemfile_x509 || NULL == con->conf.ssl_pemfile_pkey) {
116 117
		/* x509/pkey available <=> pemfile was set <=> pemfile got patched: so this should never happen, unless you nest $SERVER["socket"] */
src/plugin.h (working copy)
85 85
int config_insert_values_global(server *srv, array *ca, const config_values_t *cv);
86 86
int config_insert_values_internal(server *srv, array *ca, const config_values_t *cv);
87 87
int config_setup_connection(server *srv, connection *con);
88
int config_patch_connection(server *srv, connection *con, comp_key_t comp);
88
int config_patch_connection(server *srv, connection *con);
89 89
int config_check_cond(server *srv, connection *con, data_config *dc);
90 90
int config_append_cond_match_buffer(connection *con, data_config *dc, buffer *buf, int n);
91 91