Skip to content

Commit a9507a5

Browse files
committed
try the new host override
1 parent 2ccc3b2 commit a9507a5

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

Diff for: source/s3express_credentials_provider.c

+8-10
Original file line numberDiff line numberDiff line change
@@ -401,17 +401,17 @@ static struct aws_http_message *s_create_session_request_new(
401401
const struct aws_uri *endpoint_override) {
402402
struct aws_http_message *request = aws_http_message_new_request(allocator);
403403

404+
struct aws_byte_cursor host = host_value;
405+
/* NOTE: Only for Tests. */
406+
if (endpoint_override != NULL) {
407+
host = *aws_uri_host_name(endpoint_override);
408+
}
404409
struct aws_http_header host_header = {
405410
.name = g_host_header_name,
406-
.value = host_value,
411+
.value = host,
407412
};
408-
/* NOTE: Only for Tests.
409-
* Don't add the host header for endpoint override.
410-
*/
411-
if (endpoint_override == NULL) {
412-
if (aws_http_message_add_header(request, host_header)) {
413-
goto error;
414-
}
413+
if (aws_http_message_add_header(request, host_header)) {
414+
goto error;
415415
}
416416

417417
struct aws_http_header user_agent_header = {
@@ -571,8 +571,6 @@ static struct aws_s3express_session_creator *s_session_creator_new(
571571
.body_callback = s_on_incoming_body_fn,
572572
.finish_callback = s_on_request_finished,
573573
.signing_config = &s3express_signing_config,
574-
/* Override endpoint only for tests. */
575-
.endpoint = impl->mock_test.endpoint_override ? impl->mock_test.endpoint_override : NULL,
576574
.user_data = session_creator,
577575
.operation_name = aws_byte_cursor_from_c_str("CreateSession"),
578576
};

Diff for: tests/mock_s3_server/mock_s3_server.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ def handle_get_object(wrapper, request, parsed_path, head_request=False):
434434
else:
435435
RETRY_REQUEST_COUNT = 0
436436

437-
if (parsed_path.path == "/get_object_invalid_response_missing_content_range" or
438-
parsed_path.path == "/get_object_invalid_response_missing_etags" or
437+
if (parsed_path.path == "/get_object_invalid_response_missing_content_range" or
438+
parsed_path.path == "/get_object_invalid_response_missing_etags" or
439439
parsed_path.path == "/get_object_long_error"):
440440
# Don't generate the body for those requests
441441
return response_config
@@ -529,4 +529,4 @@ async def serve(port):
529529
print("KeyboardInterrupt - shutting down")
530530

531531
if __name__ == "__main__":
532-
trio.run(serve, 8080)
532+
trio.run(serve, 8181)

0 commit comments

Comments
 (0)