Hello community, here is the log from the commit of package siege for openSUSE:Factory checked in at 2015-09-03 18:04:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/siege (Old) and /work/SRC/openSUSE:Factory/.siege.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "siege" Changes: -------- --- /work/SRC/openSUSE:Factory/siege/siege.changes 2015-03-18 13:03:47.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.siege.new/siege.changes 2015-09-03 18:12:29.000000000 +0200 @@ -1,0 +2,9 @@ +Wed Sep 2 13:17:27 UTC 2015 - mplus...@suse.com + +- Update to 3.1.0 + * This release adds support for more than 1024 concurrent users. + (Please don’t use that many unless you know what you’re doing). + It also adds delay granularity. You can now select set delays + to hundreds of a second like this: –delay=0.001 or -d 0.001 + +------------------------------------------------------------------- Old: ---- siege-3.0.9.tar.gz New: ---- siege-3.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ siege.spec ++++++ --- /var/tmp/diff_new_pack.Dg2Jh4/_old 2015-09-03 18:12:31.000000000 +0200 +++ /var/tmp/diff_new_pack.Dg2Jh4/_new 2015-09-03 18:12:31.000000000 +0200 @@ -18,7 +18,7 @@ Name: siege -Version: 3.0.9 +Version: 3.1.0 Release: 0 Summary: HTTP Regression Testing/Benchmarking Utility License: GPL-2.0+ @@ -67,11 +67,11 @@ %{_bindir}/siege %{_bindir}/siege2csv.pl %{_bindir}/siege.config -%doc %{_mandir}/man1/bombardment.1* -%doc %{_mandir}/man1/siege.1* -%doc %{_mandir}/man1/siege2csv.1* -%doc %{_mandir}/man1/siege.config.1* -%doc %{_mandir}/man5/urls_txt.5* -%doc %{_mandir}/man7/layingsiege.7* +%{_mandir}/man1/bombardment.1* +%{_mandir}/man1/siege.1* +%{_mandir}/man1/siege2csv.1* +%{_mandir}/man1/siege.config.1* +%{_mandir}/man5/urls_txt.5* +%{_mandir}/man7/layingsiege.7* %changelog ++++++ siege-3.0.9.tar.gz -> siege-3.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/ChangeLog new/siege-3.1.0/ChangeLog --- old/siege-3.0.9/ChangeLog 2015-02-26 21:22:40.000000000 +0100 +++ new/siege-3.1.0/ChangeLog 2015-06-03 22:12:36.000000000 +0200 @@ -1,6 +1,46 @@ To email a contributor remove "DELETE" from the email address. (The DELETEs are necessary as this list is published online.) +2015/06/03 Jeffrey Fulmer <http://www.joedog.org/support/> + * SIEGE RELEASE RELEASE_3-1-0_JUN_03_2015 + * src/version.c Version increment: 3.1.0 + +2015/06/03 Eric Abbott <eabb...@hubspotnospam.com> + * src/setup.h Changed delay to float + * src/client.c Changed delay handling for float + * src/main.c Changed delay handling for float + * src/init.c Changed delay handling for float + +2015/06/03 Jeffrey Fulmer <http://www.joedog.org/support/> + * src/init.c XXX backed out 04/16 protective mem handling + +2015/05/19 Jeffrey Fulmer <http://www.joedog.org/support/> + * SIEGE RELEASE RELEASE_3-1-0rc3_MAY_19_2015 + * src/sock.h Added struct for poll + * src/sock.c Added __socket_poll for socks >= FD_SETSIZE + * src/version.c Version increment: 3.1.0-rc3 + +2015/05/15 Jeffrey Fulmer <http://www.joedog.org/support/> + * SIEGE RELEASE RELEASE_3-1-0rc2_MAY_15_2015 + * src/sock.c Added poll in __socket_check for those who have it + * src/version.c Release candidate: 3.1.0-rc2 + * configure.ac Added func_check for poll (HAVE_POLL in config.h) + +2015/05/13 Jeffrey Fulmer <http://www.joedog.org/support/> + * SIEGE RELEASE RELEASE_3-1-0rc1_MAY_13_2015 + * src/sock.c Checked integrity of incoming host param + * src/version.c Release candidate: 3.1.0-rc1 + +2015/04/16 Technion <https://github.com/technion> + * include/joedog.h Removed asprintf from the CYGWIN block + * src/url.c Added test for conttype in get_conttype + * src/init.c Added protective memory handling + +2015/04/14 Jeffrey Fulmer <http://www.joedog.org/support/> + * src/url.c Fixed some broken memsets + * src/sock.c Added error handling for unused herrno + * lib/memory.c Removed unused variable from xstrcat + 2015/02/26 Jeffrey Fulmer <http://www.joedog.org/support/> * SIEGE RELEASE RELEASE_3-0-9_FEB_26-2015 * src/version.c Version increment: 3.0.9 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/README.md new/siege-3.1.0/README.md --- old/siege-3.0.9/README.md 2015-02-26 21:21:15.000000000 +0100 +++ new/siege-3.1.0/README.md 2015-06-03 21:01:21.000000000 +0200 @@ -66,13 +66,17 @@ WHERE IS IT? ------------ The latest version of siege can be obtained via anonymous FTP: -ftp://sid.joedog.org/pub/siege/siege-latest.tar.gz +http://download.joedog.org/siege/siege-latest.tar.gz -Siege is mirrored at nerf-herder: -http://nerf-herder.net/siege +The source repository is located on GitHub: +git clone https://github.com/JoeDog/siege.git + +YOu can view in your browser here: +https://github.com/JoeDog/siege + +Updates and announcements are distributed via JoeBlog: +http://www.joedog.org/blog -Updates and announcements are distributed via freshmeat: -http://freshmeat.net/projects/siege INSTALLATION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/configure new/siege-3.1.0/configure --- old/siege-3.0.9/configure 2015-02-26 21:33:39.000000000 +0100 +++ new/siege-3.1.0/configure 2015-06-03 22:14:55.000000000 +0200 @@ -25999,6 +25999,108 @@ done +for ac_func in poll +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/configure.ac new/siege-3.1.0/configure.ac --- old/siege-3.0.9/configure.ac 2015-02-26 21:21:15.000000000 +0100 +++ new/siege-3.1.0/configure.ac 2015-06-03 21:01:21.000000000 +0200 @@ -266,6 +266,7 @@ AC_CHECK_FUNCS(getipnodebyname) AC_CHECK_FUNCS(freehostent) AC_CHECK_FUNCS(getopt_long) +AC_CHECK_FUNCS(poll) dnl dnl Check for socket library diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/include/config.h.in new/siege-3.1.0/include/config.h.in --- old/siege-3.0.9/include/config.h.in 2015-02-26 21:33:35.000000000 +0100 +++ new/siege-3.1.0/include/config.h.in 2015-06-03 22:14:51.000000000 +0200 @@ -75,6 +75,9 @@ /* Define to 1 if you have the <openssl/e_os.h> header file. */ #undef HAVE_OPENSSL_E_OS_H +/* Define to 1 if you have the `poll' function. */ +#undef HAVE_POLL + /* Define to 1 if you have the <pthread.h> header file. */ #undef HAVE_PTHREAD_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/include/joedog/joedog.h new/siege-3.1.0/include/joedog/joedog.h --- old/siege-3.0.9/include/joedog/joedog.h 2015-02-26 21:21:15.000000000 +0100 +++ new/siege-3.1.0/include/joedog/joedog.h 2015-06-03 21:01:21.000000000 +0200 @@ -90,7 +90,6 @@ #endif #ifndef __CYGWIN__ -extern int asprintf (char **ptr, const char *fmt, /*args*/ ...); extern int vasprintf (char **ptr, const char *fmt, va_list ap); extern int asnprintf (char **ptr, size_t str_m, const char *fmt, /*args*/ ...); extern int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/lib/joedog/memory.c new/siege-3.1.0/lib/joedog/memory.c --- old/siege-3.0.9/lib/joedog/memory.c 2015-02-26 21:21:15.000000000 +0100 +++ new/siege-3.1.0/lib/joedog/memory.c 2015-06-03 21:01:21.000000000 +0200 @@ -59,7 +59,6 @@ { const char *argptr; char *resptr, *result; - int nargs = 0; size_t len = 0; va_list valist; @@ -75,7 +74,6 @@ va_start(valist, arg1); - nargs = 0; for(argptr = arg1; argptr != NULL; argptr = va_arg(valist, char *)) { len = strlen(argptr); memcpy(resptr, argptr, len); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/src/client.c new/siege-3.1.0/src/client.c --- old/siege-3.0.9/src/client.c 2015-02-26 21:21:15.000000000 +0100 +++ new/siege-3.1.0/src/client.c 2015-06-03 21:07:06.000000000 +0200 @@ -248,11 +248,16 @@ return FALSE; } - if (my.delay) { + if (my.delay >= 1) { pthread_sleep_np( (unsigned int) (((double)pthread_rand_np(&(client->rand_r_SEED)) / ((double)RAND_MAX + 1) * my.delay ) + .5) ); + } else if (my.delay >= .001) { + pthread_usleep_np( + (unsigned int) (((double)pthread_rand_np(&(client->rand_r_SEED)) / + ((double)RAND_MAX + 1) * my.delay * 1000000 ) + .0005) + ); } /* record transaction start time */ @@ -263,14 +268,14 @@ /** * write to socket with a GET/POST/PUT/DELETE/HEAD */ - if (url_get_method(U) == GET || url_get_method(U) == HEAD) { - if ((http_get(C, U)) == FALSE) { + if (url_get_method(U) == POST) { + if ((http_post(C, U)) == FALSE) { C->connection.reuse = 0; socket_close(C); return FALSE; } } else { - if ((http_post(C, U)) == FALSE) { + if ((http_get(C, U)) == FALSE) { C->connection.reuse = 0; socket_close(C); return FALSE; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/src/cookie.c new/siege-3.1.0/src/cookie.c --- old/siege-3.0.9/src/cookie.c 2015-02-26 21:21:15.000000000 +0100 +++ new/siege-3.1.0/src/cookie.c 2015-06-03 21:01:21.000000000 +0200 @@ -140,54 +140,49 @@ PARSED_COOKIE ck; parse_cookie(cookiestr, &ck); - name = ck.name; + name = ck.name; value = ck.value; if ((name == NULL || value == NULL)) return -1; pthread_mutex_lock(&(cookie->mutex)); for (cur=pre=cookie->first; cur != NULL; pre=cur, cur=cur->next) { - if ((cur->threadID == id )&&(!strcasecmp(cur->name, name))) { + if ((cur->threadID == id ) && (!strcasecmp(cur->name, name))) { xfree(cur->value); cur->value = xstrdup(value); - /** - XXX: I need to read the RFC in order to - understand the required behavior - xfree(cur->name); - xfree(cur->domain); - cur->name = xstrdup(name); - cur->expires = ck.expires; - if(!ck.domain) - cur->domain = xstrdup(host); - else - cur->domain = xstrdup(ck.domain); - */ found = TRUE; break; } } - if (!found) { - fresh = (CNODE*)xmalloc(sizeof(CNODE)); - if (!fresh) NOTIFY(FATAL, "out of memory!"); - fresh->threadID = id; - fresh->name = xstrdup(name); - fresh->value = xstrdup(value); - fresh->expires = ck.expires; - if (!ck.domain) - fresh->domain = xstrdup(host); - else - fresh->domain = xstrdup(ck.domain); - fresh->next = cur; - if (cur==cookie->first) - cookie->first = fresh; - else - pre->next = fresh; - } - if (name != NULL) xfree(name); - if (value != NULL) xfree(value); + if (found) { + BOOLEAN test = delete_cookie(id, name); + if (! test) { + NOTIFY(WARNING, "Unable to update cookie"); + return -1; + } + } + fresh = (CNODE*)xmalloc(sizeof(CNODE)); + fresh->threadID = id; + fresh->name = xstrdup(name); + fresh->value = xstrdup(value); + fresh->expires = ck.expires; + + if (!ck.domain) { + fresh->domain = xstrdup(host); + } else { + fresh->domain = xstrdup(ck.domain); + } + fresh->next = cur; + if (cur==cookie->first) { + cookie->first = fresh; + } else { + pre->next = fresh; + } + xfree(name); + xfree(value); pthread_mutex_unlock(&(cookie->mutex)); - + //display_cookies(); /* XXX: still examing */ return 0; } @@ -334,7 +329,11 @@ printf ("Linked list contains:\n"); for (cur=cookie->first; cur != NULL; cur=cur->next) { - printf ("Index: %ld\tName: %s Value: %s\n", (long)cur->threadID, cur->name, cur->value); + char buf[20]; + struct tm * timeinfo; + timeinfo = localtime (&cur->expires); + strftime(buf, sizeof(buf), "%b %d %H:%M", timeinfo); + printf ("Index: %ld\tName: %s Value: %s, Expires: %s\n", (long)cur->threadID, cur->name, cur->value, buf); } pthread_mutex_unlock(&(cookie->mutex)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/src/crew.c new/siege-3.1.0/src/crew.c --- old/siege-3.0.9/src/crew.c 2015-02-26 21:21:15.000000000 +0100 +++ new/siege-3.1.0/src/crew.c 2015-06-03 21:01:21.000000000 +0200 @@ -70,20 +70,26 @@ this->closed = FALSE; this->shutdown = FALSE; - if((c = pthread_mutex_init(&(this->lock), NULL)) != 0) + if ((c = pthread_mutex_init(&(this->lock), NULL)) != 0) return NULL; - if((c = pthread_cond_init(&(this->not_empty), NULL )) != 0) + if ((c = pthread_cond_init(&(this->not_empty), NULL )) != 0) return NULL; - if((c = pthread_cond_init(&(this->not_full), NULL )) != 0) + if ((c = pthread_cond_init(&(this->not_full), NULL )) != 0) return NULL; - if((c = pthread_cond_init(&(this->empty), NULL)) != 0) + if ((c = pthread_cond_init(&(this->empty), NULL)) != 0) return NULL; - for(x = 0; x != size; x++){ - if((c = pthread_create(&(this->threads[x]), NULL, crew_thread, (void *)this)) != 0) - return NULL; + for (x = 0; x != size; x++) { + if ((c = pthread_create(&(this->threads[x]), NULL, crew_thread, (void *)this)) != 0) { + switch (errno) { + case EINVAL: { NOTIFY(ERROR, "Error creating additional threads %s:%d", __FILE__, __LINE__); break; } + case EPERM: { NOTIFY(ERROR, "Inadequate permission to create pool %s:%d", __FILE__, __LINE__); break; } + case EAGAIN: { NOTIFY(ERROR, "Inadequate resources to create pool %s:%d", __FILE__, __LINE__); break; } + case ENOMEM: { NOTIFY(ERROR, "Exceeded thread limit for this system %s:%d", __FILE__, __LINE__); break; } + default: { NOTIFY(ERROR, "Unknown error building thread pool %s:%d", __FILE__, __LINE__); break; } + } return NULL; + } } - return this; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/src/eval.c new/siege-3.1.0/src/eval.c --- old/siege-3.0.9/src/eval.c 2015-02-26 21:21:15.000000000 +0100 +++ new/siege-3.1.0/src/eval.c 2015-06-03 21:01:21.000000000 +0200 @@ -67,7 +67,7 @@ if (getenv(string) != NULL) { ENV = 1; } else { - string = '\0'; /* user botched his config file */ + string = NULL; /* user botched his config file */ } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/src/init.c new/siege-3.1.0/src/init.c --- old/siege-3.0.9/src/init.c 2015-02-26 21:21:15.000000000 +0100 +++ new/siege-3.1.0/src/init.c 2015-06-03 22:22:52.000000000 +0200 @@ -34,6 +34,7 @@ #include <sys/stat.h> #include <unistd.h> #include <errno.h> +#include <stdlib.h> int init_config( void ) @@ -145,51 +146,50 @@ method = strdup("HEAD"); break; } - - printf( "CURRENT SIEGE CONFIGURATION\n" ); - printf( "%s\n", my.uagent ); - printf( "Edit the resource file to change the settings.\n" ); - printf( "----------------------------------------------\n" ); - printf( "version: %s\n", version_string ); - printf( "verbose: %s\n", my.verbose?"true":"false" ); - printf( "quiet: %s\n", my.quiet?"true":"false" ); - printf( "debug: %s\n", my.debug?"true":"false" ); - printf( "protocol: %s\n", my.protocol?"HTTP/1.1":"HTTP/1.0" ); - printf( "get method: %s\n", method); + printf("CURRENT SIEGE CONFIGURATION\n"); + printf("%s\n", my.uagent); + printf("Edit the resource file to change the settings.\n"); + printf("----------------------------------------------\n"); + printf("version: %s\n", version_string); + printf("verbose: %s\n", my.verbose ? "true" : "false"); + printf("quiet: %s\n", my.quiet ? "true" : "false"); + printf("debug: %s\n", my.debug ? "true" : "false"); + printf("protocol: %s\n", my.protocol ? "HTTP/1.1" : "HTTP/1.0"); + printf("get method: %s\n", method); if (auth_get_proxy_required(my.auth)){ printf("proxy-host: %s\n", auth_get_proxy_host(my.auth)); printf("proxy-port: %d\n", auth_get_proxy_port(my.auth)); } - printf( "connection: %s\n", my.keepalive?"keep-alive":"close" ); - printf( "concurrent users: %d\n", my.cusers ); - if( my.secs > 0 ) - printf( "time to run: %d seconds\n", my.secs ); + printf("connection: %s\n", my.keepalive?"keep-alive":"close"); + printf("concurrent users: %d\n", my.cusers); + if (my.secs > 0) + printf( "time to run: %d seconds\n", my.secs); else - printf( "time to run: n/a\n" ); - if(( my.reps > 0 )&&( my.reps != MAXREPS )) - printf( "repetitions: %d\n", my.reps ); + printf( "time to run: n/a\n"); + if ((my.reps > 0) && (my.reps != MAXREPS)) + printf( "repetitions: %d\n", my.reps); else - printf( "repetitions: n/a\n" ); - printf( "socket timeout: %d\n", my.timeout ); - printf( "accept-encoding: %s\n", my.encoding); - printf( "delay: %d sec%s\n", my.delay,my.delay>1?"s":"" ); - printf( "internet simulation: %s\n", my.internet?"true":"false" ); - printf( "benchmark mode: %s\n", my.bench?"true":"false" ); - printf( "failures until abort: %d\n", my.failures ); - printf( "named URL: %s\n", my.url==NULL||strlen(my.url)<2?"none":my.url ); - printf( "URLs file: %s\n", strlen(my.file)>1?my.file:URL_FILE ); - printf( "logging: %s\n", my.logging?"true":"false" ); - printf( "log file: %s\n", my.logfile==NULL?LOG_FILE:my.logfile ); - printf( "resource file: %s\n", my.rc); - printf( "timestamped output: %s\n", my.timestamp?"true":"false"); - printf( "comma separated output: %s\n", my.csv?"true":"false"); - printf( "allow redirects: %s\n", my.follow?"true":"false" ); - printf( "allow zero byte data: %s\n", my.zero_ok?"true":"false" ); - printf( "allow chunked encoding: %s\n", my.chunked?"true":"false" ); - printf( "upload unique files: %s\n", my.unique?"true":"false" ); - //printf( "proxy auth: " ); display_authorization( PROXY );printf( "\n" ); - //printf( "www auth: " ); display_authorization( WWW ); - printf( "\n" ); + printf("repetitions: n/a\n" ); + printf("socket timeout: %d\n", my.timeout); + printf("accept-encoding: %s\n", my.encoding); + printf("delay: %.3f sec%s\n", my.delay, (my.delay > 1) ? "s" : ""); + printf("internet simulation: %s\n", my.internet?"true":"false"); + printf("benchmark mode: %s\n", my.bench?"true":"false"); + printf("failures until abort: %d\n", my.failures); + printf("named URL: %s\n", my.url==NULL||strlen(my.url) < 2 ? "none" : my.url); + printf("URLs file: %s\n", strlen(my.file) > 1 ? my.file : URL_FILE); + printf("logging: %s\n", my.logging ? "true" : "false"); + printf("log file: %s\n", (my.logfile == NULL) ? LOG_FILE : my.logfile); + printf("resource file: %s\n", my.rc); + printf("timestamped output: %s\n", my.timestamp?"true":"false"); + printf("comma separated output: %s\n", my.csv?"true":"false"); + printf("allow redirects: %s\n", my.follow?"true":"false"); + printf("allow zero byte data: %s\n", my.zero_ok?"true":"false"); + printf("allow chunked encoding: %s\n", my.chunked?"true":"false"); + printf("upload unique files: %s\n", my.unique?"true":"false"); + //printf("proxy auth: " ); display_authorization(PROXY);printf("\n"); + //printf("www auth: " ); display_authorization(WWW); + printf("\n"); xfree(method); if (EXIT) exit(0); else return 0; @@ -342,7 +342,7 @@ } else if (strmatch(option, "delay")) { if (value != NULL) { - my.delay = atoi(value); + my.delay = atof(value); } else { my.delay = 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/src/main.c new/siege-3.1.0/src/main.c --- old/siege-3.0.9/src/main.c 2015-02-26 21:21:15.000000000 +0100 +++ new/siege-3.1.0/src/main.c 2015-06-05 14:18:28.000000000 +0200 @@ -147,7 +147,7 @@ printf(" default is used: PREFIX/var/%s.log\n", program_name); puts(" -m, --mark=\"text\" MARK, mark the log file with a string." ); puts(" -d, --delay=NUM Time DELAY, random delay before each requst"); - puts(" between 1 and NUM. (NOT COUNTED IN STATS)"); + puts(" between .001 and NUM. (NOT COUNTED IN STATS)"); puts(" -H, --header=\"text\" Add a header to request (can be many)" ); puts(" -A, --user-agent=\"text\" Sets User-Agent in request" ); puts(" -T, --content-type=\"text\" Sets Content-Type in request" ); @@ -216,7 +216,7 @@ break; case 'd': /* XXX range checking? use strtol? */ - my.delay = atoi(optarg); + my.delay = atof(optarg); if(my.delay < 0){ my.delay = 0; } @@ -321,11 +321,11 @@ memset(&my, 0, sizeof(struct CONFIG)); parse_rc_cmdline(argc, argv); - if (init_config() < 0) { /* defined in init.h */ - exit( EXIT_FAILURE ); /* polly was a girl... */ + if (init_config() < 0) { + exit(EXIT_FAILURE); } - parse_cmdline(argc, argv); /* defined above */ - ds_module_check(); /* check config integ */ + parse_cmdline(argc, argv); + ds_module_check(); /** * XXX: we should consider moving the following diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/src/setup.h new/siege-3.1.0/src/setup.h --- old/siege-3.0.9/src/setup.h 2015-02-26 21:21:15.000000000 +0100 +++ new/siege-3.1.0/src/setup.h 2015-06-03 21:07:21.000000000 +0200 @@ -162,7 +162,7 @@ BOOLEAN display; /* boolean, display the thread id verbose */ BOOLEAN config; /* boolean, prints the configuration */ int cusers; /* default concurrent users value. */ - int delay; /* range for random time delay, see -d */ + float delay; /* range for random time delay, see -d */ int timeout; /* socket connection timeout value, def:10 */ BOOLEAN bench; /* signifies a benchmarking run, no delay */ BOOLEAN internet; /* use random URL selection if TRUE */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/src/sock.c new/siege-3.1.0/src/sock.c --- old/siege-3.0.9/src/sock.c 2015-02-26 21:26:55.000000000 +0100 +++ new/siege-3.1.0/src/sock.c 2015-06-03 21:01:21.000000000 +0200 @@ -33,6 +33,10 @@ #include <pthread.h> #include <fcntl.h> +#ifdef HAVE_POLL +# include <poll.h> +#endif/*HAVE_POLL*/ + #ifdef HAVE_UNISTD_H # include <unistd.h> #endif/*HAVE_UNISTD_H*/ @@ -63,6 +67,10 @@ private int __socket_block(int socket, BOOLEAN block); private ssize_t __socket_write(int sock, const void *vbuf, size_t len); private BOOLEAN __socket_check(CONN *C, SDSET mode); +private BOOLEAN __socket_select(CONN *C, SDSET mode); +#ifdef HAVE_POLL +private BOOLEAN __socket_poll(CONN *C, SDSET mode); +#endif/*HAVE_POLL*/ #ifdef HAVE_SSL private ssize_t __ssl_socket_write(CONN *C, const void *vbuf, size_t len); #endif/*HAVE_SSL*/ @@ -95,6 +103,11 @@ int rc; #endif/*_AIX*/ + if (hostparam == NULL) { + NOTIFY(ERROR, "Unable to resolve host %s:%d", __FILE__, __LINE__); + return -1; + } + C->encrypt = (C->scheme == HTTPS) ? TRUE: FALSE; C->state = UNDEF; C->ftp.pasv = TRUE; @@ -149,16 +162,32 @@ rc = gethostbyname_r(hn, (struct hostent *)aixbuf, (struct hostent_data *)(aixbuf + sizeof(struct hostent))); hp = (struct hostent*)aixbuf; -#elif ( defined(hpux) || defined(__hpux) || defined(__osf__) ) +#elif (defined(hpux) || defined(__hpux) || defined(__osf__)) hp = gethostbyname(hn); herrno = h_errno; #else - /* simply hoping that gethostbyname is thread-safe */ + /** + * Let's just hope gethostbyname is tread-safe + */ hp = gethostbyname(hn); herrno = h_errno; #endif/*OS SPECIFICS*/ - if(hp == NULL){ return -1; } + /** + * If hp is NULL, then we did not get good information + * from the name server. Let's notify the user and bail + */ + if (hp == NULL) { + switch(herrno) { + case HOST_NOT_FOUND: { NOTIFY(ERROR, "Host not found: %s\n", hostparam); break; } + case NO_ADDRESS: { NOTIFY(ERROR, "HOst does not have an IP address: %s\n", hostparam); break; } + case NO_RECOVERY: { NOTIFY(ERROR, "A non-recoverable resolution error for %s\n", hostparam); break; } + case TRY_AGAIN: { NOTIFY(ERROR, "A temporary resolution error for %s\n", hostparam); break; } + default: { NOTIFY(ERROR, "Unknown error code from gethostbyname for %s\n", hostparam); break; } + } + return -1; + } + memset((void*) &cli, 0, sizeof(cli)); memcpy(&cli.sin_addr, hp->h_addr, hp->h_length); #if defined(sun) @@ -205,20 +234,9 @@ default: {NOTIFY(ERROR, "socket: %d unknown network error.", pthread_self()); break;} } socket_close(C); return -1; } else { - struct timeval timeout; - fd_set rs; - fd_set ws; - FD_ZERO(&rs); - FD_ZERO(&ws); - FD_SET(C->sock, &rs); - FD_SET(C->sock, &ws); - memset((void *)&timeout, '\0', sizeof(struct timeval)); - timeout.tv_sec = (my.timeout > 0)?my.timeout:30; - timeout.tv_usec = 0; - res = select(C->sock+1, &rs, &ws, NULL, &timeout); - if ((res == -1) && (errno == EINTR)) { + if (__socket_check(C, READ) == FALSE) { pthread_testcancel(); - fprintf(stderr, "socket: connection timed out\n"); + NOTIFY(WARNING, "socket: read check timed out(%d) %s:%d", my.timeout, __FILE__, __LINE__); socket_close(C); return -1; } else { @@ -244,61 +262,97 @@ return(C->sock); } +/** + * Conditionally determines whether or not a socket is ready. + * This function calls __socket_poll if HAVE_POLL is defined in + * config.h, else it uses __socket_select + */ private BOOLEAN __socket_check(CONN *C, SDSET mode) { - int res; - fd_set fds; - fd_set *rs = NULL; - fd_set *ws = NULL; - double timo; - struct timeval timeout; +#ifdef HAVE_POLL + if (C->sock >= FD_SETSIZE) { + return __socket_poll(C, mode); + } else { + return __socket_select(C, mode); + } +#else + return __socket_select(C, mode); +#endif/*HAVE_POLL*/ +} - if (C->state == mode) { - return TRUE; - } +#ifdef HAVE_POLL +private BOOLEAN +__socket_poll(CONN *C, SDSET mode) +{ + int res; + int timo = (my.timeout) ? my.timeout * 1000 : 15000; + __socket_block(C->sock, FALSE); + + C->pfd[0].fd = C->sock + 1; + C->pfd[0].events |= POLLIN; + + do { + res = poll(C->pfd, 1, timo); + pthread_testcancel(); + if (res < 0) puts("LESS THAN ZERO!"); + } while (res < 0); // && errno == EINTR); - FD_ZERO(&fds); - FD_SET (C->sock, &fds); - if (mode==WRITE) { - *(&ws) = &fds; + if (res == 0) { + errno = ETIMEDOUT; + } + + if (res <= 0) { + C->state = UNDEF; + NOTIFY(WARNING, + "socket: polled(%d) and discovered it's not ready %s:%d", + (my.timeout)?my.timeout:15, __FILE__, __LINE__ + ); + return FALSE; } else { - *(&rs) = &fds; + C->state = mode; + return TRUE; } +} +#endif/*HAVE_POLL*/ - timo = (my.timeout)?my.timeout:15; - timeout.tv_sec = (long)timo; - timeout.tv_usec = 1000000L * (timo - (long)timo); +private BOOLEAN +__socket_select(CONN *C, SDSET mode) +{ + struct timeval timeout; + int res; + fd_set rs; + fd_set ws; + memset((void *)&timeout, '\0', sizeof(struct timeval)); + timeout.tv_sec = (my.timeout > 0)?my.timeout:30; + timeout.tv_usec = 0; - if (mode==WRITE) { - __socket_block(C->sock, FALSE); + if ((C->sock < 0) || (C->sock >= FD_SETSIZE)) { + // FD_SET can't handle it + return FALSE; } do { - res = select(C->sock + 1, rs, ws, NULL, &timeout); + FD_ZERO(&rs); + FD_ZERO(&ws); + FD_SET(C->sock, &rs); + FD_SET(C->sock, &ws); + res = select(C->sock+1, &rs, &ws, NULL, &timeout); pthread_testcancel(); } while (res < 0 && errno == EINTR); - - if (mode==WRITE) { - __socket_block(C->sock, TRUE); - } if (res == 0) { errno = ETIMEDOUT; } - if (res < 1) { - NOTIFY(WARNING, "socket: %d select timed out", pthread_self()); - } - if (res <= 0) { C->state = UNDEF; + NOTIFY(WARNING, "socket: select and discovered it's not ready %s:%d", __FILE__, __LINE__); return FALSE; } else { C->state = mode; return TRUE; } - //return (res <= 0) ? FALSE : TRUE; } /** @@ -440,6 +494,7 @@ #ifdef HAVE_SSL while (n > 0) { if (__socket_check(C, READ) == FALSE) { + NOTIFY(WARNING, "socket: read check timed out(%d) %s:%d", (my.timeout)?my.timeout:15, __FILE__, __LINE__); return -1; } if ((r = SSL_read(C->ssl, buf, n)) < 0) { @@ -457,6 +512,7 @@ while (n > 0) { if (C->inbuffer < len) { if (__socket_check(C, READ) == FALSE) { + NOTIFY(WARNING, "socket: read check timed out(%d) %s:%d", (my.timeout)?my.timeout:15, __FILE__, __LINE__); return -1; } } @@ -465,6 +521,7 @@ memmove(C->buffer,&C->buffer[C->pos_ini],C->inbuffer); C->pos_ini = 0; if (__socket_check(C, READ) == FALSE) { + NOTIFY(WARNING, "socket: read check timed out(%d) %s:%d", (my.timeout)?my.timeout:15, __FILE__, __LINE__); return -1; } lidos = read(C->sock, &C->buffer[C->inbuffer], sizeof(C->buffer)-C->inbuffer); @@ -550,11 +607,7 @@ size_t bytes; pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &type); -#if 0 - if(__socket_check(C, READ) == WRITE){ - return -1; - } -#endif + if (C->encrypt == TRUE) { /* handle HTTPS protocol */ #ifdef HAVE_SSL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/src/sock.h new/siege-3.1.0/src/sock.h --- old/siege-3.0.9/src/sock.h 2015-02-26 21:21:15.000000000 +0100 +++ new/siege-3.1.0/src/sock.h 2015-06-03 21:01:21.000000000 +0200 @@ -38,6 +38,10 @@ # include <netdb.h> #endif/*HAVE_NETDB_H*/ +#ifdef HAVE_POLL +# include <poll.h> +#endif/*HAVE_POLL*/ + #ifdef HAVE_SSL # include <openssl/ssl.h> # include <openssl/err.h> @@ -120,6 +124,9 @@ int pos_ini; char buffer[4096]; char chkbuf[1024]; +#ifdef HAVE_POLL + struct pollfd pfd[1]; +#endif/*HAVE_POLL*/ fd_set *ws; fd_set *rs; SDSET state; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/src/url.c new/siege-3.1.0/src/url.c --- old/siege-3.0.9/src/url.c 2015-02-26 21:21:48.000000000 +0100 +++ new/siege-3.1.0/src/url.c 2015-06-03 21:01:21.000000000 +0200 @@ -142,7 +142,7 @@ xfree(this->hostname); len = strlen(hostname)+1; this->hostname = xmalloc(len); - memset(this->hostname, 0, sizeof this->hostname); + memset(this->hostname, '\0', len); strncpy(this->hostname, hostname, len); return; } @@ -163,7 +163,7 @@ len = strlen(etag)+1; this->etag = xmalloc(len); - memset(this->etag, 0, sizeof this->etag); + memset(this->etag, '\0', len); strncpy(this->etag, etag, len); return; } @@ -323,6 +323,14 @@ public char * url_get_conttype(URL this) { + + if (this->conttype == NULL) { + if (! empty(my.conttype)) { + this->conttype = xstrdup(my.conttype); + } else { + this->conttype = xstrdup("application/x-www-form-urlencoded"); + } + } return this->conttype; } @@ -369,7 +377,7 @@ len = strlen(this->etag) + 18; tag = xmalloc(len); - memset(tag, 0, sizeof tag); + memset(tag, '\0', len); snprintf(tag, len, "If-None-Match: %s\015\012", this->etag); return tag; @@ -427,7 +435,7 @@ printf("Params: %s\n", url_get_parameters(this)); printf("Query: %s\n", url_get_query(this)); printf("Fragment: %s\n", url_get_fragment(this)); - printf("Post Len: %d\n", url_get_postlen(this)); + printf("Post Len: %d\n", (int)url_get_postlen(this)); printf("Post Data: %s\n", url_get_postdata(this)); printf("Cont Type: %s\n", url_get_conttype(this)); //time_t expires; @@ -591,7 +599,7 @@ len = strlen(url)+5; if (!__url_has_scheme(url)) { this->url = xmalloc(len+7); - memset(this->url, '\0', sizeof this->url); + memset(this->url, '\0', len+7); slash = strstr(url, "/"); if (slash) { snprintf(this->url, len+7, "http://%s", url); @@ -600,7 +608,7 @@ } } else { this->url = xmalloc(len); - memset(this->url, '\0', sizeof this->url); + memset(this->url, '\0', len); snprintf(this->url, len, "%s", url); } return this->url; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/siege-3.0.9/src/version.c new/siege-3.1.0/src/version.c --- old/siege-3.0.9/src/version.c 2015-02-26 21:22:24.000000000 +0100 +++ new/siege-3.1.0/src/version.c 2015-06-03 21:12:24.000000000 +0200 @@ -4,7 +4,7 @@ * used by configure to dynamically assign those values * to documentation files. */ -const char *version_string = "3.0.9"; +const char *version_string = "3.1.0"; const char *program_name = "siege"; const char *author_name = "Jeffrey Fulmer, et al."; const char *email_address = "j...@joedog.org";