]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_curl] fixes 'Unparsable header' error message on HTTP/2 200 reply
authorbrianomchugh <brianomchugh@gmail.com>
Wed, 21 May 2025 09:35:22 +0000 (05:35 -0400)
committerGitHub <noreply@github.com>
Wed, 21 May 2025 09:35:22 +0000 (12:35 +0300)
src/mod/applications/mod_curl/mod_curl.c

index cae06bdb302176f861b7b456c0d2405d134a1529..d443ae4adce0fc92750568443ae355b66327f57e 100644 (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);
                                        }