Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jdINN-00058q-3F for mharc-grub-devel@gnu.org; Mon, 25 May 2020 15:03:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdINL-00055r-Em for grub-devel@gnu.org; Mon, 25 May 2020 15:03:03 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:53312) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdINK-0000Z4-GC for grub-devel@gnu.org; Mon, 25 May 2020 15:03:03 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04PJ2g5O108699; Mon, 25 May 2020 19:02:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2020-01-29; bh=3KJNn4Ei5jYqYSn2uZYZT+E/aSABWvpQFvcplaxZzdE=; b=a5LpQy48i/Vp6MYON9IjOM9sLpvWC3MLn4BGXg9CyQ1MNWjOwk++ygCKZCgVRMoTU1LQ s0+Hdj00Scy1NOlafq8U0kw+bB7NbgTd6ZETuWwEwfi+tbtgoeNUexzs5QernBUT/Doc Jy5GFX3FgKOkY7Q7UTi7LNLCRfrEP3AB/fRLu0BiEZwPvKL1OrxEbS4VPHKcr54aO/N9 dW7ZHAyT29cn6eGpqUmnHndes4sXyNKQ0rLHzlndaNYcjXFiyI4okKHTeEfoXit/eo3y or6nw04nYMI+uYYM6cBT6AsxYYAdEr3dhV7ICD+eRDSa1ixQWJRL0YLL+aH5yUMRyeb8 Wg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 316uskpftv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 May 2020 19:02:53 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04PIrim0167346; Mon, 25 May 2020 19:02:52 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 317dkr23kp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 May 2020 19:02:52 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 04PJ2hXE022539; Mon, 25 May 2020 19:02:46 GMT Received: from tomti.i.net-space.pl (/10.175.171.6) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 25 May 2020 12:02:43 -0700 From: Daniel Kiper To: grub-devel@gnu.org Cc: cjwatson@ubuntu.com, higgi1pt@gmail.com, javierm@redhat.com, fsf@martin-whitaker.me.uk, mailing-lists@martin-whitaker.me.uk, mjg59@srcf.ucam.org, olaf@aepfle.de, phcoder@gmail.com Subject: [PATCH 2/6] net/http: Return an error on HTTP error responses Date: Mon, 25 May 2020 21:02:11 +0200 Message-Id: <20200525190215.16390-3-daniel.kiper@oracle.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200525190215.16390-1-daniel.kiper@oracle.com> References: <20200525190215.16390-1-daniel.kiper@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9632 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 bulkscore=0 spamscore=0 suspectscore=1 mlxscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005250150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9632 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 lowpriorityscore=0 suspectscore=1 spamscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 cotscore=-2147483648 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005250151 Received-SPF: pass client-ip=141.146.126.78; envelope-from=daniel.kiper@oracle.com; helo=aserp2120.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/25 15:02:59 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2020 19:03:03 -0000 From: Olaf Hering A http transfer will hang if an error is returned. The error branch returns the value GRUB_ERR_NONE which is not expected by the caller. Signed-off-by: Olaf Hering Signed-off-by: Daniel Kiper --- grub-core/net/http.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/http.c b/grub-core/net/http.c index b616cf40b..0d3da7501 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c @@ -118,14 +118,14 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) case 404: data->err = GRUB_ERR_FILE_NOT_FOUND; data->errmsg = grub_xasprintf (_("file `%s' not found"), data->filename); - return GRUB_ERR_NONE; + return GRUB_ERR_FILE_NOT_FOUND; default: data->err = GRUB_ERR_NET_UNKNOWN_ERROR; /* TRANSLATORS: GRUB HTTP code is pretty young. So even perfectly valid answers like 403 will trigger this very generic message. */ data->errmsg = grub_xasprintf (_("unsupported HTTP error %d: %s"), code, ptr); - return GRUB_ERR_NONE; + return GRUB_ERR_FILE_READ_ERROR; } data->first_line_recv = 1; return GRUB_ERR_NONE; -- 2.11.0