Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for minor bug with the -n parameter #37

Closed
wants to merge 3 commits into from

2 participants

@cjbehm

In testing that fix I kept getting a confusing error about NoneType and it turns out that when you pass -n 1 to ab, it doesn't return data in the format that bees expects. To work around that I included a requirement that -n is at least 2.

cjbehm added some commits
@cjbehm cjbehm ENHANCE TRAILING SLASH REGEX
Replace the regular expression that checks for "bare" domains
with one that can detect bare domain URLs but allow regular URLs
that ab can use (e.g. flag http://somedomain.com and allow
http://somedomain.com/somefile.html).
f5de324
@cjbehm cjbehm WORKAROUND ISSUE WITH AB RESULTS
If a user provides -n 1 for the attack, ab does not return the
expected result set and bees crashes with a confusing error. To
avoid this entirely, add a check for the attack command that
requires at least -n 2 (two requests)
6599364
@cosmin
Collaborator

Going to address the trailing slash issue as part of #30

@cosmin
Collaborator

The -n argument to bees actually needs to be at least 2 * number of instances, but we don't have access to the number of instances when validating arguments.

@cosmin
Collaborator

Fixed in 3c98561

@cosmin cosmin closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 24, 2012
  1. @cjbehm

    ENHANCE TRAILING SLASH REGEX

    cjbehm authored
    Replace the regular expression that checks for "bare" domains
    with one that can detect bare domain URLs but allow regular URLs
    that ab can use (e.g. flag http://somedomain.com and allow
    http://somedomain.com/somefile.html).
  2. @cjbehm

    WORKAROUND ISSUE WITH AB RESULTS

    cjbehm authored
    If a user provides -n 1 for the attack, ab does not return the
    expected result set and bees crashes with a confusing error. To
    avoid this entirely, add a check for the attack command that
    requires at least -n 2 (two requests)
Commits on Jan 3, 2013
  1. @cjbehm
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +4 −1 beeswithmachineguns/main.py
View
5 beeswithmachineguns/main.py
@@ -29,7 +29,7 @@
import sys
from optparse import OptionParser, OptionGroup
-NO_TRAILING_SLASH_REGEX = re.compile(r'^.*?\.\w+$')
+NO_TRAILING_SLASH_REGEX = re.compile(r'^https?://(\w+\.?)+$')
def parse_options():
"""
@@ -110,6 +110,9 @@ def parse_options():
bees.up(options.servers, options.group, options.zone, options.instance, options.login, options.key)
elif command == 'attack':
+ if options.number < 2:
+ parser.error('To avoid a problem with how ab returns data for -n 1, you must make at least two requests')
+
if not options.url:
parser.error('To run an attack you need to specify a url with -u')
Something went wrong with that request. Please try again.