This commit is contained in:
源文雨 2022-11-23 14:43:20 +08:00
parent db29be7054
commit a4a53d8a31
2 changed files with 5 additions and 4 deletions

3
c302.c
View File

@ -1,10 +1,9 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/file.h>
#include <sys/uio.h>
#include <time.h>
#include <unistd.h>
#include "c302.h"
static void http_error(ERRCODE code, char* msg) {

6
c302.h
View File

@ -1,6 +1,8 @@
#ifndef _C302_H_
#define _C302_H_
#include <stdint.h>
#define SERVER_STRING "Server: C302 by Fumiama/1.0\r\n"
#define HTTP302 "HTTP/1.0 302 Moved Temporarily\r\n"
#define LOCATION "Location: "
@ -11,7 +13,7 @@
#define H404 "HTTP/1.0 404 NOT FOUND\r\nContent-Type: text/html\r\n\r\n<HTML><TITLE>Not Found</TITLE>\r\n<BODY><P>%s\r\n</BODY></HTML>\r\n"
#define H500 "HTTP/1.0 500 Internal Server Error\r\nContent-Type: text/html\r\n\r\n<P>%s\r\n"
const char* types[] = {H400, H404, H500};
const unsigned char typel[] = {59, 111, 69};
const uint8_t typel[] = {59, 111, 69};
enum ERRCODE {HTTP400, HTTP404, HTTP500};
typedef enum ERRCODE ERRCODE;
@ -22,6 +24,6 @@ static const char* urls[] = {
"https://bocchi.rocks/assets/img/page/character/ikuyo/main.png" // 喜多郁代
};
static const unsigned short urlsl[] = {62, 62, 59, 61};
static const uint16_t urlsl[] = {62, 62, 59, 61};
#endif