예제 #1
0
파일: example.c 프로젝트: Indrikoterio/kore
int
serve_style_css(struct http_request *req)
{
    char		*date;
    time_t		tstamp;

    tstamp = 0;
    if (http_request_header(req, "if-modified-since", &date)) {
        tstamp = kore_date_to_time(date);
        kore_mem_free(date);

        kore_debug("header was present with %ld", tstamp);
    }

    if (tstamp != 0 && tstamp <= asset_mtime_style_css) {
        http_response(req, 304, NULL, 0);
    } else {
        date = kore_time_to_date(asset_mtime_style_css);
        if (date != NULL)
            http_response_header(req, "last-modified", date);

        http_response_header(req, "content-type", "text/css");
        http_response(req, 200, asset_style_css, asset_len_style_css);
    }

    return (KORE_RESULT_OK);
}
예제 #2
0
파일: example.c 프로젝트: liexusong/kore
int
serve_style_css(struct http_request *req)
{
	int		ret;
	char		*date;
	time_t		tstamp;

	tstamp = 0;
	if (http_request_header_get(req, "if-modified-since", &date)) {
		tstamp = kore_date_to_time(date);
		kore_mem_free(date);

		kore_debug("header was present with %ld", tstamp);
	}

	if (tstamp != 0 && tstamp <= static_mtime_css_style) {
		ret = http_response(req, 304, NULL, 0);
	} else {
		date = kore_time_to_date(static_mtime_css_style);
		if (date != NULL)
			http_response_header_add(req, "last-modified", date);

		http_response_header_add(req, "content-type", "text/css");
		ret = http_response(req, 200, static_css_style,
		    static_len_css_style);
	}

	return (ret);
}