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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
c91b6436
Commit
c91b6436
authored
Apr 17, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make HTTPIO compatible with multi-byte chars (Extracted from ChunkedIO)
parent
c39ad568
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2888 additions
and
617 deletions
+2888
-617
lib/gitlab/ci/trace/http_io.rb
lib/gitlab/ci/trace/http_io.rb
+16
-6
spec/fixtures/trace/sample_trace
spec/fixtures/trace/sample_trace
+2870
-610
spec/support/http_io/http_io_helpers.rb
spec/support/http_io/http_io_helpers.rb
+2
-1
No files found.
lib/gitlab/ci/trace/http_io.rb
View file @
c91b6436
...
@@ -75,18 +75,28 @@ module Gitlab
...
@@ -75,18 +75,28 @@ module Gitlab
end
end
end
end
def
read
(
length
=
nil
)
def
read
(
length
=
nil
,
outbuf
=
""
)
out
=
""
out
=
""
until
eof?
||
(
length
&&
out
.
length
>=
length
)
length
||=
size
-
tell
until
length
<=
0
||
eof?
data
=
get_chunk
data
=
get_chunk
break
if
data
.
empty?
break
if
data
.
empty?
out
<<
data
chunk_bytes
=
[
BUFFER_SIZE
-
chunk_offset
,
length
].
min
@tell
+=
data
.
bytesize
chunk_data
=
data
.
byteslice
(
0
,
chunk_bytes
)
out
<<
chunk_data
@tell
+=
chunk_data
.
bytesize
length
-=
chunk_data
.
bytesize
end
end
out
=
out
[
0
,
length
]
if
length
&&
out
.
length
>
length
# If outbuf is passed, we put the output into the buffer. This supports IO.copy_stream functionality
if
outbuf
outbuf
.
slice!
(
0
,
outbuf
.
bytesize
)
outbuf
<<
out
end
out
out
end
end
...
@@ -158,7 +168,7 @@ module Gitlab
...
@@ -158,7 +168,7 @@ module Gitlab
# Provider: GCS
# Provider: GCS
# - When the file size is larger than requested Content-range, the Content-range is included in responces with Net::HTTPPartialContent 206
# - When the file size is larger than requested Content-range, the Content-range is included in responces with Net::HTTPPartialContent 206
# - When the file size is smaller than requested Content-range, the Content-range is included in responces with Net::HTTPOK 200
# - When the file size is smaller than requested Content-range, the Content-range is included in responces with Net::HTTPOK 200
@chunk_range
||=
(
chunk_start
...
(
chunk_start
+
@chunk
.
length
))
@chunk_range
||=
(
chunk_start
...
(
chunk_start
+
@chunk
.
bytesize
))
end
end
@chunk
[
chunk_offset
..
BUFFER_SIZE
]
@chunk
[
chunk_offset
..
BUFFER_SIZE
]
...
...
spec/fixtures/trace/sample_trace
View file @
c91b6436
This source diff could not be displayed because it is too large. You can
view the blob
instead.
spec/support/http_io/http_io_helpers.rb
View file @
c91b6436
...
@@ -44,10 +44,11 @@ module HttpIOHelpers
...
@@ -44,10 +44,11 @@ module HttpIOHelpers
def
remote_trace_body
def
remote_trace_body
@remote_trace_body
||=
File
.
read
(
expand_fixture_path
(
'trace/sample_trace'
))
@remote_trace_body
||=
File
.
read
(
expand_fixture_path
(
'trace/sample_trace'
))
.
force_encoding
(
Encoding
::
BINARY
)
end
end
def
remote_trace_size
def
remote_trace_size
remote_trace_body
.
length
remote_trace_body
.
bytesize
end
end
def
set_smaller_buffer_size_than
(
file_size
)
def
set_smaller_buffer_size_than
(
file_size
)
...
...
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