Pete Zaitcev wrote:
commit 5e777007575b4f20180008fdcca23188f0c9179b
Author: Pete Zaitcev <zaitcev(a)yahoo.com>
Date: Tue Jun 14 14:41:20 2011 -0600
Do not include \r\n into curl headers.
The result appears to work if the payload is XML, but any other type
of body will get corrupted. Also, no headers can be added to the list
after the broken one.
dc-rhev-image.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/dc-rhev-image.c b/dc-rhev-image.c
index 39a5225..865040f 100644
--- a/dc-rhev-image.c
+++ b/dc-rhev-image.c
@@ -879,14 +879,14 @@ static struct stor_dom *apistart(struct config *cfg)
authrlen = strlen(authraw);
authhlen = ((authrlen+2)/3) * 4; /* base64 expands 3 into 4 */
authhlen += sizeof("Authorization: Basic ")-1;
- authhdr = malloc(authhlen + 3); /* \r\n and nul */
+ authhdr = malloc(authhlen + 1); /* \r\n and nul */
Sounds fine.
I've just tweaked the comment to match the new code:
From 27a1f12910f7c5481bd6330f2de1430dc118c5c3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Wed, 15 Jun 2011 11:36:39 +0200
Subject: [PATCH] maint: adjust comment to match just-changed code
* dc-rhev-image.c (apistart): Adjust comment to match code.
---
dc-rhev-image.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dc-rhev-image.c b/dc-rhev-image.c
index 865040f..3658009 100644
--- a/dc-rhev-image.c
+++ b/dc-rhev-image.c
@@ -879,7 +879,7 @@ static struct stor_dom *apistart(struct config *cfg)
authrlen = strlen(authraw);
authhlen = ((authrlen+2)/3) * 4; /* base64 expands 3 into 4 */
authhlen += sizeof("Authorization: Basic ")-1;
- authhdr = malloc(authhlen + 1); /* \r\n and nul */
+ authhdr = malloc(authhlen + 1); /* nul */
if (!authhdr)
goto err_alloc;
strcpy(authhdr, "Authorization: Basic ");
--
1.7.6.rc0.293.g40857