mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-05-10 18:58:46 +02:00
「✨」 feat: added mimetype and some other few thing
This commit is contained in:
22
Dockerfile
22
Dockerfile
@ -2,12 +2,22 @@ FROM alpine:3.21
|
||||
|
||||
COPY ./ /build
|
||||
|
||||
RUN apk add --no-cache clang make \
|
||||
&& cd /build \
|
||||
&& make \
|
||||
&& chmod +x webserv \
|
||||
&& cp webserv /bin/webserv
|
||||
ENV PKGS=true
|
||||
ENV TTY=true
|
||||
|
||||
RUN apk add --no-cache bash clang make
|
||||
|
||||
RUN cd /build \
|
||||
&& PKGS=true make -j re
|
||||
|
||||
COPY /build/webserv /bin/webserv
|
||||
|
||||
RUN chmod +x /bin/webserv
|
||||
|
||||
WORKDIR /
|
||||
|
||||
RUN webserv --generate
|
||||
|
||||
STOPSIGNAL SIGINT
|
||||
|
||||
RUN [ "/bin/webserv", "$WEBSERV-CONF"]
|
||||
RUN [ "webserv", "/sample.toml"]
|
||||
|
@ -6,13 +6,13 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/10 13:43:54 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/11 11:36:22 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/26 16:14:37 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#define SAMPLE_CONF_PATH "./sample.conf"
|
||||
#define SAMPLE_CONF_PATH "./sample.toml"
|
||||
#define WEBSRV_VERSION "v0.1"
|
||||
|
||||
bool help(int, char **);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/11 17:45:43 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/25 17:20:12 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/26 16:36:05 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
#include <log.hpp>
|
||||
#include <netinet/in.h>
|
||||
#include <stdexcept>
|
||||
#include <sys/poll.h>
|
||||
#include <poll.h>
|
||||
#include <vector>
|
||||
|
||||
namespace webserv {
|
||||
|
@ -101,7 +101,7 @@ Route::Route(toml::ANode *table)
|
||||
_root = *static_cast<std::string *>(val);
|
||||
else
|
||||
#ifdef PKGS
|
||||
_root = "/var/www/html"
|
||||
_root = "/var/www/html";
|
||||
#else
|
||||
_root = "./html";
|
||||
#endif
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/24 14:50:37 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/04/25 17:30:09 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/26 12:19:34 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -33,7 +33,9 @@ std::map<std::string, std::string> http::Mime::initMimeTypes() {
|
||||
types["css"] = "text/css";
|
||||
types["csv"] = "text/csv";
|
||||
types["doc"] = "application/msword";
|
||||
types["docx"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
||||
types["docx"] =
|
||||
"application/"
|
||||
"vnd.openxmlformats-officedocument.wordprocessingml.document";
|
||||
types["eot"] = "application/vnd.ms-fontobject";
|
||||
types["epub"] = "application/epub+zip";
|
||||
types["gz"] = "application/gzip";
|
||||
@ -70,7 +72,9 @@ std::map<std::string, std::string> http::Mime::initMimeTypes() {
|
||||
types["pdf"] = "application/pdf";
|
||||
types["php"] = "application/x-httpd-php";
|
||||
types["ppt"] = "application/vnd.ms-powerpoint";
|
||||
types["pptx"] = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
||||
types["pptx"] =
|
||||
"application/"
|
||||
"vnd.openxmlformats-officedocument.presentationml.presentation";
|
||||
types["rar"] = "application/vnd.rar";
|
||||
types["rtf"] = "application/rtf";
|
||||
types["sh"] = "application/x-sh";
|
||||
@ -89,7 +93,8 @@ std::map<std::string, std::string> http::Mime::initMimeTypes() {
|
||||
types["woff2"] = "font/woff2";
|
||||
types["xhtml"] = "application/xhtml+xml";
|
||||
types["xls"] = "application/vnd.ms-excel";
|
||||
types["xlsx"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
types["xlsx"] =
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
types["xml"] = "application/xml";
|
||||
types["xul"] = "application/vnd.mozilla.xul+xml";
|
||||
types["zip"] = "application/zip";
|
||||
@ -98,11 +103,16 @@ std::map<std::string, std::string> http::Mime::initMimeTypes() {
|
||||
types["7z"] = "application/x-7z-compressed";
|
||||
types["lock"] = "application/json";
|
||||
types["nix"] = "text/plain";
|
||||
types["cpp"] = "text/plain";
|
||||
types["hpp"] = "text/plain";
|
||||
types["c"] = "text/plain";
|
||||
types["h"] = "text/plain";
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> http::Mime::mimeTypes = Mime::initMimeTypes();
|
||||
std::map<std::string, std::string> http::Mime::mimeTypes =
|
||||
Mime::initMimeTypes();
|
||||
|
||||
std::string http::Mime::getType(const std::string &filename) {
|
||||
size_t dot_pos = filename.find_last_of('.');
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/11 16:11:40 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/25 17:23:49 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/26 16:35:53 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/socket.h>
|
||||
#include <webserv.hpp>
|
||||
|
||||
|
Reference in New Issue
Block a user