-
Notifications
You must be signed in to change notification settings - Fork 0
/
not_complete.go
71 lines (65 loc) · 1.53 KB
/
not_complete.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package main
import (
"fmt"
"net"
)
//const _url = "www.example.com"
//const _host = "example.com"
func main2() {
go slow3()
select {}
}
func slow3_() {
conn, err := net.Dial("tcp", _url+":443")
if err != nil {
fmt.Println(err)
newErr := fmt.Errorf("Error Slow3: %v", err)
fmt.Println(newErr)
return
}
defer conn.Close()
_, err = fmt.Fprintf(conn, "GET / HTTP/1.1\r\nHost: "+_host+"\r\n")
if err != nil {
fmt.Println(err)
newErr := fmt.Errorf("Error Slow3: %v", err)
fmt.Println(newErr)
return
}
_, err = fmt.Fprintf(conn, "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0\r\n")
if err != nil {
fmt.Println(err)
newErr := fmt.Errorf("Error Slow3: %v", err)
fmt.Println(newErr)
return
}
_, err = fmt.Fprintf(conn, "Content-Type: text/plain\r\n")
if err != nil {
fmt.Println(err)
newErr := fmt.Errorf("Error Slow3: %v", err)
fmt.Println(newErr)
return
}
_, err = fmt.Fprintf(conn, "Connection: keep-alive\r\n")
if err != nil {
fmt.Println(err)
newErr := fmt.Errorf("Error Slow3: %v", err)
fmt.Println(newErr)
return
}
_, err = fmt.Fprintf(conn, "Accept-Encoding: gzip, deflate\r\n")
if err != nil {
fmt.Println(err)
newErr := fmt.Errorf("Error Slow3: %v", err)
fmt.Println(newErr)
return
}
_, err = fmt.Fprintf(conn, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n")
if err != nil {
fmt.Println(err)
newErr := fmt.Errorf("Error Slow3: %v", err)
fmt.Println(newErr)
return
}
// Send partial request
//_, err = fmt.
}