Fixed bugs in httpserver, need smaphors
added locks and semaphors