webserv is a I/O Multiplexing HTTP/1.1 server.
👉 노션 페이지
# Compile the sources
make
# Run the server (if no
./webserv [config_file]
- Nginx-like configuration file
- HTTP Protocol (ex. status line, request line...)
- HTTP 1.1 Header
- I/O multiplexing (kqueue)
- GET, POST, DELETE HTTP methods
- HTTP redirections
- HTTP response status codes (ex. 200, 301...)
- CGI implementation (ex. bla, php...)
- Auto Index on/off
server
{
server_name default
listen 8180 127.0.0.1
location /
{
error_page 404 ./tests/test1/error404.html
allow_methods GET POST DELETE
root ./tests/test1/
index index.html index2.html
auto_index on
cgi_info .php ./tests/tester_bin/php-cgi
cgi_info .bla ./tests/tester_bin/cgi_tester
}
location /auth/
{
allow_methods GET POST DELETE
request_max_body_size 42
root ./tests/test1/
index index.html index2.html
auto_index on
cgi_info .php ./tests/tester_bin/php-cgi
auth_key selim:1234
}
}
server
: server blocklisten
: port and iplocation
: set for specific routeerror_page
: path for custom error pageallow_method
: allowed methods for HTTP requestsindex
: default file for the requested URIcgi_info
: cgi execute for specific file extensionrequest_max_body_size
: max limit for request body sizeauth_key
: authorization needed
- curl
curl -X POST -H “Content-Type: plain/text” –data “BODY is here and write something longer or shorter than limit”
- Postman
[POST] localhost:8179/index.html
[GET/DELETE] localhost:8179/index
- Browser
localhost:8182
localhost:8180/youpi.php
- Siege
# 소켓 제한을 풀어주는 명령어
sudo sysctl -w net.inet.tcp.msl=100
# seige 명령어
siege -b -R <(echo connection = keep-alive) -c100 127.0.0.1:8180