Http application layer fixes

I can not accept this Pull Request until you remove this ugly C-style cast !