log_fn(LOG_DEBUG,"body not all here yet.");
return 0; /* not all there yet */
}
- bodylen = contentlen;
- log_fn(LOG_DEBUG,"bodylen reduced to %d.",bodylen);
+ if(bodylen > contentlen) {
+ bodylen = contentlen;
+ log_fn(LOG_DEBUG,"bodylen reduced to %d.",bodylen);
+ }
}
/* all happy. copy into the appropriate places, and return 1 */
if(headers_out) {
return connection_tls_continue_handshake(conn);
}
+ log_fn(LOG_DEBUG,"%d: starting, inbuf_datalen %d (%d pending in tls object). at_most %d.",
+ conn->s,(int)buf_datalen(conn->inbuf),tor_tls_get_pending_bytes(conn->tls), at_most);
+
/* else open, or closing */
result = read_to_buf_tls(conn->tls, at_most, conn->inbuf);