Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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-ce
Commits
52107939
Commit
52107939
authored
Aug 08, 2020
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix static analysis failures in httprs
parent
150f645a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
changelogs/unreleased/sh-vendor-httprs.yml
changelogs/unreleased/sh-vendor-httprs.yml
+5
-0
internal/httprs/httprs.go
internal/httprs/httprs.go
+4
-4
internal/httprs/httprs_test.go
internal/httprs/httprs_test.go
+2
-2
No files found.
changelogs/unreleased/sh-vendor-httprs.yml
0 → 100644
View file @
52107939
---
title
:
Vendor httprs module
merge_request
:
550
author
:
type
:
other
internal/httprs/httprs.go
View file @
52107939
...
@@ -47,14 +47,14 @@ var _ io.Seeker = (*HttpReadSeeker)(nil)
...
@@ -47,14 +47,14 @@ var _ io.Seeker = (*HttpReadSeeker)(nil)
var
(
var
(
// ErrNoContentLength is returned by Seek when the initial http response did not include a Content-Length header
// ErrNoContentLength is returned by Seek when the initial http response did not include a Content-Length header
ErrNoContentLength
=
errors
.
New
(
"Content-Length was not set"
)
ErrNoContentLength
=
errors
.
New
(
"
header
Content-Length was not set"
)
// ErrRangeRequestsNotSupported is returned by Seek and Read
// ErrRangeRequestsNotSupported is returned by Seek and Read
// when the remote server does not allow range requests (Accept-Ranges was not set)
// when the remote server does not allow range requests (Accept-Ranges was not set)
ErrRangeRequestsNotSupported
=
errors
.
New
(
"
R
ange requests are not supported by the remote server"
)
ErrRangeRequestsNotSupported
=
errors
.
New
(
"
r
ange requests are not supported by the remote server"
)
// ErrInvalidRange is returned by Read when trying to read past the end of the file
// ErrInvalidRange is returned by Read when trying to read past the end of the file
ErrInvalidRange
=
errors
.
New
(
"
I
nvalid range"
)
ErrInvalidRange
=
errors
.
New
(
"
i
nvalid range"
)
// ErrContentHasChanged is returned by Read when the content has changed since the first request
// ErrContentHasChanged is returned by Read when the content has changed since the first request
ErrContentHasChanged
=
errors
.
New
(
"
C
ontent has changed since first request"
)
ErrContentHasChanged
=
errors
.
New
(
"
c
ontent has changed since first request"
)
)
)
// NewHttpReadSeeker returns a HttpReadSeeker, using the http.Response and, optionaly, the http.Client
// NewHttpReadSeeker returns a HttpReadSeeker, using the http.Response and, optionaly, the http.Client
...
...
internal/httprs/httprs_test.go
View file @
52107939
...
@@ -37,7 +37,7 @@ func (f *fakeResponseWriter) WriteHeader(code int) {
...
@@ -37,7 +37,7 @@ func (f *fakeResponseWriter) WriteHeader(code int) {
}
}
func
(
f
*
fakeResponseWriter
)
Response
()
*
http
.
Response
{
func
(
f
*
fakeResponseWriter
)
Response
()
*
http
.
Response
{
f
.
tmp
.
Seek
(
0
,
os
.
SEEK_SET
)
f
.
tmp
.
Seek
(
0
,
io
.
SeekStart
)
return
&
http
.
Response
{
Body
:
f
.
tmp
,
StatusCode
:
f
.
code
,
Header
:
f
.
h
}
return
&
http
.
Response
{
Body
:
f
.
tmp
,
StatusCode
:
f
.
code
,
Header
:
f
.
h
}
}
}
...
@@ -167,7 +167,7 @@ func testHttpReaderSeeker(t *testing.T, newRS RSFactory) {
...
@@ -167,7 +167,7 @@ func testHttpReaderSeeker(t *testing.T, newRS RSFactory) {
r
:=
newRS
()
r
:=
newRS
()
So
(
r
,
ShouldNotBeNil
)
So
(
r
,
ShouldNotBeNil
)
defer
r
.
Close
()
defer
r
.
Close
()
s
,
err
:=
r
.
Seek
(
4
*
64
,
os
.
SEEK_SET
)
s
,
err
:=
r
.
Seek
(
4
*
64
,
io
.
SeekStart
)
So
(
s
,
ShouldEqual
,
4
*
64
)
So
(
s
,
ShouldEqual
,
4
*
64
)
So
(
err
,
ShouldBeNil
)
So
(
err
,
ShouldBeNil
)
buf
:=
make
([]
byte
,
4
)
buf
:=
make
([]
byte
,
4
)
...
...
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