summaryrefslogtreecommitdiff
path: root/dev-ruby/websocket
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-04-02 05:16:35 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-04-02 05:16:35 +0100
commit6882d8d1110ef4feeec532196a1f0a25420d0fd1 (patch)
treec8a3d28a31e6c077d6b9097ff36b1232d2ce04b7 /dev-ruby/websocket
parent85a2a2153ef8027c2ba1be45143cd91914be0ad0 (diff)
gentoo auto-resync : 02:04:2023 - 05:16:35
Diffstat (limited to 'dev-ruby/websocket')
-rw-r--r--dev-ruby/websocket/Manifest2
-rw-r--r--dev-ruby/websocket/files/websocket-1.2.9-default-port.patch134
-rw-r--r--dev-ruby/websocket/websocket-1.2.9-r2.ebuild29
3 files changed, 165 insertions, 0 deletions
diff --git a/dev-ruby/websocket/Manifest b/dev-ruby/websocket/Manifest
index 87bed591bf96..e9240361a3a5 100644
--- a/dev-ruby/websocket/Manifest
+++ b/dev-ruby/websocket/Manifest
@@ -1,3 +1,5 @@
+AUX websocket-1.2.9-default-port.patch 4427 BLAKE2B 90268a5b0686a9a054ee4d0193a0890cdfd5d3e92c5bb502602aa3ba74c858879e1a5eb8a6f5e07e3cae9c53ea64e0c1ebe64bc017a2e395b3f609d43a83df5d SHA512 7a9fbf2a4160d187e6e833ec9ef918a619bc311521c10e6bc88e2d8e249e45dc168912fad05c3a4560aa9a6f2f96b1eaa541735b1f2dcb247410d82bae1f74ad
DIST websocket-1.2.9.gem 28160 BLAKE2B 1d0423050d26ee9c719de1803bd5fbcda80acb2c47825e2ad4203b8ac6e3e9a925fbe3cab8f5c0b283841dbfdbb97b753cc4f2c7a9c689486dadd9573b8fb87d SHA512 42044df313e1ca2525700decaac6f77b8bf9d4f1dd21723de408c636196e9f77c4b9d865abeb1de68575ad3b59ad48a9e7c30f0e16dbd15695958f8cf6ca3d57
EBUILD websocket-1.2.9-r1.ebuild 456 BLAKE2B aaf39296991f53d2420afb12079398d077161c10227610406c58dc352cad6fa221ae5f01538530c436e64fdc22e94126097782aae20e879e6e209adcbd928776 SHA512 727dcafa0759cc4160c5cb1aeedafc191399281a9c11cd796fadb32be7b6c75d8c5082051f885389c6ed50c2ee5be01a9d0516d5c41cc4a2f39088c9ea9bde73
+EBUILD websocket-1.2.9-r2.ebuild 540 BLAKE2B b304dfa6a91fb9150d698196e6476ec60c233d177d370c9947c8b2ccbe1d4af016dd3ca1b04deb8f43f50c6986666fa7999d334d7261b56c9431ec482e00e7cb SHA512 e6e767444565ee65ef165b5a9e1196c318ea536dfbad4b4293dfbb5d626e8f715c18f762923b51e877fe23ff8e4b75047bea26febae63c96e8dfb317c7eed7de
MISC metadata.xml 348 BLAKE2B 97c5037c95e1f278b4e7607286707298751b9aef68d81d99448842de0561c9657e191dc72ddb530e0202c6be2c0433482d1e0066bd56dcab3b0edd8daa6195d2 SHA512 7d0a8b7a151834686c239ef6f56d2648701f37512fdd1effd3cca0204e2dc445a586bfad9acfb7b38c094db15154b861a31c6dc9bbeba7559932e87d61742821
diff --git a/dev-ruby/websocket/files/websocket-1.2.9-default-port.patch b/dev-ruby/websocket/files/websocket-1.2.9-default-port.patch
new file mode 100644
index 000000000000..5830036da62e
--- /dev/null
+++ b/dev-ruby/websocket/files/websocket-1.2.9-default-port.patch
@@ -0,0 +1,134 @@
+https://github.com/imanel/websocket-ruby/commit/736a7515aff808a5c268b87066e928b59aed769e
+
+From 736a7515aff808a5c268b87066e928b59aed769e Mon Sep 17 00:00:00 2001
+From: Bernard Potocki <bernard.potocki@imanel.org>
+Date: Thu, 17 Feb 2022 20:02:21 +0100
+Subject: [PATCH] Ensure correct port is always specified (#48)
+
+--- a/lib/websocket/handshake/base.rb
++++ b/lib/websocket/handshake/base.rb
+@@ -7,7 +7,7 @@ class Base
+ include ExceptionHandler
+ include NiceInspect
+
+- attr_reader :host, :port, :path, :query,
++ attr_reader :host, :path, :query,
+ :state, :version, :secure,
+ :headers, :protocols
+
+@@ -66,6 +66,20 @@ def leftovers
+ (@leftovers.to_s.split("\n", reserved_leftover_lines + 1)[reserved_leftover_lines] || '').strip
+ end
+
++ # Return default port for protocol (80 for ws, 443 for wss)
++ def default_port
++ secure ? 443 : 80
++ end
++
++ # Check if provided port is a default one
++ def default_port?
++ port == default_port
++ end
++
++ def port
++ @port || default_port
++ end
++
+ # URI of request.
+ # @return [String] Full URI with protocol
+ # @example
+@@ -73,7 +87,7 @@ def leftovers
+ def uri
+ uri = String.new(secure ? 'wss://' : 'ws://')
+ uri << host
+- uri << ":#{port}" if port
++ uri << ":#{port}" unless default_port?
+ uri << path
+ uri << "?#{query}" if query
+ uri
+--- a/lib/websocket/handshake/client.rb
++++ b/lib/websocket/handshake/client.rb
+@@ -61,7 +61,7 @@ def initialize(args = {})
+ uri = URI.parse(@url || @uri)
+ @secure ||= (uri.scheme == 'wss')
+ @host ||= uri.host
+- @port ||= uri.port
++ @port ||= uri.port || default_port
+ @path ||= uri.path
+ @query ||= uri.query
+ end
+--- a/lib/websocket/handshake/handler/client04.rb
++++ b/lib/websocket/handshake/handler/client04.rb
+@@ -21,7 +21,7 @@ def handshake_keys
+ %w[Connection Upgrade]
+ ]
+ host = @handshake.host
+- host += ":#{@handshake.port}" if @handshake.port
++ host += ":#{@handshake.port}" unless @handshake.default_port?
+ keys << ['Host', host]
+ keys += super
+ keys << ['Sec-WebSocket-Origin', @handshake.origin] if @handshake.origin
+--- a/lib/websocket/handshake/handler/client75.rb
++++ b/lib/websocket/handshake/handler/client75.rb
+@@ -18,7 +18,7 @@ def handshake_keys
+ %w[Connection Upgrade]
+ ]
+ host = @handshake.host
+- host += ":#{@handshake.port}" if @handshake.port
++ host += ":#{@handshake.port}" unless @handshake.default_port?
+ keys << ['Host', host]
+ keys << ['Origin', @handshake.origin] if @handshake.origin
+ keys << ['WebSocket-Protocol', @handshake.protocols.first] if @handshake.protocols.any?
+--- a/lib/websocket/handshake/server.rb
++++ b/lib/websocket/handshake/server.rb
+@@ -129,13 +129,13 @@ def should_respond?
+ # Host of server according to client header
+ # @return [String] host
+ def host
+- @headers['host'].to_s.split(':')[0].to_s
++ @host || @headers['host'].to_s.split(':')[0].to_s
+ end
+
+ # Port of server according to client header
+- # @return [String] port
++ # @return [Integer] port
+ def port
+- @headers['host'].to_s.split(':')[1]
++ (@port || @headers['host'].to_s.split(':')[1] || default_port).to_i
+ end
+
+ private
+--- a/spec/support/all_client_drafts.rb
++++ b/spec/support/all_client_drafts.rb
+@@ -38,6 +38,10 @@ def validate_request
+ expect(handshake.query).to eql('aaa=bbb')
+ end
+
++ it 'returns default port' do
++ expect(handshake.port).to be(80)
++ end
++
+ it 'returns valid port' do
+ @request_params = { port: 123 }
+ expect(handshake.port).to be(123)
+--- a/spec/support/all_server_drafts.rb
++++ b/spec/support/all_server_drafts.rb
+@@ -47,11 +47,17 @@ def validate_request
+ expect(handshake.query).to eql('aaa=bbb')
+ end
+
++ it 'returns default port' do
++ handshake << client_request
++
++ expect(handshake.port).to be(80)
++ end
++
+ it 'returns valid port' do
+ @request_params = { port: 123 }
+ handshake << client_request
+
+- expect(handshake.port).to eql('123')
++ expect(handshake.port).to be(123)
+ end
+
+ it 'returns valid response' do
diff --git a/dev-ruby/websocket/websocket-1.2.9-r2.ebuild b/dev-ruby/websocket/websocket-1.2.9-r2.ebuild
new file mode 100644
index 000000000000..9c9d3b6ac7bf
--- /dev/null
+++ b/dev-ruby/websocket/websocket-1.2.9-r2.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+USE_RUBY="ruby27 ruby30 ruby31 ruby32"
+
+RUBY_FAKEGEM_RECIPE_TEST="rspec3"
+
+inherit ruby-fakegem
+
+DESCRIPTION="Universal Ruby library to handle WebSocket protocol"
+HOMEPAGE="https://github.com/imanel/websocket-ruby"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
+IUSE=""
+
+ruby_add_bdepend "
+ test? (
+ dev-ruby/rspec-its
+ dev-ruby/webrick
+ )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-default-port.patch
+)