If raw IP packet will make code complicated, TCP socket can save IP and TCP header.
Following link can make you build HTTP server or client much easy.
http://www.jmarshall.com/easy/http/
Another library is good choice, libebb.
libebb is a lightweight HTTP server library for C. It lays the foundation for writing a web server by providing the socket juggling and request parsing. By implementing the HTTP/1.1 grammar provided in RFC2612, libebb understands most most valid HTTP/1.1 connections (persistent, pipelined, and chunked requests included) and rejects invalid or malicious requests. libebb supports SSL over HTTP.