diff options
| author | Stanislav Malyshev <stas@php.net> | 2015-01-03 01:22:58 -0800 |
|---|---|---|
| committer | Stanislav Malyshev <stas@php.net> | 2015-01-10 15:07:38 -0800 |
| commit | b7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc (patch) | |
| tree | 0e09490075ee4f9a75a77ef4168d8ee254c52e5b /sapi/apache2filter | |
| parent | 773c8b0c092a0e9ad5c5548815bcb9991d54d5c1 (diff) | |
| download | php-git-b7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc.tar.gz | |
trailing whitespace removal
Diffstat (limited to 'sapi/apache2filter')
| -rw-r--r-- | sapi/apache2filter/apache_config.c | 14 | ||||
| -rw-r--r-- | sapi/apache2filter/php_apache.h | 2 | ||||
| -rw-r--r-- | sapi/apache2filter/php_functions.c | 24 | ||||
| -rw-r--r-- | sapi/apache2filter/sapi_apache2.c | 88 |
4 files changed, 64 insertions, 64 deletions
diff --git a/sapi/apache2filter/apache_config.c b/sapi/apache2filter/apache_config.c index 0e9bb73830..1703fba94f 100644 --- a/sapi/apache2filter/apache_config.c +++ b/sapi/apache2filter/apache_config.c @@ -60,11 +60,11 @@ static const char *real_value_hnd(cmd_parms *cmd, void *dummy, const char *name, php_dir_entry e; phpapdebug((stderr, "Getting %s=%s for %p (%d)\n", name, value, dummy, zend_hash_num_elements(&d->config))); - + if (!strncasecmp(value, "none", sizeof("none"))) { value = ""; } - + e.value = apr_pstrdup(cmd->pool, value); e.value_len = strlen(value); e.status = status; @@ -132,7 +132,7 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf) phpapdebug((stderr, "Merge dir (%p)+(%p)=(%p)\n", base_conf, new_conf, n)); for (zend_hash_internal_pointer_reset(&d->config); - zend_hash_get_current_key(&d->config, &str, &str_len, + zend_hash_get_current_key(&d->config, &str, &str_len, &num_index) == HASH_KEY_IS_STRING; zend_hash_move_forward(&d->config)) { pe = NULL; @@ -151,7 +151,7 @@ char *get_php_config(void *conf, char *name, size_t name_len) { php_conf_rec *d = conf; php_dir_entry *pe; - + if ((pe = zend_hash_find(&d->config, name, name_len)) != NULL) { return pe->value; } @@ -165,7 +165,7 @@ void apply_config(void *dummy) char *str; uint str_len; php_dir_entry *data; - + for (zend_hash_internal_pointer_reset(&d->config); zend_hash_get_current_key(&d->config, &str, &str_len, NULL) == HASH_KEY_IS_STRING; zend_hash_move_forward(&d->config)) { @@ -173,7 +173,7 @@ void apply_config(void *dummy) phpapdebug((stderr, "APPLYING (%s)(%s)\n", str, data->value)); if (zend_alter_ini_entry(str, str_len, data->value, data->value_len, data->status, data->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE) == FAILURE) { phpapdebug((stderr, "..FAILED\n")); - } + } } } @@ -191,7 +191,7 @@ static apr_status_t destroy_php_config(void *data) { php_conf_rec *d = data; - phpapdebug((stderr, "Destroying config %p\n", data)); + phpapdebug((stderr, "Destroying config %p\n", data)); zend_hash_destroy(&d->config); return APR_SUCCESS; diff --git a/sapi/apache2filter/php_apache.h b/sapi/apache2filter/php_apache.h index 5d9e795667..15c1c47516 100644 --- a/sapi/apache2filter/php_apache.h +++ b/sapi/apache2filter/php_apache.h @@ -36,7 +36,7 @@ typedef struct php_struct { int state; request_rec *r; ap_filter_t *f; /* downstream output filters after the PHP filter. */ - /* stat structure of the current file */ + /* stat structure of the current file */ struct stat finfo; /* Set-aside request body bucket brigade */ apr_bucket_brigade *post_data; diff --git a/sapi/apache2filter/php_functions.c b/sapi/apache2filter/php_functions.c index ad0f229003..4bfac96002 100644 --- a/sapi/apache2filter/php_functions.c +++ b/sapi/apache2filter/php_functions.c @@ -46,11 +46,11 @@ static request_rec *php_apache_lookup_uri(char *filename) { php_struct *ctx; - + if (!filename) { return NULL; } - + ctx = SG(server_context); return ap_sub_req_lookup_uri(filename, ctx->f->r, ctx->f->next); } @@ -71,7 +71,7 @@ PHP_FUNCTION(virtual) php_error_docref(NULL, E_WARNING, "Unable to include '%s' - URI lookup failed", filename); RETURN_FALSE; } - + if (rr->status == HTTP_OK) { if (ap_run_sub_req(rr)) { php_error_docref(NULL, E_WARNING, "Unable to include '%s' - request execution failed", filename); @@ -81,7 +81,7 @@ PHP_FUNCTION(virtual) ap_destroy_sub_req(rr); RETURN_TRUE; } - + php_error_docref(NULL, E_WARNING, "Unable to include '%s' - error finding URI", filename); ap_destroy_sub_req(rr); RETURN_FALSE; @@ -109,7 +109,7 @@ PHP_FUNCTION(apache_lookup_uri) php_error_docref(NULL, E_WARNING, "Unable to include '%s' - URI lookup failed", filename); RETURN_FALSE; } - + if (rr->status == HTTP_OK) { object_init(return_value); @@ -142,7 +142,7 @@ PHP_FUNCTION(apache_lookup_uri) ap_destroy_sub_req(rr); return; } - + php_error_docref(NULL, E_WARNING, "Unable to include '%s' - error finding URI", filename); ap_destroy_sub_req(rr); RETURN_FALSE; @@ -157,7 +157,7 @@ PHP_FUNCTION(apache_request_headers) char *key, *val; array_init(return_value); - + ctx = SG(server_context); arr = apr_table_elts(ctx->f->r->headers_in); @@ -177,7 +177,7 @@ PHP_FUNCTION(apache_response_headers) char *key, *val; array_init(return_value); - + ctx = SG(server_context); arr = apr_table_elts(ctx->f->r->headers_out); @@ -307,9 +307,9 @@ PHP_FUNCTION(apache_get_modules) { int n; char *p; - + array_init(return_value); - + for (n = 0; ap_loaded_modules[n]; ++n) { char *s = (char *) ap_loaded_modules[n]->name; if ((p = strchr(s, '.'))) { @@ -327,7 +327,7 @@ PHP_MINFO_FUNCTION(apache) smart_str tmp1 = {0}; int n; char *p; - + for (n = 0; ap_loaded_modules[n]; ++n) { char *s = (char *) ap_loaded_modules[n]->name; if ((p = strchr(s, '.'))) { @@ -340,7 +340,7 @@ PHP_MINFO_FUNCTION(apache) if ((tmp1.len - 1) >= 0) { tmp1.c[tmp1.len - 1] = '\0'; } - + php_info_print_table_start(); if (apv && *apv) { php_info_print_table_row(2, "Apache Version", apv); diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index 315fafd550..7487a128ce 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -49,7 +49,7 @@ #include "http_log.h" #include "http_main.h" #include "util_script.h" -#include "http_core.h" +#include "http_core.h" #include "ap_mpm.h" #include "php_apache.h" @@ -74,9 +74,9 @@ php_apache_sapi_ub_write(const char *str, uint str_length) ctx = SG(server_context); f = ctx->f; - + if (str_length == 0) return 0; - + ba = f->c->bucket_alloc; bb = apr_brigade_create(ctx->r->pool, ba); @@ -86,7 +86,7 @@ php_apache_sapi_ub_write(const char *str, uint str_length) if (ap_pass_brigade(f->next, bb) != APR_SUCCESS || ctx->r->connection->aborted) { php_handle_aborted_connection(); } - + return str_length; /* we always consume all the data passed to us. */ } @@ -118,7 +118,7 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_e ptr = val; *val = '\0'; - + do { val++; } while (*val == ' '); @@ -131,7 +131,7 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_e apr_table_set(ctx->r->headers_out, sapi_header->header, val); else apr_table_add(ctx->r->headers_out, sapi_header->header, val); - + *ptr = ':'; return SAPI_HEADER_ADD; @@ -218,7 +218,7 @@ php_apache_sapi_getenv(char *name, size_t name_len) { php_struct *ctx = SG(server_context); const char *env_var; - + env_var = apr_table_get(ctx->r->subprocess_env, name); return (char *) env_var; @@ -231,7 +231,7 @@ php_apache_sapi_register_variables(zval *track_vars_array) const apr_array_header_t *arr = apr_table_elts(ctx->r->subprocess_env); char *key, *val; unsigned int new_val_len; - + APR_ARRAY_FOREACH_OPEN(arr, key, val) if (!val) { val = ""; @@ -240,7 +240,7 @@ php_apache_sapi_register_variables(zval *track_vars_array) php_register_variable_safe(key, val, new_val_len, track_vars_array); } APR_ARRAY_FOREACH_CLOSE() - + php_register_variable("PHP_SELF", ctx->r->uri, track_vars_array); if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &ctx->r->uri, strlen(ctx->r->uri), &new_val_len)) { php_register_variable_safe("PHP_SELF", ctx->r->uri, new_val_len, track_vars_array); @@ -274,7 +274,7 @@ php_apache_sapi_flush(void *server_context) * handler seems to act on the first flush bucket, but ignores * all further flush buckets. */ - + ba = ctx->r->connection->bucket_alloc; bb = apr_brigade_create(ctx->r->pool, ba); b = apr_bucket_flush_create(ba); @@ -289,7 +289,7 @@ static void php_apache_sapi_log_message(char *msg) php_struct *ctx; ctx = SG(server_context); - + if (ctx == NULL) { /* we haven't initialized our ctx yet, oh well */ ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, 0, NULL, "%s", msg); } @@ -301,12 +301,12 @@ static void php_apache_sapi_log_message(char *msg) static int php_apache_disable_caching(ap_filter_t *f) { - /* Identify PHP scripts as non-cacheable, thus preventing + /* Identify PHP scripts as non-cacheable, thus preventing * Apache from sending a 304 status when the browser sends * If-Modified-Since header. */ f->r->no_local_copy = 1; - + return OK; } @@ -358,7 +358,7 @@ static sapi_module_struct apache2_sapi_module = { STANDARD_SAPI_MODULE_PROPERTIES }; -static int php_input_filter(ap_filter_t *f, apr_bucket_brigade *bb, +static int php_input_filter(ap_filter_t *f, apr_bucket_brigade *bb, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes) { php_struct *ctx; @@ -401,7 +401,7 @@ static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx) SG(sapi_headers).http_response_code = !f->r->status ? HTTP_OK : f->r->status; SG(request_info).content_type = apr_table_get(f->r->headers_in, "Content-Type"); #undef safe_strdup -#define safe_strdup(x) ((x)?strdup((x)):NULL) +#define safe_strdup(x) ((x)?strdup((x)):NULL) SG(request_info).query_string = safe_strdup(f->r->args); SG(request_info).request_method = f->r->method; SG(request_info).proto_num = f->r->proto_num; @@ -415,7 +415,7 @@ static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx) content_length = (char *) apr_table_get(f->r->headers_in, "Content-Length"); SG(request_info).content_length = (content_length ? atol(content_length) : 0); - + apr_table_unset(f->r->headers_out, "Content-Length"); apr_table_unset(f->r->headers_out, "Last-Modified"); apr_table_unset(f->r->headers_out, "Expires"); @@ -436,7 +436,7 @@ static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx) static void php_apache_request_dtor(ap_filter_t *f) { php_apr_bucket_brigade *pbb = (php_apr_bucket_brigade *)f->ctx; - + php_request_shutdown(NULL); if (SG(request_info).query_string) { @@ -448,7 +448,7 @@ static void php_apache_request_dtor(ap_filter_t *f) if (SG(request_info).path_translated) { free(SG(request_info).path_translated); } - + apr_brigade_destroy(pbb->bb); } @@ -460,22 +460,22 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) zend_file_handle zfd; php_apr_bucket_brigade *pbb; apr_bucket *b; - + if (f->r->proxyreq) { zend_try { zend_ini_deactivate(); } zend_end_try(); return ap_pass_brigade(f->next, bb); } - + /* handle situations where user turns the engine off */ if (*p == '0') { zend_try { zend_ini_deactivate(); } zend_end_try(); return ap_pass_brigade(f->next, bb); - } - + } + if(f->ctx) { pbb = (php_apr_bucket_brigade *)f->ctx; } else { @@ -486,17 +486,17 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) if(ap_save_brigade(NULL, &pbb->bb, &bb, f->r->pool) != APR_SUCCESS) { /* Bad */ } - + apr_brigade_cleanup(bb); - + /* Check to see if the last bucket in this brigade, it not * we have to wait until then. */ if(!APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(pbb->bb))) { return 0; - } - + } + /* Setup the CGI variables if this is the main request.. */ - if (f->r->main == NULL || + if (f->r->main == NULL || /* .. or if the sub-request envinronment differs from the main-request. */ f->r->subprocess_env != f->r->main->subprocess_env ) { @@ -504,7 +504,7 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) ap_add_common_vars(f->r); ap_add_cgi_vars(f->r); } - + ctx = SG(server_context); if (ctx == NULL) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, f->r, @@ -514,7 +514,7 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) } zend_end_try(); return HTTP_INTERNAL_SERVER_ERROR; } - + ctx->f = f->next; /* save whatever filters are after us in the chain. */ if (ctx->request_processed) { @@ -526,36 +526,36 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) apply_config(conf); php_apache_request_ctor(f, ctx); - + /* It'd be nice if we could highlight based of a zend_file_handle here.... * ...but we can't. */ - + zfd.type = ZEND_HANDLE_STREAM; - + zfd.handle.stream.handle = pbb; zfd.handle.stream.reader = php_apache_read_stream; zfd.handle.stream.closer = NULL; zfd.handle.stream.fsizer = php_apache_fsizer_stream; zfd.handle.stream.isatty = 0; - + zfd.filename = f->r->filename; zfd.opened_path = NULL; zfd.free_filename = 0; - + php_execute_script(&zfd); apr_table_set(ctx->r->notes, "mod_php_memory_usage", apr_psprintf(ctx->r->pool, "%lu", (unsigned long) zend_memory_peak_usage(1))); - + php_apache_request_dtor(f); - + if (!f->r->main) { ctx->request_processed = 1; } - + b = apr_bucket_eos_create(f->c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(pbb->bb, b); - + /* Pass whatever is left on the brigade. */ return ap_pass_brigade(f->next, pbb->bb); } @@ -659,10 +659,10 @@ static void php_insert_filter(request_rec *r) int content_type_len = strlen("application/x-httpd-php"); if (r->content_type && !strncmp(r->content_type, "application/x-httpd-php", content_type_len-1)) { - if (r->content_type[content_type_len] == '\0' || !strncmp(r->content_type+content_type_len, "-source", sizeof("-source"))) { + if (r->content_type[content_type_len] == '\0' || !strncmp(r->content_type+content_type_len, "-source", sizeof("-source"))) { php_add_filter(r, r->output_filters); php_add_filter(r, r->input_filters); - } + } } } @@ -710,17 +710,17 @@ static size_t php_apache_read_stream(void *handle, char *buf, size_t wantlen) apr_bucket_brigade *rbb; apr_size_t readlen; apr_bucket *b = NULL; - + rbb = pbb->bb; - + if((apr_brigade_partition(pbb->bb, wantlen, &b) == APR_SUCCESS) && b){ pbb->bb = apr_brigade_split(rbb, b); - } + } readlen = wantlen; apr_brigade_flatten(rbb, buf, &readlen); apr_brigade_cleanup(rbb); - + return readlen; } |
