gitlab-grack 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +14 -0
- data/CHANGELOG +2 -0
- data/lib/grack/server.rb +21 -2
- data/lib/grack/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23b1962af9b51c2805167e6b627d5357dcee1752
|
4
|
+
data.tar.gz: 74d0879a706bc19457bc6fae3bbf5dc0c7bdc135
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b52af3a8f9be5abaa0f7a0513c127c67a2900ba315a431bb2b2d51dbfd4fd7f10a42a95d71b1d954b5862e34adb28619a3b2831c271bbeca713fc217e9005b3
|
7
|
+
data.tar.gz: bc0cabeec601326501c9c80c56dba59cd19eb4bf39cf905918426d67a2b65625cb77a9a983fb8beb2b3d1b3936c66401c6f69663468c9b9146515875f1fa16df
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/CHANGELOG
ADDED
data/lib/grack/server.rb
CHANGED
@@ -55,6 +55,12 @@ module Grack
|
|
55
55
|
# actual command handling functions
|
56
56
|
# ---------------------------------
|
57
57
|
|
58
|
+
# Uses chunked (streaming) transfer, otherwise response
|
59
|
+
# blocks to calculate Content-Length header
|
60
|
+
# http://en.wikipedia.org/wiki/Chunked_transfer_encoding
|
61
|
+
|
62
|
+
CRLF = "\r\n"
|
63
|
+
|
58
64
|
def service_rpc
|
59
65
|
return render_no_access if !has_access(@rpc, true)
|
60
66
|
input = read_body
|
@@ -62,19 +68,32 @@ module Grack
|
|
62
68
|
@res = Rack::Response.new
|
63
69
|
@res.status = 200
|
64
70
|
@res["Content-Type"] = "application/x-git-%s-result" % @rpc
|
71
|
+
@res["Transfer-Encoding"] = "chunked"
|
72
|
+
@res["Cache-Control"] = "no-cache"
|
73
|
+
|
65
74
|
@res.finish do
|
66
75
|
command = git_command("#{@rpc} --stateless-rpc #{@dir}")
|
67
76
|
IO.popen(command, File::RDWR) do |pipe|
|
68
77
|
pipe.write(input)
|
69
78
|
pipe.close_write
|
70
79
|
while !pipe.eof?
|
71
|
-
block = pipe.read(8192)
|
72
|
-
@res.write block
|
80
|
+
block = pipe.read(8192) # 8KB at a time
|
81
|
+
@res.write encode_chunk(block) # stream it to the client
|
73
82
|
end
|
83
|
+
@res.write terminating_chunk
|
74
84
|
end
|
75
85
|
end
|
76
86
|
end
|
77
87
|
|
88
|
+
def encode_chunk(chunk)
|
89
|
+
size_in_hex = chunk.size.to_s(16)
|
90
|
+
[ size_in_hex, CRLF, chunk, CRLF ].join
|
91
|
+
end
|
92
|
+
|
93
|
+
def terminating_chunk
|
94
|
+
[ 0, CRLF, CRLF ].join
|
95
|
+
end
|
96
|
+
|
78
97
|
def get_info_refs
|
79
98
|
service_name = get_service_type
|
80
99
|
|
data/lib/grack/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-grack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Chacon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -47,6 +47,8 @@ extra_rdoc_files: []
|
|
47
47
|
files:
|
48
48
|
- .gitignore
|
49
49
|
- .gitmodules
|
50
|
+
- .travis.yml
|
51
|
+
- CHANGELOG
|
50
52
|
- Gemfile
|
51
53
|
- Gemfile.lock
|
52
54
|
- README.md
|
@@ -79,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
81
|
version: '0'
|
80
82
|
requirements: []
|
81
83
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.
|
84
|
+
rubygems_version: 2.1.11
|
83
85
|
signing_key:
|
84
86
|
specification_version: 4
|
85
87
|
summary: Ruby/Rack Git Smart-HTTP Server Handler
|