Wait until IO finished before re-starting a request
In case of restarting it can happen that the new request is started before the previous one is fully completed. This is because restart is scheduled on SoupMessage::got-body that happens right before the stream is closed and the IO finished. In HTTP/1.x this is possible if a new request is made in got-body callback, for example. In HTTP/2 is easier to reproduce because we emit SoupMessage::got-body right after SoupClientInputStream::eof. This patch adds an intermediate state SOUP_MESSAGE_REQUEUED set by soup_session_requeue_item(). The transition to SOUP_MESSAGE_RESTARTING happens when the message IO completes to ensure the restarted request starts when message no longer has an active IO.
Showing with 51 additions and 1 deletion