diff options
Diffstat (limited to 'src/Content.c')
-rw-r--r-- | src/Content.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/Content.c b/src/Content.c index 2f22bac..da1139b 100644 --- a/src/Content.c +++ b/src/Content.c @@ -1292,3 +1292,38 @@ static int ControlTerminationPage(cGH *cctkGH, httpRequest *request) return retval; } + + /*@@ + @routine HTTP_ContentSendFromFile + @date Sun Sep 17 17:35:57 2000 + @author Tom Goodale + @desc + Reads data from the filedescriptor and sends it to the HTTP request. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +int HTTP_ContentSendFromFile(httpRequest *request, int filedes) +{ + int bytes_sent; + int n_bytes; + char buffer[4096]; + + bytes_sent = 0; + while((n_bytes = read(filedes, buffer,4096)) > 0) + { + HTTP_Write(request, buffer, n_bytes); + bytes_sent += n_bytes; + } + + if(n_bytes == -1) + { + bytes_sent = -bytes_sent; + } + + return bytes_sent; +} |