update c/{buildah,common,image,storage} to latest main

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-05-08 13:51:48 +02:00
parent ee8ed8dd1f
commit d4c7ca39fd
318 changed files with 25238 additions and 21994 deletions

View File

@ -16,6 +16,8 @@ package runtime
import (
"bufio"
"context"
"errors"
"io"
"net/http"
"strings"
@ -96,10 +98,16 @@ func (p *peekingReader) Read(d []byte) (int, error) {
if p == nil {
return 0, io.EOF
}
if p.underlying == nil {
return 0, io.ErrUnexpectedEOF
}
return p.underlying.Read(d)
}
func (p *peekingReader) Close() error {
if p.underlying == nil {
return errors.New("reader already closed")
}
p.underlying = nil
if p.orig != nil {
return p.orig.Close()
@ -107,9 +115,11 @@ func (p *peekingReader) Close() error {
return nil
}
// JSONRequest creates a new http request with json headers set
// JSONRequest creates a new http request with json headers set.
//
// It uses context.Background.
func JSONRequest(method, urlStr string, body io.Reader) (*http.Request, error) {
req, err := http.NewRequest(method, urlStr, body)
req, err := http.NewRequestWithContext(context.Background(), method, urlStr, body)
if err != nil {
return nil, err
}