[mod_curl] fixes 'Unparsable header' error message on HTTP/2 200 reply

This commit is contained in:
brianomchugh 2025-05-21 05:35:22 -04:00 committed by GitHub
parent 6a13dee6f8
commit 6a25584da2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -381,6 +381,10 @@ static char *print_json(switch_memory_pool_t *pool, http_data_t *http_data)
if (argc > 2) {
cJSON_AddItemToObject(top, "version", cJSON_CreateString(argv[0]));
cJSON_AddItemToObject(top, "phrase", cJSON_CreateString(argv[2]));
} else if (argc == 2 && strcmp(argv[0], "HTTP/2") == 0) {
/* HTTP/2 responses may not include a phrase */
cJSON_AddItemToObject(top, "version", cJSON_CreateString(argv[0]));
cJSON_AddItemToObject(top, "phrase", cJSON_CreateString(""));
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unparsable header: argc: %d\n", argc);
}