Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
ruby-passwordstate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LiU IT - Infrastructure
ruby-passwordstate
Commits
e8647ff3
Verified
Commit
e8647ff3
authored
6 years ago
by
Alexander Olofsson
Browse files
Options
Downloads
Patches
Plain Diff
Add configurable read timeout
parent
b62e14bb
No related branches found
No related tags found
No related merge requests found
Pipeline
#3379
failed
6 years ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/passwordstate/client.rb
+8
-0
8 additions, 0 deletions
lib/passwordstate/client.rb
with
8 additions
and
0 deletions
lib/passwordstate/client.rb
+
8
−
0
View file @
e8647ff3
...
@@ -9,6 +9,7 @@ module Passwordstate
...
@@ -9,6 +9,7 @@ module Passwordstate
}.
freeze
}.
freeze
attr_accessor
:server_url
,
:auth_data
,
:headers
,
:validate_certificate
attr_accessor
:server_url
,
:auth_data
,
:headers
,
:validate_certificate
attr_reader
:timeout
attr_writer
:api_type
attr_writer
:api_type
def
initialize
(
url
,
options
=
{})
def
initialize
(
url
,
options
=
{})
...
@@ -17,6 +18,7 @@ module Passwordstate
...
@@ -17,6 +18,7 @@ module Passwordstate
@headers
=
DEFAULT_HEADERS
@headers
=
DEFAULT_HEADERS
@auth_data
=
options
.
select
{
|
k
,
_v
|
%i[apikey username password]
.
include?
k
}
@auth_data
=
options
.
select
{
|
k
,
_v
|
%i[apikey username password]
.
include?
k
}
@api_type
=
options
.
fetch
(
:api_type
)
if
options
.
key?
:api_type
@api_type
=
options
.
fetch
(
:api_type
)
if
options
.
key?
:api_type
@timeout
=
options
.
fetch
(
:timeout
,
0
)
end
end
def
logger
def
logger
...
@@ -27,6 +29,11 @@ module Passwordstate
...
@@ -27,6 +29,11 @@ module Passwordstate
@api_type
||
(
auth_data
.
key?
(
:apikey
)
?
:api
:
:winapi
)
@api_type
||
(
auth_data
.
key?
(
:apikey
)
?
:api
:
:winapi
)
end
end
def
timeout
=
(
sec
)
@timeout
=
sec
@http
.
read_timeout
=
sec
if
@http
end
def
folders
def
folders
ResourceList
.
new
self
,
Passwordstate
::
Resources
::
Folder
,
ResourceList
.
new
self
,
Passwordstate
::
Resources
::
Folder
,
only:
%i[all search post]
only:
%i[all search post]
...
@@ -115,6 +122,7 @@ module Passwordstate
...
@@ -115,6 +122,7 @@ module Passwordstate
@http
||=
Net
::
HTTP
.
new
server_url
.
host
,
server_url
.
port
@http
||=
Net
::
HTTP
.
new
server_url
.
host
,
server_url
.
port
return
@http
if
@http
.
active?
return
@http
if
@http
.
active?
@http
.
read_timeout
=
@timeout
if
@timeout
@http
.
use_ssl
=
server_url
.
scheme
==
'https'
@http
.
use_ssl
=
server_url
.
scheme
==
'https'
@http
.
verify_mode
=
validate_certificate
?
::
OpenSSL
::
SSL
::
VERIFY_NONE
:
nil
@http
.
verify_mode
=
validate_certificate
?
::
OpenSSL
::
SSL
::
VERIFY_NONE
:
nil
@http
.
start
@http
.
start
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment