Added Apache Licence

Added Apache Licence in all files
corrected endless loop in http put file