Content-Length set during PUT/POST method
MikolajMarkiel opened this issue · comments
Is there any way to set .length and .length-set fields before requesting header with PUT or POST methods?
I see there is a condition that in dependence of .length_set is setting header field but without any opportunity to modify the .length_set before it is forcing to use "Transfer-Encoding: chunked\r\n" anyway.
if (op == HTTPC_PUT || op == HTTPC_POST) {
if (h->length_set) {
char content[64 + 1] = { 0, };
if (httpc_buffer_add_string(h, b0, "Content-Length: ") < 0)
goto fail;
httpc_num_to_str(content, h->length, 10);
if (httpc_buffer_add_string(h, b0, content) < 0)
goto fail;
if (httpc_buffer_add_string(h, b0, "\r\n") < 0)
goto fail;
} else { /* Attempt to send chunked encoding */
if (httpc_buffer_add_string(h, b0, "Transfer-Encoding: chunked\r\n") < 0)
goto fail;
}
}
I don't believe there is at the moment, I'll need to think about the best way to resolve this deficiency.