mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-03-13 09:49:17 -05:00
chore: bump icap client which fixes defer error handling (#8234)
* chore: bump icap client which fixes defer error handling * chore: bump icap-client
This commit is contained in:
10
vendor/github.com/egirna/icap-client/client.go
generated
vendored
10
vendor/github.com/egirna/icap-client/client.go
generated
vendored
@@ -31,9 +31,7 @@ func NewClient(options ...ConfigOption) (Client, error) {
|
||||
}
|
||||
|
||||
// Do is the main function of the client that makes the ICAP request
|
||||
func (c *Client) Do(req Request) (Response, error) {
|
||||
var err error
|
||||
|
||||
func (c *Client) Do(req Request) (res Response, err error) {
|
||||
// establish connection to the icap server
|
||||
err = c.conn.Connect(req.ctx, req.URL.Host)
|
||||
if err != nil {
|
||||
@@ -57,15 +55,15 @@ func (c *Client) Do(req Request) (Response, error) {
|
||||
return Response{}, err
|
||||
}
|
||||
|
||||
resp, err := toClientResponse(bufio.NewReader(strings.NewReader(string(dataRes))))
|
||||
res, err = toClientResponse(bufio.NewReader(strings.NewReader(string(dataRes))))
|
||||
if err != nil {
|
||||
return Response{}, err
|
||||
}
|
||||
|
||||
// check if the message is fully done scanning or if it needs to be sent another chunk
|
||||
done := !(resp.StatusCode == http.StatusContinue && !req.bodyFittedInPreview && req.previewSet)
|
||||
done := !(res.StatusCode == http.StatusContinue && !req.bodyFittedInPreview && req.previewSet)
|
||||
if done {
|
||||
return resp, nil
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// get the remaining body bytes
|
||||
|
||||
3
vendor/github.com/egirna/icap-client/request.go
generated
vendored
3
vendor/github.com/egirna/icap-client/request.go
generated
vendored
@@ -55,10 +55,9 @@ func NewRequest(ctx context.Context, method, urlStr string, httpReq *http.Reques
|
||||
|
||||
// SetPreview sets the preview bytes in the icap header
|
||||
// todo: defer close error
|
||||
func (r *Request) SetPreview(maxBytes int) error {
|
||||
func (r *Request) SetPreview(maxBytes int) (err error) {
|
||||
var bodyBytes []byte
|
||||
var previewBytes int
|
||||
var err error
|
||||
|
||||
// receiving the body bites to determine the preview bytes depending on the request ICAP method
|
||||
if r.Method == MethodREQMOD {
|
||||
|
||||
Reference in New Issue
Block a user