commit a97e18bbe941b12187637b785615f65cf7381ac0
parent e33710b26aa885ca0a02e63ef45231551f1cdac1
Author: Joris Vink <joris@coders.se>
Date: Tue, 19 May 2015 09:13:29 +0200
Shuffle some HTTP_REQUEST_NO_CONTENT_LENGTH around
Diffstat:
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/http.c b/src/http.c
@@ -1267,11 +1267,18 @@ http_response_normal(struct http_request *req, struct connection *c,
kore_buf_appendf(header_buf, "%s: %s\r\n",
hdr->header, hdr->value);
}
- }
- if (req != NULL && status != 204 && status >= 200 &&
- !(req->flags & HTTP_REQUEST_NO_CONTENT_LENGTH))
- kore_buf_appendf(header_buf, "content-length: %d\r\n", len);
+ if (status != 204 && status >= 200 &&
+ !(req->flags & HTTP_REQUEST_NO_CONTENT_LENGTH)) {
+ kore_buf_appendf(header_buf,
+ "content-length: %d\r\n", len);
+ }
+ } else {
+ if (status != 204 && status >= 200) {
+ kore_buf_appendf(header_buf,
+ "content-length: %d\r\n", len);
+ }
+ }
kore_buf_append(header_buf, "\r\n", 2);
net_send_queue(c, header_buf->data, header_buf->offset,