[libvirt] [PATCH] esx: Correctly disable HTTP Expect header usage of libcurl

Adding "Expect:" to the header list stops libcurl from sending a Expect header at all. Before, a dummy Expect header was added that might confuse HTTP proxies and result in HTTP error code 417 being reported. --- src/esx/esx_vi.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 14ad50a..6004aac 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -293,14 +293,14 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri) "Content-Type: text/xml; charset=UTF-8"); /* - * Add a dummy expect header to stop CURL from waiting for a response code + * Add an empty expect header to stop CURL from waiting for a response code * 100 (Continue) from the server before continuing the POST operation. * Waiting for this response would slowdown each communication with the * server by approx. 2 sec, because the server doesn't send the expected * 100 (Continue) response and the wait times out resulting in wasting * approx. 2 sec per POST operation. */ - curl->headers = curl_slist_append(curl->headers, "Expect: nothing"); + curl->headers = curl_slist_append(curl->headers, "Expect:"); if (curl->headers == NULL) { ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", -- 1.7.4.1

On 02/20/2012 02:38 PM, Matthias Bolte wrote:
Adding "Expect:" to the header list stops libcurl from sending a Expect header at all.
Before, a dummy Expect header was added that might confuse HTTP proxies and result in HTTP error code 417 being reported. --- src/esx/esx_vi.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 14ad50a..6004aac 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -293,14 +293,14 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri) "Content-Type: text/xml; charset=UTF-8");
/* - * Add a dummy expect header to stop CURL from waiting for a response code + * Add an empty expect header to stop CURL from waiting for a response code * 100 (Continue) from the server before continuing the POST operation. * Waiting for this response would slowdown each communication with the * server by approx. 2 sec, because the server doesn't send the expected * 100 (Continue) response and the wait times out resulting in wasting * approx. 2 sec per POST operation. */ - curl->headers = curl_slist_append(curl->headers, "Expect: nothing"); + curl->headers = curl_slist_append(curl->headers, "Expect:");
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

2012/2/20 Eric Blake <eblake@redhat.com>:
On 02/20/2012 02:38 PM, Matthias Bolte wrote:
Adding "Expect:" to the header list stops libcurl from sending a Expect header at all.
Before, a dummy Expect header was added that might confuse HTTP proxies and result in HTTP error code 417 being reported. --- src/esx/esx_vi.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 14ad50a..6004aac 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -293,14 +293,14 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri) "Content-Type: text/xml; charset=UTF-8");
/* - * Add a dummy expect header to stop CURL from waiting for a response code + * Add an empty expect header to stop CURL from waiting for a response code * 100 (Continue) from the server before continuing the POST operation. * Waiting for this response would slowdown each communication with the * server by approx. 2 sec, because the server doesn't send the expected * 100 (Continue) response and the wait times out resulting in wasting * approx. 2 sec per POST operation. */ - curl->headers = curl_slist_append(curl->headers, "Expect: nothing"); + curl->headers = curl_slist_append(curl->headers, "Expect:");
ACK.
Thanks, pushed. -- Matthias Bolte http://photron.blogspot.com
participants (2)
-
Eric Blake
-
Matthias Bolte