diff options
Diffstat (limited to 'smalldog/README.md')
-rw-r--r-- | smalldog/README.md | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/smalldog/README.md b/smalldog/README.md deleted file mode 100644 index 2505f5f..0000000 --- a/smalldog/README.md +++ /dev/null @@ -1,43 +0,0 @@ -smalldog - -a crate for safely working with corgi's cgi module system. - -module's are loaded in a new thread at the time of request. - -if you want to build a module in C, these structs will be of use: -```c -// In Rust this is interpreted as a fixed size, 2-element array of char* -// but i cannot get C to like that kind of at all. sorry. -struct pair { - char *name; - char *value; -}; - -// The request from corgi. body may be null if one was not sent. -struct request { - u64_t headers_len; - struct pair *headers; - u64_t body_len; - u8_t *body; -}; - -// The request your module should return to corgi -struct response { - u16_t status; - u64_t headers_len; - struct pair *headers; - u64_t body_len; - u8_t *body; -}; -``` - -as well as that, there are two functions that corgi expects to exist and will call. - -`struct response *cgi_handle(struct request*);` -this function is called after the module is loaded. here you should process the -request and send back a response. be sure to keep track of any allocations so -you can clean them up later. - -`void cgi_cleanup(struct response*);` -this is where you clean up, later. function is called after corgi copies all -required data to an internal structure. free memory here. \ No newline at end of file |