You could add the flush command within the function bound to the rquestcomplete delegate function. It would then trigger at the correct time.(you might already have this)
Or as a cleanup function that is triggered if it fails or succeeds.
Also have you seen this thread regarding ssl?
It also tackles a lack if response but it due to certificates.