title: Stream video to Windows Media Player over http
body: <p>Trying to stream video to windows media player from a servlet (progressive download style). The streaming works, but I have some weird behavior, which I would like to rule out is not caused by a problem in my implementation.</p>
  
  <p>When using WMP to open an url from the servlet, WMP will perform a total of 4 http-get requests for the same resource, but with slightly different headers each time. The connection for the first 3 requests seems to be closed as soon as the request (including headers) have been sent. The fourth request remains connected, and I can actually deliver response headers and the file content.</p>
  
  <p>Have tried using wireshark to watch the first three requests. Identical starts of responses are sent for all 4 requests, and the first 3 requests managed to send the response headers, and some part of the file content before being closed. (Don't know if its relevant, but have to enable "Support packet-capture from IP TSO-enabled hardware" for wireshark to correctly parse the stream, otherwise the first packet containing the http-response is seen as malformed.) </p>
  
  <p>The 4 request headers below here:</p>
  
  <pre><code>GET /basic/test.mpg HTTP/1.1
  Accept: */*
  User-Agent: Windows-Media-Player/12.0.7600.16415
  Accept-Encoding: gzip, deflate
  Host: 192.168.1.34
  Connection: Keep-Alive
  
  GET /basic/test.mpg HTTP/1.1
  Cache-Control: no-cache
  Connection: Keep-Alive
  Pragma: getIfoFileURI.dlna.org
  Accept: */*
  User-Agent: NSPlayer/12.00.7600.16385 WMFSDK/12.00.7600.16385
  GetContentFeatures.DLNA.ORG: 1
  Host: 192.168.1.34
  
  GET /basic/test.mpg HTTP/1.1
  Accept: */*
  User-Agent: NSPlayer/12.00.7600.16385 WMFSDK/12.00.7600.16385
  Icy-Metadata: 1
  Accept-Encoding: gzip, deflate
  Host: 192.168.1.34
  Connection: Keep-Alive
  
  GET /basic/test.mpg HTTP/1.1
  Cache-Control: no-cache
  Connection: Keep-Alive
  Pragma: getIfoFileURI.dlna.org
  Accept: */*
  User-Agent: NSPlayer/12.00.7600.16385 WMFSDK/12.00.7600.16385
  GetContentFeatures.DLNA.ORG: 1
  Host: 192.168.1.34
  </code></pre>
  
  <p>Response headers:</p>
  
  <pre><code>HTTP/1.1 200 OK
  Content-Type: video/mpeg
  Content-Length: 130549760
  ETag: TEST1286565215430
  ContentFeatures.DLNA.ORG: DLNA.ORG_PN=MPEG_PS_PAL;DLNA.ORG_OP=00
  Server: Jetty(6.1.x)
  </code></pre>