Skip to main content

merge_range_response

Function merge_range_response 

Source
pub fn merge_range_response(
    partial: &[u8],
    off: usize,
    resp: &[u8],
) -> Option<Vec<u8>>
Expand description

途中まで受け取った応答 partial(200・全体の Content-Length 付き)に、 Range: bytes=off- への応答 resp の本文を継ぎ足した応答を返す。

resp が 206 で、Content-Range: bytes off-.../全体長 の開始位置と全体長が partial と一致するときだけ継ぎ足す(ファイルが差し替わっていたら混ぜない)。 resp 自体が途中で切れていても、伸びた分は返す(次の再開に使う)。