endheaders
uses send
internally (indirectly). The difference might be in performance. If data
is a bytes object then .endheaders(data)
tries to send headers and data together. See the comment in _send_output()
:
896 # If msg and message_body are sent in a single send() call,
897 # it will avoid performance problems caused by the interaction
898 # between delayed ack and the Nagle algorithm.