Skip to content

Commit

Permalink
chore: Bump Helm chart version pre-release
Browse files Browse the repository at this point in the history
Co-Authored-By: Sebastián Vargas <[email protected]>
  • Loading branch information
achetronic and sebastocorp committed Oct 29, 2024
1 parent 77b501f commit c9a7518
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
4 changes: 2 additions & 2 deletions charts/bifrost/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ type: application
description: >-
A Helm chart for bifrost, a lightweight S3 proxy that re-signs requests between
your customers and buckets, supporting multiple client authentication methods.
version: 0.9.0 # chart version
appVersion: 0.9.0 # application version
version: 0.10.0 # chart version
appVersion: 0.10.0 # application version
kubeVersion: ">=1.22.0-0" # kubernetes version
home: https://github.com/freepik-company/bifrost
sources:
Expand Down
29 changes: 18 additions & 11 deletions internal/httpserver/httpserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,16 +481,23 @@ func (s *HttpServer) handleRequest(response http.ResponseWriter, request *http.R

// Clone the data in the response.
// Using an intermediate structs to retrieve reading and writing errors separately
rwErrorInformer := &ReadWriteInformer{
readErrorInformer := &ReadInformer{
Reader: targetResponse.Body,
}

writeErrorInformer := &WriteInformer{
Writer: response,
}

_, localErr = io.Copy(rwErrorInformer, rwErrorInformer)
_, localErr = io.Copy(writeErrorInformer, readErrorInformer)
if localErr != nil {

globals.Application.Logger.Debugf("[io.Copy] localErr content: %s", localErr.Error())
globals.Application.Logger.Debugf("[io.Copy] readErrorInformer.ReadErr content: %v", readErrorInformer.ReadErr)
globals.Application.Logger.Debugf("[io.Copy] writeErrorInformer.WriteErr content: %v", writeErrorInformer.WriteErr)

// Error reading from S3
if rwErrorInformer.ReadErr != nil {
if readErrorInformer.ReadErr != nil {

// Verify whether the response writer implements the Hijacker interface
hijacker, ok := response.(http.Hijacker)
Expand All @@ -511,21 +518,21 @@ func (s *HttpServer) handleRequest(response http.ResponseWriter, request *http.R
}

// Error writing to the client
if rwErrorInformer.WriteErr != nil {
if writeErrorInformer.WriteErr != nil {

if errors.Is(err, syscall.EPIPE) || errors.Is(err, syscall.ECONNRESET) {
err = fmt.Errorf("client closed the connection: %s", err.Error())
if errors.Is(writeErrorInformer.WriteErr, syscall.EPIPE) || errors.Is(writeErrorInformer.WriteErr, syscall.ECONNRESET) {
err = fmt.Errorf("client closed the connection: %s", writeErrorInformer.WriteErr.Error())
return
}

// Waiting time exhausted
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
err = fmt.Errorf("timeout writing to the frentend: %s", err.Error())
if netErr, ok := writeErrorInformer.WriteErr.(net.Error); ok && netErr.Timeout() {
err = fmt.Errorf("timeout writing to the frentend: %s", writeErrorInformer.WriteErr.Error())
return
}

// Error writing on user's stream (client)
err = fmt.Errorf("failed writing to the frentend: %s", err.Error())
err = fmt.Errorf("failed writing to the frentend: %s", writeErrorInformer.WriteErr.Error())
return
}

Expand Down Expand Up @@ -577,7 +584,7 @@ func (s *HttpServer) Run(httpAddr string) {
//
listener, err := net.Listen("tcp", s.Addr)
if err != nil {
globals.Application.Logger.Errorf("Server failed. Reason: %s", err.Error())
globals.Application.Logger.Errorf("Server failed. Listen() crashed. Reason: %s", err.Error())
}

limitedListener := listener
Expand All @@ -587,7 +594,7 @@ func (s *HttpServer) Run(httpAddr string) {

err = s.Serve(limitedListener)
if err != nil {
globals.Application.Logger.Errorf("Server failed. Reason: %s", err.Error())
globals.Application.Logger.Errorf("Server failed. Serve() crashed. Reason: %s", err.Error())
}

}
Expand Down
13 changes: 8 additions & 5 deletions internal/httpserver/rw.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@ package httpserver

import "io"

type ReadWriteInformer struct {
Reader io.Reader
type ReadInformer struct {
Reader io.Reader
ReadErr error
}

type WriteInformer struct {
Writer io.Writer
ReadErr error
WriteErr error
}

func (rw *ReadWriteInformer) Read(p []byte) (int, error) {
func (rw *ReadInformer) Read(p []byte) (int, error) {
n, err := rw.Reader.Read(p)
if err != nil {
rw.ReadErr = err
}
return n, err
}

func (rw *ReadWriteInformer) Write(p []byte) (int, error) {
func (rw *WriteInformer) Write(p []byte) (int, error) {
n, err := rw.Writer.Write(p)
if err != nil {
rw.WriteErr = err
Expand Down

0 comments on commit c9a7518

Please sign in to comment.