Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timeout and tests for curb, also added the gem curb that was not part of selenium #14285

Merged
merged 52 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d83ff7e
Add timeout and tests for curb, also added the gem curb that was not …
aguspe Jul 19, 2024
7ff5293
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Jul 19, 2024
ab7c387
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Jul 24, 2024
7723d51
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Jul 24, 2024
21703f8
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Jul 25, 2024
01208da
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Aug 1, 2024
0a1be6d
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Aug 3, 2024
b7bef9f
Update gemfile lock
aguspe Aug 3, 2024
aca97ab
Merge remote-tracking branch 'origin/rb_fix_curb_http_client' into rb…
aguspe Aug 3, 2024
f37500a
Gemfile updated and loaded on spec
aguspe Aug 4, 2024
ea55716
Merge branch 'trunk' into rb_fix_curb_http_client
diemol Aug 8, 2024
97d2608
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Aug 10, 2024
8f1f273
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Aug 10, 2024
ef41b67
Update checksums
aguspe Aug 10, 2024
7fea303
Merge remote-tracking branch 'origin/rb_fix_curb_http_client' into rb…
aguspe Aug 10, 2024
1ab7a34
Review comments updated
aguspe Aug 10, 2024
c6ed50d
Remove curb from jruby reference
aguspe Aug 10, 2024
473a913
Guard for platforms not supporting curb
aguspe Aug 11, 2024
0066cb2
Use only darwin as a platform for curb
aguspe Aug 11, 2024
ee8edba
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Aug 12, 2024
4b5c9e6
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Aug 16, 2024
5e12850
Add conditional for curb
aguspe Aug 16, 2024
3372065
Add libcurl installation
aguspe Aug 16, 2024
60aa9fe
Update checksums and bazel lib curl step
aguspe Aug 16, 2024
6738d3c
Remove extra space line
aguspe Aug 16, 2024
0b39528
FIx format and add windows curl
aguspe Aug 16, 2024
ff7941c
Fix chocolatey
aguspe Aug 16, 2024
62e48c0
Fix format
aguspe Aug 16, 2024
9da8827
Update module and try to set curl dir
aguspe Aug 16, 2024
f7c4c7a
Update module and try to set curl dir
aguspe Aug 16, 2024
deb0ede
Change curl config
aguspe Aug 16, 2024
cb333cd
Try with bazel
aguspe Aug 16, 2024
8301eb8
Try with bazel
aguspe Aug 16, 2024
0a2d057
Use msys to install curl
aguspe Aug 16, 2024
be8f39b
Using with instead of run
aguspe Aug 16, 2024
458959c
Install curl library
aguspe Aug 17, 2024
0422961
Add libyaml
aguspe Aug 17, 2024
ada6c33
Run bazel format
aguspe Aug 18, 2024
9710a13
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Aug 18, 2024
f34a245
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Aug 19, 2024
42918b8
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Aug 19, 2024
0bd2a2a
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Aug 19, 2024
0eeba47
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Aug 19, 2024
be797b2
Update require curl on the curl spec
aguspe Aug 20, 2024
cf12ce2
Merge branch 'trunk' into rb_fix_curb_http_client
aguspe Aug 20, 2024
7103eca
Update rescue with comment
aguspe Aug 20, 2024
3f617b0
Require curb added again
aguspe Aug 20, 2024
e6158a9
Require curb added again
aguspe Aug 20, 2024
42ab4a2
Update guard clause
aguspe Aug 20, 2024
0559ebe
Update to RUBY_PLATFORM
aguspe Aug 20, 2024
05c77ad
Try with ruby engine
aguspe Aug 20, 2024
e1674f7
Update to remove truffle ruby
aguspe Aug 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rb/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ PATH
selenium-webdriver (~> 4.2)
selenium-webdriver (4.24.0.nightly)
base64 (~> 0.2)
curb (~> 1.0.5)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
Expand Down Expand Up @@ -35,6 +36,7 @@ GEM
bigdecimal
rexml
csv (3.3.0)
curb (1.0.5)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
Expand Down
3 changes: 2 additions & 1 deletion rb/lib/selenium/webdriver/remote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ module Remote
autoload :Capabilities, 'selenium/webdriver/remote/capabilities'

module Http
autoload :Common, 'selenium/webdriver/remote/http/common'
autoload :Common, 'selenium/webdriver/remote/http/common'
autoload :Curb, 'selenium/webdriver/remote/http/curb'
aguspe marked this conversation as resolved.
Show resolved Hide resolved
autoload :Default, 'selenium/webdriver/remote/http/default'
end
end
Expand Down
20 changes: 14 additions & 6 deletions rb/lib/selenium/webdriver/remote/http/curb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ module Http
#

class Curb < Common
attr_accessor :timeout

def initialize(timeout: nil)
@timeout = timeout
super()
end

def quit_errors
[Curl::Err::RecvError] + super
end
Expand All @@ -53,7 +60,7 @@ def request(verb, url, headers, payload)
client.headers = headers

# http://github.com/taf2/curb/issues/issue/33
client.head = false
client.head = false
client.delete = false

case verb
Expand All @@ -80,15 +87,16 @@ def client
@client ||= begin
c = Curl::Easy.new

c.max_redirects = MAX_REDIRECTS
c.max_redirects = MAX_REDIRECTS
c.follow_location = true
c.timeout = @timeout if @timeout
c.verbose = WebDriver.logger.debug?

c.timeout = timeout if timeout
c.verbose = WebDriver.logger.debug?
c
end
end
end # Curb
end

# Curb
end # Http
end # Remote
end # WebDriver
Expand Down
1 change: 1 addition & 0 deletions rb/selenium-webdriver.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Gem::Specification.new do |s|
s.require_paths = ['lib']

s.add_dependency 'base64', ['~> 0.2']
s.add_dependency 'curb', ['~> 1.0.5']
aguspe marked this conversation as resolved.
Show resolved Hide resolved
s.add_dependency 'logger', ['~> 1.4']
s.add_dependency 'rexml', ['~> 3.2', '>= 3.2.5']
s.add_dependency 'rubyzip', ['>= 1.2.2', '< 3.0']
Expand Down
5 changes: 5 additions & 0 deletions rb/sig/gems/curb/curl.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Curl
class Easy
def initialize: () -> void
end
end
10 changes: 7 additions & 3 deletions rb/sig/lib/selenium/webdriver/remote/http/curb.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ module Selenium
class Curb < Common
@client: untyped

def quit_errors: () -> untyped
attr_accessor timeout: Numeric?

def initialize: (timeout: Numeric?) -> void

def quit_errors: () -> Array[StandardError]

private

def request: (untyped verb, untyped url, untyped headers, untyped payload) -> untyped
def request: (Symbol verb, URI | String url, Hash[String, String] headers, String payload) -> Remote::Response

def client: () -> untyped
def client: () -> Curl::Easy
end
end
end
Expand Down
51 changes: 51 additions & 0 deletions rb/spec/unit/selenium/webdriver/remote/http/curb_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# frozen_string_literal: true

# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

require File.expand_path('../../spec_helper', __dir__)
aguspe marked this conversation as resolved.
Show resolved Hide resolved

module Selenium
module WebDriver
module Remote
module Http
describe Curb do
subject(:curb) { described_class.new }

it 'assigns default timeout to 0.0' do
http = curb.send :client

expect(http.timeout).to eq 0.0
end

it 'sets the timeout' do
curb.timeout = 20
expect(curb.timeout).to eq 20
end

describe '#initialize' do
let(:curb) { described_class.new(timeout: 10) }

it 'is initialized with timeout' do
expect(curb.timeout).to eq 10
end
end
end
end # Http
end # Remote
end # WebDriver
end # Selenium