diff options
Diffstat (limited to 'hw4/chttpd/chttpd-conn.c')
-rw-r--r-- | hw4/chttpd/chttpd-conn.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/hw4/chttpd/chttpd-conn.c b/hw4/chttpd/chttpd-conn.c index fecc5a8..6b2b205 100644 --- a/hw4/chttpd/chttpd-conn.c +++ b/hw4/chttpd/chttpd-conn.c @@ -181,11 +181,14 @@ void* chttpd_conn_http (void* ptr_to_ChttpdConn) { "HTTP line delimiter length must be 2bytes!"); char errmsg[ERRLEN]; - LbsArray* hdr_buf = lbs_array_new (sizeof (char)); - LbsArray* out_buf = lbs_array_new (sizeof (char)); + LbsArray* hdr_buf = lbs_array_new_with_max (sizeof (char), CHTTPD_CONN_BUF_SIZE); + LbsArray* out_buf = lbs_array_new_with_max (sizeof (char), CHTTPD_CONN_BUF_SIZE); ssize_t data_offset; ssize_t data_count; + lbs_array_set_len (hdr_buf, 0); + lbs_array_set_len (out_buf, 0); + while (true) { ssize_t r = read (connfd, conn->buf, CHTTPD_CONN_BUF_SIZE); if (r < 0) { |