defdefault_redirect_uri_callback(uri, res) newuri = urify(res.header['location'][0]) if !http?(newuri) && !https?(newuri) warn("#{newuri}: a relative URI in location header which is not recommended") warn("'The field value consists of a single absolute URI' in HTTP spec") newuri = uri + newuri end if https?(uri) && !https?(newuri) raise BadResponseError.new("redirecting to non-https resource") end puts "redirect to: #{newuri}"if$DEBUG newuri end
HTTPClient::BadResponseError (redirecting to non-https resource)
plantuml-serverはdocker imageが既にあるので簡単に公開する事ができます。 外部サーバに立てると、誰でもアクセスできてしまうため、Basic認証を付けたいことがあります。WebのUIから使うだけならIDP連携でOAuth認証を入れてしまえば良いのですが、Visual Studio Codeのプラグインと連携させる場合は、OAuthは対応していないため、Basic認証にするしかありません。
By default, this uses rack-protection’s AuthenticityToken class to validate authenticity tokens. If you are using a rack based framework like sinatra, you can find an example of how to add authenticity tokens to your view here.
しかし、Concurrent::Promises.futureはfuture_onのshortcutであり、future_onはeval on immediatelyであるので、futureを作った時点で実行が始まります。そのため、zipとは関係なく、threadの状態はfullfilledになります。
Constructs new Future which will be resolved after block is evaluated on default executor. Evaluation begins immediately.
zipメソッドで処理を発火したい場合は、delayを使います。
sample program
threads = (1..5).map do|i| Concurrent::Promises.delay(i) do|i| n = rand(5) + 1 puts "[#{i}] start: #{Time.now} / sleep=#{n}" sleep n puts "[#{i}] finished: #{Time.now}" "result: #{i}" end end