title: unexpected behavior of wget?
body: <p>this is not actually a question, it is for someone --if possible-- to tell me what exactly does wget when launched with the -c --or --continue-- option.</p>
  
  <p>here is a section for the -c option from wget's man page:
  (...)
  Beginning with Wget 1.7, if you use -c on a non-empty file, and it turns out that the server does not support continued downloading, Wget will refuse to start the download from scratch, which would effectively ruin existing contents. If you really want the download to start from scratch, remove the file.
  (...)
  Note that -c only works with FTP servers and with HTTP servers that support the "Range" header.</p>
  
  <p>ok, reading that, what i first did was to perform some tests on wget's resuming. i noticed that wget weren't doing as stated before, so let me show what my final test is:</p>
  
  <p>first i modified the example that uses SimpleHTTPRequestHandler for creating a simple webserver that serves static files, this allow me to view headers sent in both directions:</p>
  
  <pre><code>import http.server
  import socketserver
  import os
  import sys
  
  PORT = 8000
  
  class Handler(http.server.SimpleHTTPRequestHandler):
      def _print_headers(self):
          for header, hvalue in self.headers.items():
              print('%s: %s' % (header, hvalue))
  
      def send_header(self, keyword, value):
          print("%s: %s" % (keyword, value))
          return super(Handler, self).send_header(keyword, value)
  
      def do_GET(self):
          print('%sGET%s' % ('*' * 10, '*' * 10))
          self._print_headers()
          print('%sRESPONSE HEADERS%s' % ('*' * 4, '*' * 3))
          return super(Handler, self).do_GET()
  
      def do_HEAD(self):
          print('%sHEAD%s' % ('*' * 10, '*' * 9))
          self._print_headers()
          print('*' * 23)
          print('%sRESPONSE HEADERS%s' % ('*' * 4, '*' * 3))
          return super(Handler, self).do_HEAD()
  
  httpd = socketserver.TCPServer(("", PORT), Handler)
  
  print("serving at port", PORT)
  httpd.serve_forever()
  </code></pre>
  
  <p>having the server running, i started wget to get some portion of some file (waiting a short time and then ^C):</p>
  
  <pre><code>wget --limit-rate=10m http://localhost:8000/carlitos\ way.avi
  </code></pre>
  
  <p>at this step headers received in the HTTP request and the ones returned are:</p>
  
  <pre><code>**********GET**********
  User-Agent: Wget/1.16 (linux-gnu)
  Accept: */*
  Host: localhost:8000
  Connection: Keep-Alive
  ****RESPONSE HEADERS***
  127.0.0.1 - - [09/May/2015 21:52:44] "GET /carlitos%20way.avi HTTP/1.1" 200 -  # this line gets printed before sending response headers
  Server: SimpleHTTP/0.6 Python/3.4.2
  Date: Sun, 10 May 2015 01:52:44 GMT
  Content-type: video/x-msvideo
  Content-Length: 1526812672
  Last-Modified: Fri, 04 Sep 2009 13:12:22 GMT
  </code></pre>
  
  <p>then i launched wget with the -c option to resume the download: </p>
  
  <pre><code>wget --limit-rate=10m -c http://localhost:8000/carlitos\ way.avi
  </code></pre>
  
  <p>here it should refuse to start the download --as stated in the docs, but instead it does performs the download --from scratch-- but no Accept-Ranges header nor Partial Content response were given as shown below:</p>
  
  <pre><code>**********GET**********
  Range: bytes=298172416-
  User-Agent: Wget/1.16 (linux-gnu)
  Accept: */*
  Host: localhost:8000
  Connection: Keep-Alive
  ****RESPONSE HEADERS***
  127.0.0.1 - - [09/May/2015 21:56:07] "GET /carlitos%20way.avi HTTP/1.1" 200 -  # this line gets printed before sending response headers
  Server: SimpleHTTP/0.6 Python/3.4.2
  Date: Sun, 10 May 2015 01:56:07 GMT
  Content-type: video/x-msvideo
  Content-Length: 1526812672
  Last-Modified: Fri, 04 Sep 2009 13:12:22 
  </code></pre>
  
  <p>As you can also see, it never made a HEAD request. So can anyone explain to me what's really happening here or am i missing something?</p>
  
  <p>PS: excuse my english, not an english speaker.</p>