Aller au contenu
  1. Articles/

cURL : options avancées

·2 mins·
Memos - Cet article fait partie d'une série.
Partie 9: Cet article

Lors d’un diagnostic d’un lien réseau, cURL propose des options très informatives qu’il serait dommage de ne pas profiter. Grâce à elles, on va pouvoir mesurer les différentes étapes d’établissement de la connexion. La version utilisée de cURL est curl 8.5.0.

$ curl -o /dev/null -s -w 'Time lookup: %{time_namelookup}s\nTime redirect: %{time_redirect}s\nTime connect: %{time_connect}s\nTime appconnect:  %{time_appconnect}\nTime pretransfer:  %{time_pretransfer}\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n' HOSTNAME
ÉtapeVariableDescription
1time_namelookupRésolution DNS du nom de domaine
2time_redirectTemps passé sur les redirections éventuelles
3time_connectÉtablissement du handshake TCP en 3 étapes (SYN → SYN-ACK → ACK)
4time_appconnectHandshake TLS/SSL terminée (échange de certificats, négociation du chiffrement). 0 pour HTTP simple
5time_pretransferToute la configuration au niveau protocolaire est terminée ; cURL est prêt à envoyer le premier octet de la requête
6time_starttransfer(TTFB) Le premier octet de la réponse est reçu
7time_totalLe transfert entier est terminé, connexion fermée
Documentation (man curl)
time_appconnect
                The time, in seconds, it took from the start until the SSL/SSH/etc connect/handshake to the remote host was completed.

time_connect   The time, in seconds, it took from the start until the TCP connect to the remote host (or proxy) was completed.

time_namelookup
                The time, in seconds, it took from the start until the name resolving was completed.

time_pretransfer
                The time, in seconds, it took from the start until the file transfer was just about to begin. This includes all pre-transfer
                commands and negotiations that are specific to the particular protocol(s) involved.

time_redirect  The time, in seconds, it took for all redirection steps including name lookup, connect, pretransfer and transfer before  the
                final transaction was started. time_redirect shows the complete execution time for multiple redirections.

time_starttransfer
                The  time, in seconds, it took from the start until the first byte is received.  This includes time_pretransfer and also the
                time the server needed to calculate the result.
Memos - Cet article fait partie d'une série.
Partie 9: Cet article