From patchwork Fri Mar 22 22:30:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 12394 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 444D344892A for ; Sat, 23 Mar 2019 00:30:44 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2403F68A0C8; Sat, 23 Mar 2019 00:30:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3E0C2689FA6 for ; Sat, 23 Mar 2019 00:30:37 +0200 (EET) Received: by mail-pg1-f193.google.com with SMTP id y3so2417849pgk.12 for ; Fri, 22 Mar 2019 15:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=5wLLZYvNVdFGvHwo4VGdZm3NzdqWEkj9stVrD/YKEng=; b=FNP4B8nCZNmbgWsxFavCB6Bj+DgHa3Cdd4iiTJxgP9ez84iEUvSc1ny4jHwEr3DlXk HSbZ4ZwlG25m9fKJWg1aF3cwQH0jVcexSIL61eUXiBUPXzcSk2EBkI/jLMk6oDCG2RGR wu0qZcDMOZtRqWhDegPwNE6VvMXpJcyk2W8L28NY/0W20Eq4zQT4SXpC0zelnZKW42n2 Dt3hrcr29Krn1QbbUdoE3ccXYzg6yGQt88YVnoSnWUJcaMgt5q9Xy0nONN8wNFN+GNJu QRpSK8cIy7kQ8Wa8fAeU5NUo3nhy6YD6rwzsmZo1KnWoJDgoXFyHKLuFpVq1MAnaGirY WKFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=5wLLZYvNVdFGvHwo4VGdZm3NzdqWEkj9stVrD/YKEng=; b=hepwHiU2AQDfgsnihOc/d9YtU2WW173Ed3euP2dCogF0iEcPBrFVWk13FPKR7IMk4d a6EUHC1SxiJsim/R7QFe4lunI4EGSi49XNqMOEEcMAH7309nNio6KPN/44rpQTXjeqe5 7jMxOHUWdecwWYThVoTPmsJCcdsW0X3uO+FiQeP0D66sJIUXQFQE8OdIobnWVVhYQ9Fn utIQ+z9xvPWuGo7S8fW/mFGt53MKWKLJ8V1Yo/b+s0aoC5HWd6yPUzVtP4QK+sTrX4mM riYOfKAeIBcK7sV/sgQD4+5EZbBDQoARe22k1RKR9TPDx+PKM6qZfzJ6t5OREBkFVYFo br8w== X-Gm-Message-State: APjAAAW4owFNraFpb1497av6hTHsVEWtzjrmclIuZNIXaeTWpNYyMMD3 tzoWcisRlrtShWXa6CVo+bNTnghu X-Google-Smtp-Source: APXvYqyG7O4sbhLDX+laRmJOZrEdoehDpL15I9cMKsAsksGPNIcxXELBy1gedUUuGq1wBgcbUlG4HA== X-Received: by 2002:a62:1385:: with SMTP id 5mr11521067pft.221.1553293834813; Fri, 22 Mar 2019 15:30:34 -0700 (PDT) Received: from jun-ubuntu.corp.microsoft.com ([2001:4898:80e8:8:24a5:3dda:2b5:c2f5]) by smtp.googlemail.com with ESMTPSA id h64sm15238020pfj.40.2019.03.22.15.30.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2019 15:30:33 -0700 (PDT) From: Jun Li To: ffmpeg-devel@ffmpeg.org Date: Fri, 22 Mar 2019 15:30:28 -0700 Message-Id: <20190322223028.18925-1-junli1026@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH v3] avformat/http, icecast, rtsp: Add option to disable send-100-continue X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The current setting for send-100-continue option is either enabled if applicable or forced enabled, no option to force disable the header. This change is to expand the option setting to provide more flexibility, which is useful for rstp case. --- libavformat/http.c | 8 ++++++-- libavformat/icecast.c | 2 +- libavformat/rtsp.c | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index 74d743850d..2911ca29c1 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -113,6 +113,7 @@ typedef struct HTTPContext { uint8_t *inflate_buffer; #endif /* CONFIG_ZLIB */ AVDictionary *chained_options; + /* -1 = try to send if applicable, 0 = always disabled, 1 = always enabled */ int send_expect_100; char *method; int reconnect; @@ -155,7 +156,7 @@ static const AVOption options[] = { { "auth_type", "HTTP authentication type", OFFSET(auth_state.auth_type), AV_OPT_TYPE_INT, { .i64 = HTTP_AUTH_NONE }, HTTP_AUTH_NONE, HTTP_AUTH_BASIC, D | E, "auth_type"}, { "none", "No auth method set, autodetect", 0, AV_OPT_TYPE_CONST, { .i64 = HTTP_AUTH_NONE }, 0, 0, D | E, "auth_type"}, { "basic", "HTTP basic authentication", 0, AV_OPT_TYPE_CONST, { .i64 = HTTP_AUTH_BASIC }, 0, 0, D | E, "auth_type"}, - { "send_expect_100", "Force sending an Expect: 100-continue header for POST", OFFSET(send_expect_100), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E }, + { "send_expect_100", "Force sending an Expect: 100-continue header for POST", OFFSET(send_expect_100), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, E }, { "location", "The actual location of the data received", OFFSET(location), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E }, { "offset", "initial byte offset", OFFSET(off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D }, { "end_offset", "try to limit the request to bytes preceding this offset", OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D }, @@ -1179,7 +1180,10 @@ static int http_connect(URLContext *h, const char *path, const char *local_path, local_path, method); proxyauthstr = ff_http_auth_create_response(&s->proxy_auth_state, proxyauth, local_path, method); - if (post && !s->post_data) { + + if (s->send_expect_100 != -1) { + send_expect_100 = s->send_expect_100; + } else if (post && !s->post_data) { send_expect_100 = s->send_expect_100; /* The user has supplied authentication but we don't know the auth type, * send Expect: 100-continue to get the 401 response including the diff --git a/libavformat/icecast.c b/libavformat/icecast.c index c93b06b553..d2198b78ec 100644 --- a/libavformat/icecast.c +++ b/libavformat/icecast.c @@ -115,7 +115,7 @@ static int icecast_open(URLContext *h, const char *uri, int flags) av_dict_set(&opt_dict, "auth_type", "basic", 0); av_dict_set(&opt_dict, "headers", headers, 0); av_dict_set(&opt_dict, "chunked_post", "0", 0); - av_dict_set(&opt_dict, "send_expect_100", s->legacy_icecast ? "0" : "1", 0); + av_dict_set(&opt_dict, "send_expect_100", s->legacy_icecast ? "-1" : "1", 0); if (NOT_EMPTY(s->content_type)) av_dict_set(&opt_dict, "content_type", s->content_type, 0); else diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index ae8811234a..6e67e411b9 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1793,6 +1793,7 @@ redirect: sessioncookie); av_opt_set(rt->rtsp_hd_out->priv_data, "headers", headers, 0); av_opt_set(rt->rtsp_hd_out->priv_data, "chunked_post", "0", 0); + av_opt_set(rt->rtsp_hd_out->priv_data, "send_expect_100", "0", 0); /* Initialize the authentication state for the POST session. The HTTP * protocol implementation doesn't properly handle multi-pass