A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/cloudflare/cfssl/commit/941a1cde099d8ad7655d4239eb2e283c58591241 below:

replace uses of deprecated io/ioutil · cloudflare/cfssl@941a1cd · GitHub

File tree Expand file treeCollapse file tree 20 files changed

+78

-75

lines changed

Filter options

Expand file treeCollapse file tree 20 files changed

+78

-75

lines changed Original file line number Diff line number Diff line change

@@ -3,7 +3,7 @@ package api

3 3 4 4

import (

5 5

"encoding/json"

6 -

"io/ioutil"

6 +

"io"

7 7

"net/http"

8 8 9 9

"github.com/cloudflare/cfssl/errors"

@@ -92,7 +92,7 @@ func (h HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {

92 92

func readRequestBlob(r *http.Request) (map[string]string, error) {

93 93

var blob map[string]string

94 94 95 -

body, err := ioutil.ReadAll(r.Body)

95 +

body, err := io.ReadAll(r.Body)

96 96

if err != nil {

97 97

return nil, err

98 98

}

Original file line number Diff line number Diff line change

@@ -3,7 +3,7 @@ package api

3 3

import (

4 4

"bytes"

5 5

"encoding/json"

6 -

"io/ioutil"

6 +

"io"

7 7

"net/http"

8 8

"net/http/httptest"

9 9

"testing"

@@ -52,7 +52,7 @@ func post(t *testing.T, obj map[string]interface{}, ts *httptest.Server) (resp *

52 52

if err != nil {

53 53

t.Fatal(err)

54 54

}

55 -

body, err = ioutil.ReadAll(resp.Body)

55 +

body, err = io.ReadAll(resp.Body)

56 56

if err != nil {

57 57

t.Fatal(err)

58 58

}

@@ -65,7 +65,7 @@ func get(t *testing.T, ts *httptest.Server) (resp *http.Response, body []byte) {

65 65

t.Fatal(err)

66 66

}

67 67 68 -

body, err = ioutil.ReadAll(resp.Body)

68 +

body, err = io.ReadAll(resp.Body)

69 69

if err != nil {

70 70

t.Fatal(err)

71 71

}

Original file line number Diff line number Diff line change

@@ -3,9 +3,10 @@ package bundle

3 3

import (

4 4

"bytes"

5 5

"encoding/json"

6 -

"io/ioutil"

6 +

"io"

7 7

"net/http"

8 8

"net/http/httptest"

9 +

"os"

9 10

"testing"

10 11 11 12

"github.com/cloudflare/cfssl/api"

@@ -39,14 +40,14 @@ func testBundleFile(t *testing.T, domain, ip, certFile, keyFile, flavor string)

39 40

var certPEM, keyPEM []byte

40 41

if certFile != "" {

41 42

var err error

42 -

certPEM, err = ioutil.ReadFile(certFile)

43 +

certPEM, err = os.ReadFile(certFile)

43 44

if err != nil {

44 45

t.Fatal(err)

45 46

}

46 47

}

47 48

if keyFile != "" {

48 49

var err error

49 -

keyPEM, err = ioutil.ReadFile(keyFile)

50 +

keyPEM, err = os.ReadFile(keyFile)

50 51

if err != nil {

51 52

t.Fatal(err)

52 53

}

@@ -75,7 +76,7 @@ func testBundleFile(t *testing.T, domain, ip, certFile, keyFile, flavor string)

75 76

if err != nil {

76 77

t.Fatal(err)

77 78

}

78 -

body, err = ioutil.ReadAll(resp.Body)

79 +

body, err = io.ReadAll(resp.Body)

79 80

if err != nil {

80 81

t.Fatal(err)

81 82

}

Original file line number Diff line number Diff line change

@@ -3,9 +3,10 @@ package certadd

3 3

import (

4 4

"bytes"

5 5

"database/sql"

6 +

"encoding/base64"

6 7

"encoding/hex"

7 8

"encoding/json"

8 -

"io/ioutil"

9 +

"io"

9 10

"math/big"

10 11

"net/http"

11 12

"time"

@@ -17,8 +18,6 @@ import (

17 18

"github.com/cloudflare/cfssl/ocsp"

18 19

"github.com/jmoiron/sqlx/types"

19 20 20 -

"encoding/base64"

21 - 22 21

stdocsp "golang.org/x/crypto/ocsp"

23 22

)

24 23

@@ -81,7 +80,7 @@ var validReasons = map[int]bool{

81 80 82 81

// Handle handles HTTP requests to add certificates

83 82

func (h *Handler) Handle(w http.ResponseWriter, r *http.Request) error {

84 -

body, err := ioutil.ReadAll(r.Body)

83 +

body, err := io.ReadAll(r.Body)

85 84

if err != nil {

86 85

return err

87 86

}

Original file line number Diff line number Diff line change

@@ -6,10 +6,11 @@ import (

6 6

"crypto/rsa"

7 7

"crypto/x509"

8 8

"crypto/x509/pkix"

9 +

"encoding/base64"

9 10

"encoding/hex"

10 11

"encoding/json"

11 12

"encoding/pem"

12 -

"io/ioutil"

13 +

"io"

13 14

"math/big"

14 15

"net/http"

15 16

"net/http/httptest"

@@ -21,8 +22,6 @@ import (

21 22

"github.com/cloudflare/cfssl/certdb/testdb"

22 23

"github.com/cloudflare/cfssl/ocsp"

23 24 24 -

"encoding/base64"

25 - 26 25

stdocsp "golang.org/x/crypto/ocsp"

27 26

)

28 27

@@ -47,7 +46,7 @@ func makeRequest(t *testing.T, dbAccessor certdb.Accessor, signer ocsp.Signer, r

47 46

t.Fatal(err)

48 47

}

49 48 50 -

body, err = ioutil.ReadAll(resp.Body)

49 +

body, err = io.ReadAll(resp.Body)

51 50

if err != nil {

52 51

t.Fatal(err)

53 52

}

Original file line number Diff line number Diff line change

@@ -7,7 +7,7 @@ import (

7 7

"encoding/json"

8 8

stderr "errors"

9 9

"fmt"

10 -

"io/ioutil"

10 +

"io"

11 11

"net"

12 12

"net/http"

13 13

"net/url"

@@ -158,7 +158,7 @@ func (srv *server) post(url string, jsonData []byte) (*api.Response, error) {

158 158

}

159 159

defer req.Body.Close()

160 160

defer resp.Body.Close()

161 -

body, err := ioutil.ReadAll(resp.Body)

161 +

body, err := io.ReadAll(resp.Body)

162 162

if err != nil {

163 163

return nil, errors.Wrap(errors.APIClientError, errors.IOError, err)

164 164

}

Original file line number Diff line number Diff line change

@@ -4,7 +4,7 @@ import (

4 4

"crypto/x509"

5 5

"encoding/base64"

6 6

"encoding/json"

7 -

"io/ioutil"

7 +

"io"

8 8

"net/http"

9 9

"net/http/httptest"

10 10

"testing"

@@ -61,7 +61,7 @@ func testGetCRL(t *testing.T, dbAccessor certdb.Accessor, expiry string) (resp *

61 61

if err != nil {

62 62

t.Fatal(err)

63 63

}

64 -

body, err = ioutil.ReadAll(resp.Body)

64 +

body, err = io.ReadAll(resp.Body)

65 65

if err != nil {

66 66

t.Fatal(err)

67 67

}

Original file line number Diff line number Diff line change

@@ -5,16 +5,17 @@ import (

5 5

"crypto/rand"

6 6

"crypto/x509/pkix"

7 7

"encoding/json"

8 -

"github.com/cloudflare/cfssl/api"

9 -

"github.com/cloudflare/cfssl/errors"

10 -

"github.com/cloudflare/cfssl/helpers"

11 -

"github.com/cloudflare/cfssl/log"

12 -

"io/ioutil"

8 +

"io"

13 9

"math/big"

14 10

"net/http"

15 11

"strconv"

16 12

"strings"

17 13

"time"

14 + 15 +

"github.com/cloudflare/cfssl/api"

16 +

"github.com/cloudflare/cfssl/errors"

17 +

"github.com/cloudflare/cfssl/helpers"

18 +

"github.com/cloudflare/cfssl/log"

18 19

)

19 20 20 21

// This type is meant to be unmarshalled from JSON

@@ -32,7 +33,7 @@ func gencrlHandler(w http.ResponseWriter, r *http.Request) error {

32 33

var oneWeek = time.Duration(604800) * time.Second

33 34

var newExpiryTime = time.Now()

34 35 35 -

body, err := ioutil.ReadAll(r.Body)

36 +

body, err := io.ReadAll(r.Body)

36 37

if err != nil {

37 38

return err

38 39

}

Original file line number Diff line number Diff line change

@@ -3,11 +3,13 @@ package gencrl

3 3

import (

4 4

"bytes"

5 5

"encoding/json"

6 -

"github.com/cloudflare/cfssl/api"

7 -

"io/ioutil"

6 +

"io"

8 7

"net/http"

9 8

"net/http/httptest"

9 +

"os"

10 10

"testing"

11 + 12 +

"github.com/cloudflare/cfssl/api"

11 13

)

12 14 13 15

const (

@@ -55,7 +57,7 @@ func testCRLCreation(t *testing.T, issuingKey, certFile string, expiry string, s

55 57

obj := map[string]interface{}{}

56 58 57 59

if certFile != "" {

58 -

c, err := ioutil.ReadFile(certFile)

60 +

c, err := os.ReadFile(certFile)

59 61

if err != nil {

60 62

t.Fatal(err)

61 63

}

@@ -65,7 +67,7 @@ func testCRLCreation(t *testing.T, issuingKey, certFile string, expiry string, s

65 67

obj["serialNumber"] = serialList

66 68 67 69

if issuingKey != "" {

68 -

c, err := ioutil.ReadFile(issuingKey)

70 +

c, err := os.ReadFile(issuingKey)

69 71

if err != nil {

70 72

t.Fatal(err)

71 73

}

@@ -83,7 +85,7 @@ func testCRLCreation(t *testing.T, issuingKey, certFile string, expiry string, s

83 85

if err != nil {

84 86

t.Fatal(err)

85 87

}

86 -

body, err = ioutil.ReadAll(resp.Body)

88 +

body, err = io.ReadAll(resp.Body)

87 89

if err != nil {

88 90

t.Fatal(err)

89 91

}

@@ -103,5 +105,4 @@ func TestCRL(t *testing.T) {

103 105

t.Logf("failed to read response body: %v", err)

104 106

t.Fatal(resp.Status, tester.ExpectedHTTPStatus, message)

105 107

}

106 - 107 108

}

Original file line number Diff line number Diff line change

@@ -8,7 +8,7 @@ import (

8 8

"encoding/json"

9 9

"encoding/pem"

10 10

"fmt"

11 -

"io/ioutil"

11 +

"io"

12 12

"net/http"

13 13 14 14

"github.com/cloudflare/cfssl/api"

@@ -107,7 +107,7 @@ func computeSum(in []byte) (sum Sum, err error) {

107 107

// these requests is documented in the API documentation.

108 108

func (g *Handler) Handle(w http.ResponseWriter, r *http.Request) error {

109 109

log.Info("request for CSR")

110 -

body, err := ioutil.ReadAll(r.Body)

110 +

body, err := io.ReadAll(r.Body)

111 111

if err != nil {

112 112

log.Warningf("failed to read request body: %v", err)

113 113

return errors.NewBadRequest(err)

@@ -228,7 +228,7 @@ func (cg *CertGeneratorHandler) Handle(w http.ResponseWriter, r *http.Request) e

228 228

req := new(genSignRequest)

229 229

req.Request = csr.New()

230 230 231 -

body, err := ioutil.ReadAll(r.Body)

231 +

body, err := io.ReadAll(r.Body)

232 232

if err != nil {

233 233

log.Warningf("failed to read request body: %v", err)

234 234

return errors.NewBadRequest(err)

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4