From patchwork Thu Nov 12 22:05:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 23611 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 26B6D44A7C8 for ; Fri, 13 Nov 2020 00:32:24 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EE75968C21F; Fri, 13 Nov 2020 00:32:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CCEAF68B970 for ; Fri, 13 Nov 2020 00:32:17 +0200 (EET) Received: by mail-wr1-f66.google.com with SMTP id d12so7631265wrr.13 for ; Thu, 12 Nov 2020 14:32:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=kSyFpVDy72SdlFDGfrb1zSkudjbpMOzV6vZgMpCLVfU=; b=ydSy2+mAF+nbgYwi2vA0GsvndCBsg+XeJrR/ugS/W97rWfki88ZY3uQyPEA/M467Rl aq74XhPGJgd/XlPgJ3QDrbzZRFQJHOKkb6IYmDhAdvO+KEuJl3Xytcx/lk/Xd894+eeO 5AwxK+ObE7v46U19ywgyN3hOcP7Uw9eEMjHStjiHbV0riSYEBvyGyfRseVnoV5Pnd43B xtnw7SpcwfgCXRHoqZSC8HeM1R+6ABmbwX8gn1V9YbyctNmtZf4wMGadv/MQ1w/EtJHw HLAApn4nnsyll9yrE8ASMvqFNCP4xZcDp0KfuzVViEAULf0sGkMxm99q5oS0WhxG6aOk dHrw== 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:mime-version :content-transfer-encoding; bh=kSyFpVDy72SdlFDGfrb1zSkudjbpMOzV6vZgMpCLVfU=; b=tHcQ5JQxn1gSHchrimSSe+rp3gh7TweSJ+6pdxP0NEIHo2hkgRMmeGMz3JcgJTyKze vM/pDXd3b4Mxp1eN/tG6Q+orHAfvCTqKx7lRtnL2IsVreSSje6PHUVZ4J6P9VJQbKU8z iET+jX23hE3vb6B9g30WEGUawyL3wAnSG2UNXo/tftvtOPcE72T6H2xNBCrj8Ff35YKj ZHoTLVjmSTJBs+VWuFJQyYRQrL2Ddc7WcvxGD83IidgaFBb7RxfmzmvytwXLfWyAN0Lb +raeOzGwq8E5DLH9dSOh3Y0DTfMjVxyCcPY6W1YZJBowzQThbVJY/l7X+Isvi7qvlrQd BfFQ== X-Gm-Message-State: AOAM532gMWlzk6LrPmYX1fIJ61mJl7uPQF04kq16FLfgmZOpA5J6+PpO 5HFNWieRhC2DeffTEnu44JZFeytdHJuuVLkR X-Google-Smtp-Source: ABdhPJwSYUyEoTsvBba00FCNwUMG68sukfhf2S8hQgAqZorn1BDbe6fmnyvNlXzbpWq59Bnetvnfkg== X-Received: by 2002:adf:82c7:: with SMTP id 65mr1899485wrc.384.1605218757835; Thu, 12 Nov 2020 14:05:57 -0800 (PST) Received: from localhost (host-96-177.parnet.fi. [77.234.96.177]) by smtp.gmail.com with ESMTPSA id w11sm8046213wmg.36.2020.11.12.14.05.56 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 12 Nov 2020 14:05:56 -0800 (PST) From: =?utf-8?q?Martin_Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 13 Nov 2020 00:05:55 +0200 Message-Id: <20201112220555.67959-1-martin@martin.st> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] http: Return AVERROR_EOF instead of 0 in some EOF conditions 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" IO functions are expected to return AVERROR_EOF instead of 0 nowadays. This is also expected by other higher level layers within the http protocol itself (e.g. the reconnect mechanism). --- libavformat/http.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index 3d25d652d3..528ea046ef 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -1408,12 +1408,12 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size) if (!s->chunksize && s->multiple_requests) { http_get_line(s, line, sizeof(line)); // read empty chunk s->chunkend = 1; - return 0; + return AVERROR_EOF; } else if (!s->chunksize) { av_log(h, AV_LOG_DEBUG, "Last chunk received, closing conn\n"); ffurl_closep(&s->hd); - return 0; + return AVERROR_EOF; } else if (s->chunksize == UINT64_MAX) { av_log(h, AV_LOG_ERROR, "Invalid chunk size %"PRIu64"\n",