Manually parsing HTTP? might consider using htpy (libhtp) -- but it might be more work than it's worth.
Also (shameless plug) take a look at the ChopShop v4 branch to see how http can be handled for you.