Integrated Hibri's fixes: request location now correct, duplicated content length handled properly