Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
55444e03
Commit
55444e03
authored
Nov 14, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update github.com/jfbus/httprs to fix
https://gitlab.com/gitlab-org/gitlab-workhorse/issues/153
parent
367f10dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
vendor/github.com/jfbus/httprs/httprs.go
vendor/github.com/jfbus/httprs/httprs.go
+23
-0
vendor/vendor.json
vendor/vendor.json
+3
-3
No files found.
vendor/github.com/jfbus/httprs/httprs.go
View file @
55444e03
...
...
@@ -16,6 +16,7 @@ If you want use a specific http.Client for additional range requests :
package
httprs
import
(
"context"
"errors"
"fmt"
"io"
...
...
@@ -33,6 +34,7 @@ type HttpReadSeeker struct {
c
*
http
.
Client
req
*
http
.
Request
res
*
http
.
Response
ctx
context
.
Context
r
io
.
ReadCloser
pos
int64
canSeek
bool
...
...
@@ -63,6 +65,7 @@ var (
func
NewHttpReadSeeker
(
res
*
http
.
Response
,
client
...*
http
.
Client
)
*
HttpReadSeeker
{
r
:=
&
HttpReadSeeker
{
req
:
res
.
Request
,
ctx
:
res
.
Request
.
Context
(),
res
:
res
,
r
:
res
.
Body
,
canSeek
:
(
res
.
Header
.
Get
(
"Accept-Ranges"
)
==
"bytes"
),
...
...
@@ -159,7 +162,27 @@ func (r *HttpReadSeeker) Seek(offset int64, whence int) (int64, error) {
return
r
.
pos
,
err
}
func
cloneHeader
(
h
http
.
Header
)
http
.
Header
{
h2
:=
make
(
http
.
Header
,
len
(
h
))
for
k
,
vv
:=
range
h
{
vv2
:=
make
([]
string
,
len
(
vv
))
copy
(
vv2
,
vv
)
h2
[
k
]
=
vv2
}
return
h2
}
func
(
r
*
HttpReadSeeker
)
newRequest
()
*
http
.
Request
{
newreq
:=
r
.
req
.
WithContext
(
r
.
ctx
)
// includes shallow copies of maps, but okay
if
r
.
req
.
ContentLength
==
0
{
newreq
.
Body
=
nil
// Issue 16036: nil Body for http.Transport retries
}
newreq
.
Header
=
cloneHeader
(
r
.
req
.
Header
)
return
newreq
}
func
(
r
*
HttpReadSeeker
)
rangeRequest
()
error
{
r
.
req
=
r
.
newRequest
()
r
.
req
.
Header
.
Set
(
"Range"
,
fmt
.
Sprintf
(
"bytes=%d-"
,
r
.
pos
))
etag
,
last
:=
r
.
res
.
Header
.
Get
(
"ETag"
),
r
.
res
.
Header
.
Get
(
"Last-Modified"
)
switch
{
...
...
vendor/vendor.json
View file @
55444e03
...
...
@@ -91,10 +91,10 @@
"revision"
:
"e8f0f8aaa98dfb6586cbdf2978d511e3199a960a"
},
{
"checksumSHA1"
:
"
g46WnPAlsmkyNDUFdObDgP6DP+s
="
,
"checksumSHA1"
:
"
6TbprMZzwDk+SaW+JxdxvnauyDk
="
,
"path"
:
"github.com/jfbus/httprs"
,
"revision"
:
"
e879ae6bf984ca6c009eb44696e9f400ec3ed2d9
"
,
"revisionTime"
:
"2017-
07-03T13:54:3
5Z"
"revision"
:
"
32cf48c14a79f94eb3d8100efc00e773c5c8b160
"
,
"revisionTime"
:
"2017-
11-08T13:45:5
5Z"
},
{
"checksumSHA1"
:
"oIkoHb8+rM5Etur5HhZVY/sDQKQ="
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment