[libsoup/gnome-2-26] Add "Content-Length: 0" to requests with a Content-Type but no body
- From: Dan Winship <danw src gnome org>
- To: svn-commits-list gnome org
- Subject: [libsoup/gnome-2-26] Add "Content-Length: 0" to requests with a Content-Type but no body
- Date: Mon, 29 Jun 2009 22:47:56 +0000 (UTC)
commit 62abcaf2ee568461d3d44ec2b56b60a17d241093
Author: Dan Winship <danw gnome org>
Date: Sat Jun 6 23:14:05 2009 -0400
Add "Content-Length: 0" to requests with a Content-Type but no body
Some servers get annoyed if a POST/PUT declares a Content-Type but
contains no body, so make sure to send a 0-length body (which is
different) instead.
libsoup/soup-message-client-io.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-message-client-io.c b/libsoup/soup-message-client-io.c
index ebf144c..8159922 100644
--- a/libsoup/soup-message-client-io.c
+++ b/libsoup/soup-message-client-io.c
@@ -109,7 +109,8 @@ get_request_headers (SoupMessage *req, GString *header,
*encoding = soup_message_headers_get_encoding (req->request_headers);
if ((*encoding == SOUP_ENCODING_CONTENT_LENGTH ||
*encoding == SOUP_ENCODING_NONE) &&
- req->request_body->length > 0 &&
+ (req->request_body->length > 0 ||
+ soup_message_headers_get_one (req->request_headers, "Content-Type")) &&
!soup_message_headers_get_content_length (req->request_headers)) {
*encoding = SOUP_ENCODING_CONTENT_LENGTH;
soup_message_headers_set_content_length (req->request_headers,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]