Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #10776 from EOSIO/pdr/fix_https_r22x
Browse files Browse the repository at this point in the history
fix https bug (release 2.2.x)
  • Loading branch information
praphael authored Oct 4, 2021
2 parents b03d7b7 + e4a8b3e commit e04eb7a
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 11 deletions.
22 changes: 11 additions & 11 deletions plugins/http_plugin/http_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,17 @@ class http_plugin_impl : public std::enable_shared_from_this<http_plugin_impl> {

void http_plugin::plugin_initialize(const variables_map& options) {
try {
my->max_body_size = options.at( "max-body-size" ).as<uint32_t>();
verbose_http_errors = options.at( "verbose-http-errors" ).as<bool>();

my->thread_pool_size = options.at( "http-threads" ).as<uint16_t>();
EOS_ASSERT( my->thread_pool_size > 0, chain::plugin_config_exception,
"http-threads ${num} must be greater than 0", ("num", my->thread_pool_size));

my->max_bytes_in_flight = options.at( "http-max-bytes-in-flight-mb" ).as<uint32_t>() * 1024 * 1024;
my->max_requests_in_flight = options.at( "http-max-in-flight-requests" ).as<int32_t>();
my->max_response_time = fc::microseconds( options.at("http-max-response-time-ms").as<uint32_t>() * 1000 );

my->validate_host = options.at("http-validate-host").as<bool>();
if( options.count( "http-alias" )) {
const auto& aliases = options["http-alias"].as<vector<string>>();
Expand Down Expand Up @@ -835,17 +846,6 @@ class http_plugin_impl : public std::enable_shared_from_this<http_plugin_impl> {
}
}

my->max_body_size = options.at( "max-body-size" ).as<uint32_t>();
verbose_http_errors = options.at( "verbose-http-errors" ).as<bool>();

my->thread_pool_size = options.at( "http-threads" ).as<uint16_t>();
EOS_ASSERT( my->thread_pool_size > 0, chain::plugin_config_exception,
"http-threads ${num} must be greater than 0", ("num", my->thread_pool_size));

my->max_bytes_in_flight = options.at( "http-max-bytes-in-flight-mb" ).as<uint32_t>() * 1024 * 1024;
my->max_requests_in_flight = options.at( "http-max-in-flight-requests" ).as<int32_t>();
my->max_response_time = fc::microseconds( options.at("http-max-response-time-ms").as<uint32_t>() * 1000 );

//watch out for the returns above when adding new code here
} FC_LOG_AND_RETHROW()
}
Expand Down
5 changes: 5 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/light_validation_sync_test.py ${CMAKE
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/eosio_blocklog_prune_test.py ${CMAKE_CURRENT_BINARY_DIR}/eosio_blocklog_prune_test.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cli_test.py ${CMAKE_CURRENT_BINARY_DIR}/cli_test.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/plugin_http_api_test.py ${CMAKE_CURRENT_BINARY_DIR}/plugin_http_api_test.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/http_plugin_test.py ${CMAKE_CURRENT_BINARY_DIR}/http_plugin_test.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/resource_monitor_plugin_test.py ${CMAKE_CURRENT_BINARY_DIR}/resource_monitor_plugin_test.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rodeos_test.py ${CMAKE_CURRENT_BINARY_DIR}/rodeos_test.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test_filter.wasm ${CMAKE_CURRENT_BINARY_DIR}/test_filter.wasm COPYONLY)
Expand Down Expand Up @@ -267,6 +268,10 @@ add_test(NAME plugin_http_api_test COMMAND tests/plugin_http_api_test.py WORKING
set_tests_properties(plugin_http_api_test PROPERTIES TIMEOUT 40)
set_property(TEST plugin_http_api_test PROPERTY LABELS nonparallelizable_tests)

add_test(NAME http_plugin_test COMMAND tests/http_plugin_test.py WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_tests_properties(http_plugin_test PROPERTIES TIMEOUT 100)
set_property(TEST http_plugin_test PROPERTY LABELS nonparallelizable_tests)

add_test(NAME trace_plugin_test COMMAND tests/trace_plugin_test.py WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_tests_properties(trace_plugin_test PROPERTIES TIMEOUT 150)
set_property(TEST trace_plugin_test PROPERTY LABELS nonparallelizable_tests)
Expand Down
56 changes: 56 additions & 0 deletions tests/http_plugin_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python3

from testUtils import Utils
from Cluster import Cluster
from Node import Node
from Node import ReturnType
from TestHelper import TestHelper

###############################################################
# http_plugin_tests.py
#
# Integration tests for HTTP plugin
#
###############################################################

Print=Utils.Print
errorExit=Utils.errorExit
cmdError=Utils.cmdError

args = TestHelper.parse_args({"-v","--clean-run", "--dump-error-details","--keep-logs"})
debug=args.v
killAll=args.clean_run
killEosInstances = True
keepLogs = args.keep_logs
dumpErrorDetails = dumpErrorDetails=args.dump_error_details


Utils.Debug=debug
https_port = 5555
cluster=Cluster(walletd=True)

testSuccessful=False

ClientName="cleos"
timeout = .5 * 12 * 2 + 60 # time for finalization with 1 producer + 60 seconds padding
Utils.setIrreversibleTimeout(timeout)

try:
TestHelper.printSystemInfo("BEGIN")

Print("Stand up cluster")
# standup cluster with HTTPS enabled, but not configured
# HTTP should still work
extraArgs={ 0 : "--https-server-address 127.0.0.1:5555" }
# specificExtraNodeosArgs=extraArgs

if cluster.launch(dontBootstrap=True, loadSystemContract=False) is False:
cmdError("launcher")
errorExit("Failed to stand up eos cluster.")

Print("Getting cluster info")
cluster.getInfos()
testSuccessful = True
finally:
TestHelper.shutdown(cluster, None, testSuccessful, killEosInstances, True, keepLogs, killAll, dumpErrorDetails)

0 comments on commit e04eb7a

Please sign in to comment.