setup response header struct
This commit is contained in:
parent
16481ec708
commit
aaeac2ad7f
3
src/headers.c
Normal file
3
src/headers.c
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#include "include/headers.h"
|
||||||
|
|
||||||
|
|
89
src/include/headers.h
Normal file
89
src/include/headers.h
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifndef HEADERS_H
|
||||||
|
#define HEADERS_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response Headers
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
BYTES, // bytes
|
||||||
|
NONE // none
|
||||||
|
} accept_ranges_t;
|
||||||
|
|
||||||
|
struct response_headers {
|
||||||
|
/**
|
||||||
|
* Accept-Ranges: ...
|
||||||
|
*
|
||||||
|
* If we should accept a range request for a resource, defaults to NONE
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
accept_ranges_t accept_ranges;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Age: ...
|
||||||
|
*
|
||||||
|
* represents time in seconds
|
||||||
|
*
|
||||||
|
* time since the response was generated, this is for cached responses,
|
||||||
|
* if we are cacheing, this header is REQUIRED
|
||||||
|
*/
|
||||||
|
uint age;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ETag: ...
|
||||||
|
*
|
||||||
|
* Current value of the entity tag for the requested tag
|
||||||
|
* only useful if we're sending an entity body+header aswell
|
||||||
|
*/
|
||||||
|
const char* etag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Location: absoluteURI
|
||||||
|
*
|
||||||
|
* For 201 (created), this should be the new source that was created
|
||||||
|
* for 3xx this should indicate the servers preferred URI for automatic redirection
|
||||||
|
*/
|
||||||
|
const char* location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proxy-Authenticate: ...
|
||||||
|
*
|
||||||
|
* For 407 this is a required field
|
||||||
|
*/
|
||||||
|
const char* proxy_authenticate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retry-After: (HTTP-date | delta-seconds)
|
||||||
|
*
|
||||||
|
* can be used with a 503 to indicate how long its expeccted to be unavailable
|
||||||
|
* may be used with 3xx to tell how long to wait before redirecting
|
||||||
|
*/
|
||||||
|
const char* retry_after;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server: product/version ...
|
||||||
|
*
|
||||||
|
* Information about the HTTP server
|
||||||
|
*/
|
||||||
|
const char* server;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vary: (* | field-name)
|
||||||
|
*
|
||||||
|
* This is for a cacheable (or non cacheable reponse)
|
||||||
|
* that is subject to server-driven negotiation
|
||||||
|
*/
|
||||||
|
const char* vary;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WWW-Authenticate: ...
|
||||||
|
*
|
||||||
|
* required for 401
|
||||||
|
*/
|
||||||
|
const char* www_authenticate;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user