>From af9326b1665e0e1d3b28ed0b66c6c99d07a88172 Mon Sep 17 00:00:00 2001 From: Matthew Atkinson Date: Sun, 19 Oct 2014 21:31:36 +0100 Subject: [PATCH] Always send Content-Length if method is post --- src/ChangeLog | 5 +++++ src/http.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 1c4e2d5..447179e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-10-19 Matthew Atkinson + + * http.c (gethttp): Always send Content-Length header when method is post, + even with no post body, as some servers will reject the request otherwise + 2014-05-03 Tim Ruehsen * retr.c (retrieve_url): fixed memory leak diff --git a/src/http.c b/src/http.c index 4b99c17..e020682 100644 --- a/src/http.c +++ b/src/http.c @@ -1875,6 +1875,8 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy, xstrdup (number_to_static_string (body_data_size)), rel_value); } + else if (strcasecmp (opt.method, "post") == 0) + request_set_header (req, "Content-Length", "0", rel_none); } retry_with_auth: -- 1.9.1