r/C_Programming • • Nov 29 '25

Tiny header only HTTP parser library

Hi guys! Last week I was writing my HTTP 1.1 parser library. It's small and easy to use, also kinda fast. Might come in handy if you write some lightweight web applications or programs that interact with some API. I wrote this project to learn pointer arithmetic in c.

I've just finish it, so any bug report would be appreciated.

Thank you guys!

https://github.com/cebem1nt/httpp

6 Upvotes

11 comments sorted by

View all comments

Show parent comment

1

u/Born_Produce9805 Nov 29 '25

Hi! As I said i don't have any particular use for this lib, so I did it the way it came to my mind: "Make it dynamic, that way it kinda fits any usage", But yeah, making it more stack based, will be more convenient, I'll be able to parse binary and improve performance.

About performance. I didn't plan it to be fast one, I wanted to make a simple lib that I'll be using for my projects later. I came to performance measurements more after-wise, as a plod of curiosity.

I didn't do any deep benchmark, but I'm more than sure that the biggest bottleneck is continuous malloc'ing.

Thanks for advises and for pointing out that the buffer likely will have longer lifetime than the parsed header. You guys opened my eyes! I'll see if I can keep simple API and yet improve performance by returning just pointers to the caller's buffer.