Skip to content

Commit

Permalink
Modify download URLs for caching only.
Browse files Browse the repository at this point in the history
Other action operations' URLs will remain in place so that the
unmodified proxy request/responses function correctly.
  • Loading branch information
saracen committed Jan 8, 2019
1 parent 473de32 commit da4d85f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ func (s *Server) batch() *httputil.ReverseProxy {

// modify batch request urls
for _, object := range br.Objects {
for _, action := range object.Actions {
for operation, action := range object.Actions {
if operation != "download" {
continue
}
if action.Header == nil {
action.Header = make(map[string]string)
}
Expand Down Expand Up @@ -377,7 +380,7 @@ func (s *Server) fetch(w io.Writer, oid, url string, size int, header http.Heade
}

if resp.StatusCode != http.StatusOK {
return fmt.Errorf("upstream server responsed with %d status", resp.StatusCode)
return fmt.Errorf("upstream server responded with %d status", resp.StatusCode)
}

defer resp.Body.Close()
Expand Down

0 comments on commit da4d85f

Please sign in to comment.