Commit bb14a14c authored by Diwaker Nithyanandan's avatar Diwaker Nithyanandan
Browse files

Upload New File

parent 23a41e82
//
// Created by Sebastian Schinzel on 25.03.20.
//
#ifndef ECHO_SERVER_HTTPLIB_H
#define ECHO_SERVER_HTTPLIB_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct string {
size_t len;
size_t pos;
char* str;
};
typedef struct string string;
//request
struct req_line {
string* http_methode;
string* http_ressource;
string* http_prot_ver;
};
typedef struct req_line req_line;
struct http_req {
req_line* request_line;
/*
string host;
string user_agent;
string accept;
string accept_language;
string accept_encoding;
string connection;
string upgrade_insecure_requests;
string cache_Control;
*/
};
typedef struct http_req http_req;
//response TODO
struct resp_line {
string* http_code;
string* http_status;
string* http_prot_ver;
};
typedef struct resp_line resp_line;
struct http_resp {
resp_line* response_line;
/*
string host;
string user_agent;
string accept;
string accept_language;
string accept_encoding;
string connection;
string upgrade_insecure_requests;
string cache_Control;
*/
};
typedef struct http_resp http_resp;
string* str_cat(string* dest, const char* src, size_t len);
string* new_string(size_t );
void print_string(string* str);
string* cpy_str(const char* src, size_t len);
void free_str(string* str);
size_t get_length(string* str);
char* get_char_str(string* str);
void split_Request(string* request, http_req* req);
string* str_tok(string* str,const char delim,size_t len);
http_req* new_request(size_t len);
req_line* new_req_line(size_t len);
http_resp* new_response(size_t len);
resp_line* new_resp_line(size_t len);
string* get_html_index(http_req* req);
string* get_HTTP_Header(http_resp* resp, size_t len);
void fill_Html_Resp(http_req* request ,http_resp* response );
char* readFile(string* path);
string* get_file_index(http_req* req);
string* get_html_body(string* req);
#endif //ECHO_SERVER_HTTPLIB_H
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment