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 | |
parent | 773c8b0c092a0e9ad5c5548815bcb9991d54d5c1 (diff) | |
download | php-git-b7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc.tar.gz |
trailing whitespace removal
Diffstat (limited to 'sapi')
72 files changed, 972 insertions, 972 deletions
diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c index 9df215ecd6..bc583e78ad 100644 --- a/sapi/aolserver/aolserver.c +++ b/sapi/aolserver/aolserver.c @@ -101,12 +101,12 @@ php_ns_sapi_ub_write(const char *str, uint str_length) sent += n; str_length -= n; } - + return sent; } /* - * php_ns_sapi_header_handler() sets a HTTP reply header to be + * php_ns_sapi_header_handler() sets a HTTP reply header to be * sent to the client. */ @@ -135,7 +135,7 @@ php_ns_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct } sapi_free_header(sapi_header); - + return 0; } @@ -150,9 +150,9 @@ php_ns_sapi_send_headers(sapi_headers_struct *sapi_headers) if(SG(sapi_headers).send_default_content_type) { Ns_ConnSetRequiredHeaders(NSG(conn), "text/html", 0); } - + Ns_ConnFlushHeaders(NSG(conn), SG(sapi_headers).http_response_code); - + return SAPI_HEADER_SENT_SUCCESSFULLY; } @@ -168,9 +168,9 @@ php_ns_sapi_read_post(char *buf, uint count_bytes) uint total_read = 0; max_read = MIN(NSG(data_avail), count_bytes); - + total_read = Ns_ConnRead(NSG(conn), buf, max_read); - + if(total_read == NS_ERROR) { total_read = -1; } else { @@ -180,16 +180,16 @@ php_ns_sapi_read_post(char *buf, uint count_bytes) return total_read; } -/* +/* * php_ns_sapi_read_cookies() returns the Cookie header from * the HTTP request header */ - + static char *php_ns_sapi_read_cookies(void) { int i; char *http_cookie = NULL; - + i = Ns_SetIFind(NSG(conn->headers), "cookie"); if(i != -1) { http_cookie = Ns_SetValue(NSG(conn->headers), i); @@ -203,7 +203,7 @@ static void php_info_aolserver(ZEND_MODULE_INFO_FUNC_ARGS) char buf[512]; int uptime = Ns_InfoUptime(); int i; - + php_info_print_table_start(); php_info_print_table_row(2, "SAPI module version", "$Id$"); php_info_print_table_row(2, "Build date", Ns_InfoBuildDate()); @@ -215,7 +215,7 @@ static void php_info_aolserver(ZEND_MODULE_INFO_FUNC_ARGS) php_info_print_table_row(2, "Server platform", Ns_InfoPlatform()); snprintf(buf, 511, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion()); php_info_print_table_row(2, "Server version", buf); - snprintf(buf, 511, "%d day(s), %02d:%02d:%02d", + snprintf(buf, 511, "%d day(s), %02d:%02d:%02d", uptime / 86400, (uptime / 3600) % 24, (uptime / 60) % 60, @@ -268,11 +268,11 @@ PHP_FUNCTION(getallheaders) int i; array_init(return_value); - + for (i = 0; i < Ns_SetSize(NSG(conn->headers)); i++) { char *key = Ns_SetKey(NSG(conn->headers), i); char *value = Ns_SetValue(NSG(conn->headers), i); - + add_assoc_string(return_value, key, value); } } @@ -314,7 +314,7 @@ php_ns_sapi_register_variables(zval *track_vars_array) char c; snprintf(buf, NS_BUF_SIZE, "HTTP_%s", key); - + for(p = buf + 5; (c = *p); p++) { c = toupper(c); if(c < 'A' || c > 'Z') { @@ -325,7 +325,7 @@ php_ns_sapi_register_variables(zval *track_vars_array) ADD_STRINGX(buf, value); } - + snprintf(buf, NS_BUF_SIZE, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion()); ADD_STRING("SERVER_SOFTWARE"); snprintf(buf, NS_BUF_SIZE, "HTTP/%1.1f", NSG(conn)->request->version); @@ -335,7 +335,7 @@ php_ns_sapi_register_variables(zval *track_vars_array) if(NSG(conn)->request->query) ADD_STRINGX("QUERY_STRING", NSG(conn)->request->query); - + ADD_STRINGX("SERVER_BUILDDATE", Ns_InfoBuildDate()); ADD_STRINGX("REMOTE_ADDR", Ns_ConnPeer(NSG(conn))); @@ -410,12 +410,12 @@ php_ns_module_main(void) file_handle.filename = SG(request_info).path_translated; file_handle.free_filename = 0; file_handle.opened_path = NULL; - + php_ns_config(global_context, 0); if (php_request_startup() == FAILURE) { return NS_ERROR; } - + php_execute_script(&file_handle); php_request_shutdown(NULL); @@ -427,7 +427,7 @@ php_ns_module_main(void) * and fills it with data provided by the web server */ -static void +static void php_ns_request_ctor(void) { char *server; @@ -435,15 +435,15 @@ php_ns_request_ctor(void) char *root; int index; char *tmp; - + server = Ns_ConnServer(NSG(conn)); - + #define safe_strdup(x) ((x)?strdup((x)):NULL) SG(request_info).query_string = safe_strdup(NSG(conn->request->query)); Ns_DStringInit(&ds); Ns_UrlToFile(&ds, server, NSG(conn->request->url)); - + /* path_translated is the absolute path to the file */ SG(request_info).path_translated = safe_strdup(Ns_DStringValue(&ds)); Ns_DStringFree(&ds); @@ -454,7 +454,7 @@ php_ns_request_ctor(void) else SG(request_info).proto_num = 1000; SG(request_info).content_length = Ns_ConnContentLength(NSG(conn)); index = Ns_SetIFind(NSG(conn)->headers, "content-type"); - SG(request_info).content_type = index == -1 ? NULL : + SG(request_info).content_type = index == -1 ? NULL : Ns_SetValue(NSG(conn)->headers, index); SG(sapi_headers).http_response_code = 200; @@ -473,7 +473,7 @@ php_ns_request_ctor(void) /* * php_ns_request_dtor() destroys all data associated with - * the per-request structure + * the per-request structure */ static void @@ -494,15 +494,15 @@ static int php_ns_request_handler(void *context, Ns_Conn *conn) { int status = NS_OK; - + NSG(conn) = conn; - + SG(server_context) = global_context; php_ns_request_ctor(); - + status = php_ns_module_main(); - + php_ns_request_dtor(); return status; @@ -514,7 +514,7 @@ php_ns_request_handler(void *context, Ns_Conn *conn) * It understands the "map" and "php_value" command. */ -static void +static void php_ns_config(php_ns_context *ctx, char global) { int i; @@ -534,10 +534,10 @@ php_ns_config(php_ns_context *ctx, char global) Ns_RegisterRequest(ctx->ns_server, "POST", value, php_ns_request_handler, NULL, ctx, 0); Ns_RegisterRequest(ctx->ns_server, "HEAD", value, php_ns_request_handler, NULL, ctx, 0); - /* - * Deactivated for now. The ini system will cause random crashes when - * accessed from here (since there are no locks to protect the global - * known_directives) + /* + * Deactivated for now. The ini system will cause random crashes when + * accessed from here (since there are no locks to protect the global + * known_directives) */ } else if (!global && !strcasecmp(key, "php_value")) { @@ -548,25 +548,25 @@ php_ns_config(php_ns_context *ctx, char global) val = strchr(value, ' '); if (val) { char *new_key; - + new_key = estrndup(value, val - value); - - do { - val++; + + do { + val++; } while(*val == ' '); Ns_Log(Debug, "PHP configuration option '%s=%s'", new_key, val); - zend_alter_ini_entry(new_key, strlen(new_key) + 1, val, + zend_alter_ini_entry(new_key, strlen(new_key) + 1, val, strlen(val) + 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); - + efree(new_key); } #endif } - + } } - + /* * php_ns_server_shutdown() performs the last steps before the * server exits. Shutdowns basic services and frees memory @@ -576,7 +576,7 @@ static void php_ns_server_shutdown(void *context) { php_ns_context *ctx = (php_ns_context *) context; - + ctx->sapi_module->shutdown(ctx->sapi_module); sapi_shutdown(); tsrm_shutdown(); @@ -596,20 +596,20 @@ php_ns_server_shutdown(void *context) int Ns_ModuleInit(char *server, char *module) { php_ns_context *ctx; - + tsrm_startup(1, 1, 0, NULL); sapi_startup(&aolserver_sapi_module); sapi_module.startup(&aolserver_sapi_module); - + /* TSRM is used to allocate a per-thread structure */ ts_allocate_id(&ns_globals_id, sizeof(ns_globals_struct), NULL, NULL); - + /* the context contains data valid for all threads */ ctx = malloc(sizeof *ctx); ctx->sapi_module = &aolserver_sapi_module; ctx->ns_server = strdup(server); ctx->ns_module = strdup(module); - + /* read the configuration */ php_ns_config(ctx, 1); diff --git a/sapi/apache/libpre.c b/sapi/apache/libpre.c index f7ab68b62c..f9cc31490c 100644 --- a/sapi/apache/libpre.c +++ b/sapi/apache/libpre.c @@ -25,7 +25,7 @@ * stops. By using these functions instead of defining a main() * and calling ExitThread(TSR_THREAD, 0), the load time of the * shared NLM is faster and memory size reduced. - * + * * You may also want to override these in your own Apache module * to do any cleanup other than the mechanism Apache modules provide. * ------------------------------------------------------------------ diff --git a/sapi/apache/mod_php7.c b/sapi/apache/mod_php7.c index afd1d18472..9d0d78f4b6 100644 --- a/sapi/apache/mod_php7.c +++ b/sapi/apache/mod_php7.c @@ -95,7 +95,7 @@ static void php_save_umask(void) static int sapi_apache_ub_write(const char *str, uint str_length) { int ret=0; - + if (SG(server_context)) { ret = rwrite(str, str_length, (request_rec *) SG(server_context)); } @@ -137,7 +137,7 @@ static int sapi_apache_read_post(char *buffer, uint count_bytes) if (!SG(read_post_bytes) && !ap_should_client_block(r)) { return total_read_bytes; } - + handler = signal(SIGPIPE, SIG_IGN); while (total_read_bytes<count_bytes) { hard_timeout("Read POST information", r); /* start timeout timer */ @@ -148,7 +148,7 @@ static int sapi_apache_read_post(char *buffer, uint count_bytes) } total_read_bytes += read_bytes; } - signal(SIGPIPE, handler); + signal(SIGPIPE, handler); return total_read_bytes; } /* }}} */ @@ -331,10 +331,10 @@ static void php_apache_request_shutdown(void *dummy) AP(in_request) = 0; php_request_shutdown(dummy); } - SG(server_context) = NULL; - /* - * The server context (request) is NOT invalid by the time - * run_cleanups() is called + SG(server_context) = NULL; + /* + * The server context (request) is NOT invalid by the time + * run_cleanups() is called */ } /* }}} */ @@ -343,7 +343,7 @@ static void php_apache_request_shutdown(void *dummy) */ static int php_apache_sapi_activate(void) { - request_rec *r = (request_rec *) SG(server_context); + request_rec *r = (request_rec *) SG(server_context); /* * For the Apache module version, this bit of code registers a cleanup @@ -351,7 +351,7 @@ static int php_apache_sapi_activate(void) * We need this because at any point in our code we can be interrupted * and that may happen before we have had time to free our memory. * The php_request_shutdown function needs to free all outstanding allocated - * memory. + * memory. */ block_alarms(); register_cleanup(r->pool, NULL, php_apache_request_shutdown, php_request_shutdown_for_exec); @@ -395,7 +395,7 @@ static int sapi_apache_get_fd(int *nfd) int fd; fd = r->connection->client->fd; - + if (fd >= 0) { if (nfd) *nfd = fd; return SUCCESS; @@ -410,9 +410,9 @@ static int sapi_apache_get_fd(int *nfd) static int sapi_apache_force_http_10(void) { request_rec *r = SG(server_context); - + r->proto_num = HTTP_VERSION(1,0); - + return SUCCESS; } /* }}} */ @@ -458,7 +458,7 @@ static void sapi_apache_child_terminate(void) static sapi_module_struct apache_sapi_module = { "apache", /* name */ "Apache", /* pretty name */ - + php_apache_startup, /* startup */ php_module_shutdown_wrapper, /* shutdown */ @@ -576,7 +576,7 @@ static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry) */ static char *php_apache_get_default_mimetype(request_rec *r) { - + char *mimetype; if (SG(default_mimetype) || SG(default_charset)) { /* Assume output will be of the default MIME type. Individual @@ -624,7 +624,7 @@ static int send_php(request_rec *r, int display_source_mode, char *filename) if (per_dir_conf) { zend_hash_apply((HashTable *) per_dir_conf, (apply_func_t) php_apache_alter_ini_entries); } - + /* If PHP parser engine has been turned off with an "engine off" * directive, then decline to handle this request */ @@ -691,7 +691,7 @@ static int send_php(request_rec *r, int display_source_mode, char *filename) static int send_parsed_php(request_rec * r) { int result = send_php(r, 0, NULL); - + ap_table_setn(r->notes, "mod_php_memory_usage", ap_psprintf(r->pool, "%lu", zend_memory_peak_usage(1))); @@ -863,7 +863,7 @@ static CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable * bool_val[0] = '0'; } bool_val[1] = 0; - + return php_apache_value_handler_ex(cmd, conf, arg1, bool_val, mode); } /* }}} */ @@ -928,7 +928,7 @@ static void apache_php_module_shutdown_wrapper(void) #if MODULE_MAGIC_NUMBER >= 19970728 /* This function is only called on server exit if the apache API - * child_exit handler exists, so shutdown globally + * child_exit handler exists, so shutdown globally */ sapi_shutdown(); #endif diff --git a/sapi/apache/sapi_apache.c b/sapi/apache/sapi_apache.c index f0c54c59ad..813f2dcdbd 100644 --- a/sapi/apache/sapi_apache.c +++ b/sapi/apache/sapi_apache.c @@ -27,7 +27,7 @@ */ int apache_php_module_main(request_rec *r, int display_source_mode) { - int retval = OK; + int retval = OK; zend_file_handle file_handle; if (php_request_startup() == FAILURE) { @@ -35,7 +35,7 @@ int apache_php_module_main(request_rec *r, int display_source_mode) } /* sending a file handle to another dll is not working so let zend open it. */ - + if (display_source_mode) { zend_syntax_highlighter_ini syntax_highlighter_ini; @@ -54,11 +54,11 @@ int apache_php_module_main(request_rec *r, int display_source_mode) } AP(in_request) = 0; - + zend_try { php_request_shutdown(NULL); } zend_end_try(); - + return retval; } /* }}} */ 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; } diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c index 92a683b22c..e1644d647d 100644 --- a/sapi/apache2handler/apache_config.c +++ b/sapi/apache2handler/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; @@ -157,7 +157,7 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf) //??? zend_hash_merge_ex(&n->config, &e->config, NULL, sizeof(php_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL); #if STAS_0 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; @@ -176,7 +176,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_str_find_ptr(&d->config, name, name_len)) != NULL) { return pe->value; } @@ -189,7 +189,7 @@ void apply_config(void *dummy) php_conf_rec *d = dummy; zend_string *str; php_dir_entry *data; - + ZEND_HASH_FOREACH_STR_KEY_PTR(&d->config, str, data) { phpapdebug((stderr, "APPLYING (%s)(%s)\n", str, data->value)); if (zend_alter_ini_entry_chars(str, data->value, data->value_len, data->status, data->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE) == FAILURE) { @@ -212,7 +212,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/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index 2eb6a64c00..fd4edb2bb8 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -59,7 +59,7 @@ php_apache2_info_struct php_apache2_info; static request_rec *php_apache_lookup_uri(char *filename) { php_struct *ctx = SG(server_context); - + if (!filename || !ctx || !ctx->r) { return NULL; } @@ -129,7 +129,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); @@ -162,7 +162,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; @@ -181,7 +181,7 @@ PHP_FUNCTION(apache_request_headers) } array_init(return_value); - + ctx = SG(server_context); arr = apr_table_elts(ctx->r->headers_in); @@ -205,7 +205,7 @@ PHP_FUNCTION(apache_response_headers) } array_init(return_value); - + ctx = SG(server_context); arr = apr_table_elts(ctx->r->headers_out); @@ -349,9 +349,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, '.'))) { @@ -378,7 +378,7 @@ PHP_MINFO_FUNCTION(apache) AP_DECLARE_DATA extern unixd_config_rec unixd_config; #endif #endif - + for (n = 0; ap_loaded_modules[n]; ++n) { char *s = (char *) ap_loaded_modules[n]->name; if ((p = strchr(s, '.'))) { @@ -395,21 +395,21 @@ PHP_MINFO_FUNCTION(apache) tmp1.s->val[0] = '\0'; } } - + php_info_print_table_start(); if (apv && *apv) { php_info_print_table_row(2, "Apache Version", apv); } snprintf(tmp, sizeof(tmp), "%d", MODULE_MAGIC_NUMBER); php_info_print_table_row(2, "Apache API Version", tmp); - + if (serv->server_admin && *(serv->server_admin)) { php_info_print_table_row(2, "Server Administrator", serv->server_admin); } - + snprintf(tmp, sizeof(tmp), "%s:%u", serv->server_hostname, serv->port); php_info_print_table_row(2, "Hostname:Port", tmp); - + #if !defined(WIN32) && !defined(WINNT) && !defined(NETWARE) #if MODULE_MAGIC_NUMBER_MAJOR >= 20081201 snprintf(tmp, sizeof(tmp), "%s(%d)/%d", ap_unixd_config.user_name, ap_unixd_config.user_id, ap_unixd_config.group_id); @@ -424,25 +424,25 @@ PHP_MINFO_FUNCTION(apache) php_info_print_table_row(2, "Max Requests", tmp); apr_snprintf(tmp, sizeof tmp, - "Connection: %" APR_TIME_T_FMT " - Keep-Alive: %" APR_TIME_T_FMT, + "Connection: %" APR_TIME_T_FMT " - Keep-Alive: %" APR_TIME_T_FMT, apr_time_sec(serv->timeout), apr_time_sec(serv->keep_alive_timeout)); php_info_print_table_row(2, "Timeouts", tmp); - + php_info_print_table_row(2, "Virtual Server", (serv->is_virtual ? "Yes" : "No")); php_info_print_table_row(2, "Server Root", ap_server_root); php_info_print_table_row(2, "Loaded Modules", tmp1.s->val); smart_str_free(&tmp1); php_info_print_table_end(); - + DISPLAY_INI_ENTRIES(); { const apr_array_header_t *arr = apr_table_elts(((php_struct *) SG(server_context))->r->subprocess_env); char *key, *val; - + SECTION("Apache Environment"); - php_info_print_table_start(); + php_info_print_table_start(); php_info_print_table_header(2, "Variable", "Value"); APR_ARRAY_FOREACH_OPEN(arr, key, val) if (!val) { @@ -450,14 +450,14 @@ PHP_MINFO_FUNCTION(apache) } php_info_print_table_row(2, key, val); APR_ARRAY_FOREACH_CLOSE() - - php_info_print_table_end(); - + + php_info_print_table_end(); + SECTION("HTTP Headers Information"); php_info_print_table_start(); php_info_print_table_colspan_header(2, "HTTP Request Headers"); php_info_print_table_row(2, "HTTP Request", ((php_struct *) SG(server_context))->r->the_request); - + arr = apr_table_elts(((php_struct *) SG(server_context))->r->headers_in); APR_ARRAY_FOREACH_OPEN(arr, key, val) if (!val) { @@ -474,7 +474,7 @@ PHP_MINFO_FUNCTION(apache) } php_info_print_table_row(2, key, val); APR_ARRAY_FOREACH_CLOSE() - + php_info_print_table_end(); } } @@ -519,7 +519,7 @@ ZEND_END_ARG_INFO() static const zend_function_entry apache_functions[] = { PHP_FE(apache_lookup_uri, arginfo_apache2handler_lookup_uri) - PHP_FE(virtual, arginfo_apache2handler_virtual) + PHP_FE(virtual, arginfo_apache2handler_virtual) PHP_FE(apache_request_headers, arginfo_apache2handler_getallheaders) PHP_FE(apache_response_headers, arginfo_apache2handler_response_headers) PHP_FE(apache_setenv, arginfo_apache2handler_setenv) @@ -559,7 +559,7 @@ zend_module_entry php_apache_module = { PHP_MINIT(apache), PHP_MSHUTDOWN(apache), NULL, - NULL, + NULL, PHP_MINFO(apache), NULL, STANDARD_MODULE_PROPERTIES diff --git a/sapi/apache_hooks/mod_php7.c b/sapi/apache_hooks/mod_php7.c index cd1e733f32..df83e80891 100644 --- a/sapi/apache_hooks/mod_php7.c +++ b/sapi/apache_hooks/mod_php7.c @@ -108,7 +108,7 @@ typedef struct _php_per_dir_entry { */ /* This code is ripped part and parcel from zend_stack.[ch]. Assuming that the - patch supporting zend_stack_init_ex is applied, all but the bottom two + patch supporting zend_stack_init_ex is applied, all but the bottom two module-specific iterators will be removed */ @@ -152,18 +152,18 @@ int sapi_stack_destroy(sapi_stack *stack) int sapi_stack_apply_with_argument_all(sapi_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg) { - int i, retval; + int i, retval; - switch (type) { + switch (type) { case ZEND_STACK_APPLY_TOPDOWN: for (i=stack->top-1; i>=0; i--) { - retval = apply_function(stack->elements[i], arg); + retval = apply_function(stack->elements[i], arg); } break; case ZEND_STACK_APPLY_BOTTOMUP: - for (i=0; i<stack->top; i++) { + for (i=0; i<stack->top; i++) { retval = apply_function(stack->elements[i], arg); - } + } break; } return retval; @@ -224,7 +224,7 @@ void php_handler_stack_destroy(sapi_stack *stack) free(ph); } } -/* }}} */ +/* }}} */ /* {{{ php_save_umask */ @@ -240,7 +240,7 @@ static void php_save_umask(void) static int sapi_apache_ub_write(const char *str, uint str_length) { int ret=0; - + if (SG(server_context)) { ret = rwrite(str, str_length, (request_rec *) SG(server_context)); } @@ -282,7 +282,7 @@ static int sapi_apache_read_post(char *buffer, uint count_bytes) if (!SG(read_post_bytes) && !ap_should_client_block(r)) { return total_read_bytes; } - + handler = signal(SIGPIPE, SIG_IGN); while (total_read_bytes<count_bytes) { hard_timeout("Read POST information", r); /* start timeout timer */ @@ -293,7 +293,7 @@ static int sapi_apache_read_post(char *buffer, uint count_bytes) } total_read_bytes += read_bytes; } - signal(SIGPIPE, handler); + signal(SIGPIPE, handler); return total_read_bytes; } /* }}} */ @@ -369,7 +369,7 @@ static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers) ((request_rec *) SG(server_context))->status = SG(sapi_headers).http_response_code; /* check that we haven't sent headers already, we use our own - * headers_sent since we may send headers at anytime + * headers_sent since we may send headers at anytime */ if(!AP(headers_sent)) { send_http_header((request_rec *) SG(server_context)); @@ -469,7 +469,7 @@ static void php_apache_request_shutdown(void *dummy) */ static int php_apache_sapi_activate(void) { - request_rec *r = (request_rec *) SG(server_context); + request_rec *r = (request_rec *) SG(server_context); /* * For the Apache module version, this bit of code registers a cleanup @@ -477,7 +477,7 @@ static int php_apache_sapi_activate(void) * We need this because at any point in our code we can be interrupted * and that may happen before we have had time to free our memory. * The php_request_shutdown function needs to free all outstanding allocated - * memory. + * memory. */ block_alarms(); register_cleanup(r->pool, NULL, php_apache_request_shutdown, php_request_shutdown_for_exec); @@ -513,7 +513,7 @@ static char *php_apache_getenv(char *name, size_t name_len) static sapi_module_struct apache_sapi_module = { "apache", /* name */ "Apache", /* pretty name */ - + php_apache_startup, /* startup */ php_module_shutdown_wrapper, /* shutdown */ @@ -554,7 +554,7 @@ static sapi_module_struct apache_sapi_module = { NULL, /* exe location */ 0, /* ini ignore */ NULL - + }; /* }}} */ @@ -624,7 +624,7 @@ static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry) */ static char *php_apache_get_default_mimetype(request_rec *r) { - + char *mimetype; if (SG(default_mimetype) || SG(default_charset)) { /* Assume output will be of the default MIME type. Individual @@ -717,7 +717,7 @@ static int send_php(request_rec *r, int display_source_mode, char *filename) hard_timeout("send", r); SG(server_context) = r; - + php_save_umask(); if(!AP(setup_env)) { AP(setup_env) = 1; @@ -726,7 +726,7 @@ static int send_php(request_rec *r, int display_source_mode, char *filename) } init_request_info(); apache_php_module_main(r, display_source_mode); - + /* Done, restore umask, turn off timeout, close file and return */ php_restore_umask(); kill_timeout(r); @@ -741,7 +741,7 @@ static int send_php(request_rec *r, int display_source_mode, char *filename) static int send_parsed_php(request_rec * r) { int result = send_php(r, 0, NULL); - + ap_table_setn(r->notes, "mod_php_memory_usage", ap_psprintf(r->pool, "%u", zend_memory_peak_usage(1))); @@ -813,7 +813,7 @@ static void php_destroy_per_server_info(php_per_server_config *conf) /* {{{ php_destroy_per_dir_info */ -static void php_destroy_per_dir_info(php_per_dir_config *conf) +static void php_destroy_per_dir_info(php_per_dir_config *conf) { zend_hash_destroy(conf->ini_settings); php_handler_stack_destroy(&conf->response_handlers); @@ -835,12 +835,12 @@ static void *php_create_server(pool *p, char *dummy) php_per_server_config *conf; conf = (php_per_server_config *) malloc(sizeof(php_per_server_config)); register_cleanup(p, (void *) conf, (void (*)(void *)) php_destroy_per_server_info, (void (*)(void *)) php_destroy_per_server_info); - + sapi_stack_init_ex(&conf->requires, 1); sapi_stack_init_ex(&conf->uri_handlers, 1); return conf; } - + /* }}} */ @@ -861,7 +861,7 @@ static void *php_create_dir(pool *p, char *dummy) sapi_stack_init_ex(&conf->logger_handlers, 1); sapi_stack_init_ex(&conf->post_read_handlers, 1); register_cleanup(p, (void *) conf, (void (*)(void *)) php_destroy_per_dir_info, (void (*)(void *)) php_destroy_per_dir_info); - + return conf; } @@ -983,7 +983,7 @@ static CONST_PREFIX char *php_set_dir_handler(php_per_dir_config *conf, char *ar return NULL; } -/* {{{ php_set_uri_handler +/* {{{ php_set_uri_handler */ static CONST_PREFIX char *php_set_uri_handler(cmd_parms *cmd, void *dummy, char *arg1) { @@ -1010,7 +1010,7 @@ static CONST_PREFIX char *php_set_header_handler_code(cmd_parms *cmd, php_per_di } /* }}} */ -/* {{{ php_set_auth_handler +/* {{{ php_set_auth_handler */ static CONST_PREFIX char *php_set_auth_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) { @@ -1072,7 +1072,7 @@ static CONST_PREFIX char *php_set_logger_handler_code(cmd_parms *cmd, php_per_di return php_set_dir_handler(conf, arg1, AP_LOGGING, AP_HANDLER_TYPE_METHOD); } -/* }}} */ +/* }}} */ /* {{{ php_set_post_read_handler */ @@ -1108,7 +1108,7 @@ static CONST_PREFIX char *php_set_response_handler_code(cmd_parms *cmd, php_per_ return php_set_dir_handler(conf, arg1, AP_RESPONSE, AP_HANDLER_TYPE_METHOD); } /* }}} */ - + /* {{{ php_apache_value_handler */ static CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2) @@ -1137,7 +1137,7 @@ static CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable * bool_val[0] = '0'; } bool_val[1] = 0; - + return php_apache_value_handler_ex(cmd, conf, arg1, bool_val, mode); } /* }}} */ @@ -1204,7 +1204,7 @@ static void apache_php_module_shutdown_wrapper(void) #if MODULE_MAGIC_NUMBER >= 19970728 /* This function is only called on server exit if the apache API - * child_exit handler exists, so shutdown globally + * child_exit handler exists, so shutdown globally */ sapi_shutdown(); #endif @@ -1285,15 +1285,15 @@ static int php_run_hook(php_handler *handler, request_rec *r) } return HTTP_INTERNAL_SERVER_ERROR; } - + static int php_uri_translation(request_rec *r) -{ +{ php_per_server_config *conf; AP(current_hook) = AP_URI_TRANS; conf = (php_per_server_config *) get_module_config(r->server->module_config, &php7_module); - return sapi_stack_apply_with_argument_stop_if_equals(&conf->uri_handlers, - ZEND_STACK_APPLY_BOTTOMUP, + return sapi_stack_apply_with_argument_stop_if_equals(&conf->uri_handlers, + ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r, OK); } @@ -1312,8 +1312,8 @@ static int php_auth_hook(request_rec *r) php_per_dir_config *conf; AP(current_hook) = AP_AUTHENTICATION; conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php7_module); - return sapi_stack_apply_with_argument_stop_if_equals(&conf->auth_handlers, - ZEND_STACK_APPLY_BOTTOMUP, + return sapi_stack_apply_with_argument_stop_if_equals(&conf->auth_handlers, + ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r, OK); } @@ -1362,7 +1362,7 @@ static int php_logger_hook(request_rec *r) (int (*)(void *element, void *)) php_run_hook, r); } - + static int php_post_read_hook(request_rec *r) { php_per_dir_config *conf; diff --git a/sapi/apache_hooks/php_apache_http.h b/sapi/apache_hooks/php_apache_http.h index f79bd91c50..5684de9179 100644 --- a/sapi/apache_hooks/php_apache_http.h +++ b/sapi/apache_hooks/php_apache_http.h @@ -28,11 +28,11 @@ #include "http_main.h" #include "http_protocol.h" #include "http_request.h" -#include "http_log.h" +#include "http_log.h" #include "util_script.h" #include "php_variables.h" -#include "php_main.h" +#include "php_main.h" #include "php_ini.h" #include "ext/standard/php_standard.h" diff --git a/sapi/apache_hooks/sapi_apache.c b/sapi/apache_hooks/sapi_apache.c index 78e7c8cbd3..c01b0d15d1 100644 --- a/sapi/apache_hooks/sapi_apache.c +++ b/sapi/apache_hooks/sapi_apache.c @@ -34,7 +34,7 @@ int apache_php_module_main(request_rec *r, int display_source_mode) } /* sending a file handle to another dll is not working so let zend open it. */ - + if (display_source_mode) { zend_syntax_highlighter_ini syntax_highlighter_ini; @@ -53,7 +53,7 @@ int apache_php_module_main(request_rec *r, int display_source_mode) (void) php_execute_script(&file_handle); } AP(in_request) = 0; - + return (OK); } /* }}} */ diff --git a/sapi/caudium/caudium.c b/sapi/caudium/caudium.c index 850e761955..e0417a3ee2 100644 --- a/sapi/caudium/caudium.c +++ b/sapi/caudium/caudium.c @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ @@ -25,12 +25,12 @@ #include "php_ini.h" #include "php_globals.h" #include "SAPI.h" -#include "php_main.h" +#include "php_main.h" #include "ext/standard/info.h" #include "php_version.h" -/* Pike Include Files +/* Pike Include Files * * conflicts with pike avoided by only using long names. Requires a new * Pike 0.7 since it was implemented for this interface only. @@ -114,7 +114,7 @@ static int caudium_globals_id; #define GET_THIS() php_caudium_request *_request = ts_resource(caudium_globals_id) #define THIS _request #define PTHIS ((php_caudium_request *)(Pike_fp->current_storage)) -/* File descriptor integer. Used to write directly to the FD without +/* File descriptor integer. Used to write directly to the FD without * passing Pike */ #define MY_FD (THIS->my_fd) @@ -161,7 +161,7 @@ static unsigned char caudium_php_initialized; /* Low level header lookup. Basically looks for the named header in the mapping * headers in the supplied options mapping. */ - + INLINE static struct svalue *lookup_header(char *headername) { struct svalue *headers, *value; @@ -204,7 +204,7 @@ INLINE static int lookup_integer_header(char *headername, int default_value) /* * php_caudium_low_ub_write() writes data to the client connection. Might be - * rewritten to do more direct IO to save CPU and the need to lock the + * rewritten to do more direct IO to save CPU and the need to lock the * interpreter for better threading. */ @@ -235,7 +235,7 @@ php_caudium_low_ub_write(const char *str, uint str_length) { /* * php_caudium_sapi_ub_write() calls php_caudium_low_ub_write in a Pike thread * safe manner or writes directly to the output FD if RXML post-parsing is - * disabled. + * disabled. */ static int @@ -259,7 +259,7 @@ php_caudium_sapi_ub_write(const char *str, uint str_length) zend_bailout(); THIS->written += sent_bytes; return sent_bytes; - case EINTR: + case EINTR: case EWOULDBLOCK: continue; } @@ -295,7 +295,7 @@ php_caudium_set_header(char *header_name, char *value, char *p) s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind); if(!s_headermap || s_headermap->type != PIKE_T_MAPPING) { - struct svalue mappie; + struct svalue mappie; mappie.type = PIKE_T_MAPPING; headermap = allocate_mapping(1); mappie.u.mapping = headermap; @@ -306,7 +306,7 @@ php_caudium_set_header(char *header_name, char *value, char *p) headermap = s_headermap->u.mapping; soldval = low_mapping_string_lookup(headermap, hind); vallen = strlen(value); - if(soldval != NULL && + if(soldval != NULL && soldval->type == PIKE_T_STRING && soldval->u.string->size_shift == 0) { /* Existing, valid header. Prepend.*/ @@ -315,7 +315,7 @@ php_caudium_set_header(char *header_name, char *value, char *p) STR0(hval)[soldval->u.string->len] = '\0'; MEMCPY(hval->str+soldval->u.string->len+1, value, vallen); hval = end_shared_string(hval); - } else { + } else { hval = make_shared_string(value); } } @@ -330,7 +330,7 @@ php_caudium_set_header(char *header_name, char *value, char *p) } /* - * php_caudium_sapi_header_handler() sets a HTTP reply header to be + * php_caudium_sapi_header_handler() sets a HTTP reply header to be * sent to the client. */ static int @@ -340,7 +340,7 @@ php_caudium_sapi_header_handler(sapi_header_struct *sapi_header, char *header_name, *header_content, *p; header_name = sapi_header->header; header_content = p = strchr(header_name, ':'); - + if(p) { do { header_content++; @@ -367,10 +367,10 @@ php_caudium_low_send_headers(sapi_headers_struct *sapi_headers) zend_bailout(); return SAPI_HEADER_SEND_FAILED; } - ind = make_shared_string(" _headers"); + ind = make_shared_string(" _headers"); s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind); free_string(ind); - + push_int(SG(sapi_headers).http_response_code); if(s_headermap && s_headermap->type == PIKE_T_MAPPING) ref_push_mapping(s_headermap->u.mapping); @@ -378,7 +378,7 @@ php_caudium_low_send_headers(sapi_headers_struct *sapi_headers) push_int(0); safe_apply(MY_FD_OBJ, "send_headers", 2); pop_stack(); - + return SAPI_HEADER_SENT_SUCCESSFULLY; } @@ -399,7 +399,7 @@ INLINE static int php_caudium_low_read_post(char *buf, uint count_bytes) { uint total_read = 0; GET_THIS(); - + if(!MY_FD_OBJ->prog) { PG(connection_status) = PHP_CONNECTION_ABORTED; @@ -426,11 +426,11 @@ php_caudium_sapi_read_post(char *buf, uint count_bytes) return total_read; } -/* +/* * php_caudium_sapi_read_cookies() returns the Cookie header from * the HTTP request header */ - + static char * php_caudium_sapi_read_cookies(void) { @@ -453,7 +453,7 @@ static void php_info_caudium(ZEND_MODULE_INFO_FUNC_ARGS) php_info_print_table_row(2, "Server platform", Ns_InfoPlatform()); snprintf(buf, 511, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion()); php_info_print_table_row(2, "Server version", buf); - snprintf(buf, 511, "%d day(s), %02d:%02d:%02d", + snprintf(buf, 511, "%d day(s), %02d:%02d:%02d", uptime / 86400, (uptime / 3600) % 24, (uptime / 60) % 60, @@ -477,7 +477,7 @@ static zend_module_entry php_caudium_module = { }; -INLINE static void low_sapi_caudium_register_variables(zval *track_vars_array) +INLINE static void low_sapi_caudium_register_variables(zval *track_vars_array) { int i; struct keypair *k; @@ -602,7 +602,7 @@ static void php_caudium_module_main(php_caudium_request *ureq) state->status=THREAD_RUNNING; #endif state->swapped = 0; -#endif +#endif SG(request_info).query_string = lookup_string_header("QUERY_STRING", 0); SG(server_context) = (void *)1; /* avoid server_context == NULL */ @@ -706,7 +706,7 @@ void f_php_caudium_request_handler(INT32 args) get_all_args("PHP5.Interpreter->run", args, "%S%m%O%*", &script, &request_data, &my_fd_obj, &done_callback); - if(done_callback->type != PIKE_T_FUNCTION) + if(done_callback->type != PIKE_T_FUNCTION) Pike_error("PHP5.Interpreter->run: Bad argument 4, expected function.\n"); add_ref(request_data); add_ref(my_fd_obj); diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 4d6f4c1920..f3e1318eea 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -431,7 +431,7 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers) while (h) { /* prevent CRLFCRLF */ if (h->header_len) { - if (h->header_len > sizeof("Status:")-1 && + if (h->header_len > sizeof("Status:")-1 && strncasecmp(h->header, "Status:", sizeof("Status:")-1) == 0 ) { if (!ignore_status) { @@ -590,7 +590,7 @@ static char *sapi_fcgi_read_cookies(void) static void cgi_php_load_env_var(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg) { - zval *array_ptr = (zval*)arg; + zval *array_ptr = (zval*)arg; int filter_arg = (Z_ARR_P(array_ptr) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV]))?PARSE_ENV:PARSE_SERVER; size_t new_val_len; @@ -763,12 +763,12 @@ static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const } /* we have to test if path is part of DOCUMENT_ROOT. - if it is inside the docroot, we scan the tree up to the docroot + if it is inside the docroot, we scan the tree up to the docroot to find more user.ini, if not we only scan the current path. */ #ifdef PHP_WIN32 if (strnicmp(s1, s2, s_len) == 0) { -#else +#else if (strncmp(s1, s2, s_len) == 0) { #endif ptr = s2 + start; /* start is the point where doc_root ends! */ @@ -864,7 +864,7 @@ static int sapi_cgi_activate(void) zend_str_tolower(doc_root, doc_root_len); #endif php_cgi_ini_activate_user_config(path, path_len, doc_root, doc_root_len, (doc_root_len > 0 && (doc_root_len - 1))); - + #ifdef PHP_WIN32 efree(doc_root); #endif @@ -1014,7 +1014,7 @@ static int is_valid_path(const char *path) p++; if (UNEXPECTED(!*p) || UNEXPECTED(IS_SLASH(*p))) { return 0; - } + } } } } @@ -1436,7 +1436,7 @@ PHP_INI_END() */ static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals) { -#ifdef ZTS +#ifdef ZTS ZEND_TSRMLS_CACHE_UPDATE; #endif php_cgi_globals->rfc2616_headers = 0; @@ -2507,7 +2507,7 @@ fastcgi_request_done: #ifdef HAVE_GETTIMEOFDAY gettimeofday(&start, NULL); #else - time(&start); + time(&start); #endif } continue; diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c index 1f5ee50d03..6446baa553 100644 --- a/sapi/cgi/fastcgi.c +++ b/sapi/cgi/fastcgi.c @@ -243,7 +243,7 @@ static inline char* fcgi_hash_strndup(fcgi_hash *h, char *str, unsigned int str_ p->next = h->data; h->data = p; } - ret = h->data->pos; + ret = h->data->pos; memcpy(ret, str, str_len); ret[str_len] = 0; h->data->pos += str_len + 1; diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index fb6a898430..749e291771 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -470,7 +470,7 @@ static sapi_module_struct cli_sapi_module = { sapi_cli_log_message, /* Log message */ NULL, /* Get request time */ NULL, /* Child terminate */ - + STANDARD_SAPI_MODULE_PROPERTIES }; /* }}} */ @@ -500,7 +500,7 @@ static void php_cli_usage(char *argv0) } else { prog = "php"; } - + printf( "Usage: %s [options] [-f] <file> [--] [args...]\n" " %s [options] -r <code> [--] [args...]\n" " %s [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]\n" @@ -559,7 +559,7 @@ static void cli_register_file_handles(void) /* {{{ */ php_stream *s_in, *s_out, *s_err; php_stream_context *sc_in=NULL, *sc_out=NULL, *sc_err=NULL; zend_constant ic, oc, ec; - + s_in = php_stream_open_wrapper_ex("php://stdin", "rb", 0, NULL, sc_in); s_out = php_stream_open_wrapper_ex("php://stdout", "wb", 0, NULL, sc_out); s_err = php_stream_open_wrapper_ex("php://stderr", "wb", 0, NULL, sc_err); @@ -570,7 +570,7 @@ static void cli_register_file_handles(void) /* {{{ */ if (s_err) php_stream_close(s_err); return; } - + #if PHP_DEBUG /* do not close stdout and stderr */ s_out->flags |= PHP_STREAM_FLAG_NO_CLOSE; @@ -582,7 +582,7 @@ static void cli_register_file_handles(void) /* {{{ */ php_stream_to_zval(s_in, &zin); php_stream_to_zval(s_out, &zout); php_stream_to_zval(s_err, &zerr); - + ZVAL_COPY_VALUE(&ic.value, &zin); ic.flags = CONST_CS; ic.name = zend_string_init("STDIN", sizeof("STDIN")-1, 1); @@ -664,7 +664,7 @@ static int do_cli(int argc, char **argv) /* {{{ */ zend_string *key; zend_try { - + CG(in_compilation) = 0; /* not initialized but needed for several options */ while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0, 2)) != -1) { @@ -798,7 +798,7 @@ static int do_cli(int argc, char **argv) /* {{{ */ behavior=PHP_MODE_CLI_DIRECT; exec_direct=php_optarg; break; - + case 'R': if (behavior == PHP_MODE_PROCESS_STDIN) { if (exec_run || script_file) { @@ -907,11 +907,11 @@ static int do_cli(int argc, char **argv) /* {{{ */ } /* only set script_file if not set already and not in direct mode and not at end of parameter list */ - if (argc > php_optind - && !script_file - && behavior!=PHP_MODE_CLI_DIRECT - && behavior!=PHP_MODE_PROCESS_STDIN - && strcmp(argv[php_optind-1],"--")) + if (argc > php_optind + && !script_file + && behavior!=PHP_MODE_CLI_DIRECT + && behavior!=PHP_MODE_PROCESS_STDIN + && strcmp(argv[php_optind-1],"--")) { script_file=argv[php_optind]; php_optind++; @@ -1023,7 +1023,7 @@ static int do_cli(int argc, char **argv) /* {{{ */ exit_status=254; } break; - + case PHP_MODE_PROCESS_STDIN: { char *input; @@ -1098,7 +1098,7 @@ static int do_cli(int argc, char **argv) /* {{{ */ pce = reflection_zend_extension_ptr; break; } - + ZVAL_STRING(&arg, reflection_what); object_init_ex(&ref, pce); @@ -1138,7 +1138,7 @@ static int do_cli(int argc, char **argv) /* {{{ */ } else { php_info_print_module(module); } - + efree(lcname); break; } @@ -1348,7 +1348,7 @@ exit_loop: goto out; } module_started = 1; - + /* -e option */ if (use_extended_info) { CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO; diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index e650a16edb..84598f8b2d 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -265,7 +265,7 @@ int php_cli_server_get_system_time(char *buf) { #endif static void char_ptr_dtor_p(zval *zv) /* {{{ */ -{ +{ pefree(Z_PTR_P(zv), 1); } /* }}} */ diff --git a/sapi/cli/ps_title.c b/sapi/cli/ps_title.c index 6cef483983..e64f6b4fba 100644 --- a/sapi/cli/ps_title.c +++ b/sapi/cli/ps_title.c @@ -125,7 +125,7 @@ static size_t ps_buffer_cur_len; /* actual string length in ps_buffer */ static int save_argc; static char** save_argv; -/* +/* * This holds the 'locally' allocated environ from the save_ps_args method. * This is subsequently free'd at exit. */ diff --git a/sapi/continuity/capi.c b/sapi/continuity/capi.c index c92d8838d3..fde487558d 100644 --- a/sapi/continuity/capi.c +++ b/sapi/continuity/capi.c @@ -75,7 +75,7 @@ PHP_MSHUTDOWN_FUNCTION(continuity); PHP_RINIT_FUNCTION(continuity); PHP_RSHUTDOWN_FUNCTION(continuity); PHP_MINFO_FUNCTION(continuity); - + PHP_FUNCTION(continuity_virtual); PHP_FUNCTION(continuity_request_headers); PHP_FUNCTION(continuity_response_headers); @@ -87,7 +87,7 @@ const zend_function_entry continuity_functions[] = { zend_module_entry continuity_module_entry = { STANDARD_MODULE_HEADER, "continuity", - continuity_functions, + continuity_functions, PHP_MINIT(continuity), PHP_MSHUTDOWN(continuity), NULL, @@ -118,7 +118,7 @@ PHP_MINFO_FUNCTION(continuity) php_info_print_table_row(2,"CDP Extensions", "disabled"); #endif php_info_print_table_end(); - + /* DISPLAY_INI_ENTRIES(); */ } @@ -243,7 +243,7 @@ static void sapi_capi_register_server_variables(zval * track_vars_array) php_register_variable("PHP_SELF", value, track_vars_array); php_register_variable("REQUEST_URI", value, track_vars_array); } - + /* COUNTRY CODE */ value = lstFset_get(rc->t->vars, "ccode"); if(value!=NULL) @@ -475,7 +475,7 @@ int phpFservice(httpTtrans * t, lstTset * opts) int retval; capi_request_context *request_context; - + request_context = (capi_request_context *) malloc(sizeof(capi_request_context)); request_context->t = t; request_context->read_post_bytes = -1; diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c index f5e6129e0f..c777e84742 100644 --- a/sapi/embed/php_embed.c +++ b/sapi/embed/php_embed.c @@ -115,32 +115,32 @@ static int php_embed_startup(sapi_module_struct *sapi_module) EMBED_SAPI_API sapi_module_struct php_embed_module = { "embed", /* name */ "PHP Embedded Library", /* pretty name */ - + php_embed_startup, /* startup */ php_module_shutdown_wrapper, /* shutdown */ - + NULL, /* activate */ php_embed_deactivate, /* deactivate */ - + php_embed_ub_write, /* unbuffered write */ php_embed_flush, /* flush */ NULL, /* get uid */ NULL, /* getenv */ - + php_error, /* error handler */ - + NULL, /* header handler */ NULL, /* send headers handler */ php_embed_send_header, /* send header handler */ - + NULL, /* read POST data */ php_embed_read_cookies, /* read Cookies */ - + php_embed_register_variables, /* register server variables */ php_embed_log_message, /* Log message */ NULL, /* Get request time */ NULL, /* Child terminate */ - + STANDARD_SAPI_MODULE_PROPERTIES }; /* }}} */ @@ -198,8 +198,8 @@ EMBED_SAPI_API int php_embed_init(int argc, char **argv) if (php_embed_module.startup(&php_embed_module)==FAILURE) { return FAILURE; } - - zend_llist_init(&global_vars, sizeof(char *), NULL, 0); + + zend_llist_init(&global_vars, sizeof(char *), NULL, 0); /* Set some Embedded PHP defaults */ SG(options) |= SAPI_OPTION_NO_CHDIR; @@ -210,7 +210,7 @@ EMBED_SAPI_API int php_embed_init(int argc, char **argv) php_module_shutdown(); return FAILURE; } - + SG(headers_sent) = 1; SG(request_info).no_headers = 1; php_register_variable("PHP_SELF", "-", NULL); diff --git a/sapi/embed/php_embed.h b/sapi/embed/php_embed.h index 82afa686d2..982daa8756 100644 --- a/sapi/embed/php_embed.h +++ b/sapi/embed/php_embed.h @@ -41,14 +41,14 @@ #ifndef PHP_WIN32 #define EMBED_SAPI_API SAPI_API #else - #define EMBED_SAPI_API -#endif + #define EMBED_SAPI_API +#endif #ifdef ZTS ZEND_TSRMLS_CACHE_EXTERN; #endif -BEGIN_EXTERN_C() +BEGIN_EXTERN_C() EMBED_SAPI_API int php_embed_init(int argc, char **argv); EMBED_SAPI_API void php_embed_shutdown(void); extern EMBED_SAPI_API sapi_module_struct php_embed_module; diff --git a/sapi/fpm/fpm/events/devpoll.c b/sapi/fpm/fpm/events/devpoll.c index c843940638..ac943f7a9d 100644 --- a/sapi/fpm/fpm/events/devpoll.c +++ b/sapi/fpm/fpm/events/devpoll.c @@ -45,7 +45,7 @@ static struct fpm_event_module_s devpoll_module = { .clean = fpm_event_devpoll_clean, .wait = fpm_event_devpoll_wait, .add = fpm_event_devpoll_add, - .remove = fpm_event_devpoll_remove, + .remove = fpm_event_devpoll_remove, }; int dpfd = -1; @@ -76,7 +76,7 @@ static int fpm_event_devpoll_init(int max) /* {{{ */ /* open /dev/poll for future usages */ dpfd = open("/dev/poll", O_RDWR); - if (dpfd < 0) { + if (dpfd < 0) { zlog(ZLOG_ERROR, "Unable to open /dev/poll"); return -1; } @@ -120,7 +120,7 @@ static int fpm_event_devpoll_init(int max) /* {{{ */ static int fpm_event_devpoll_clean() /* {{{ */ { /* close /dev/poll if open */ - if (dpfd > -1) { + if (dpfd > -1) { close(dpfd); dpfd = -1; } @@ -176,7 +176,7 @@ static int fpm_event_devpoll_wait(struct fpm_event_queue_s *queue, unsigned long while (q) { /* found */ - if (q->ev && q->ev->fd == active_pollfds[i].fd) { + if (q->ev && q->ev->fd == active_pollfds[i].fd) { /* fire the event */ fpm_event_fire(q->ev); diff --git a/sapi/fpm/fpm/events/epoll.c b/sapi/fpm/fpm/events/epoll.c index aa4881649b..af14b397ce 100644 --- a/sapi/fpm/fpm/events/epoll.c +++ b/sapi/fpm/fpm/events/epoll.c @@ -41,7 +41,7 @@ static struct fpm_event_module_s epoll_module = { .clean = fpm_event_epoll_clean, .wait = fpm_event_epoll_wait, .add = fpm_event_epoll_add, - .remove = fpm_event_epoll_remove, + .remove = fpm_event_epoll_remove, }; static struct epoll_event *epollfds = NULL; diff --git a/sapi/fpm/fpm/events/kqueue.c b/sapi/fpm/fpm/events/kqueue.c index df0724c3d4..f5fde1b510 100644 --- a/sapi/fpm/fpm/events/kqueue.c +++ b/sapi/fpm/fpm/events/kqueue.c @@ -44,7 +44,7 @@ static struct fpm_event_module_s kqueue_module = { .clean = fpm_event_kqueue_clean, .wait = fpm_event_kqueue_wait, .add = fpm_event_kqueue_add, - .remove = fpm_event_kqueue_remove, + .remove = fpm_event_kqueue_remove, }; static struct kevent *kevents = NULL; diff --git a/sapi/fpm/fpm/events/poll.c b/sapi/fpm/fpm/events/poll.c index a97c64c2d0..febf5b9d30 100644 --- a/sapi/fpm/fpm/events/poll.c +++ b/sapi/fpm/fpm/events/poll.c @@ -42,7 +42,7 @@ static struct fpm_event_module_s poll_module = { .clean = fpm_event_poll_clean, .wait = fpm_event_poll_wait, .add = fpm_event_poll_add, - .remove = fpm_event_poll_remove, + .remove = fpm_event_poll_remove, }; static struct pollfd *pollfds = NULL; @@ -150,7 +150,7 @@ static int fpm_event_poll_wait(struct fpm_event_queue_s *queue, unsigned long in return -1; } } - + /* events have been triggered */ if (ret > 0) { diff --git a/sapi/fpm/fpm/events/port.c b/sapi/fpm/fpm/events/port.c index faf67343c7..7d3caeb4f6 100644 --- a/sapi/fpm/fpm/events/port.c +++ b/sapi/fpm/fpm/events/port.c @@ -42,7 +42,7 @@ static struct fpm_event_module_s port_module = { .clean = fpm_event_port_clean, .wait = fpm_event_port_wait, .add = fpm_event_port_add, - .remove = fpm_event_port_remove, + .remove = fpm_event_port_remove, }; port_event_t *events = NULL; diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c index cd59082642..2b1b117b1f 100644 --- a/sapi/fpm/fpm/fastcgi.c +++ b/sapi/fpm/fpm/fastcgi.c @@ -472,7 +472,7 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e break; } if (eff_name_len >= buf_size-1) { - if (eff_name_len > ((uint)-1)-64) { + if (eff_name_len > ((uint)-1)-64) { ret = 0; break; } @@ -1030,8 +1030,8 @@ ssize_t fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, i return -1; } pos += 0xfff8; - } - + } + pad = (((len - pos) + 7) & ~7) - (len - pos); rest = pad ? 8 - pad : 0; diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c index 96a29c5f10..e43eb5a86d 100644 --- a/sapi/fpm/fpm/fpm.c +++ b/sapi/fpm/fpm/fpm.c @@ -24,7 +24,7 @@ #include "zlog.h" struct fpm_globals_s fpm_globals = { - .parent_pid = 0, + .parent_pid = 0, .argc = 0, .argv = NULL, .config = NULL, diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 9997446028..6fb1a3dcc9 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -88,7 +88,7 @@ static char *ini_filename = NULL; static int ini_lineno = 0; static char *ini_include = NULL; -/* +/* * Please keep the same order as in fpm_conf.h and in php-fpm.conf.in */ static struct ini_value_parser_s ini_fpm_global_options[] = { @@ -114,7 +114,7 @@ static struct ini_value_parser_s ini_fpm_global_options[] = { { 0, 0, 0 } }; -/* +/* * Please keep the same order as in fpm_conf.h and in php-fpm.conf.in */ static struct ini_value_parser_s ini_fpm_pool_options[] = { @@ -510,7 +510,7 @@ static char *fpm_conf_set_rlimit_core(zval *value, void **config, intptr_t offse error = fpm_conf_set_integer(value, &subconf, 0); - if (error) { + if (error) { return error; } @@ -602,7 +602,7 @@ static void *fpm_worker_pool_config_alloc() /* {{{ */ wp->config = malloc(sizeof(struct fpm_worker_pool_config_s)); - if (!wp->config) { + if (!wp->config) { fpm_worker_pool_free(wp); return 0; } @@ -1256,7 +1256,7 @@ static void fpm_conf_ini_parser_include(char *inc, void *arg) /* {{{ */ if (!inc || !arg) return; if (*error) return; /* We got already an error. Switch to the end. */ - spprintf(&filename, 0, "%s", ini_filename); + spprintf(&filename, 0, "%s", ini_filename); #ifdef HAVE_GLOB { @@ -1267,7 +1267,7 @@ static void fpm_conf_ini_parser_include(char *inc, void *arg) /* {{{ */ zlog(ZLOG_WARNING, "Nothing matches the include pattern '%s' from %s at line %d.", inc, filename, ini_lineno); efree(filename); return; - } + } #endif /* GLOB_NOMATCH */ zlog(ZLOG_ERROR, "Unable to globalize '%s' (ret=%d) from %s at line %d.", inc, i, filename, ini_lineno); *error = 1; diff --git a/sapi/fpm/fpm/fpm_env.c b/sapi/fpm/fpm/fpm_env.c index 3bdb346341..73affab236 100644 --- a/sapi/fpm/fpm/fpm_env.c +++ b/sapi/fpm/fpm/fpm_env.c @@ -32,7 +32,7 @@ int setenv(char *name, char *value, int clobber) /* {{{ */ if (clobber == 0 && getenv(name) != 0) { return 0; } - + if ((cp = malloc(strlen(name) + strlen(value) + 2)) == 0) { return 1; } @@ -106,11 +106,11 @@ static char * nvmatch(char *s1, char *s2) /* {{{ */ { while(*s1 == *s2++) { - if(*s1++ == '=') { + if(*s1++ == '=') { return s2; } } - if(*s1 == '\0' && *(s2-1) == '=') { + if(*s1 == '\0' && *(s2-1) == '=') { return s2; } return NULL; @@ -270,7 +270,7 @@ int fpm_env_init_main() /* {{{ */ #endif spprintf(&title, 0, "master process (%s)", fpm_globals.config); - fpm_env_setproctitle(title); + fpm_env_setproctitle(title); efree(title); return 0; } diff --git a/sapi/fpm/fpm/fpm_events.c b/sapi/fpm/fpm/fpm_events.c index ce5d543f9b..ca45cb1665 100644 --- a/sapi/fpm/fpm/fpm_events.c +++ b/sapi/fpm/fpm/fpm_events.c @@ -171,7 +171,7 @@ static int fpm_event_queue_add(struct fpm_event_queue_s **queue, struct fpm_even module->add(ev); } - return 0; + return 0; } /* }}} */ @@ -464,7 +464,7 @@ void fpm_event_fire(struct fpm_event_s *ev) /* {{{ */ return; } - (*ev->callback)( (struct fpm_event_s *) ev, ev->which, ev->arg); + (*ev->callback)( (struct fpm_event_s *) ev, ev->which, ev->arg); } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c index 94e8b29d64..86332c4c80 100644 --- a/sapi/fpm/fpm/fpm_log.c +++ b/sapi/fpm/fpm/fpm_log.c @@ -34,14 +34,14 @@ int fpm_log_open(int reopen) /* {{{ */ { struct fpm_worker_pool_s *wp; int ret = 1; - + int fd; for (wp = fpm_worker_all_pools; wp; wp = wp->next) { if (!wp->config->access_log) { continue; } ret = 0; - + fd = open(wp->config->access_log, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR); if (0 > fd) { zlog(ZLOG_SYSERROR, "failed to open access log (%s)", wp->config->access_log); @@ -410,7 +410,7 @@ int fpm_log_write(char *log_format) /* {{{ */ { char *start; size_t l; - + start = ++s; while (*s != '\0') { diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 4f5e2da7af..fb18dbbeaa 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -270,8 +270,8 @@ static void print_extensions(void) zend_llist_destroy(&sorted_exts); } -#ifndef STDOUT_FILENO -#define STDOUT_FILENO 1 +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 #endif static inline size_t sapi_cgibin_single_write(const char *str, uint str_length) @@ -289,8 +289,8 @@ static inline size_t sapi_cgibin_single_write(const char *str, uint str_length) } /* sapi has not started, output to stdout instead of fcgi */ -#ifdef PHP_WRITE_STDOUT - ret = write(STDOUT_FILENO, str, str_length); +#ifdef PHP_WRITE_STDOUT + ret = write(STDOUT_FILENO, str, str_length); if (ret <= 0) { return 0; } @@ -420,7 +420,7 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers) while (h) { /* prevent CRLFCRLF */ if (h->header_len) { - if (h->header_len > sizeof("Status:") - 1 && + if (h->header_len > sizeof("Status:") - 1 && strncasecmp(h->header, "Status:", sizeof("Status:") - 1) == 0 ) { if (!ignore_status) { @@ -679,12 +679,12 @@ static void php_cgi_ini_activate_user_config(char *path, int path_len, const cha } /* we have to test if path is part of DOCUMENT_ROOT. - if it is inside the docroot, we scan the tree up to the docroot + if it is inside the docroot, we scan the tree up to the docroot to find more user.ini, if not we only scan the current path. */ #ifdef PHP_WIN32 if (strnicmp(s1, s2, s_len) == 0) { -#else +#else if (strncmp(s1, s2, s_len) == 0) { #endif ptr = s2 + start; /* start is the point where doc_root ends! */ @@ -1554,7 +1554,7 @@ int main(int argc, char *argv[]) sapi_startup(&cgi_sapi_module); cgi_sapi_module.php_ini_path_override = NULL; cgi_sapi_module.php_ini_ignore_cwd = 1; - + fcgi_init(); #ifdef PHP_WIN32 @@ -1625,7 +1625,7 @@ int main(int argc, char *argv[]) use_extended_info = 1; break; - case 't': + case 't': test_conf++; break; @@ -1746,7 +1746,7 @@ int main(int argc, char *argv[]) #endif return FPM_EXIT_SOFTWARE; } - + if (use_extended_info) { CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO; } @@ -1868,7 +1868,7 @@ consult the installation file that came with this distribution, or visit \n\ goto fastcgi_request_done; } - /* + /* * have to duplicate SG(request_info).path_translated to be able to log errrors * php_fopen_primary_script seems to delete SG(request_info).path_translated on failure */ diff --git a/sapi/fpm/fpm/fpm_process_ctl.c b/sapi/fpm/fpm/fpm_process_ctl.c index 76ea4d358e..ca5a6f2e40 100644 --- a/sapi/fpm/fpm/fpm_process_ctl.c +++ b/sapi/fpm/fpm/fpm_process_ctl.c @@ -425,7 +425,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{ return; } - zlog(ZLOG_DEBUG, "[pool %s] %d child(ren) have been created dynamically", wp->config->name, children_to_fork); + zlog(ZLOG_DEBUG, "[pool %s] %d child(ren) have been created dynamically", wp->config->name, children_to_fork); /* Double the spawn rate for the next iteration */ if (wp->idle_spawn_rate < FPM_MAX_SPAWN_RATE) { diff --git a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c index 6335559b48..de3caf7daf 100644 --- a/sapi/fpm/fpm/fpm_request.c +++ b/sapi/fpm/fpm/fpm_request.c @@ -257,7 +257,7 @@ void fpm_request_check_timed_out(struct fpm_child_s *child, struct timeval *now, #if HAVE_FPM_TRACE if (child->slow_logged.tv_sec == 0 && slowlog_timeout && proc.request_stage == FPM_REQUEST_EXECUTING && tv.tv_sec >= slowlog_timeout) { - + str_purify_filename(purified_script_filename, proc.script_filename, sizeof(proc.script_filename)); child->slow_logged = proc.accepted; diff --git a/sapi/fpm/fpm/fpm_scoreboard.c b/sapi/fpm/fpm/fpm_scoreboard.c index 8d0868182d..eabab8f8e6 100644 --- a/sapi/fpm/fpm/fpm_scoreboard.c +++ b/sapi/fpm/fpm/fpm_scoreboard.c @@ -69,7 +69,7 @@ int fpm_scoreboard_init_main() /* {{{ */ wp->scoreboard->start_epoch = time(NULL); strlcpy(wp->scoreboard->pool, wp->config->name, sizeof(wp->scoreboard->pool)); } - return 0; + return 0; } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index 9d8b8fcc7c..7a8a7825c6 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -238,7 +238,7 @@ int fpm_status_handle_request(void) /* {{{ */ short_post = "</status>"; } else { full_pre = "<processes>\n"; - full_syntax = + full_syntax = "<process>" "<pid>%d</pid>" "<state>%s</state>" diff --git a/sapi/fpm/fpm/fpm_systemd.c b/sapi/fpm/fpm/fpm_systemd.c index c4d7ec15a4..95d12c97f2 100644 --- a/sapi/fpm/fpm/fpm_systemd.c +++ b/sapi/fpm/fpm/fpm_systemd.c @@ -29,7 +29,7 @@ static void fpm_systemd() /* {{{ */ } /* - zlog(ZLOG_DEBUG, "systemd %s (Processes active:%d, idle:%d, Requests:%lu, slow:%lu, Traffic:%.3greq/sec)", + zlog(ZLOG_DEBUG, "systemd %s (Processes active:%d, idle:%d, Requests:%lu, slow:%lu, Traffic:%.3greq/sec)", fpm_global_config.systemd_watchdog ? "watchdog" : "heartbeat", active, idle, requests, slow_req, ((float)requests - last) * 1000.0 / fpm_global_config.systemd_interval); */ diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c index f0d4573483..6089e3109e 100644 --- a/sapi/fpm/fpm/fpm_unix.c +++ b/sapi/fpm/fpm/fpm_unix.c @@ -477,7 +477,7 @@ int fpm_unix_init_main() /* {{{ */ * The parent process has then to wait for the master * process to initialize to return a consistent exit * value. For this pupose, the master process will - * send \"1\" into the pipe if everything went well + * send \"1\" into the pipe if everything went well * and \"0\" otherwise. */ diff --git a/sapi/fpm/fpm/zlog.c b/sapi/fpm/fpm/zlog.c index 80db9d8374..6f17b99133 100644 --- a/sapi/fpm/fpm/zlog.c +++ b/sapi/fpm/fpm/zlog.c @@ -184,7 +184,7 @@ void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /* buf[len] = '\0'; php_syslog(syslog_priorities[zlog_level], "%s", buf); buf[len++] = '\n'; - } else + } else #endif { buf[len++] = '\n'; diff --git a/sapi/isapi/php7isapi.c b/sapi/isapi/php7isapi.c index fc97af9c34..b623842de6 100644 --- a/sapi/isapi/php7isapi.c +++ b/sapi/isapi/php7isapi.c @@ -48,9 +48,9 @@ #define PHP_ENABLE_SEH #endif -/* -uncomment the following lines to turn off -exception trapping when running under a debugger +/* +uncomment the following lines to turn off +exception trapping when running under a debugger #ifdef _DEBUG #undef PHP_ENABLE_SEH @@ -138,7 +138,7 @@ static char *isapi_secure_server_variable_names[] = { "SSL_CLIENT_I_O", "SSL_CLIENT_I_L", "SSL_CLIENT_I_ST", - "SSL_CLIENT_I_C", + "SSL_CLIENT_I_C", #endif NULL }; @@ -206,7 +206,7 @@ static int sapi_isapi_ub_write(const char *str, uint str_length) { DWORD num_bytes = str_length; LPEXTENSION_CONTROL_BLOCK ecb; - + ecb = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); if (ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC) == FALSE) { php_handle_aborted_connection(); @@ -280,7 +280,7 @@ static int sapi_isapi_send_headers(sapi_headers_struct *sapi_headers) default: { const char *sline = SG(sapi_headers).http_status_line; int sline_len; - + /* httpd requires that r->status_line is set to the first digit of * the status-code: */ if (sline && ((sline_len = strlen(sline)) > 12) && strncmp(sline, "HTTP/1.", 7) == 0 && sline[8] == ' ') { @@ -397,7 +397,7 @@ static void sapi_isapi_register_zeus_ssl_variables(LPEXTENSION_CONTROL_BLOCK lpE strlcat( static_cons_buf, static_variable_buf, ISAPI_SERVER_VAR_BUF_SIZE ); } php_register_variable( "SSL_CLIENT_DN", static_cons_buf, track_vars_array ); - + strcpy( static_cons_buf, "/C=" ); variable_len = ISAPI_SERVER_VAR_BUF_SIZE; if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_I_C", static_variable_buf, &variable_len ) && static_variable_buf[0] ) { @@ -408,7 +408,7 @@ static void sapi_isapi_register_zeus_ssl_variables(LPEXTENSION_CONTROL_BLOCK lpE if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_I_ST", static_variable_buf, &variable_len ) && static_variable_buf[0] ) { strlcat( static_cons_buf, static_variable_buf, ISAPI_SERVER_VAR_BUF_SIZE ); } - php_register_variable( "SSL_CLIENT_I_DN", static_cons_buf, track_vars_array ); + php_register_variable( "SSL_CLIENT_I_DN", static_cons_buf, track_vars_array ); } static void sapi_isapi_register_zeus_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array) @@ -467,7 +467,7 @@ static void sapi_isapi_register_zeus_variables(LPEXTENSION_CONTROL_BLOCK lpECB, if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_TYPE", static_variable_buf, &variable_len) && static_variable_buf[0] ) { php_register_variable( "AUTH_TYPE", static_variable_buf, track_vars_array ); } - + /* And now, for the SSL variables (if applicable) */ variable_len = ISAPI_SERVER_VAR_BUF_SIZE; if ( lpECB->GetServerVariable(lpECB->ConnID, "CERT_COOKIE", static_variable_buf, &variable_len) && static_variable_buf[0] ) { @@ -541,7 +541,7 @@ static void sapi_isapi_register_iis_variables(LPEXTENSION_CONTROL_BLOCK lpECB, z php_register_variable("DOCUMENT_ROOT", humi.lpszPath, track_vars_array); } - if (!SG(request_info).auth_user || !SG(request_info).auth_password || + if (!SG(request_info).auth_user || !SG(request_info).auth_password || !SG(request_info).auth_user[0] || !SG(request_info).auth_password[0]) { variable_len = ISAPI_SERVER_VAR_BUF_SIZE; if (lpECB->GetServerVariable(lpECB->ConnID, "HTTP_AUTHORIZATION", static_variable_buf, &variable_len) @@ -664,7 +664,7 @@ static void sapi_isapi_register_server_variables(zval *track_vars_array) static sapi_module_struct isapi_sapi_module = { "isapi", /* name */ "ISAPI", /* pretty name */ - + php_isapi_startup, /* startup */ php_module_shutdown_wrapper, /* shutdown */ @@ -719,7 +719,7 @@ DWORD WINAPI HttpFilterProc(PHTTP_FILTER_CONTEXT pfc, DWORD notificationType, LP if (auth_user && auth_user[0]) { SG(request_info).auth_user = estrdup(auth_user); - } + } if (auth_password && auth_password[0]) { SG(request_info).auth_password = estrdup(auth_password); } @@ -755,7 +755,7 @@ static void init_request_info(LPEXTENSION_CONTROL_BLOCK lpECB) */ if(lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_FILENAME", static_variable_buf, &variable_len)) { SG(request_info).path_translated = estrdup(static_variable_buf); - } else + } else #else /* happily, IIS gives us SCRIPT_NAME which is correct (without PATH_INFO stuff) so we can just map that to the physical path and we have our filename */ @@ -763,7 +763,7 @@ static void init_request_info(LPEXTENSION_CONTROL_BLOCK lpECB) lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_NAME", static_variable_buf, &variable_len); if (lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_MAP_URL_TO_PATH_EX, static_variable_buf, &variable_len, (LPDWORD) &humi)) { SG(request_info).path_translated = estrdup(humi.lpszPath); - } else + } else #endif /* if mapping fails, default to what the server tells us */ SG(request_info).path_translated = estrdup(lpECB->lpszPathTranslated); diff --git a/sapi/isapi/stresstest/getopt.c b/sapi/isapi/stresstest/getopt.c index 57faa0f890..21056bf883 100644 --- a/sapi/isapi/stresstest/getopt.c +++ b/sapi/isapi/stresstest/getopt.c @@ -41,7 +41,7 @@ ap_optiserr(int argc, char * const *argv, int oint, const char *optstr, ap_optopt = argv[oint][optchr]; return('?'); } - + int ap_getopt(int argc, char* const *argv, const char *optstr) { static int optchr = 0; @@ -98,7 +98,7 @@ int ap_getopt(int argc, char* const *argv, const char *optstr) } if (cp[1] == ':') { - /* Check for cases where the value of the argument + /* Check for cases where the value of the argument is in the form -<arg> <val> or in the form -<arg><val> */ dash = 0; if(!argv[ap_optind][2]) { diff --git a/sapi/isapi/stresstest/getopt.h b/sapi/isapi/stresstest/getopt.h index a3e278e3a6..6d4139bfe0 100644 --- a/sapi/isapi/stresstest/getopt.h +++ b/sapi/isapi/stresstest/getopt.h @@ -9,4 +9,4 @@ int ap_getopt(int argc, char* const *argv, const char *optstr); #ifdef __cplusplus } -#endif
\ No newline at end of file +#endif diff --git a/sapi/isapi/stresstest/stresstest.cpp b/sapi/isapi/stresstest/stresstest.cpp index 8ad414fab6..ddb06473c2 100644 --- a/sapi/isapi/stresstest/stresstest.cpp +++ b/sapi/isapi/stresstest/stresstest.cpp @@ -84,9 +84,9 @@ char * GetEnv(char *); DWORD CALLBACK IsapiThread(void *); -int stress_main(const char *filename, - const char *arg, - const char *postfile, +int stress_main(const char *filename, + const char *arg, + const char *postfile, const char *matchdata); @@ -354,7 +354,7 @@ BOOL ParseTestFile(const char *path, const char *fn) fputs(line, fe); break; } - } + } fclose(fp); fclose(ft); @@ -520,14 +520,14 @@ int main(int argc, char* argv[]) hDll = LoadLibrary(module); // Load our DLL if (!hDll) { - FormatMessage( + FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, - NULL + NULL ); fprintf(stderr,"Error: Dll 'php7isapi.dll' not found -%d\n%s\n", GetLastError(), lpMsgBuf); free (module); @@ -553,7 +553,7 @@ int main(int argc, char* argv[]) free(filelist); return -1; } - TerminateExtensionProc = (TerminateProc) GetProcAddress(hDll, + TerminateExtensionProc = (TerminateProc) GetProcAddress(hDll, "TerminateExtension"); // This should really check if the version information matches what we @@ -568,7 +568,7 @@ int main(int argc, char* argv[]) if (bUseTestFiles) { char TestPath[MAX_PATH]; - if (filelist != NULL) + if (filelist != NULL) _snprintf(TestPath, sizeof(TestPath)-1, "%s\\tests", filelist); else strcpy(TestPath, "tests"); DoTestFiles(TestPath, environment); @@ -598,8 +598,8 @@ DWORD CALLBACK IsapiThread(void *p) // execute each file CString testname = TestNames.GetAt(i); BOOL ok = FALSE; - if (stress_main(IsapiFileList.GetAt(i), - IsapiGetData.GetAt(i), + if (stress_main(IsapiFileList.GetAt(i), + IsapiGetData.GetAt(i), IsapiPostData.GetAt(i), IsapiMatchData.GetAt(i))) { InterlockedIncrement(&Results[i].ok); @@ -629,10 +629,10 @@ DWORD CALLBACK IsapiThread(void *p) * the DLL to load. There is no recompilation required. * * ======================================================================= * */ -BOOL stress_main(const char *filename, - const char *arg, +BOOL stress_main(const char *filename, + const char *arg, const char *postdata, - const char *matchdata) + const char *matchdata) { EXTENSION_CONTROL_BLOCK ECB; @@ -660,8 +660,8 @@ BOOL stress_main(const char *filename, fprintf(stderr,"Fill Ext Block Failed\n"); return -1; } - - // check for command line argument, + + // check for command line argument, // first arg = filename // this is added for testing php from command line @@ -718,7 +718,7 @@ BOOL stress_main(const char *filename, DeleteFile(fname); return ok; - + } // // GetServerVariable() is how the DLL calls the main program to figure out @@ -764,7 +764,7 @@ BOOL WINAPI ReadClient(HCONN hConn, LPVOID lpBuffer, LPDWORD lpdwSize) { TIsapiContext *c = (TIsapiContext *)hConn; if (!c) return FALSE; - if (c->in != INVALID_HANDLE_VALUE) + if (c->in != INVALID_HANDLE_VALUE) return ReadFile(c->in, lpBuffer, (*lpdwSize), lpdwSize, NULL); return FALSE; @@ -782,7 +782,7 @@ BOOL WINAPI WriteClient(HCONN hConn, LPVOID lpBuffer, LPDWORD lpdwSize, return FALSE; } // -// This is a special callback function used by the DLL for certain extra +// This is a special callback function used by the DLL for certain extra // functionality. Look at the API help for details. // BOOL WINAPI ServerSupportFunction(HCONN hConn, DWORD dwHSERequest, @@ -801,16 +801,16 @@ BOOL WINAPI ServerSupportFunction(HCONN hConn, DWORD dwHSERequest, return FALSE; wsprintf(lpszRespBuf,"%s", //HTTP_VER, - + /* Default response is 200 Ok */ //lpvBuffer?lpvBuffer:"200 Ok", - + /* Create a string for the time. */ //temp=MakeDateStr(), //SERVER_VERSION, - + /* If this exists, it is a pointer to a data buffer to be sent. */ lpdwDataType?(char *)lpdwDataType:NULL); @@ -828,7 +828,7 @@ BOOL WINAPI ServerSupportFunction(HCONN hConn, DWORD dwHSERequest, SetEvent(c->waitEvent); //ExitThread(0); break; - + // // This sends a redirect (temporary) to the client. // The header construction is similar to RESPONSE_HEADER above. @@ -851,7 +851,7 @@ BOOL WINAPI ServerSupportFunction(HCONN hConn, DWORD dwHSERequest, break; } return bRet; - + } // // Makes a string of the date and time from GetSystemTime(). @@ -877,7 +877,7 @@ char * MakeDateStr(void){ return szDate; } // -// Fill the ECB up +// Fill the ECB up // BOOL WINAPI FillExtensionControlBlock(EXTENSION_CONTROL_BLOCK *ECB, TIsapiContext *context) { @@ -915,18 +915,18 @@ BOOL WINAPI FillExtensionControlBlock(EXTENSION_CONTROL_BLOCK *ECB, TIsapiContex // char *GetEnv(LPSTR lpszEnvVar) { - + char *var, dummy; DWORD dwLen; if (!lpszEnvVar) return ""; - + dwLen =GetEnvironmentVariable(lpszEnvVar, &dummy, 1); if (dwLen == 0) return ""; - + var = (char *)xmalloc(dwLen); if (!var) return ""; diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index 2cb1045b22..754d19a22a 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -206,7 +206,7 @@ static int add_variable( const char * pKey, int keyLen, const char * pValue, int #else int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER; #endif - char * new_val = (char *) pValue; + char * new_val = (char *) pValue; size_t new_val_len; if (sapi_module.input_filter(filter_arg, (char *)pKey, &new_val, valLen, &new_val_len)) { @@ -304,7 +304,7 @@ static void litespeed_php_import_environment_variables(zval *array_ptr) #if ((PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || PHP_MAJOR_VERSION < 5) -static int add_variable_magic_quote( const char * pKey, int keyLen, const char * pValue, int valLen, +static int add_variable_magic_quote( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { zval * gpc_element, **gpc_element_p; @@ -493,7 +493,7 @@ static int init_request_info( void ) { char * pContentType = LSAPI_GetHeader( H_CONTENT_TYPE ); char * pAuth; - + SG(request_info).content_type = pContentType ? pContentType : ""; SG(request_info).request_method = LSAPI_GetRequestMethod(); SG(request_info).query_string = LSAPI_GetQueryString(); @@ -503,7 +503,7 @@ static int init_request_info( void ) /* It is not reset by zend engine, set it to 200. */ SG(sapi_headers).http_response_code = 200; - + pAuth = LSAPI_GetHeader( H_AUTHORIZATION ); php_handle_auth_data(pAuth); } @@ -532,7 +532,7 @@ static int lsapi_chdir_primary_script( zend_file_handle * file_handle ) if ( !CWDG(cwd).cwd || ( strcmp( file_handle->filename, CWDG(cwd).cwd ) != 0 ) ) { CWDG(cwd).cwd_length = p - file_handle->filename; - CWDG(cwd).cwd = (char *) realloc(CWDG(cwd).cwd, CWDG(cwd).cwd_length+1); + CWDG(cwd).cwd = (char *) realloc(CWDG(cwd).cwd, CWDG(cwd).cwd_length+1); memmove( CWDG(cwd).cwd, file_handle->filename, CWDG(cwd).cwd_length+1 ); } *p = ch; @@ -616,7 +616,7 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va void * arg ) { #if PHP_MAJOR_VERSION >= 7 - zend_string * psKey; + zend_string * psKey; #endif int type = ZEND_INI_PERDIR; if ( '\001' == *pKey ) { @@ -635,14 +635,14 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va { #if PHP_MAJOR_VERSION >= 7 psKey = zend_string_init(pKey, keyLen, 1); - zend_alter_ini_entry_chars(psKey, + zend_alter_ini_entry_chars(psKey, (char *)pValue, valLen, type, PHP_INI_STAGE_ACTIVATE); zend_string_release(psKey); #else zend_alter_ini_entry((char *)pKey, keyLen, (char *)pValue, valLen, - type, PHP_INI_STAGE_ACTIVATE); + type, PHP_INI_STAGE_ACTIVATE); #endif } } @@ -731,7 +731,7 @@ static int parse_opt( int argc, char * argv[], int *climode, } *php_bind = strdup(*p++); break; - + case 'c': if ( p >= argend ) { fprintf( stderr, "<path> or <file> must be specified following '-c' option.\n"); @@ -786,7 +786,7 @@ static int cli_main( int argc, char * argv[] ) int ret = -1; int c; #if PHP_MAJOR_VERSION >= 7 - zend_string * psKey; + zend_string * psKey; #endif lsapi_mode = 0; /* enter CLI mode */ @@ -808,7 +808,7 @@ static int cli_main( int argc, char * argv[] ) for( ini = ini_defaults; *ini; ini+=2 ) { #if PHP_MAJOR_VERSION >= 7 psKey = zend_string_init(*ini, strlen( *ini ), 1); - zend_alter_ini_entry_chars(psKey, + zend_alter_ini_entry_chars(psKey, (char *)*(ini+1), strlen( *(ini+1) ), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); zend_string_release(psKey); @@ -891,7 +891,7 @@ static int cli_main( int argc, char * argv[] ) } else { if (source_highlight == 1) { zend_syntax_highlighter_ini syntax_highlighter_ini; - + php_get_highlight_struct(&syntax_highlighter_ini); highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini); } else if (source_highlight == 2) { @@ -904,7 +904,7 @@ static int cli_main( int argc, char * argv[] ) } else { zend_printf("Errors parsing %s\n", file_handle.filename); } - + } else { file_handle.filename = *p; file_handle.free_filename = 0; @@ -982,7 +982,7 @@ void start_children( int children ) running++; break; } - } + } if ( s_stop ) { break; } @@ -1027,7 +1027,7 @@ int main( int argc, char * argv[] ) struct timeval tv_req_end; int slow_script_msec = 0; char time_buf[40]; - + #ifdef HAVE_SIGNAL_H #if defined(SIGPIPE) && defined(SIG_IGN) signal(SIGPIPE, SIG_IGN); @@ -1039,7 +1039,7 @@ int main( int argc, char * argv[] ) #endif if (argc > 1 ) { - if ( parse_opt( argc, argv, &climode, + if ( parse_opt( argc, argv, &climode, &php_ini_path, &php_bind ) == -1 ) { return 1; } @@ -1063,7 +1063,7 @@ int main( int argc, char * argv[] ) #endif lsapi_sapi_module.executable_location = argv[0]; - + if ( ignore_php_ini ) lsapi_sapi_module.php_ini_ignore = 1; @@ -1099,9 +1099,9 @@ int main( int argc, char * argv[] ) } LSAPI_Init(); - + LSAPI_Init_Env_Parameters( NULL ); - lsapi_mode = 1; + lsapi_mode = 1; slow_script_msec = LSAPI_Get_Slow_Req_Msecs(); @@ -1118,13 +1118,13 @@ int main( int argc, char * argv[] ) ret = processReq(); if ( slow_script_msec ) { gettimeofday( &tv_req_end, NULL ); - n = ((long) tv_req_end.tv_sec - tv_req_begin.tv_sec ) * 1000 + n = ((long) tv_req_end.tv_sec - tv_req_begin.tv_sec ) * 1000 + (tv_req_end.tv_usec - tv_req_begin.tv_usec) / 1000; if ( n > slow_script_msec ) { strftime( time_buf, 30, "%d/%b/%Y:%H:%M:%S", localtime( &tv_req_end.tv_sec ) ); fprintf( stderr, "[%s] Slow PHP script: %d ms\n URL: %s %s\n Query String: %s\n Script: %s\n", - time_buf, n, LSAPI_GetRequestMethod(), + time_buf, n, LSAPI_GetRequestMethod(), LSAPI_GetScriptName(), LSAPI_GetQueryString(), LSAPI_GetScriptFileName() ); @@ -1199,7 +1199,7 @@ static int add_associate_array( const char * pKey, int keyLen, const char * pVal add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue #if PHP_MAJOR_VERSION < 7 , 1 -#endif +#endif ); return 1; } @@ -1257,13 +1257,13 @@ PHP_FUNCTION(litespeed_response_headers) add_assoc_string_ex(return_value, headerBuf, len+1, p #if PHP_MAJOR_VERSION < 7 , 1 -#endif +#endif ); } } } h = zend_llist_get_next_ex(&SG(sapi_headers).headers, &pos); - } + } } /* }}} */ @@ -1273,7 +1273,7 @@ PHP_FUNCTION(litespeed_response_headers) Fetch all loaded module names */ PHP_FUNCTION(apache_get_modules) { - static const char * mod_names[] = + static const char * mod_names[] = { "mod_rewrite", "mod_mime", "mod_headers", "mod_expires", NULL }; @@ -1285,10 +1285,10 @@ PHP_FUNCTION(apache_get_modules) array_init(return_value); while( *name ) { - add_next_index_string(return_value, *name + add_next_index_string(return_value, *name #if PHP_MAJOR_VERSION < 7 , 1 -#endif +#endif ); ++name; } diff --git a/sapi/litespeed/lsapidef.h b/sapi/litespeed/lsapidef.h index 5c604a57c4..44b9a4fe14 100644 --- a/sapi/litespeed/lsapidef.h +++ b/sapi/litespeed/lsapidef.h @@ -22,18 +22,18 @@ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are -met: +met: * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided - with the distribution. + with the distribution. * Neither the name of the Lite Speed Technologies Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior - written permission. + written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -45,7 +45,7 @@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -94,7 +94,7 @@ enum /* Values for m_flag in lsapi_packet_header */ #define LSAPI_ENDIAN_LITTLE 0 -#define LSAPI_ENDIAN_BIG 1 +#define LSAPI_ENDIAN_BIG 1 #define LSAPI_ENDIAN_BIT 1 #if defined(__i386__)||defined( __x86_64 )||defined( __x86_64__ ) @@ -137,7 +137,7 @@ struct lsapi_packet_header /* LSAPI request header packet - + 1. struct lsapi_req_header 2. struct lsapi_http_header_index 3. lsapi_header_offset * unknownHeaders @@ -148,7 +148,7 @@ struct lsapi_packet_header struct lsapi_req_header { struct lsapi_packet_header m_pktHeader; - + int32_t m_httpHeaderLen; int32_t m_reqBodyLen; int32_t m_scriptFileOff; /* path to the script file. */ @@ -162,11 +162,11 @@ struct lsapi_req_header struct lsapi_http_header_index -{ +{ int16_t m_headerLen[H_TRANSFER_ENCODING+1]; int32_t m_headerOff[H_TRANSFER_ENCODING+1]; -} ; - +} ; + struct lsapi_header_offset { int32_t nameOff; diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c index daf0f37f14..53d9def952 100644 --- a/sapi/litespeed/lsapilib.c +++ b/sapi/litespeed/lsapilib.c @@ -22,18 +22,18 @@ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are -met: +met: * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided - with the distribution. + with the distribution. * Neither the name of the Lite Speed Technologies Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior - written permission. + written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -45,7 +45,7 @@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -153,7 +153,7 @@ static const char *CGI_HEADERS[H_TRANSFER_ENCODING+1] = "HTTP_VIA", "HTTP_TRANSFER_ENCODING" }; - + static int CGI_HEADER_LEN[H_TRANSFER_ENCODING+1] = { 11, 19, 20, 20, 18, 15, 12, 14, 11, 12, 9, 11, 12, 15, 18, 22, 13, 18, 13, 24, 15, 10, 20, 8, 22 }; @@ -184,7 +184,7 @@ static int HTTP_HEADER_LEN[H_TRANSFER_ENCODING+1] = { 6, 14, 15, 15, 13, 10, 12, 14, 6, 7, 4, 6, 7, 10, //user-agent 13,17, 8, 13, 8, 19, 10, 5, 15, 3, 17 }; - + static void lsapi_sigpipe( int sig ) { } @@ -196,7 +196,7 @@ static void lsapi_siguser1( int sig ) #ifndef sighandler_t typedef void (*sighandler_t)(int); #endif - + static void lsapi_signal(int signo, sighandler_t handler) { struct sigaction sa; @@ -219,7 +219,7 @@ static void lsapi_enable_core_dump() #if defined(__FreeBSD__ ) || defined(__NetBSD__) || defined(__OpenBSD__) \ || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) int mib[2]; - size_t len; + size_t len; len = 2; if ( sysctlnametomib("kern.sugid_coredump", mib, &len) == 0 ) @@ -230,7 +230,7 @@ static void lsapi_enable_core_dump() "core dump may not be available!"); } - + #endif #if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) @@ -511,7 +511,7 @@ static inline void swapIntEndian( int * pInteger ) b = p[1]; p[1] = p[2]; p[2] = b; - + } static inline void fixEndian( LSAPI_Request * pReq ) @@ -586,7 +586,7 @@ static int lsapi_load_lve_lib() if (s_liblve) { fp_lve_is_available = dlsym(s_liblve, "lve_is_available"); - if (dlerror() == NULL) + if (dlerror() == NULL) { if ( !(*fp_lve_is_available)() ) { @@ -612,7 +612,7 @@ static int init_lve_ex() { int rc; if ( !s_liblve ) - return -1; + return -1; fp_lve_instance_init = dlsym(s_liblve, "lve_instance_init"); fp_lve_destroy = dlsym(s_liblve, "lve_destroy"); fp_lve_enter = dlsym(s_liblve, "lve_enter"); @@ -620,13 +620,13 @@ static int init_lve_ex() if ( s_enable_lve >= LSAPI_CAGEFS_ENABLED ) fp_lve_jail = dlsym(s_liblve, "jail" ); - if ( s_lve == NULL ) + if ( s_lve == NULL ) { rc = (*fp_lve_instance_init)(NULL); s_lve = malloc(rc); } rc = (*fp_lve_instance_init)(s_lve); - if (rc != 0) + if (rc != 0) { perror( "LSAPI: Unable to initialize LVE" ); free( s_lve ); @@ -634,7 +634,7 @@ static int init_lve_ex() return -1; } return 0; - + } #endif @@ -701,7 +701,7 @@ static int LSAPI_perror_r( LSAPI_Request * pReq, const char * pErr1, const char static int lsapi_lve_error( LSAPI_Request * pReq ) { - static const char * headers[] = + static const char * headers[] = { "Cache-Control: private, no-cache, no-store, must-revalidate, max-age=0", "Pragma: no-cache", @@ -717,7 +717,7 @@ static int lsapi_lve_error( LSAPI_Request * pReq ) "Please try again later.\n" "<HR>\n" "</BODY></HTML>\n"; - + LSAPI_ErrResponse_r( pReq, 508, headers, achBody, sizeof( achBody ) - 1 ); return 0; } @@ -751,7 +751,7 @@ static int lsapi_jailLVE( LSAPI_Request * pReq, uid_t uid, struct passwd * pw ) ret = (*fp_lve_jail)( pw, error_msg ); if ( ret < 0 ) { - fprintf( stderr, "LSAPI (%d): LVE jail(%d) ressult: %d, error: %s !\n", + fprintf( stderr, "LSAPI (%d): LVE jail(%d) ressult: %d, error: %s !\n", getpid(), uid, ret, error_msg ); LSAPI_perror_r( pReq, "LSAPI: jail() failure.", NULL ); return -1; @@ -796,7 +796,7 @@ static int setUID_LVE(LSAPI_Request * pReq, uid_t uid, gid_t gid, const char * p pw = getpwuid( uid ); #if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) if ( s_lve ) - { + { if( lsapi_enterLVE( pReq, uid ) == -1 ) return -1; if ( pw && fp_lve_jail) @@ -813,7 +813,7 @@ static int setUID_LVE(LSAPI_Request * pReq, uid_t uid, gid_t gid, const char * p } } #endif - //if ( !uid || !gid ) //do not allow root + //if ( !uid || !gid ) //do not allow root //{ // return -1; //} @@ -869,7 +869,7 @@ static int setUID_LVE(LSAPI_Request * pReq, uid_t uid, gid_t gid, const char * p return 0; } -static int lsapi_suexec_auth( LSAPI_Request *pReq, +static int lsapi_suexec_auth( LSAPI_Request *pReq, char * pAuth, int len, char * pUgid, int ugidLen ) { lsapi_MD5_CTX md5ctx; @@ -901,7 +901,7 @@ static int lsapi_changeUGid( LSAPI_Request * pReq ) //with special ID 0x00 //authenticate the suEXEC request; //first one should be MD5( nonce + lscgid secret ) - //remember to clear the secret after verification + //remember to clear the secret after verification //it should be set at the end of special env i = pReq->m_pHeader->m_cntSpecialEnv - 1; if ( i >= 0 ) @@ -917,7 +917,7 @@ static int lsapi_changeUGid( LSAPI_Request * pReq ) { --pReq->m_pHeader->m_cntSpecialEnv; uid = *(uint32_t *)pEnv->pValue; - gid = *(((uint32_t *)pEnv->pValue) + 1 ); + gid = *(((uint32_t *)pEnv->pValue) + 1 ); //fprintf( stderr, "LSAPI: SUEXEC_UGID set UID: %d, GID: %d\n", uid, gid ); } else @@ -927,8 +927,8 @@ static int lsapi_changeUGid( LSAPI_Request * pReq ) } if ( pEnv&& lsapi_suexec_auth( pReq, pAuth->pValue, pAuth->valLen, pEnv->pValue, pEnv->valLen ) == 0 ) { - //read UID, GID from specialEnv - + //read UID, GID from specialEnv + } else { @@ -956,10 +956,10 @@ static int lsapi_changeUGid( LSAPI_Request * pReq ) return -1; } - s_uid = uid; + s_uid = uid; return 0; - + } static int parseContentLenFromHeader(LSAPI_Request * pReq) @@ -1004,7 +1004,7 @@ static int parseRequest( LSAPI_Request * pReq, int totalLen ) pReq->m_pScriptName = pReq->m_pReqBuf + pReq->m_pHeader->m_scriptNameOff; pReq->m_pQueryString = pReq->m_pReqBuf + pReq->m_pHeader->m_queryStringOff; pReq->m_pRequestMethod = pReq->m_pReqBuf + pReq->m_pHeader->m_requestMethodOff; - + pBegin = pReq->m_pReqBuf + (( pBegin - pReq->m_pReqBuf + 7 ) & (~0x7)); pReq->m_pHeaderIndex = ( struct lsapi_http_header_index * )pBegin; pBegin += sizeof( struct lsapi_http_header_index ); @@ -1030,7 +1030,7 @@ static int parseRequest( LSAPI_Request * pReq, int totalLen ) { parseContentLenFromHeader(pReq); } - + return 0; } @@ -1088,7 +1088,7 @@ static inline int lsapi_notify_pid( int fd ) 8 + LSAPI_PACKET_HEADER_LEN ); memmove( &achBuf[8], "\0PID", 4 ); *((int *)&achBuf[12]) = getpid(); - + if ( write( fd, achBuf, 16 ) < 16 ) return -1; return 0; @@ -1112,7 +1112,7 @@ static inline int init_conn_key( int fd ) < LSAPI_PACKET_HEADER_LEN+8 ) return -1; return 0; - + } @@ -1198,9 +1198,9 @@ int LSAPI_Init(void) #if defined(SIGXFSZ) && defined(SIG_IGN) signal(SIGXFSZ, SIG_IGN); #endif - /* let STDOUT function as STDERR, + /* let STDOUT function as STDERR, just in case writing to STDOUT directly */ - dup2( 2, 1 ); + dup2( 2, 1 ); if ( LSAPI_InitRequest( &g_req, LSAPI_SOCK_FILENO ) == -1 ) return -1; g_inited = 1; @@ -1240,8 +1240,8 @@ int LSAPI_InitRequest( LSAPI_Request * pReq, int fd ) { fd = dup( fd ); newfd = open( "/dev/null", O_RDWR ); - dup2( newfd, STDIN_FILENO ); - } + dup2( newfd, STDIN_FILENO ); + } if ( isPipe( fd ) ) { @@ -1274,7 +1274,7 @@ int LSAPI_Accept_r( LSAPI_Request * pReq ) char achPeer[128]; socklen_t len; int nodelay = 1; - + if ( !pReq ) return -1; if ( LSAPI_Finish_r( pReq ) == -1 ) @@ -1300,7 +1300,7 @@ int LSAPI_Accept_r( LSAPI_Request * pReq ) { lsapi_set_nblock( pReq->m_fd , 0 ); if (((struct sockaddr *)&achPeer)->sa_family == AF_INET ) - { + { setsockopt(pReq->m_fd, IPPROTO_TCP, TCP_NODELAY, (char *)&nodelay, sizeof(nodelay)); } @@ -1344,7 +1344,7 @@ int LSAPI_Finish_r( LSAPI_Request * pReq ) { Flush_RespBuf_r( pReq ); } - + pReq->m_pIovecCur->iov_base = (void *)&finish; pReq->m_pIovecCur->iov_len = LSAPI_PACKET_HEADER_LEN; pReq->m_totalLen += LSAPI_PACKET_HEADER_LEN; @@ -1362,7 +1362,7 @@ void LSAPI_Reset_r( LSAPI_Request * pReq ) pReq->m_pRespBufPos = pReq->m_pRespBuf; pReq->m_pIovecCur = pReq->m_pIovecToWrite = pReq->m_pIovec + 1; pReq->m_pRespHeaderBufPos = pReq->m_pRespHeaderBuf; - + memset( &pReq->m_pHeaderIndex, 0, (char *)(pReq->m_respHeaderLen) - (char *)&pReq->m_pHeaderIndex ); } @@ -1377,7 +1377,7 @@ int LSAPI_Release_r( LSAPI_Request * pReq ) if ( pReq->m_pEnvList ) free( pReq->m_pEnvList ); if ( pReq->m_pRespHeaderBuf ) - free( pReq->m_pRespHeaderBuf ); + free( pReq->m_pRespHeaderBuf ); return 0; } @@ -1390,9 +1390,9 @@ char * LSAPI_GetHeader_r( LSAPI_Request * pReq, int headerIndex ) off = pReq->m_pHeaderIndex->m_headerOff[ headerIndex ]; if ( !off ) return NULL; - if ( *(pReq->m_pHttpHeader + off + + if ( *(pReq->m_pHttpHeader + off + pReq->m_pHeaderIndex->m_headerLen[ headerIndex ]) ) - *( pReq->m_pHttpHeader + off + + *( pReq->m_pHttpHeader + off + pReq->m_pHeaderIndex->m_headerLen[ headerIndex ]) = 0; return pReq->m_pHttpHeader + off; } @@ -1411,7 +1411,7 @@ static int readBodyToReqBuf( LSAPI_Request * pReq ) return -1; if ( len > bodyLeft ) len = bodyLeft; - + len = lsapi_read( pReq->m_fd, pReq->m_pReqBuf + pReq->m_bufRead, len ); if ( len > 0 ) pReq->m_bufRead += len; @@ -1447,7 +1447,7 @@ int LSAPI_ReqBodyGetLine_r( LSAPI_Request * pReq, char * pBuf, size_t bufLen, in *getLF = 0; while( (left = pBufEnd - pBufCur ) > 0 ) { - + len = pReq->m_bufRead - pReq->m_bufProcessed; if ( len <= 0 ) { @@ -1468,7 +1468,7 @@ int LSAPI_ReqBodyGetLine_r( LSAPI_Request * pReq, char * pBuf, size_t bufLen, in pReq->m_bufProcessed += len; pReq->m_reqBodyRead += len; - + if ( p ) { *getLF = 1; @@ -1476,7 +1476,7 @@ int LSAPI_ReqBodyGetLine_r( LSAPI_Request * pReq, char * pBuf, size_t bufLen, in } } *pBufCur = 0; - + return pBufCur - pBuf; } @@ -1490,7 +1490,7 @@ ssize_t LSAPI_ReadReqBody_r( LSAPI_Request * pReq, char * pBuf, size_t bufLen ) return -1; total = pReq->m_reqBodyLen - pReq->m_reqBodyRead; - + if ( total <= 0 ) return 0; if ( total < bufLen ) @@ -1526,7 +1526,7 @@ ssize_t LSAPI_ReadReqBody_r( LSAPI_Request * pReq, char * pBuf, size_t bufLen ) } pReq->m_reqBodyRead += total; return total; - + } @@ -1539,7 +1539,7 @@ ssize_t LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, size_t len ) ssize_t toWrite; ssize_t packetLen; int skip = 0; - + if ( !pReq || !pBuf || (pReq->m_fd == -1) ) return -1; if ( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) @@ -1564,13 +1564,13 @@ ssize_t LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, size_t len ) pReq->m_pRespBufPos += len - skip; return len; } - - + + pHeader = pReq->m_respPktHeader; p = pBuf + skip; pEnd = pBuf + len; bufLen = pReq->m_pRespBufPos - pReq->m_pRespBuf; - + while( ( toWrite = pEnd - p ) > 0 ) { packetLen = toWrite + bufLen; @@ -1579,7 +1579,7 @@ ssize_t LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, size_t len ) packetLen = LSAPI_MAX_DATA_PACKET_LEN; toWrite = packetLen - bufLen; } - + lsapi_buildPacketHeader( pHeader, LSAPI_RESP_STREAM, packetLen + LSAPI_PACKET_HEADER_LEN ); pReq->m_totalLen += packetLen + LSAPI_PACKET_HEADER_LEN; @@ -1593,7 +1593,7 @@ ssize_t LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, size_t len ) pReq->m_pIovecCur->iov_base = (void *)pReq->m_pRespBuf; pReq->m_pIovecCur->iov_len = bufLen; pReq->m_pRespBufPos = pReq->m_pRespBuf; - ++pReq->m_pIovecCur; + ++pReq->m_pIovecCur; bufLen = 0; } @@ -1615,7 +1615,7 @@ ssize_t LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, size_t len ) return p - pBuf; } -#if defined(__FreeBSD__ ) || defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__FreeBSD__ ) || defined(__NetBSD__) || defined(__OpenBSD__) ssize_t gsendfile( int fdOut, int fdIn, off_t* off, size_t size ) { ssize_t ret; @@ -1644,7 +1644,7 @@ ssize_t gsendfile( int fdOut, int fdIn, off_t* off, size_t size ) return ret; } #endif - + #if defined(sun) || defined(__sun) #include <sys/sendfile.h> ssize_t gsendfile( int fdOut, int fdIn, off_t *off, size_t size ) @@ -1690,16 +1690,16 @@ ssize_t LSAPI_sendfile_r( LSAPI_Request * pReq, int fdIn, off_t* off, size_t siz LSAPI_FinalizeRespHeaders_r( pReq ); } pReq->m_reqState |= LSAPI_ST_RESP_BODY; - + LSAPI_Flush_r(pReq); - + lsapi_buildPacketHeader( pHeader, LSAPI_RESP_STREAM, size + LSAPI_PACKET_HEADER_LEN ); - + if (write(pReq->m_fd, (const char *) pHeader, LSAPI_PACKET_HEADER_LEN ) != LSAPI_PACKET_HEADER_LEN) return -1; - + return gsendfile( pReq->m_fd, fdIn, off, size ); } @@ -1722,7 +1722,7 @@ void Flush_RespBuf_r( LSAPI_Request * pReq ) pReq->m_pIovecCur->iov_base = (void *)pReq->m_pRespBuf; pReq->m_pIovecCur->iov_len = bufLen; pReq->m_pRespBufPos = pReq->m_pRespBuf; - ++pReq->m_pIovecCur; + ++pReq->m_pIovecCur; bufLen = 0; } } @@ -1754,11 +1754,11 @@ int LSAPI_Flush_r( LSAPI_Request * pReq ) { Flush_RespBuf_r( pReq ); } - + n = pReq->m_pIovecCur - pReq->m_pIovecToWrite; if ( n > 0 ) { - + ret = lsapi_writev( pReq->m_fd, &pReq->m_pIovecToWrite, n, pReq->m_totalLen ); if ( ret < pReq->m_totalLen ) @@ -1784,7 +1784,7 @@ ssize_t LSAPI_Write_Stderr_r( LSAPI_Request * pReq, const char * pBuf, size_t le int ret; struct iovec iov[2]; struct iovec *pIov; - + if ( !pReq ) return -1; if (( pReq->m_fd == -1 )||(pReq->m_fd == pReq->m_fdListen )) @@ -1793,7 +1793,7 @@ ssize_t LSAPI_Write_Stderr_r( LSAPI_Request * pReq, const char * pBuf, size_t le { LSAPI_Flush_r( pReq ); } - + p = pBuf; pEnd = pBuf + len; @@ -1900,7 +1900,7 @@ struct _headerInfo int compareValueLocation(const void * v1, const void *v2 ) { return ((const struct _headerInfo *)v1)->_value - - ((const struct _headerInfo *)v2)->_value; + ((const struct _headerInfo *)v2)->_value; } int LSAPI_ForeachOrgHeader_r( LSAPI_Request * pReq, @@ -1931,7 +1931,7 @@ int LSAPI_ForeachOrgHeader_r( LSAPI_Request * pReq, headers[count]._value = pValue; headers[count]._valueLen = len; ++count; - + //ret = (*fn)( HTTP_HEADERS[i], HTTP_HEADER_LEN[i], // pValue, len, arg ); //if ( ret <= 0 ) @@ -1960,7 +1960,7 @@ int LSAPI_ForeachOrgHeader_r( LSAPI_Request * pReq, ++count; if ( count == 512 ) break; - //ret = (*fn)( pKey, keyLen, + //ret = (*fn)( pKey, keyLen, // pValue, pCur->valueLen, arg ); //if ( ret <= 0 ) // return ret; @@ -1970,13 +1970,13 @@ int LSAPI_ForeachOrgHeader_r( LSAPI_Request * pReq, qsort( headers, count, sizeof( struct _headerInfo ), compareValueLocation ); for( i = 0; i < count; ++i ) { - ret = (*fn)( headers[i]._name, headers[i]._nameLen, + ret = (*fn)( headers[i]._name, headers[i]._nameLen, headers[i]._value, headers[i]._valueLen, arg ); if ( ret <= 0 ) return ret; } return count; - + } @@ -2037,7 +2037,7 @@ int LSAPI_ForeachHeader_r( LSAPI_Request * pReq, pValue = pReq->m_pHttpHeader + pCur->valueOff; *(pValue + pCur->valueLen ) = 0; - ret = (*fn)( achHeaderName, keyLen, + ret = (*fn)( achHeaderName, keyLen, pValue, pCur->valueLen, arg ); if ( ret <= 0 ) return ret; @@ -2045,7 +2045,7 @@ int LSAPI_ForeachHeader_r( LSAPI_Request * pReq, } } return count + pReq->m_pHeader->m_cntUnknownHeaders; - + } static int EnvForeach( struct LSAPI_key_value_pair * pEnv, @@ -2114,7 +2114,7 @@ int LSAPI_FinalizeRespHeaders_r( LSAPI_Request * pReq ) pReq->m_totalLen += pReq->m_pIovecCur->iov_len; ++pReq->m_pIovecCur; } - + pReq->m_pIovec->iov_len = sizeof( struct lsapi_resp_header) + pReq->m_respHeader.m_respInfo.m_cntHeaders * sizeof( short ); pReq->m_totalLen += pReq->m_pIovec->iov_len; @@ -2127,11 +2127,11 @@ int LSAPI_FinalizeRespHeaders_r( LSAPI_Request * pReq ) } -int LSAPI_AppendRespHeader2_r( LSAPI_Request * pReq, const char * pHeaderName, +int LSAPI_AppendRespHeader2_r( LSAPI_Request * pReq, const char * pHeaderName, const char * pHeaderValue ) { int nameLen, valLen, len; - if ( !pReq || !pHeaderName || !pHeaderValue ) + if ( !pReq || !pHeaderName || !pHeaderValue ) return -1; if ( pReq->m_reqState & LSAPI_ST_RESP_BODY ) return -1; @@ -2275,7 +2275,7 @@ int LSAPI_ParseSockAddr( const char * pBind, struct sockaddr * pAddr ) struct addrinfo *res, hints; int doAddrInfo = 0; int port; - + if ( !pBind ) return -1; @@ -2299,7 +2299,7 @@ int LSAPI_ParseSockAddr( const char * pBind, struct sockaddr * pAddr ) if ( !pEnd ) return -1; *pEnd++ = 0; - + if ( *p == '*' ) { strcpy( achAddr, "::" ); @@ -2314,7 +2314,7 @@ int LSAPI_ParseSockAddr( const char * pBind, struct sockaddr * pAddr ) if ( !pEnd ) return -1; *pEnd++ = 0; - + doAddrInfo = 0; if ( *p == '*' ) { @@ -2334,7 +2334,7 @@ int LSAPI_ParseSockAddr( const char * pBind, struct sockaddr * pAddr ) } if ( *pEnd == ':' ) ++pEnd; - + port = atoi( pEnd ); if (( port <= 0 )||( port > 65535 )) return -1; @@ -2355,13 +2355,13 @@ int LSAPI_ParseSockAddr( const char * pBind, struct sockaddr * pAddr ) memcpy(pAddr, res->ai_addr, res->ai_addrlen); freeaddrinfo(res); } - + if ( pAddr->sa_family == AF_INET ) ((struct sockaddr_in *)pAddr)->sin_port = htons( port ); else ((struct sockaddr_in6 *)pAddr)->sin6_port = htons( port ); return 0; - + } int LSAPI_CreateListenSock( const char * pBind, int backlog ) @@ -2407,11 +2407,11 @@ typedef struct _lsapi_prefork_server int m_iChildrenMaxIdleTime; int m_iMaxReqProcessTime; int m_iAvoidFork; - + lsapi_child_status * m_pChildrenStatus; lsapi_child_status * m_pChildrenStatusCur; lsapi_child_status * m_pChildrenStatusEnd; - + }lsapi_prefork_server; static lsapi_prefork_server * g_prefork_server = NULL; @@ -2426,7 +2426,7 @@ int LSAPI_Init_Prefork_Server( int max_children, fn_select_t fp, int avoidFork ) if ( max_children >= 10000) max_children = 10000; - + g_prefork_server = (lsapi_prefork_server *)malloc( sizeof( lsapi_prefork_server ) ); if ( !g_prefork_server ) return -1; @@ -2440,14 +2440,14 @@ int LSAPI_Init_Prefork_Server( int max_children, fn_select_t fp, int avoidFork ) setpgid( pid, pid ); g_prefork_server->m_iAvoidFork = avoidFork; g_prefork_server->m_iMaxChildren = max_children; - + g_prefork_server->m_iExtraChildren = ( avoidFork ) ? 0 : (max_children / 3) ; g_prefork_server->m_iMaxIdleChildren = ( avoidFork ) ? (max_children + 1) : (max_children / 3); if ( g_prefork_server->m_iMaxIdleChildren == 0 ) g_prefork_server->m_iMaxIdleChildren = 1; g_prefork_server->m_iChildrenMaxIdleTime = 300; g_prefork_server->m_iMaxReqProcessTime = 3600; - return 0; + return 0; } void LSAPI_Set_Server_fd( int fd ) @@ -2554,7 +2554,7 @@ static void lsapi_sigchild( int signal ) static int lsapi_init_children_status() { int size = 4096; - + char * pBuf; size = (g_prefork_server->m_iMaxChildren + g_prefork_server->m_iExtraChildren ) * sizeof( lsapi_child_status ) * 2; size = (size + 4095 ) / 4096 * 4096; @@ -2582,9 +2582,9 @@ static void dump_debug_info( lsapi_child_status * pStatus, long tmCur ) } s_pid_dump_debug_info = fork(); - fprintf( stderr, "[%s] Possible runaway process, PPID: %d, PID: %d, reqCount: %d, process time: %ld, checkpoint time: %ld, start time: %ld\n", - ctime(&tmCur), getpid(), pStatus->m_pid, pStatus->m_iReqCounter, - tmCur - pStatus->m_tmReqBegin, tmCur - pStatus->m_tmLastCheckPoint, tmCur - pStatus->m_tmStart ); + fprintf( stderr, "[%s] Possible runaway process, PPID: %d, PID: %d, reqCount: %d, process time: %ld, checkpoint time: %ld, start time: %ld\n", + ctime(&tmCur), getpid(), pStatus->m_pid, pStatus->m_iReqCounter, + tmCur - pStatus->m_tmReqBegin, tmCur - pStatus->m_tmLastCheckPoint, tmCur - pStatus->m_tmStart ); snprintf( achCmd, 1024, "gdb --batch -ex \"attach %d\" -ex \"set height 0\" -ex \"bt\" >&2;PATH=$PATH:/usr/sbin lsof -p %d >&2", pStatus->m_pid, pStatus->m_pid ); if ( system( achCmd ) == -1 ) perror( "system()" ); @@ -2607,7 +2607,7 @@ static void lsapi_check_child_status( long tmCur ) ++count; if ( !pStatus->m_inProcess ) { - + if (( g_prefork_server->m_iCurChildren - dying > g_prefork_server->m_iMaxChildren)|| ( idle > g_prefork_server->m_iMaxIdleChildren )) { @@ -2627,7 +2627,7 @@ static void lsapi_check_child_status( long tmCur ) } else { - if ( tmCur - pStatus->m_tmReqBegin > + if ( tmCur - pStatus->m_tmReqBegin > g_prefork_server->m_iMaxReqProcessTime ) { if (( ( pStatus->m_iKillSent % 5 ) == 0 )&&( s_dump_debug_info )) @@ -2662,7 +2662,7 @@ static void lsapi_check_child_status( long tmCur ) } if ( abs( g_prefork_server->m_iCurChildren - count ) > 1 ) { - fprintf( stderr, "Children tracking is wrong: PID: %d, Cur Children: %d, count: %d, idle: %d, dying: %d\n", getpid(), + fprintf( stderr, "Children tracking is wrong: PID: %d, Cur Children: %d, count: %d, idle: %d, dying: %d\n", getpid(), g_prefork_server->m_iCurChildren, count, idle, dying ); } @@ -2706,7 +2706,7 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, LSAPI_Re sigset_t orig_mask; lsapi_init_children_status(); - + setsid(); act.sa_flags = 0; @@ -2796,17 +2796,17 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, LSAPI_Re sigemptyset( &mask ); sigaddset( &mask, SIGCHLD ); - - if ( sigprocmask(SIG_BLOCK, &mask, &orig_mask) < 0 ) + + if ( sigprocmask(SIG_BLOCK, &mask, &orig_mask) < 0 ) { perror( "sigprocmask(SIG_BLOCK) to block SIGCHLD" ); } pid = fork(); - + if ( !pid ) { - if (sigprocmask(SIG_SETMASK, &orig_mask, NULL) < 0) + if (sigprocmask(SIG_SETMASK, &orig_mask, NULL) < 0) perror( "sigprocmask( SIG_SETMASK ) to restore SIGMASK in child" ); g_prefork_server = NULL; s_ppid = getppid(); @@ -2848,7 +2848,7 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, LSAPI_Re close( pReq->m_fd ); pReq->m_fd = -1; - if (sigprocmask(SIG_SETMASK, &orig_mask, NULL) < 0) + if (sigprocmask(SIG_SETMASK, &orig_mask, NULL) < 0) perror( "sigprocmask( SIG_SETMASK ) to restore SIGMASK" ); } @@ -2897,7 +2897,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) s_pChildStatus->m_tmWaitBegin = time( NULL ); } - + while( g_running ) { if ( pReq->m_fd != -1 ) @@ -2916,7 +2916,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) if ( !g_running ) return -1; if ((s_req_processed)&&( s_pChildStatus )&&( s_pChildStatus->m_iKillSent )) - return -1; + return -1; FD_ZERO( &readfds ); FD_SET( fd, &readfds ); timeout.tv_sec = 1; @@ -2944,7 +2944,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) else if ( ret >= 1 ) { if (s_req_processed && ( s_pChildStatus )&&( s_pChildStatus->m_iKillSent )) - return -1; + return -1; if ( fd == pReq->m_fdListen ) { pReq->m_fd = lsapi_accept( pReq->m_fdListen ); @@ -2992,7 +2992,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) LSAPI_Reset_r( pReq ); } return -1; - + } void LSAPI_Set_Max_Reqs( int reqs ) @@ -3061,19 +3061,19 @@ static void unset_lsapi_envs() #else env = environ; #endif - while( env != NULL && *env != NULL ) + while( env != NULL && *env != NULL ) { - if (!strncmp(*env, "LSAPI_", 6) || !strncmp( *env, "PHP_LSAPI_", 10 ) - || (!strncmp( *env, "PHPRC=", 6 )&&(!s_uid))) - { + if (!strncmp(*env, "LSAPI_", 6) || !strncmp( *env, "PHP_LSAPI_", 10 ) + || (!strncmp( *env, "PHPRC=", 6 )&&(!s_uid))) + { char ** del = env; - do + do *del = del[1]; while( *del++ ); } else ++env; - } + } } static int lsapi_initSuEXEC() @@ -3100,7 +3100,7 @@ static int lsapi_initSuEXEC() } p = getenv( "LSAPI_SECRET" ); if (( !p )||( readSecret(p) == -1 )) - return -1; + return -1; if ( g_prefork_server ) { if ( g_prefork_server->m_iMaxChildren < 100 ) @@ -3140,7 +3140,7 @@ int LSAPI_Init_Env_Parameters( fn_select_t fp ) if ( p ) { avoidFork = atoi( p ); - } + } p = getenv( "LSAPI_ACCEPT_NOTIFY" ); if ( p ) @@ -3149,7 +3149,7 @@ int LSAPI_Init_Env_Parameters( fn_select_t fp ) } p = getenv( "LSAPI_SLOW_REQ_MSECS" ); - if ( p ) + if ( p ) { n = atoi( p ); LSAPI_Set_Slow_Req_Msecs( n ); @@ -3199,26 +3199,26 @@ int LSAPI_Init_Env_Parameters( fn_select_t fp ) p = getenv( "LSAPI_EXTRA_CHILDREN" ); if ( p ) LSAPI_Set_Extra_Children( atoi( p ) ); - + p = getenv( "LSAPI_MAX_IDLE_CHILDREN" ); if ( p ) LSAPI_Set_Max_Idle_Children( atoi( p ) ); - + p = getenv( "LSAPI_PGRP_MAX_IDLE" ); if ( p ) { LSAPI_Set_Server_Max_Idle_Secs( atoi( p ) ); } - + p = getenv( "LSAPI_MAX_PROCESS_TIME" ); - if ( p ) + if ( p ) LSAPI_Set_Max_Process_Time( atoi( p ) ); - + if ( getenv( "LSAPI_PPID_NO_CHECK" ) ) { LSAPI_No_Check_ppid(); } - + p = getenv( "LSAPI_DUMP_DEBUG_INFO" ); if ( p ) s_dump_debug_info = atoi( p ); @@ -3234,7 +3234,7 @@ int LSAPI_Init_Env_Parameters( fn_select_t fp ) } -int LSAPI_ErrResponse_r( LSAPI_Request * pReq, int code, const char ** pRespHeaders, +int LSAPI_ErrResponse_r( LSAPI_Request * pReq, int code, const char ** pRespHeaders, const char * pBody, int bodyLen ) { LSAPI_SetRespStatus_r( pReq, code ); diff --git a/sapi/litespeed/lsapilib.h b/sapi/litespeed/lsapilib.h index cacf7d97b8..76d8a72bae 100644 --- a/sapi/litespeed/lsapilib.h +++ b/sapi/litespeed/lsapilib.h @@ -22,18 +22,18 @@ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are -met: +met: * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided - with the distribution. + with the distribution. * Neither the name of the Lite Speed Technologies Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior - written permission. + written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -45,7 +45,7 @@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -83,7 +83,7 @@ typedef struct lsapi_request char * m_pReqBuf; int m_reqBufSize; - + char * m_pRespBuf; char * m_pRespBufEnd; char * m_pRespBufPos; @@ -96,7 +96,7 @@ typedef struct lsapi_request struct iovec * m_pIovec; struct iovec * m_pIovecEnd; struct iovec * m_pIovecCur; - struct iovec * m_pIovecToWrite; + struct iovec * m_pIovecToWrite; struct lsapi_packet_header * m_respPktHeaderEnd; @@ -108,7 +108,7 @@ typedef struct lsapi_request struct lsapi_http_header_index * m_pHeaderIndex; struct lsapi_header_offset * m_pUnknownHeader; - + char * m_pScriptFile; char * m_pScriptName; char * m_pQueryString; @@ -120,9 +120,9 @@ typedef struct lsapi_request off_t m_reqBodyRead; int m_bufProcessed; int m_bufRead; - + struct lsapi_packet_header m_respPktHeader[5]; - + struct lsapi_resp_header m_respHeader; short m_respHeaderLen[LSAPI_MAX_RESP_HEADERS]; void * m_pAppData; @@ -168,7 +168,7 @@ int LSAPI_ForeachSpecialEnv_r( LSAPI_Request * pReq, LSAPI_CB_EnvHandler fn, void * arg ); char * LSAPI_GetEnv_r( LSAPI_Request * pReq, const char * name ); - + ssize_t LSAPI_ReadReqBody_r( LSAPI_Request * pReq, char * pBuf, size_t len ); @@ -189,7 +189,7 @@ int LSAPI_Flush_r( LSAPI_Request * pReq ); int LSAPI_AppendRespHeader_r( LSAPI_Request * pReq, const char * pBuf, int len ); -int LSAPI_AppendRespHeader2_r( LSAPI_Request * pReq, const char * pHeaderName, +int LSAPI_AppendRespHeader2_r( LSAPI_Request * pReq, const char * pHeaderName, const char * pHeaderValue ); int LSAPI_ErrResponse_r( LSAPI_Request * pReq, int code, const char ** pRespHeaders, @@ -331,7 +331,7 @@ static inline ssize_t LSAPI_Write( const char * pBuf, ssize_t len ) static inline ssize_t LSAPI_sendfile( int fdIn, off_t* off, size_t size ) { - return LSAPI_sendfile_r(&g_req, fdIn, off, size ); + return LSAPI_sendfile_r(&g_req, fdIn, off, size ); } static inline ssize_t LSAPI_Write_Stderr( const char * pBuf, ssize_t len ) diff --git a/sapi/milter/getopt.c b/sapi/milter/getopt.c index f5874d577e..df2c77f94c 100644 --- a/sapi/milter/getopt.c +++ b/sapi/milter/getopt.c @@ -39,7 +39,7 @@ ap_php_optiserr(int argc, char * const *argv, int oint, const char *optstr, } return('?'); } - + int ap_php_getopt(int argc, char* const *argv, const char *optstr) { static int optchr = 0; @@ -96,7 +96,7 @@ int ap_php_getopt(int argc, char* const *argv, const char *optstr) } if (cp[1] == ':') { - /* Check for cases where the value of the argument + /* Check for cases where the value of the argument is in the form -<arg> <val> or in the form -<arg><val> */ dash = 0; if(!argv[ap_php_optind][2]) { diff --git a/sapi/milter/php_milter.c b/sapi/milter/php_milter.c index 87df7898a1..03244b8d65 100644 --- a/sapi/milter/php_milter.c +++ b/sapi/milter/php_milter.c @@ -122,11 +122,11 @@ static int mlfi_init() return -1; } - + /* disable headers */ SG(headers_sent) = 1; SG(request_info).no_headers = 1; - + if (filename == NULL) { php_printf("No input file specified"); return SMFIS_TEMPFAIL; @@ -143,7 +143,7 @@ static int mlfi_init() file_handle.opened_path = NULL; php_execute_script(&file_handle); - + /* call userland */ INIT_ZVAL(function_name); @@ -160,9 +160,9 @@ static int mlfi_init() if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) { ret = Z_LVAL(retval); } - + php_request_shutdown((void *) 0); - + return ret; } /* }}} */ @@ -187,16 +187,16 @@ static sfsistat mlfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr) return SMFIS_TEMPFAIL; } - + /* disable headers */ SG(headers_sent) = 1; SG(request_info).no_headers = 1; - + if (filename == NULL) { php_printf("No input file specified"); return SMFIS_TEMPFAIL; } - + if (!(file_handle.handle.fp = VCWD_FOPEN(filename, "rb"))) { php_printf("Could not open input file: %s\n", filename); return SMFIS_TEMPFAIL; @@ -208,7 +208,7 @@ static sfsistat mlfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr) file_handle.opened_path = NULL; php_execute_script(&file_handle); - + /* call userland */ INIT_ZVAL(function_name); @@ -229,7 +229,7 @@ static sfsistat mlfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr) if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) { return Z_LVAL(retval); } - + return SMFIS_CONTINUE; } /* }}} */ @@ -244,7 +244,7 @@ static sfsistat mlfi_helo(SMFICTX *ctx, char *helohost) /* call userland */ INIT_ZVAL(function_name); - + ALLOC_ZVAL(param[0]); INIT_PZVAL(param[0]); @@ -254,16 +254,16 @@ static sfsistat mlfi_helo(SMFICTX *ctx, char *helohost) /* set the milter context for possible use in API functions */ MG(ctx) = ctx; MG(state) = MLFI_HELO; - + status = call_user_function(CG(function_table), NULL, &function_name, &retval, 1, param); MG(state) = MLFI_NONE; zval_ptr_dtor(param); - + if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) { return Z_LVAL(retval); } - + return SMFIS_CONTINUE; } /* }}} */ @@ -278,7 +278,7 @@ static sfsistat mlfi_envfrom(SMFICTX *ctx, char **argv) /* call userland */ INIT_ZVAL(function_name); - + ALLOC_ZVAL(param[0]); INIT_PZVAL(param[0]); @@ -293,12 +293,12 @@ static sfsistat mlfi_envfrom(SMFICTX *ctx, char **argv) /* set the milter context for possible use in API functions */ MG(ctx) = ctx; MG(state) = MLFI_ENVFROM; - + status = call_user_function(CG(function_table), NULL, &function_name, &retval, 1, param); MG(state) = MLFI_NONE; zval_ptr_dtor(param); - + if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) { return Z_LVAL(retval); } @@ -317,7 +317,7 @@ static sfsistat mlfi_envrcpt(SMFICTX *ctx, char **argv) /* call userland */ INIT_ZVAL(function_name); - + ALLOC_ZVAL(param[0]); INIT_PZVAL(param[0]); @@ -332,13 +332,13 @@ static sfsistat mlfi_envrcpt(SMFICTX *ctx, char **argv) /* set the milter context for possible use in API functions */ MG(ctx) = ctx; MG(state) = MLFI_ENVRCPT; - + status = call_user_function(CG(function_table), NULL, &function_name, &retval, 1, param); MG(state) = MLFI_NONE; - + zval_ptr_dtor(param); - + if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) { return Z_LVAL(retval); } @@ -357,12 +357,12 @@ static sfsistat mlfi_header(SMFICTX *ctx, char *headerf, char *headerv) /* call userland */ INIT_ZVAL(function_name); - + ALLOC_ZVAL(param[0]); ALLOC_ZVAL(param[1]); INIT_PZVAL(param[0]); INIT_PZVAL(param[1]); - + ZVAL_STRING(&function_name, "milter_header", 0); ZVAL_STRING(param[0], headerf, 1); ZVAL_STRING(param[1], headerv, 1); @@ -370,18 +370,18 @@ static sfsistat mlfi_header(SMFICTX *ctx, char *headerf, char *headerv) /* set the milter context for possible use in API functions */ MG(ctx) = ctx; MG(state) = MLFI_HEADER; - + status = call_user_function(CG(function_table), NULL, &function_name, &retval, 2, param); MG(state) = MLFI_NONE; - + zval_ptr_dtor(¶m[0]); - zval_ptr_dtor(¶m[1]); - + zval_ptr_dtor(¶m[1]); + if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) { return Z_LVAL(retval); } - + return SMFIS_CONTINUE; } /* }}} */ @@ -401,11 +401,11 @@ static sfsistat mlfi_eoh(SMFICTX *ctx) /* set the milter context for possible use in API functions */ MG(ctx) = ctx; MG(state) = MLFI_EOH; - + status = call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL); MG(state) = MLFI_NONE; - + if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) { return Z_LVAL(retval); } @@ -424,22 +424,22 @@ static sfsistat mlfi_body(SMFICTX *ctx, u_char *bodyp, size_t len) /* call userland */ INIT_ZVAL(function_name); - + ALLOC_ZVAL(param[0]); INIT_PZVAL(param[0]); ZVAL_STRING(&function_name, "milter_body", 0); ZVAL_STRINGL(param[0], (char*)bodyp, len, 1); /*alex*/ - + /* set the milter context for possible use in API functions */ MG(ctx) = ctx; MG(state) = MLFI_BODY; - + status = call_user_function(CG(function_table), NULL, &function_name, &retval, 1, param); MG(state) = MLFI_NONE; - - zval_ptr_dtor(param); + + zval_ptr_dtor(param); if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) { return Z_LVAL(retval); @@ -460,7 +460,7 @@ static sfsistat mlfi_eom(SMFICTX *ctx) /* call userland */ INIT_ZVAL(function_name); ZVAL_STRING(&function_name, "milter_eom", 0); - + /* set the milter context for possible use in API functions */ MG(ctx) = ctx; MG(state) = MLFI_EOM; @@ -468,7 +468,7 @@ static sfsistat mlfi_eom(SMFICTX *ctx) status = call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL); MG(state) = MLFI_NONE; - + if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) { return Z_LVAL(retval); } @@ -488,15 +488,15 @@ static sfsistat mlfi_abort(SMFICTX *ctx) /* call userland */ INIT_ZVAL(function_name); ZVAL_STRING(&function_name, "milter_abort", 0); - + /* set the milter context for possible use in API functions */ MG(ctx) = ctx; MG(state) = MLFI_ABORT; - + status = call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL); MG(state) = MLFI_NONE; - + if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) { return Z_LVAL(retval); } @@ -521,19 +521,19 @@ static sfsistat mlfi_close(SMFICTX *ctx) /* call userland */ INIT_ZVAL(function_name); ZVAL_STRING(&function_name, "milter_close", 0); - + /* set the milter context for possible use in API functions */ MG(ctx) = ctx; MG(state) = MLFI_CLOSE; - + status = call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL); MG(state) = MLFI_NONE; - + if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) { ret = Z_LVAL(retval); } - + php_request_shutdown((void *) 0); return ret; @@ -564,38 +564,38 @@ static struct smfiDesc smfilter = { */ /* {{{ proto void smfi_setflags(long flags) - Sets the flags describing the actions the filter may take. */ + Sets the flags describing the actions the filter may take. */ PHP_FUNCTION(smfi_setflags) { long flags; - + /* valid only in the init callback */ if (MG(state) != MLFI_INIT) { php_error(E_WARNING, NOT_INIT, get_active_function_name()); } else if (zend_parse_parameters(1, "l", &flags) == SUCCESS) { flags = flags & (SMFIF_ADDHDRS|SMFIF_CHGHDRS|SMFIF_CHGBODY|SMFIF_ADDRCPT|SMFIF_DELRCPT); smfilter.xxfi_flags = flags; - } + } } /* }}} */ /* {{{ proto void smfi_settimeout(long timeout) - Sets the number of seconds libmilter will wait for an MTA connection before timing out a socket. */ + Sets the number of seconds libmilter will wait for an MTA connection before timing out a socket. */ PHP_FUNCTION(smfi_settimeout) { long timeout; - + /* valid only in the init callback */ if (MG(state) != MLFI_INIT) { php_error(E_WARNING, NOT_INIT, get_active_function_name()); } else if (zend_parse_parameters(1, "l", &timeout) == SUCCESS) { smfi_settimeout(timeout); - } + } } /* }}} */ /* {{{ proto string smfi_getsymval(string macro) - Returns the value of the given macro or NULL if the macro is not defined. */ + Returns the value of the given macro or NULL if the macro is not defined. */ PHP_FUNCTION(smfi_getsymval) { char *symname, *ret; @@ -616,12 +616,12 @@ PHP_FUNCTION(smfi_getsymval) /* {{{ proto bool smfi_setreply(string rcode, string xcode, string message) Directly set the SMTP error reply code for this connection. - This code will be used on subsequent error replies resulting from actions taken by this filter. */ + This code will be used on subsequent error replies resulting from actions taken by this filter. */ PHP_FUNCTION(smfi_setreply) { char *rcode, *xcode, *message; int len; - + /* valid in any callback */ if (MG(state) == MLFI_NONE) { php_error(E_WARNING, IS_NONE, get_active_function_name()); @@ -630,18 +630,18 @@ PHP_FUNCTION(smfi_setreply) RETURN_TRUE; } } - + RETURN_FALSE; } /* }}} */ /* {{{ proto bool smfi_addheader(string headerf, string headerv) - Adds a header to the current message. */ + Adds a header to the current message. */ PHP_FUNCTION(smfi_addheader) { char *f, *v; int len; - + /* valid only in milter_eom */ if (MG(state) != MLFI_EOM) { php_error(E_WARNING, NOT_EOM, get_active_function_name()); @@ -650,19 +650,19 @@ PHP_FUNCTION(smfi_addheader) RETURN_TRUE; } } - + RETURN_FALSE; } /* }}} */ /* {{{ proto bool smfi_chgheader(string headerf, string headerv) - Changes a header's value for the current message. */ + Changes a header's value for the current message. */ PHP_FUNCTION(smfi_chgheader) { char *f, *v; long idx; int len; - + /* valid only in milter_eom */ if (MG(state) != MLFI_EOM) { php_error(E_WARNING, NOT_EOM, get_active_function_name()); @@ -671,18 +671,18 @@ PHP_FUNCTION(smfi_chgheader) RETURN_TRUE; } } - + RETURN_FALSE; } /* }}} */ /* {{{ proto bool smfi_addrcpt(string rcpt) - Add a recipient to the message envelope. */ + Add a recipient to the message envelope. */ PHP_FUNCTION(smfi_addrcpt) { char *rcpt; int len; - + /* valid only in milter_eom */ if (MG(state) != MLFI_EOM) { php_error(E_WARNING, NOT_EOM, get_active_function_name()); @@ -691,18 +691,18 @@ PHP_FUNCTION(smfi_addrcpt) RETURN_TRUE; } } - + RETURN_FALSE; } /* }}} */ /* {{{ proto bool smfi_delrcpt(string rcpt) - Removes the named recipient from the current message's envelope. */ + Removes the named recipient from the current message's envelope. */ PHP_FUNCTION(smfi_delrcpt) { char *rcpt; int len; - + /* valid only in milter_eom */ if (MG(state) != MLFI_EOM) { php_error(E_WARNING, NOT_EOM, get_active_function_name()); @@ -711,19 +711,19 @@ PHP_FUNCTION(smfi_delrcpt) RETURN_TRUE; } } - + RETURN_FALSE; } /* }}} */ /* {{{ proto bool smfi_replacebody(string body) Replaces the body of the current message. If called more than once, - subsequent calls result in data being appended to the new body. */ + subsequent calls result in data being appended to the new body. */ PHP_FUNCTION(smfi_replacebody) { char *body; int len; - + /* valid only in milter_eom */ if (MG(state) != MLFI_EOM) { php_error(E_WARNING, NOT_EOM, get_active_function_name()); @@ -732,7 +732,7 @@ PHP_FUNCTION(smfi_replacebody) RETURN_TRUE; } } - + RETURN_FALSE; } /* }}} */ @@ -1006,7 +1006,7 @@ int main(int argc, char *argv[]) tsrm_startup(1, 1, 0, NULL); tsrm_ls = ts_resource(0); sapi_startup(&milter_sapi_module); - + while ((c=ap_php_getopt(argc, argv, OPTSTRING))!=-1) { switch (c) { case 'c': @@ -1130,7 +1130,7 @@ int main(int argc, char *argv[]) } /* check if file exists, exit else */ - + if (dofork) { switch(fork()) { case -1: /* Uh-oh, we have a problem forking. */ @@ -1143,14 +1143,14 @@ int main(int argc, char *argv[]) exit(0); } } - + if (sock) { struct stat junk; if (stat(sock,&junk) == 0) unlink(sock); } openlog("php-milter", LOG_PID, LOG_MAIL); - + if ((exit_status = mlfi_init())) { syslog(1, "mlfi_init failed."); closelog(); @@ -1165,7 +1165,7 @@ int main(int argc, char *argv[]) goto err; } else { exit_status = smfi_main(); - } + } closelog(); diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c index c89d581a33..5fcec29277 100644 --- a/sapi/nsapi/nsapi.c +++ b/sapi/nsapi/nsapi.c @@ -62,7 +62,7 @@ #ifdef __hpux #define HPUX #endif - + /* * NSAPI includes */ @@ -233,7 +233,7 @@ nsapi_servact_prototype nsapi_servact_service = NULL; * the server only by wrapping the function table nothing else. So choose * the newest one found in process space for dynamic linking */ static char *nsapi_dlls[] = { "ns-httpd40.dll", "ns-httpd36.dll", "ns-httpd35.dll", "ns-httpd30.dll", NULL }; -/* if user specifies an other dll name by server_lib parameter +/* if user specifies an other dll name by server_lib parameter * it is placed in the following variable and only this DLL is * checked for the servact_* functions */ char *nsapi_dll = NULL; @@ -408,7 +408,7 @@ PHP_FUNCTION(nsapi_request_headers) if (zend_parse_parameters_none() == FAILURE) { return; } - + array_init(return_value); for (i=0; i < rc->rq->headers->hsize; i++) { @@ -432,7 +432,7 @@ PHP_FUNCTION(nsapi_response_headers) if (zend_parse_parameters_none() == FAILURE) { return; } - + array_init(return_value); for (i=0; i < rc->rq->srvhdrs->hsize; i++) { @@ -454,7 +454,7 @@ static int sapi_nsapi_ub_write(const char *str, unsigned int str_length) { int retval; nsapi_request_context *rc = (nsapi_request_context *)SG(server_context); - + if (!SG(headers_sent)) { sapi_send_headers(); } @@ -470,7 +470,7 @@ static int sapi_nsapi_ub_write(const char *str, unsigned int str_length) static void sapi_nsapi_flush(void *server_context) { nsapi_request_context *rc = (nsapi_request_context *)server_context; - + if (!rc) { /* we have no context, so no flushing needed. This fixes a SIGSEGV on shutdown */ return; @@ -493,7 +493,7 @@ static int php_nsapi_remove_header(sapi_header_struct *sapi_header) { char *header_name, *p; nsapi_request_context *rc = (nsapi_request_context *)SG(server_context); - + /* copy the header, because NSAPI needs reformatting and we do not want to change the parameter */ header_name = pool_strdup(rc->sn->pool, sapi_header->header); @@ -501,16 +501,16 @@ static int php_nsapi_remove_header(sapi_header_struct *sapi_header) if (p = strchr(header_name, ':')) { *p = 0; } - + /* header_name to lower case because NSAPI reformats the headers and wants lowercase */ for (p=header_name; *p; p++) { *p=tolower(*p); } - + /* remove the header */ param_free(pblock_remove(header_name, rc->rq->srvhdrs)); pool_free(rc->sn->pool, header_name); - + return ZEND_HASH_APPLY_KEEP; } @@ -542,7 +542,7 @@ static int sapi_nsapi_header_handler(sapi_header_struct *sapi_header, sapi_heade do { header_content++; } while (*header_content==' '); - + /* header_name to lower case because NSAPI reformats the headers and wants lowercase */ for (p=header_name; *p; p++) { *p=tolower(*p); @@ -555,10 +555,10 @@ static int sapi_nsapi_header_handler(sapi_header_struct *sapi_header, sapi_heade /* ADD header to nsapi table */ pblock_nvinsert(header_name, header_content, rc->rq->srvhdrs); } - + pool_free(rc->sn->pool, header_name); return SAPI_HEADER_ADD; - + default: return 0; } @@ -746,7 +746,7 @@ static void sapi_nsapi_register_server_variables(zval *track_vars_array) /* Create full Request-URI & Script-Name */ if (SG(request_info).request_uri) { pos = strlen(SG(request_info).request_uri); - + if (SG(request_info).query_string) { spprintf(&value, 0, "%s?%s", SG(request_info).request_uri, SG(request_info).query_string); if (value) { @@ -877,13 +877,13 @@ void NSAPI_PUBLIC php7_close(void *vparam) if (nsapi_sapi_module.php_ini_path_override) { free(nsapi_sapi_module.php_ini_path_override); } - + #ifdef PHP_WIN32 if (nsapi_dll) { free(nsapi_dll); nsapi_dll = NULL; } -#endif +#endif sapi_shutdown(); tsrm_shutdown(); @@ -921,14 +921,14 @@ int NSAPI_PUBLIC php7_init(pblock *pb, Session *sn, Request *rq) if (strval = pblock_findval("php_ini", pb)) { nsapi_sapi_module.php_ini_path_override = strdup(strval); } - + #ifdef PHP_WIN32 /* look if server_lib parameter is given to php7_init * (this disables the automatic search for the newest ns-httpdXX.dll) */ if (strval = pblock_findval("server_lib", pb)) { nsapi_dll = strdup(strval); } -#endif +#endif /* start SAPI */ sapi_startup(&nsapi_sapi_module); @@ -1025,7 +1025,7 @@ int NSAPI_PUBLIC php7_execute(pblock *pb, Session *sn, Request *rq) SG(request_info).content_type = content_type; SG(request_info).content_length = (content_length == NULL) ? 0 : strtoul(content_length, 0, 0); SG(sapi_headers).http_response_code = (error_directive) ? rq->status_num : 200; - + nsapi_php_ini_entries(NSLS_C); php_handle_auth_data(pblock_findval("authorization", rq->headers)); diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index f249f57b87..1155855146 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -164,7 +164,7 @@ static void php_phpdbg_destroy_bp_condition(zval *data) /* {{{ */ if (brake) { if (brake->ops) { - + destroy_op_array(brake->ops); efree(brake->ops); } @@ -304,7 +304,7 @@ static PHP_FUNCTION(phpdbg_break_next) if (zend_parse_parameters_none() == FAILURE && EG(current_execute_data)) { return; } - + phpdbg_set_breakpoint_opline_ex((phpdbg_opline_ptr_t) EG(current_execute_data)->opline + 1); } /* }}} */ @@ -314,7 +314,7 @@ static PHP_FUNCTION(phpdbg_break_file) char *file = NULL; size_t flen = 0; long line; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &file, &flen, &line) == FAILURE) { return; } @@ -327,7 +327,7 @@ static PHP_FUNCTION(phpdbg_break_method) { char *class = NULL, *method = NULL; size_t clen = 0, mlen = 0; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &class, &clen, &method, &mlen) == FAILURE) { return; } @@ -340,7 +340,7 @@ static PHP_FUNCTION(phpdbg_break_function) { char *function = NULL; size_t function_len; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &function, &function_len) == FAILURE) { return; } @@ -516,7 +516,7 @@ static void php_sapi_phpdbg_log_message(char *message) /* {{{ */ case E_PARSE: case E_RECOVERABLE_ERROR: { const char *file_char = zend_get_executed_filename(); - zend_string *file = zend_string_init(file_char, strlen(file_char), 0); + zend_string *file = zend_string_init(file_char, strlen(file_char), 0); phpdbg_list_file(file, 3, zend_get_executed_lineno() - 1, zend_get_executed_lineno()); efree(file); @@ -1204,7 +1204,7 @@ phpdbg_main: } break; } } - + /* set exec if present on command line */ if (!exec && (argc > php_optind) && (strcmp(argv[php_optind-1], "--") != SUCCESS)) { if (strlen(argv[php_optind])) { @@ -1391,7 +1391,7 @@ phpdbg_main: PHPDBG_G(io)[PHPDBG_STDOUT].fd = fileno(stdout); #else /* XXX this is a complete mess here with FILE/fd/SOCKET, - we should let only one to survive probably. Need + we should let only one to survive probably. Need a clean separation whether it's a remote or local prompt. And what is supposed to go as user interaction, error log, etc. */ @@ -1462,7 +1462,7 @@ phpdbg_main: } } zend_end_try(); PHPDBG_G(flags) &= ~PHPDBG_IS_INITIALIZING; - + /* quit if init says so */ if (PHPDBG_G(flags) & PHPDBG_IS_QUITTING) { goto phpdbg_out; @@ -1521,16 +1521,16 @@ phpdbg_interact: if (!cleaning) { /* remote client disconnected */ if ((PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED)) { - + if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE) { /* renegociate connections */ phpdbg_remote_init(address, listen, server, &socket, &stream); - + /* set streams */ if (stream) { PHPDBG_G(flags) &= ~PHPDBG_IS_QUITTING; } - + /* this must be forced */ CG(unclean_shutdown) = 0; } else { @@ -1550,10 +1550,10 @@ phpdbg_interact: /* this must be forced */ CG(unclean_shutdown) = 0; - + /* this is just helpful */ PG(report_memleaks) = 0; - + #ifndef _WIN32 phpdbg_out: if ((PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED)) { diff --git a/sapi/phpdbg/phpdbg.h b/sapi/phpdbg/phpdbg.h index 672e75f814..99b65c9cf1 100644 --- a/sapi/phpdbg/phpdbg.h +++ b/sapi/phpdbg/phpdbg.h @@ -56,8 +56,8 @@ # include "config.w32.h" # undef strcasecmp # undef strncasecmp -# define strcasecmp _stricmp -# define strncasecmp _strnicmp +# define strcasecmp _stricmp +# define strncasecmp _strnicmp #else # include "php_config.h" #endif diff --git a/sapi/phpdbg/phpdbg_cmd.c b/sapi/phpdbg/phpdbg_cmd.c index d2196040db..e4d2e925b6 100644 --- a/sapi/phpdbg/phpdbg_cmd.c +++ b/sapi/phpdbg/phpdbg_cmd.c @@ -462,7 +462,7 @@ PHPDBG_API int phpdbg_stack_verify(const phpdbg_command_t *command, phpdbg_param return SUCCESS; } - phpdbg_error("command", "type=\"toomanyargs\" command=\"%s\" expected=\"0\"", "The command \"%s\" expected no arguments", + phpdbg_error("command", "type=\"toomanyargs\" command=\"%s\" expected=\"0\"", "The command \"%s\" expected no arguments", phpdbg_command_name(command, buffer)); return FAILURE; } diff --git a/sapi/phpdbg/phpdbg_eol.c b/sapi/phpdbg/phpdbg_eol.c index 47643aae8d..3ae65670dc 100644 --- a/sapi/phpdbg/phpdbg_eol.c +++ b/sapi/phpdbg/phpdbg_eol.c @@ -124,7 +124,7 @@ void phpdbg_eol_convert(char **str, int *len) out[cursor] = cur; last = cur; } - + i++; cursor++; cur = in[i]; diff --git a/sapi/phpdbg/phpdbg_help.c b/sapi/phpdbg/phpdbg_help.c index fefde149e3..d8da2b6721 100644 --- a/sapi/phpdbg/phpdbg_help.c +++ b/sapi/phpdbg/phpdbg_help.c @@ -245,7 +245,7 @@ PHPDBG_COMMAND(help) /* {{{ */ n = get_command( param->str, param->len, &cmd, phpdbg_help_commands); if (n>0) { - if (cmd->alias == 'a') { /* help aliases executes a canned routine */ + if (cmd->alias == 'a') { /* help aliases executes a canned routine */ return cmd->handler(param); } else { pretty_print(get_help(cmd->name)); @@ -320,7 +320,7 @@ PHPDBG_HELP(aliases) /* {{{ */ * Also note the convention that help text not directly referenceable as a help param * has a key ending in ! */ -#define CR "\n" +#define CR "\n" phpdbg_help_text_t phpdbg_help_text[] = { /******************************** General Help Topics ********************************/ @@ -332,7 +332,7 @@ phpdbg_help_text_t phpdbg_help_text[] = { " **list** list PHP source" CR " **info** displays information on the debug session" CR " **print** show opcodes" CR -" **frame** select a stack frame and print a stack frame summary" CR +" **frame** select a stack frame and print a stack frame summary" CR " **back** shows the current backtrace" CR " **help** provide help on a topic" CR CR @@ -412,10 +412,10 @@ phpdbg_help_text_t phpdbg_help_text[] = { "Debugger scripts can also be executed using the **source** command." CR CR "A script file can contain a sequence of valid debugger commands, comments and embedded PHP " -"code. " CR CR +"code. " CR CR "Comment lines are prefixed by the **#** character. Note that comments are only allowed in script " -"files and not in interactive sessions." CR CR +"files and not in interactive sessions." CR CR "PHP code is delimited by the start and end escape tags **<:** and **:>**. PHP code can be used " "to define application context for a debugging session and also to extend the debugger by defining " @@ -608,7 +608,7 @@ phpdbg_help_text_t phpdbg_help_text[] = { }, {"exec", -"The **exec** command sets the execution context, that is the script to be executed. The " +"The **exec** command sets the execution context, that is the script to be executed. The " "execution context must be defined either by executing the **exec** command or by using the " "**-e** command line option." CR CR diff --git a/sapi/phpdbg/phpdbg_io.c b/sapi/phpdbg/phpdbg_io.c index 6d74230d20..f58c23f9ce 100644 --- a/sapi/phpdbg/phpdbg_io.c +++ b/sapi/phpdbg/phpdbg_io.c @@ -59,7 +59,7 @@ PHPDBG_API int phpdbg_consume_stdin_line(char *buf) { do { int i; - if (bytes <= 0) { + if (bytes <= 0) { continue; } @@ -293,7 +293,7 @@ PHPDBG_API int phpdbg_create_listenable_socket(const char *addr, unsigned short write(PHPDBG_G(io)[PHPDBG_STDERR].fd, buf, strlen(buf)); return sock; - } + } if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*) &reuse, sizeof(reuse)) == -1) { phpdbg_close_socket(sock); diff --git a/sapi/phpdbg/phpdbg_lexer.c b/sapi/phpdbg/phpdbg_lexer.c index 76dfc393b8..d1474dc252 100644 --- a/sapi/phpdbg/phpdbg_lexer.c +++ b/sapi/phpdbg/phpdbg_lexer.c @@ -65,38 +65,38 @@ restart: yyc_INITIAL: { static const unsigned char yybm[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 192, 96, 0, 0, 192, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 192, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 192, 96, 0, 0, 192, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 192, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, }; YYDEBUG(0, *YYCURSOR); @@ -345,38 +345,38 @@ yy29: yyc_NORMAL: { static const unsigned char yybm[] = { - 0, 8, 8, 8, 8, 8, 8, 8, - 8, 66, 68, 8, 8, 66, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 66, 8, 8, 0, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 24, 8, - 152, 152, 152, 152, 152, 152, 152, 152, - 152, 152, 0, 8, 8, 8, 8, 8, - 8, 168, 168, 168, 168, 168, 168, 40, - 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 8, 8, 8, 8, 8, - 8, 168, 168, 168, 168, 168, 168, 40, - 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, + 0, 8, 8, 8, 8, 8, 8, 8, + 8, 66, 68, 8, 8, 66, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 66, 8, 8, 0, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 24, 8, + 152, 152, 152, 152, 152, 152, 152, 152, + 152, 152, 0, 8, 8, 8, 8, 8, + 8, 168, 168, 168, 168, 168, 168, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 8, 8, 8, 8, 8, + 8, 168, 168, 168, 168, 168, 168, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, }; YYDEBUG(31, *YYCURSOR); YYFILL(11); @@ -529,7 +529,7 @@ yy41: phpdbg_init_param(yylval, STR_PARAM); yylval->str = zend_strndup(yytext, yyleng); yylval->len = yyleng; - return T_ID; + return T_ID; } #line 536 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_lexer.c" yy42: @@ -858,7 +858,7 @@ yy81: #line 102 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_lexer.l" { phpdbg_init_param(yylval, NUMERIC_PARAM); - yylval->num = 1; + yylval->num = 1; return T_TRUTHY; } #line 866 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_lexer.c" @@ -1196,38 +1196,38 @@ yy121: yyc_PRE_RAW: { static const unsigned char yybm[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 160, 48, 0, 0, 160, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 160, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 64, 0, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 160, 48, 0, 0, 160, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 160, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 64, 0, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, }; YYDEBUG(123, *YYCURSOR); YYFILL(2); @@ -1383,38 +1383,38 @@ yy142: yyc_RAW: { static const unsigned char yybm[] = { - 0, 128, 128, 128, 128, 128, 128, 128, - 128, 160, 64, 128, 128, 160, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 160, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, + 0, 128, 128, 128, 128, 128, 128, 128, + 128, 160, 64, 128, 128, 160, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 160, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, }; YYDEBUG(144, *YYCURSOR); YYFILL(1); diff --git a/sapi/phpdbg/phpdbg_lexer.l b/sapi/phpdbg/phpdbg_lexer.l index 45d7c27fa5..b9cdc65d22 100644 --- a/sapi/phpdbg/phpdbg_lexer.l +++ b/sapi/phpdbg/phpdbg_lexer.l @@ -100,7 +100,7 @@ INPUT [^\n\000]+ <NORMAL>({T_YES}|{T_ON}|{T_ENABLED}|{T_TRUE}){WS} { phpdbg_init_param(yylval, NUMERIC_PARAM); - yylval->num = 1; + yylval->num = 1; return T_TRUTHY; } @@ -133,7 +133,7 @@ INPUT [^\n\000]+ phpdbg_init_param(yylval, STR_PARAM); yylval->str = zend_strndup(yytext, yyleng); yylval->len = yyleng; - return T_ID; + return T_ID; } <RAW>{INPUT} { diff --git a/sapi/phpdbg/phpdbg_parser.c b/sapi/phpdbg/phpdbg_parser.c index 61f98b0cb6..ed976f0b3f 100644 --- a/sapi/phpdbg/phpdbg_parser.c +++ b/sapi/phpdbg/phpdbg_parser.c @@ -2,20 +2,20 @@ /* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -28,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -78,14 +78,14 @@ /* Line 189 of yacc.c */ #line 1 "sapi/phpdbg/phpdbg_parser.y" - + /* * phpdbg_parser.y * (from php-src root) * flex sapi/phpdbg/dev/phpdbg_lexer.l * bison sapi/phpdbg/dev/phpdbg_parser.y */ - + #include "phpdbg.h" #include "phpdbg_cmd.h" #include "phpdbg_utils.h" @@ -867,7 +867,7 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - + #if YYERROR_VERBOSE @@ -1078,7 +1078,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar) } } #endif /* YYERROR_VERBOSE */ - + /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -1436,7 +1436,7 @@ yyreduce: /* Line 1455 of yacc.c */ #line 77 "sapi/phpdbg/phpdbg_parser.y" - { + { (yyval).type = FILE_PARAM; (yyval).file.name = (yyvsp[(2) - (3)]).str; (yyval).file.line = (yyvsp[(3) - (3)]).num; @@ -1490,7 +1490,7 @@ yyreduce: /* Line 1455 of yacc.c */ #line 107 "sapi/phpdbg/phpdbg_parser.y" - { + { (yyval).type = METHOD_PARAM; (yyval).method.class = (yyvsp[(1) - (3)]).str; (yyval).method.name = (yyvsp[(3) - (3)]).str; @@ -1501,11 +1501,11 @@ yyreduce: /* Line 1455 of yacc.c */ #line 112 "sapi/phpdbg/phpdbg_parser.y" - { + { (yyval).type = NUMERIC_METHOD_PARAM; (yyval).method.class = (yyvsp[(1) - (5)]).str; (yyval).method.name = (yyvsp[(3) - (5)]).str; - (yyval).num = (yyvsp[(5) - (5)]).num; + (yyval).num = (yyvsp[(5) - (5)]).num; ;} break; @@ -1517,7 +1517,7 @@ yyreduce: (yyval).type = NUMERIC_FUNCTION_PARAM; (yyval).str = (yyvsp[(1) - (3)]).str; (yyval).len = (yyvsp[(1) - (3)]).len; - (yyval).num = (yyvsp[(3) - (3)]).num; + (yyval).num = (yyvsp[(3) - (3)]).num; ;} break; @@ -1526,7 +1526,7 @@ yyreduce: /* Line 1455 of yacc.c */ #line 124 "sapi/phpdbg/phpdbg_parser.y" { - (yyval).type = COND_PARAM; + (yyval).type = COND_PARAM; (yyval).str = (yyvsp[(2) - (2)]).str; (yyval).len = (yyvsp[(2) - (2)]).len; ;} @@ -1592,8 +1592,8 @@ yyreduce: /* Line 1455 of yacc.c */ #line 144 "sapi/phpdbg/phpdbg_parser.y" - { - (yyval).type = EVAL_PARAM; + { + (yyval).type = EVAL_PARAM; (yyval).str = (yyvsp[(3) - (3)]).str; (yyval).len = (yyvsp[(3) - (3)]).len; ;} @@ -1603,8 +1603,8 @@ yyreduce: /* Line 1455 of yacc.c */ #line 149 "sapi/phpdbg/phpdbg_parser.y" - { - (yyval).type = SHELL_PARAM; + { + (yyval).type = SHELL_PARAM; (yyval).str = (yyvsp[(3) - (3)]).str; (yyval).len = (yyvsp[(3) - (3)]).len; ;} @@ -1624,8 +1624,8 @@ yyreduce: /* Line 1455 of yacc.c */ #line 158 "sapi/phpdbg/phpdbg_parser.y" - { - (yyval).type = RUN_PARAM; + { + (yyval).type = RUN_PARAM; (yyval).str = (yyvsp[(3) - (3)]).str; (yyval).len = (yyvsp[(3) - (3)]).len; ;} @@ -1854,7 +1854,7 @@ static int yyerror(const char *msg) { { const phpdbg_param_t *top = PHPDBG_G(parser_stack); - + while (top) { phpdbg_param_debug(top, "--> "); top = top->next; diff --git a/sapi/phpdbg/phpdbg_parser.h b/sapi/phpdbg/phpdbg_parser.h index be201fef96..0c66b27dc0 100644 --- a/sapi/phpdbg/phpdbg_parser.h +++ b/sapi/phpdbg/phpdbg_parser.h @@ -2,20 +2,20 @@ /* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C - + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -28,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ diff --git a/sapi/phpdbg/phpdbg_parser.y b/sapi/phpdbg/phpdbg_parser.y index 18d23b834f..8b3ab27f85 100644 --- a/sapi/phpdbg/phpdbg_parser.y +++ b/sapi/phpdbg/phpdbg_parser.y @@ -1,12 +1,12 @@ %{ - + /* * phpdbg_parser.y * (from php-src root) * flex sapi/phpdbg/dev/phpdbg_lexer.l * bison sapi/phpdbg/dev/phpdbg_parser.y */ - + #include "phpdbg.h" #include "phpdbg_cmd.h" #include "phpdbg_utils.h" @@ -27,7 +27,7 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg); %pure-parser %error-verbose - + %code requires { #include "phpdbg.h" #ifndef YY_TYPEDEF_YY_SCANNER_T @@ -74,7 +74,7 @@ parameters ; parameter - : T_ID T_COLON T_DIGITS { + : T_ID T_COLON T_DIGITS { $$.type = FILE_PARAM; $$.file.name = $2.str; $$.file.line = $3.num; @@ -104,25 +104,25 @@ parameter } $$.file.line = $5.num; } - | T_ID T_DCOLON T_ID { + | T_ID T_DCOLON T_ID { $$.type = METHOD_PARAM; $$.method.class = $1.str; $$.method.name = $3.str; } - | T_ID T_DCOLON T_ID T_POUND T_DIGITS { + | T_ID T_DCOLON T_ID T_POUND T_DIGITS { $$.type = NUMERIC_METHOD_PARAM; $$.method.class = $1.str; $$.method.name = $3.str; - $$.num = $5.num; + $$.num = $5.num; } | T_ID T_POUND T_DIGITS { $$.type = NUMERIC_FUNCTION_PARAM; $$.str = $1.str; $$.len = $1.len; - $$.num = $3.num; + $$.num = $3.num; } | T_IF T_INPUT { - $$.type = COND_PARAM; + $$.type = COND_PARAM; $$.str = $2.str; $$.len = $2.len; } @@ -141,13 +141,13 @@ req_id ; full_expression - : T_EVAL req_id T_INPUT { - $$.type = EVAL_PARAM; + : T_EVAL req_id T_INPUT { + $$.type = EVAL_PARAM; $$.str = $3.str; $$.len = $3.len; } - | T_SHELL req_id T_INPUT { - $$.type = SHELL_PARAM; + | T_SHELL req_id T_INPUT { + $$.type = SHELL_PARAM; $$.str = $3.str; $$.len = $3.len; } @@ -155,8 +155,8 @@ full_expression $$.type = RUN_PARAM; $$.len = 0; } - | T_RUN req_id T_INPUT { - $$.type = RUN_PARAM; + | T_RUN req_id T_INPUT { + $$.type = RUN_PARAM; $$.str = $3.str; $$.len = $3.len; } @@ -169,7 +169,7 @@ static int yyerror(const char *msg) { { const phpdbg_param_t *top = PHPDBG_G(parser_stack); - + while (top) { phpdbg_param_debug(top, "--> "); top = top->next; diff --git a/sapi/phpdbg/phpdbg_win.c b/sapi/phpdbg/phpdbg_win.c index 5ad99cb0ef..a7f292bcb1 100644 --- a/sapi/phpdbg/phpdbg_win.c +++ b/sapi/phpdbg/phpdbg_win.c @@ -31,7 +31,7 @@ int phpdbg_exception_handler_win32(EXCEPTION_POINTERS *xp) { CONTEXT *xc = xp->ContextRecord; if(xr->ExceptionCode == EXCEPTION_ACCESS_VIOLATION) { - + if (phpdbg_watchpoint_segfault_handler((void *)xr->ExceptionInformation[1]) == SUCCESS) { return EXCEPTION_CONTINUE_EXECUTION; } diff --git a/sapi/phpdbg/phpdbg_win.h b/sapi/phpdbg/phpdbg_win.h index 68c3052790..a5a7d442f9 100644 --- a/sapi/phpdbg/phpdbg_win.h +++ b/sapi/phpdbg/phpdbg_win.h @@ -34,4 +34,4 @@ void phpdbg_win_set_mm_heap(zend_mm_heap *heap); int phpdbg_exception_handler_win32(EXCEPTION_POINTERS *xp); -#endif
\ No newline at end of file +#endif diff --git a/sapi/phttpd/phttpd.c b/sapi/phttpd/phttpd.c index 81c17c3c49..27ea0fbfa2 100644 --- a/sapi/phttpd/phttpd.c +++ b/sapi/phttpd/phttpd.c @@ -24,7 +24,7 @@ #ifdef HAVE_PHTTPD #include "ext/standard/info.h" - + #ifndef ZTS #error PHTTPD module is only useable in thread-safe mode #endif @@ -34,7 +34,7 @@ typedef struct { struct connectioninfo *cip; struct stat sb; -} phttpd_globals_struct; +} phttpd_globals_struct; static int ph_globals_id; @@ -71,12 +71,12 @@ php_phttpd_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_str { char *header_name, *header_content; char *p; - + http_sendheaders(PHG(cip)->fd, PHG(cip), SG(sapi_headers).http_response_code, NULL); header_name = sapi_header->header; header_content = p = strchr(header_name, ':'); - + if (p) { *p = '\0'; do { @@ -84,7 +84,7 @@ php_phttpd_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_str } while (*header_content == ' '); fd_printf(PHG(cip)->fd,"%s: %s\n", header_name, header_content); - + *p = ':'; } @@ -99,9 +99,9 @@ php_phttpd_sapi_send_headers(sapi_headers_struct *sapi_headers) if (SG(sapi_headers).send_default_content_type) { fd_printf(PHG(cip)->fd,"Content-Type: text/html\n"); } - + fd_putc('\n', PHG(cip)->fd); - + return SAPI_HEADER_SENT_SUCCESSFULLY; } @@ -112,16 +112,16 @@ php_phttpd_sapi_read_cookies(void) /* int i; char *http_cookie = NULL; - + i = Ns_SetIFind(NSG(conn->headers), "cookie"); if(i != -1) { http_cookie = Ns_SetValue(NSG(conn->headers), i); } - + return http_cookie; */ fprintf(stderr,"***php_phttpd_sapi_read_cookies\n"); - + return 0; } @@ -131,17 +131,17 @@ php_phttpd_sapi_read_post(char *buf, uint count_bytes) /* uint max_read; uint total_read = 0; - + max_read = MIN(NSG(data_avail), count_bytes); - + total_read = Ns_ConnRead(NSG(conn), buf, max_read); - + if(total_read == NS_ERROR) { total_read = -1; } else { NSG(data_avail) -= total_read; } - + return total_read; */ fprintf(stderr,"***php_phttpd_sapi_read_post\n"); @@ -151,10 +151,10 @@ php_phttpd_sapi_read_post(char *buf, uint count_bytes) static sapi_module_struct phttpd_sapi_module = { "phttpd", "PHTTPD", - + php_phttpd_startup, /* startup */ php_module_shutdown_wrapper, /* shutdown */ - + NULL, /* activate */ NULL, /* deactivate */ @@ -164,14 +164,14 @@ static sapi_module_struct phttpd_sapi_module = { NULL, /* getenv */ php_error, /* error handler */ - + php_phttpd_sapi_header_handler, /* header handler */ php_phttpd_sapi_send_headers, /* send headers handler */ NULL, /* send header handler */ - + php_phttpd_sapi_read_post, /* read POST data */ php_phttpd_sapi_read_cookies, /* read Cookies */ - + NULL, /* register server variables */ NULL, /* Log message */ NULL, /* Get request time */ @@ -199,12 +199,12 @@ php_phttpd_request_ctor(void) char *root; int index; char *tmp; - + server = Ns_ConnServer(NSG(conn)); - + Ns_DStringInit(&ds); Ns_UrlToFile(&ds, server, NSG(conn->request->url)); - + /* path_translated is the absolute path to the file */ SG(request_info).path_translated = strdup(Ns_DStringValue(&ds)); Ns_DStringFree(&ds); @@ -214,19 +214,19 @@ php_phttpd_request_ctor(void) index = Ns_SetIFind(NSG(conn)->headers, "content-type"); SG(request_info).content_type = index == -1 ? NULL : Ns_SetValue(NSG(conn)->headers, index); - + tmp = Ns_ConnAuthUser(NSG(conn)); if(tmp) { tmp = estrdup(tmp); } SG(request_info).auth_user = tmp; - + tmp = Ns_ConnAuthPasswd(NSG(conn)); if(tmp) { tmp = estrdup(tmp); } SG(request_info).auth_password = tmp; - + NSG(data_avail) = SG(request_info).content_length; #endif } @@ -282,16 +282,16 @@ int pm_request(struct connectioninfo *cip) struct httpinfo *hip = cip->hip; int status; - if (strcasecmp(hip->method, "GET") == 0 || + if (strcasecmp(hip->method, "GET") == 0 || strcasecmp(hip->method, "HEAD") == 0 || strcasecmp(hip->method, "POST") == 0) { PHG(cip) = cip; - + php_phttpd_request_ctor(); status = php_doit(); php_phttpd_request_dtor(); - return status; + return status; } else { return -2; } diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c index cabd3c19a9..640797ea96 100644 --- a/sapi/pi3web/pi3web_sapi.c +++ b/sapi/pi3web/pi3web_sapi.c @@ -52,7 +52,7 @@ static void php_info_pi3web(ZEND_MODULE_INFO_FUNC_ARGS) DWORD variable_len; LPCONTROL_BLOCK lpCB = (LPCONTROL_BLOCK) SG(server_context); PIDB *pDB = (PIDB *)lpCB->GetVariableNames(lpCB->ConnID); - PIDBIterator *pIter = PIDB_getIterator( pDB, PIDBTYPE_STRING, 0, 0 ); + PIDBIterator *pIter = PIDB_getIterator( pDB, PIDBTYPE_STRING, 0, 0 ); PUTS("<table border=0 cellpadding=3 cellspacing=1 width=600 align=center>\n"); PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">Pi3Web Server Information</th></tr>\n"); @@ -71,7 +71,7 @@ static void php_info_pi3web(ZEND_MODULE_INFO_FUNC_ARGS) php_info_print_table_row(2, "Server PID", variable_buf); php_info_print_table_row(2, "Server Platform", PIPlatform_getDescription()); - PUTS("</table><br />"); + PUTS("</table><br />"); PUTS("<table border=0 cellpadding=3 cellspacing=1 width=600 align=center>\n"); PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Request Information</th></tr>\n"); @@ -81,10 +81,10 @@ static void php_info_pi3web(ZEND_MODULE_INFO_FUNC_ARGS) /* --- loop over all registered server variables --- */ for(; pIter && PIDBIterator_atValidElement( pIter ); PIDBIterator_next( pIter ) ) - { + { PCHAR pKey; PIDBIterator_current( pIter, &pKey ); - if ( !pKey ) { /* sanity */ continue; }; + if ( !pKey ) { /* sanity */ continue; }; variable_len = PI3WEB_SERVER_VAR_BUF_SIZE; if (lpCB->GetServerVariable(lpCB->ConnID, pKey, variable_buf, &variable_len) @@ -124,7 +124,7 @@ static int zend_pi3web_ub_write(const char *str, uint str_length) { DWORD num_bytes = str_length; LPCONTROL_BLOCK cb; - + cb = (LPCONTROL_BLOCK) SG(server_context); if ( !IWasLoaded ) return 0; @@ -165,7 +165,7 @@ static int sapi_pi3web_send_headers(sapi_headers_struct *sapi_headers) char *combined_headers, *combined_headers_ptr; LPCONTROL_BLOCK lpCB = (LPCONTROL_BLOCK) SG(server_context); sapi_header_struct default_content_type; - + if ( !IWasLoaded ) return SAPI_HEADER_SENT_SUCCESSFULLY; @@ -235,7 +235,7 @@ static int sapi_pi3web_read_post(char *buffer, uint count_bytes) } total_read += cbRead; } - + /* removed after re-testing POST with Pi3Web 2.0.2 */ /* SG(read_post_bytes) += total_read; */ return total_read; @@ -284,14 +284,14 @@ static void sapi_pi3web_register_variables(zval *track_vars_array) DWORD variable_len = PI3WEB_SERVER_VAR_BUF_SIZE; LPCONTROL_BLOCK lpCB = (LPCONTROL_BLOCK) SG(server_context); PIDB *pDB = (PIDB *)lpCB->GetVariableNames(lpCB->ConnID); - PIDBIterator *pIter = PIDB_getIterator( pDB, PIDBTYPE_STRING, 0, 0 ); + PIDBIterator *pIter = PIDB_getIterator( pDB, PIDBTYPE_STRING, 0, 0 ); - /* --- loop over all registered server variables --- */ + /* --- loop over all registered server variables --- */ for(; pIter && PIDBIterator_atValidElement( pIter ); PIDBIterator_next( pIter ) ) - { + { PCHAR pKey; PIDBIterator_current( pIter, &pKey ); - if ( !pKey ) { /* sanity */ continue; }; + if ( !pKey ) { /* sanity */ continue; }; variable_len = PI3WEB_SERVER_VAR_BUF_SIZE; if (lpCB->GetServerVariable(lpCB->ConnID, pKey, static_variable_buf, &variable_len) @@ -379,7 +379,7 @@ MODULE_API DWORD PHP7_wrapper(LPCONTROL_BLOCK lpCB) ctr.line = "Content-Type: text/plain"; ctr.line_len = strlen(ctr.line); - + sapi_header_op(SAPI_HEADER_REPLACE, &ctr); } if ( open_file_for_scanning( &file_handle ) == SUCCESS ) diff --git a/sapi/pi3web/pi3web_sapi.h b/sapi/pi3web/pi3web_sapi.h index 83f483d924..70eec611b4 100644 --- a/sapi/pi3web/pi3web_sapi.h +++ b/sapi/pi3web/pi3web_sapi.h @@ -4,9 +4,9 @@ #ifdef PHP_WIN32 # include <windows.h> # ifdef PHP7PI3WEB_EXPORTS -# define MODULE_API __declspec(dllexport) +# define MODULE_API __declspec(dllexport) # else -# define MODULE_API __declspec(dllimport) +# define MODULE_API __declspec(dllimport) # endif #else # if defined(__GNUC__) && __GNUC__ >= 4 diff --git a/sapi/roxen/roxen.c b/sapi/roxen/roxen.c index 35ae0201dc..52282de838 100644 --- a/sapi/roxen/roxen.c +++ b/sapi/roxen/roxen.c @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ @@ -25,7 +25,7 @@ #include "php_ini.h" #include "php_globals.h" #include "SAPI.h" -#include "php_main.h" +#include "php_main.h" #include "ext/standard/info.h" #include "php_version.h" @@ -36,7 +36,7 @@ #endif -/* Pike Include Files +/* Pike Include Files * * conflicts with pike avoided by only using long names. Requires a new * Pike 0.7 since it was implemented for this interface only. @@ -95,7 +95,7 @@ static php_roxen_request *current_request = NULL; # define THIS current_request #endif -/* File descriptor integer. Used to write directly to the FD without +/* File descriptor integer. Used to write directly to the FD without * passing Pike */ #define MY_FD (THIS->my_fd) @@ -121,10 +121,10 @@ static PIKE_MUTEX_T roxen_php_execution_lock; # define PHP_UNLOCK(X) mt_unlock(&roxen_php_execution_lock); # define PHP_DESTROY() mt_destroy(&roxen_php_execution_lock) #else /* !_REENTRANT */ -# define PHP_INIT_LOCK() +# define PHP_INIT_LOCK() # define PHP_LOCK(X) # define PHP_UNLOCK(X) -# define PHP_DESTROY() +# define PHP_DESTROY() #endif /* _REENTRANT */ extern int fd_from_object(struct object *o); @@ -153,7 +153,7 @@ struct program *php_program; /* To avoid executing a PHP script from a PHP callback, which would * create a deadlock, a global thread id is used. If the thread calling the - * php-script is the same as the current thread, it fails. + * php-script is the same as the current thread, it fails. */ static int current_thread = -1; @@ -161,7 +161,7 @@ static int current_thread = -1; /* Low level header lookup. Basically looks for the named header in the mapping * headers in the supplied options mapping. */ - + static INLINE struct svalue *lookup_header(char *headername) { struct svalue *headers, *value; @@ -264,7 +264,7 @@ php_roxen_sapi_ub_write(const char *str, uint str_length) PG(connection_status) = PHP_CONNECTION_ABORTED; zend_bailout(); return sent_bytes; - case EINTR: + case EINTR: case EWOULDBLOCK: continue; } @@ -300,7 +300,7 @@ static void php_roxen_set_header(char *header_name, char *value, char *p) s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind); if(!s_headermap) { - struct svalue mappie; + struct svalue mappie; mappie.type = PIKE_T_MAPPING; headermap = allocate_mapping(1); mappie.u.mapping = headermap; @@ -319,7 +319,7 @@ static void php_roxen_set_header(char *header_name, char *value, char *p) } /* - * php_roxen_sapi_header_handler() sets a HTTP reply header to be + * php_roxen_sapi_header_handler() sets a HTTP reply header to be * sent to the client. */ static int @@ -329,7 +329,7 @@ php_roxen_sapi_header_handler(sapi_header_struct *sapi_header, char *header_name, *header_content, *p; header_name = sapi_header->header; header_content = p = strchr(header_name, ':'); - + if(p) { do { header_content++; @@ -359,10 +359,10 @@ php_roxen_low_send_headers(sapi_headers_struct *sapi_headers) zend_bailout(); return SAPI_HEADER_SEND_FAILED; } - ind = make_shared_string(" _headers"); + ind = make_shared_string(" _headers"); s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind); free_string(ind); - + push_int(SG(sapi_headers).http_response_code); if(s_headermap && s_headermap->type == PIKE_T_MAPPING) ref_push_mapping(s_headermap->u.mapping); @@ -370,7 +370,7 @@ php_roxen_low_send_headers(sapi_headers_struct *sapi_headers) push_int(0); safe_apply(MY_FD_OBJ, "send_headers", 2); pop_stack(); - + return SAPI_HEADER_SENT_SUCCESSFULLY; } @@ -393,7 +393,7 @@ INLINE static int php_roxen_low_read_post(char *buf, uint count_bytes) #ifdef ROXEN_USE_ZTS GET_THIS(); #endif - + if(!MY_FD_OBJ->prog) { PG(connection_status) = PHP_CONNECTION_ABORTED; @@ -420,11 +420,11 @@ php_roxen_sapi_read_post(char *buf, uint count_bytes) return total_read; } -/* +/* * php_roxen_sapi_read_cookies() returns the Cookie header from * the HTTP request header */ - + static char * php_roxen_sapi_read_cookies(void) { @@ -447,7 +447,7 @@ static void php_info_roxen(ZEND_MODULE_INFO_FUNC_ARGS) php_info_print_table_row(2, "Server platform", Ns_InfoPlatform()); snprintf(buf, 511, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion()); php_info_print_table_row(2, "Server version", buf); - snprintf(buf, 511, "%d day(s), %02d:%02d:%02d", + snprintf(buf, 511, "%d day(s), %02d:%02d:%02d", uptime / 86400, (uptime / 3600) % 24, (uptime / 60) % 60, @@ -550,13 +550,13 @@ php_roxen_hash_environment(void) zvalue->type = IS_STRING; zvalue->value.str.len = val->u.string->len; zvalue->value.str.val = estrndup(val->u.string->str, zvalue->value.str.len); - + zend_hash_update(&EG(symbol_table), buf, buf_len + 1, &zvalue, sizeof(zval *), NULL); } } free_array(indices); } - + /* MAKE_STD_ZVAL(zvalue); zvalue->type = IS_LONG; @@ -613,13 +613,13 @@ void f_php_roxen_request_handler(INT32 args) #ifdef ROXEN_USE_ZTS GET_THIS(); #endif - + if(current_thread == th_self()) php_error(E_WARNING, "PHP7.Interpreter->run: Tried to run a PHP-script from a PHP " "callback!"); get_all_args("PHP7.Interpreter->run", args, "%S%m%O%*", &script, &request_data, &my_fd_obj, &done_callback); - if(done_callback->type != PIKE_T_FUNCTION) + if(done_callback->type != PIKE_T_FUNCTION) php_error(E_WARNING, "PHP7.Interpreter->run: Bad argument 4, expected function.\n"); PHP_LOCK(THIS); /* Need to lock here or reusing the same object might cause * problems in changing stuff in that object */ @@ -646,10 +646,10 @@ void f_php_roxen_request_handler(INT32 args) SG(request_info).content_type = lookup_string_header("HTTP_CONTENT_TYPE", NULL); SG(sapi_headers).http_response_code = 200; - /* FIXME: Check for auth stuff needs to be fixed... */ - SG(request_info).auth_user = NULL; + /* FIXME: Check for auth stuff needs to be fixed... */ + SG(request_info).auth_user = NULL; SG(request_info).auth_password = NULL; - + ind = make_shared_binary_string("my_fd", 5); raw_fd = low_mapping_string_lookup(THIS->request_data, ind); if(raw_fd && raw_fd->type == PIKE_T_OBJECT) @@ -660,10 +660,10 @@ void f_php_roxen_request_handler(INT32 args) THIS->my_fd = fd; } else THIS->my_fd = 0; - + status = php_roxen_module_main(); current_thread = -1; - + apply_svalue(done_callback, 0); pop_stack(); pop_n_elems(args); @@ -692,7 +692,7 @@ void pike_module_init( void ) tsrm_startup(1, 1, 0, NULL); #ifdef ROXEN_USE_ZTS ts_allocate_id(&roxen_globals_id, sizeof(php_roxen_request), NULL, NULL); -#endif +#endif #endif sapi_startup(&roxen_sapi_module); /*php_roxen_startup(&roxen_sapi_module); removed - should be called from SAPI activation*/ diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c index 3d2e24b3d6..e18569478c 100644 --- a/sapi/thttpd/thttpd.c +++ b/sapi/thttpd/thttpd.c @@ -68,12 +68,12 @@ static int sapi_thttpd_ub_write(const char *str, uint str_length) { int n; uint sent = 0; - + if (TG(sbuf).c != 0) { smart_str_appendl_ex(&TG(sbuf), str, str_length, 1); return str_length; } - + while (str_length > 0) { PHP_SYS_CALL(n = send(TG(hc)->conn_fd, str, str_length, 0);); @@ -148,7 +148,7 @@ static int do_writev(struct iovec *vec, int nvec, int len) smart_str_appendl_ex(&TG(sbuf), vec->iov_base, vec->iov_len, 1); } } - + return 0; } @@ -178,15 +178,15 @@ static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers) zend_llist_position pos; sapi_header_struct *h; size_t len = 0; - + if (!SG(sapi_headers).http_status_line) { ADD_VEC_S("HTTP/1.1 "); - p = zend_print_long_to_buf(buf+sizeof(buf)-1, + p = zend_print_long_to_buf(buf+sizeof(buf)-1, SG(sapi_headers).http_response_code); ADD_VEC(p, strlen(p)); ADD_VEC_S(" HTTP\r\n"); } else { - ADD_VEC(SG(sapi_headers).http_status_line, + ADD_VEC(SG(sapi_headers).http_status_line, strlen(SG(sapi_headers).http_status_line)); ADD_VEC("\r\n", 2); } @@ -198,7 +198,7 @@ static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers) h = zend_llist_get_first_ex(&sapi_headers->headers, &pos); while (h) { - + switch (h->header[0]) { case 'c': case 'C': if (!TG(seen_cl) && strncasecmp(h->header, CL_TOKEN, sizeof(CL_TOKEN)-1) == 0) { @@ -216,7 +216,7 @@ static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers) } #endif ADD_VEC("\r\n", 2); - + h = zend_llist_get_next_ex(&sapi_headers->headers, &pos); } @@ -226,12 +226,12 @@ static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers) TG(hc)->do_keep_alive = 0; ADD_VEC(KA_NO, sizeof(KA_NO)-1); } - + ADD_VEC("\r\n", 2); #ifdef SERIALIZE_HEADERS sapi_thttpd_ub_write(vec_str.c, vec_str.len); -#else +#else do_writev(vec, n, len); #endif @@ -255,7 +255,7 @@ static int sapi_thttpd_read_post(char *buffer, uint count_bytes) TG(unconsumed_length) -= read_bytes; CONSUME_BYTES(read_bytes); } - + return read_bytes; } @@ -287,8 +287,8 @@ static void sapi_thttpd_register_variables(zval *track_vars_array) php_register_variable("SERVER_PROTOCOL", "HTTP/1.0", track_vars_array); } - p = httpd_ntoa(&TG(hc)->client_addr); - + p = httpd_ntoa(&TG(hc)->client_addr); + ADD_STRING_EX("REMOTE_ADDR", p); ADD_STRING_EX("REMOTE_HOST", p); @@ -323,7 +323,7 @@ static void sapi_thttpd_register_variables(zval *track_vars_array) if (TG(hc)->contentlength != -1) { ADD_STRING_EX("CONTENT_LENGTH", - zend_print_long_to_buf(buf + sizeof(buf) - 1, + zend_print_long_to_buf(buf + sizeof(buf) - 1, TG(hc)->contentlength)); } @@ -372,10 +372,10 @@ static int sapi_thttpd_get_fd(int *nfd) static sapi_module_struct thttpd_sapi_module = { "thttpd", "thttpd", - + php_thttpd_startup, php_module_shutdown_wrapper, - + NULL, /* activate */ NULL, /* deactivate */ @@ -385,7 +385,7 @@ static sapi_module_struct thttpd_sapi_module = { NULL, /* getenv */ php_error, - + NULL, sapi_thttpd_send_headers, NULL, @@ -415,7 +415,7 @@ static void thttpd_module_main(int show_source) if (php_request_startup() == FAILURE) { return; } - + if (show_source) { zend_syntax_highlighter_ini syntax_highlighter_ini; @@ -429,7 +429,7 @@ static void thttpd_module_main(int show_source) php_execute_script(&file_handle); } - + php_request_shutdown(NULL); } @@ -446,7 +446,7 @@ static void thttpd_request_ctor(void) smart_str_appends_ex(&s, TG(hc)->expnfilename, 1); smart_str_0(&s); SG(request_info).path_translated = s.c; - + s.c = NULL; smart_str_appendc_ex(&s, '/', 1); smart_str_appends_ex(&s, TG(hc)->origfilename, 1); @@ -462,7 +462,7 @@ static void thttpd_request_ctor(void) : TG(hc)->contentlength; TG(unconsumed_length) = SG(request_info).content_length; - + php_handle_auth_data(TG(hc)->authorization); } @@ -528,7 +528,7 @@ static httpd_conn *duplicate_conn(httpd_conn *hc, httpd_conn *nhc) #define HANDLE_STR(m) nhc->m = nhc->m ? strdup(nhc->m) : NULL HANDLE_STRINGS(); #undef HANDLE_STR - + return nhc; } @@ -543,7 +543,7 @@ static httpd_conn *dequeue_request(void) { httpd_conn *ret = NULL; qreq_t *m; - + tsrm_mutex_lock(qr_lock); if (queued_requests) { m = queued_requests; @@ -553,7 +553,7 @@ static httpd_conn *dequeue_request(void) free(m); } tsrm_mutex_unlock(qr_lock); - + return ret; } @@ -563,7 +563,7 @@ static void queue_request(httpd_conn *hc) { qreq_t *m; httpd_conn *nhc; - + /* Mark as long-running request */ hc->file_address = (char *) 1; @@ -573,17 +573,17 @@ static void queue_request(httpd_conn *hc) */ nhc = malloc(sizeof *nhc); duplicate_conn(hc, nhc); - + /* Allocate request queue container */ m = malloc(sizeof *m); m->hc = nhc; m->next = NULL; - + tsrm_mutex_lock(qr_lock); /* Create new threads when reaching a certain threshold */ if (nr_threads < max_threads && nr_free_threads < 2) { nr_threads++; /* protected by qr_lock */ - + thread_atomic_inc(nr_free_threads); thread_create_simple_detached(worker_thread); } @@ -663,13 +663,13 @@ static off_t thttpd_real_php_request(httpd_conn *hc, int show_source) hc->should_linger = 1; hc->do_keep_alive = 0; } - + if (hc->contentlength != -1 && SIZEOF_UNCONSUMED_BYTES() < hc->contentlength) { hc->read_body_into_mem = 1; return 0; } - + thttpd_request_ctor(); thttpd_module_main(show_source); @@ -678,11 +678,11 @@ static off_t thttpd_real_php_request(httpd_conn *hc, int show_source) if (TG(seen_cl) == 0 || TG(seen_cn) == 1) { TG(hc)->do_keep_alive = 0; } - + if (TG(sbuf).c != 0) { if (TG(hc)->response) free(TG(hc)->response); - + TG(hc)->response = TG(sbuf).c; TG(hc)->responselen = TG(sbuf).len; TG(hc)->maxresponse = TG(sbuf).a; @@ -706,7 +706,7 @@ off_t thttpd_php_request(httpd_conn *hc, int show_source) #endif } -void thttpd_register_on_close(void (*arg)(int)) +void thttpd_register_on_close(void (*arg)(int)) { TG(on_close) = arg; } @@ -746,9 +746,9 @@ void thttpd_php_init(void) sapi_startup(&thttpd_sapi_module); thttpd_sapi_module.startup(&thttpd_sapi_module); - + { - + SG(server_context) = (void *) 1; } } diff --git a/sapi/tux/php_tux.c b/sapi/tux/php_tux.c index 8af7da40fa..bf60e04106 100644 --- a/sapi/tux/php_tux.c +++ b/sapi/tux/php_tux.c @@ -54,15 +54,15 @@ static int sapi_tux_ub_write(const char *str, uint str_length) int n; int m; const char *estr; - + /* combine headers and body */ if (TG(number_vec)) { struct iovec *vec = TG(header_vec); - + n = TG(number_vec); vec[n].iov_base = (void *) str; vec[n++].iov_len = str_length; - + /* XXX: this might need more complete error handling */ if ((m = writev(TG(req)->sock, vec, n)) == -1 && errno == EPIPE) php_handle_aborted_connection(); @@ -75,7 +75,7 @@ static int sapi_tux_ub_write(const char *str, uint str_length) } estr = str + str_length; - + while (str < estr) { n = send(TG(req)->sock, str, estr - str, 0); @@ -83,14 +83,14 @@ static int sapi_tux_ub_write(const char *str, uint str_length) php_handle_aborted_connection(); if (n == -1 && errno == EAGAIN) continue; - if (n <= 0) + if (n <= 0) return n; str += n; } n = str_length - (estr - str); - + TG(req)->bytes_sent += n; return n; @@ -107,34 +107,34 @@ static int sapi_tux_send_headers(sapi_headers_struct *sapi_headers) size_t len; char *status_line; int locate_cl; - + max_headers = 30; n = 1; - + vec = malloc(sizeof(struct iovec) * max_headers); status_line = malloc(30); - + /* safe sprintf use */ len = slprintf(status_line, 30, "HTTP/1.1 %d NA\r\n", SG(sapi_headers).http_response_code); - + vec[0].iov_base = status_line; vec[0].iov_len = len; - + TG(req)->http_status = SG(sapi_headers).http_response_code; if (TG(tux_action) == TUX_ACTION_FINISH_CLOSE_REQ && TG(req)->http_version == HTTP_1_1) locate_cl = 1; else locate_cl = 0; - + h = zend_llist_get_first_ex(&sapi_headers->headers, &pos); while (h) { - if (locate_cl + if (locate_cl && strncasecmp(h->header, "Content-length:", sizeof("Content-length:")-1) == 0) { TG(tux_action) = TUX_ACTION_FINISH_REQ; locate_cl = 0; } - + vec[n].iov_base = h->header; vec[n++].iov_len = h->header_len; if (n >= max_headers - 3) { @@ -143,7 +143,7 @@ static int sapi_tux_send_headers(sapi_headers_struct *sapi_headers) } vec[n].iov_base = "\r\n"; vec[n++].iov_len = 2; - + h = zend_llist_get_next_ex(&sapi_headers->headers, &pos); } @@ -153,7 +153,7 @@ static int sapi_tux_send_headers(sapi_headers_struct *sapi_headers) TG(number_vec) = n; TG(header_vec) = vec; - + return SAPI_HEADER_SENT_SUCCESSFULLY; } @@ -168,7 +168,7 @@ static int sapi_tux_read_post(char *buffer, uint count_bytes) return 0; TG(read_post_data) = 1; - + return TG(req)->objectlen; #else return 0; @@ -189,11 +189,11 @@ static void sapi_tux_register_variables(zval *track_vars_array) char buf[BUF_SIZE + 1]; char *p; sapi_header_line ctr = {0}; - + ctr.line = buf; ctr.line_len = slprintf(buf, sizeof(buf), "Server: %s", TUXAPI_version); sapi_header_op(SAPI_HEADER_REPLACE, &ctr); - + php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array); php_register_variable("SERVER_SOFTWARE", TUXAPI_version, track_vars_array); php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", track_vars_array); @@ -261,10 +261,10 @@ static int php_tux_startup(sapi_module_struct *sapi_module) static sapi_module_struct tux_sapi_module = { "tux", "tux", - + php_tux_startup, php_module_shutdown_wrapper, - + NULL, /* activate */ NULL, /* deactivate */ @@ -274,7 +274,7 @@ static sapi_module_struct tux_sapi_module = { NULL, /* getenv */ php_error, - + NULL, sapi_tux_send_headers, NULL, @@ -301,7 +301,7 @@ static void tux_module_main(void) if (php_request_startup() == FAILURE) { return; } - + php_execute_script(&file_handle); php_request_shutdown(NULL); } @@ -315,7 +315,7 @@ static void tux_request_ctor(void) smart_str s = {0}; char *p; - TG(number_vec) = 0; + TG(number_vec) = 0; TG(header_vec) = NULL; SG(request_info).query_string = strdup(TG(req)->query); @@ -326,7 +326,7 @@ static void tux_request_ctor(void) if (p) *p = '\0'; SG(request_info).path_translated = s.c; - + s.c = NULL; smart_str_appendc_ex(&s, '/', 1); smart_str_appends_ex(&s, TG(req)->objectname, 1); @@ -362,14 +362,14 @@ static void *separate_thread(void *bla) { int fd; int i = 0; - + fd = (int) bla; while (i++ < 5) { send(fd, "test<br />\n", 9, 0); sleep(1); } - + tux(TUX_ACTION_CONTINUE_REQ, (user_req_t *) fd); /* We HAVE to trigger some event on the fd. Otherwise fast_thread won't wake up, so that the eventloop @@ -386,10 +386,10 @@ int TUXAPI_handle_events(user_req_t *req) tux_closed_conn(req->sock); return tux(TUX_ACTION_FINISH_CLOSE_REQ, req); } - + TG(req) = req; TG(tux_action) = TUX_ACTION_FINISH_CLOSE_REQ; - + tux_request_ctor(); tux_module_main(); @@ -399,7 +399,7 @@ int TUXAPI_handle_events(user_req_t *req) return tux(TG(tux_action), req); } -void tux_register_on_close(void (*arg)(int)) +void tux_register_on_close(void (*arg)(int)) { TG(on_close) = arg; } @@ -412,7 +412,7 @@ void tux_closed_conn(int fd) int tux_get_fd(void) { - + return TG(req)->sock; } diff --git a/sapi/webjames/webjames.c b/sapi/webjames/webjames.c index 914855928a..25387c16b5 100644 --- a/sapi/webjames/webjames.c +++ b/sapi/webjames/webjames.c @@ -137,7 +137,7 @@ static void sapi_webjames_register_variables(zval *track_vars_array) ADD_FIELD("PHP_SELF", uri); ADD_FIELD("QUERY_STRING", args); - + snprintf(buf, BUF_SIZE, "%d.%d.%d.%d", WG(conn)->ipaddr[0], WG(conn)->ipaddr[1], WG(conn)->ipaddr[2], WG(conn)->ipaddr[3]); ADD_STRING("REMOTE_ADDR", buf); if (WG(conn)->dnsstatus == DNS_OK) ADD_FIELD("REMOTE_HOST", host); @@ -211,7 +211,7 @@ static void webjames_module_main(void) if (php_request_startup() == FAILURE) { return; } - + php_execute_script(&file_handle); php_request_shutdown(NULL); } @@ -258,7 +258,7 @@ static zend_module_entry php_webjames_module = { NULL, php_info_webjames, #if ZEND_MODULE_API_NO >= 20010901 - WEBJAMES_SAPI_VERSION, + WEBJAMES_SAPI_VERSION, #endif STANDARD_MODULE_PROPERTIES }; |