Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make an http Server - Recommended books?

Tags:

c

http

I am interested in making a simple HTTP server in C to play with (of course I'm only expecting to learn more about how a server works and gain some knowledge from there). I saw some topics regarding the same question as well as providing code but that didnt help. Are there any books for what I'm looking for?

like image 658
Rrjrjtlokrthjji Avatar asked Oct 13 '25 06:10

Rrjrjtlokrthjji


1 Answers

First, there are many HTTP server C code out there. At least, have a look into some of them.

There are also several libraries for adding HTTP server abilities to your software. I do like the onion library, but there are others (libmicrohttpd, Wt for C++, etc...).

You need to be fluent with

  • advanced unix programming
  • unix networking programming
  • HTTP protocol
  • The C10K problem
  • FastCGI perhaps

I'm not sure it is worth the effort to re-implement a simple HTTP server. You probably won't do better than existing stuff in a reasonable time.

You might learn more by studying and improving existing code.

At last, your question is perhaps off-topic here. Did you consider asking on programmers's forum?

Actually, since HTTP is a complex protocol (above TCP/IP which is itself complex, implemented e.g. on operating systems like Posix or Linux which are complex), you won't be able to make a simple but standard compliant implementation (if you want it robust enough, which is required by HTTP specs). It has to be complex!

You definitely will learn a lot by implementing something simple. Just read a little bit about HTTP (e.g. wikipedia's page on HTTP, and start implementing some simple GET and HEAD requests); but you should have some knowledge about e.g. basic Linux network programming. However, you'll then implement only a subset of HTTP.

like image 150
Basile Starynkevitch Avatar answered Oct 14 '25 20:10

Basile Starynkevitch