title: How to properly handle client "Connection: close" request on HTTP file server?
body: <p>How do I handle properly a client <code>Connection: close</code> request field? As of now if I get this particular field I close the socket and wait for a following request from the client than reply again and start serving the data.</p>
  
  <p>I don't know why my client/server communication is not working as the Apache Server I tested with.</p>
  
  <p>Thanks for any clarifications...</p>
  
  <p><strong>Client/Server comunication:</strong></p>
  
  <pre><code>CLIENT:
  HEAD /stream.mpeg HTTP/1.0
  Host: 127.0.0.1
  User-Agent: SuperPlayer
  Connection: Close
  
  SERVER:
  HTTP/1.0 200 OK 
  Date: Wed, 1 Jun 2011 20:05:13 GMT
  Server: HTTP Server
  Last-Modified: Mon, 06 Aug 2009 01:02:23 GMT
  Accept-Ranges: bytes
  Connection: Close
  Content-Type: audio/mpeg
  
  CLIENT:
  HEAD /stream.mpeg HTTP/1.0
  Host: 127.0.0.1
  User-Agent: SuperPlayer
  Connection: Close
  
  SERVER:
  HTTP/1.0 200 OK 
  Date: Wed, 1 Jun 2011 20:05:13 GMT
  Server: HTTP Server
  Last-Modified: Mon, 06 Aug 2009 01:02:23 GMT
  Accept-Ranges: bytes
  Connection: Close
  Content-Type: audio/mpeg
  
  231489172304981723409817234981234acvass123412323
  21312hjdfaoi8w34yorhadl4hi8rali45mhalo3i,wmotw
  345fqw354aoicu43yocq2i3hr
  </code></pre>
  
  <p><strong>Client/ApacheServer Comunication:</strong></p>
  
  <pre><code>CLIENT:
  GET /test.mp3 HTTP/1.0
  Host: 192.168.1.120
  User-Agent: SuperPlayer
  Connection: Close
  
  SERVER:
  HTTP/1.1 200 OK
  Date: Wed, 01 Jun 2011 19:15:11 GMT
  Server: Apache/2.2.16 (Win32)
  Last-Modified: Thu, 29 Apr 2010 21:06:34 GMT
  ETag: "14000000047049-4f75c8-4856680636a80"
  Accept-Ranges: bytes
  Content-Length: 5207496
  Connection: close
  Content-Type: audio/mpeg
  
  ...d.....&lt;).0.. ..........&lt;.@.. ( .h.$.J...1...i....A. ......c....a.9..!g.N...A. ........ ....&gt;......|.......8....a......|..|N.............'&gt;........?...C.....@..TJt.n .e...r.iL..#..IH...pR|.
  </code></pre>