public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Kamil Dudka <kdudka@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/curl] curl-v8.23.0-3: print reason phrase from HTTP status line on error (#676596)
Date: Tue, 03 Nov 2026 12:34:49 GMT [thread overview]
Message-ID: <179370928944.1.4956836073300975095.rpms-curl-20e0756c88ea@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/curl
Branch : curl-v8.23.0-3
Commit : 20e0756c88ea7f1d6567c467ae95b36c973438c3
Author : Kamil Dudka <kdudka@redhat.com>
Date : 2012-07-23T09:25:19+02:00
Stats : +103/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/curl/c/20e0756c88ea7f1d6567c467ae95b36c973438c3?branch=curl-v8.23.0-3
Log:
print reason phrase from HTTP status line on error (#676596)
---
diff --git a/0003-curl-7.26.0-d317ca50.patch b/0003-curl-7.26.0-d317ca50.patch
new file mode 100644
index 0000000..513b074
--- /dev/null
+++ b/0003-curl-7.26.0-d317ca50.patch
@@ -0,0 +1,95 @@
+From 402328f2fc91e82c1f8b73500e3e8ce2e5b728c5 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka <kdudka@redhat.com>
+Date: Fri, 20 Jul 2012 13:33:58 +0200
+Subject: [PATCH] http: print reason phrase from HTTP status line on error
+
+[upstream commit d317ca50ae7d8bb250431f86709e53b94f7f6ddf]
+
+Bug: https://bugzilla.redhat.com/676596
+---
+ lib/http.c | 39 +++++++++++++++++++++++++++++++++++++--
+ tests/data/test24 | 5 ++++-
+ 2 files changed, 41 insertions(+), 3 deletions(-)
+
+diff --git a/lib/http.c b/lib/http.c
+index a139894..1d6519f 100644
+--- a/lib/http.c
++++ b/lib/http.c
+@@ -2727,6 +2727,42 @@ static CURLcode header_append(struct SessionHandle *data,
+ return CURLE_OK;
+ }
+
++static void print_http_error(struct SessionHandle *data)
++{
++ struct SingleRequest *k = &data->req;
++ char *beg = k->p;
++
++ /* make sure that data->req.p points to the HTTP status line */
++ if(!strncmp(beg, "HTTP", 4)) {
++
++ /* skip to HTTP status code */
++ beg = strchr(beg, ' ');
++ if(beg && *++beg) {
++
++ /* find trailing CR */
++ char end_char = '\r';
++ char *end = strchr(beg, end_char);
++ if(!end) {
++ /* try to find LF (workaround for non-compliant HTTP servers) */
++ end_char = '\n';
++ end = strchr(beg, end_char);
++ }
++
++ if(end) {
++ /* temporarily replace CR or LF by NUL and print the error message */
++ *end = '\0';
++ failf(data, "The requested URL returned error: %s", beg);
++
++ /* restore the previously replaced CR or LF */
++ *end = end_char;
++ return;
++ }
++ }
++ }
++
++ /* fall-back to printing the HTTP status code only */
++ failf(data, "The requested URL returned error: %d", k->httpcode);
++}
+
+ /*
+ * Read any HTTP header lines from the server and pass them to the client app.
+@@ -3114,8 +3150,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
+ }
+ else {
+ /* serious error, go home! */
+- failf (data, "The requested URL returned error: %d",
+- k->httpcode);
++ print_http_error(data);
+ return CURLE_HTTP_RETURNED_ERROR;
+ }
+ }
+diff --git a/tests/data/test24 b/tests/data/test24
+index 7985f43..18e7d5b 100644
+--- a/tests/data/test24
++++ b/tests/data/test24
+@@ -24,7 +24,7 @@ http
+ HTTP GET fail silently on HTTP error return
+ </name>
+ <command>
+-http://%HOSTIP:%HTTPPORT/24 --fail
++http://%HOSTIP:%HTTPPORT/24 --fail --silent --show-error
+ </command>
+ </client>
+
+@@ -43,5 +43,8 @@ Accept: */*
+ <errorcode>
+ 22
+ </errorcode>
++<file2 name="log/stderr24">
++curl: (22) The requested URL returned error: 404 BAD BOY
++</file2>
+ </verify>
+ </testcase>
+--
+1.7.1
+
diff --git a/curl.spec b/curl.spec
index 039c6dc..76cd42f 100644
--- a/curl.spec
+++ b/curl.spec
@@ -1,7 +1,7 @@
Summary: A utility for getting files from remote servers (FTP, HTTP, and others)
Name: curl
Version: 7.26.0
-Release: 5%{?dist}
+Release: 6%{?dist}
License: MIT
Group: Applications/Internet
Source: http://curl.haxx.se/download/%{name}-%{version}.tar.lzma
@@ -14,6 +14,9 @@ Patch1: 0001-curl-7.26.0-72f4b534.patch
# fix duplicated SSL handshake with multi interface and proxy (#788526)
Patch2: 0002-curl-7.26.0-68857e40.patch
+# print reason phrase from HTTP status line on error (#676596)
+Patch3: 0003-curl-7.26.0-d317ca50.patch
+
# patch making libcurl multilib ready
Patch101: 0101-curl-7.25.0-multilib.patch
@@ -115,6 +118,7 @@ documentation of the library, too.
# upstream patches
%patch1 -p1
%patch2 -p1
+%patch3 -p1
# Fedora patches
%patch101 -p1
@@ -237,6 +241,9 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/aclocal/libcurl.m4
%changelog
+* Mon Jul 23 2012 Kamil Dudka <kdudka@redhat.com> 7.26.0-6
+- print reason phrase from HTTP status line on error (#676596)
+
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 7.26.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
reply other threads:[~2026-11-03 12:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179370928944.1.4956836073300975095.rpms-curl-20e0756c88ea@fedoraproject.org \
--to=kdudka@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox