diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-08-15 19:36:06 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-08-15 19:36:06 +0000 |
commit | 0ddbcb2ada560e33f79f302c6287305acdc34e62 (patch) | |
tree | 64e71c594c6bbba49f0cb96b3226436d5ee78569 /nuttx/netutils/thttpd/thttpd.c | |
parent | cc7a78241f8535fd006a51951ab99b378bf37924 (diff) | |
download | nuttx-0ddbcb2ada560e33f79f302c6287305acdc34e62.tar.gz nuttx-0ddbcb2ada560e33f79f302c6287305acdc34e62.tar.bz2 nuttx-0ddbcb2ada560e33f79f302c6287305acdc34e62.zip |
THTTPD progress
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2020 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/netutils/thttpd/thttpd.c')
-rw-r--r-- | nuttx/netutils/thttpd/thttpd.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/nuttx/netutils/thttpd/thttpd.c b/nuttx/netutils/thttpd/thttpd.c index d89d6dd06..093d89294 100644 --- a/nuttx/netutils/thttpd/thttpd.c +++ b/nuttx/netutils/thttpd/thttpd.c @@ -307,6 +307,7 @@ static void handle_read(struct connect_s *conn, struct timeval *tv) { if (hc->read_size > CONFIG_THTTPD_MAXREALLOC) { + BADREQUEST("MAXREALLOC"); goto errout_with_400; } httpd_realloc_str(&hc->read_buf, &hc->read_size, hc->read_size + CONFIG_THTTPD_REALLOCINCR); @@ -317,12 +318,13 @@ static void handle_read(struct connect_s *conn, struct timeval *tv) sz = read(hc->conn_fd, &(hc->read_buf[hc->read_idx]), hc->read_size - hc->read_idx); if (sz == 0) { + BADREQUEST("EOF"); goto errout_with_400; } if (sz < 0) { - /* Ignore EINTR and EAGAIN. Also ignore EWOULDBLOCK. At first glanc + /* Ignore EINTR and EAGAIN. Also ignore EWOULDBLOCK. At first glance * you would think that connections returned by fdwatch as readable * should never give an EWOULDBLOCK; however, this apparently can * happen if a packet gets garbled. @@ -332,6 +334,9 @@ static void handle_read(struct connect_s *conn, struct timeval *tv) { return; } + + ndbg("read(fd=%d) failed: %d\n", hc->conn_fd, errno); + BADREQUEST("read"); goto errout_with_400; } @@ -345,7 +350,8 @@ static void handle_read(struct connect_s *conn, struct timeval *tv) case GR_NO_REQUEST: return; case GR_BAD_REQUEST: - goto errout_with_400; + BADREQUEST("httpd_got_request"); + goto errout_with_400; } /* Yes. Try parsing and resolving it */ @@ -408,6 +414,7 @@ static void handle_read(struct connect_s *conn, struct timeval *tv) if (actual != conn->offset) { ndbg("fseek to %d failed: offset=%d errno=%d\n", conn->offset, actual, errno); + BADREQUEST("lseek"); goto errout_with_400; } @@ -421,6 +428,7 @@ static void handle_read(struct connect_s *conn, struct timeval *tv) return; errout_with_400: + BADREQUEST("errout"); httpd_send_err(hc, 400, httpd_err400title, "", httpd_err400form, ""); errout_with_connection: |