mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
No functional change: simple detabbing of indented code.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332305 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -46,7 +46,7 @@ static const command_rec authn_default_cmds[] =
|
||||
OR_AUTHCFG,
|
||||
"Set to 'Off' to allow access control to be passed along to "
|
||||
"lower modules if the UserID is not known to this module. "
|
||||
"(default is On)."),
|
||||
"(default is On)."),
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ static int authenticate_no_user(request_rec *r)
|
||||
const char *type;
|
||||
|
||||
if (!(type = ap_auth_type(r))) {
|
||||
return DECLINED;
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
/* fill in the r->user field */
|
||||
@@ -74,7 +74,7 @@ static int authenticate_no_user(request_rec *r)
|
||||
}
|
||||
|
||||
if (conf->authoritative == 0) {
|
||||
return DECLINED;
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||
|
@@ -246,7 +246,7 @@ static void authn_ldap_build_filter(char *filtbuf,
|
||||
*q++ = '5';
|
||||
*q++ = 'c';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
*q++ = *p++;
|
||||
|
@@ -76,5 +76,5 @@ void _NonAppStop( void )
|
||||
|
||||
int _NonAppCheckUnload( void )
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@@ -113,7 +113,7 @@ struct seclistenup_rec {
|
||||
struct NWSSLSrvConfigRec {
|
||||
apr_table_t *sltable;
|
||||
apr_table_t *slutable;
|
||||
apr_pool_t *pPool;
|
||||
apr_pool_t *pPool;
|
||||
};
|
||||
|
||||
struct secsocket_data {
|
||||
@@ -311,9 +311,9 @@ static int make_secure_socket(apr_pool_t *pconf, const struct sockaddr_in *serve
|
||||
|
||||
int convert_secure_socket(conn_rec *c, apr_socket_t *csd)
|
||||
{
|
||||
int rcode;
|
||||
struct tlsclientopts sWS2Opts;
|
||||
struct nwtlsopts sNWTLSOpts;
|
||||
int rcode;
|
||||
struct tlsclientopts sWS2Opts;
|
||||
struct nwtlsopts sNWTLSOpts;
|
||||
struct sslserveropts opts;
|
||||
unsigned long ulFlags;
|
||||
SOCKET sock;
|
||||
@@ -322,22 +322,22 @@ int convert_secure_socket(conn_rec *c, apr_socket_t *csd)
|
||||
apr_os_sock_get(&sock, csd);
|
||||
|
||||
/* zero out buffers */
|
||||
memset((char *)&sWS2Opts, 0, sizeof(struct tlsclientopts));
|
||||
memset((char *)&sNWTLSOpts, 0, sizeof(struct nwtlsopts));
|
||||
memset((char *)&sWS2Opts, 0, sizeof(struct tlsclientopts));
|
||||
memset((char *)&sNWTLSOpts, 0, sizeof(struct nwtlsopts));
|
||||
|
||||
/* turn on ssl for the socket */
|
||||
ulFlags = (numcerts ? SO_TLS_ENABLE : SO_TLS_ENABLE | SO_TLS_BLIND_ACCEPT);
|
||||
rcode = WSAIoctl(sock, SO_TLS_SET_FLAGS, &ulFlags, sizeof(unsigned long),
|
||||
ulFlags = (numcerts ? SO_TLS_ENABLE : SO_TLS_ENABLE | SO_TLS_BLIND_ACCEPT);
|
||||
rcode = WSAIoctl(sock, SO_TLS_SET_FLAGS, &ulFlags, sizeof(unsigned long),
|
||||
NULL, 0, NULL, NULL, NULL);
|
||||
if (SOCKET_ERROR == rcode)
|
||||
{
|
||||
if (SOCKET_ERROR == rcode)
|
||||
{
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, c->base_server,
|
||||
"Error: %d with ioctlsocket(flag SO_TLS_ENABLE)", WSAGetLastError());
|
||||
return rcode;
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
ulFlags = SO_TLS_UNCLEAN_SHUTDOWN;
|
||||
WSAIoctl(sock, SO_TLS_SET_FLAGS, &ulFlags, sizeof(unsigned long),
|
||||
WSAIoctl(sock, SO_TLS_SET_FLAGS, &ulFlags, sizeof(unsigned long),
|
||||
NULL, 0, NULL, NULL, NULL);
|
||||
|
||||
/* setup the socket for SSL */
|
||||
@@ -365,11 +365,11 @@ int convert_secure_socket(conn_rec *c, apr_socket_t *csd)
|
||||
NULL, NULL);
|
||||
|
||||
/* make sure that it was successfull */
|
||||
if(SOCKET_ERROR == rcode ){
|
||||
if(SOCKET_ERROR == rcode ){
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, c->base_server,
|
||||
"Error: %d with ioctl (SO_TLS_SET_CLIENT)", WSAGetLastError());
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
int SSLize_Socket(SOCKET socketHnd, char *key, request_rec *r)
|
||||
@@ -879,19 +879,19 @@ static int isSecureConnUpgradeable (const server_rec *s, const conn_rec *c)
|
||||
|
||||
static int isSecure (const request_rec *r)
|
||||
{
|
||||
return isSecureConn (r->server, r->connection);
|
||||
return isSecureConn (r->server, r->connection);
|
||||
}
|
||||
|
||||
static int isSecureUpgradeable (const request_rec *r)
|
||||
{
|
||||
return isSecureConnUpgradeable (r->server, r->connection);
|
||||
return isSecureConnUpgradeable (r->server, r->connection);
|
||||
}
|
||||
|
||||
static int isSecureUpgraded (const request_rec *r)
|
||||
{
|
||||
secsocket_data *csd_data = (secsocket_data*)ap_get_module_config(r->connection->conn_config, &nwssl_module);
|
||||
|
||||
return csd_data->is_secure;
|
||||
return csd_data->is_secure;
|
||||
}
|
||||
|
||||
static int nwssl_hook_Fixup(request_rec *r)
|
||||
@@ -1053,14 +1053,14 @@ char *ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r,
|
||||
*/
|
||||
if (result == NULL && c != NULL) {
|
||||
|
||||
/* XXX-Can't get specific SSL info from NetWare */
|
||||
/* XXX-Can't get specific SSL info from NetWare */
|
||||
/* SSLConnRec *sslconn = myConnConfig(c);
|
||||
if (strlen(var) > 4 && strcEQn(var, "SSL_", 4)
|
||||
&& sslconn && sslconn->ssl)
|
||||
result = ssl_var_lookup_ssl(p, c, var+4);*/
|
||||
|
||||
if (strlen(var) > 4 && strcEQn(var, "SSL_", 4))
|
||||
result = NULL;
|
||||
if (strlen(var) > 4 && strcEQn(var, "SSL_", 4))
|
||||
result = NULL;
|
||||
else if (strcEQ(var, "REMOTE_ADDR"))
|
||||
result = c->remote_ip;
|
||||
}
|
||||
@@ -1070,7 +1070,7 @@ char *ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r,
|
||||
*/
|
||||
if (result == NULL) {
|
||||
if (strlen(var) > 12 && strcEQn(var, "SSL_VERSION_", 12))
|
||||
result = NULL;
|
||||
result = NULL;
|
||||
/* XXX-Can't get specific SSL info from NetWare */
|
||||
/*result = ssl_var_lookup_ssl_version(p, var+12);*/
|
||||
else if (strcEQ(var, "SERVER_SOFTWARE"))
|
||||
|
@@ -136,20 +136,20 @@ static const char *isapi_cmd_cachefile(cmd_parms *cmd, void *dummy,
|
||||
*/
|
||||
fspec = ap_server_root_relative(cmd->pool, filename);
|
||||
if (!fspec) {
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, APR_EBADPATH, cmd->server,
|
||||
"ISAPI: invalid module path, skipping %s", filename);
|
||||
return NULL;
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, APR_EBADPATH, cmd->server,
|
||||
"ISAPI: invalid module path, skipping %s", filename);
|
||||
return NULL;
|
||||
}
|
||||
if ((rv = apr_stat(&tmp, fspec, APR_FINFO_TYPE,
|
||||
cmd->temp_pool)) != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, rv, cmd->server,
|
||||
"ISAPI: unable to stat, skipping %s", fspec);
|
||||
return NULL;
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, rv, cmd->server,
|
||||
"ISAPI: unable to stat, skipping %s", fspec);
|
||||
return NULL;
|
||||
}
|
||||
if (tmp.filetype != APR_REG) {
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
|
||||
"ISAPI: not a regular file, skipping %s", fspec);
|
||||
return NULL;
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
|
||||
"ISAPI: not a regular file, skipping %s", fspec);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Load the extention as cached (with null request_rec) */
|
||||
@@ -157,7 +157,7 @@ static const char *isapi_cmd_cachefile(cmd_parms *cmd, void *dummy,
|
||||
if (rv != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, rv, cmd->server,
|
||||
"ISAPI: unable to cache, skipping %s", fspec);
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -874,12 +874,12 @@ int APR_THREAD_FUNC ServerSupportFunction(isapi_cid *cid,
|
||||
apr_bucket_brigade *bb;
|
||||
apr_bucket *b;
|
||||
bb = apr_brigade_create(cid->r->pool, c->bucket_alloc);
|
||||
b = apr_bucket_transient_create((char*) data_type + ate,
|
||||
b = apr_bucket_transient_create((char*) data_type + ate,
|
||||
headlen - ate, c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||
b = apr_bucket_flush_create(c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||
ap_pass_brigade(cid->r->output_filters, bb);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||
ap_pass_brigade(cid->r->output_filters, bb);
|
||||
cid->response_sent = 1;
|
||||
}
|
||||
return 1;
|
||||
@@ -1274,13 +1274,13 @@ int APR_THREAD_FUNC ServerSupportFunction(isapi_cid *cid,
|
||||
apr_bucket_brigade *bb;
|
||||
apr_bucket *b;
|
||||
bb = apr_brigade_create(cid->r->pool, c->bucket_alloc);
|
||||
b = apr_bucket_transient_create(shi->pszHeader + ate,
|
||||
b = apr_bucket_transient_create(shi->pszHeader + ate,
|
||||
shi->cchHeader - ate,
|
||||
c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||
b = apr_bucket_flush_create(c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||
ap_pass_brigade(cid->r->output_filters, bb);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||
ap_pass_brigade(cid->r->output_filters, bb);
|
||||
cid->response_sent = 1;
|
||||
}
|
||||
return 1;
|
||||
@@ -1608,8 +1608,8 @@ static int isapi_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte
|
||||
|
||||
apr_pool_create_ex(&loaded.pool, pconf, NULL, NULL);
|
||||
if (!loaded.pool) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, NULL,
|
||||
"ISAPI: could not create the isapi cache pool");
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, NULL,
|
||||
"ISAPI: could not create the isapi cache pool");
|
||||
return APR_EGENERAL;
|
||||
}
|
||||
|
||||
|
24
modules/cache/cache_hash.c
vendored
24
modules/cache/cache_hash.c
vendored
@@ -114,9 +114,9 @@ CACHE_DECLARE(cache_hash_index_t *) cache_hash_next(cache_hash_index_t *hi)
|
||||
{
|
||||
hi->this = hi->next;
|
||||
while (!hi->this) {
|
||||
if (hi->index > hi->ht->max)
|
||||
return NULL;
|
||||
hi->this = hi->ht->array[hi->index++];
|
||||
if (hi->index > hi->ht->max)
|
||||
return NULL;
|
||||
hi->this = hi->ht->array[hi->index++];
|
||||
}
|
||||
hi->next = hi->this->next;
|
||||
return hi;
|
||||
@@ -216,15 +216,15 @@ static cache_hash_entry_t **find_entry(cache_hash_t *ht,
|
||||
|
||||
/* scan linked list */
|
||||
for (hep = &ht->array[hash % ht->max], he = *hep;
|
||||
he;
|
||||
hep = &he->next, he = *hep) {
|
||||
if (he->hash == hash &&
|
||||
he->klen == klen &&
|
||||
memcmp(he->key, key, klen) == 0)
|
||||
break;
|
||||
he;
|
||||
hep = &he->next, he = *hep) {
|
||||
if (he->hash == hash &&
|
||||
he->klen == klen &&
|
||||
memcmp(he->key, key, klen) == 0)
|
||||
break;
|
||||
}
|
||||
if (he || !val)
|
||||
return hep;
|
||||
return hep;
|
||||
/* add a new entry for non-NULL values */
|
||||
he = malloc(sizeof(*he));
|
||||
if (!he) {
|
||||
@@ -247,9 +247,9 @@ CACHE_DECLARE(void *) cache_hash_get(cache_hash_t *ht,
|
||||
cache_hash_entry_t *he;
|
||||
he = *find_entry(ht, key, klen, NULL);
|
||||
if (he)
|
||||
return (void *)he->val;
|
||||
return (void *)he->val;
|
||||
else
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CACHE_DECLARE(void *) cache_hash_set(cache_hash_t *ht,
|
||||
|
6
modules/cache/cache_util.c
vendored
6
modules/cache/cache_util.c
vendored
@@ -209,9 +209,9 @@ CACHE_DECLARE(int) ap_cache_check_freshness(cache_handle_t *h,
|
||||
|| ap_cache_liststr(NULL, cc_req, "no-cache", NULL)) {
|
||||
|
||||
if (!conf->ignorecachecontrol) {
|
||||
/* Treat as stale, causing revalidation */
|
||||
return 0;
|
||||
}
|
||||
/* Treat as stale, causing revalidation */
|
||||
return 0;
|
||||
}
|
||||
|
||||
ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
|
||||
"Incoming request is asking for a uncached version of "
|
||||
|
34
modules/cache/mod_file_cache.c
vendored
34
modules/cache/mod_file_cache.c
vendored
@@ -43,9 +43,9 @@
|
||||
cachefile directives into your configuration to direct files to
|
||||
be cached.
|
||||
|
||||
cachefile /path/to/file1
|
||||
cachefile /path/to/file2
|
||||
...
|
||||
cachefile /path/to/file1
|
||||
cachefile /path/to/file2
|
||||
...
|
||||
|
||||
These files are only cached when the server is restarted, so if you
|
||||
change the list, or if the files are changed, then you'll need to
|
||||
@@ -138,23 +138,23 @@ static void cache_the_file(cmd_parms *cmd, const char *filename, int mmap)
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, APR_EBADPATH, cmd->server,
|
||||
"mod_file_cache: invalid file path "
|
||||
"%s, skipping", filename);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if ((rc = apr_stat(&tmp.finfo, fspec, APR_FINFO_MIN,
|
||||
cmd->temp_pool)) != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server,
|
||||
"mod_file_cache: unable to stat(%s), skipping", fspec);
|
||||
return;
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server,
|
||||
"mod_file_cache: unable to stat(%s), skipping", fspec);
|
||||
return;
|
||||
}
|
||||
if (tmp.finfo.filetype != APR_REG) {
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
|
||||
"mod_file_cache: %s isn't a regular file, skipping", fspec);
|
||||
return;
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
|
||||
"mod_file_cache: %s isn't a regular file, skipping", fspec);
|
||||
return;
|
||||
}
|
||||
if (tmp.finfo.size > AP_MAX_SENDFILE) {
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
|
||||
"mod_file_cache: %s is too large to cache, skipping", fspec);
|
||||
return;
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
|
||||
"mod_file_cache: %s is too large to cache, skipping", fspec);
|
||||
return;
|
||||
}
|
||||
|
||||
rc = apr_file_open(&fd, fspec, APR_READ | APR_BINARY | APR_XTHREAD,
|
||||
@@ -162,7 +162,7 @@ static void cache_the_file(cmd_parms *cmd, const char *filename, int mmap)
|
||||
if (rc != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server,
|
||||
"mod_file_cache: unable to open(%s, O_RDONLY), skipping", fspec);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
apr_file_inherit_set(fd);
|
||||
|
||||
@@ -248,12 +248,12 @@ static int file_cache_xlat(request_rec *r)
|
||||
|
||||
/* we only operate when at least one cachefile directive was used */
|
||||
if (!apr_hash_count(sconf->fileht)) {
|
||||
return DECLINED;
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
res = ap_core_translate(r);
|
||||
if (res != OK || !r->filename) {
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
/* search the cache */
|
||||
@@ -329,7 +329,7 @@ static int file_cache_handler(request_rec *r)
|
||||
match = ap_get_module_config(r->request_config, &file_cache_module);
|
||||
|
||||
if (match == NULL) {
|
||||
return DECLINED;
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
/* note that we would handle GET on this resource */
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -93,15 +93,15 @@ DAV_DECLARE(int) dav_do_find_liveprop(const char *ns_uri, const char *name,
|
||||
if (strcmp(ns_uri, uris[ns]) == 0)
|
||||
break;
|
||||
if (uris[ns] == NULL) {
|
||||
/* not our property (the namespace matched none of ours) */
|
||||
return 0;
|
||||
/* not our property (the namespace matched none of ours) */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* second: look for the property in the liveprop specs */
|
||||
for (scan = group->specs; scan->name != NULL; ++scan)
|
||||
if (ns == scan->ns && strcmp(name, scan->name) == 0) {
|
||||
if (ns == scan->ns && strcmp(name, scan->name) == 0) {
|
||||
*hooks = group->hooks;
|
||||
return scan->propid;
|
||||
return scan->propid;
|
||||
}
|
||||
|
||||
/* not our property (same namespace, but no matching prop name) */
|
||||
|
@@ -49,7 +49,7 @@ static void dumpit(ap_filter_t *f, apr_bucket *b)
|
||||
conn_rec *c = f->c;
|
||||
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
|
||||
"mod_dumpio: %s (%s-%s): %" APR_SIZE_T_FMT " bytes",
|
||||
"mod_dumpio: %s (%s-%s): %" APR_SIZE_T_FMT " bytes",
|
||||
f->frec->name,
|
||||
(APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data",
|
||||
b->type->name,
|
||||
@@ -101,9 +101,9 @@ static int dumpio_input_filter (ap_filter_t *f, apr_bucket_brigade *bb,
|
||||
conn_rec *c = f->c;
|
||||
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
|
||||
"mod_dumpio: %s [%s-%s] %" APR_OFF_T_FMT " readbytes",
|
||||
"mod_dumpio: %s [%s-%s] %" APR_OFF_T_FMT " readbytes",
|
||||
f->frec->name,
|
||||
whichmode(mode),
|
||||
whichmode(mode),
|
||||
((block) == APR_BLOCK_READ) ? "blocking" : "nonblocking",
|
||||
readbytes) ;
|
||||
|
||||
@@ -115,7 +115,7 @@ static int dumpio_input_filter (ap_filter_t *f, apr_bucket_brigade *bb,
|
||||
}
|
||||
} else {
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
|
||||
"mod_dumpio: %s - %d", f->frec->name, ret) ;
|
||||
"mod_dumpio: %s - %d", f->frec->name, ret) ;
|
||||
}
|
||||
|
||||
return APR_SUCCESS ;
|
||||
@@ -161,10 +161,10 @@ static void dumpio_register_hooks(apr_pool_t *p)
|
||||
* We know that SSL is CONNECTION + 5
|
||||
*/
|
||||
ap_register_output_filter("DUMPIO_OUT", dumpio_output_filter,
|
||||
NULL, AP_FTYPE_CONNECTION + 3) ;
|
||||
NULL, AP_FTYPE_CONNECTION + 3) ;
|
||||
|
||||
ap_register_input_filter("DUMPIO_IN", dumpio_input_filter,
|
||||
NULL, AP_FTYPE_CONNECTION + 3) ;
|
||||
NULL, AP_FTYPE_CONNECTION + 3) ;
|
||||
|
||||
ap_hook_pre_connection(dumpio_pre_conn, NULL, NULL, APR_HOOK_MIDDLE);
|
||||
}
|
||||
@@ -205,11 +205,11 @@ static const command_rec dumpio_cmds[] = {
|
||||
};
|
||||
|
||||
module AP_MODULE_DECLARE_DATA dumpio_module = {
|
||||
STANDARD20_MODULE_STUFF,
|
||||
NULL,
|
||||
NULL,
|
||||
dumpio_create_sconfig,
|
||||
NULL,
|
||||
dumpio_cmds,
|
||||
dumpio_register_hooks
|
||||
STANDARD20_MODULE_STUFF,
|
||||
NULL,
|
||||
NULL,
|
||||
dumpio_create_sconfig,
|
||||
NULL,
|
||||
dumpio_cmds,
|
||||
dumpio_register_hooks
|
||||
};
|
||||
|
@@ -44,16 +44,16 @@ static void *CaseFilterCreateServerConfig(apr_pool_t *p,server_rec *s)
|
||||
static void CaseFilterInsertFilter(request_rec *r)
|
||||
{
|
||||
CaseFilterConfig *pConfig=ap_get_module_config(r->server->module_config,
|
||||
&case_filter_module);
|
||||
&case_filter_module);
|
||||
|
||||
if(!pConfig->bEnabled)
|
||||
return;
|
||||
return;
|
||||
|
||||
ap_add_output_filter(s_szCaseFilterName,NULL,r,r->connection);
|
||||
}
|
||||
|
||||
static apr_status_t CaseFilterOutFilter(ap_filter_t *f,
|
||||
apr_bucket_brigade *pbbIn)
|
||||
apr_bucket_brigade *pbbIn)
|
||||
{
|
||||
request_rec *r = f->r;
|
||||
conn_rec *c = r->connection;
|
||||
@@ -65,31 +65,31 @@ static apr_status_t CaseFilterOutFilter(ap_filter_t *f,
|
||||
pbktIn != APR_BRIGADE_SENTINEL(pbbIn);
|
||||
pbktIn = APR_BUCKET_NEXT(pbktIn))
|
||||
{
|
||||
const char *data;
|
||||
apr_size_t len;
|
||||
char *buf;
|
||||
apr_size_t n;
|
||||
apr_bucket *pbktOut;
|
||||
const char *data;
|
||||
apr_size_t len;
|
||||
char *buf;
|
||||
apr_size_t n;
|
||||
apr_bucket *pbktOut;
|
||||
|
||||
if(APR_BUCKET_IS_EOS(pbktIn))
|
||||
{
|
||||
apr_bucket *pbktEOS=apr_bucket_eos_create(c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(pbbOut,pbktEOS);
|
||||
continue;
|
||||
}
|
||||
if(APR_BUCKET_IS_EOS(pbktIn))
|
||||
{
|
||||
apr_bucket *pbktEOS=apr_bucket_eos_create(c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(pbbOut,pbktEOS);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* read */
|
||||
apr_bucket_read(pbktIn,&data,&len,APR_BLOCK_READ);
|
||||
/* read */
|
||||
apr_bucket_read(pbktIn,&data,&len,APR_BLOCK_READ);
|
||||
|
||||
/* write */
|
||||
buf = apr_bucket_alloc(len, c->bucket_alloc);
|
||||
for(n=0 ; n < len ; ++n)
|
||||
buf[n] = apr_toupper(data[n]);
|
||||
/* write */
|
||||
buf = apr_bucket_alloc(len, c->bucket_alloc);
|
||||
for(n=0 ; n < len ; ++n)
|
||||
buf[n] = apr_toupper(data[n]);
|
||||
|
||||
pbktOut = apr_bucket_heap_create(buf, len, apr_bucket_free,
|
||||
c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(pbbOut,pbktOut);
|
||||
}
|
||||
pbktOut = apr_bucket_heap_create(buf, len, apr_bucket_free,
|
||||
c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(pbbOut,pbktOut);
|
||||
}
|
||||
|
||||
/* XXX: is there any advantage to passing a brigade for each bucket? */
|
||||
return ap_pass_brigade(f->next,pbbOut);
|
||||
@@ -98,7 +98,7 @@ static apr_status_t CaseFilterOutFilter(ap_filter_t *f,
|
||||
static const char *CaseFilterEnable(cmd_parms *cmd, void *dummy, int arg)
|
||||
{
|
||||
CaseFilterConfig *pConfig=ap_get_module_config(cmd->server->module_config,
|
||||
&case_filter_module);
|
||||
&case_filter_module);
|
||||
pConfig->bEnabled=arg;
|
||||
|
||||
return NULL;
|
||||
@@ -115,7 +115,7 @@ static void CaseFilterRegisterHooks(apr_pool_t *p)
|
||||
{
|
||||
ap_hook_insert_filter(CaseFilterInsertFilter,NULL,NULL,APR_HOOK_MIDDLE);
|
||||
ap_register_output_filter(s_szCaseFilterName,CaseFilterOutFilter,NULL,
|
||||
AP_FTYPE_RESOURCE);
|
||||
AP_FTYPE_RESOURCE);
|
||||
}
|
||||
|
||||
module AP_MODULE_DECLARE_DATA case_filter_module =
|
||||
|
@@ -546,7 +546,7 @@ static int x_handler(request_rec *r)
|
||||
ap_rputs(" </H1>\n", r);
|
||||
ap_rputs(" <P>\n", r);
|
||||
ap_rprintf(r, " Apache HTTP Server version: \"%s\"\n",
|
||||
ap_get_server_version());
|
||||
ap_get_server_version());
|
||||
ap_rputs(" <BR>\n", r);
|
||||
ap_rprintf(r, " Server built: \"%s\"\n", ap_get_server_built());
|
||||
ap_rputs(" </P>\n", r);;
|
||||
|
@@ -861,7 +861,7 @@ static apr_status_t xlate_out_filter(ap_filter_t *f, apr_bucket_brigade *bb)
|
||||
"can't open translation %s->%s",
|
||||
dc->charset_source, dc->charset_default);
|
||||
ctx->noop = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ctx->noop = 1;
|
||||
|
@@ -36,43 +36,43 @@ static int asis_handler(request_rec *r)
|
||||
const char *location;
|
||||
|
||||
if(strcmp(r->handler,ASIS_MAGIC_TYPE) && strcmp(r->handler,"send-as-is"))
|
||||
return DECLINED;
|
||||
return DECLINED;
|
||||
|
||||
r->allowed |= (AP_METHOD_BIT << M_GET);
|
||||
if (r->method_number != M_GET)
|
||||
return DECLINED;
|
||||
return DECLINED;
|
||||
if (r->finfo.filetype == 0) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||
"File does not exist: %s", r->filename);
|
||||
return HTTP_NOT_FOUND;
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||
"File does not exist: %s", r->filename);
|
||||
return HTTP_NOT_FOUND;
|
||||
}
|
||||
|
||||
if ((rv = apr_file_open(&f, r->filename, APR_READ,
|
||||
APR_OS_DEFAULT, r->pool)) != APR_SUCCESS) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||
"file permissions deny server access: %s", r->filename);
|
||||
return HTTP_FORBIDDEN;
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||
"file permissions deny server access: %s", r->filename);
|
||||
return HTTP_FORBIDDEN;
|
||||
}
|
||||
|
||||
ap_scan_script_header_err(r, f, NULL);
|
||||
location = apr_table_get(r->headers_out, "Location");
|
||||
|
||||
if (location && location[0] == '/' &&
|
||||
((r->status == HTTP_OK) || ap_is_HTTP_REDIRECT(r->status))) {
|
||||
((r->status == HTTP_OK) || ap_is_HTTP_REDIRECT(r->status))) {
|
||||
|
||||
apr_file_close(f);
|
||||
apr_file_close(f);
|
||||
|
||||
/* Internal redirect -- fake-up a pseudo-request */
|
||||
r->status = HTTP_OK;
|
||||
/* Internal redirect -- fake-up a pseudo-request */
|
||||
r->status = HTTP_OK;
|
||||
|
||||
/* This redirect needs to be a GET no matter what the original
|
||||
* method was.
|
||||
*/
|
||||
r->method = apr_pstrdup(r->pool, "GET");
|
||||
r->method_number = M_GET;
|
||||
/* This redirect needs to be a GET no matter what the original
|
||||
* method was.
|
||||
*/
|
||||
r->method = apr_pstrdup(r->pool, "GET");
|
||||
r->method_number = M_GET;
|
||||
|
||||
ap_internal_redirect_handler(location, r);
|
||||
return OK;
|
||||
ap_internal_redirect_handler(location, r);
|
||||
return OK;
|
||||
}
|
||||
|
||||
if (!r->header_only) {
|
||||
|
@@ -635,8 +635,8 @@ static int cgid_server(void *data)
|
||||
#if defined(ENETDOWN)
|
||||
if (errno == ENETDOWN) {
|
||||
/* The network has been shut down, no need to continue. Die gracefully */
|
||||
++daemon_should_exit;
|
||||
}
|
||||
++daemon_should_exit;
|
||||
}
|
||||
#endif
|
||||
if (errno != EINTR) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, errno,
|
||||
|
@@ -42,7 +42,7 @@ AP_DECLARE_DATA ap_filter_rec_t *ap_chunk_filter_handle;
|
||||
AP_DECLARE_DATA ap_filter_rec_t *ap_byterange_filter_handle;
|
||||
|
||||
static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy,
|
||||
const char *arg)
|
||||
const char *arg)
|
||||
{
|
||||
const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
|
||||
if (err != NULL) {
|
||||
@@ -54,7 +54,7 @@ static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy,
|
||||
}
|
||||
|
||||
static const char *set_keep_alive(cmd_parms *cmd, void *dummy,
|
||||
const char *arg)
|
||||
const char *arg)
|
||||
{
|
||||
const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
|
||||
if (err != NULL) {
|
||||
@@ -65,16 +65,16 @@ static const char *set_keep_alive(cmd_parms *cmd, void *dummy,
|
||||
* so we accept anything but "Off" or "0" as "On"
|
||||
*/
|
||||
if (!strcasecmp(arg, "off") || !strcmp(arg, "0")) {
|
||||
cmd->server->keep_alive = 0;
|
||||
cmd->server->keep_alive = 0;
|
||||
}
|
||||
else {
|
||||
cmd->server->keep_alive = 1;
|
||||
cmd->server->keep_alive = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *set_keep_alive_max(cmd_parms *cmd, void *dummy,
|
||||
const char *arg)
|
||||
const char *arg)
|
||||
{
|
||||
const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
|
||||
if (err != NULL) {
|
||||
|
@@ -782,7 +782,7 @@ AP_DECLARE_NONSTD(int) ap_send_http_trace(request_rec *r)
|
||||
&core_module);
|
||||
|
||||
if (conf->trace_enable == AP_TRACE_DISABLE) {
|
||||
apr_table_setn(r->notes, "error-notes",
|
||||
apr_table_setn(r->notes, "error-notes",
|
||||
"TRACE denied by server configuration");
|
||||
return HTTP_FORBIDDEN;
|
||||
}
|
||||
@@ -804,7 +804,7 @@ AP_DECLARE_NONSTD(int) ap_send_http_trace(request_rec *r)
|
||||
|
||||
if (r->remaining > 0) {
|
||||
if (r->remaining > 65536) {
|
||||
apr_table_setn(r->notes, "error-notes",
|
||||
apr_table_setn(r->notes, "error-notes",
|
||||
"Extended TRACE request bodies cannot exceed 64k\n");
|
||||
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
||||
}
|
||||
@@ -829,7 +829,7 @@ AP_DECLARE_NONSTD(int) ap_send_http_trace(request_rec *r)
|
||||
/* discard_rest_of_request_body into our buffer */
|
||||
while (ap_get_client_block(r, bodyread, bodylen) > 0)
|
||||
;
|
||||
apr_table_setn(r->notes, "error-notes",
|
||||
apr_table_setn(r->notes, "error-notes",
|
||||
"Extended TRACE request bodies cannot exceed 64k\n");
|
||||
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
||||
}
|
||||
|
@@ -309,15 +309,15 @@ static int uldap_connection_open(request_rec *r,
|
||||
result->rc = ldapssl_set_verify_mode(LDAPSSL_VERIFY_NONE);
|
||||
}
|
||||
#elif defined(LDAP_OPT_X_TLS_REQUIRE_CERT)
|
||||
/* This is not a per-connection setting so just pass NULL for the
|
||||
Ldap connection handle */
|
||||
/* This is not a per-connection setting so just pass NULL for the
|
||||
Ldap connection handle */
|
||||
if (st->verify_svr_cert) {
|
||||
int i = LDAP_OPT_X_TLS_DEMAND;
|
||||
result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
|
||||
int i = LDAP_OPT_X_TLS_DEMAND;
|
||||
result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
|
||||
}
|
||||
else {
|
||||
int i = LDAP_OPT_X_TLS_NEVER;
|
||||
result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
|
||||
int i = LDAP_OPT_X_TLS_NEVER;
|
||||
result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -635,20 +635,20 @@ static int uldap_cache_comparedn(request_rec *r, util_ldap_connection_t *ldc,
|
||||
|
||||
start_over:
|
||||
if (failures++ > 10) {
|
||||
/* too many failures */
|
||||
/* too many failures */
|
||||
return result;
|
||||
}
|
||||
|
||||
/* make a server connection */
|
||||
if (LDAP_SUCCESS != (result = uldap_connection_open(r, ldc))) {
|
||||
/* connect to server failed */
|
||||
/* connect to server failed */
|
||||
return result;
|
||||
}
|
||||
|
||||
/* search for reqdn */
|
||||
if ((result = ldap_search_ext_s(ldc->ldap, (char *)reqdn, LDAP_SCOPE_BASE,
|
||||
"(objectclass=*)", NULL, 1,
|
||||
NULL, NULL, NULL, -1, &res))
|
||||
"(objectclass=*)", NULL, 1,
|
||||
NULL, NULL, NULL, -1, &res))
|
||||
== LDAP_SERVER_DOWN)
|
||||
{
|
||||
ldc->reason = "DN Comparison ldap_search_ext_s() "
|
||||
@@ -924,9 +924,9 @@ start_over:
|
||||
|
||||
/* try do the search */
|
||||
if ((result = ldap_search_ext_s(ldc->ldap,
|
||||
(char *)basedn, scope,
|
||||
(char *)filter, attrs, 0,
|
||||
NULL, NULL, NULL, -1, &res))
|
||||
(char *)basedn, scope,
|
||||
(char *)filter, attrs, 0,
|
||||
NULL, NULL, NULL, -1, &res))
|
||||
== LDAP_SERVER_DOWN)
|
||||
{
|
||||
ldc->reason = "ldap_search_ext_s() for user failed with server down";
|
||||
@@ -1164,9 +1164,9 @@ start_over:
|
||||
|
||||
/* try do the search */
|
||||
if ((result = ldap_search_ext_s(ldc->ldap,
|
||||
(char *)basedn, scope,
|
||||
(char *)basedn, scope,
|
||||
(char *)filter, attrs, 0,
|
||||
NULL, NULL, NULL, -1, &res))
|
||||
NULL, NULL, NULL, -1, &res))
|
||||
== LDAP_SERVER_DOWN)
|
||||
{
|
||||
ldc->reason = "ldap_search_ext_s() for user failed with server down";
|
||||
@@ -1295,7 +1295,7 @@ static const char *util_ldap_set_cache_bytes(cmd_parms *cmd, void *dummy,
|
||||
{
|
||||
util_ldap_state_t *st =
|
||||
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
||||
&ldap_module);
|
||||
&ldap_module);
|
||||
|
||||
st->cache_bytes = atol(bytes);
|
||||
|
||||
@@ -1333,7 +1333,7 @@ static const char *util_ldap_set_cache_ttl(cmd_parms *cmd, void *dummy,
|
||||
{
|
||||
util_ldap_state_t *st =
|
||||
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
||||
&ldap_module);
|
||||
&ldap_module);
|
||||
|
||||
st->search_cache_ttl = atol(ttl) * 1000000;
|
||||
|
||||
@@ -1349,7 +1349,7 @@ static const char *util_ldap_set_cache_entries(cmd_parms *cmd, void *dummy,
|
||||
{
|
||||
util_ldap_state_t *st =
|
||||
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
||||
&ldap_module);
|
||||
&ldap_module);
|
||||
|
||||
|
||||
st->search_cache_size = atol(size);
|
||||
@@ -1369,7 +1369,7 @@ static const char *util_ldap_set_opcache_ttl(cmd_parms *cmd, void *dummy,
|
||||
{
|
||||
util_ldap_state_t *st =
|
||||
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
||||
&ldap_module);
|
||||
&ldap_module);
|
||||
|
||||
st->compare_cache_ttl = atol(ttl) * 1000000;
|
||||
|
||||
@@ -1385,7 +1385,7 @@ static const char *util_ldap_set_opcache_entries(cmd_parms *cmd, void *dummy,
|
||||
{
|
||||
util_ldap_state_t *st =
|
||||
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
||||
&ldap_module);
|
||||
&ldap_module);
|
||||
|
||||
st->compare_cache_size = atol(size);
|
||||
if (st->compare_cache_size < 0) {
|
||||
@@ -1699,7 +1699,7 @@ static const char *util_ldap_set_connection_timeout(cmd_parms *cmd,
|
||||
{
|
||||
util_ldap_state_t *st =
|
||||
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
||||
&ldap_module);
|
||||
&ldap_module);
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
|
||||
|
||||
if (err != NULL) {
|
||||
|
@@ -247,8 +247,8 @@ int util_ldap_compare_node_compare(void *a, void *b)
|
||||
util_compare_node_t *nb = b;
|
||||
|
||||
return (strcmp(na->dn, nb->dn) == 0 &&
|
||||
strcmp(na->attrib, nb->attrib) == 0 &&
|
||||
strcmp(na->value, nb->value) == 0);
|
||||
strcmp(na->attrib, nb->attrib) == 0 &&
|
||||
strcmp(na->value, nb->value) == 0);
|
||||
}
|
||||
|
||||
void *util_ldap_compare_node_copy(util_ald_cache_t *cache, void *c)
|
||||
|
@@ -78,7 +78,7 @@ static void *merge_action_dir_configs(apr_pool_t *p, void *basev, void *addv)
|
||||
int i;
|
||||
|
||||
new->action_types = apr_table_overlay(p, add->action_types,
|
||||
base->action_types);
|
||||
base->action_types);
|
||||
|
||||
for (i = 0; i < METHODS; ++i) {
|
||||
new->scripted[i] = add->scripted[i] ? add->scripted[i]
|
||||
@@ -173,7 +173,7 @@ static int action_handler(request_rec *r)
|
||||
|
||||
/* Check for looping, which can happen if the CGI script isn't */
|
||||
if (script && r->prev && r->prev->prev)
|
||||
return DECLINED;
|
||||
return DECLINED;
|
||||
|
||||
/* Second, check for actions (which override the method scripts) */
|
||||
action = r->handler ? r->handler :
|
||||
@@ -195,7 +195,7 @@ static int action_handler(request_rec *r)
|
||||
}
|
||||
|
||||
if (script == NULL)
|
||||
return DECLINED;
|
||||
return DECLINED;
|
||||
|
||||
ap_internal_redirect_handler(apr_pstrcat(r->pool, script,
|
||||
ap_escape_uri(r->pool, r->uri),
|
||||
|
@@ -181,8 +181,8 @@ static int pointinpoly(const double point[2], double pgon[MAXVERTS][2])
|
||||
double x = point[X], y = point[Y];
|
||||
|
||||
for (numverts = 0; pgon[numverts][X] != -1 && numverts < MAXVERTS;
|
||||
numverts++) {
|
||||
/* just counting the vertexes */
|
||||
numverts++) {
|
||||
/* just counting the vertexes */
|
||||
}
|
||||
|
||||
for (i = 0; i < numverts; i++) {
|
||||
@@ -193,12 +193,12 @@ static int pointinpoly(const double point[2], double pgon[MAXVERTS][2])
|
||||
double d=(y - y1) * (x2 - x1) - (x - x1) * (y2 - y1);
|
||||
|
||||
if ((y1 >= y) != (y2 >= y)) {
|
||||
crossings +=y2 - y1 >= 0 ? d >= 0 : d <= 0;
|
||||
}
|
||||
crossings +=y2 - y1 >= 0 ? d >= 0 : d <= 0;
|
||||
}
|
||||
if (!d && fmin(x1,x2) <= x && x <= fmax(x1,x2)
|
||||
&& fmin(y1,y2) <= y && y <= fmax(y1,y2)) {
|
||||
return 1;
|
||||
}
|
||||
&& fmin(y1,y2) <= y && y <= fmax(y1,y2)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return crossings & 0x01;
|
||||
}
|
||||
@@ -270,13 +270,13 @@ static double get_y_coord(const char *args)
|
||||
while (*start_of_y && !apr_isdigit(*start_of_y)) {
|
||||
start_of_y++; /* jump to the first digit, but not
|
||||
past the end */
|
||||
}
|
||||
}
|
||||
|
||||
y_coord = strtod(start_of_y, &endptr);
|
||||
|
||||
if (endptr > start_of_y) {
|
||||
return (y_coord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (-1); /* if no conversion was made, or
|
||||
@@ -304,16 +304,16 @@ static void read_quoted(char **string, char **quoted_part)
|
||||
|
||||
if (*strp == '"') { /* if that character is a double quote */
|
||||
strp++; /* step over it */
|
||||
*quoted_part = strp; /* note where the quoted part begins */
|
||||
*quoted_part = strp; /* note where the quoted part begins */
|
||||
|
||||
while (*strp && *strp != '"') {
|
||||
++strp; /* skip the quoted portion */
|
||||
++strp; /* skip the quoted portion */
|
||||
}
|
||||
|
||||
*strp = '\0'; /* end the string with a NUL */
|
||||
|
||||
strp++; /* step over the last double quote */
|
||||
*string = strp;
|
||||
*string = strp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ static char *imap_url(request_rec *r, const char *base, const char *value)
|
||||
char *my_base;
|
||||
|
||||
if (!strcasecmp(value, "map") || !strcasecmp(value, "menu")) {
|
||||
return ap_construct_url(r->pool, r->uri, r);
|
||||
return ap_construct_url(r->pool, r->uri, r);
|
||||
}
|
||||
|
||||
if (!strcasecmp(value, "nocontent") || !strcasecmp(value, "error")) {
|
||||
@@ -342,11 +342,11 @@ static char *imap_url(request_rec *r, const char *base, const char *value)
|
||||
if (!strcasecmp(value, "referer")) {
|
||||
referer = apr_table_get(r->headers_in, "Referer");
|
||||
if (referer && *referer) {
|
||||
return apr_pstrdup(r->pool, referer);
|
||||
return apr_pstrdup(r->pool, referer);
|
||||
}
|
||||
else {
|
||||
/* XXX: This used to do *value = '\0'; ... which is totally bogus
|
||||
* because it hammers the passed in value, which can be a string
|
||||
/* XXX: This used to do *value = '\0'; ... which is totally bogus
|
||||
* because it hammers the passed in value, which can be a string
|
||||
* constant, or part of a config, or whatever. Total garbage.
|
||||
* This works around that without changing the rest of this
|
||||
* code much
|
||||
@@ -358,21 +358,21 @@ static char *imap_url(request_rec *r, const char *base, const char *value)
|
||||
|
||||
string_pos_const = value;
|
||||
while (apr_isalpha(*string_pos_const)) {
|
||||
string_pos_const++; /* go along the URL from the map
|
||||
string_pos_const++; /* go along the URL from the map
|
||||
until a non-letter */
|
||||
}
|
||||
if (*string_pos_const == ':') {
|
||||
/* if letters and then a colon (like http:) */
|
||||
/* it's an absolute URL, so use it! */
|
||||
return apr_pstrdup(r->pool, value);
|
||||
/* if letters and then a colon (like http:) */
|
||||
/* it's an absolute URL, so use it! */
|
||||
return apr_pstrdup(r->pool, value);
|
||||
}
|
||||
|
||||
if (!base || !*base) {
|
||||
if (value && *value) {
|
||||
return apr_pstrdup(r->pool, value); /* no base: use what is given */
|
||||
return apr_pstrdup(r->pool, value); /* no base: use what is given */
|
||||
}
|
||||
/* no base, no value: pick a simple default */
|
||||
return ap_construct_url(r->pool, "/", r);
|
||||
/* no base, no value: pick a simple default */
|
||||
return ap_construct_url(r->pool, "/", r);
|
||||
}
|
||||
|
||||
/* must be a relative URL to be combined with base */
|
||||
@@ -427,11 +427,11 @@ static char *imap_url(request_rec *r, const char *base, const char *value)
|
||||
|
||||
if ((string_pos = strrchr(directory, '/'))) {
|
||||
*string_pos = '\0';
|
||||
}
|
||||
}
|
||||
clen = strlen(directory);
|
||||
if (clen == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
value += 2; /* jump over the '..' that we found in the
|
||||
@@ -448,13 +448,13 @@ static char *imap_url(request_rec *r, const char *base, const char *value)
|
||||
to do. This way, we leave the starting
|
||||
'/' on value after the last '..', but get
|
||||
rid of it otherwise */
|
||||
}
|
||||
}
|
||||
|
||||
} /* by this point, value does not start
|
||||
with '..' */
|
||||
|
||||
if (value && *value) {
|
||||
return apr_pstrcat(r->pool, my_base, value, NULL);
|
||||
return apr_pstrcat(r->pool, my_base, value, NULL);
|
||||
}
|
||||
return my_base;
|
||||
}
|
||||
@@ -609,12 +609,12 @@ static int imap_handler_internal(request_rec *r)
|
||||
base = imap_url(r, NULL, imap_base); /* set base according
|
||||
to default */
|
||||
if (!base) {
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
mapdflt = imap_url(r, NULL, imap_default); /* and default to
|
||||
global default */
|
||||
if (!mapdflt) {
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
testpoint[X] = get_x_coord(r->args);
|
||||
@@ -629,7 +629,7 @@ static int imap_handler_internal(request_rec *r)
|
||||
if (strncasecmp(imap_menu, "none", 2)) {
|
||||
showmenu = 1; /* show the menu _unless_ ImapMenu is
|
||||
'none' or 'no' */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showmenu) { /* send start of imagemap menu if
|
||||
@@ -653,51 +653,51 @@ static int imap_handler_internal(request_rec *r)
|
||||
} /* blank lines and comments are ignored
|
||||
if we aren't printing a menu */
|
||||
|
||||
/* find the first two space delimited fields, recall that
|
||||
* ap_cfg_getline has removed leading/trailing whitespace.
|
||||
*
|
||||
* note that we're tokenizing as we go... if we were to use the
|
||||
* ap_getword() class of functions we would end up allocating extra
|
||||
* memory for every line of the map file
|
||||
*/
|
||||
/* find the first two space delimited fields, recall that
|
||||
* ap_cfg_getline has removed leading/trailing whitespace.
|
||||
*
|
||||
* note that we're tokenizing as we go... if we were to use the
|
||||
* ap_getword() class of functions we would end up allocating extra
|
||||
* memory for every line of the map file
|
||||
*/
|
||||
string_pos = input;
|
||||
if (!*string_pos) { /* need at least two fields */
|
||||
goto need_2_fields;
|
||||
}
|
||||
if (!*string_pos) { /* need at least two fields */
|
||||
goto need_2_fields;
|
||||
}
|
||||
|
||||
directive = string_pos;
|
||||
while (*string_pos && !apr_isspace(*string_pos)) { /* past directive */
|
||||
++string_pos;
|
||||
}
|
||||
if (!*string_pos) { /* need at least two fields */
|
||||
goto need_2_fields;
|
||||
}
|
||||
*string_pos++ = '\0';
|
||||
directive = string_pos;
|
||||
while (*string_pos && !apr_isspace(*string_pos)) { /* past directive */
|
||||
++string_pos;
|
||||
}
|
||||
if (!*string_pos) { /* need at least two fields */
|
||||
goto need_2_fields;
|
||||
}
|
||||
*string_pos++ = '\0';
|
||||
|
||||
if (!*string_pos) { /* need at least two fields */
|
||||
goto need_2_fields;
|
||||
}
|
||||
while(*string_pos && apr_isspace(*string_pos)) { /* past whitespace */
|
||||
++string_pos;
|
||||
}
|
||||
if (!*string_pos) { /* need at least two fields */
|
||||
goto need_2_fields;
|
||||
}
|
||||
while(*string_pos && apr_isspace(*string_pos)) { /* past whitespace */
|
||||
++string_pos;
|
||||
}
|
||||
|
||||
value = string_pos;
|
||||
while (*string_pos && !apr_isspace(*string_pos)) { /* past value */
|
||||
++string_pos;
|
||||
}
|
||||
if (apr_isspace(*string_pos)) {
|
||||
*string_pos++ = '\0';
|
||||
}
|
||||
else {
|
||||
/* end of input, don't advance past it */
|
||||
*string_pos = '\0';
|
||||
}
|
||||
value = string_pos;
|
||||
while (*string_pos && !apr_isspace(*string_pos)) { /* past value */
|
||||
++string_pos;
|
||||
}
|
||||
if (apr_isspace(*string_pos)) {
|
||||
*string_pos++ = '\0';
|
||||
}
|
||||
else {
|
||||
/* end of input, don't advance past it */
|
||||
*string_pos = '\0';
|
||||
}
|
||||
|
||||
if (!strncasecmp(directive, "base", 4)) { /* base, base_uri */
|
||||
base = imap_url(r, NULL, value);
|
||||
if (!base) {
|
||||
goto menu_bail;
|
||||
}
|
||||
if (!base) {
|
||||
goto menu_bail;
|
||||
}
|
||||
continue; /* base is never printed to a menu */
|
||||
}
|
||||
|
||||
@@ -705,14 +705,14 @@ static int imap_handler_internal(request_rec *r)
|
||||
|
||||
if (!strcasecmp(directive, "default")) { /* default */
|
||||
mapdflt = imap_url(r, NULL, value);
|
||||
if (!mapdflt) {
|
||||
goto menu_bail;
|
||||
}
|
||||
if (!mapdflt) {
|
||||
goto menu_bail;
|
||||
}
|
||||
if (showmenu) { /* print the default if there's a menu */
|
||||
redirect = imap_url(r, base, mapdflt);
|
||||
if (!redirect) {
|
||||
goto menu_bail;
|
||||
}
|
||||
if (!redirect) {
|
||||
goto menu_bail;
|
||||
}
|
||||
menu_default(r, imap_menu, redirect,
|
||||
href_text ? href_text : mapdflt);
|
||||
}
|
||||
@@ -726,17 +726,17 @@ static int imap_handler_internal(request_rec *r)
|
||||
/* Now skip what we just read... we can't use ANSIism %n */
|
||||
while (apr_isspace(*string_pos)) { /* past whitespace */
|
||||
string_pos++;
|
||||
}
|
||||
}
|
||||
while (apr_isdigit(*string_pos)) { /* and the 1st number */
|
||||
string_pos++;
|
||||
}
|
||||
}
|
||||
string_pos++; /* skip the ',' */
|
||||
while (apr_isspace(*string_pos)) { /* past any more whitespace */
|
||||
string_pos++;
|
||||
}
|
||||
}
|
||||
while (apr_isdigit(*string_pos)) { /* 2nd number */
|
||||
string_pos++;
|
||||
}
|
||||
}
|
||||
vertex++;
|
||||
} /* so long as there are more vertices to
|
||||
read, and we have room, read them in.
|
||||
@@ -746,14 +746,14 @@ static int imap_handler_internal(request_rec *r)
|
||||
pointarray[vertex][X] = -1; /* signals the end of vertices */
|
||||
|
||||
if (showmenu) {
|
||||
if (!href_text) {
|
||||
read_quoted(&string_pos, &href_text); /* href text could
|
||||
if (!href_text) {
|
||||
read_quoted(&string_pos, &href_text); /* href text could
|
||||
be here instead */
|
||||
}
|
||||
}
|
||||
redirect = imap_url(r, base, value);
|
||||
if (!redirect) {
|
||||
goto menu_bail;
|
||||
}
|
||||
if (!redirect) {
|
||||
goto menu_bail;
|
||||
}
|
||||
menu_directive(r, imap_menu, redirect,
|
||||
href_text ? href_text : value);
|
||||
continue;
|
||||
@@ -764,16 +764,16 @@ static int imap_handler_internal(request_rec *r)
|
||||
continue; /* don't try the following tests if testpoints
|
||||
are invalid, or if there are no
|
||||
coordinates */
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcasecmp(directive, "poly")) { /* poly */
|
||||
|
||||
if (pointinpoly(testpoint, pointarray)) {
|
||||
ap_cfg_closefile(imap);
|
||||
ap_cfg_closefile(imap);
|
||||
redirect = imap_url(r, base, value);
|
||||
if (!redirect) {
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
if (!redirect) {
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
return (imap_reply(r, redirect));
|
||||
}
|
||||
continue;
|
||||
@@ -782,11 +782,11 @@ static int imap_handler_internal(request_rec *r)
|
||||
if (!strcasecmp(directive, "circle")) { /* circle */
|
||||
|
||||
if (pointincircle(testpoint, pointarray)) {
|
||||
ap_cfg_closefile(imap);
|
||||
ap_cfg_closefile(imap);
|
||||
redirect = imap_url(r, base, value);
|
||||
if (!redirect) {
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
if (!redirect) {
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
return (imap_reply(r, redirect));
|
||||
}
|
||||
continue;
|
||||
@@ -795,11 +795,11 @@ static int imap_handler_internal(request_rec *r)
|
||||
if (!strcasecmp(directive, "rect")) { /* rect */
|
||||
|
||||
if (pointinrect(testpoint, pointarray)) {
|
||||
ap_cfg_closefile(imap);
|
||||
ap_cfg_closefile(imap);
|
||||
redirect = imap_url(r, base, value);
|
||||
if (!redirect) {
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
if (!redirect) {
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
return (imap_reply(r, redirect));
|
||||
}
|
||||
continue;
|
||||
@@ -808,7 +808,7 @@ static int imap_handler_internal(request_rec *r)
|
||||
if (!strcasecmp(directive, "point")) { /* point */
|
||||
|
||||
if (is_closer(testpoint, pointarray, &closest_yet)) {
|
||||
closest = apr_pstrdup(r->pool, value);
|
||||
closest = apr_pstrdup(r->pool, value);
|
||||
}
|
||||
|
||||
continue;
|
||||
@@ -826,18 +826,18 @@ static int imap_handler_internal(request_rec *r)
|
||||
|
||||
if (closest) { /* if a 'point' directive has been seen */
|
||||
redirect = imap_url(r, base, closest);
|
||||
if (!redirect) {
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
if (!redirect) {
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
return (imap_reply(r, redirect));
|
||||
}
|
||||
|
||||
if (mapdflt) { /* a default should be defined, even if
|
||||
only 'nocontent' */
|
||||
redirect = imap_url(r, base, mapdflt);
|
||||
if (!redirect) {
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
if (!redirect) {
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
return (imap_reply(r, redirect));
|
||||
}
|
||||
|
||||
@@ -846,18 +846,18 @@ static int imap_handler_internal(request_rec *r)
|
||||
|
||||
need_2_fields:
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||
"map file %s, line %d syntax error: requires at "
|
||||
"map file %s, line %d syntax error: requires at "
|
||||
"least two fields", r->uri, imap->line_number);
|
||||
/* fall through */
|
||||
menu_bail:
|
||||
ap_cfg_closefile(imap);
|
||||
if (showmenu) {
|
||||
/* There's not much else we can do ... we've already sent the headers
|
||||
* to the client.
|
||||
*/
|
||||
ap_rputs("\n\n[an internal server error occured]\n", r);
|
||||
menu_footer(r);
|
||||
return OK;
|
||||
/* There's not much else we can do ... we've already sent the headers
|
||||
* to the client.
|
||||
*/
|
||||
ap_rputs("\n\n[an internal server error occured]\n", r);
|
||||
menu_footer(r);
|
||||
return OK;
|
||||
}
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
@@ -869,8 +869,8 @@ static int imap_handler(request_rec *r)
|
||||
* imagemaps
|
||||
*/
|
||||
if (r->method_number != M_GET || (strcmp(r->handler,IMAP_MAGIC_TYPE)
|
||||
&& strcmp(r->handler, "imap-file"))) {
|
||||
return DECLINED;
|
||||
&& strcmp(r->handler, "imap-file"))) {
|
||||
return DECLINED;
|
||||
}
|
||||
else {
|
||||
return imap_handler_internal(r);
|
||||
|
@@ -179,7 +179,7 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
|
||||
* Check both dynamically-loaded modules and statically-linked modules.
|
||||
*/
|
||||
sconf = (so_server_conf *)ap_get_module_config(cmd->server->module_config,
|
||||
&so_module);
|
||||
&so_module);
|
||||
modie = (ap_module_symbol_t *)sconf->loaded_modules->elts;
|
||||
for (i = 0; i < sconf->loaded_modules->nelts; i++) {
|
||||
modi = &modie[i];
|
||||
@@ -239,12 +239,12 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
|
||||
char my_error[256];
|
||||
|
||||
return apr_pstrcat(cmd->pool, "Cannot load ", szModuleFile,
|
||||
" into server: ",
|
||||
apr_dso_error(modhandle, my_error, sizeof(my_error)),
|
||||
NULL);
|
||||
" into server: ",
|
||||
apr_dso_error(modhandle, my_error, sizeof(my_error)),
|
||||
NULL);
|
||||
}
|
||||
ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, cmd->pool,
|
||||
"loaded module %s", modname);
|
||||
"loaded module %s", modname);
|
||||
|
||||
/*
|
||||
* Retrieve the pointer to the module structure through the module name:
|
||||
@@ -254,10 +254,10 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
|
||||
if (apr_dso_sym(&modsym, modhandle, modname) != APR_SUCCESS) {
|
||||
char my_error[256];
|
||||
|
||||
return apr_pstrcat(cmd->pool, "Can't locate API module structure `",
|
||||
modname, "' in file ", szModuleFile, ": ",
|
||||
apr_dso_error(modhandle, my_error, sizeof(my_error)),
|
||||
NULL);
|
||||
return apr_pstrcat(cmd->pool, "Can't locate API module structure `",
|
||||
modname, "' in file ", szModuleFile, ": ",
|
||||
apr_dso_error(modhandle, my_error, sizeof(my_error)),
|
||||
NULL);
|
||||
}
|
||||
modp = (module*) modsym;
|
||||
modp->dynamic_load_handle = (apr_dso_handle_t *)modhandle;
|
||||
@@ -316,14 +316,14 @@ static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)
|
||||
if (apr_dso_load(&handle, file, cmd->pool) != APR_SUCCESS) {
|
||||
char my_error[256];
|
||||
|
||||
return apr_pstrcat(cmd->pool, "Cannot load ", filename,
|
||||
" into server: ",
|
||||
apr_dso_error(handle, my_error, sizeof(my_error)),
|
||||
NULL);
|
||||
return apr_pstrcat(cmd->pool, "Cannot load ", filename,
|
||||
" into server: ",
|
||||
apr_dso_error(handle, my_error, sizeof(my_error)),
|
||||
NULL);
|
||||
}
|
||||
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
|
||||
"loaded file %s", filename);
|
||||
"loaded file %s", filename);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -395,7 +395,7 @@ static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)
|
||||
}
|
||||
|
||||
static const char *load_module(cmd_parms *cmd, void *dummy,
|
||||
const char *modname, const char *filename)
|
||||
const char *modname, const char *filename)
|
||||
{
|
||||
ap_log_perror(APLOG_MARK, APLOG_STARTUP, 0, cmd->pool,
|
||||
"WARNING: LoadModule not supported on this platform");
|
||||
|
@@ -164,22 +164,22 @@ static sp_reason spdist(const char *s, const char *t)
|
||||
for (; apr_tolower(*s) == apr_tolower(*t); t++, s++) {
|
||||
if (*t == '\0') {
|
||||
return SP_MISCAPITALIZED; /* exact match (sans case) */
|
||||
}
|
||||
}
|
||||
}
|
||||
if (*s) {
|
||||
if (*t) {
|
||||
if (s[1] && t[1] && apr_tolower(*s) == apr_tolower(t[1])
|
||||
&& apr_tolower(*t) == apr_tolower(s[1])
|
||||
&& strcasecmp(s + 2, t + 2) == 0) {
|
||||
&& apr_tolower(*t) == apr_tolower(s[1])
|
||||
&& strcasecmp(s + 2, t + 2) == 0) {
|
||||
return SP_TRANSPOSITION; /* transposition */
|
||||
}
|
||||
}
|
||||
if (strcasecmp(s + 1, t + 1) == 0) {
|
||||
return SP_SIMPLETYPO; /* 1 char mismatch */
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strcasecmp(s + 1, t) == 0) {
|
||||
return SP_EXTRACHAR; /* extra character */
|
||||
}
|
||||
}
|
||||
}
|
||||
if (*t && strcasecmp(s, t + 1) == 0) {
|
||||
return SP_MISSINGCHAR; /* missing character */
|
||||
@@ -296,7 +296,7 @@ static int check_speling(request_rec *r)
|
||||
else if (strcasecmp(bad, dirent.name) == 0) {
|
||||
misspelled_file *sp_new;
|
||||
|
||||
sp_new = (misspelled_file *) apr_array_push(candidates);
|
||||
sp_new = (misspelled_file *) apr_array_push(candidates);
|
||||
sp_new->name = apr_pstrdup(r->pool, dirent.name);
|
||||
sp_new->quality = SP_MISCAPITALIZED;
|
||||
}
|
||||
@@ -308,17 +308,17 @@ static int check_speling(request_rec *r)
|
||||
else if ((q = spdist(bad, dirent.name)) != SP_VERYDIFFERENT) {
|
||||
misspelled_file *sp_new;
|
||||
|
||||
sp_new = (misspelled_file *) apr_array_push(candidates);
|
||||
sp_new = (misspelled_file *) apr_array_push(candidates);
|
||||
sp_new->name = apr_pstrdup(r->pool, dirent.name);
|
||||
sp_new->quality = q;
|
||||
}
|
||||
|
||||
/*
|
||||
* The spdist() should have found the majority of the misspelled
|
||||
* requests. It is of questionable use to continue looking for
|
||||
* files with the same base name, but potentially of totally wrong
|
||||
* type (index.html <-> index.db).
|
||||
* I would propose to not set the WANT_BASENAME_MATCH define.
|
||||
* The spdist() should have found the majority of the misspelled
|
||||
* requests. It is of questionable use to continue looking for
|
||||
* files with the same base name, but potentially of totally wrong
|
||||
* type (index.html <-> index.db).
|
||||
* I would propose to not set the WANT_BASENAME_MATCH define.
|
||||
* 08-Aug-1997 <Martin.Kraemer@Mch.SNI.De>
|
||||
*
|
||||
* However, Alexei replied giving some reasons to add it anyway:
|
||||
@@ -326,12 +326,12 @@ static int check_speling(request_rec *r)
|
||||
* > extension-stripping-and-matching stuff is a good idea:
|
||||
* >
|
||||
* > If you're using MultiViews, and have a file named foobar.html,
|
||||
* > which you refer to as "foobar", and someone tried to access
|
||||
* > "Foobar", mod_speling won't find it, because it won't find
|
||||
* > anything matching that spelling. With the extension-munging,
|
||||
* > it would locate "foobar.html". Not perfect, but I ran into
|
||||
* > that problem when I first wrote the module.
|
||||
*/
|
||||
* > which you refer to as "foobar", and someone tried to access
|
||||
* > "Foobar", mod_speling won't find it, because it won't find
|
||||
* > anything matching that spelling. With the extension-munging,
|
||||
* > it would locate "foobar.html". Not perfect, but I ran into
|
||||
* > that problem when I first wrote the module.
|
||||
*/
|
||||
else {
|
||||
#ifdef WANT_BASENAME_MATCH
|
||||
/*
|
||||
@@ -348,13 +348,13 @@ static int check_speling(request_rec *r)
|
||||
int entloc = ap_ind(dirent.name, '.');
|
||||
if (entloc == -1) {
|
||||
entloc = strlen(dirent.name);
|
||||
}
|
||||
}
|
||||
|
||||
if ((dotloc == entloc)
|
||||
&& !strncasecmp(bad, dirent.name, dotloc)) {
|
||||
misspelled_file *sp_new;
|
||||
|
||||
sp_new = (misspelled_file *) apr_array_push(candidates);
|
||||
sp_new = (misspelled_file *) apr_array_push(candidates);
|
||||
sp_new->name = apr_pstrdup(r->pool, dirent.name);
|
||||
sp_new->quality = SP_VERYDIFFERENT;
|
||||
}
|
||||
@@ -366,7 +366,7 @@ static int check_speling(request_rec *r)
|
||||
if (candidates->nelts != 0) {
|
||||
/* Wow... we found us a mispelling. Construct a fixed url */
|
||||
char *nuri;
|
||||
const char *ref;
|
||||
const char *ref;
|
||||
misspelled_file *variant = (misspelled_file *) candidates->elts;
|
||||
int i;
|
||||
|
||||
@@ -379,27 +379,27 @@ static int check_speling(request_rec *r)
|
||||
* Conditions for immediate redirection:
|
||||
* a) the first candidate was not found by stripping the suffix
|
||||
* AND b) there exists only one candidate OR the best match is not
|
||||
* ambiguous
|
||||
* ambiguous
|
||||
* then return a redirection right away.
|
||||
*/
|
||||
if (variant[0].quality != SP_VERYDIFFERENT
|
||||
&& (candidates->nelts == 1
|
||||
|| variant[0].quality != variant[1].quality)) {
|
||||
&& (candidates->nelts == 1
|
||||
|| variant[0].quality != variant[1].quality)) {
|
||||
|
||||
nuri = ap_escape_uri(r->pool, apr_pstrcat(r->pool, url,
|
||||
variant[0].name,
|
||||
r->path_info, NULL));
|
||||
if (r->parsed_uri.query)
|
||||
nuri = apr_pstrcat(r->pool, nuri, "?", r->parsed_uri.query, NULL);
|
||||
variant[0].name,
|
||||
r->path_info, NULL));
|
||||
if (r->parsed_uri.query)
|
||||
nuri = apr_pstrcat(r->pool, nuri, "?", r->parsed_uri.query, NULL);
|
||||
|
||||
apr_table_setn(r->headers_out, "Location",
|
||||
ap_construct_url(r->pool, nuri, r));
|
||||
ap_construct_url(r->pool, nuri, r));
|
||||
|
||||
ap_log_rerror(APLOG_MARK, APLOG_INFO, APR_SUCCESS,
|
||||
r,
|
||||
ref ? "Fixed spelling: %s to %s from %s"
|
||||
: "Fixed spelling: %s to %s",
|
||||
r->uri, nuri, ref);
|
||||
r,
|
||||
ref ? "Fixed spelling: %s to %s from %s"
|
||||
: "Fixed spelling: %s to %s",
|
||||
r->uri, nuri, ref);
|
||||
|
||||
return HTTP_MOVED_PERMANENTLY;
|
||||
}
|
||||
@@ -410,9 +410,9 @@ static int check_speling(request_rec *r)
|
||||
else {
|
||||
apr_pool_t *p;
|
||||
apr_table_t *notes;
|
||||
apr_pool_t *sub_pool;
|
||||
apr_array_header_t *t;
|
||||
apr_array_header_t *v;
|
||||
apr_pool_t *sub_pool;
|
||||
apr_array_header_t *t;
|
||||
apr_array_header_t *v;
|
||||
|
||||
|
||||
if (r->main == NULL) {
|
||||
@@ -424,49 +424,49 @@ static int check_speling(request_rec *r)
|
||||
notes = r->main->notes;
|
||||
}
|
||||
|
||||
if (apr_pool_create(&sub_pool, p) != APR_SUCCESS)
|
||||
return DECLINED;
|
||||
if (apr_pool_create(&sub_pool, p) != APR_SUCCESS)
|
||||
return DECLINED;
|
||||
|
||||
t = apr_array_make(sub_pool, candidates->nelts * 8 + 8,
|
||||
sizeof(char *));
|
||||
v = apr_array_make(sub_pool, candidates->nelts * 5,
|
||||
sizeof(char *));
|
||||
t = apr_array_make(sub_pool, candidates->nelts * 8 + 8,
|
||||
sizeof(char *));
|
||||
v = apr_array_make(sub_pool, candidates->nelts * 5,
|
||||
sizeof(char *));
|
||||
|
||||
/* Generate the response text. */
|
||||
|
||||
*(const char **)apr_array_push(t) =
|
||||
"The document name you requested (<code>";
|
||||
*(const char **)apr_array_push(t) = ap_escape_html(sub_pool, r->uri);
|
||||
*(const char **)apr_array_push(t) =
|
||||
"</code>) could not be found on this server.\n"
|
||||
"However, we found documents with names similar "
|
||||
"to the one you requested.<p>"
|
||||
"Available documents:\n<ul>\n";
|
||||
*(const char **)apr_array_push(t) =
|
||||
"The document name you requested (<code>";
|
||||
*(const char **)apr_array_push(t) = ap_escape_html(sub_pool, r->uri);
|
||||
*(const char **)apr_array_push(t) =
|
||||
"</code>) could not be found on this server.\n"
|
||||
"However, we found documents with names similar "
|
||||
"to the one you requested.<p>"
|
||||
"Available documents:\n<ul>\n";
|
||||
|
||||
for (i = 0; i < candidates->nelts; ++i) {
|
||||
char *vuri;
|
||||
const char *reason;
|
||||
char *vuri;
|
||||
const char *reason;
|
||||
|
||||
reason = sp_reason_str[(int) (variant[i].quality)];
|
||||
reason = sp_reason_str[(int) (variant[i].quality)];
|
||||
/* The format isn't very neat... */
|
||||
vuri = apr_pstrcat(sub_pool, url, variant[i].name, r->path_info,
|
||||
(r->parsed_uri.query != NULL) ? "?" : "",
|
||||
(r->parsed_uri.query != NULL)
|
||||
? r->parsed_uri.query : "",
|
||||
NULL);
|
||||
*(const char **)apr_array_push(v) = "\"";
|
||||
*(const char **)apr_array_push(v) = ap_escape_uri(sub_pool, vuri);
|
||||
*(const char **)apr_array_push(v) = "\";\"";
|
||||
*(const char **)apr_array_push(v) = reason;
|
||||
*(const char **)apr_array_push(v) = "\"";
|
||||
vuri = apr_pstrcat(sub_pool, url, variant[i].name, r->path_info,
|
||||
(r->parsed_uri.query != NULL) ? "?" : "",
|
||||
(r->parsed_uri.query != NULL)
|
||||
? r->parsed_uri.query : "",
|
||||
NULL);
|
||||
*(const char **)apr_array_push(v) = "\"";
|
||||
*(const char **)apr_array_push(v) = ap_escape_uri(sub_pool, vuri);
|
||||
*(const char **)apr_array_push(v) = "\";\"";
|
||||
*(const char **)apr_array_push(v) = reason;
|
||||
*(const char **)apr_array_push(v) = "\"";
|
||||
|
||||
*(const char **)apr_array_push(t) = "<li><a href=\"";
|
||||
*(const char **)apr_array_push(t) = ap_escape_uri(sub_pool, vuri);
|
||||
*(const char **)apr_array_push(t) = "\">";
|
||||
*(const char **)apr_array_push(t) = ap_escape_html(sub_pool, vuri);
|
||||
*(const char **)apr_array_push(t) = "</a> (";
|
||||
*(const char **)apr_array_push(t) = reason;
|
||||
*(const char **)apr_array_push(t) = ")\n";
|
||||
*(const char **)apr_array_push(t) = "<li><a href=\"";
|
||||
*(const char **)apr_array_push(t) = ap_escape_uri(sub_pool, vuri);
|
||||
*(const char **)apr_array_push(t) = "\">";
|
||||
*(const char **)apr_array_push(t) = ap_escape_html(sub_pool, vuri);
|
||||
*(const char **)apr_array_push(t) = "</a> (";
|
||||
*(const char **)apr_array_push(t) = reason;
|
||||
*(const char **)apr_array_push(t) = ")\n";
|
||||
|
||||
/*
|
||||
* when we have printed the "close matches" and there are
|
||||
@@ -478,36 +478,36 @@ static int check_speling(request_rec *r)
|
||||
if (i > 0 && i < candidates->nelts - 1
|
||||
&& variant[i].quality != SP_VERYDIFFERENT
|
||||
&& variant[i + 1].quality == SP_VERYDIFFERENT) {
|
||||
*(const char **)apr_array_push(t) =
|
||||
"</ul>\nFurthermore, the following related "
|
||||
"documents were found:\n<ul>\n";
|
||||
*(const char **)apr_array_push(t) =
|
||||
"</ul>\nFurthermore, the following related "
|
||||
"documents were found:\n<ul>\n";
|
||||
}
|
||||
}
|
||||
*(const char **)apr_array_push(t) = "</ul>\n";
|
||||
*(const char **)apr_array_push(t) = "</ul>\n";
|
||||
|
||||
/* If we know there was a referring page, add a note: */
|
||||
if (ref != NULL) {
|
||||
*(const char **)apr_array_push(t) =
|
||||
"Please consider informing the owner of the "
|
||||
"<a href=\"";
|
||||
*(const char **)apr_array_push(t) = ap_escape_uri(sub_pool, ref);
|
||||
"Please consider informing the owner of the "
|
||||
"<a href=\"";
|
||||
*(const char **)apr_array_push(t) = ap_escape_uri(sub_pool, ref);
|
||||
*(const char **)apr_array_push(t) = "\">referring page</a> "
|
||||
"about the broken link.\n";
|
||||
}
|
||||
"about the broken link.\n";
|
||||
}
|
||||
|
||||
|
||||
/* Pass our apr_table_t to http_protocol.c (see mod_negotiation): */
|
||||
apr_table_setn(notes, "variant-list", apr_array_pstrcat(p, t, 0));
|
||||
|
||||
apr_table_mergen(r->subprocess_env, "VARIANTS",
|
||||
apr_array_pstrcat(p, v, ','));
|
||||
apr_table_mergen(r->subprocess_env, "VARIANTS",
|
||||
apr_array_pstrcat(p, v, ','));
|
||||
|
||||
apr_pool_destroy(sub_pool);
|
||||
apr_pool_destroy(sub_pool);
|
||||
|
||||
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
|
||||
ref ? "Spelling fix: %s: %d candidates from %s"
|
||||
: "Spelling fix: %s: %d candidates",
|
||||
r->uri, candidates->nelts, ref);
|
||||
ref ? "Spelling fix: %s: %d candidates from %s"
|
||||
: "Spelling fix: %s: %d candidates",
|
||||
r->uri, candidates->nelts, ref);
|
||||
|
||||
return HTTP_MULTIPLE_CHOICES;
|
||||
}
|
||||
|
@@ -89,20 +89,20 @@ static void *mva_merge_server_config(apr_pool_t *p, void *parentv, void *childv)
|
||||
|
||||
conf = (mva_sconf_t *) apr_pcalloc(p, sizeof(*conf));
|
||||
if (child->doc_root_mode == VHOST_ALIAS_UNSET) {
|
||||
conf->doc_root_mode = parent->doc_root_mode;
|
||||
conf->doc_root = parent->doc_root;
|
||||
conf->doc_root_mode = parent->doc_root_mode;
|
||||
conf->doc_root = parent->doc_root;
|
||||
}
|
||||
else {
|
||||
conf->doc_root_mode = child->doc_root_mode;
|
||||
conf->doc_root = child->doc_root;
|
||||
conf->doc_root_mode = child->doc_root_mode;
|
||||
conf->doc_root = child->doc_root;
|
||||
}
|
||||
if (child->cgi_root_mode == VHOST_ALIAS_UNSET) {
|
||||
conf->cgi_root_mode = parent->cgi_root_mode;
|
||||
conf->cgi_root = parent->cgi_root;
|
||||
conf->cgi_root_mode = parent->cgi_root_mode;
|
||||
conf->cgi_root = parent->cgi_root;
|
||||
}
|
||||
else {
|
||||
conf->cgi_root_mode = child->cgi_root_mode;
|
||||
conf->cgi_root = child->cgi_root;
|
||||
conf->cgi_root_mode = child->cgi_root_mode;
|
||||
conf->cgi_root = child->cgi_root;
|
||||
}
|
||||
return conf;
|
||||
}
|
||||
@@ -125,87 +125,87 @@ static const char *vhost_alias_set(cmd_parms *cmd, void *dummy, const char *map)
|
||||
const char *p;
|
||||
|
||||
conf = (mva_sconf_t *) ap_get_module_config(cmd->server->module_config,
|
||||
&vhost_alias_module);
|
||||
&vhost_alias_module);
|
||||
/* there ought to be a better way of doing this */
|
||||
if (&vhost_alias_set_doc_root_ip == cmd->info) {
|
||||
mode = VHOST_ALIAS_IP;
|
||||
pmap = &conf->doc_root;
|
||||
pmode = &conf->doc_root_mode;
|
||||
mode = VHOST_ALIAS_IP;
|
||||
pmap = &conf->doc_root;
|
||||
pmode = &conf->doc_root_mode;
|
||||
}
|
||||
else if (&vhost_alias_set_cgi_root_ip == cmd->info) {
|
||||
mode = VHOST_ALIAS_IP;
|
||||
pmap = &conf->cgi_root;
|
||||
pmode = &conf->cgi_root_mode;
|
||||
mode = VHOST_ALIAS_IP;
|
||||
pmap = &conf->cgi_root;
|
||||
pmode = &conf->cgi_root_mode;
|
||||
}
|
||||
else if (&vhost_alias_set_doc_root_name == cmd->info) {
|
||||
mode = VHOST_ALIAS_NAME;
|
||||
pmap = &conf->doc_root;
|
||||
pmode = &conf->doc_root_mode;
|
||||
mode = VHOST_ALIAS_NAME;
|
||||
pmap = &conf->doc_root;
|
||||
pmode = &conf->doc_root_mode;
|
||||
}
|
||||
else if (&vhost_alias_set_cgi_root_name == cmd->info) {
|
||||
mode = VHOST_ALIAS_NAME;
|
||||
pmap = &conf->cgi_root;
|
||||
pmode = &conf->cgi_root_mode;
|
||||
mode = VHOST_ALIAS_NAME;
|
||||
pmap = &conf->cgi_root;
|
||||
pmode = &conf->cgi_root_mode;
|
||||
}
|
||||
else {
|
||||
return "INTERNAL ERROR: unknown command info";
|
||||
return "INTERNAL ERROR: unknown command info";
|
||||
}
|
||||
|
||||
if (!ap_os_is_path_absolute(cmd->pool, map)) {
|
||||
if (strcasecmp(map, "none")) {
|
||||
return "format string must be an absolute path, or 'none'";
|
||||
}
|
||||
*pmap = NULL;
|
||||
*pmode = VHOST_ALIAS_NONE;
|
||||
return NULL;
|
||||
if (strcasecmp(map, "none")) {
|
||||
return "format string must be an absolute path, or 'none'";
|
||||
}
|
||||
*pmap = NULL;
|
||||
*pmode = VHOST_ALIAS_NONE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* sanity check */
|
||||
p = map;
|
||||
while (*p != '\0') {
|
||||
if (*p++ != '%') {
|
||||
continue;
|
||||
}
|
||||
/* we just found a '%' */
|
||||
if (*p == 'p' || *p == '%') {
|
||||
++p;
|
||||
continue;
|
||||
}
|
||||
/* optional dash */
|
||||
if (*p == '-') {
|
||||
++p;
|
||||
}
|
||||
/* digit N */
|
||||
if (apr_isdigit(*p)) {
|
||||
++p;
|
||||
}
|
||||
else {
|
||||
return "syntax error in format string";
|
||||
}
|
||||
/* optional plus */
|
||||
if (*p == '+') {
|
||||
++p;
|
||||
}
|
||||
/* do we end here? */
|
||||
if (*p != '.') {
|
||||
continue;
|
||||
}
|
||||
++p;
|
||||
/* optional dash */
|
||||
if (*p == '-') {
|
||||
++p;
|
||||
}
|
||||
/* digit M */
|
||||
if (apr_isdigit(*p)) {
|
||||
++p;
|
||||
}
|
||||
else {
|
||||
return "syntax error in format string";
|
||||
}
|
||||
/* optional plus */
|
||||
if (*p == '+') {
|
||||
++p;
|
||||
}
|
||||
if (*p++ != '%') {
|
||||
continue;
|
||||
}
|
||||
/* we just found a '%' */
|
||||
if (*p == 'p' || *p == '%') {
|
||||
++p;
|
||||
continue;
|
||||
}
|
||||
/* optional dash */
|
||||
if (*p == '-') {
|
||||
++p;
|
||||
}
|
||||
/* digit N */
|
||||
if (apr_isdigit(*p)) {
|
||||
++p;
|
||||
}
|
||||
else {
|
||||
return "syntax error in format string";
|
||||
}
|
||||
/* optional plus */
|
||||
if (*p == '+') {
|
||||
++p;
|
||||
}
|
||||
/* do we end here? */
|
||||
if (*p != '.') {
|
||||
continue;
|
||||
}
|
||||
++p;
|
||||
/* optional dash */
|
||||
if (*p == '-') {
|
||||
++p;
|
||||
}
|
||||
/* digit M */
|
||||
if (apr_isdigit(*p)) {
|
||||
++p;
|
||||
}
|
||||
else {
|
||||
return "syntax error in format string";
|
||||
}
|
||||
/* optional plus */
|
||||
if (*p == '+') {
|
||||
++p;
|
||||
}
|
||||
}
|
||||
*pmap = map;
|
||||
*pmode = mode;
|
||||
@@ -235,23 +235,23 @@ static const command_rec mva_commands[] =
|
||||
* but C is too feeble to support them.
|
||||
*/
|
||||
static APR_INLINE void vhost_alias_checkspace(request_rec *r, char *buf,
|
||||
char **pdest, int size)
|
||||
char **pdest, int size)
|
||||
{
|
||||
/* XXX: what if size > HUGE_STRING_LEN? */
|
||||
if (*pdest + size > buf + HUGE_STRING_LEN) {
|
||||
**pdest = '\0';
|
||||
if (r->filename) {
|
||||
r->filename = apr_pstrcat(r->pool, r->filename, buf, NULL);
|
||||
}
|
||||
else {
|
||||
r->filename = apr_pstrdup(r->pool, buf);
|
||||
}
|
||||
*pdest = buf;
|
||||
**pdest = '\0';
|
||||
if (r->filename) {
|
||||
r->filename = apr_pstrcat(r->pool, r->filename, buf, NULL);
|
||||
}
|
||||
else {
|
||||
r->filename = apr_pstrdup(r->pool, buf);
|
||||
}
|
||||
*pdest = buf;
|
||||
}
|
||||
}
|
||||
|
||||
static void vhost_alias_interpolate(request_rec *r, const char *name,
|
||||
const char *map, const char *uri)
|
||||
const char *map, const char *uri)
|
||||
{
|
||||
/* 0..9 9..0 */
|
||||
enum { MAXDOTS = 19 };
|
||||
@@ -269,9 +269,9 @@ static void vhost_alias_interpolate(request_rec *r, const char *name,
|
||||
ndots = 0;
|
||||
dots[ndots++] = name-1; /* slightly naughty */
|
||||
for (p = name; *p; ++p){
|
||||
if (*p == '.' && ndots < MAXDOTS) {
|
||||
dots[ndots++] = p;
|
||||
}
|
||||
if (*p == '.' && ndots < MAXDOTS) {
|
||||
dots[ndots++] = p;
|
||||
}
|
||||
}
|
||||
dots[ndots] = p;
|
||||
|
||||
@@ -280,103 +280,103 @@ static void vhost_alias_interpolate(request_rec *r, const char *name,
|
||||
dest = buf;
|
||||
last = '\0';
|
||||
while (*map) {
|
||||
if (*map != '%') {
|
||||
/* normal characters */
|
||||
vhost_alias_checkspace(r, buf, &dest, 1);
|
||||
last = *dest++ = *map++;
|
||||
continue;
|
||||
}
|
||||
/* we are in a format specifier */
|
||||
++map;
|
||||
/* can't be a slash */
|
||||
last = '\0';
|
||||
/* %% -> % */
|
||||
if (*map == '%') {
|
||||
++map;
|
||||
vhost_alias_checkspace(r, buf, &dest, 1);
|
||||
*dest++ = '%';
|
||||
continue;
|
||||
}
|
||||
/* port number */
|
||||
if (*map == 'p') {
|
||||
++map;
|
||||
/* no. of decimal digits in a short plus one */
|
||||
vhost_alias_checkspace(r, buf, &dest, 7);
|
||||
dest += apr_snprintf(dest, 7, "%d", ap_get_server_port(r));
|
||||
continue;
|
||||
}
|
||||
/* deal with %-N+.-M+ -- syntax is already checked */
|
||||
N = M = 0; /* value */
|
||||
Np = Mp = 0; /* is there a plus? */
|
||||
Nd = Md = 0; /* is there a dash? */
|
||||
if (*map == '-') ++map, Nd = 1;
|
||||
N = *map++ - '0';
|
||||
if (*map == '+') ++map, Np = 1;
|
||||
if (*map == '.') {
|
||||
++map;
|
||||
if (*map == '-') {
|
||||
++map, Md = 1;
|
||||
}
|
||||
M = *map++ - '0';
|
||||
if (*map == '+') {
|
||||
++map, Mp = 1;
|
||||
}
|
||||
}
|
||||
/* note that N and M are one-based indices, not zero-based */
|
||||
start = dots[0]+1; /* ptr to the first character */
|
||||
end = dots[ndots]; /* ptr to the character after the last one */
|
||||
if (N != 0) {
|
||||
if (N > ndots) {
|
||||
start = "_";
|
||||
end = start+1;
|
||||
}
|
||||
else if (!Nd) {
|
||||
start = dots[N-1]+1;
|
||||
if (!Np) {
|
||||
end = dots[N];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!Np) {
|
||||
start = dots[ndots-N]+1;
|
||||
}
|
||||
end = dots[ndots-N+1];
|
||||
}
|
||||
}
|
||||
if (M != 0) {
|
||||
if (M > end - start) {
|
||||
start = "_";
|
||||
end = start+1;
|
||||
}
|
||||
else if (!Md) {
|
||||
start = start+M-1;
|
||||
if (!Mp) {
|
||||
end = start+1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!Mp) {
|
||||
start = end-M;
|
||||
}
|
||||
end = end-M+1;
|
||||
}
|
||||
}
|
||||
vhost_alias_checkspace(r, buf, &dest, end - start);
|
||||
for (p = start; p < end; ++p) {
|
||||
*dest++ = apr_tolower(*p);
|
||||
}
|
||||
if (*map != '%') {
|
||||
/* normal characters */
|
||||
vhost_alias_checkspace(r, buf, &dest, 1);
|
||||
last = *dest++ = *map++;
|
||||
continue;
|
||||
}
|
||||
/* we are in a format specifier */
|
||||
++map;
|
||||
/* can't be a slash */
|
||||
last = '\0';
|
||||
/* %% -> % */
|
||||
if (*map == '%') {
|
||||
++map;
|
||||
vhost_alias_checkspace(r, buf, &dest, 1);
|
||||
*dest++ = '%';
|
||||
continue;
|
||||
}
|
||||
/* port number */
|
||||
if (*map == 'p') {
|
||||
++map;
|
||||
/* no. of decimal digits in a short plus one */
|
||||
vhost_alias_checkspace(r, buf, &dest, 7);
|
||||
dest += apr_snprintf(dest, 7, "%d", ap_get_server_port(r));
|
||||
continue;
|
||||
}
|
||||
/* deal with %-N+.-M+ -- syntax is already checked */
|
||||
N = M = 0; /* value */
|
||||
Np = Mp = 0; /* is there a plus? */
|
||||
Nd = Md = 0; /* is there a dash? */
|
||||
if (*map == '-') ++map, Nd = 1;
|
||||
N = *map++ - '0';
|
||||
if (*map == '+') ++map, Np = 1;
|
||||
if (*map == '.') {
|
||||
++map;
|
||||
if (*map == '-') {
|
||||
++map, Md = 1;
|
||||
}
|
||||
M = *map++ - '0';
|
||||
if (*map == '+') {
|
||||
++map, Mp = 1;
|
||||
}
|
||||
}
|
||||
/* note that N and M are one-based indices, not zero-based */
|
||||
start = dots[0]+1; /* ptr to the first character */
|
||||
end = dots[ndots]; /* ptr to the character after the last one */
|
||||
if (N != 0) {
|
||||
if (N > ndots) {
|
||||
start = "_";
|
||||
end = start+1;
|
||||
}
|
||||
else if (!Nd) {
|
||||
start = dots[N-1]+1;
|
||||
if (!Np) {
|
||||
end = dots[N];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!Np) {
|
||||
start = dots[ndots-N]+1;
|
||||
}
|
||||
end = dots[ndots-N+1];
|
||||
}
|
||||
}
|
||||
if (M != 0) {
|
||||
if (M > end - start) {
|
||||
start = "_";
|
||||
end = start+1;
|
||||
}
|
||||
else if (!Md) {
|
||||
start = start+M-1;
|
||||
if (!Mp) {
|
||||
end = start+1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!Mp) {
|
||||
start = end-M;
|
||||
}
|
||||
end = end-M+1;
|
||||
}
|
||||
}
|
||||
vhost_alias_checkspace(r, buf, &dest, end - start);
|
||||
for (p = start; p < end; ++p) {
|
||||
*dest++ = apr_tolower(*p);
|
||||
}
|
||||
}
|
||||
*dest = '\0';
|
||||
/* no double slashes */
|
||||
if (last == '/') {
|
||||
++uri;
|
||||
++uri;
|
||||
}
|
||||
|
||||
if (r->filename) {
|
||||
r->filename = apr_pstrcat(r->pool, r->filename, buf, uri, NULL);
|
||||
r->filename = apr_pstrcat(r->pool, r->filename, buf, uri, NULL);
|
||||
}
|
||||
else {
|
||||
r->filename = apr_pstrcat(r->pool, buf, uri, NULL);
|
||||
r->filename = apr_pstrcat(r->pool, buf, uri, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,36 +388,36 @@ static int mva_translate(request_rec *r)
|
||||
const char *cgi;
|
||||
|
||||
conf = (mva_sconf_t *) ap_get_module_config(r->server->module_config,
|
||||
&vhost_alias_module);
|
||||
&vhost_alias_module);
|
||||
cgi = NULL;
|
||||
if (conf->cgi_root) {
|
||||
cgi = strstr(r->uri, "cgi-bin/");
|
||||
if (cgi && (cgi != r->uri + strspn(r->uri, "/"))) {
|
||||
cgi = NULL;
|
||||
}
|
||||
cgi = strstr(r->uri, "cgi-bin/");
|
||||
if (cgi && (cgi != r->uri + strspn(r->uri, "/"))) {
|
||||
cgi = NULL;
|
||||
}
|
||||
}
|
||||
if (cgi) {
|
||||
mode = conf->cgi_root_mode;
|
||||
map = conf->cgi_root;
|
||||
uri = cgi + strlen("cgi-bin");
|
||||
mode = conf->cgi_root_mode;
|
||||
map = conf->cgi_root;
|
||||
uri = cgi + strlen("cgi-bin");
|
||||
}
|
||||
else if (r->uri[0] == '/') {
|
||||
mode = conf->doc_root_mode;
|
||||
map = conf->doc_root;
|
||||
uri = r->uri;
|
||||
mode = conf->doc_root_mode;
|
||||
map = conf->doc_root;
|
||||
uri = r->uri;
|
||||
}
|
||||
else {
|
||||
return DECLINED;
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
if (mode == VHOST_ALIAS_NAME) {
|
||||
name = ap_get_server_name(r);
|
||||
name = ap_get_server_name(r);
|
||||
}
|
||||
else if (mode == VHOST_ALIAS_IP) {
|
||||
name = r->connection->local_ip;
|
||||
name = r->connection->local_ip;
|
||||
}
|
||||
else {
|
||||
return DECLINED;
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
/* ### There is an optimization available here to determine the
|
||||
@@ -429,9 +429,9 @@ static int mva_translate(request_rec *r)
|
||||
vhost_alias_interpolate(r, name, map, uri);
|
||||
|
||||
if (cgi) {
|
||||
/* see is_scriptaliased() in mod_cgi */
|
||||
r->handler = "cgi-script";
|
||||
apr_table_setn(r->notes, "alias-forced-type", r->handler);
|
||||
/* see is_scriptaliased() in mod_cgi */
|
||||
r->handler = "cgi-script";
|
||||
apr_table_setn(r->notes, "alias-forced-type", r->handler);
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
@@ -375,7 +375,7 @@ static void *merge_expires_dir_configs(apr_pool_t *p, void *basev, void *addv)
|
||||
new->expiresdefault = add->expiresdefault;
|
||||
}
|
||||
else {
|
||||
new->expiresdefault = base->expiresdefault;
|
||||
new->expiresdefault = base->expiresdefault;
|
||||
}
|
||||
new->wildcards = add->wildcards;
|
||||
new->expiresbytype = apr_table_overlay(p, add->expiresbytype,
|
||||
@@ -399,13 +399,13 @@ static int set_expiration_fields(request_rec *r, const char *code,
|
||||
|
||||
switch (code[0]) {
|
||||
case 'M':
|
||||
if (r->finfo.filetype == 0) {
|
||||
/* file doesn't exist on disk, so we can't do anything based on
|
||||
* modification time. Note that this does _not_ log an error.
|
||||
*/
|
||||
return DECLINED;
|
||||
}
|
||||
base = r->finfo.mtime;
|
||||
if (r->finfo.filetype == 0) {
|
||||
/* file doesn't exist on disk, so we can't do anything based on
|
||||
* modification time. Note that this does _not_ log an error.
|
||||
*/
|
||||
return DECLINED;
|
||||
}
|
||||
base = r->finfo.mtime;
|
||||
additional_sec = atoi(&code[1]);
|
||||
additional = apr_time_from_sec(additional_sec);
|
||||
break;
|
||||
|
@@ -534,11 +534,11 @@ static void do_headers_fixup(request_rec *r, apr_table_t *headers,
|
||||
header_entry *hdr = &((header_entry *) (fixup->elts))[i];
|
||||
const char *envar = hdr->condition_var;
|
||||
|
||||
/* ignore early headers in late calls */
|
||||
/* ignore early headers in late calls */
|
||||
if (!early && (envar == condition_early)) {
|
||||
continue;
|
||||
}
|
||||
/* ignore late headers in early calls */
|
||||
/* ignore late headers in early calls */
|
||||
else if (early && (envar != condition_early)) {
|
||||
continue;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -253,7 +253,7 @@ static const char *non_regex_pattern(apr_pool_t *p, const char *s)
|
||||
}
|
||||
|
||||
static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
|
||||
char *fname, const char *args)
|
||||
char *fname, const char *args)
|
||||
{
|
||||
char *regex;
|
||||
const char *simple_pattern;
|
||||
@@ -274,7 +274,7 @@ static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
|
||||
sconf = (cmd->path != NULL)
|
||||
? (sei_cfg_rec *) mconfig
|
||||
: (sei_cfg_rec *) ap_get_module_config(cmd->server->module_config,
|
||||
&setenvif_module);
|
||||
&setenvif_module);
|
||||
entries = (sei_entry *) sconf->conditionals->elts;
|
||||
/* get regex */
|
||||
regex = ap_getword_conf(cmd->pool, &args);
|
||||
@@ -427,7 +427,7 @@ static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
|
||||
}
|
||||
|
||||
static const char *add_setenvif(cmd_parms *cmd, void *mconfig,
|
||||
const char *args)
|
||||
const char *args)
|
||||
{
|
||||
char *fname;
|
||||
|
||||
|
@@ -284,8 +284,8 @@ static int gen_unique_id(request_rec *r)
|
||||
*/
|
||||
unique_id_rec new_unique_id;
|
||||
struct {
|
||||
unique_id_rec foo;
|
||||
unsigned char pad[2];
|
||||
unique_id_rec foo;
|
||||
unsigned char pad[2];
|
||||
} paddedbuf;
|
||||
unsigned char *x,*y;
|
||||
unsigned short counter;
|
||||
@@ -296,8 +296,8 @@ static int gen_unique_id(request_rec *r)
|
||||
* actually called for sub requests, so we don't need to test for
|
||||
* them) */
|
||||
if (r->prev && (e = apr_table_get(r->subprocess_env, "REDIRECT_UNIQUE_ID"))) {
|
||||
apr_table_setn(r->subprocess_env, "UNIQUE_ID", e);
|
||||
return DECLINED;
|
||||
apr_table_setn(r->subprocess_env, "UNIQUE_ID", e);
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
new_unique_id.in_addr = cur_unique_id.in_addr;
|
||||
|
@@ -95,12 +95,12 @@ typedef struct {
|
||||
static void make_cookie(request_rec *r)
|
||||
{
|
||||
cookie_log_state *cls = ap_get_module_config(r->server->module_config,
|
||||
&usertrack_module);
|
||||
&usertrack_module);
|
||||
/* 1024 == hardcoded constant */
|
||||
char cookiebuf[1024];
|
||||
char *new_cookie;
|
||||
const char *rname = ap_get_remote_host(r->connection, r->per_dir_config,
|
||||
REMOTE_NAME, NULL);
|
||||
REMOTE_NAME, NULL);
|
||||
cookie_dir_rec *dcfg;
|
||||
|
||||
dcfg = ap_get_module_config(r->per_dir_config, &usertrack_module);
|
||||
@@ -116,7 +116,7 @@ static void make_cookie(request_rec *r)
|
||||
dcfg->cookie_name, cookiebuf);
|
||||
|
||||
if ((dcfg->style == CT_UNSET) || (dcfg->style == CT_NETSCAPE)) {
|
||||
apr_time_exp_t tms;
|
||||
apr_time_exp_t tms;
|
||||
apr_time_exp_gmt(&tms, r->request_time
|
||||
+ apr_time_from_sec(cls->expires));
|
||||
new_cookie = apr_psprintf(r->pool,
|
||||
@@ -207,7 +207,7 @@ static void set_and_comp_regexp(cookie_dir_rec *dcfg,
|
||||
static int spot_cookie(request_rec *r)
|
||||
{
|
||||
cookie_dir_rec *dcfg = ap_get_module_config(r->per_dir_config,
|
||||
&usertrack_module);
|
||||
&usertrack_module);
|
||||
const char *cookie_header;
|
||||
ap_regmatch_t regm[NUM_SUBS];
|
||||
|
||||
@@ -308,7 +308,7 @@ static const char *set_cookie_exp(cmd_parms *parms, void *dummy,
|
||||
/* {<num> <type>}* */
|
||||
while (word[0]) {
|
||||
/* <num> */
|
||||
if (apr_isdigit(word[0]))
|
||||
if (apr_isdigit(word[0]))
|
||||
num = atoi(word);
|
||||
else
|
||||
return "bad expires code, numeric value expected.";
|
||||
|
@@ -144,7 +144,7 @@ static const command_rec ssl_config_cmds[] = {
|
||||
SSL_CMD_SRV(HonorCipherOrder, FLAG,
|
||||
"Use the server's cipher ordering preference")
|
||||
SSL_CMD_ALL(UserName, TAKE1,
|
||||
"Set user name to SSL variable value")
|
||||
"Set user name to SSL variable value")
|
||||
|
||||
/*
|
||||
* Proxy configuration for remote SSL connections
|
||||
|
@@ -1404,7 +1404,7 @@ const char *ssl_cmd_SSLProxyMachineCertificatePath(cmd_parms *cmd,
|
||||
|
||||
|
||||
const char *ssl_cmd_SSLUserName(cmd_parms *cmd, void *dcfg,
|
||||
const char *arg)
|
||||
const char *arg)
|
||||
{
|
||||
SSLDirConfigRec *dc = (SSLDirConfigRec *)dcfg;
|
||||
dc->szUserName = arg;
|
||||
|
@@ -596,16 +596,16 @@ static int pipe_get_passwd_cb(char *buf, int length, char *prompt, int verify)
|
||||
apr_file_puts(APR_EOL_STR, writetty);
|
||||
|
||||
if (rc != APR_SUCCESS || apr_file_eof(readtty)) {
|
||||
memset(buf, 0, length);
|
||||
memset(buf, 0, length);
|
||||
return 1; /* failure */
|
||||
}
|
||||
if ((p = strchr(buf, '\n')) != NULL) {
|
||||
*p = '\0';
|
||||
*p = '\0';
|
||||
}
|
||||
#ifdef WIN32
|
||||
/* XXX: apr_sometest */
|
||||
if ((p = strchr(buf, '\r')) != NULL) {
|
||||
*p = '\0';
|
||||
*p = '\0';
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
@@ -676,7 +676,7 @@ int ssl_pphrase_Handle_CB(char *buf, int bufsize, int verify, void *srv)
|
||||
ap_log_error(APLOG_MARK, APLOG_INFO, 0, s,
|
||||
"Init: Creating pass phrase dialog pipe child "
|
||||
"'%s'", sc->server->pphrase_dialog_path);
|
||||
if (ssl_pipe_child_create(p, sc->server->pphrase_dialog_path)
|
||||
if (ssl_pipe_child_create(p, sc->server->pphrase_dialog_path)
|
||||
!= APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
|
||||
"Init: Failed to create pass phrase pipe '%s'",
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -44,7 +44,7 @@ void ssl_scache_dbm_init(server_rec *s, apr_pool_t *p)
|
||||
/* open it once to create it and to make sure it _can_ be created */
|
||||
ssl_mutex_on(s);
|
||||
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||
"Cannot create SSLSessionCache DBM file `%s'",
|
||||
mc->szSessionCacheDataFile);
|
||||
@@ -159,7 +159,7 @@ BOOL ssl_scache_dbm_store(server_rec *s, UCHAR *id, int idlen, time_t expiry, SS
|
||||
/* and store it to the DBM file */
|
||||
ssl_mutex_on(s);
|
||||
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||
"Cannot open SSLSessionCache DBM file `%s' for writing "
|
||||
"(store)",
|
||||
@@ -215,7 +215,7 @@ SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *s, UCHAR *id, int idlen)
|
||||
*/
|
||||
ssl_mutex_on(s);
|
||||
if ((rc = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
|
||||
"Cannot open SSLSessionCache DBM file `%s' for reading "
|
||||
"(fetch)",
|
||||
@@ -278,7 +278,7 @@ void ssl_scache_dbm_remove(server_rec *s, UCHAR *id, int idlen)
|
||||
/* and delete it from the DBM file */
|
||||
ssl_mutex_on(s);
|
||||
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||
"Cannot open SSLSessionCache DBM file `%s' for writing "
|
||||
"(delete)",
|
||||
@@ -384,7 +384,7 @@ static void ssl_scache_dbm_expire(server_rec *s)
|
||||
|
||||
/* pass 2: delete expired elements */
|
||||
if (apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||
APR_DBM_RWCREATE,SSL_DBM_FILE_MODE, p) != APR_SUCCESS) {
|
||||
APR_DBM_RWCREATE,SSL_DBM_FILE_MODE, p) != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||
"Cannot re-open SSLSessionCache DBM file `%s' for "
|
||||
"expiring",
|
||||
@@ -431,7 +431,7 @@ void ssl_scache_dbm_status(request_rec *r, int flags, apr_pool_t *p)
|
||||
* XXX - Check what pool is to be used - TBD
|
||||
*/
|
||||
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE,
|
||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE,
|
||||
mc->pPool)) != APR_SUCCESS) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||
"Cannot open SSLSessionCache DBM file `%s' for status "
|
||||
|
@@ -210,35 +210,35 @@ typedef struct {
|
||||
static unsigned int shmcb_get_safe_uint(unsigned int *);
|
||||
static void shmcb_set_safe_uint_ex(unsigned char *, const unsigned char *);
|
||||
#define shmcb_set_safe_uint(pdest, src) \
|
||||
do { \
|
||||
unsigned int tmp_uint = src; \
|
||||
shmcb_set_safe_uint_ex((unsigned char *)pdest, \
|
||||
(const unsigned char *)(&tmp_uint)); \
|
||||
} while(0)
|
||||
do { \
|
||||
unsigned int tmp_uint = src; \
|
||||
shmcb_set_safe_uint_ex((unsigned char *)pdest, \
|
||||
(const unsigned char *)(&tmp_uint)); \
|
||||
} while(0)
|
||||
#if 0 /* Unused so far */
|
||||
static unsigned long shmcb_get_safe_ulong(unsigned long *);
|
||||
static void shmcb_set_safe_ulong_ex(unsigned char *, const unsigned char *);
|
||||
#define shmcb_set_safe_ulong(pdest, src) \
|
||||
do { \
|
||||
unsigned long tmp_ulong = src; \
|
||||
shmcb_set_safe_ulong_ex((unsigned char *)pdest, \
|
||||
(const unsigned char *)(&tmp_ulong)); \
|
||||
} while(0)
|
||||
do { \
|
||||
unsigned long tmp_ulong = src; \
|
||||
shmcb_set_safe_ulong_ex((unsigned char *)pdest, \
|
||||
(const unsigned char *)(&tmp_ulong)); \
|
||||
} while(0)
|
||||
#endif
|
||||
static time_t shmcb_get_safe_time(time_t *);
|
||||
static void shmcb_set_safe_time_ex(unsigned char *, const unsigned char *);
|
||||
#define shmcb_set_safe_time(pdest, src) \
|
||||
do { \
|
||||
time_t tmp_time = src; \
|
||||
shmcb_set_safe_time_ex((unsigned char *)pdest, \
|
||||
(const unsigned char *)(&tmp_time)); \
|
||||
} while(0)
|
||||
do { \
|
||||
time_t tmp_time = src; \
|
||||
shmcb_set_safe_time_ex((unsigned char *)pdest, \
|
||||
(const unsigned char *)(&tmp_time)); \
|
||||
} while(0)
|
||||
|
||||
/* This is necessary simply so that the size passed to memset() is not a
|
||||
* compile-time constant, preventing the compiler from optimising it. */
|
||||
static void shmcb_safe_clear(void *ptr, size_t size)
|
||||
{
|
||||
memset(ptr, 0, size);
|
||||
memset(ptr, 0, size);
|
||||
}
|
||||
|
||||
/* Underlying functions for session-caching */
|
||||
@@ -279,12 +279,12 @@ static unsigned int shmcb_get_safe_uint(unsigned int *ptr)
|
||||
{
|
||||
unsigned int ret;
|
||||
shmcb_set_safe_uint_ex((unsigned char *)(&ret),
|
||||
(const unsigned char *)ptr);
|
||||
(const unsigned char *)ptr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void shmcb_set_safe_uint_ex(unsigned char *dest,
|
||||
const unsigned char *src)
|
||||
const unsigned char *src)
|
||||
{
|
||||
memcpy(dest, src, sizeof(unsigned int));
|
||||
}
|
||||
@@ -294,12 +294,12 @@ static unsigned long shmcb_get_safe_ulong(unsigned long *ptr)
|
||||
{
|
||||
unsigned long ret;
|
||||
shmcb_set_safe_ulong_ex((unsigned char *)(&ret),
|
||||
(const unsigned char *)ptr);
|
||||
(const unsigned char *)ptr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void shmcb_set_safe_ulong_ex(unsigned char *dest,
|
||||
const unsigned char *src)
|
||||
const unsigned char *src)
|
||||
{
|
||||
memcpy(dest, src, sizeof(unsigned long));
|
||||
}
|
||||
@@ -309,12 +309,12 @@ static time_t shmcb_get_safe_time(time_t * ptr)
|
||||
{
|
||||
time_t ret;
|
||||
shmcb_set_safe_time_ex((unsigned char *)(&ret),
|
||||
(const unsigned char *)ptr);
|
||||
(const unsigned char *)ptr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void shmcb_set_safe_time_ex(unsigned char *dest,
|
||||
const unsigned char *src)
|
||||
const unsigned char *src)
|
||||
{
|
||||
memcpy(dest, src, sizeof(time_t));
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@
|
||||
static int TestOptionalFn(const char *szStr)
|
||||
{
|
||||
ap_log_error(APLOG_MARK,APLOG_ERR,OK,NULL,
|
||||
"Optional function test said: %s",szStr);
|
||||
"Optional function test said: %s",szStr);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ static APR_OPTIONAL_FN_TYPE(TestOptionalFn) *pfn;
|
||||
static int ImportLogTransaction(request_rec *r)
|
||||
{
|
||||
if(pfn)
|
||||
return pfn(r->the_request);
|
||||
return pfn(r->the_request);
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "http_protocol.h"
|
||||
|
||||
AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(int,optional_hook_test,(const char *szStr),
|
||||
(szStr),OK,DECLINED)
|
||||
(szStr),OK,DECLINED)
|
||||
|
||||
static int ExportLogTransaction(request_rec *r)
|
||||
{
|
||||
|
@@ -22,7 +22,7 @@
|
||||
static int ImportOptionalHookTestHook(const char *szStr)
|
||||
{
|
||||
ap_log_error(APLOG_MARK,APLOG_ERR,OK,NULL,"Optional hook test said: %s",
|
||||
szStr);
|
||||
szStr);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ static int ImportOptionalHookTestHook(const char *szStr)
|
||||
static void ImportRegisterHooks(apr_pool_t *p)
|
||||
{
|
||||
AP_OPTIONAL_HOOK(optional_hook_test,ImportOptionalHookTestHook,NULL,
|
||||
NULL,APR_HOOK_MIDDLE);
|
||||
NULL,APR_HOOK_MIDDLE);
|
||||
}
|
||||
|
||||
module AP_MODULE_DECLARE_DATA optional_hook_import_module=
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#if APR_CHARSET_EBCDIC
|
||||
#include "ebcdic.h"
|
||||
/*
|
||||
Initial Port for Apache-1.3 by <Martin.Kraemer Mch.SNI.De>
|
||||
Initial Port for Apache-1.3 by <Martin.Kraemer Mch.SNI.De>
|
||||
|
||||
"BS2000 OSD" is a POSIX on a main frame. It is made by Siemens AG, Germany.
|
||||
Within the POSIX subsystem, the same character set was chosen as in
|
||||
@@ -149,37 +149,37 @@ f0 8c 49 cd ce cb cf cc e1 70 c0 de db dc 8d 8e df *................*
|
||||
*/
|
||||
const unsigned char os_toebcdic[256] = {
|
||||
/*00*/ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
|
||||
0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
|
||||
0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
|
||||
/*10*/ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
|
||||
0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
|
||||
0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
|
||||
/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
|
||||
0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
|
||||
0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
|
||||
/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
||||
0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/
|
||||
0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/
|
||||
/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
||||
0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/
|
||||
0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/
|
||||
/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
|
||||
0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/
|
||||
0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/
|
||||
/*60*/ 0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/
|
||||
0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/
|
||||
/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
|
||||
0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/
|
||||
0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/
|
||||
/*80*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08,
|
||||
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/
|
||||
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/
|
||||
/*90*/ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17,
|
||||
0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/
|
||||
0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/
|
||||
/*a0*/ 0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
|
||||
0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/
|
||||
0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/
|
||||
/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
|
||||
0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/
|
||||
0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/
|
||||
/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
|
||||
0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/
|
||||
0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/
|
||||
/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
|
||||
0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/
|
||||
0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/
|
||||
/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
|
||||
0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/
|
||||
0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/
|
||||
/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
|
||||
0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/
|
||||
0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/
|
||||
};
|
||||
|
||||
/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset)
|
||||
@@ -189,22 +189,22 @@ const unsigned char os_toebcdic[256] = {
|
||||
void
|
||||
ebcdic2ascii(unsigned char *dest, const unsigned char *srce, size_t count)
|
||||
{
|
||||
while (count-- != 0) {
|
||||
*dest++ = os_toascii[*srce++];
|
||||
}
|
||||
while (count-- != 0) {
|
||||
*dest++ = os_toascii[*srce++];
|
||||
}
|
||||
}
|
||||
void
|
||||
ebcdic2ascii_strictly(unsigned char *dest, const unsigned char *srce, size_t count)
|
||||
{
|
||||
while (count-- != 0) {
|
||||
*dest++ = os_toascii_strictly[*srce++];
|
||||
}
|
||||
while (count-- != 0) {
|
||||
*dest++ = os_toascii_strictly[*srce++];
|
||||
}
|
||||
}
|
||||
void
|
||||
ascii2ebcdic(unsigned char *dest, const unsigned char *srce, size_t count)
|
||||
{
|
||||
while (count-- != 0) {
|
||||
*dest++ = os_toebcdic[*srce++];
|
||||
}
|
||||
while (count-- != 0) {
|
||||
*dest++ = os_toebcdic[*srce++];
|
||||
}
|
||||
}
|
||||
#endif /*APR_CHARSET_EBCDIC*/
|
||||
|
@@ -44,8 +44,8 @@ static bs2_ForkType forktype = bs2_unknown;
|
||||
static void ap_str_toupper(char *str)
|
||||
{
|
||||
while (*str) {
|
||||
*str = apr_toupper(*str);
|
||||
++str;
|
||||
*str = apr_toupper(*str);
|
||||
++str;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,12 +90,12 @@ int os_init_job_environment(server_rec *server, const char *user_name, int one_p
|
||||
|
||||
if (one_process) {
|
||||
|
||||
type = forktype = bs2_noFORK;
|
||||
type = forktype = bs2_noFORK;
|
||||
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, server,
|
||||
"The debug mode of Apache should only "
|
||||
"be started by an unprivileged user!");
|
||||
return 0;
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, server,
|
||||
"The debug mode of Apache should only "
|
||||
"be started by an unprivileged user!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -110,27 +110,27 @@ pid_t os_fork(const char *user)
|
||||
switch (os_forktype(0)) {
|
||||
|
||||
case bs2_FORK:
|
||||
pid = fork();
|
||||
break;
|
||||
pid = fork();
|
||||
break;
|
||||
|
||||
case bs2_UFORK:
|
||||
apr_cpystrn(username, user, sizeof username);
|
||||
apr_cpystrn(username, user, sizeof username);
|
||||
|
||||
/* Make user name all upper case - for some versions of ufork() */
|
||||
ap_str_toupper(username);
|
||||
/* Make user name all upper case - for some versions of ufork() */
|
||||
ap_str_toupper(username);
|
||||
|
||||
pid = ufork(username);
|
||||
if (pid == -1 && errno == EPERM) {
|
||||
ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
|
||||
NULL, "ufork: Possible mis-configuration "
|
||||
"for user %s - Aborting.", user);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
pid = ufork(username);
|
||||
if (pid == -1 && errno == EPERM) {
|
||||
ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
|
||||
NULL, "ufork: Possible mis-configuration "
|
||||
"for user %s - Aborting.", user);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
pid = 0;
|
||||
break;
|
||||
pid = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return pid;
|
||||
|
@@ -37,13 +37,13 @@ AP_DECLARE(apr_status_t) ap_os_create_privileged_process(
|
||||
|
||||
int _NonAppCheckUnload( void )
|
||||
{
|
||||
return nlmUnloadSignaled(1);
|
||||
return nlmUnloadSignaled(1);
|
||||
}
|
||||
|
||||
// down server event callback
|
||||
void ap_down_server_cb(void *, void *)
|
||||
{
|
||||
nlmUnloadSignaled(0);
|
||||
nlmUnloadSignaled(0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
160
os/unix/unixd.c
160
os/unix/unixd.c
@@ -63,49 +63,49 @@ unixd_config_rec unixd_config;
|
||||
static int set_group_privs(void)
|
||||
{
|
||||
if (!geteuid()) {
|
||||
const char *name;
|
||||
const char *name;
|
||||
|
||||
/* Get username if passed as a uid */
|
||||
/* Get username if passed as a uid */
|
||||
|
||||
if (unixd_config.user_name[0] == '#') {
|
||||
struct passwd *ent;
|
||||
uid_t uid = atoi(&unixd_config.user_name[1]);
|
||||
if (unixd_config.user_name[0] == '#') {
|
||||
struct passwd *ent;
|
||||
uid_t uid = atoi(&unixd_config.user_name[1]);
|
||||
|
||||
if ((ent = getpwuid(uid)) == NULL) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||
"getpwuid: couldn't determine user name from uid %u, "
|
||||
"you probably need to modify the User directive",
|
||||
(unsigned)uid);
|
||||
return -1;
|
||||
}
|
||||
if ((ent = getpwuid(uid)) == NULL) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||
"getpwuid: couldn't determine user name from uid %u, "
|
||||
"you probably need to modify the User directive",
|
||||
(unsigned)uid);
|
||||
return -1;
|
||||
}
|
||||
|
||||
name = ent->pw_name;
|
||||
}
|
||||
else
|
||||
name = unixd_config.user_name;
|
||||
name = ent->pw_name;
|
||||
}
|
||||
else
|
||||
name = unixd_config.user_name;
|
||||
|
||||
#if !defined(OS2) && !defined(TPF)
|
||||
/* OS/2 and TPF don't support groups. */
|
||||
/* OS/2 and TPF don't support groups. */
|
||||
|
||||
/*
|
||||
* Set the GID before initgroups(), since on some platforms
|
||||
* setgid() is known to zap the group list.
|
||||
*/
|
||||
if (setgid(unixd_config.group_id) == -1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||
"setgid: unable to set group id to Group %u",
|
||||
(unsigned)unixd_config.group_id);
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* Set the GID before initgroups(), since on some platforms
|
||||
* setgid() is known to zap the group list.
|
||||
*/
|
||||
if (setgid(unixd_config.group_id) == -1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||
"setgid: unable to set group id to Group %u",
|
||||
(unsigned)unixd_config.group_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Reset `groups' attributes. */
|
||||
/* Reset `groups' attributes. */
|
||||
|
||||
if (initgroups(name, unixd_config.group_id) == -1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||
"initgroups: unable to set groups for User %s "
|
||||
"and Group %u", name, (unsigned)unixd_config.group_id);
|
||||
return -1;
|
||||
}
|
||||
if (initgroups(name, unixd_config.group_id) == -1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||
"initgroups: unable to set groups for User %s "
|
||||
"and Group %u", name, (unsigned)unixd_config.group_id);
|
||||
return -1;
|
||||
}
|
||||
#endif /* !defined(OS2) && !defined(TPF) */
|
||||
}
|
||||
return 0;
|
||||
@@ -115,32 +115,32 @@ static int set_group_privs(void)
|
||||
AP_DECLARE(int) unixd_setup_child(void)
|
||||
{
|
||||
if (set_group_privs()) {
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
#ifdef MPE
|
||||
/* Only try to switch if we're running as MANAGER.SYS */
|
||||
if (geteuid() == 1 && unixd_config.user_id > 1) {
|
||||
GETPRIVMODE();
|
||||
if (setuid(unixd_config.user_id) == -1) {
|
||||
GETUSERMODE();
|
||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||
"setuid: unable to change to uid: %ld",
|
||||
GETPRIVMODE();
|
||||
if (setuid(unixd_config.user_id) == -1) {
|
||||
GETUSERMODE();
|
||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||
"setuid: unable to change to uid: %ld",
|
||||
(long) unixd_config.user_id);
|
||||
exit(1);
|
||||
}
|
||||
GETUSERMODE();
|
||||
exit(1);
|
||||
}
|
||||
GETUSERMODE();
|
||||
}
|
||||
#else
|
||||
/* Only try to switch if we're running as root */
|
||||
if (!geteuid() && (
|
||||
#ifdef _OSD_POSIX
|
||||
os_init_job_environment(NULL, unixd_config.user_name, ap_exists_config_define("DEBUG")) != 0 ||
|
||||
os_init_job_environment(NULL, unixd_config.user_name, ap_exists_config_define("DEBUG")) != 0 ||
|
||||
#endif
|
||||
setuid(unixd_config.user_id) == -1)) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||
"setuid: unable to change to uid: %ld",
|
||||
setuid(unixd_config.user_id) == -1)) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||
"setuid: unable to change to uid: %ld",
|
||||
(long) unixd_config.user_id);
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
|
||||
/* this applies to Linux 2.4+ */
|
||||
@@ -171,15 +171,15 @@ AP_DECLARE(const char *) unixd_set_user(cmd_parms *cmd, void *dummy,
|
||||
unixd_config.user_id = ap_uname2id(arg);
|
||||
#if !defined (BIG_SECURITY_HOLE) && !defined (OS2)
|
||||
if (unixd_config.user_id == 0) {
|
||||
return "Error:\tApache has not been designed to serve pages while\n"
|
||||
"\trunning as root. There are known race conditions that\n"
|
||||
"\twill allow any local user to read any file on the system.\n"
|
||||
"\tIf you still desire to serve pages as root then\n"
|
||||
"\tadd -DBIG_SECURITY_HOLE to the CFLAGS env variable\n"
|
||||
"\tand then rebuild the server.\n"
|
||||
"\tIt is strongly suggested that you instead modify the User\n"
|
||||
"\tdirective in your httpd.conf file to list a non-root\n"
|
||||
"\tuser.\n";
|
||||
return "Error:\tApache has not been designed to serve pages while\n"
|
||||
"\trunning as root. There are known race conditions that\n"
|
||||
"\twill allow any local user to read any file on the system.\n"
|
||||
"\tIf you still desire to serve pages as root then\n"
|
||||
"\tadd -DBIG_SECURITY_HOLE to the CFLAGS env variable\n"
|
||||
"\tand then rebuild the server.\n"
|
||||
"\tIt is strongly suggested that you instead modify the User\n"
|
||||
"\tdirective in your httpd.conf file to list a non-root\n"
|
||||
"\tuser.\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -330,7 +330,7 @@ static apr_status_t ap_unix_create_privileged_process(
|
||||
if (args) {
|
||||
while (args[i]) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* allocate space for 4 new args, the input args, and a null terminator */
|
||||
newargs = apr_palloc(p, sizeof(char *) * (i + 4));
|
||||
@@ -622,8 +622,8 @@ static bs2_ForkType forktype = bs2_unknown;
|
||||
static void ap_str_toupper(char *str)
|
||||
{
|
||||
while (*str) {
|
||||
*str = apr_toupper(*str);
|
||||
++str;
|
||||
*str = apr_toupper(*str);
|
||||
++str;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,12 +668,12 @@ int os_init_job_environment(server_rec *server, const char *user_name, int one_p
|
||||
|
||||
if (one_process) {
|
||||
|
||||
type = forktype = bs2_noFORK;
|
||||
type = forktype = bs2_noFORK;
|
||||
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, server,
|
||||
"The debug mode of Apache should only "
|
||||
"be started by an unprivileged user!");
|
||||
return 0;
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, server,
|
||||
"The debug mode of Apache should only "
|
||||
"be started by an unprivileged user!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -688,27 +688,27 @@ pid_t os_fork(const char *user)
|
||||
switch (os_forktype(0)) {
|
||||
|
||||
case bs2_FORK:
|
||||
pid = fork();
|
||||
break;
|
||||
pid = fork();
|
||||
break;
|
||||
|
||||
case bs2_UFORK:
|
||||
apr_cpystrn(username, user, sizeof username);
|
||||
apr_cpystrn(username, user, sizeof username);
|
||||
|
||||
/* Make user name all upper case - for some versions of ufork() */
|
||||
ap_str_toupper(username);
|
||||
/* Make user name all upper case - for some versions of ufork() */
|
||||
ap_str_toupper(username);
|
||||
|
||||
pid = ufork(username);
|
||||
if (pid == -1 && errno == EPERM) {
|
||||
ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
|
||||
NULL, "ufork: Possible mis-configuration "
|
||||
"for user %s - Aborting.", user);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
pid = ufork(username);
|
||||
if (pid == -1 && errno == EPERM) {
|
||||
ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
|
||||
NULL, "ufork: Possible mis-configuration "
|
||||
"for user %s - Aborting.", user);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
pid = 0;
|
||||
break;
|
||||
pid = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return pid;
|
||||
|
@@ -121,13 +121,13 @@ PSECURITY_ATTRIBUTES GetNullACL()
|
||||
}
|
||||
apr_set_os_error(0);
|
||||
if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION)
|
||||
|| apr_get_os_error()) {
|
||||
|| apr_get_os_error()) {
|
||||
LocalFree( pSD );
|
||||
LocalFree( sa );
|
||||
return NULL;
|
||||
}
|
||||
if (!SetSecurityDescriptorDacl(pSD, TRUE, (PACL) NULL, FALSE)
|
||||
|| apr_get_os_error()) {
|
||||
|| apr_get_os_error()) {
|
||||
LocalFree( pSD );
|
||||
LocalFree( sa );
|
||||
return NULL;
|
||||
|
@@ -34,8 +34,8 @@
|
||||
|
||||
APR_HOOK_STRUCT(
|
||||
APR_HOOK_LINK(create_connection)
|
||||
APR_HOOK_LINK(process_connection)
|
||||
APR_HOOK_LINK(pre_connection)
|
||||
APR_HOOK_LINK(process_connection)
|
||||
APR_HOOK_LINK(pre_connection)
|
||||
)
|
||||
AP_IMPLEMENT_HOOK_RUN_FIRST(conn_rec *,create_connection,
|
||||
(apr_pool_t *p, server_rec *server, apr_socket_t *csd, long conn_id, void *sbh, apr_bucket_alloc_t *alloc),
|
||||
|
@@ -260,7 +260,7 @@ static void *merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv)
|
||||
}
|
||||
|
||||
if (!(new->override_opts & OPT_UNSET)) {
|
||||
conf->override_opts = new->override_opts;
|
||||
conf->override_opts = new->override_opts;
|
||||
}
|
||||
|
||||
if (new->ap_default_type) {
|
||||
@@ -750,7 +750,7 @@ char *ap_response_code_string(request_rec *r, int error_index)
|
||||
&core_module);
|
||||
|
||||
if (dirconf->response_code_strings == NULL) {
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (dirconf->response_code_strings[error_index] == &errordocument_default) {
|
||||
@@ -1343,21 +1343,21 @@ static const char *set_override(cmd_parms *cmd, void *d_, const char *l)
|
||||
while (l[0]) {
|
||||
w = ap_getword_conf(cmd->pool, &l);
|
||||
|
||||
k = w;
|
||||
v = strchr(k, '=');
|
||||
if (v) {
|
||||
*v++ = '\0';
|
||||
}
|
||||
k = w;
|
||||
v = strchr(k, '=');
|
||||
if (v) {
|
||||
*v++ = '\0';
|
||||
}
|
||||
|
||||
if (!strcasecmp(w, "Limit")) {
|
||||
d->override |= OR_LIMIT;
|
||||
}
|
||||
else if (!strcasecmp(k, "Options")) {
|
||||
d->override |= OR_OPTIONS;
|
||||
if (v)
|
||||
if (v)
|
||||
set_allow_opts(cmd, &(d->override_opts), v);
|
||||
else
|
||||
d->override_opts = OPT_ALL;
|
||||
else
|
||||
d->override_opts = OPT_ALL;
|
||||
}
|
||||
else if (!strcasecmp(w, "FileInfo")) {
|
||||
d->override |= OR_FILEINFO;
|
||||
@@ -1437,8 +1437,8 @@ static const char *set_options(cmd_parms *cmd, void *d_, const char *l)
|
||||
return apr_pstrcat(cmd->pool, "Illegal option ", w, NULL);
|
||||
}
|
||||
|
||||
if (!(cmd->override_opts & opt) && opt != OPT_NONE) {
|
||||
return apr_pstrcat(cmd->pool, "Option ", w, " not allowed here", NULL);
|
||||
if (!(cmd->override_opts & opt) && opt != OPT_NONE) {
|
||||
return apr_pstrcat(cmd->pool, "Option ", w, " not allowed here", NULL);
|
||||
}
|
||||
else if (action == '-') {
|
||||
/* we ensure the invariant (d->opts_add & d->opts_remove) == 0 */
|
||||
|
@@ -296,7 +296,7 @@ static apr_status_t beos_accept(void **accepted, ap_listen_rec *lr, apr_pool_t *
|
||||
if (APR_STATUS_IS_EINTR(status)) {
|
||||
return status;
|
||||
}
|
||||
/* This switch statement provides us with better error details. */
|
||||
/* This switch statement provides us with better error details. */
|
||||
switch (status) {
|
||||
#ifdef ECONNABORTED
|
||||
case ECONNABORTED:
|
||||
@@ -376,7 +376,7 @@ static void set_signals(void)
|
||||
/* These next two are handled by sig_term */
|
||||
sa.sa_handler = sig_term;
|
||||
if (sigaction(SIGTERM, &sa, NULL) < 0)
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
|
||||
if (sigaction(SIGINT, &sa, NULL) < 0)
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)");
|
||||
|
||||
@@ -393,7 +393,7 @@ static void set_signals(void)
|
||||
if (sigaction(SIGHUP, &sa, NULL) < 0)
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
|
||||
if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(" AP_SIG_GRACEFUL_STRING ")");
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(" AP_SIG_GRACEFUL_STRING ")");
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
@@ -489,7 +489,7 @@ static int32 worker_thread(void *dummy)
|
||||
|
||||
mpm_state = AP_MPMQ_RUNNING;
|
||||
|
||||
while (!this_worker_should_exit) {
|
||||
while (!this_worker_should_exit) {
|
||||
conn_rec *current_conn;
|
||||
void *csd;
|
||||
|
||||
@@ -603,7 +603,7 @@ static int make_worker(int slot)
|
||||
thread_id tid;
|
||||
|
||||
if (slot + 1 > ap_max_child_assigned)
|
||||
ap_max_child_assigned = slot + 1;
|
||||
ap_max_child_assigned = slot + 1;
|
||||
|
||||
(void) ap_update_child_status_from_indexes(0, slot, SERVER_STARTING, (request_rec*)NULL);
|
||||
|
||||
@@ -663,7 +663,7 @@ static void startup_threads(int number_to_start)
|
||||
continue;
|
||||
|
||||
if (make_worker(i) < 0)
|
||||
break;
|
||||
break;
|
||||
|
||||
--number_to_start;
|
||||
}
|
||||
@@ -704,23 +704,23 @@ static void perform_idle_server_maintenance(void)
|
||||
}
|
||||
|
||||
if (i >= ap_max_child_assigned && free_length >= spawn_rate) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
ap_max_child_assigned = last_non_dead + 1;
|
||||
|
||||
if (free_length > 0) {
|
||||
for (i = 0; i < free_length; ++i) {
|
||||
make_worker(free_slots[i]);
|
||||
}
|
||||
/* the next time around we want to spawn twice as many if this
|
||||
* wasn't good enough, but not if we've just done a graceful
|
||||
*/
|
||||
if (hold_off_on_exponential_spawning) {
|
||||
--hold_off_on_exponential_spawning;
|
||||
} else if (spawn_rate < MAX_SPAWN_RATE) {
|
||||
spawn_rate *= 2;
|
||||
}
|
||||
make_worker(free_slots[i]);
|
||||
}
|
||||
/* the next time around we want to spawn twice as many if this
|
||||
* wasn't good enough, but not if we've just done a graceful
|
||||
*/
|
||||
if (hold_off_on_exponential_spawning) {
|
||||
--hold_off_on_exponential_spawning;
|
||||
} else if (spawn_rate < MAX_SPAWN_RATE) {
|
||||
spawn_rate *= 2;
|
||||
}
|
||||
} else {
|
||||
spawn_rate = 1;
|
||||
}
|
||||
@@ -759,13 +759,13 @@ static void server_main_loop(int remaining_threads_to_start)
|
||||
(request_rec*)NULL);
|
||||
|
||||
if (remaining_threads_to_start
|
||||
&& child_slot < ap_thread_limit) {
|
||||
&& child_slot < ap_thread_limit) {
|
||||
/* we're still doing a 1-for-1 replacement of dead
|
||||
* children with new children
|
||||
*/
|
||||
make_worker(child_slot);
|
||||
--remaining_threads_to_start;
|
||||
}
|
||||
}
|
||||
/* TODO
|
||||
#if APR_HAS_OTHER_CHILD
|
||||
}
|
||||
@@ -779,7 +779,7 @@ static void server_main_loop(int remaining_threads_to_start)
|
||||
* child.
|
||||
*/
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ap_server_conf,
|
||||
"long lost child came home! (pid %ld)", pid.pid);
|
||||
"long lost child came home! (pid %ld)", pid.pid);
|
||||
}
|
||||
|
||||
/* Don't perform idle maintenance when a child dies,
|
||||
@@ -789,7 +789,7 @@ static void server_main_loop(int remaining_threads_to_start)
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
else if (remaining_threads_to_start) {
|
||||
else if (remaining_threads_to_start) {
|
||||
/* we hit a 1 second timeout in which none of the previous
|
||||
* generation of children needed to be reaped... so assume
|
||||
* they're all done, and pick up the slack if any is left.
|
||||
@@ -913,7 +913,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
||||
remaining_threads_to_start = ap_threads_to_start;
|
||||
/* sanity check on the number to start... */
|
||||
if (remaining_threads_to_start > ap_thread_limit) {
|
||||
remaining_threads_to_start = ap_thread_limit;
|
||||
remaining_threads_to_start = ap_thread_limit;
|
||||
}
|
||||
|
||||
/* If we're doing the single process thing or we're in a graceful_restart
|
||||
@@ -922,11 +922,11 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
||||
* do we??
|
||||
*/
|
||||
if (!is_graceful && !one_process) {
|
||||
startup_threads(remaining_threads_to_start);
|
||||
remaining_threads_to_start = 0;
|
||||
startup_threads(remaining_threads_to_start);
|
||||
remaining_threads_to_start = 0;
|
||||
} else {
|
||||
/* give the system some time to recover before kicking into
|
||||
* exponential mode */
|
||||
/* give the system some time to recover before kicking into
|
||||
* exponential mode */
|
||||
hold_off_on_exponential_spawning = 10;
|
||||
}
|
||||
|
||||
@@ -934,11 +934,11 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
||||
* record that we've entered the world !
|
||||
*/
|
||||
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
|
||||
"%s configured -- resuming normal operations",
|
||||
ap_get_server_version());
|
||||
"%s configured -- resuming normal operations",
|
||||
ap_get_server_version());
|
||||
|
||||
ap_log_error(APLOG_MARK, APLOG_INFO, 0, ap_server_conf,
|
||||
"Server built: %s", ap_get_server_built());
|
||||
"Server built: %s", ap_get_server_built());
|
||||
|
||||
restart_pending = shutdown_pending = 0;
|
||||
|
||||
@@ -1003,7 +1003,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
||||
|
||||
if (is_graceful) {
|
||||
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
|
||||
AP_SIG_GRACEFUL_STRING " received. Doing graceful restart");
|
||||
AP_SIG_GRACEFUL_STRING " received. Doing graceful restart");
|
||||
} else {
|
||||
/* Kill 'em all. Since the child acts the same on the parents SIGTERM
|
||||
* and a SIGHUP, we may as well use the same signal, because some user
|
||||
@@ -1011,8 +1011,8 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
||||
*/
|
||||
|
||||
ap_reclaim_child_processes(1); /* Start with SIGTERM */
|
||||
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
|
||||
"SIGHUP received. Attempting to restart");
|
||||
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
|
||||
"SIGHUP received. Attempting to restart");
|
||||
}
|
||||
|
||||
/* just before we go, tidy up the lock we created to prevent a
|
||||
@@ -1070,7 +1070,7 @@ static int beos_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptem
|
||||
ap_pid_fname = DEFAULT_PIDLOG;
|
||||
ap_max_requests_per_thread = DEFAULT_MAX_REQUESTS_PER_THREAD;
|
||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
#endif
|
||||
|
||||
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
||||
|
@@ -26,7 +26,7 @@ typedef struct recycled_pool
|
||||
struct fd_queue_info_t
|
||||
{
|
||||
apr_int32_t idlers; /**
|
||||
* 0 or positive: number of idle worker threads
|
||||
* 0 or positive: number of idle worker threads
|
||||
* negative: number of threads blocked waiting
|
||||
* for an idle worker
|
||||
*/
|
||||
|
@@ -1534,9 +1534,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
||||
"Server built: %s", ap_get_server_built());
|
||||
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
||||
"AcceptMutex: %s (default: %s)",
|
||||
apr_proc_mutex_name(accept_mutex),
|
||||
apr_proc_mutex_defname());
|
||||
"AcceptMutex: %s (default: %s)",
|
||||
apr_proc_mutex_name(accept_mutex),
|
||||
apr_proc_mutex_defname());
|
||||
#endif
|
||||
restart_pending = shutdown_pending = 0;
|
||||
mpm_state = AP_MPMQ_RUNNING;
|
||||
@@ -1550,9 +1550,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
||||
* (By "gracefully" we don't mean graceful in the same sense as
|
||||
* "apachectl graceful" where we allow old connections to finish.)
|
||||
*/
|
||||
if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM");
|
||||
}
|
||||
if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM");
|
||||
}
|
||||
ap_reclaim_child_processes(1); /* Start with SIGTERM */
|
||||
|
||||
if (!child_fatal) {
|
||||
@@ -1726,7 +1726,7 @@ static int leader_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
||||
ap_extended_status = 0;
|
||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
#endif
|
||||
|
||||
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
||||
@@ -1918,9 +1918,9 @@ static const char *set_server_limit (cmd_parms *cmd, void *dummy, const char *ar
|
||||
server_limit = MAX_SERVER_LIMIT;
|
||||
}
|
||||
else if (server_limit < 1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
"WARNING: Require ServerLimit > 0, setting to 1");
|
||||
server_limit = 1;
|
||||
server_limit = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -1958,9 +1958,9 @@ static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *ar
|
||||
thread_limit = MAX_THREAD_LIMIT;
|
||||
}
|
||||
else if (thread_limit < 1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
"WARNING: Require ThreadLimit > 0, setting to 1");
|
||||
thread_limit = 1;
|
||||
thread_limit = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -1319,9 +1319,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
||||
"Server built: %s", ap_get_server_built());
|
||||
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
||||
"AcceptMutex: %s (default: %s)",
|
||||
apr_proc_mutex_name(process_accept_mutex),
|
||||
apr_proc_mutex_defname());
|
||||
"AcceptMutex: %s (default: %s)",
|
||||
apr_proc_mutex_name(process_accept_mutex),
|
||||
apr_proc_mutex_defname());
|
||||
#endif
|
||||
restart_pending = shutdown_pending = 0;
|
||||
|
||||
@@ -1497,7 +1497,7 @@ static int perchild_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptem
|
||||
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
||||
curr_child_num = 0;
|
||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
#endif
|
||||
|
||||
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
||||
@@ -1956,9 +1956,9 @@ static const char *set_server_limit (cmd_parms *cmd, void *dummy, const char *ar
|
||||
server_limit = MAX_SERVER_LIMIT;
|
||||
}
|
||||
else if (server_limit < 1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
"WARNING: Require ServerLimit > 0, setting to 1");
|
||||
server_limit = 1;
|
||||
server_limit = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -1996,9 +1996,9 @@ static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *ar
|
||||
thread_limit = MAX_THREAD_LIMIT;
|
||||
}
|
||||
else if (thread_limit < 1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
"WARNING: Require ThreadLimit > 0, setting to 1");
|
||||
thread_limit = 1;
|
||||
thread_limit = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -1783,9 +1783,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
||||
"Server built: %s", ap_get_server_built());
|
||||
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
||||
"AcceptMutex: %s (default: %s)",
|
||||
apr_proc_mutex_name(accept_mutex),
|
||||
apr_proc_mutex_defname());
|
||||
"AcceptMutex: %s (default: %s)",
|
||||
apr_proc_mutex_name(accept_mutex),
|
||||
apr_proc_mutex_defname());
|
||||
#endif
|
||||
restart_pending = shutdown_pending = 0;
|
||||
mpm_state = AP_MPMQ_RUNNING;
|
||||
@@ -1980,7 +1980,7 @@ static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
||||
ap_extended_status = 0;
|
||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
#endif
|
||||
|
||||
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
||||
@@ -2172,9 +2172,9 @@ static const char *set_server_limit (cmd_parms *cmd, void *dummy, const char *ar
|
||||
server_limit = MAX_SERVER_LIMIT;
|
||||
}
|
||||
else if (server_limit < 1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
"WARNING: Require ServerLimit > 0, setting to 1");
|
||||
server_limit = 1;
|
||||
server_limit = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -2212,9 +2212,9 @@ static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *ar
|
||||
thread_limit = MAX_THREAD_LIMIT;
|
||||
}
|
||||
else if (thread_limit < 1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
"WARNING: Require ThreadLimit > 0, setting to 1");
|
||||
thread_limit = 1;
|
||||
thread_limit = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -269,15 +269,15 @@ static char master_main()
|
||||
|
||||
ap_scoreboard_image->global->restart_time = apr_time_now();
|
||||
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
|
||||
"%s configured -- resuming normal operations",
|
||||
ap_get_server_version());
|
||||
"%s configured -- resuming normal operations",
|
||||
ap_get_server_version());
|
||||
ap_log_error(APLOG_MARK, APLOG_INFO, 0, ap_server_conf,
|
||||
"Server built: %s", ap_get_server_built());
|
||||
"Server built: %s", ap_get_server_built());
|
||||
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
||||
"AcceptMutex: %s (default: %s)",
|
||||
apr_proc_mutex_name(accept_mutex),
|
||||
apr_proc_mutex_defname());
|
||||
"AcceptMutex: %s (default: %s)",
|
||||
apr_proc_mutex_name(accept_mutex),
|
||||
apr_proc_mutex_defname());
|
||||
#endif
|
||||
if (one_process) {
|
||||
ap_scoreboard_image->parent[0].pid = getpid();
|
||||
@@ -398,7 +398,7 @@ static void set_signals()
|
||||
sa.sa_handler = sig_term;
|
||||
|
||||
if (sigaction(SIGTERM, &sa, NULL) < 0)
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
|
||||
|
||||
if (sigaction(SIGINT, &sa, NULL) < 0)
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)");
|
||||
@@ -471,7 +471,7 @@ static int mpmt_os2_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *
|
||||
ap_min_spare_threads = DEFAULT_MIN_SPARE_THREAD;
|
||||
ap_max_spare_threads = DEFAULT_MAX_SPARE_THREAD;
|
||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
@@ -501,7 +501,7 @@ static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, const char
|
||||
|
||||
|
||||
static const char *set_min_spare_threads(cmd_parms *cmd, void *dummy,
|
||||
const char *arg)
|
||||
const char *arg)
|
||||
{
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
|
||||
|
||||
@@ -527,7 +527,7 @@ static const char *set_min_spare_threads(cmd_parms *cmd, void *dummy,
|
||||
|
||||
|
||||
static const char *set_max_spare_threads(cmd_parms *cmd, void *dummy,
|
||||
const char *arg)
|
||||
const char *arg)
|
||||
{
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
|
||||
|
||||
|
@@ -81,7 +81,7 @@ static void server_maintenance(void *vpArg);
|
||||
static void clean_child_exit(int code)
|
||||
{
|
||||
if (pchild) {
|
||||
apr_pool_destroy(pchild);
|
||||
apr_pool_destroy(pchild);
|
||||
}
|
||||
|
||||
exit(code);
|
||||
@@ -471,10 +471,10 @@ static void set_signals()
|
||||
sa.sa_handler = sig_term;
|
||||
|
||||
if (sigaction(SIGTERM, &sa, NULL) < 0)
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
|
||||
|
||||
sa.sa_handler = sig_hup;
|
||||
|
||||
if (sigaction(SIGHUP, &sa, NULL) < 0)
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
|
||||
}
|
||||
|
@@ -1127,7 +1127,7 @@ static int CommandLineInterpreter(scr_t screenID, const char *commandLine)
|
||||
ap_show_modules();
|
||||
}
|
||||
else if (!strnicmp("DIRECTIVES",&szcommandLine[iCommandLen],3)) {
|
||||
ap_show_directives();
|
||||
ap_show_directives();
|
||||
}
|
||||
else if (!strnicmp("SHUTDOWN",&szcommandLine[iCommandLen],3)) {
|
||||
printf("Shutdown Requested...\n");
|
||||
|
@@ -276,7 +276,7 @@ static void add_job(SOCKET sock)
|
||||
|
||||
new_job = (joblist *) malloc(sizeof(joblist));
|
||||
if (new_job == NULL) {
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
"Ouch! Out of memory in add_job()!");
|
||||
return;
|
||||
}
|
||||
@@ -286,10 +286,10 @@ static void add_job(SOCKET sock)
|
||||
apr_thread_mutex_lock(allowed_globals.jobmutex);
|
||||
|
||||
if (allowed_globals.jobtail != NULL)
|
||||
allowed_globals.jobtail->next = new_job;
|
||||
allowed_globals.jobtail->next = new_job;
|
||||
allowed_globals.jobtail = new_job;
|
||||
if (!allowed_globals.jobhead)
|
||||
allowed_globals.jobhead = new_job;
|
||||
allowed_globals.jobhead = new_job;
|
||||
allowed_globals.jobcount++;
|
||||
ReleaseSemaphore(allowed_globals.jobsemaphore, 1, NULL);
|
||||
|
||||
@@ -307,13 +307,13 @@ static SOCKET remove_job(void)
|
||||
|
||||
if (shutdown_in_progress && !allowed_globals.jobhead) {
|
||||
apr_thread_mutex_unlock(allowed_globals.jobmutex);
|
||||
return (INVALID_SOCKET);
|
||||
return (INVALID_SOCKET);
|
||||
}
|
||||
job = allowed_globals.jobhead;
|
||||
ap_assert(job);
|
||||
allowed_globals.jobhead = job->next;
|
||||
if (allowed_globals.jobhead == NULL)
|
||||
allowed_globals.jobtail = NULL;
|
||||
allowed_globals.jobtail = NULL;
|
||||
apr_thread_mutex_unlock(allowed_globals.jobmutex);
|
||||
sock = job->sock;
|
||||
free(job);
|
||||
@@ -356,9 +356,9 @@ static unsigned int __stdcall win9x_accept(void * dummy)
|
||||
head_listener = ap_listeners;
|
||||
|
||||
while (!shutdown_in_progress) {
|
||||
tv.tv_sec = wait_time;
|
||||
tv.tv_usec = 0;
|
||||
memcpy(&main_fds, &listenfds, sizeof(fd_set));
|
||||
tv.tv_sec = wait_time;
|
||||
tv.tv_usec = 0;
|
||||
memcpy(&main_fds, &listenfds, sizeof(fd_set));
|
||||
|
||||
/* First parameter of select() is ignored on Windows */
|
||||
rc = select(0, &main_fds, NULL, NULL, &tv);
|
||||
@@ -381,30 +381,30 @@ static unsigned int __stdcall win9x_accept(void * dummy)
|
||||
"Too many errors in select loop. Child process exiting.");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ap_listen_rec *lr;
|
||||
} else {
|
||||
ap_listen_rec *lr;
|
||||
|
||||
lr = find_ready_listener(&main_fds);
|
||||
if (lr != NULL) {
|
||||
lr = find_ready_listener(&main_fds);
|
||||
if (lr != NULL) {
|
||||
/* fetch the native socket descriptor */
|
||||
apr_os_sock_get(&nsd, lr->sd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
do {
|
||||
clen = sizeof(sa_client);
|
||||
csd = accept(nsd, (struct sockaddr *) &sa_client, &clen);
|
||||
} while (csd < 0 && APR_STATUS_IS_EINTR(apr_get_netos_error()));
|
||||
|
||||
if (csd < 0) {
|
||||
if (csd < 0) {
|
||||
if (APR_STATUS_IS_ECONNABORTED(apr_get_netos_error())) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_netos_error(), ap_server_conf,
|
||||
"accept: (client socket)");
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_netos_error(), ap_server_conf,
|
||||
"accept: (client socket)");
|
||||
}
|
||||
}
|
||||
else {
|
||||
add_job(csd);
|
||||
}
|
||||
}
|
||||
else {
|
||||
add_job(csd);
|
||||
}
|
||||
}
|
||||
SetEvent(exit_event);
|
||||
return 0;
|
||||
@@ -809,7 +809,7 @@ static void cleanup_thread(HANDLE *handles, int *thread_cnt, int thread_to_clean
|
||||
|
||||
CloseHandle(handles[thread_to_clean]);
|
||||
for (i = thread_to_clean; i < ((*thread_cnt) - 1); i++)
|
||||
handles[i] = handles[i + 1];
|
||||
handles[i] = handles[i + 1];
|
||||
(*thread_cnt)--;
|
||||
}
|
||||
|
||||
|
@@ -132,9 +132,9 @@ static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, char *arg
|
||||
ap_threads_per_child = thread_limit;
|
||||
}
|
||||
else if (ap_threads_per_child < 1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
"WARNING: Require ThreadsPerChild > 0, setting to 1");
|
||||
ap_threads_per_child = 1;
|
||||
ap_threads_per_child = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -171,9 +171,9 @@ static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *ar
|
||||
thread_limit = MAX_THREAD_LIMIT;
|
||||
}
|
||||
else if (thread_limit < 1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
"WARNING: Require ThreadLimit > 0, setting to 1");
|
||||
thread_limit = 1;
|
||||
thread_limit = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -244,9 +244,9 @@ void setup_signal_names(char *prefix)
|
||||
{
|
||||
apr_snprintf(signal_name_prefix, sizeof(signal_name_prefix), prefix);
|
||||
apr_snprintf(signal_shutdown_name, sizeof(signal_shutdown_name),
|
||||
"%s_shutdown", signal_name_prefix);
|
||||
"%s_shutdown", signal_name_prefix);
|
||||
apr_snprintf(signal_restart_name, sizeof(signal_restart_name),
|
||||
"%s_restart", signal_name_prefix);
|
||||
"%s_restart", signal_name_prefix);
|
||||
}
|
||||
|
||||
int volatile is_graceful = 0;
|
||||
@@ -277,7 +277,7 @@ AP_DECLARE(void) ap_signal_parent(ap_signal_parent_e type)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
@@ -300,19 +300,19 @@ AP_DECLARE(void) ap_signal_parent(ap_signal_parent_e type)
|
||||
|
||||
e = OpenEvent(EVENT_MODIFY_STATE, FALSE, signal_name);
|
||||
if (!e) {
|
||||
/* Um, problem, can't signal the parent, which means we can't
|
||||
* signal ourselves to die. Ignore for now...
|
||||
*/
|
||||
ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), ap_server_conf,
|
||||
/* Um, problem, can't signal the parent, which means we can't
|
||||
* signal ourselves to die. Ignore for now...
|
||||
*/
|
||||
ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), ap_server_conf,
|
||||
"OpenEvent on %s event", signal_name);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if (SetEvent(e) == 0) {
|
||||
/* Same problem as above */
|
||||
ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), ap_server_conf,
|
||||
/* Same problem as above */
|
||||
ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), ap_server_conf,
|
||||
"SetEvent on %s event", signal_name);
|
||||
CloseHandle(e);
|
||||
return;
|
||||
CloseHandle(e);
|
||||
return;
|
||||
}
|
||||
CloseHandle(e);
|
||||
}
|
||||
@@ -390,7 +390,7 @@ void get_handles_from_parent(server_rec *s, HANDLE *child_exit_event,
|
||||
|
||||
rv = ap_reopen_scoreboard(s->process->pool, scoreboard_shm, 1);
|
||||
if (rv || !(sb_shared = apr_shm_baseaddr_get(*scoreboard_shm))) {
|
||||
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
|
||||
"Child %d: Unable to reopen the scoreboard from the parent", my_pid);
|
||||
exit(APEXIT_CHILDINIT);
|
||||
}
|
||||
@@ -1402,7 +1402,7 @@ static int winnt_pre_config(apr_pool_t *pconf_, apr_pool_t *plog, apr_pool_t *pt
|
||||
ap_pid_fname = DEFAULT_PIDLOG;
|
||||
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
#endif
|
||||
/* use_acceptex which is enabled by default is not available on Win9x.
|
||||
*/
|
||||
|
@@ -181,9 +181,9 @@ static LRESULT CALLBACK monitor_service_9x_proc(HWND hWnd, UINT msg,
|
||||
&& (die_on_logoff || (lParam != ENDSESSION_LOGOFF)))
|
||||
{
|
||||
ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
|
||||
if (wParam)
|
||||
if (wParam)
|
||||
/* Don't leave this message until we are dead! */
|
||||
WaitForSingleObject(globdat.mpm_thread, 30000);
|
||||
WaitForSingleObject(globdat.mpm_thread, 30000);
|
||||
return 0;
|
||||
}
|
||||
return (DefWindowProc(hWnd, msg, wParam, lParam));
|
||||
@@ -214,9 +214,9 @@ static DWORD WINAPI monitor_service_9x_thread(void *service_name)
|
||||
wc.hbrBackground = NULL;
|
||||
wc.lpszMenuName = NULL;
|
||||
if (service_name)
|
||||
wc.lpszClassName = "ApacheWin95ServiceMonitor";
|
||||
wc.lpszClassName = "ApacheWin95ServiceMonitor";
|
||||
else
|
||||
wc.lpszClassName = "ApacheWin95SystemMonitor";
|
||||
wc.lpszClassName = "ApacheWin95SystemMonitor";
|
||||
|
||||
die_on_logoff = service_name ? FALSE : TRUE;
|
||||
|
||||
@@ -255,8 +255,8 @@ static DWORD WINAPI monitor_service_9x_thread(void *service_name)
|
||||
if (msg.message == WM_CLOSE)
|
||||
DestroyWindow(hwndMain);
|
||||
else {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
globdat.service_thread_id = 0;
|
||||
@@ -397,7 +397,7 @@ static int ReportStatusToSCMgr(int currentState, int exitCode, int waitHint)
|
||||
}
|
||||
else {
|
||||
globdat.ssStatus.dwCheckPoint = ++checkPoint;
|
||||
globdat.ssStatus.dwControlsAccepted = 0;
|
||||
globdat.ssStatus.dwControlsAccepted = 0;
|
||||
if(waitHint)
|
||||
globdat.ssStatus.dwWaitHint = waitHint;
|
||||
}
|
||||
@@ -797,7 +797,7 @@ apr_status_t mpm_service_install(apr_pool_t *ptemp, int argc,
|
||||
apr_status_t rv;
|
||||
|
||||
fprintf(stderr,reconfig ? "Reconfiguring the %s service\n"
|
||||
: "Installing the %s service\n", mpm_display_name);
|
||||
: "Installing the %s service\n", mpm_display_name);
|
||||
|
||||
/* ###: utf-ize */
|
||||
if (GetModuleFileName(NULL, exe_path, sizeof(exe_path)) == 0)
|
||||
@@ -844,10 +844,10 @@ apr_status_t mpm_service_install(apr_pool_t *ptemp, int argc,
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_ERR,
|
||||
apr_get_os_error(), NULL,
|
||||
"ChangeServiceConfig failed");
|
||||
/* !schService aborts configuration below */
|
||||
CloseServiceHandle(schService);
|
||||
schService = NULL;
|
||||
}
|
||||
/* !schService aborts configuration below */
|
||||
CloseServiceHandle(schService);
|
||||
schService = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* RPCSS is the Remote Procedure Call (RPC) Locator required
|
||||
@@ -980,7 +980,7 @@ apr_status_t mpm_service_uninstall(void)
|
||||
if (!schService) {
|
||||
rv = apr_get_os_error();
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
|
||||
"%s: OpenService failed", mpm_display_name);
|
||||
"%s: OpenService failed", mpm_display_name);
|
||||
return (rv);
|
||||
}
|
||||
|
||||
@@ -996,7 +996,7 @@ apr_status_t mpm_service_uninstall(void)
|
||||
|
||||
if (DeleteService(schService) == 0) {
|
||||
rv = apr_get_os_error();
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
|
||||
"%s: Failed to delete the service.", mpm_display_name);
|
||||
return (rv);
|
||||
}
|
||||
@@ -1019,7 +1019,7 @@ apr_status_t mpm_service_uninstall(void)
|
||||
ap_regkey_close(key);
|
||||
}
|
||||
if (rv != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
|
||||
"%s: Failed to remove the RunServices registry "
|
||||
"entry.", mpm_display_name);
|
||||
}
|
||||
|
@@ -1714,9 +1714,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
||||
"Server built: %s", ap_get_server_built());
|
||||
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
||||
"AcceptMutex: %s (default: %s)",
|
||||
apr_proc_mutex_name(accept_mutex),
|
||||
apr_proc_mutex_defname());
|
||||
"AcceptMutex: %s (default: %s)",
|
||||
apr_proc_mutex_name(accept_mutex),
|
||||
apr_proc_mutex_defname());
|
||||
#endif
|
||||
restart_pending = shutdown_pending = 0;
|
||||
mpm_state = AP_MPMQ_RUNNING;
|
||||
@@ -1959,7 +1959,7 @@ static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
||||
ap_extended_status = 0;
|
||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
#endif
|
||||
|
||||
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
||||
@@ -2151,9 +2151,9 @@ static const char *set_server_limit (cmd_parms *cmd, void *dummy, const char *ar
|
||||
server_limit = MAX_SERVER_LIMIT;
|
||||
}
|
||||
else if (server_limit < 1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
"WARNING: Require ServerLimit > 0, setting to 1");
|
||||
server_limit = 1;
|
||||
server_limit = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -2191,9 +2191,9 @@ static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *ar
|
||||
thread_limit = MAX_THREAD_LIMIT;
|
||||
}
|
||||
else if (thread_limit < 1) {
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||
"WARNING: Require ThreadLimit > 0, setting to 1");
|
||||
thread_limit = 1;
|
||||
thread_limit = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -1049,7 +1049,7 @@ void ap_mpm_rewrite_args(process_rec *process)
|
||||
apr_uint32_t ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||
|
||||
const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy,
|
||||
const char *arg)
|
||||
const char *arg)
|
||||
{
|
||||
long value;
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
|
||||
@@ -1111,7 +1111,7 @@ const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy,
|
||||
}
|
||||
|
||||
if (cmd->server->is_virtual) {
|
||||
return "EnableExceptionHook directive not allowed in <VirtualHost>";
|
||||
return "EnableExceptionHook directive not allowed in <VirtualHost>";
|
||||
}
|
||||
|
||||
if (strcasecmp(arg, "on") == 0) {
|
||||
|
@@ -825,7 +825,7 @@ AP_DECLARE(int) ap_directory_walk(request_rec *r)
|
||||
}
|
||||
|
||||
res = ap_parse_htaccess(&htaccess_conf, r, opts.override,
|
||||
opts.override_opts,
|
||||
opts.override_opts,
|
||||
apr_pstrdup(r->pool, r->filename),
|
||||
sconf->access_name);
|
||||
if (res) {
|
||||
|
@@ -343,7 +343,7 @@ static ap_filter_t *add_any_filter_handle(ap_filter_rec_t *frec, void *ctx,
|
||||
fscan = fscan->next;
|
||||
|
||||
f->next = fscan->next;
|
||||
fscan->next = f;
|
||||
fscan->next = f;
|
||||
}
|
||||
|
||||
if (frec->ftype < AP_FTYPE_CONNECTION && (*r_filters == *c_filters)) {
|
||||
|
@@ -70,8 +70,8 @@ AP_DECLARE(char *) ap_md5_binary(apr_pool_t *p, const unsigned char *buf, int le
|
||||
apr_md5_final(hash, &my_md5);
|
||||
|
||||
for (i = 0, r = result; i < APR_MD5_DIGESTSIZE; i++) {
|
||||
*r++ = hex[hash[i] >> 4];
|
||||
*r++ = hex[hash[i] & 0xF];
|
||||
*r++ = hex[hash[i] >> 4];
|
||||
*r++ = hex[hash[i] & 0xF];
|
||||
}
|
||||
*r = '\0';
|
||||
|
||||
@@ -142,10 +142,10 @@ AP_DECLARE(char *) ap_md5contextTo64(apr_pool_t *a, apr_md5_ctx_t *context)
|
||||
|
||||
p = encodedDigest;
|
||||
for (i = 0; i < sizeof(digest); i += 3) {
|
||||
*p++ = basis_64[digest[i] >> 2];
|
||||
*p++ = basis_64[((digest[i] & 0x3) << 4) | ((int) (digest[i + 1] & 0xF0) >> 4)];
|
||||
*p++ = basis_64[((digest[i + 1] & 0xF) << 2) | ((int) (digest[i + 2] & 0xC0) >> 6)];
|
||||
*p++ = basis_64[digest[i + 2] & 0x3F];
|
||||
*p++ = basis_64[digest[i] >> 2];
|
||||
*p++ = basis_64[((digest[i] & 0x3) << 4) | ((int) (digest[i + 1] & 0xF0) >> 4)];
|
||||
*p++ = basis_64[((digest[i + 1] & 0xF) << 2) | ((int) (digest[i + 2] & 0xC0) >> 6)];
|
||||
*p++ = basis_64[digest[i + 2] & 0x3F];
|
||||
}
|
||||
*p-- = '\0';
|
||||
*p-- = '=';
|
||||
@@ -163,7 +163,7 @@ AP_DECLARE(char *) ap_md5digest(apr_pool_t *p, apr_file_t *infile)
|
||||
apr_md5_init(&context);
|
||||
nbytes = sizeof(buf);
|
||||
while (apr_file_read(infile, buf, &nbytes) == APR_SUCCESS) {
|
||||
apr_md5_update(&context, buf, nbytes);
|
||||
apr_md5_update(&context, buf, nbytes);
|
||||
nbytes = sizeof(buf);
|
||||
}
|
||||
apr_file_seek(infile, APR_SET, &offset);
|
||||
|
@@ -726,12 +726,12 @@ static void fix_hostname(request_rec *r)
|
||||
}
|
||||
else if (port) {
|
||||
/* Don't throw the Host: header's port number away:
|
||||
save it in parsed_uri -- ap_get_server_port() needs it! */
|
||||
save it in parsed_uri -- ap_get_server_port() needs it! */
|
||||
/* @@@ XXX there should be a better way to pass the port.
|
||||
* Like r->hostname, there should be a r->portno
|
||||
*/
|
||||
* Like r->hostname, there should be a r->portno
|
||||
*/
|
||||
r->parsed_uri.port = port;
|
||||
r->parsed_uri.port_str = apr_itoa(r->pool, (int)port);
|
||||
r->parsed_uri.port_str = apr_itoa(r->pool, (int)port);
|
||||
}
|
||||
|
||||
/* if the hostname is an IPv6 numeric address string, it was validated
|
||||
|
@@ -214,7 +214,7 @@ int main(int argc, const char * const argv[])
|
||||
|
||||
/* Check if this could even be an IP address */
|
||||
if (!apr_isxdigit(line[0]) && line[0] != ':') {
|
||||
withname++;
|
||||
withname++;
|
||||
apr_file_puts(line, outfile);
|
||||
continue;
|
||||
}
|
||||
@@ -228,7 +228,7 @@ int main(int argc, const char * const argv[])
|
||||
hostname = (char *) apr_hash_get(cache, line, APR_HASH_KEY_STRING);
|
||||
if (hostname) {
|
||||
apr_file_printf(outfile, "%s %s", hostname, space + 1);
|
||||
cachehits++;
|
||||
cachehits++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ int main(int argc, const char * const argv[])
|
||||
status = apr_sockaddr_info_get(&ip, line, APR_UNSPEC ,0, 0, pool);
|
||||
if (status != APR_SUCCESS) {
|
||||
/* Not an IP address */
|
||||
withname++;
|
||||
withname++;
|
||||
*space = ' ';
|
||||
apr_file_puts(line, outfile);
|
||||
continue;
|
||||
@@ -246,7 +246,7 @@ int main(int argc, const char * const argv[])
|
||||
* "parsed as an IP address". It does not mean we actually resolved
|
||||
* the IP address into a hostname.
|
||||
*/
|
||||
resolves++;
|
||||
resolves++;
|
||||
|
||||
/* From here on our we cache each result, even if it was not
|
||||
* succesful
|
||||
|
@@ -136,7 +136,7 @@ int main(int argc, char** argv)
|
||||
case '?':
|
||||
printf(options, arg0);
|
||||
exit(1);
|
||||
default:
|
||||
default:
|
||||
printf("wintty option %s not recognized, use -? for help.\n\n", *argv);
|
||||
exit(1);
|
||||
}
|
||||
@@ -214,7 +214,7 @@ int main(int argc, char** argv)
|
||||
|
||||
if (isservice) {
|
||||
#ifdef WE_EVER_FIGURE_OUT_WHY_THIS_DOESNT_WORK
|
||||
hsavedesk = GetThreadDesktop(GetCurrentThreadId());
|
||||
hsavedesk = GetThreadDesktop(GetCurrentThreadId());
|
||||
if (!hsavedesk || hsavedesk == INVALID_HANDLE_VALUE) {
|
||||
printerr("GetThreadDesktop(GetTID()) failed (%d)\n", GetLastError());
|
||||
}
|
||||
|
188
test/cls.c
188
test/cls.c
@@ -35,32 +35,32 @@ static int checkmask(const char *data, const char *mask)
|
||||
int i, ch, d;
|
||||
|
||||
for (i = 0; mask[i] != '\0' && mask[i] != '*'; i++) {
|
||||
ch = mask[i];
|
||||
d = data[i];
|
||||
if (ch == '@') {
|
||||
if (!isupper(d))
|
||||
return 0;
|
||||
}
|
||||
else if (ch == '$') {
|
||||
if (!islower(d))
|
||||
return 0;
|
||||
}
|
||||
else if (ch == '#') {
|
||||
if (!isdigit(d))
|
||||
return 0;
|
||||
}
|
||||
else if (ch == '&') {
|
||||
if (!isxdigit(d))
|
||||
return 0;
|
||||
}
|
||||
else if (ch != d)
|
||||
return 0;
|
||||
ch = mask[i];
|
||||
d = data[i];
|
||||
if (ch == '@') {
|
||||
if (!isupper(d))
|
||||
return 0;
|
||||
}
|
||||
else if (ch == '$') {
|
||||
if (!islower(d))
|
||||
return 0;
|
||||
}
|
||||
else if (ch == '#') {
|
||||
if (!isdigit(d))
|
||||
return 0;
|
||||
}
|
||||
else if (ch == '&') {
|
||||
if (!isxdigit(d))
|
||||
return 0;
|
||||
}
|
||||
else if (ch != d)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mask[i] == '*')
|
||||
return 1;
|
||||
return 1;
|
||||
else
|
||||
return (data[i] == '\0');
|
||||
return (data[i] == '\0');
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -72,19 +72,19 @@ static int hex2sec(const char *x)
|
||||
unsigned int j;
|
||||
|
||||
for (i = 0, j = 0; i < 8; i++) {
|
||||
ch = x[i];
|
||||
j <<= 4;
|
||||
if (isdigit(ch))
|
||||
j |= ch - '0';
|
||||
else if (isupper(ch))
|
||||
j |= ch - ('A' - 10);
|
||||
else
|
||||
j |= ch - ('a' - 10);
|
||||
ch = x[i];
|
||||
j <<= 4;
|
||||
if (isdigit(ch))
|
||||
j |= ch - '0';
|
||||
else if (isupper(ch))
|
||||
j |= ch - ('A' - 10);
|
||||
else
|
||||
j |= ch - ('a' - 10);
|
||||
}
|
||||
if (j == 0xffffffff)
|
||||
return -1; /* so that it works with 8-byte ints */
|
||||
return -1; /* so that it works with 8-byte ints */
|
||||
else
|
||||
return j;
|
||||
return j;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@@ -103,78 +103,78 @@ int main(int argc, char **argv)
|
||||
const char time_format[] = "%e %b %Y %R";
|
||||
|
||||
if (argc != 2) {
|
||||
printf("Usage: cls directory\n");
|
||||
exit(0);
|
||||
printf("Usage: cls directory\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
d = opendir(argv[1]);
|
||||
if (d == NULL) {
|
||||
perror("opendir");
|
||||
exit(1);
|
||||
perror("opendir");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
e = readdir(d);
|
||||
if (e == NULL)
|
||||
break;
|
||||
s = e->d_name;
|
||||
if (s[0] == '.' || s[0] == '#')
|
||||
continue;
|
||||
sprintf(path, "%s/%s", argv[1], s);
|
||||
fp = fopen(path, "r");
|
||||
if (fp == NULL) {
|
||||
perror("fopen");
|
||||
continue;
|
||||
}
|
||||
if (fgets(line, 1034, fp) == NULL) {
|
||||
perror("fgets");
|
||||
fclose(fp);
|
||||
continue;
|
||||
}
|
||||
if (!checkmask(line, "&&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&&\n")) {
|
||||
fprintf(stderr, "Bad cache file\n");
|
||||
fclose(fp);
|
||||
continue;
|
||||
}
|
||||
date = hex2sec(line);
|
||||
lmod = hex2sec(line + 9);
|
||||
expire = hex2sec(line + 18);
|
||||
ver = hex2sec(line + 27);
|
||||
len = hex2sec(line + 35);
|
||||
if (fgets(line, 1034, fp) == NULL) {
|
||||
perror("fgets");
|
||||
fclose(fp);
|
||||
continue;
|
||||
}
|
||||
fclose(fp);
|
||||
i = strlen(line);
|
||||
if (strncmp(line, "X-URL: ", 7) != 0 || line[i - 1] != '\n') {
|
||||
fprintf(stderr, "Bad cache file\n");
|
||||
continue;
|
||||
}
|
||||
line[i - 1] = '\0';
|
||||
if (date != -1) {
|
||||
ts = *gmtime(&date);
|
||||
strftime(sdate, 30, time_format, &ts);
|
||||
}
|
||||
else
|
||||
strcpy(sdate, "-");
|
||||
e = readdir(d);
|
||||
if (e == NULL)
|
||||
break;
|
||||
s = e->d_name;
|
||||
if (s[0] == '.' || s[0] == '#')
|
||||
continue;
|
||||
sprintf(path, "%s/%s", argv[1], s);
|
||||
fp = fopen(path, "r");
|
||||
if (fp == NULL) {
|
||||
perror("fopen");
|
||||
continue;
|
||||
}
|
||||
if (fgets(line, 1034, fp) == NULL) {
|
||||
perror("fgets");
|
||||
fclose(fp);
|
||||
continue;
|
||||
}
|
||||
if (!checkmask(line, "&&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&&\n")) {
|
||||
fprintf(stderr, "Bad cache file\n");
|
||||
fclose(fp);
|
||||
continue;
|
||||
}
|
||||
date = hex2sec(line);
|
||||
lmod = hex2sec(line + 9);
|
||||
expire = hex2sec(line + 18);
|
||||
ver = hex2sec(line + 27);
|
||||
len = hex2sec(line + 35);
|
||||
if (fgets(line, 1034, fp) == NULL) {
|
||||
perror("fgets");
|
||||
fclose(fp);
|
||||
continue;
|
||||
}
|
||||
fclose(fp);
|
||||
i = strlen(line);
|
||||
if (strncmp(line, "X-URL: ", 7) != 0 || line[i - 1] != '\n') {
|
||||
fprintf(stderr, "Bad cache file\n");
|
||||
continue;
|
||||
}
|
||||
line[i - 1] = '\0';
|
||||
if (date != -1) {
|
||||
ts = *gmtime(&date);
|
||||
strftime(sdate, 30, time_format, &ts);
|
||||
}
|
||||
else
|
||||
strcpy(sdate, "-");
|
||||
|
||||
if (lmod != -1) {
|
||||
ts = *gmtime(&lmod);
|
||||
strftime(slmod, 30, time_format, &ts);
|
||||
}
|
||||
else
|
||||
strcpy(slmod, "-");
|
||||
if (lmod != -1) {
|
||||
ts = *gmtime(&lmod);
|
||||
strftime(slmod, 30, time_format, &ts);
|
||||
}
|
||||
else
|
||||
strcpy(slmod, "-");
|
||||
|
||||
if (expire != -1) {
|
||||
ts = *gmtime(&expire);
|
||||
strftime(sexpire, 30, time_format, &ts);
|
||||
}
|
||||
else
|
||||
strcpy(sexpire, "-");
|
||||
if (expire != -1) {
|
||||
ts = *gmtime(&expire);
|
||||
strftime(sexpire, 30, time_format, &ts);
|
||||
}
|
||||
else
|
||||
strcpy(sexpire, "-");
|
||||
|
||||
printf("%s: %d; %s %s %s\n", line + 7, ver, sdate, slmod, sexpire);
|
||||
printf("%s: %d; %s %s %s\n", line + 7, ver, sdate, slmod, sexpire);
|
||||
}
|
||||
|
||||
closedir(d);
|
||||
|
@@ -57,36 +57,36 @@ void main( int argc, char **argv )
|
||||
|
||||
if( argc != 3 ) {
|
||||
usage:
|
||||
fprintf( stderr, "usage: test-writev a.b.c.d port#\n" );
|
||||
exit( 1 );
|
||||
fprintf( stderr, "usage: test-writev a.b.c.d port#\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
server_addr.sin_family = AF_INET;
|
||||
server_addr.sin_addr.s_addr = inet_addr( argv[1] );
|
||||
if( server_addr.sin_addr.s_addr == INADDR_NONE ) {
|
||||
fprintf( stderr, "bogus address\n" );
|
||||
goto usage;
|
||||
fprintf( stderr, "bogus address\n" );
|
||||
goto usage;
|
||||
}
|
||||
server_addr.sin_port = htons( atoi( argv[2] ) );
|
||||
|
||||
s = socket( AF_INET, SOCK_STREAM, 0 );
|
||||
if( s < 0 ) {
|
||||
perror("socket");
|
||||
exit(1);
|
||||
perror("socket");
|
||||
exit(1);
|
||||
}
|
||||
if( connect( s, (struct sockaddr *)&server_addr, sizeof( server_addr ) )
|
||||
!= 0 ) {
|
||||
perror("connect");
|
||||
exit(1);
|
||||
!= 0 ) {
|
||||
perror("connect");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if( setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char*)&just_say_no,
|
||||
sizeof(just_say_no)) != 0 ) {
|
||||
perror( "TCP_NODELAY" );
|
||||
exit(1);
|
||||
sizeof(just_say_no)) != 0 ) {
|
||||
perror( "TCP_NODELAY" );
|
||||
exit(1);
|
||||
}
|
||||
/* now build up a two part writev and write it out */
|
||||
for( i = 0; i < sizeof( buf ); ++i ) {
|
||||
buf[i] = 'x';
|
||||
buf[i] = 'x';
|
||||
}
|
||||
vector[0].iov_base = buf;
|
||||
vector[0].iov_len = sizeof(buf);
|
||||
|
192
test/time-sem.c
192
test/time-sem.c
@@ -23,16 +23,16 @@ to be used:
|
||||
- NFS filesystems absolutely suck for fcntl() and flock()
|
||||
|
||||
- uslock absolutely sucks on single-processor IRIX boxes, but
|
||||
absolutely rocks on multi-processor boxes. The converse
|
||||
is true for fcntl. sysvsem seems a moderate balance.
|
||||
absolutely rocks on multi-processor boxes. The converse
|
||||
is true for fcntl. sysvsem seems a moderate balance.
|
||||
|
||||
- Under Solaris you can't have too many processes use SEM_UNDO, there
|
||||
might be a tuneable somewhere that increases the limit from 29.
|
||||
We're not sure what the tunable is, so there's a define
|
||||
NO_SEM_UNDO which can be used to simulate us trapping/blocking
|
||||
signals to be able to properly release the semaphore on a clean
|
||||
child death. You'll also need to define NEED_UNION_SEMUN
|
||||
under solaris.
|
||||
might be a tuneable somewhere that increases the limit from 29.
|
||||
We're not sure what the tunable is, so there's a define
|
||||
NO_SEM_UNDO which can be used to simulate us trapping/blocking
|
||||
signals to be able to properly release the semaphore on a clean
|
||||
child death. You'll also need to define NEED_UNION_SEMUN
|
||||
under solaris.
|
||||
|
||||
You'll need to define USE_SHMGET_SCOREBOARD if anonymous shared mmap()
|
||||
doesn't work on your system (i.e. linux).
|
||||
@@ -101,9 +101,9 @@ accept_mutex_init(void)
|
||||
fcntl_fd = open("test-lock-thing", O_CREAT | O_WRONLY | O_EXCL, 0644);
|
||||
if (fcntl_fd == -1)
|
||||
{
|
||||
perror ("open");
|
||||
fprintf (stderr, "Cannot open lock file: %s\n", "test-lock-thing");
|
||||
exit (1);
|
||||
perror ("open");
|
||||
fprintf (stderr, "Cannot open lock file: %s\n", "test-lock-thing");
|
||||
exit (1);
|
||||
}
|
||||
unlink("test-lock-thing");
|
||||
}
|
||||
@@ -113,11 +113,11 @@ void accept_mutex_on(void)
|
||||
int ret;
|
||||
|
||||
while ((ret = fcntl(fcntl_fd, F_SETLKW, &lock_it)) < 0 && errno == EINTR)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
if (ret < 0) {
|
||||
perror ("fcntl lock_it");
|
||||
exit(1);
|
||||
perror ("fcntl lock_it");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,8 +125,8 @@ void accept_mutex_off(void)
|
||||
{
|
||||
if (fcntl (fcntl_fd, F_SETLKW, &unlock_it) < 0)
|
||||
{
|
||||
perror ("fcntl unlock_it");
|
||||
exit(1);
|
||||
perror ("fcntl unlock_it");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,9 +149,9 @@ void accept_mutex_init(void)
|
||||
flock_fd = open(FNAME, O_CREAT | O_WRONLY | O_EXCL, 0644);
|
||||
if (flock_fd == -1)
|
||||
{
|
||||
perror ("open");
|
||||
fprintf (stderr, "Cannot open lock file: %s\n", "test-lock-thing");
|
||||
exit (1);
|
||||
perror ("open");
|
||||
fprintf (stderr, "Cannot open lock file: %s\n", "test-lock-thing");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,8 +159,8 @@ void accept_mutex_child_init(void)
|
||||
{
|
||||
flock_fd = open(FNAME, O_WRONLY, 0600);
|
||||
if (flock_fd == -1) {
|
||||
perror("open");
|
||||
exit(1);
|
||||
perror("open");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,11 +174,11 @@ void accept_mutex_on(void)
|
||||
int ret;
|
||||
|
||||
while ((ret = flock(flock_fd, LOCK_EX)) < 0 && errno == EINTR)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
if (ret < 0) {
|
||||
perror ("flock(LOCK_EX)");
|
||||
exit(1);
|
||||
perror ("flock(LOCK_EX)");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,8 +186,8 @@ void accept_mutex_off(void)
|
||||
{
|
||||
if (flock (flock_fd, LOCK_UN) < 0)
|
||||
{
|
||||
perror ("flock(LOCK_UN)");
|
||||
exit(1);
|
||||
perror ("flock(LOCK_UN)");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,9 +211,9 @@ void accept_mutex_init(void)
|
||||
#ifdef NEED_UNION_SEMUN
|
||||
/* believe it or not, you need to define this under solaris */
|
||||
union semun {
|
||||
int val;
|
||||
struct semid_ds *buf;
|
||||
ushort *array;
|
||||
int val;
|
||||
struct semid_ds *buf;
|
||||
ushort *array;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -243,8 +243,8 @@ void accept_mutex_on()
|
||||
|
||||
#ifdef NO_SEM_UNDO
|
||||
if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) {
|
||||
perror("sigprocmask(SIG_BLOCK)");
|
||||
exit (1);
|
||||
perror("sigprocmask(SIG_BLOCK)");
|
||||
exit (1);
|
||||
}
|
||||
op.sem_flg = 0;
|
||||
#else
|
||||
@@ -253,8 +253,8 @@ void accept_mutex_on()
|
||||
op.sem_num = 0;
|
||||
op.sem_op = -1;
|
||||
if (semop(sem_id, &op, 1) < 0) {
|
||||
perror ("accept_mutex_on");
|
||||
exit (1);
|
||||
perror ("accept_mutex_on");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,13 +270,13 @@ void accept_mutex_off()
|
||||
op.sem_flg = SEM_UNDO;
|
||||
#endif
|
||||
if (semop(sem_id, &op, 1) < 0) {
|
||||
perror ("accept_mutex_off");
|
||||
perror ("accept_mutex_off");
|
||||
exit (1);
|
||||
}
|
||||
#ifdef NO_SEM_UNDO
|
||||
if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) {
|
||||
perror("sigprocmask(SIG_SETMASK)");
|
||||
exit (1);
|
||||
perror("sigprocmask(SIG_SETMASK)");
|
||||
exit (1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -304,27 +304,27 @@ void accept_mutex_init(void)
|
||||
|
||||
fd = open ("/dev/zero", O_RDWR);
|
||||
if (fd == -1) {
|
||||
perror ("open(/dev/zero)");
|
||||
exit (1);
|
||||
perror ("open(/dev/zero)");
|
||||
exit (1);
|
||||
}
|
||||
mutex = (pthread_mutex_t *)mmap ((caddr_t)0, sizeof (*mutex),
|
||||
PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (mutex == (void *)(caddr_t)-1) {
|
||||
perror ("mmap");
|
||||
exit (1);
|
||||
perror ("mmap");
|
||||
exit (1);
|
||||
}
|
||||
close (fd);
|
||||
if (pthread_mutexattr_init(&mattr)) {
|
||||
perror ("pthread_mutexattr_init");
|
||||
exit (1);
|
||||
perror ("pthread_mutexattr_init");
|
||||
exit (1);
|
||||
}
|
||||
if (pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED)) {
|
||||
perror ("pthread_mutexattr_setpshared");
|
||||
exit (1);
|
||||
perror ("pthread_mutexattr_setpshared");
|
||||
exit (1);
|
||||
}
|
||||
if (pthread_mutex_init(mutex, &mattr)) {
|
||||
perror ("pthread_mutex_init");
|
||||
exit (1);
|
||||
perror ("pthread_mutex_init");
|
||||
exit (1);
|
||||
}
|
||||
sigfillset(&accept_block_mask);
|
||||
sigdelset(&accept_block_mask, SIGHUP);
|
||||
@@ -335,24 +335,24 @@ void accept_mutex_init(void)
|
||||
void accept_mutex_on()
|
||||
{
|
||||
if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) {
|
||||
perror("sigprocmask(SIG_BLOCK)");
|
||||
exit (1);
|
||||
perror("sigprocmask(SIG_BLOCK)");
|
||||
exit (1);
|
||||
}
|
||||
if (pthread_mutex_lock (mutex)) {
|
||||
perror ("pthread_mutex_lock");
|
||||
exit (1);
|
||||
perror ("pthread_mutex_lock");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
void accept_mutex_off()
|
||||
{
|
||||
if (pthread_mutex_unlock (mutex)) {
|
||||
perror ("pthread_mutex_unlock");
|
||||
exit (1);
|
||||
perror ("pthread_mutex_unlock");
|
||||
exit (1);
|
||||
}
|
||||
if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) {
|
||||
perror("sigprocmask(SIG_SETMASK)");
|
||||
exit (1);
|
||||
perror("sigprocmask(SIG_SETMASK)");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,10 +423,10 @@ static void *get_shared_mem(apr_size_t size)
|
||||
|
||||
/* allocate shared memory for the shared_counter */
|
||||
result = (unsigned long *)mmap ((caddr_t)0, size,
|
||||
PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
|
||||
PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
|
||||
if (result == (void *)(caddr_t)-1) {
|
||||
perror ("mmap");
|
||||
exit (1);
|
||||
perror ("mmap");
|
||||
exit (1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -448,8 +448,8 @@ static void *get_shared_mem(apr_size_t size)
|
||||
#endif
|
||||
|
||||
if ((shmid = shmget(shmkey, size, IPC_CREAT | SHM_R | SHM_W)) == -1) {
|
||||
perror("shmget");
|
||||
exit(1);
|
||||
perror("shmget");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef MOVEBREAK
|
||||
@@ -463,29 +463,29 @@ static void *get_shared_mem(apr_size_t size)
|
||||
* attach the segment and then move break back down. Ugly
|
||||
*/
|
||||
if ((obrk = sbrk(MOVEBREAK)) == (char *) -1) {
|
||||
perror("sbrk");
|
||||
perror("sbrk");
|
||||
}
|
||||
#endif
|
||||
|
||||
#define BADSHMAT ((void *)(-1))
|
||||
if ((result = shmat(shmid, 0, 0)) == BADSHMAT) {
|
||||
perror("shmat");
|
||||
perror("shmat");
|
||||
}
|
||||
/*
|
||||
* We must avoid leaving segments in the kernel's
|
||||
* (small) tables.
|
||||
*/
|
||||
if (shmctl(shmid, IPC_RMID, NULL) != 0) {
|
||||
perror("shmctl(IPC_RMID)");
|
||||
perror("shmctl(IPC_RMID)");
|
||||
}
|
||||
if (result == BADSHMAT) /* now bailout */
|
||||
exit(1);
|
||||
exit(1);
|
||||
|
||||
#ifdef MOVEBREAK
|
||||
if (obrk == (char *) -1)
|
||||
return; /* nothing else to do */
|
||||
return; /* nothing else to do */
|
||||
if (sbrk(-(MOVEBREAK)) == (char *) -1) {
|
||||
perror("sbrk 2");
|
||||
perror("sbrk 2");
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
@@ -513,8 +513,8 @@ void main (int argc, char **argv)
|
||||
unsigned long *shared_counter;
|
||||
|
||||
if (argc != 3) {
|
||||
fprintf (stderr, "Usage: time-sem num-child num iter\n");
|
||||
exit (1);
|
||||
fprintf (stderr, "Usage: time-sem num-child num iter\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
num_child = atoi (argv[1]);
|
||||
@@ -532,54 +532,54 @@ void main (int argc, char **argv)
|
||||
accept_mutex_on ();
|
||||
|
||||
for (i = 0; i < num_child; ++i) {
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
/* child, do our thing */
|
||||
accept_mutex_child_init();
|
||||
for (i = 0; i < num_iter; ++i) {
|
||||
unsigned long tmp;
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
/* child, do our thing */
|
||||
accept_mutex_child_init();
|
||||
for (i = 0; i < num_iter; ++i) {
|
||||
unsigned long tmp;
|
||||
|
||||
accept_mutex_on ();
|
||||
tmp = *shared_counter;
|
||||
YIELD;
|
||||
*shared_counter = tmp + 1;
|
||||
accept_mutex_off ();
|
||||
}
|
||||
exit (0);
|
||||
} else if (pid == -1) {
|
||||
perror ("fork");
|
||||
exit (1);
|
||||
}
|
||||
accept_mutex_on ();
|
||||
tmp = *shared_counter;
|
||||
YIELD;
|
||||
*shared_counter = tmp + 1;
|
||||
accept_mutex_off ();
|
||||
}
|
||||
exit (0);
|
||||
} else if (pid == -1) {
|
||||
perror ("fork");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
/* a quick test to see that nothing is screwed up */
|
||||
if (*shared_counter != 0) {
|
||||
puts ("WTF! shared_counter != 0 before the children have been started!");
|
||||
exit (1);
|
||||
puts ("WTF! shared_counter != 0 before the children have been started!");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
gettimeofday (&first, NULL);
|
||||
/* launch children into action */
|
||||
accept_mutex_off ();
|
||||
for (i = 0; i < num_child; ++i) {
|
||||
if (wait(NULL) == -1) {
|
||||
perror ("wait");
|
||||
}
|
||||
if (wait(NULL) == -1) {
|
||||
perror ("wait");
|
||||
}
|
||||
}
|
||||
gettimeofday (&last, NULL);
|
||||
|
||||
if (*shared_counter != num_child * num_iter) {
|
||||
printf ("WTF! shared_counter != num_child * num_iter!\n"
|
||||
"shared_counter = %lu\nnum_child = %d\nnum_iter=%d\n",
|
||||
*shared_counter,
|
||||
num_child, num_iter);
|
||||
printf ("WTF! shared_counter != num_child * num_iter!\n"
|
||||
"shared_counter = %lu\nnum_child = %d\nnum_iter=%d\n",
|
||||
*shared_counter,
|
||||
num_child, num_iter);
|
||||
}
|
||||
|
||||
last.tv_sec -= first.tv_sec;
|
||||
ms = last.tv_usec - first.tv_usec;
|
||||
if (ms < 0) {
|
||||
--last.tv_sec;
|
||||
ms += 1000000;
|
||||
--last.tv_sec;
|
||||
ms += 1000000;
|
||||
}
|
||||
last.tv_usec = ms;
|
||||
printf ("%8lu.%06lu\n", last.tv_sec, last.tv_usec);
|
||||
|
84
test/zb.c
84
test/zb.c
@@ -1,6 +1,6 @@
|
||||
|
||||
/* ZeusBench V1.01
|
||||
===============
|
||||
===============
|
||||
|
||||
This program is Copyright (C) Zeus Technology Limited 1996.
|
||||
|
||||
@@ -196,11 +196,11 @@ void output_results()
|
||||
printf("Document Length: %d\n", doclen);
|
||||
printf("Concurency Level: %d\n", concurrency);
|
||||
printf("Time taken for tests: %d.%03d seconds\n",
|
||||
timetaken/1000, timetaken%1000);
|
||||
timetaken/1000, timetaken%1000);
|
||||
printf("Complete requests: %d\n", done);
|
||||
printf("Failed requests: %d\n", bad);
|
||||
if(bad) printf(" (Connect: %d, Length: %d, Exceptions: %d)\n",
|
||||
err_conn, err_length, err_except);
|
||||
err_conn, err_length, err_except);
|
||||
if(keepalive) printf("Keep-Alive requests: %d\n", doneka);
|
||||
printf("Bytes transferred: %d\n", totalread);
|
||||
printf("HTML transferred: %d\n", totalbread);
|
||||
@@ -209,7 +209,7 @@ void output_results()
|
||||
if(timetaken) {
|
||||
printf("Requests per seconds: %.2f\n", 1000*(float)(done)/timetaken);
|
||||
printf("Transfer rate: %.2f kb/s\n",
|
||||
(float)(totalread)/timetaken);
|
||||
(float)(totalread)/timetaken);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -266,8 +266,8 @@ void start_connect(struct connection *c)
|
||||
close(c->fd);
|
||||
err_conn++;
|
||||
if(bad++>10) {
|
||||
printf("\nTest aborted after 10 failures\n\n");
|
||||
exit(1);
|
||||
printf("\nTest aborted after 10 failures\n\n");
|
||||
exit(1);
|
||||
}
|
||||
start_connect(c);
|
||||
}
|
||||
@@ -352,44 +352,44 @@ void read_connection(struct connection *c)
|
||||
if(!s) {
|
||||
/* read rest next time */
|
||||
if(space)
|
||||
return;
|
||||
return;
|
||||
else {
|
||||
/* header is in invalid or too big - close connection */
|
||||
close(c->fd);
|
||||
if(bad++>10) {
|
||||
printf("\nTest aborted after 10 failures\n\n");
|
||||
exit(1);
|
||||
}
|
||||
FD_CLR(c->fd, &writebits);
|
||||
start_connect(c);
|
||||
/* header is in invalid or too big - close connection */
|
||||
close(c->fd);
|
||||
if(bad++>10) {
|
||||
printf("\nTest aborted after 10 failures\n\n");
|
||||
exit(1);
|
||||
}
|
||||
FD_CLR(c->fd, &writebits);
|
||||
start_connect(c);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* have full header */
|
||||
if(!good) {
|
||||
/* this is first time, extract some interesting info */
|
||||
char *p, *q;
|
||||
p = strstr(c->cbuff, "Server:");
|
||||
q = server_name;
|
||||
if(p) { p+=8; while(*p>32) *q++ = *p++; }
|
||||
*q = 0;
|
||||
/* this is first time, extract some interesting info */
|
||||
char *p, *q;
|
||||
p = strstr(c->cbuff, "Server:");
|
||||
q = server_name;
|
||||
if(p) { p+=8; while(*p>32) *q++ = *p++; }
|
||||
*q = 0;
|
||||
}
|
||||
|
||||
c->gotheader = 1;
|
||||
*s = 0; /* terminate at end of header */
|
||||
if(keepalive &&
|
||||
(strstr(c->cbuff, "Keep-Alive")
|
||||
|| strstr(c->cbuff, "keep-alive"))) /* for benefit of MSIIS */
|
||||
{
|
||||
char *cl;
|
||||
cl = strstr(c->cbuff, "Content-Length:");
|
||||
/* for cacky servers like NCSA which break the spec and send a
|
||||
lower case 'l' */
|
||||
if(!cl) cl = strstr(c->cbuff, "Content-length:");
|
||||
if(cl) {
|
||||
c->keepalive=1;
|
||||
c->length = atoi(cl+16);
|
||||
}
|
||||
(strstr(c->cbuff, "Keep-Alive")
|
||||
|| strstr(c->cbuff, "keep-alive"))) /* for benefit of MSIIS */
|
||||
{
|
||||
char *cl;
|
||||
cl = strstr(c->cbuff, "Content-Length:");
|
||||
/* for cacky servers like NCSA which break the spec and send a
|
||||
lower case 'l' */
|
||||
if(!cl) cl = strstr(c->cbuff, "Content-length:");
|
||||
if(cl) {
|
||||
c->keepalive=1;
|
||||
c->length = atoi(cl+16);
|
||||
}
|
||||
}
|
||||
c->bread += c->cbx - (s+l-c->cbuff) + r-tocopy;
|
||||
totalbread += c->bread;
|
||||
@@ -454,8 +454,8 @@ int test()
|
||||
|
||||
/* setup request */
|
||||
sprintf(request,"GET %s HTTP/1.0\r\nUser-Agent: ZeusBench/1.0\r\n"
|
||||
"%sHost: %s\r\nAccept: */*\r\n\r\n", file,
|
||||
keepalive?"Connection: Keep-Alive\r\n":"", machine );
|
||||
"%sHost: %s\r\nAccept: */*\r\n\r\n", file,
|
||||
keepalive?"Connection: Keep-Alive\r\n":"", machine );
|
||||
|
||||
reqlen = strlen(request);
|
||||
|
||||
@@ -491,10 +491,10 @@ int test()
|
||||
for(i=0; i<concurrency; i++) {
|
||||
int s = con[i].fd;
|
||||
if(FD_ISSET(s, &sel_except)) {
|
||||
bad++;
|
||||
err_except++;
|
||||
start_connect(&con[i]);
|
||||
continue;
|
||||
bad++;
|
||||
err_except++;
|
||||
start_connect(&con[i]);
|
||||
continue;
|
||||
}
|
||||
if(FD_ISSET(s, &sel_read)) read_connection(&con[i]);
|
||||
if(FD_ISSET(s, &sel_write)) write_request(&con[i]);
|
||||
@@ -511,7 +511,7 @@ int test()
|
||||
void usage(char *progname) {
|
||||
printf("\nZeusBench v1.0\n\n");
|
||||
printf("Usage: %s <machine> <file> [-k] [-n requests | -t timelimit (sec)]"
|
||||
"\n\t\t[-c concurrency] [-p port] \n",progname);
|
||||
"\n\t\t[-c concurrency] [-p port] \n",progname);
|
||||
printf("Filename should start with a '/' e.g. /index.html\n\n");
|
||||
exit(EINVAL);
|
||||
}
|
||||
@@ -534,8 +534,8 @@ int main(int argc, char **argv) {
|
||||
case 'n':
|
||||
requests = atoi(optarg);
|
||||
if(!requests) {
|
||||
printf("Invalid number of requests\n");
|
||||
exit(1);
|
||||
printf("Invalid number of requests\n");
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'k':
|
||||
|
Reference in New Issue
Block a user