libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit ac3fe616d5c0407a99d3d7c312143b6214046b5b
parent 5b12d5bcb98bd76e4d3942bcde50d286282a026d
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun,  8 May 2011 19:55:23 +0000

fixing 1679

Diffstat:
MChangeLog | 7+++++++
Mconfigure.ac | 8++++----
Msrc/daemon/response.c | 8+++++++-
Msrc/include/microhttpd.h | 10+++++++---
4 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,10 @@ +Sun May 8 21:52:47 CEST 2011 + Allow MHD_SIZE_UNKNOWN to be used in conjunction with + MHD_create_response_from_fd (fixing #1679). -TG + +Wed Apr 27 16:11:18 CEST 2011 + Releasing libmicrohttpd 0.9.10. -CG + Fri Apr 8 11:40:35 CEST 2011 Workaround for cygwin poll brokenness. -TS diff --git a/configure.ac b/configure.ac @@ -21,15 +21,15 @@ # # AC_PREREQ(2.57) -AC_INIT([libmicrohttpd], [0.9.9],[libmicrohttpd@gnu.org]) -AM_INIT_AUTOMAKE([libmicrohttpd], [0.9.9]) +AC_INIT([libmicrohttpd], [0.9.10],[libmicrohttpd@gnu.org]) +AM_INIT_AUTOMAKE([libmicrohttpd], [0.9.10]) AM_CONFIG_HEADER([MHD_config.h]) AC_CONFIG_MACRO_DIR([m4]) AH_TOP([#define _GNU_SOURCE 1]) -LIB_VERSION_CURRENT=17 +LIB_VERSION_CURRENT=18 LIB_VERSION_REVISION=0 -LIB_VERSION_AGE=7 +LIB_VERSION_AGE=8 AC_SUBST(LIB_VERSION_CURRENT) AC_SUBST(LIB_VERSION_REVISION) AC_SUBST(LIB_VERSION_AGE) diff --git a/src/daemon/response.c b/src/daemon/response.c @@ -270,9 +270,15 @@ static ssize_t file_reader (void *cls, uint64_t pos, char *buf, size_t max) { struct MHD_Response *response = cls; + ssize_t n; (void) lseek (response->fd, pos + response->fd_off, SEEK_SET); - return read (response->fd, buf, max); + n = read (response->fd, buf, max); + if (n == 0) + return MHD_CONTENT_READER_END_OF_STREAM; + if (n < 0) + return MHD_CONTENT_READER_END_WITH_ERROR; + return n; } diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h @@ -106,7 +106,7 @@ extern "C" /** * Current version of the library. */ -#define MHD_VERSION 0x00090900 +#define MHD_VERSION 0x00090A00 /** * MHD-internal return code for "YES". @@ -1298,7 +1298,9 @@ MHD_create_response_from_buffer (size_t size, * header information and then be used any number of times. * * @param size size of the data portion of the response - * @param fd file descriptor referring to a file on disk with the data; will be closed when response is destroyed + * @param fd file descriptor referring to a file on disk with the + * data; will be closed when response is destroyed; + * fd should be in 'blocking' mode * @return NULL on error (i.e. invalid arguments, out of memory) * @deprecated use MHD_create_response_from_fd_at_offset instead */ @@ -1311,7 +1313,9 @@ struct MHD_Response *MHD_create_response_from_fd (size_t size, * header information and then be used any number of times. * * @param size size of the data portion of the response - * @param fd file descriptor referring to a file on disk with the data; will be closed when response is destroyed + * @param fd file descriptor referring to a file on disk with the + * data; will be closed when response is destroyed; + * fd should be in 'blocking' mode * @param off offset to start reading from in the file * @return NULL on error (i.e. invalid arguments, out of memory) */