misc: general C style cleanups
... in code that previously was not checksrc'ed Closes #14625
This commit is contained in:
parent
42843af0b8
commit
99ba50d9c4
@ -89,89 +89,87 @@ int decc$feature_set_value (int index, int mode, int value);
|
||||
#endif
|
||||
|
||||
int SYS$TRNLNM(
|
||||
const unsigned long * attr,
|
||||
const struct dsc$descriptor_s * table_dsc,
|
||||
struct dsc$descriptor_s * name_dsc,
|
||||
const unsigned char * acmode,
|
||||
const struct itmlst_3 * item_list);
|
||||
const unsigned long *attr,
|
||||
const struct dsc$descriptor_s *table_dsc,
|
||||
struct dsc$descriptor_s *name_dsc,
|
||||
const unsigned char *acmode,
|
||||
const struct itmlst_3 *item_list);
|
||||
int SYS$CRELNM(
|
||||
const unsigned long * attr,
|
||||
const struct dsc$descriptor_s * table_dsc,
|
||||
const struct dsc$descriptor_s * name_dsc,
|
||||
const unsigned char * acmode,
|
||||
const struct itmlst_3 * item_list);
|
||||
const unsigned long *attr,
|
||||
const struct dsc$descriptor_s *table_dsc,
|
||||
const struct dsc$descriptor_s *name_dsc,
|
||||
const unsigned char *acmode,
|
||||
const struct itmlst_3 *item_list);
|
||||
|
||||
|
||||
/* Take all the fun out of simply looking up a logical name */
|
||||
static int sys_trnlnm
|
||||
(const char * logname,
|
||||
char * value,
|
||||
int value_len)
|
||||
static int sys_trnlnm(const char *logname,
|
||||
char *value,
|
||||
int value_len)
|
||||
{
|
||||
const $DESCRIPTOR(table_dsc, "LNM$FILE_DEV");
|
||||
const unsigned long attr = LNM$M_CASE_BLIND;
|
||||
struct dsc$descriptor_s name_dsc;
|
||||
int status;
|
||||
unsigned short result;
|
||||
struct itmlst_3 itlst[2];
|
||||
const $DESCRIPTOR(table_dsc, "LNM$FILE_DEV");
|
||||
const unsigned long attr = LNM$M_CASE_BLIND;
|
||||
struct dsc$descriptor_s name_dsc;
|
||||
int status;
|
||||
unsigned short result;
|
||||
struct itmlst_3 itlst[2];
|
||||
|
||||
itlst[0].buflen = value_len;
|
||||
itlst[0].itmcode = LNM$_STRING;
|
||||
itlst[0].bufadr = value;
|
||||
itlst[0].retlen = &result;
|
||||
itlst[0].buflen = value_len;
|
||||
itlst[0].itmcode = LNM$_STRING;
|
||||
itlst[0].bufadr = value;
|
||||
itlst[0].retlen = &result;
|
||||
|
||||
itlst[1].buflen = 0;
|
||||
itlst[1].itmcode = 0;
|
||||
itlst[1].buflen = 0;
|
||||
itlst[1].itmcode = 0;
|
||||
|
||||
name_dsc.dsc$w_length = strlen(logname);
|
||||
name_dsc.dsc$a_pointer = (char *)logname;
|
||||
name_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
name_dsc.dsc$b_class = DSC$K_CLASS_S;
|
||||
name_dsc.dsc$w_length = strlen(logname);
|
||||
name_dsc.dsc$a_pointer = (char *)logname;
|
||||
name_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
name_dsc.dsc$b_class = DSC$K_CLASS_S;
|
||||
|
||||
status = SYS$TRNLNM(&attr, &table_dsc, &name_dsc, 0, itlst);
|
||||
status = SYS$TRNLNM(&attr, &table_dsc, &name_dsc, 0, itlst);
|
||||
|
||||
if($VMS_STATUS_SUCCESS(status)) {
|
||||
if($VMS_STATUS_SUCCESS(status)) {
|
||||
|
||||
/* Null terminate and return the string */
|
||||
/*--------------------------------------*/
|
||||
value[result] = '\0';
|
||||
}
|
||||
/* Null terminate and return the string */
|
||||
/*--------------------------------------*/
|
||||
value[result] = '\0';
|
||||
}
|
||||
|
||||
return status;
|
||||
return status;
|
||||
}
|
||||
|
||||
/* How to simply create a logical name */
|
||||
static int sys_crelnm
|
||||
(const char * logname,
|
||||
const char * value)
|
||||
static int sys_crelnm(const char *logname,
|
||||
const char *value)
|
||||
{
|
||||
int ret_val;
|
||||
const char * proc_table = "LNM$PROCESS_TABLE";
|
||||
struct dsc$descriptor_s proc_table_dsc;
|
||||
struct dsc$descriptor_s logname_dsc;
|
||||
struct itmlst_3 item_list[2];
|
||||
int ret_val;
|
||||
const char *proc_table = "LNM$PROCESS_TABLE";
|
||||
struct dsc$descriptor_s proc_table_dsc;
|
||||
struct dsc$descriptor_s logname_dsc;
|
||||
struct itmlst_3 item_list[2];
|
||||
|
||||
proc_table_dsc.dsc$a_pointer = (char *) proc_table;
|
||||
proc_table_dsc.dsc$w_length = strlen(proc_table);
|
||||
proc_table_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
proc_table_dsc.dsc$b_class = DSC$K_CLASS_S;
|
||||
proc_table_dsc.dsc$a_pointer = (char *) proc_table;
|
||||
proc_table_dsc.dsc$w_length = strlen(proc_table);
|
||||
proc_table_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
proc_table_dsc.dsc$b_class = DSC$K_CLASS_S;
|
||||
|
||||
logname_dsc.dsc$a_pointer = (char *) logname;
|
||||
logname_dsc.dsc$w_length = strlen(logname);
|
||||
logname_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
logname_dsc.dsc$b_class = DSC$K_CLASS_S;
|
||||
logname_dsc.dsc$a_pointer = (char *) logname;
|
||||
logname_dsc.dsc$w_length = strlen(logname);
|
||||
logname_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
logname_dsc.dsc$b_class = DSC$K_CLASS_S;
|
||||
|
||||
item_list[0].buflen = strlen(value);
|
||||
item_list[0].itmcode = LNM$_STRING;
|
||||
item_list[0].bufadr = (char *)value;
|
||||
item_list[0].retlen = NULL;
|
||||
item_list[0].buflen = strlen(value);
|
||||
item_list[0].itmcode = LNM$_STRING;
|
||||
item_list[0].bufadr = (char *)value;
|
||||
item_list[0].retlen = NULL;
|
||||
|
||||
item_list[1].buflen = 0;
|
||||
item_list[1].itmcode = 0;
|
||||
item_list[1].buflen = 0;
|
||||
item_list[1].itmcode = 0;
|
||||
|
||||
ret_val = SYS$CRELNM(NULL, &proc_table_dsc, &logname_dsc, NULL, item_list);
|
||||
ret_val = SYS$CRELNM(NULL, &proc_table_dsc, &logname_dsc, NULL, item_list);
|
||||
|
||||
return ret_val;
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
||||
@ -183,111 +181,112 @@ static int sys_crelnm
|
||||
#ifdef __VAX
|
||||
static void set_feature_default(const char *name, const char *value)
|
||||
{
|
||||
sys_crelnm(name, value);
|
||||
sys_crelnm(name, value);
|
||||
}
|
||||
#else
|
||||
static void set_feature_default(const char *name, int value)
|
||||
{
|
||||
int index;
|
||||
int index;
|
||||
|
||||
index = decc$feature_get_index(name);
|
||||
index = decc$feature_get_index(name);
|
||||
|
||||
if(index > 0)
|
||||
decc$feature_set_value (index, 0, value);
|
||||
if(index > 0)
|
||||
decc$feature_set_value (index, 0, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void set_features(void)
|
||||
{
|
||||
int status;
|
||||
char unix_shell_name[255];
|
||||
int use_unix_settings = 1;
|
||||
int status;
|
||||
char unix_shell_name[255];
|
||||
int use_unix_settings = 1;
|
||||
|
||||
status = sys_trnlnm("GNV$UNIX_SHELL",
|
||||
unix_shell_name, sizeof unix_shell_name -1);
|
||||
if(!$VMS_STATUS_SUCCESS(status)) {
|
||||
use_unix_settings = 0;
|
||||
}
|
||||
status = sys_trnlnm("GNV$UNIX_SHELL",
|
||||
unix_shell_name, sizeof(unix_shell_name) -1);
|
||||
if(!$VMS_STATUS_SUCCESS(status)) {
|
||||
use_unix_settings = 0;
|
||||
}
|
||||
|
||||
/* ACCESS should check ACLs or it is lying. */
|
||||
set_feature_default("DECC$ACL_ACCESS_CHECK", ENABLE);
|
||||
/* ACCESS should check ACLs or it is lying. */
|
||||
set_feature_default("DECC$ACL_ACCESS_CHECK", ENABLE);
|
||||
|
||||
/* We always want the new parse style */
|
||||
set_feature_default ("DECC$ARGV_PARSE_STYLE" , ENABLE);
|
||||
/* We always want the new parse style */
|
||||
set_feature_default("DECC$ARGV_PARSE_STYLE", ENABLE);
|
||||
|
||||
|
||||
/* Unless we are in POSIX compliant mode, we want the old POSIX root
|
||||
* enabled.
|
||||
*/
|
||||
set_feature_default("DECC$DISABLE_POSIX_ROOT", DISABLE);
|
||||
/* Unless we are in POSIX compliant mode, we want the old POSIX root
|
||||
* enabled.
|
||||
*/
|
||||
set_feature_default("DECC$DISABLE_POSIX_ROOT", DISABLE);
|
||||
|
||||
/* EFS charset, means UTF-8 support */
|
||||
/* VTF-7 support is controlled by a feature setting called UTF8 */
|
||||
set_feature_default ("DECC$EFS_CHARSET", ENABLE);
|
||||
set_feature_default ("DECC$EFS_CASE_PRESERVE", ENABLE);
|
||||
/* EFS charset, means UTF-8 support */
|
||||
/* VTF-7 support is controlled by a feature setting called UTF8 */
|
||||
set_feature_default("DECC$EFS_CHARSET", ENABLE);
|
||||
set_feature_default("DECC$EFS_CASE_PRESERVE", ENABLE);
|
||||
|
||||
/* Support timestamps when available */
|
||||
set_feature_default ("DECC$EFS_FILE_TIMESTAMPS", ENABLE);
|
||||
/* Support timestamps when available */
|
||||
set_feature_default("DECC$EFS_FILE_TIMESTAMPS", ENABLE);
|
||||
|
||||
/* Cache environment variables - performance improvements */
|
||||
set_feature_default ("DECC$ENABLE_GETENV_CACHE", ENABLE);
|
||||
/* Cache environment variables - performance improvements */
|
||||
set_feature_default("DECC$ENABLE_GETENV_CACHE", ENABLE);
|
||||
|
||||
/* Start out with new file attribute inheritance */
|
||||
/* Start out with new file attribute inheritance */
|
||||
#ifdef __VAX
|
||||
set_feature_default ("DECC$EXEC_FILEATTR_INHERITANCE", "2");
|
||||
set_feature_default("DECC$EXEC_FILEATTR_INHERITANCE", "2");
|
||||
#else
|
||||
set_feature_default ("DECC$EXEC_FILEATTR_INHERITANCE", 2);
|
||||
set_feature_default("DECC$EXEC_FILEATTR_INHERITANCE", 2);
|
||||
#endif
|
||||
|
||||
/* Don't display trailing dot after files without type */
|
||||
set_feature_default ("DECC$READDIR_DROPDOTNOTYPE", ENABLE);
|
||||
/* Don't display trailing dot after files without type */
|
||||
set_feature_default("DECC$READDIR_DROPDOTNOTYPE", ENABLE);
|
||||
|
||||
/* For standard output channels buffer output until terminator */
|
||||
/* Gets rid of output logs with single character lines in them. */
|
||||
set_feature_default ("DECC$STDIO_CTX_EOL", ENABLE);
|
||||
/* For standard output channels buffer output until terminator */
|
||||
/* Gets rid of output logs with single character lines in them. */
|
||||
set_feature_default("DECC$STDIO_CTX_EOL", ENABLE);
|
||||
|
||||
/* Fix mv aa.bb aa */
|
||||
set_feature_default ("DECC$RENAME_NO_INHERIT", ENABLE);
|
||||
/* Fix mv aa.bb aa */
|
||||
set_feature_default("DECC$RENAME_NO_INHERIT", ENABLE);
|
||||
|
||||
if(use_unix_settings) {
|
||||
if(use_unix_settings) {
|
||||
|
||||
/* POSIX requires that open files be able to be removed */
|
||||
set_feature_default ("DECC$ALLOW_REMOVE_OPEN_FILES", ENABLE);
|
||||
/* POSIX requires that open files be able to be removed */
|
||||
set_feature_default("DECC$ALLOW_REMOVE_OPEN_FILES", ENABLE);
|
||||
|
||||
/* Default to outputting Unix filenames in VMS routines */
|
||||
set_feature_default ("DECC$FILENAME_UNIX_ONLY", ENABLE);
|
||||
/* FILENAME_UNIX_ONLY Implicitly sets */
|
||||
/* decc$disable_to_vms_logname_translation */
|
||||
/* Default to outputting Unix filenames in VMS routines */
|
||||
set_feature_default("DECC$FILENAME_UNIX_ONLY", ENABLE);
|
||||
/* FILENAME_UNIX_ONLY Implicitly sets */
|
||||
/* decc$disable_to_vms_logname_translation */
|
||||
|
||||
set_feature_default ("DECC$FILE_PERMISSION_UNIX", ENABLE);
|
||||
set_feature_default("DECC$FILE_PERMISSION_UNIX", ENABLE);
|
||||
|
||||
set_feature_default ("DECC$FILE_SHARING", ENABLE);
|
||||
set_feature_default("DECC$FILE_SHARING", ENABLE);
|
||||
|
||||
set_feature_default ("DECC$FILE_OWNER_UNIX", ENABLE);
|
||||
set_feature_default ("DECC$POSIX_SEEK_STREAM_FILE", ENABLE);
|
||||
set_feature_default("DECC$FILE_OWNER_UNIX", ENABLE);
|
||||
set_feature_default("DECC$POSIX_SEEK_STREAM_FILE", ENABLE);
|
||||
|
||||
} else {
|
||||
set_feature_default("DECC$FILENAME_UNIX_REPORT", ENABLE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
set_feature_default("DECC$FILENAME_UNIX_REPORT", ENABLE);
|
||||
}
|
||||
|
||||
/* When reporting Unix filenames, glob the same way */
|
||||
set_feature_default ("DECC$GLOB_UNIX_STYLE", ENABLE);
|
||||
/* When reporting Unix filenames, glob the same way */
|
||||
set_feature_default("DECC$GLOB_UNIX_STYLE", ENABLE);
|
||||
|
||||
/* The VMS version numbers on Unix filenames is incompatible with most */
|
||||
/* ported packages. */
|
||||
set_feature_default("DECC$FILENAME_UNIX_NO_VERSION", ENABLE);
|
||||
/* The VMS version numbers on Unix filenames is incompatible with most */
|
||||
/* ported packages. */
|
||||
set_feature_default("DECC$FILENAME_UNIX_NO_VERSION", ENABLE);
|
||||
|
||||
/* The VMS version numbers on Unix filenames is incompatible with most */
|
||||
/* ported packages. */
|
||||
set_feature_default("DECC$UNIX_PATH_BEFORE_LOGNAME", ENABLE);
|
||||
/* The VMS version numbers on Unix filenames is incompatible with most */
|
||||
/* ported packages. */
|
||||
set_feature_default("DECC$UNIX_PATH_BEFORE_LOGNAME", ENABLE);
|
||||
|
||||
/* Set strtol to proper behavior */
|
||||
set_feature_default("DECC$STRTOL_ERANGE", ENABLE);
|
||||
/* Set strtol to proper behavior */
|
||||
set_feature_default("DECC$STRTOL_ERANGE", ENABLE);
|
||||
|
||||
/* Commented here to prevent future bugs: A program or user should */
|
||||
/* never ever enable DECC$POSIX_STYLE_UID. */
|
||||
/* It will probably break all code that accesses UIDs */
|
||||
/* do_not_set_default ("DECC$POSIX_STYLE_UID", TRUE); */
|
||||
/* Commented here to prevent future bugs: A program or user should */
|
||||
/* never ever enable DECC$POSIX_STYLE_UID. */
|
||||
/* It will probably break all code that accesses UIDs */
|
||||
/* do_not_set_default ("DECC$POSIX_STYLE_UID", TRUE); */
|
||||
}
|
||||
|
||||
|
||||
@ -308,7 +307,7 @@ static void set_features(void)
|
||||
# endif
|
||||
#endif
|
||||
/* Set our contribution to the LIB$INITIALIZE array */
|
||||
void (* const iniarray[])(void) = {set_features, } ;
|
||||
void (* const iniarray[])(void) = {set_features };
|
||||
#ifndef __VAX
|
||||
# if __INITIAL_POINTER_SIZE
|
||||
# pragma __pointer_size __restore
|
||||
|
||||
@ -36,65 +36,64 @@
|
||||
#include <errno.h>
|
||||
|
||||
unsigned long LIB$SET_SYMBOL(
|
||||
const struct dsc$descriptor_s * symbol,
|
||||
const struct dsc$descriptor_s * value,
|
||||
const unsigned long * table_type);
|
||||
const struct dsc$descriptor_s * symbol,
|
||||
const struct dsc$descriptor_s * value,
|
||||
const unsigned long *table_type);
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
void *libptr;
|
||||
const char * (*ssl_version)(int t);
|
||||
const char *version;
|
||||
|
||||
if(argc < 1) {
|
||||
puts("report_openssl_version filename");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void * libptr;
|
||||
const char * (*ssl_version)(int t);
|
||||
const char * version;
|
||||
libptr = dlopen(argv[1], 0);
|
||||
|
||||
if(argc < 1) {
|
||||
puts("report_openssl_version filename");
|
||||
exit(1);
|
||||
}
|
||||
ssl_version = (const char * (*)(int))dlsym(libptr, "SSLeay_version");
|
||||
if(!ssl_version) {
|
||||
ssl_version = (const char * (*)(int))dlsym(libptr, "ssleay_version");
|
||||
if(!ssl_version) {
|
||||
ssl_version = (const char * (*)(int))dlsym(libptr, "SSLEAY_VERSION");
|
||||
}
|
||||
}
|
||||
|
||||
libptr = dlopen(argv[1], 0);
|
||||
dlclose(libptr);
|
||||
|
||||
ssl_version = (const char * (*)(int))dlsym(libptr, "SSLeay_version");
|
||||
if(ssl_version == NULL) {
|
||||
ssl_version = (const char * (*)(int))dlsym(libptr, "ssleay_version");
|
||||
if(ssl_version == NULL) {
|
||||
ssl_version = (const char * (*)(int))dlsym(libptr, "SSLEAY_VERSION");
|
||||
}
|
||||
}
|
||||
if(!ssl_version) {
|
||||
puts("Unable to lookup version of OpenSSL");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
dlclose(libptr);
|
||||
version = ssl_version(SSLEAY_VERSION);
|
||||
|
||||
if(ssl_version == NULL) {
|
||||
puts("Unable to lookup version of OpenSSL");
|
||||
exit(1);
|
||||
}
|
||||
puts(version);
|
||||
|
||||
version = ssl_version(SSLEAY_VERSION);
|
||||
/* Was a symbol argument given? */
|
||||
if(argc > 1) {
|
||||
int status;
|
||||
struct dsc$descriptor_s symbol_dsc;
|
||||
struct dsc$descriptor_s value_dsc;
|
||||
const unsigned long table_type = LIB$K_CLI_LOCAL_SYM;
|
||||
|
||||
puts(version);
|
||||
symbol_dsc.dsc$a_pointer = argv[2];
|
||||
symbol_dsc.dsc$w_length = strlen(argv[2]);
|
||||
symbol_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
symbol_dsc.dsc$b_class = DSC$K_CLASS_S;
|
||||
|
||||
/* Was a symbol argument given? */
|
||||
if(argc > 1) {
|
||||
int status;
|
||||
struct dsc$descriptor_s symbol_dsc;
|
||||
struct dsc$descriptor_s value_dsc;
|
||||
const unsigned long table_type = LIB$K_CLI_LOCAL_SYM;
|
||||
value_dsc.dsc$a_pointer = (char *)version; /* Cast ok */
|
||||
value_dsc.dsc$w_length = strlen(version);
|
||||
value_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
value_dsc.dsc$b_class = DSC$K_CLASS_S;
|
||||
|
||||
symbol_dsc.dsc$a_pointer = argv[2];
|
||||
symbol_dsc.dsc$w_length = strlen(argv[2]);
|
||||
symbol_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
symbol_dsc.dsc$b_class = DSC$K_CLASS_S;
|
||||
status = LIB$SET_SYMBOL(&symbol_dsc, &value_dsc, &table_type);
|
||||
if(!$VMS_STATUS_SUCCESS(status)) {
|
||||
exit(status);
|
||||
}
|
||||
}
|
||||
|
||||
value_dsc.dsc$a_pointer = (char *)version; /* Cast ok */
|
||||
value_dsc.dsc$w_length = strlen(version);
|
||||
value_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
value_dsc.dsc$b_class = DSC$K_CLASS_S;
|
||||
|
||||
status = LIB$SET_SYMBOL(&symbol_dsc, &value_dsc, &table_type);
|
||||
if(!$VMS_STATUS_SUCCESS(status)) {
|
||||
exit(status);
|
||||
}
|
||||
}
|
||||
|
||||
exit(0);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ create the thread local storage and that could be a problem for LoadLibrary.
|
||||
Regarding the options that were added via C_EXTRA_FLAGS:
|
||||
|
||||
FP_MAX_BITS=16384
|
||||
https://www.yassl.com/forums/topic423-cacertorgs-ca-cert-verify-failed-but-withdisablefastmath-it-works.html
|
||||
https://www.wolfssl.com/documentation/manuals/wolfssl/chapter02.html
|
||||
"Since root.crt uses a 4096-bit RSA key, you'll need to increase the fastmath
|
||||
buffer size. You can do this using the define:
|
||||
FP_MAX_BITS and setting it to 8192."
|
||||
|
||||
@ -62,8 +62,8 @@ static const struct detail scheme[] = {
|
||||
{"rtsp", "#ifndef CURL_DISABLE_RTSP" },
|
||||
{"scp", "#if defined(USE_SSH) && !defined(USE_WOLFSSH)" },
|
||||
{"sftp", "#if defined(USE_SSH)" },
|
||||
{"smb", "#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \\\n"
|
||||
" (SIZEOF_CURL_OFF_T > 4)" },
|
||||
{"smb", "#if !defined(CURL_DISABLE_SMB) && \\\n"
|
||||
" defined(USE_CURL_NTLM_CORE) && (SIZEOF_CURL_OFF_T > 4)" },
|
||||
{"smbs", "#if defined(USE_SSL) && !defined(CURL_DISABLE_SMB) && \\\n"
|
||||
" defined(USE_CURL_NTLM_CORE) && (SIZEOF_CURL_OFF_T > 4)" },
|
||||
{"smtp", "#ifndef CURL_DISABLE_SMTP" },
|
||||
@ -112,10 +112,10 @@ static void showtable(int try, int init, int shift)
|
||||
printf(" static const struct Curl_handler * const protocols[%d] = {", try);
|
||||
|
||||
/* generate table */
|
||||
for(i=0; i < try; i++) {
|
||||
for(i = 0; i < try; i++) {
|
||||
int match = 0;
|
||||
int j;
|
||||
for(j=0; scheme[j].n; j++) {
|
||||
for(j = 0; scheme[j].n; j++) {
|
||||
if(ix[j] == i) {
|
||||
printf("\n");
|
||||
printf("%s\n", scheme[j].ifdef);
|
||||
@ -154,7 +154,7 @@ int main(void)
|
||||
unsigned int v = calc(scheme[i].n, add, shift);
|
||||
int j;
|
||||
int badcombo = 0;
|
||||
for(j=0; j < i; j++) {
|
||||
for(j = 0; j < i; j++) {
|
||||
|
||||
if(num[j] == v) {
|
||||
/*
|
||||
@ -183,9 +183,8 @@ int main(void)
|
||||
/* check for dupes */
|
||||
for(i = 0; scheme[i].n && good; ++i) {
|
||||
int j;
|
||||
for(j=0; j < i; j++) {
|
||||
for(j = 0; j < i; j++) {
|
||||
if(ix[j] == ix[i]) {
|
||||
/* printf("NOPE, try %u causes dupes (%d and %d)\n", try, j, i); */
|
||||
good = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -42,7 +42,8 @@ static int curltest_tweak_handler(request_rec *r);
|
||||
static int curltest_1_1_required(request_rec *r);
|
||||
static int curltest_sslinfo_handler(request_rec *r);
|
||||
|
||||
AP_DECLARE_MODULE(curltest) = {
|
||||
AP_DECLARE_MODULE(curltest) =
|
||||
{
|
||||
STANDARD20_MODULE_STUFF,
|
||||
NULL, /* func to create per dir config */
|
||||
NULL, /* func to merge per dir config */
|
||||
@ -95,8 +96,8 @@ static void curltest_hooks(apr_pool_t *pool)
|
||||
#define SECS_PER_HOUR (60*60)
|
||||
#define SECS_PER_DAY (24*SECS_PER_HOUR)
|
||||
|
||||
static apr_status_t duration_parse(apr_interval_time_t *ptimeout, const char *value,
|
||||
const char *def_unit)
|
||||
static apr_status_t duration_parse(apr_interval_time_t *ptimeout,
|
||||
const char *value, const char *def_unit)
|
||||
{
|
||||
char *endp;
|
||||
apr_int64_t n;
|
||||
@ -106,7 +107,8 @@ static apr_status_t duration_parse(apr_interval_time_t *ptimeout, const char *va
|
||||
return errno;
|
||||
}
|
||||
if(!endp || !*endp) {
|
||||
if (!def_unit) def_unit = "s";
|
||||
if(!def_unit)
|
||||
def_unit = "s";
|
||||
}
|
||||
else if(endp == value) {
|
||||
return APR_EINVAL;
|
||||
@ -202,7 +204,7 @@ static int curltest_echo_handler(request_rec *r)
|
||||
int i;
|
||||
args = apr_cstr_split(r->args, "&", 1, r->pool);
|
||||
for(i = 0; i < args->nelts; ++i) {
|
||||
char *s, *val, *arg = APR_ARRAY_IDX(args, i, char*);
|
||||
char *s, *val, *arg = APR_ARRAY_IDX(args, i, char *);
|
||||
s = strchr(arg, '=');
|
||||
if(s) {
|
||||
*s = '\0';
|
||||
@ -254,7 +256,9 @@ static int curltest_echo_handler(request_rec *r)
|
||||
|
||||
bb = apr_brigade_create(r->pool, c->bucket_alloc);
|
||||
/* copy any request body into the response */
|
||||
if((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK))) goto cleanup;
|
||||
rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK);
|
||||
if(rv)
|
||||
goto cleanup;
|
||||
if(die_after_100) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
|
||||
"echo_handler: dying after 100-continue");
|
||||
@ -278,9 +282,11 @@ static int curltest_echo_handler(request_rec *r)
|
||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
|
||||
"echo_handler: copying %ld bytes from request body", l);
|
||||
rv = apr_brigade_write(bb, NULL, NULL, buffer, l);
|
||||
if (APR_SUCCESS != rv) goto cleanup;
|
||||
if(APR_SUCCESS != rv)
|
||||
goto cleanup;
|
||||
rv = ap_pass_brigade(r->output_filters, bb);
|
||||
if (APR_SUCCESS != rv) goto cleanup;
|
||||
if(APR_SUCCESS != rv)
|
||||
goto cleanup;
|
||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
|
||||
"echo_handler: passed %ld bytes from request body", l);
|
||||
}
|
||||
@ -344,7 +350,7 @@ static int curltest_tweak_handler(request_rec *r)
|
||||
if(r->args) {
|
||||
args = apr_cstr_split(r->args, "&", 1, r->pool);
|
||||
for(i = 0; i < args->nelts; ++i) {
|
||||
char *s, *val, *arg = APR_ARRAY_IDX(args, i, char*);
|
||||
char *s, *val, *arg = APR_ARRAY_IDX(args, i, char *);
|
||||
s = strchr(arg, '=');
|
||||
if(s) {
|
||||
*s = '\0';
|
||||
@ -434,7 +440,7 @@ static int curltest_tweak_handler(request_rec *r)
|
||||
"request, %s", r->args? r->args : "(no args)");
|
||||
r->status = http_status;
|
||||
r->clength = with_cl? (chunks * chunk_size) : -1;
|
||||
r->chunked = (r->proto_num >= HTTP_VERSION(1,1)) && !with_cl;
|
||||
r->chunked = (r->proto_num >= HTTP_VERSION(1, 1)) && !with_cl;
|
||||
apr_table_setn(r->headers_out, "request-id", request_id);
|
||||
if(r->clength >= 0) {
|
||||
apr_table_set(r->headers_out, "Content-Length",
|
||||
@ -460,7 +466,8 @@ static int curltest_tweak_handler(request_rec *r)
|
||||
b = apr_bucket_flush_create(c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||
rv = ap_pass_brigade(r->output_filters, bb);
|
||||
if (APR_SUCCESS != rv) goto cleanup;
|
||||
if(APR_SUCCESS != rv)
|
||||
goto cleanup;
|
||||
|
||||
memset(buffer, 'X', sizeof(buffer));
|
||||
for(i = 0; i < chunks; ++i) {
|
||||
@ -468,9 +475,11 @@ static int curltest_tweak_handler(request_rec *r)
|
||||
apr_sleep(chunk_delay);
|
||||
}
|
||||
rv = apr_brigade_write(bb, NULL, NULL, buffer, chunk_size);
|
||||
if(APR_SUCCESS != rv) goto cleanup;
|
||||
if(APR_SUCCESS != rv)
|
||||
goto cleanup;
|
||||
rv = ap_pass_brigade(r->output_filters, bb);
|
||||
if(APR_SUCCESS != rv) goto cleanup;
|
||||
if(APR_SUCCESS != rv)
|
||||
goto cleanup;
|
||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
|
||||
"error_handler: passed %lu bytes as response body",
|
||||
(unsigned long)chunk_size);
|
||||
@ -542,7 +551,7 @@ static int curltest_put_handler(request_rec *r)
|
||||
if(r->args) {
|
||||
args = apr_cstr_split(r->args, "&", 1, r->pool);
|
||||
for(i = 0; i < args->nelts; ++i) {
|
||||
char *s, *val, *arg = APR_ARRAY_IDX(args, i, char*);
|
||||
char *s, *val, *arg = APR_ARRAY_IDX(args, i, char *);
|
||||
s = strchr(arg, '=');
|
||||
if(s) {
|
||||
*s = '\0';
|
||||
@ -591,7 +600,9 @@ static int curltest_put_handler(request_rec *r)
|
||||
}
|
||||
bb = apr_brigade_create(r->pool, c->bucket_alloc);
|
||||
/* copy any request body into the response */
|
||||
if((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK))) goto cleanup;
|
||||
rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK);
|
||||
if(rv)
|
||||
goto cleanup;
|
||||
if(ap_should_client_block(r)) {
|
||||
while(0 < (l = ap_get_client_block(r, &buffer[0], sizeof(buffer)))) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
|
||||
@ -606,7 +617,8 @@ static int curltest_put_handler(request_rec *r)
|
||||
s_rbody_len = apr_psprintf(r->pool, "%"APR_OFF_T_FMT, rbody_len);
|
||||
apr_table_setn(r->headers_out, "Received-Length", s_rbody_len);
|
||||
rv = apr_brigade_puts(bb, NULL, NULL, s_rbody_len);
|
||||
if(APR_SUCCESS != rv) goto cleanup;
|
||||
if(APR_SUCCESS != rv)
|
||||
goto cleanup;
|
||||
b = apr_bucket_eos_create(c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "put_handler: request read");
|
||||
@ -646,7 +658,7 @@ static int curltest_1_1_required(request_rec *r)
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
if (HTTP_VERSION_MAJOR(r->proto_num) > 1) {
|
||||
if(HTTP_VERSION_MAJOR(r->proto_num) > 1) {
|
||||
apr_table_setn(r->notes, "ssl-renegotiate-forbidden", "1");
|
||||
ap_die(HTTP_FORBIDDEN, r);
|
||||
return OK;
|
||||
@ -670,11 +682,13 @@ static int curltest_1_1_required(request_rec *r)
|
||||
b = apr_bucket_flush_create(c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||
rv = ap_pass_brigade(r->output_filters, bb);
|
||||
if (APR_SUCCESS != rv) goto cleanup;
|
||||
if(APR_SUCCESS != rv)
|
||||
goto cleanup;
|
||||
|
||||
/* we are done */
|
||||
rv = apr_brigade_printf(bb, NULL, NULL, "well done!");
|
||||
if(APR_SUCCESS != rv) goto cleanup;
|
||||
if(APR_SUCCESS != rv)
|
||||
goto cleanup;
|
||||
b = apr_bucket_eos_create(c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "1_1_handler: request read");
|
||||
@ -728,7 +742,7 @@ static int curltest_sslinfo_handler(request_rec *r)
|
||||
if(r->args) {
|
||||
apr_array_header_t *args = apr_cstr_split(r->args, "&", 1, r->pool);
|
||||
for(i = 0; i < args->nelts; ++i) {
|
||||
char *s, *val, *arg = APR_ARRAY_IDX(args, i, char*);
|
||||
char *s, *val, *arg = APR_ARRAY_IDX(args, i, char *);
|
||||
s = strchr(arg, '=');
|
||||
if(s) {
|
||||
*s = '\0';
|
||||
@ -781,7 +795,8 @@ static int curltest_sslinfo_handler(request_rec *r)
|
||||
b = apr_bucket_flush_create(c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||
rv = ap_pass_brigade(r->output_filters, bb);
|
||||
if (APR_SUCCESS != rv) goto cleanup;
|
||||
if(APR_SUCCESS != rv)
|
||||
goto cleanup;
|
||||
|
||||
/* we are done */
|
||||
b = apr_bucket_eos_create(c->bucket_alloc);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user