What's your favorite book/post/lecture/whatever? I'd also be interested in opinionated writeups/positions.
Ask HN: Resources for Building a Webserver in C?
1–10 of 67 posts
Re: Ask HN: Resources for Building a Webserver in C?
#2Re: Ask HN: Resources for Building a Webserver in C?
#3If you wish, use the source. (Almost?) all early webservers were written in C.
Re: Ask HN: Resources for Building a Webserver in C?
#4Re: Ask HN: Resources for Building a Webserver in C?
#5Re: Ask HN: Resources for Building a Webserver in C?
#6Re: Ask HN: Resources for Building a Webserver in C?
#7Re: Ask HN: Resources for Building a Webserver in C?
#8If you wish, use the source. (Almost?) all early webservers were written in C.
Being largely unfamiliar with C, I would prefer conceptual resources over source code. The why is more important than the how. Hopefully that makes sense?
Re: Ask HN: Resources for Building a Webserver in C?
#9Re: Ask HN: Resources for Building a Webserver in C?
#10If you wish, use the source. (Almost?) all early webservers were written in C.
Being largely unfamiliar with C, I would prefer conceptual resources over source code. The why is more important than the how. Hopefully that makes sense?
o bind a socket
o manage incoming connections
o parse http headers
o 'routing' - demultiplex handlers based on URL
o encode response
unless its a little embedded thing one usually uses some kind of select/epoll machinery to multiplex the work on each channel. I guess thread-per-request is another model that works at moderate connection counts.it helps to have some decent way of representing the header to send to the handler, C doesn't really have a great story here
I think the only funky thing is dealing with all the various body modes. so you will need to make some kind of protocol to deal with handlers and incremental updates if that's a thing for your use case.
I would just do the normal thing, read the rfc and spit out a couple hundred lines that talks to your browser...and then decide where if anywhere you need to go from there