baresip / re

Generic library for real-time communications with async IO support
BSD 3-Clause "New" or "Revised" License
136 stars 83 forks source link

http/request: reset body mbuf pos on re-sending #1116

Closed maximilianfridrich closed 5 months ago

maximilianfridrich commented 5 months ago

This fixes the following bug:

If a HTTP request is resent (e.g. with Authentication after a 401 response), the body of the request is not sent.

This is because in req_body_handler mbuf_advance(conn->body, len) is called. Then the request is re-sent and the body size is obtained by calling mbuf_get_left(conn->body) which is now incorrect.

The fix is to reset the mbuf position of conn->body before re-sending a request.