GNU libmicrohttpd 0.9.77
Loading...
Searching...
No Matches
response_from_fd.c File Reference

implementation of MHD_response_from_fd() More...

#include "internal.h"
Include dependency graph for response_from_fd.c:

Go to the source code of this file.

Macros

#define MHD_FILE_READ_BLOCK_SIZE   4096 /* 4k */
 

Functions

static ssize_t file_reader (void *cls, uint64_t pos, char *buf, size_t max)
 
static void free_callback (void *cls)
 
struct MHD_ResponseMHD_response_from_fd (enum MHD_HTTP_StatusCode sc, int fd, uint64_t offset, uint64_t size)
 

Detailed Description

implementation of MHD_response_from_fd()

Author
Daniel Pittman
Christian Grothoff
Karlson2k (Evgeny Grin)

Definition in file response_from_fd.c.

Macro Definition Documentation

◆ MHD_FILE_READ_BLOCK_SIZE

#define MHD_FILE_READ_BLOCK_SIZE   4096 /* 4k */

Size of single file read operation for file-backed responses.

Definition at line 39 of file response_from_fd.c.

Function Documentation

◆ file_reader()

static ssize_t file_reader ( void *  cls,
uint64_t  pos,
char *  buf,
size_t  max 
)
static

Given a file descriptor, read data from the file to generate the response.

Parameters
clspointer to the response
posoffset in the file to access
bufwhere to write the data
maxnumber of bytes to write at most
Returns
number of bytes written

Definition at line 54 of file response_from_fd.c.

References MHD_Response::fd, MHD_Response::fd_off, INT32_MAX, MHD_CONTENT_READER_END_OF_STREAM, MHD_CONTENT_READER_END_WITH_ERROR, and SSIZE_MAX.

Referenced by MHD_response_from_fd().

Here is the caller graph for this function:

◆ free_callback()

static void free_callback ( void *  cls)
static

Destroy file reader context. Closes the file descriptor.

Parameters
clspointer to file descriptor

Definition at line 148 of file response_from_fd.c.

References MHD_Response::fd.

Referenced by MHD_response_from_fd().

Here is the caller graph for this function: