OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#51738] Enable HTTPX persistent connections.
Pavel Balashou95476f616425
diff --git a/lib/open_project.rb b/lib/open_project.rbindex 21f2371dd65..31cb5245df1 100644--- a/lib/open_project.rb+++ b/lib/open_project.rb@@ -44,4 +44,11 @@ module OpenProjectdef self.logger::OpenProject::Logging::LogDelegatorend++ def self.httpx+ HTTPX+ .plugin(:persistent)+ .plugin(:basic_auth)+ .plugin(:webdav)+ endenddiff --git a/modules/storages/app/common/storages/peripherals/oauth_configurations/nextcloud_configuration.rb b/modules/storages/app/common/storages/peripherals/oauth_configurations/nextcloud_configuration.rbindex 047e028946e..1c0a841b744 100644--- a/modules/storages/app/common/storages/peripherals/oauth_configurations/nextcloud_configuration.rb+++ b/modules/storages/app/common/storages/peripherals/oauth_configurations/nextcloud_configuration.rb@@ -43,7 +43,7 @@ module Storagesutil = ::Storages::Peripherals::StorageInteraction::Nextcloud::Utilauthorization_check_wrapper do- HTTPX.get(+ OpenProject.httpx.get(util.join_uri_path(@uri, '/ocs/v1.php/cloud/user'),headers: {'Authorization' => "Bearer #{token}",diff --git a/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rb b/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rbindex efc48d2599d..462d1c24c5d 100644--- a/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rb+++ b/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rb@@ -47,7 +47,7 @@ module Storagesutil = ::Storages::Peripherals::StorageInteraction::OneDrive::Utilauthorization_check_wrapper do- HTTPX.get(+ OpenProject.httpx.get(util.join_uri_path(@uri, '/v1.0/me'),headers: { 'Authorization' => "Bearer #{access_token}", 'Accept' => 'application/json' }).status@@ -57,7 +57,7 @@ module Storagesdef extract_origin_user_id(rack_access_token)util = ::Storages::Peripherals::StorageInteraction::OneDrive::Util- HTTPX.get(+ OpenProject.httpx.get(util.join_uri_path(@uri, '/v1.0/me'),headers: { 'Authorization' => "Bearer #{rack_access_token.access_token}", 'Accept' => 'application/json' }).raise_for_status.json['id']diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/add_user_to_group_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/add_user_to_group_command.rbindex 47bac702ae2..8a03142d9b5 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/add_user_to_group_command.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/add_user_to_group_command.rb@@ -43,7 +43,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloudenddef call(user:, group: @group)- response = Util+ response = OpenProject.httpx.basic_auth(@username, @password).with(headers: { 'OCS-APIRequest' => 'true' })diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command.rbindex 4fa9b23b21f..7ee9dd5a864 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command.rb@@ -79,7 +79,7 @@ module Storages::Peripherals::StorageInteraction::Nextclouddef validate_destination->(urls) do- response = Util+ response = OpenProject.httpx.basic_auth(@username, @password).head(urls[:destination_url])@@ -99,7 +99,7 @@ module Storages::Peripherals::StorageInteraction::Nextclouddef copy_folder->(urls) do- response = Util+ response = OpenProject.httpx.basic_auth(@username, @password).request("COPY",diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/create_folder_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/create_folder_command.rbindex 1724f7697e1..c1ec835743e 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/create_folder_command.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/create_folder_command.rb@@ -44,7 +44,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud# rubocop:disable Metrics/AbcSizedef call(folder_path:)- response = Util+ response = OpenProject.httpx.basic_auth(@username, @password).mkcol(diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/download_link_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/download_link_query.rbindex 0184867923a..3f657a54a0e 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/download_link_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/download_link_query.rb@@ -45,7 +45,7 @@ module Storages::Peripherals::StorageInteraction::Nextclouddef call(user:, file_link:)result = Util.token(user:, configuration: @configuration) do |token|service_result = begin- response = Util+ response = OpenProject.httpx.post(Util.join_uri_path(@uri, '/ocs/v2.php/apps/dav/api/v1/direct'),diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rbindex 77df6fb0705..58849d70b34 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb@@ -52,7 +52,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloudprivatedef file_info(file_id, token)- response = Util+ response = OpenProject.httpx.with(headers: { 'Authorization' => "Bearer #{token.access_token}",'Accept' => 'application/json',diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_info_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_info_query.rbindex 8d9017a4998..37560dbc1a0 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_info_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_info_query.rb@@ -60,7 +60,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloudprivatedef files_info(file_ids, token)- response = Util+ response = OpenProject.httpx.with(headers: { 'Authorization' => "Bearer #{token.access_token}",'Accept' => 'application/json',diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rbindex 4e96c42d7e0..e083270ad89 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb@@ -41,7 +41,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloudresult = Util.token(user:, configuration: @configuration) do |token|@location_prefix = Util.join_uri_path(@uri.path, "remote.php/dav/files", token.origin_user_id.gsub(' ', '%20'))- response = Util+ response = OpenProject.httpx.request("PROPFIND",diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/group_users_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/group_users_query.rbindex 1450e2e4153..e4556e87e39 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/group_users_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/group_users_query.rb@@ -44,7 +44,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud# rubocop:disable Metrics/AbcSizedef call(group:)- response = Util+ response = OpenProject.httpx.basic_auth(@username, @password).with(headers: {'OCS-APIRequest' => 'true'})diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/delete_entity_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/delete_entity_command.rbindex 2c848aeb040..c903a7901d7 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/delete_entity_command.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/delete_entity_command.rb@@ -41,7 +41,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud::Internalenddef call(location:)- response = UTIL+ response = OpenProject.httpx.basic_auth(@username, @password).delete(UTIL.join_uri_path(@uri,diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/propfind_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/propfind_query.rbindex cd37e9eea16..3c64fbd2c61 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/propfind_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/propfind_query.rb@@ -90,7 +90,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud::Internalendend.to_xml- response = UTIL+ response = OpenProject.httpx.basic_auth(@username, @password).with(headers: { "Depth" => depth})diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/remove_user_from_group_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/remove_user_from_group_command.rbindex 1fc5f256b62..44d53baa7d9 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/remove_user_from_group_command.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/remove_user_from_group_command.rb@@ -43,7 +43,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud# rubocop:disable Metrics/AbcSizedef call(user:, group: @group)- response = Util+ response = OpenProject.httpx.basic_auth(@username, @password).with(headers: { 'OCS-APIRequest' => 'true' })diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/rename_file_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/rename_file_command.rbindex 3a84be73ae7..1c22a09034e 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/rename_file_command.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/rename_file_command.rb@@ -44,7 +44,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloudenddef call(source:, target:)- response = Util+ response = OpenProject.httpx.basic_auth(@username, @password).request(diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rbindex e856b0b965f..3ad8751b4cc 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb@@ -79,7 +79,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloudendend.to_xml- response = Util+ response = OpenProject.httpx.basic_auth(@username, @password).request(diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/upload_link_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/upload_link_query.rbindex 71f7c258ba0..7b6e6aea72d 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/upload_link_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/upload_link_query.rb@@ -66,7 +66,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloudprivatedef outbound_response(method:, relative_path:, payload:, token:)- response = Util+ response = OpenProject.httpx.with(headers: { 'Authorization' => "Bearer #{token.access_token}",'Accept' => 'application/json',diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/util.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/util.rbindex 9f87ba73fed..c41aa76ffed 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/util.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/util.rb@@ -73,10 +73,6 @@ module Storages::Peripherals::StorageInteraction::Nextcloud::Util)end- def httpx- HTTPX.plugin(:basic_auth).plugin(:webdav)- end-def error_text_from_response(response)Nokogiri::XML(response.body).xpath("//s:message").textenddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/download_link_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/download_link_query.rbindex ea1ec7ac2e5..05ceec46c45 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/download_link_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/download_link_query.rb@@ -44,7 +44,7 @@ module Storagesdef call(user:, file_link:)Util.using_user_token(@storage, user) do |token|- response = HTTPX.get(+ response = OpenProject.httpx.get(Util.join_uri_path(@uri,uri_path_for(file_link.origin_id)diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rbindex 972db4b0024..ae8131ed2d6 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb@@ -48,7 +48,7 @@ module Storagesdef call(user:, folder:)result = Util.using_user_token(@storage, user) do |token|- response = HTTPX.get(+ response = OpenProject.httpx.get(Util.join_uri_path(@uri, children_uri_path_for(folder) + FIELDS),headers: { 'Authorization' => "Bearer #{token.access_token}" })@@ -108,7 +108,7 @@ module Storagesdef empty_response(user, folder)result = Util.using_user_token(@storage, user) do |token|- response = HTTPX.get(+ response = OpenProject.httpx.get(Util.join_uri_path(@uri, location_uri_path_for(folder) + FIELDS),headers: { 'Authorization' => "Bearer #{token.access_token}" })diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/internal/drive_item_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/internal/drive_item_query.rbindex 4bbc974e7c9..ba5d730c5ba 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/internal/drive_item_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/internal/drive_item_query.rb@@ -60,7 +60,7 @@ module Storagesprivatedef make_file_request(drive_item_id, token, select_url_query)- response = HTTPX.get(+ response = OpenProject.httpx.get(UTIL.join_uri_path(@uri, uri_path_for(drive_item_id) + select_url_query),headers: { 'Authorization' => "Bearer #{token.access_token}" })diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_storage_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_storage_query.rbindex 6d60844943c..5245e358821 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_storage_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_storage_query.rb@@ -51,7 +51,7 @@ module Storagesprivatedef request_drive(token)- response = HTTPX.get(+ response = OpenProject.httpx.get(Util.join_uri_path(@uri, drive_uri_path),headers: { 'Authorization' => "Bearer #{token.access_token}" })diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/upload_link_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/upload_link_query.rbindex b0600baf03a..1c778689343 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/upload_link_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/upload_link_query.rb@@ -46,7 +46,7 @@ module Storagesfolder, filename = data.slice('parent', 'file_name').valuesUtil.using_user_token(@storage, user) do |token|- response = HTTPX+ response = OpenProject.httpx.with(headers: { 'Authorization' => "Bearer #{token.access_token}",'Content-Type' => 'application/json' }).post(diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rbindex 9b51c67d185..27c3eaabcc5 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb@@ -73,7 +73,7 @@ module Storages::Peripherals::StorageInteraction::OneDrive::Utiloauth_client.access_token!(scope: 'https://graph.microsoft.com/.default')end- yield HTTPX.with(+ yield OpenProject.httpx.with(origin: storage.uri,headers: {authorization: "Bearer #{token.access_token}", accept: "application/json", 'content-type': 'application/json'diff --git a/modules/storages/app/validator/nextcloud_application_credentials_validator.rb b/modules/storages/app/validator/nextcloud_application_credentials_validator.rbindex cfff7a3a5fc..b4fc0f24c56 100644--- a/modules/storages/app/validator/nextcloud_application_credentials_validator.rb+++ b/modules/storages/app/validator/nextcloud_application_credentials_validator.rb@@ -38,7 +38,7 @@ class NextcloudApplicationCredentialsValidatordef callreturn unless contract.model.password_changed?- response = UTIL+ response = OpenProject.httpx.basic_auth(contract.username, contract.password).head(UTIL.join_uri_path(uri, "remote.php/dav"))diff --git a/modules/storages/app/validator/nextcloud_compatible_host_validator.rb b/modules/storages/app/validator/nextcloud_compatible_host_validator.rbindex 8c53bc2c03c..53881af9c1f 100644--- a/modules/storages/app/validator/nextcloud_compatible_host_validator.rb+++ b/modules/storages/app/validator/nextcloud_compatible_host_validator.rb@@ -29,8 +29,7 @@ class NextcloudCompatibleHostValidator < ActiveModel::EachValidatorMINIMAL_NEXTCLOUD_VERSION = 22AUTHORIZATION_HEADER = "Bearer TESTBEARERTOKEN".freeze- HTTPX_TIMEOUT_SETTINGS = { timeout: { connect_timeout: 5, read_timeout: 3 } }-+ HTTPX_TIMEOUT_SETTINGS = { timeout: { connect_timeout: 5, read_timeout: 3 } }.freezedef validate_each(contract, attribute, value)return if contract.model.changed_attributes.exclude?(attribute)@@ -46,7 +45,7 @@ class NextcloudCompatibleHostValidator < ActiveModel::EachValidatorresponse =begin- HTTPX+ OpenProject.httpx.with(HTTPX_TIMEOUT_SETTINGS).get(uri, headers: { "Ocs-Apirequest" => "true", "Accept" => "application/json" })rescue StandardError => e@@ -78,7 +77,7 @@ class NextcloudCompatibleHostValidator < ActiveModel::EachValidatoruri = URI.parse(File.join(value, 'index.php/apps/integration_openproject/check-config'))response =begin- HTTPX+ OpenProject.httpx.with(HTTPX_TIMEOUT_SETTINGS).get(uri, headers: { "Authorization" => AUTHORIZATION_HEADER })rescue StandardError => e