I think it would be good to add in a comment to explain why this code is copied from htp. Also, what function in htp we should put on a watch list for modifications.