get_asset.c
674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <sys/types.h>
#include "http/header.h"
#include "http/message.h"
#include "http/request.h"
#include "http/response.h"
#include "utils/memory.h"
#include "hash.h"
HttpMessage
httpWorkerGetAsset(
HttpRequest request,
const char * fname,
const char * mime,
size_t nmime)
{
char * match;
size_t nmatch;
HttpHeader header;
header = hashGet(
((HttpMessage)request)->header,
CSTRA("If-None-Match"));
if (NULL == header) {
match = "";
nmatch = 0;
}
else {
match = (header->value)[0];
nmatch = (header->nvalue)[0];
}
return (HttpMessage)httpResponseAsset(
fname, mime, nmime, match, nmatch);
}
// vim: set ts=4 sw=4: