From 53b894170d38b09347dc29817ff7563d101abbd8 Mon Sep 17 00:00:00 2001 From: HoneyryderChuck Date: Thu, 1 Apr 2021 19:59:39 +0100 Subject: [PATCH] reinstated the legacy UDP#write for jruby, because there's no sendmsg_nonblock --- lib/httpx/io/udp.rb | 8 ++++++++ lib/httpx/plugins/aws_sigv4.rb | 1 + 2 files changed, 9 insertions(+) diff --git a/lib/httpx/io/udp.rb b/lib/httpx/io/udp.rb index e7d1f85d..e118cf0c 100644 --- a/lib/httpx/io/udp.rb +++ b/lib/httpx/io/udp.rb @@ -84,6 +84,14 @@ module HTTPX rescue IOError end end + + # In JRuby, sendmsg_nonblock is not implemented + def write(buffer) + siz = @io.send(buffer.to_s, 0, @host, @port) + log { "WRITE: #{siz} bytes..." } + buffer.shift!(siz) + siz + end if RUBY_ENGINE == "jruby" # :nocov: end end diff --git a/lib/httpx/plugins/aws_sigv4.rb b/lib/httpx/plugins/aws_sigv4.rb index 4d6e07bc..fd59750d 100644 --- a/lib/httpx/plugins/aws_sigv4.rb +++ b/lib/httpx/plugins/aws_sigv4.rb @@ -150,6 +150,7 @@ module HTTPX end def load_dependencies(klass) + require "digest/sha2" require "openssl" klass.plugin(:expect) klass.plugin(:compression)