title: Http keep-alive protocol "Connection: close" from client but no "connection" header from server
body: <p>I've a problem with broken connections and I believe this is due to an incorrect behavior respect to http keepalive but I can't understand if the 'culpit' is on the client or on the server side.</p>
  
  <p>I'm dealing with a scenario where the client sends and HTTP 1.1 request with:</p>
  
  <pre><code>Connection: close
  </code></pre>
  
  <p>and the server does NOT reply with a Connection header.
  The behavior is as follows:</p>
  
  <ol>
  <li>The client sends the request</li>
  <li>The server sends it response</li>
  <li>The server does NOT close the connection</li>
  <li>The client does NOT close the connection (.1)</li>
  <li>The client sends another request using the same connection</li>
  <li>The server does not do anything and after 30" closes the connection</li>
  </ol>
  
  <p>The components are as follows:</p>
  
  <ul>
  <li>Client: Java HttpConnection (within Dell Boomi iPaaS)</li>
  <li>Server: SAP ERP OData Webservice</li>
  </ul>
  
  <p>According to this article: "<a href="https://stackoverflow.com/questions/3424796/should-a-server-adhere-to-the-http-connection-close-header-sent-from-a-client">Should a server adhere to the HTTP Connection: close header sent from a client?</a>" the problem seems to be on the client side. However the Java HttpURLCoonnection implementation should be pretty robust (tested x64 server VM on Linux v 1.7.0_55-b13 and x64 server on Windows 7 v 1.7.0_75-b13).</p>
  
  <p>Here are the complete set of headers from the 1st request from client:</p>
  
  <pre><code>GET /sap/opu/odata/SAP/ZZSALESORDER_SRV/$metadata HTTP/1.1
  User-Agent: Boomi Http Transport
  Authorization: Basic YmPRIVATESECRETPLEASExNg==
  X-CSRF-Token: Fetch
  Connection: close
  Cache-Control: no-cache
  Pragma: no-cache
  Host: some.server.behind.firewall.local:8000
  Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
  Cookie: sap-usercontext=sap-client=100; SAP_SESSIONID_DEV_100=Cm7LsDSECRETSECRETSECTERFaIMak%3d
  </code></pre>
  
  <p>And these are the ones from the response from the server:</p>
  
  <pre><code>HTTP/1.1 200 OK
  content-type: application/xml
  content-length: 79750
  x-csrf-token: oolTHISAGAINISASECRET3PA==
  last-modified: Fri, 25 Mar 2016 17:55:35 GMT
  dataserviceversion: 2.0
  </code></pre>
  
  <p>After the server has replied the client sends a second request using the same connection:</p>
  
  <pre><code>PUT /sap/opu/odata/SAP/ZZSALESORDER_SRV/SalesOrderItems(NumDocSap='1200001534',PosId='000020') HTTP/1.1
  User-Agent: Boomi Http Transport
  Content-Type: application/atom+xml
  X-CSRF-Token: oolZMYSECRETPA==
  Connection: close
  Authorization: Basic YmPRIVATESECRETPLEASExNg==
  Cache-Control: no-cache
  Pragma: no-cache
  Host: some.server.behind.firewall.local:8000
  Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
  Content-Length: 406
  Cookie: sap-usercontext=sap-client=100; SAP_SESSIONID_DEV_100=Cm7PRETTYPRIVATESECRETak%3d
  </code></pre>
  
  <p>and the server does not reply and closed the connection abruptly after 30".</p>
  
  <p>The problem can be completely resolved setting the JVM flag</p>
  
  <pre><code>http.keepAlive=false
  </code></pre>
  
  <p>on the java client side (Boomi) but this seems more of a workaround then a solution.</p>
  
  <p>Can someone please explain:</p>
  
  <ul>
  <li>is there an HTTP protocol violation on client or server side?</li>
  <li>can this be fixed by sending different headers?</li>
  </ul>