Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rdap for openSUSE:Factory checked in at 2026-07-18 22:24:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rdap (Old) and /work/SRC/openSUSE:Factory/.rdap.new.24530 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rdap" Sat Jul 18 22:24:21 2026 rev:2 rq:1366453 version:0.10.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rdap/rdap.changes 2025-03-17 22:22:46.211457351 +0100 +++ /work/SRC/openSUSE:Factory/.rdap.new.24530/rdap.changes 2026-07-18 22:25:22.874872545 +0200 @@ -1,0 +2,15 @@ +Fri Jul 17 13:38:11 UTC 2026 - Martin Hauke <[email protected]> + +- Update to version 0.10.1 + * Derive CLI version from build info. +- Update to version 0.10 + * Create rdap.1 + * Change the registry accessor functions in bootstrap/client to + call c.freshenFromCache with the corresponding RegistryType. + * Implement AS search requests. + * Use XDG_CACHE_HOME for the bootstrap cache directory. + * Modernize, optimize, and document the RDAP library. + * Rename 'Registrar WHOIS Server' to 'WHOIS Server'. +- Install manpage. + +------------------------------------------------------------------- Old: ---- rdap-0.9.1.tar.gz New: ---- rdap-0.10.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rdap.spec ++++++ --- /var/tmp/diff_new_pack.VoqC3C/_old 2026-07-18 22:25:24.630931452 +0200 +++ /var/tmp/diff_new_pack.VoqC3C/_new 2026-07-18 22:25:24.642931858 +0200 @@ -1,7 +1,7 @@ # -# spec file for package yq +# spec file for package rdap # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2026 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,16 +18,15 @@ %global provider_prefix github.com/openrdap/rdap %global import_path %{provider_prefix} - Name: rdap -Version: 0.9.1 +Version: 0.10.1 Release: 0 Summary: RDAP command line client License: MIT URL: https://github.com/openrdap/rdap Source0: https://github.com/openrdap/rdap/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Source1: vendor.tar.gz -BuildRequires: golang(API) >= 1.23 +BuildRequires: golang(API) >= 1.25 %description OpenRDAP is an command line Registration Data Access Protocol (RDAP) client implementation in Go. @@ -46,9 +45,11 @@ %install install -D -m 0755 %{name} "%{buildroot}/%{_bindir}/%{name}" +install -D -m 0644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1 %files -%{_bindir}/%{name} %license LICENSE %doc README.md +%{_bindir}/%{name} +%{_mandir}/man1/%{name}.1%{?ext_man} ++++++ rdap-0.9.1.tar.gz -> rdap-0.10.1.tar.gz ++++++ ++++ 6573 lines of diff (skipped) ++++++ vendor.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/alecthomas/kingpin/v2/app.go new/vendor/github.com/alecthomas/kingpin/v2/app.go --- old/vendor/github.com/alecthomas/kingpin/v2/app.go 2025-03-17 13:14:51.000000000 +0100 +++ new/vendor/github.com/alecthomas/kingpin/v2/app.go 2026-07-16 23:42:12.000000000 +0200 @@ -413,6 +413,10 @@ if flag.name == "help" { return nil } + + if flag.name == "version" { + return nil + } flagElements[flag.name] = element } } @@ -460,14 +464,18 @@ } // Check required flags and set defaults. + var missingFlags []string for _, flag := range context.flags.long { if flagElements[flag.name] == nil { // Check required flags were provided. if flag.needsValue() { - return fmt.Errorf("required flag --%s not provided", flag.name) + missingFlags = append(missingFlags, fmt.Sprintf("'--%s'", flag.name)) } } } + if len(missingFlags) != 0 { + return fmt.Errorf("required flag(s) %s not provided", strings.Join(missingFlags, ", ")) + } for _, arg := range context.arguments.args { if argElements[arg.name] == nil { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/alecthomas/kingpin/v2/templates.go new/vendor/github.com/alecthomas/kingpin/v2/templates.go --- old/vendor/github.com/alecthomas/kingpin/v2/templates.go 2025-03-17 13:14:51.000000000 +0100 +++ new/vendor/github.com/alecthomas/kingpin/v2/templates.go 2026-07-16 23:42:12.000000000 +0200 @@ -248,7 +248,7 @@ var ZshCompletionTemplate = `#compdef {{.App.Name}} _{{.App.Name}}() { - local matches=($(${words[1]} --completion-bash "${(@)words[1,$CURRENT]}")) + local matches=($(${words[1]} --completion-bash "${(@)words[2,$CURRENT]}")) compadd -a matches if [[ $compstate[nmatches] -eq 0 && $words[$CURRENT] != -* ]]; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/alecthomas/units/renovate.json5 new/vendor/github.com/alecthomas/units/renovate.json5 --- old/vendor/github.com/alecthomas/units/renovate.json5 1970-01-01 01:00:00.000000000 +0100 +++ new/vendor/github.com/alecthomas/units/renovate.json5 2026-07-16 23:42:12.000000000 +0200 @@ -0,0 +1,15 @@ +{ + $schema: "https://docs.renovatebot.com/renovate-schema.json", + extends: [ + "config:recommended", + ":semanticCommits", + ":semanticCommitTypeAll(chore)", + ":semanticCommitScope(deps)", + "group:allNonMajor", + "schedule:earlyMondays", // Run once a week. + ], + postUpdateOptions: [ + "gomodTidy", + "gomodUpdateImportPaths" + ] +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/jarcoal/httpmock/.golangci.yml new/vendor/github.com/jarcoal/httpmock/.golangci.yml --- old/vendor/github.com/jarcoal/httpmock/.golangci.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/vendor/github.com/jarcoal/httpmock/.golangci.yml 2026-07-16 23:42:12.000000000 +0200 @@ -0,0 +1,49 @@ +version: "2" +issues: + max-issues-per-linter: 0 + max-same-issues: 0 +linters: + default: none + enable: + - asasalint + - asciicheck + - bidichk + - dupl + - durationcheck + - errcheck + - exhaustive + - gocritic + - godot + - govet + - importas + - ineffassign + - misspell + - prealloc + - revive + - staticcheck + - testableexamples + - unconvert + - unused + - wastedassign + - whitespace + settings: + staticcheck: + checks: + - all + - -ST1012 + - -ST1000 + revive: + rules: + - name: unused-parameter + disabled: true +formatters: + enable: + - gci + - goimports + settings: + gci: + sections: + - standard + - default + - localmodule + custom-order: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/jarcoal/httpmock/README.md new/vendor/github.com/jarcoal/httpmock/README.md --- old/vendor/github.com/jarcoal/httpmock/README.md 2025-03-17 13:14:51.000000000 +0100 +++ new/vendor/github.com/jarcoal/httpmock/README.md 2026-07-16 23:42:12.000000000 +0200 @@ -1,10 +1,10 @@ -# httpmock [](https://github.com/jarcoal/httpmock/actions?query=workflow%3ABuild) [](https://coveralls.io/github/jarcoal/httpmock?branch=v1) [](https://godoc.org/github.com/jarcoal/httpmock) [](https://github.com/jarcoal/httpmock/releases) [](https://github.com/avelino/awesome-go/#testing) +# httpmock [](https://github.com/jarcoal/httpmock/actions?query=workflow%3ABuild) [](https://coveralls.io/github/jarcoal/httpmock?branch=v1) [](https://godoc.org/github.com/jarcoal/httpmock) [](https://github.com/jarcoal/httpmock/releases) [](https://github.com/avelino/awesome-go/#testing) Easy mocking of http responses from external resources. ## Install -Currently supports Go 1.13 to 1.20 and is regularly tested against tip. +Currently supports Go 1.16 to 1.24 and is regularly tested against tip. `v1` branch has to be used instead of `master`. @@ -23,8 +23,7 @@ ### Simple Example: ```go func TestFetchArticles(t *testing.T) { - httpmock.Activate() - defer httpmock.DeactivateAndReset() + httpmock.Activate(t) // Exact URL match httpmock.RegisterResponder("GET", "https://api.mybiz.com/articles", @@ -51,8 +50,7 @@ ### Advanced Example: ```go func TestFetchArticles(t *testing.T) { - httpmock.Activate() - defer httpmock.DeactivateAndReset() + httpmock.Activate(t) // our database of articles articles := make([]map[string]interface{}, 0) @@ -138,7 +136,7 @@ func (s *MySuite) Setup(t *td.T) error { // block all HTTP requests - httpmock.Activate() + httpmock.Activate(t) return nil } @@ -148,11 +146,6 @@ return nil } -func (s *MySuite) Destroy(t *td.T) error { - httpmock.DeactivateAndReset() - return nil -} - func TestMySuite(t *testing.T) { tdsuite.Run(t, &MySuite{}) } @@ -214,12 +207,17 @@ import ( // ... "github.com/jarcoal/httpmock" - "github.com/go-resty/resty" + "github.com/go-resty/resty/v2" ) // ... + +// global client (using resty.New() creates a new transport each time, +// so you need to use the same one here and when making the request) +var client = resty.New() + var _ = BeforeSuite(func() { // block all HTTP requests - httpmock.ActivateNonDefault(resty.DefaultClient.GetClient()) + httpmock.ActivateNonDefault(client.GetClient()) }) var _ = BeforeEach(func() { @@ -237,18 +235,26 @@ import ( // ... "github.com/jarcoal/httpmock" - "github.com/go-resty/resty" ) +type Article struct { + Status struct { + Message string `json:"message"` + Code int `json:"code"` + } `json:"status"` +} + var _ = Describe("Articles", func() { It("returns a list of articles", func() { fixture := `{"status":{"message": "Your message", "code": 200}}` - responder := httpmock.NewStringResponder(200, fixture) + // have to use NewJsonResponder to get an application/json content-type + // alternatively, create a go object instead of using json.RawMessage + responder, _ := httpmock.NewJsonResponder(200, json.RawMessage(`{"status":{"message": "Your message", "code": 200}}`) fakeUrl := "https://api.mybiz.com/articles.json" httpmock.RegisterResponder("GET", fakeUrl, responder) // fetch the article into struct - articleObject := &models.Article{} + articleObject := &Article{} _, err := resty.R().SetResult(articleObject).Get(fakeUrl) // do stuff with the article object ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/jarcoal/httpmock/file.go new/vendor/github.com/jarcoal/httpmock/file.go --- old/vendor/github.com/jarcoal/httpmock/file.go 2025-03-17 13:14:51.000000000 +0100 +++ new/vendor/github.com/jarcoal/httpmock/file.go 2026-07-16 23:42:12.000000000 +0200 @@ -2,7 +2,7 @@ import ( "fmt" - "io/ioutil" //nolint: staticcheck + "os" ) // File is a file name. The contents of this file is loaded on demand @@ -32,7 +32,7 @@ } func (f File) bytes() ([]byte, error) { - return ioutil.ReadFile(string(f)) + return os.ReadFile(string(f)) } // Bytes returns the content of file as a []byte. If an error occurs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/jarcoal/httpmock/internal/error.go new/vendor/github.com/jarcoal/httpmock/internal/error.go --- old/vendor/github.com/jarcoal/httpmock/internal/error.go 2025-03-17 13:14:51.000000000 +0100 +++ new/vendor/github.com/jarcoal/httpmock/internal/error.go 2026-07-16 23:42:12.000000000 +0200 @@ -7,7 +7,7 @@ // NoResponderFound is returned when no responders are found for a // given HTTP method and URL. -var NoResponderFound = errors.New("no responder found") // nolint: revive +var NoResponderFound = errors.New("no responder found") //nolint: revive // ErrorNoResponderFoundMistake encapsulates a NoResponderFound // error probably due to a user error on the method or URL path. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/jarcoal/httpmock/match.go new/vendor/github.com/jarcoal/httpmock/match.go --- old/vendor/github.com/jarcoal/httpmock/match.go 2025-03-17 13:14:51.000000000 +0100 +++ new/vendor/github.com/jarcoal/httpmock/match.go 2026-07-16 23:42:12.000000000 +0200 @@ -4,7 +4,6 @@ "bytes" "fmt" "io" - "io/ioutil" //nolint: staticcheck "net/http" "runtime" "strings" @@ -106,6 +105,7 @@ func matcherFuncOr(mfs []MatcherFunc) MatcherFunc { return func(req *http.Request) bool { for _, mf := range mfs { + rearmBody(req) if mf(req) { return true } @@ -120,6 +120,7 @@ } return func(req *http.Request) bool { for _, mf := range mfs { + rearmBody(req) if !mf(req) { return false } @@ -134,7 +135,7 @@ } // Or combines mf and all mfs in a new [MatcherFunc]. This new -// [MatcherFunc] succeeds if one of mf or mfs succeeds. Note that as a +// [MatcherFunc] succeeds if one of mf or mfs succeeds. Note that as // a nil [MatcherFunc] is considered succeeding, if mf or one of mfs // items is nil, nil is returned. func (mf MatcherFunc) Or(mfs ...MatcherFunc) MatcherFunc { @@ -224,7 +225,8 @@ func BodyContainsBytes(subslice []byte) Matcher { return NewMatcher("", func(req *http.Request) bool { - b, err := ioutil.ReadAll(req.Body) + rearmBody(req) + b, err := io.ReadAll(req.Body) return err == nil && bytes.Contains(b, subslice) }) } @@ -243,7 +245,8 @@ func BodyContainsString(substr string) Matcher { return NewMatcher("", func(req *http.Request) bool { - b, err := ioutil.ReadAll(req.Body) + rearmBody(req) + b, err := io.ReadAll(req.Body) return err == nil && bytes.Contains(b, []byte(substr)) }) } @@ -465,27 +468,40 @@ return m.RouteKey.String() + " <" + m.name + ">" } -// bodyCopyOnRead copies body content to buf on first Read(), except +func rearmBody(req *http.Request) { + if req != nil { + if body, ok := req.Body.(interface{ rearm() }); ok { + body.rearm() + } + } +} + +type buffer struct { + *bytes.Reader +} + +func (b buffer) Close() error { + return nil +} + +// bodyCopyOnRead mutates body into a buffer on first Read(), except // if body is nil or http.NoBody. In this case, EOF is returned for -// each Read() and buf stays to nil. +// each Read() and body stays untouched. type bodyCopyOnRead struct { body io.ReadCloser - buf []byte } func (b *bodyCopyOnRead) rearm() { - if b.buf != nil { - b.body = ioutil.NopCloser(bytes.NewReader(b.buf)) + if buf, ok := b.body.(buffer); ok { + buf.Seek(0, io.SeekStart) //nolint:errcheck } // else b.body contains the original body, so don't touch } func (b *bodyCopyOnRead) copy() { - if b.buf == nil && b.body != nil && b.body != http.NoBody { - var body bytes.Buffer - io.Copy(&body, b.body) //nolint: errcheck - b.body.Close() - b.buf = body.Bytes() - b.body = ioutil.NopCloser(bytes.NewReader(b.buf)) + if _, ok := b.body.(buffer); !ok && b.body != nil && b.body != http.NoBody { + buf, _ := io.ReadAll(b.body) + b.body.Close() //nolint: errcheck + b.body = buffer{bytes.NewReader(buf)} } } @@ -500,9 +516,3 @@ func (b *bodyCopyOnRead) Close() error { return nil } - -// Len returns the buffer total length, whatever the Read position in body is. -func (b *bodyCopyOnRead) Len() int { - b.copy() - return len(b.buf) -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/jarcoal/httpmock/response.go new/vendor/github.com/jarcoal/httpmock/response.go --- old/vendor/github.com/jarcoal/httpmock/response.go 2025-03-17 13:14:51.000000000 +0100 +++ new/vendor/github.com/jarcoal/httpmock/response.go 2026-07-16 23:42:12.000000000 +0200 @@ -525,7 +525,7 @@ // httpmock.NewStringResponse(200, httpmock.File("body.txt").String()) func NewStringResponse(status int, body string) *http.Response { return &http.Response{ - Status: strconv.Itoa(status), + Status: fmt.Sprintf("%03d %s", status, http.StatusText(status)), StatusCode: status, Body: NewRespBodyFromString(body), Header: http.Header{}, @@ -551,7 +551,7 @@ // httpmock.NewBytesResponse(200, httpmock.File("body.raw").Bytes()) func NewBytesResponse(status int, body []byte) *http.Response { return &http.Response{ - Status: strconv.Itoa(status), + Status: fmt.Sprintf("%03d %s", status, http.StatusText(status)), StatusCode: status, Body: NewRespBodyFromBytes(body), Header: http.Header{}, @@ -576,7 +576,7 @@ // To pass the content of an existing file as body use [File] as in: // // httpmock.NewJsonResponse(200, httpmock.File("body.json")) -func NewJsonResponse(status int, body any) (*http.Response, error) { // nolint: revive +func NewJsonResponse(status int, body any) (*http.Response, error) { //nolint: revive,staticcheck encoded, err := json.Marshal(body) if err != nil { return nil, err @@ -586,13 +586,39 @@ return response, nil } +// NewJsonResponseOrPanic is like [NewJsonResponse] but panics in case of error. +// +// It simplifies the call of [ResponderFromMultipleResponses], avoiding the +// use of a temporary variable and an error check, and so can be used in such +// context: +// +// httpmock.RegisterResponder( +// "GET", +// "/test/path", +// httpmock.ResponderFromMultipleResponses([]*http.Response{ +// httpmock.NewJsonResponseOrPanic(200, &MyFirstResponseBody), +// httpmock.NewJsonResponseOrPanic(200, &MySecondResponseBody), +// }), +// ) +// +// To pass the content of an existing file as body use [File] as in: +// +// httpmock.NewJsonResponseOrPanic(200, httpmock.File("body.json")) +func NewJsonResponseOrPanic(status int, body any) *http.Response { //nolint: revive,staticcheck + response, err := NewJsonResponse(status, body) + if err != nil { + panic(err) + } + return response +} + // NewJsonResponder creates a [Responder] from a given body (as an // any that is encoded to JSON) and status code. // // To pass the content of an existing file as body use [File] as in: // // httpmock.NewJsonResponder(200, httpmock.File("body.json")) -func NewJsonResponder(status int, body any) (Responder, error) { // nolint: revive +func NewJsonResponder(status int, body any) (Responder, error) { //nolint: revive,staticcheck resp, err := NewJsonResponse(status, body) if err != nil { return nil, err @@ -616,7 +642,7 @@ // To pass the content of an existing file as body use [File] as in: // // httpmock.NewJsonResponderOrPanic(200, httpmock.File("body.json")) -func NewJsonResponderOrPanic(status int, body any) Responder { // nolint: revive +func NewJsonResponderOrPanic(status int, body any) Responder { //nolint: revive,staticcheck responder, err := NewJsonResponder(status, body) if err != nil { panic(err) @@ -631,7 +657,7 @@ // To pass the content of an existing file as body use [File] as in: // // httpmock.NewXmlResponse(200, httpmock.File("body.xml")) -func NewXmlResponse(status int, body any) (*http.Response, error) { // nolint: revive +func NewXmlResponse(status int, body any) (*http.Response, error) { //nolint: revive,staticcheck var ( encoded []byte err error @@ -655,7 +681,7 @@ // To pass the content of an existing file as body use [File] as in: // // httpmock.NewXmlResponder(200, httpmock.File("body.xml")) -func NewXmlResponder(status int, body any) (Responder, error) { // nolint: revive +func NewXmlResponder(status int, body any) (Responder, error) { //nolint: revive,staticcheck resp, err := NewXmlResponse(status, body) if err != nil { return nil, err @@ -679,7 +705,7 @@ // To pass the content of an existing file as body use [File] as in: // // httpmock.NewXmlResponderOrPanic(200, httpmock.File("body.xml")) -func NewXmlResponderOrPanic(status int, body any) Responder { // nolint: revive +func NewXmlResponderOrPanic(status int, body any) Responder { //nolint: revive,staticcheck responder, err := NewXmlResponder(status, body) if err != nil { panic(err) @@ -714,6 +740,7 @@ type dummyReadCloser struct { orig any // string or []byte + mu sync.Mutex // protects operations over body body lenReadSeeker // instanciated on demand from orig } @@ -733,24 +760,33 @@ case io.ReadCloser: var buf bytes.Buffer io.Copy(&buf, body) //nolint: errcheck - body.Close() + body.Close() //nolint: errcheck d.body = bytes.NewReader(buf.Bytes()) } } } func (d *dummyReadCloser) Read(p []byte) (n int, err error) { + d.mu.Lock() + defer d.mu.Unlock() + d.setup() return d.body.Read(p) } func (d *dummyReadCloser) Close() error { + d.mu.Lock() + defer d.mu.Unlock() + d.setup() - d.body.Seek(0, io.SeekEnd) // nolint: errcheck + d.body.Seek(0, io.SeekEnd) //nolint: errcheck return nil } func (d *dummyReadCloser) Len() int { + d.mu.Lock() + defer d.mu.Unlock() + d.setup() return d.body.Len() } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/jarcoal/httpmock/transport.go new/vendor/github.com/jarcoal/httpmock/transport.go --- old/vendor/github.com/jarcoal/httpmock/transport.go 2025-03-17 13:14:51.000000000 +0100 +++ new/vendor/github.com/jarcoal/httpmock/transport.go 2026-07-16 23:42:12.000000000 +0200 @@ -12,6 +12,7 @@ "strconv" "strings" "sync" + "testing" "github.com/jarcoal/httpmock/internal" ) @@ -38,10 +39,10 @@ return !stdMethods[method] && stdMethods[strings.ToUpper(method)] } -// ConnectionFailure is a responder that returns a connection failure. -// This is the default responder and is called when no other matching -// responder is found. See [RegisterNoResponder] to override this -// default behavior. +// ConnectionFailure is a responder that returns the error +// [NoResponderFound]. This is the default responder and is called +// when no other matching responder is found. See +// [RegisterNoResponder] to override this default behavior. func ConnectionFailure(*http.Request) (*http.Response, error) { return nil, NoResponderFound } @@ -414,7 +415,7 @@ func runCancelable(responder Responder, req *http.Request) (*http.Response, error) { ctx := req.Context() - if req.Cancel == nil && ctx.Done() == nil { // nolint: staticcheck + if req.Cancel == nil && ctx.Done() == nil { //nolint: staticcheck resp, err := responder(req) return resp, internal.CheckStackTracer(req, err) } @@ -432,7 +433,7 @@ go func() { select { - case <-req.Cancel: // nolint: staticcheck + case <-req.Cancel: //nolint: staticcheck resultch <- result{ response: nil, err: errors.New("request canceled"), @@ -526,7 +527,7 @@ return strings.HasPrefix(url, regexpPrefix) } -func (m *MockTransport) checkMethod(method string, matcher Matcher) { +func (m *MockTransport) checkMethod(method string) { if !m.DontCheckMethod && methodProbablyWrong(method) { panic(fmt.Sprintf("You probably want to use method %q instead of %q? If not and so want to disable this check, set MockTransport.DontCheckMethod field to true", strings.ToUpper(method), @@ -594,7 +595,7 @@ // Note that [github.com/maxatome/tdhttpmock] provides powerful helpers // to create matchers with the help of [github.com/maxatome/go-testdeep]. func (m *MockTransport) RegisterMatcherResponder(method, url string, matcher Matcher, responder Responder) { - m.checkMethod(method, matcher) + m.checkMethod(method) mr := matchResponder{ matcher: matcher, @@ -707,7 +708,7 @@ if mr.responder != nil { m.regexpResponders = append(m.regexpResponders, rxResp) } - break // nolint: staticcheck + break //nolint: staticcheck } mrk := matchRouteKey{ @@ -775,7 +776,7 @@ // Note that [github.com/maxatome/tdhttpmock] provides powerful helpers // to create matchers with the help of [github.com/maxatome/go-testdeep]. func (m *MockTransport) RegisterRegexpMatcherResponder(method string, urlRegexp *regexp.Regexp, matcher Matcher, responder Responder) { - m.checkMethod(method, matcher) + m.checkMethod(method) m.registerRegexpResponder(regexpResponder{ origRx: regexpPrefix + urlRegexp.String(), @@ -951,7 +952,7 @@ sort.Strings(keys) var b bytes.Buffer - var values []string // nolint: prealloc + var values []string //nolint: prealloc for _, k := range keys { // Do not alter the passed url.Values @@ -1096,10 +1097,17 @@ // To enable mocks for a test, simply activate at the beginning of a test: // // func TestFetchArticles(t *testing.T) { -// httpmock.Activate() +// httpmock.Activate(t) // // all http requests using http.DefaultTransport will now be intercepted // } // +// t is optional, when present it allows to automatically call +// [DeactivateAndReset] at the end of the test. It is strictly +// equivalent to: +// +// httpmock.Activate() +// t.Cleanup(httpmock.DeactivateAndReset) +// // If you want all of your tests in a package to be mocked, just call // [Activate] from init(): // @@ -1113,7 +1121,7 @@ // httpmock.Activate() // os.Exit(m.Run()) // } -func Activate() { +func Activate(t ...testing.TB) { if Disabled() { return } @@ -1124,18 +1132,30 @@ InitialTransport = http.DefaultTransport } + if len(t) > 0 && t[0] != nil { + t[0].Cleanup(DeactivateAndReset) + } + http.DefaultTransport = DefaultTransport } // ActivateNonDefault starts the mock environment with a non-default -// [*http.Client]. This emulates the [Activate] function, but allows for -// custom clients that do not use [http.DefaultTransport]. +// [*http.Client]. This emulates the [Activate] function, but allows +// for custom clients that do not use [http.DefaultTransport] +// directly. To do so, it overrides the client Transport field with +// [DefaultTransport]. +// +// To enable mocks for a test using a custom client, like: +// +// transport := http.DefaultTransport.(*http.Transport).Clone() +// transport.TLSHandshakeTimeout = 60 * time.Second +// client := &http.Client{Transport: transport} // -// To enable mocks for a test using a custom client, activate at the -// beginning of a test: +// activate at the beginning of the test: // -// client := &http.Client{Transport: &http.Transport{TLSHandshakeTimeout: 60 * time.Second}} // httpmock.ActivateNonDefault(client) +// +// See also [DeactivateNonDefault], [Deactivate] and [DeactivateAndReset]. func ActivateNonDefault(client *http.Client) { if Disabled() { return @@ -1150,49 +1170,29 @@ client.Transport = DefaultTransport } -// GetCallCountInfo gets the info on all the calls httpmock has caught -// since it was activated or reset. The info is returned as a map of -// the calling keys with the number of calls made to them as their -// value. The key is the method, a space, and the URL all concatenated -// together. -// -// As a special case, regexp responders generate 2 entries for each -// call. One for the call caught and the other for the rule that -// matched. For example: +// DeactivateNonDefault shuts down the mock environment for +// client. Any HTTP calls made after this will use the transport used +// before [ActivateNonDefault] call. // -// RegisterResponder("GET", `=~z\.com\z`, NewStringResponder(200, "body")) -// http.Get("http://z.com") -// -// will generate the following result: -// -// map[string]int{ -// `GET http://z.com`: 1, -// `GET =~z\.com\z`: 1, -// } -func GetCallCountInfo() map[string]int { - return DefaultTransport.GetCallCountInfo() -} +// See also [Deactivate] and [DeactivateAndReset]. +func DeactivateNonDefault(client *http.Client) { + if Disabled() { + return + } -// GetTotalCallCount gets the total number of calls httpmock has taken -// since it was activated or reset. -func GetTotalCallCount() int { - return DefaultTransport.GetTotalCallCount() + oldClientsLock.Lock() + defer oldClientsLock.Unlock() + if tr, ok := oldClients[client]; ok { + delete(oldClients, client) + client.Transport = tr + } } // Deactivate shuts down the mock environment. Any HTTP calls made // after this will use a live transport. // -// Usually you'll call it in a defer right after activating the mock -// environment: -// -// func TestFetchArticles(t *testing.T) { -// httpmock.Activate() -// defer httpmock.Deactivate() -// -// // when this test ends, the mock environment will close -// } -// -// Since go 1.14 you can also use [*testing.T.Cleanup] method as in: +// Usually you'll call it in a [testing.T.Cleanup] right after +// activating the mock environment: // // func TestFetchArticles(t *testing.T) { // httpmock.Activate() @@ -1201,12 +1201,25 @@ // // when this test ends, the mock environment will close // } // -// useful in test helpers to save your callers from calling defer themselves. +// Note that registered mocks and corresponding counters are not +// removed. The next time [Activate] will be called they will be +// active again. Use [DeactivateAndReset] to also remove registered +// mocks & counters. +// +// It also restores all clients Transport field previously overridden +// by [ActivateNonDefault]. Unlike globally registered mocks, these +// clients won't be mocked anymore the next time [Activate] will be +// called. +// +// See also [Reset] and [DeactivateAndReset]. func Deactivate() { if Disabled() { return } - http.DefaultTransport = InitialTransport + + if InitialTransport != nil { + http.DefaultTransport = InitialTransport + } // reset the custom clients to use their original RoundTripper oldClientsLock.Lock() @@ -1219,24 +1232,72 @@ // Reset removes any registered mocks and returns the mock // environment to its initial state. It zeroes call counters too. +// +// See also [DeactivateAndReset]. func Reset() { DefaultTransport.Reset() } -// ZeroCallCounters zeroes call counters without touching registered responders. -func ZeroCallCounters() { - DefaultTransport.ZeroCallCounters() -} - // DeactivateAndReset is just a convenience method for calling // [Deactivate] and then [Reset]. // -// Happy deferring! +// Often called at the end of the test like in: +// +// func TestFetchArticles(t *testing.T) { +// httpmock.Activate() +// t.Cleanup(httpmock.DeactivateAndReset) +// +// // when this test ends, the mock environment will close +// } +// +// you may prefer the simpler: +// +// func TestFetchArticles(t *testing.T) { +// httpmock.Activate(t) +// +// // when this test ends, the mock environment will close +// } +// +// See [Activate]. func DeactivateAndReset() { Deactivate() Reset() } +// GetCallCountInfo gets the info on all the calls httpmock has caught +// since it was activated or reset. The info is returned as a map of +// the calling keys with the number of calls made to them as their +// value. The key is the method, a space, and the URL all concatenated +// together. +// +// As a special case, regexp responders generate 2 entries for each +// call. One for the call caught and the other for the rule that +// matched. For example: +// +// RegisterResponder("GET", `=~z\.com\z`, NewStringResponder(200, "body")) +// http.Get("http://z.com") +// +// will generate the following result: +// +// map[string]int{ +// `GET http://z.com`: 1, +// `GET =~z\.com\z`: 1, +// } +func GetCallCountInfo() map[string]int { + return DefaultTransport.GetCallCountInfo() +} + +// GetTotalCallCount gets the total number of calls httpmock has taken +// since it was first activated or last reset. +func GetTotalCallCount() int { + return DefaultTransport.GetTotalCallCount() +} + +// ZeroCallCounters zeroes call counters without touching registered responders. +func ZeroCallCounters() { + DefaultTransport.ZeroCallCounters() +} + // RegisterMatcherResponder adds a new responder, associated with a given // HTTP method, URL (or path) and [Matcher]. // @@ -1310,8 +1371,8 @@ // // If method is a lower-cased version of CONNECT, DELETE, GET, HEAD, // OPTIONS, POST, PUT or TRACE, a panics occurs to notice the possible -// mistake. This panic can be disabled by setting m.DontCheckMethod to -// true prior to this call. +// mistake. This panic can be disabled by setting +// [DefaultTransport].DontCheckMethod to true prior to this call. // // See also [RegisterResponder] if a matcher is not needed. // @@ -1422,8 +1483,8 @@ // // If method is a lower-cased version of CONNECT, DELETE, GET, HEAD, // OPTIONS, POST, PUT or TRACE, a panics occurs to notice the possible -// mistake. This panic can be disabled by setting m.DontCheckMethod to -// true prior to this call. +// mistake. This panic can be disabled by setting +// [DefaultTransport].DontCheckMethod to true prior to this call. // // See [RegisterRegexpResponder] if a matcher is not needed. // @@ -1458,7 +1519,7 @@ // If method is a lower-cased version of CONNECT, DELETE, GET, HEAD, // OPTIONS, POST, PUT or TRACE, a panics occurs to notice the possible // mistake. This panic can be disabled by setting -// DefaultTransport.DontCheckMethod to true prior to this call. +// [DefaultTransport].DontCheckMethod to true prior to this call. func RegisterRegexpResponder(method string, urlRegexp *regexp.Regexp, responder Responder) { DefaultTransport.RegisterRegexpResponder(method, urlRegexp, responder) } @@ -1504,8 +1565,8 @@ // // If method is a lower-cased version of CONNECT, DELETE, GET, HEAD, // OPTIONS, POST, PUT or TRACE, a panics occurs to notice the possible -// mistake. This panic can be disabled by setting m.DontCheckMethod to -// true prior to this call. +// mistake. This panic can be disabled by setting +// [DefaultTransport].DontCheckMethod to true prior to this call. // // See also [RegisterResponderWithQuery] if a matcher is not needed. // @@ -1592,7 +1653,7 @@ // If method is a lower-cased version of CONNECT, DELETE, GET, HEAD, // OPTIONS, POST, PUT or TRACE, a panics occurs to notice the possible // mistake. This panic can be disabled by setting -// DefaultTransport.DontCheckMethod to true prior to this call. +// [DefaultTransport].DontCheckMethod to true prior to this call. func RegisterResponderWithQuery(method, path string, query any, responder Responder) { RegisterMatcherResponderWithQuery(method, path, query, Matcher{}, responder) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/golang.org/x/crypto/LICENSE new/vendor/golang.org/x/crypto/LICENSE --- old/vendor/golang.org/x/crypto/LICENSE 2025-03-17 13:14:51.000000000 +0100 +++ new/vendor/golang.org/x/crypto/LICENSE 2026-07-16 23:42:12.000000000 +0200 @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/golang.org/x/crypto/pkcs12/crypto.go new/vendor/golang.org/x/crypto/pkcs12/crypto.go --- old/vendor/golang.org/x/crypto/pkcs12/crypto.go 2025-03-17 13:14:51.000000000 +0100 +++ new/vendor/golang.org/x/crypto/pkcs12/crypto.go 2026-07-16 23:42:12.000000000 +0200 @@ -26,7 +26,7 @@ create(key []byte) (cipher.Block, error) // deriveKey returns a key derived from the given password and salt. deriveKey(salt, password []byte, iterations int) []byte - // deriveKey returns an IV derived from the given password and salt. + // deriveIV returns an IV derived from the given password and salt. deriveIV(salt, password []byte, iterations int) []byte } @@ -80,6 +80,10 @@ return nil, 0, err } + if params.Iterations < 0 || params.Iterations > maxIterations { + return nil, 0, NotImplementedError("iteration count is invalid or too high") + } + key := cipherType.deriveKey(params.Salt, password, params.Iterations) iv := cipherType.deriveIV(params.Salt, password, params.Iterations) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/golang.org/x/crypto/pkcs12/mac.go new/vendor/golang.org/x/crypto/pkcs12/mac.go --- old/vendor/golang.org/x/crypto/pkcs12/mac.go 2025-03-17 13:14:51.000000000 +0100 +++ new/vendor/golang.org/x/crypto/pkcs12/mac.go 2026-07-16 23:42:12.000000000 +0200 @@ -27,11 +27,19 @@ oidSHA1 = asn1.ObjectIdentifier([]int{1, 3, 14, 3, 2, 26}) ) +// maxIterations is a safety limit to prevent CPU exhaustion from +// crafted PKCS#12 files with unreasonable iteration counts. +const maxIterations = 1 << 20 // ~1 million + func verifyMac(macData *macData, message, password []byte) error { if !macData.Mac.Algorithm.Algorithm.Equal(oidSHA1) { return NotImplementedError("unknown digest algorithm: " + macData.Mac.Algorithm.Algorithm.String()) } + if macData.Iterations < 0 || macData.Iterations > maxIterations { + return NotImplementedError("iteration count is invalid or too high") + } + key := pbkdf(sha1Sum, 20, 64, macData.MacSalt, password, macData.Iterations, 3, 20) mac := hmac.New(sha1.New, key) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/golang.org/x/crypto/pkcs12/pkcs12.go new/vendor/golang.org/x/crypto/pkcs12/pkcs12.go --- old/vendor/golang.org/x/crypto/pkcs12/pkcs12.go 2025-03-17 13:14:51.000000000 +0100 +++ new/vendor/golang.org/x/crypto/pkcs12/pkcs12.go 2026-07-16 23:42:12.000000000 +0200 @@ -4,12 +4,16 @@ // Package pkcs12 implements some of PKCS#12. // -// This implementation is distilled from https://tools.ietf.org/html/rfc7292 -// and referenced documents. It is intended for decoding P12/PFX-stored -// certificates and keys for use with the crypto/tls package. +// This implementation is distilled from [RFC 7292] and referenced documents. +// It is intended for decoding P12/PFX-stored certificates and keys for use +// with the crypto/tls package. // -// This package is frozen. If it's missing functionality you need, consider -// an alternative like software.sslmate.com/src/go-pkcs12. +// The pkcs12 package is [frozen] and is not accepting new features. +// If it's missing functionality you need, consider an alternative like +// software.sslmate.com/src/go-pkcs12. +// +// [RFC 7292]: https://datatracker.ietf.org/doc/html/rfc7292 +// [frozen]: https://go.dev/wiki/Frozen package pkcs12 import ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/modules.txt new/vendor/modules.txt --- old/vendor/modules.txt 2025-03-17 13:14:51.000000000 +0100 +++ new/vendor/modules.txt 2026-07-16 23:42:12.000000000 +0200 @@ -1,13 +1,13 @@ -# github.com/alecthomas/kingpin/v2 v2.3.2 +# github.com/alecthomas/kingpin/v2 v2.4.0 ## explicit; go 1.17 github.com/alecthomas/kingpin/v2 -# github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 +# github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b ## explicit; go 1.15 github.com/alecthomas/units # github.com/davecgh/go-spew v1.1.1 ## explicit github.com/davecgh/go-spew/spew -# github.com/jarcoal/httpmock v1.3.0 +# github.com/jarcoal/httpmock v1.4.1 ## explicit; go 1.18 github.com/jarcoal/httpmock github.com/jarcoal/httpmock/internal @@ -17,7 +17,7 @@ # github.com/xhit/go-str2duration/v2 v2.1.0 ## explicit; go 1.13 github.com/xhit/go-str2duration/v2 -# golang.org/x/crypto v0.9.0 -## explicit; go 1.17 +# golang.org/x/crypto v0.54.0 +## explicit; go 1.25.0 golang.org/x/crypto/pkcs12 golang.org/x/crypto/pkcs12/internal/rc2
