summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2012-01-19 23:51:00 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2012-01-19 23:51:00 +0100
commit8654fae974db3351bbb324449cf8c0f67d690bae (patch)
tree6dc9e6c679abaa1b5db0197bbeee77ef2f44aaae
parentd542b1464ac4667672c8ee7f3fda11c34dcc16a6 (diff)
* methods/https.cc:
- use curls list append instead of appending Range and If-Range by hand which generates malformed requests, thanks Mel Collins for the hint! (Closes: #646381)
-rw-r--r--debian/changelog6
-rw-r--r--methods/https.cc10
2 files changed, 10 insertions, 6 deletions
diff --git a/debian/changelog b/debian/changelog
index 7f5de05e0..299afcf54 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,8 +17,12 @@ apt (0.8.16~exp12) experimental; urgency=low
* debian/rules:
- apply patch to enable usage of hardning CPPFLAGS and LDFLAGS by
Moritz Muehlenhoff, thanks! (Closes: #653504)
+ * methods/https.cc:
+ - use curls list append instead of appending Range and If-Range by hand
+ which generates malformed requests, thanks Mel Collins for the hint!
+ (Closes: #646381)
- -- David Kalnischkies <kalnischkies@gmail.com> Thu, 19 Jan 2012 23:23:29 +0100
+ -- David Kalnischkies <kalnischkies@gmail.com> Thu, 19 Jan 2012 23:43:03 +0100
apt (0.8.16~exp11) experimental; urgency=low
diff --git a/methods/https.cc b/methods/https.cc
index 317c8a587..6de18b8e0 100644
--- a/methods/https.cc
+++ b/methods/https.cc
@@ -100,7 +100,6 @@ void HttpsMethod::SetupProxy() /*{{{*/
depth. */
bool HttpsMethod::Fetch(FetchItem *Itm)
{
- stringstream ss;
struct stat SBuf;
struct curl_slist *headers=NULL;
char curl_errorstr[CURL_ERROR_SIZE];
@@ -199,6 +198,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
if (_config->FindB("Acquire::https::No-Store",
_config->FindB("Acquire::http::No-Store",false)) == true)
headers = curl_slist_append(headers,"Cache-Control: no-store");
+ stringstream ss;
ioprintf(ss, "Cache-Control: max-age=%u", _config->FindI("Acquire::https::Max-Age",
_config->FindI("Acquire::http::Max-Age",0)));
headers = curl_slist_append(headers, ss.str().c_str());
@@ -246,11 +246,11 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
if (stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0)
{
char Buf[1000];
- sprintf(Buf,"Range: bytes=%li-\r\nIf-Range: %s\r\n",
- (long)SBuf.st_size - 1,
- TimeRFC1123(SBuf.st_mtime).c_str());
+ sprintf(Buf, "Range: bytes=%li-", (long) SBuf.st_size - 1);
headers = curl_slist_append(headers, Buf);
- }
+ sprintf(Buf, "If-Range: %s", TimeRFC1123(SBuf.st_mtime).c_str());
+ headers = curl_slist_append(headers, Buf);
+ }
else if(Itm->LastModified > 0)
{
curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);