first steps
This commit is contained in:
3
.clang-format
Normal file
3
.clang-format
Normal file
@@ -0,0 +1,3 @@
|
||||
UseTab: Always
|
||||
IndentWidth: 8
|
||||
TabWidth: 8
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,6 @@
|
||||
build/
|
||||
.cache/
|
||||
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
|
||||
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"clangd.path": "/usr/bin/clangd"
|
||||
}
|
||||
28
README.md
28
README.md
@@ -1,2 +1,28 @@
|
||||
# cws
|
||||
A Web Server written in C (educational project)
|
||||
A Web Server written in C (educational purposes)
|
||||
|
||||
## Requirements
|
||||
- [meson](https://mesonbuild.com/index.html)
|
||||
|
||||
## How to build
|
||||
```bash
|
||||
$ meson setup build
|
||||
$ cd build
|
||||
$ meson compile
|
||||
```
|
||||
And then run `cws`!
|
||||
|
||||
## Roadmap
|
||||
- [ ] Understading basic web server concepts
|
||||
- [ ] Basic server
|
||||
- [ ] Enhance web server
|
||||
- [ ] Request parser (methods and headers)
|
||||
- [ ] Serve static files
|
||||
- [ ] Multithreading (non blocking I/O with `epoll`)
|
||||
- [ ] Logging
|
||||
- [ ] Advanced
|
||||
- [ ] HTTPS support
|
||||
- [ ] Caching
|
||||
|
||||
## Resources
|
||||
- [Beej's Guide to Network Programming](https://beej.us/guide/bgnet/)
|
||||
|
||||
7
include/main.h
Normal file
7
include/main.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
#define GREEN_COLOR "\033[32m"
|
||||
#define RESET_COLOR "\033[0m"
|
||||
|
||||
#endif
|
||||
13
include/server.h
Normal file
13
include/server.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef __SERVER_H__
|
||||
#define __SERVER_H__
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#define PORT 3030
|
||||
// how many pending connections the queue will hold
|
||||
#define BACKLOG 10
|
||||
|
||||
#endif
|
||||
6
meson.build
Normal file
6
meson.build
Normal file
@@ -0,0 +1,6 @@
|
||||
project('tutorial', 'c')
|
||||
|
||||
subdir('src')
|
||||
incdir = include_directories('include')
|
||||
|
||||
executable('cws', sources, include_directories: incdir)
|
||||
6
src/main.c
Normal file
6
src/main.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "main.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
puts(GREEN_COLOR "Running cws..." RESET_COLOR);
|
||||
}
|
||||
1
src/meson.build
Normal file
1
src/meson.build
Normal file
@@ -0,0 +1 @@
|
||||
sources = files('main.c', 'server.c')
|
||||
5
src/server.c
Normal file
5
src/server.c
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "server.h"
|
||||
|
||||
int start_server(void) {
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user