これまで何も見つかりませんが、実際にはタイムアウトがまったくcurl
ありませんか?
user@host:~# curl http://localhost/testdir/image.jpg
testdir
画像に対する要求は、これらの画像を動的に生成する別々のApacheモジュールにリダイレクトするために尋ねます。画像が実際に準備され、要求された顧客に配信されるまでに最大15分かかることがあります。
常にcurl
待ってください(または構成によって異なります)。それともタイムアウトがありますか?
ベストアンサー1
はい。
タイムアウトパラメータ
curl
--connect-timeout
との2つのオプションがあります--max-time
。
マニュアルページを引用すると、次のようになります。
--connect-timeout <seconds>
Maximum time in seconds that you allow the connection to the
server to take. This only limits the connection phase, once
curl has connected this option is of no more use. Since 7.32.0,
this option accepts decimal values, but the actual timeout will
decrease in accuracy as the specified timeout increases in deci‐
mal precision. See also the -m, --max-time option.
If this option is used several times, the last one will be used.
そして:
-m, --max-time <seconds>
Maximum time in seconds that you allow the whole operation to
take. This is useful for preventing your batch jobs from hang‐
ing for hours due to slow networks or links going down. Since
7.32.0, this option accepts decimal values, but the actual time‐
out will decrease in accuracy as the specified timeout increases
in decimal precision. See also the --connect-timeout option.
If this option is used several times, the last one will be used.
デフォルト
ここ(Debianでは)の使用と指定された時間に関係なく、2分後に接続試行が停止します--connect-timeout
。ただし、デフォルトの接続タイムアウト値は次のとおりです。5分DEFAULT_CONNECT_TIMEOUT
ホンジュンの言葉によるとライブラリ/connections.h。
のデフォルトは--max-time
存在しないように見え、curl
初期接続が成功すると応答を永遠に待ちます。
何を使うべきですか?
あなたは後者のオプションに興味があるかもしれません--max-time
。状況に応じて900
(15分)に設定してください。
(1分)のように--connect-timeout
オプションを指定するのも良い考えかもしれません。60
それ以外の場合は、curl
バックオフアルゴリズムの種類を使用して接続を継続しようとします。