Zero-copy FTP/HTTP Daemon compatible with all POSIX systems
| 1 | #ifndef HTTP_RESOURCES_H |
| 2 | #define HTTP_RESOURCES_H |
| 3 | #include <stddef.h> |
| 4 | |
| 5 | /** |
| 6 | * Pre-compressed HTTP resource descriptor. |
| 7 | * @field is_gzip 1 => send Content-Encoding: gzip before Content-Type |
| 8 | */ |
| 9 | typedef struct { |
| 10 | const char *path; |
| 11 | const unsigned char *data; |
| 12 | size_t size; |
| 13 | size_t original_size; |
| 14 | const char *content_type; |
| 15 | int is_gzip; |
| 16 | } http_resource_t; |
| 17 | |
| 18 | int http_resource_get(const char *path, const http_resource_t **out); |
| 19 | |
| 20 | #endif /* HTTP_RESOURCES_H */ |
| 21 |