From patchwork Tue Mar 19 21:58:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 12357 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 069A044804C for ; Tue, 19 Mar 2019 23:58:56 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EBA1068A946; Tue, 19 Mar 2019 23:58:55 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 246C868A7D4 for ; Tue, 19 Mar 2019 23:58:49 +0200 (EET) Received: by mail-pf1-f175.google.com with SMTP id v21so315588pfm.12 for ; Tue, 19 Mar 2019 14:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=OQoZv3Y8y28QBkoc/AUFUN/WFbYSdy4ny9bN57PzVi4=; b=T0cdyt/lnHor8R/ao82g3PvLVjdPKV5o2WnQzjSEJNyvNx6LxCsQja3k6XqSFylfmP 9Urft3XI8yvPg+DWSHSmL4LVms2FoHUZzVYlk9HYngAWXJzeY229mp3TPACyKTG+H9i/ wKiqZY2ZXdOEARelOxH4TBJI67x5bWjn2gwxbNtJv6v0js0DnX/5sOGnZ6Q4Ms7BH3Fk KSeV/tkYf6aio6zfWGAJAlmBjBsfqdkRyFOwAmF4DnqQvubsWVIuVt3d7uBOJRjJAf33 D0E+85zPQJpSt1yzuhs1h4bUjOayge87lIgX7RyRfgbRSNd/7LFZPI++5v7E8nU7SaAv zrMw== 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:in-reply-to :references; bh=OQoZv3Y8y28QBkoc/AUFUN/WFbYSdy4ny9bN57PzVi4=; b=ipMLYteniLW4G+pYajA/fRLB+lH6z64RmDie4WI0mY9kz6fHrFd0gFLv1HTlFqyQzg OGHqJ7eGBvtBU9PIpTIo7VJQ/NWQ1orgZ7PgSx0mtWNkG5lYADywbU7HffbkvpACPesk g0sx0MVsqsNNDYPMyYNGenhvShxdrFwRcpMWOAYKVumok6SJ3kHLVj/iITnRZJN4RDdU mB1f7WBjT6h3tg4lbcoi+xTumC8NyVce70aVw8o7II6MAlTPtCG4K1rSfV703QxhJO/f ki5ry2XtzaDhhWPPhfv+sAtX3LHk/mRUAR47gzQPr3Cqp8i1s6/c9bHbBfwZvZtOvOeG 4yjA== X-Gm-Message-State: APjAAAUfq/vpKgPy1weh5bz82kNC6x2/Qw8fZM4mwsBRA2mcFhqjPKiP 9q8Dz/Zt4S6yr+sPYTrRFeMnXwAS X-Google-Smtp-Source: APXvYqx14vRrWvKrZhKosUxoMeCF8d0t/2Ja9dzFhRPuMuBHSxqyJZ/G5mPI+WQcuzIIAa4f/E1G1g== X-Received: by 2002:aa7:8205:: with SMTP id k5mr26431751pfi.86.1553032727039; Tue, 19 Mar 2019 14:58:47 -0700 (PDT) Received: from jun-ubuntu.corp.microsoft.com ([2001:4898:80e8:a:e8de:6afa:bf6c:dfca]) by smtp.googlemail.com with ESMTPSA id k27sm26750398pgb.70.2019.03.19.14.58.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Mar 2019 14:58:46 -0700 (PDT) From: Jun Li To: ffmpeg-devel@ffmpeg.org Date: Tue, 19 Mar 2019 14:58:37 -0700 Message-Id: <20190319215839.32193-2-junli1026@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190319215839.32193-1-junli1026@gmail.com> References: <20190319215839.32193-1-junli1026@gmail.com> Subject: [FFmpeg-devel] [PATCH v1 1/3] avformat/http: 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 is either applicable or enabled, no option to disable the header. This change is to expand the option setting to provide more flexibility, which is useful for rstp case. --- libavformat/http.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) int reconnect_at_eof; @@ -155,7 +155,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,12 +1179,15 @@ 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 - * WWW-Authenticate header, or an 100 continue if no auth actually - * is needed. */ + * send Expect: 100-continue to get the 401 response including the + * WWW-Authenticate header, or an 100 continue if no auth actually + * is needed. */ if (auth && *auth && s->auth_state.auth_type == HTTP_AUTH_NONE && s->http_code != 401) diff --git a/libavformat/http.c b/libavformat/http.c index ed0eb1c875..7e74719450 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -113,7 +113,7 @@ typedef struct HTTPContext { uint8_t *inflate_buffer; #endif /* CONFIG_ZLIB */ AVDictionary *chained_options; - int send_expect_100; + // -1 = try to send if applicable, 0 = always disabled, 1 = always enabled int send_expect_100; char *method; int reconnect;