httpd: fix that http_write() returns 1 in "length" when not sending because of sndbuf/sndqueuelen

This commit is contained in:
Simon Goldschmidt 2014-03-11 20:44:06 +01:00
parent 16167a22ef
commit bc4a7f92ad

View File

@ -657,11 +657,12 @@ http_write(struct tcp_pcb *pcb, const void* ptr, u16_t *length, u8_t apiflags)
if (err == ERR_OK) { if (err == ERR_OK) {
LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Sent %d bytes\n", len)); LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Sent %d bytes\n", len));
*length = len;
} else { } else {
LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Send failed with err %d (\"%s\")\n", err, lwip_strerr(err))); LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Send failed with err %d (\"%s\")\n", err, lwip_strerr(err)));
*length = 0;
} }
*length = len;
return err; return err;
} }
@ -1012,9 +1013,6 @@ http_send_headers(struct tcp_pcb *pcb, struct http_state *hs)
if ((err == ERR_OK) && (old_sendlen != sendlen)) { if ((err == ERR_OK) && (old_sendlen != sendlen)) {
/* Remember that we added some more data to be transmitted. */ /* Remember that we added some more data to be transmitted. */
data_to_send = HTTP_DATA_TO_SEND_CONTINUE; data_to_send = HTTP_DATA_TO_SEND_CONTINUE;
} else if (err != ERR_OK) {
/* special case: http_write does not try to send 1 byte */
sendlen = 0;
} }
/* Fix up the header position for the next time round. */ /* Fix up the header position for the next time round. */