HttpRespondWithFile
Description
Populate response from a file on disk. The file’s bytes are read through response->allocator. Only available when the file feature is enabled.
Success
Returns response with body filled.
Failure
Returns NULL on I/O or allocation failure.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Http.Leak.c:165:
// Serving the file must free the old (HTML) body before installing the new.
HttpResponse *res =
HttpRespondWithFile(&response, HTTP_RESPONSE_CODE_OK, HTTP_CONTENT_TYPE_TEXT_PLAIN, StrBegin(&path));
ok = ok && (res != NULL);- In
Http.c:221:
HttpResponse response = HttpResponseInit(alloc_base);
HttpResponse *res =
HttpRespondWithFile(&response, HTTP_RESPONSE_CODE_OK, HTTP_CONTENT_TYPE_TEXT_PLAIN, StrBegin(&path));
ok = ok && (res != NULL) && (response.status_code == HTTP_RESPONSE_CODE_OK) &&- In
Http.c:248:
HttpResponse response = HttpResponseInit(alloc_base);
HttpResponse *res =
HttpRespondWithFile(&response, HTTP_RESPONSE_CODE_OK, HTTP_CONTENT_TYPE_TEXT_PLAIN, StrBegin(&path));
ok = ok && (res != NULL) && (response.status_code == HTTP_RESPONSE_CODE_OK) && (StrLen(&response.body) == 0);- In
Http.c:268:
HttpResponse response = HttpResponseInit(alloc_base);
HttpResponse *res = HttpRespondWithFile(
&response,
HTTP_RESPONSE_CODE_OK,
Last updated on