mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-21 14:17:30 -04:00
BUG/MINOR: action: do-resolve does not yield on requests with body
@davidmogar reported a github issue (#227) about problems with do-resolve action when the request contains a body. The variable was never populated in such case, despite tcpdump shows a valid DNS response coming back. The do-resolve action is a task in HAProxy and so it's waken by the scheduler each time the scheduler think such task may have some work to do. When a simple HTTP request is sent, then the task is called, it sends the DNS request, then the scheduler will wake up the task again later once the DNS response is there. Now, when the client send a PUT or a POST request (or any other type) with a BODY, then the do-resolve action if first waken up once the headers are processed. It sends the DNS request. Then, when the bytes for the body are processed by HAProxy AND the DNS response has not yet been received, then the action simply terminates and cleans up all the data associated to this resolution... This patch detect such behavior and if the action is now waken up while a DNS resolution is in RUNNING state, then the action will tell the scheduler to wake it up again later. Backport status: 2.0 and above
This commit is contained in:
parent
2aaeee34da
commit
4c52e4b560
1 changed files with 3 additions and 0 deletions
|
|
@ -2150,6 +2150,9 @@ enum act_return dns_action_do_resolve(struct act_rule *rule, struct proxy *px,
|
|||
/* we have a response to our DNS resolution */
|
||||
if (s->dns_ctx.dns_requester && s->dns_ctx.dns_requester->resolution != NULL) {
|
||||
resolution = s->dns_ctx.dns_requester->resolution;
|
||||
if (resolution->step == RSLV_STEP_RUNNING) {
|
||||
return ACT_RET_YIELD;
|
||||
}
|
||||
if (resolution->step == RSLV_STEP_NONE) {
|
||||
/* We update the variable only if we have a valid response. */
|
||||
if (resolution->status == RSLV_STATUS_VALID) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue