[core] perf: buffer copy and append
[core] perf: buffer copy and append

reorder some code
add more const
avoid redundant asserts

lighttpd/lighttpd1.4,gstrauss/lighttpd1.4,lighttpd/lighttpd1.4,lighttpd/lighttpd1.4,lighttpd/lighttpd1.4,lighttpd/lighttpd1.4,lighttpd/lighttpd1.4,gstrauss/lighttpd1.4,gstrauss/lighttpd1.4,gstrauss/lighttpd1.4,gstrauss/lighttpd1.4,gstrauss/lighttpd1.4