Skip to content

Commit

Permalink
Revert "Adds experimental nopath option"
Browse files Browse the repository at this point in the history
This reverts commit 275c5ed.
  • Loading branch information
tomnomnom committed Mar 30, 2018
1 parent 3cbfe83 commit 784188d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
7 changes: 0 additions & 7 deletions args.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type config struct {
delay int
headers headerArgs
followLocation bool
noPath bool
method string
saveStatus int
timeout int
Expand Down Expand Up @@ -58,10 +57,6 @@ func processArgs() config {
flag.BoolVar(&followLocation, "location", false, "")
flag.BoolVar(&followLocation, "L", false, "")

// no path part
noPath := false
flag.BoolVar(&noPath, "nopath", false, "")

// method param
method := "GET"
flag.StringVar(&method, "method", "GET", "")
Expand Down Expand Up @@ -118,7 +113,6 @@ func processArgs() config {
delay: delay,
headers: headers,
followLocation: followLocation,
noPath: noPath,
method: method,
saveStatus: saveStatus,
timeout: timeout,
Expand All @@ -142,7 +136,6 @@ func init() {
h += " -d, --delay <millis> Milliseconds between requests to the same host (defaut: 5000)\n"
h += " -H, --header <header> Send a custom HTTP header\n"
h += " -L, --location Follow redirects / location header\n"
h += " --nopath Treat the hosts file as complete URLs\n"
h += " -r, --rawhttp Use the rawhttp library for requests (experimental)\n"
h += " -s, --savestatus <status> Save only responses with specific status code\n"
h += " -t, --timeout <millis> Set the HTTP timeout (default: 10000)\n"
Expand Down
16 changes: 5 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,11 @@ func main() {
// get the config struct
c := processArgs()

// read the paths file; unless the nopath option is set
var paths []string
var err error
if c.noPath {
paths = []string{""}
} else {
paths, err = readLinesOrLiteral(c.paths, defaultPathsFile)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to open paths file: %s\n", err)
os.Exit(1)
}
// read the paths file
paths, err := readLinesOrLiteral(c.paths, defaultPathsFile)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to open paths file: %s\n", err)
os.Exit(1)
}

// read the hosts file
Expand Down

0 comments on commit 784188d

Please sign in to comment.