title: Apache Http Client 4.5.2 Kerberos authentication takes too long
body: <p>I use apache http client for Kerberos authentication. I have the following problem:
  between the 401 ad 200 responses from the server it takes between 90 and 300 seconds, depending on the request.</p>
  
  <p>I tried to set the connection timeout, socket timeout and connection manager timeout without any result.</p>
  
  <p>Wireshark tells me following:</p>
  
  <p>after 401 response from server:</p>
  
  <pre><code>client -&gt; ACK
  server -&gt; FIN, ACK
  client -&gt; ACK
  
  -- break between 90 to 300 seconds --
  
  client -&gt; GET url
  server -&gt; RST
  </code></pre>
  
  <p>from here starts the 200 response, everything ok. I do not understand why apache http client does not close the connection and reopens a new one, why it takes so long?</p>
  
  <p>Any help would be appreciate.</p>
  
  <p>Update:
  There are more KDC Servers and not everyone is available, the reason for the delay is the max_retries 3, and 30 second per request timeout.
  I tries to configure krb5.conf file, but it seems that Kerberos does not consider this:</p>
  
  <pre><code>[libdefaults]
  ...
  kdc_timeout = 2000
  max_retries = 1
  </code></pre>