diff --git a/src/ChangeLog b/src/ChangeLog index 5ad76058..aa6e5e66 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-10-21 Matthew Atkinson (tiny change) + + * http.c (gethttp): Always send Content-Length header when method is POST, + PUT, or PATCH even with no post body, as some servers will reject the + request otherwise. + 2014-11-03 Jakub Čajka * iri.c (remote_to_utf8): Fixed assumption that char is signed. Fixes diff --git a/src/http.c b/src/http.c index cded2dee..69ffcc3f 100644 --- a/src/http.c +++ b/src/http.c @@ -1874,6 +1874,10 @@ 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 + || strcasecmp (opt.method, "put") == 0 + || strcasecmp (opt.method, "patch") == 0) + request_set_header (req, "Content-Length", "0", rel_none); } retry_with_auth: