I'd add a check if the buffer is full and throw an error "HTTP Proxy reply header too long."
Should I increase the buffer size for being on the safer side?