Skip to main content

https_request

Function https_request 

Source
pub fn https_request(
    method: &str,
    host: &str,
    path: &str,
    extra_headers: &[(&str, &str)],
    content_type: &str,
    body: Option<&[u8]>,
) -> Result<HttpsGetResult, &'static str>
Expand description

任意メソッド + 任意ヘッダの HTTPS リクエスト(OAuth2 / REST API / XHR・fetch 用)。 Authorization: Bearer ... などの追加ヘッダを付けて送れる。body が Some なら Content-Type / Content-Length を付与する(content_type が空なら付けない)。

【2026-10-16】応答が途中で切れていたら(http_body::is_complete_response)、 冪等なメソッド(GET/HEAD/OPTIONS)に限り最大 3 回まで取り直す。従来は接続が切れても 手元の分を 200 として返し、Cloudflare が chunked で返す sugi-lab.net の papers.json (150,481 B)が 129,610 B で切れて jQuery の JSON 解析が黙って失敗、論文リストが約 3 回に 1 回出なかった。POST 等は二重送信になるので取り直さない。