BTW it looks like the Content-Disposition header isn't being parsed
correctly.  For example:

$ ./wget http://www.mininova.org/get/212851
--22:11:52--  http://www.mininova.org/get/212851
Resolving www.mininova.org... 83.149.119.115
Connecting to www.mininova.org|83.149.119.115|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-bittorrent]
Saving to: `attachment; filename="Snooker - Ronnie O'Sullivan - World Champ 
1997.avi +{mininova.org}+.torrent"'

The code in question is:

  if (!hs->local_file)     
    {
      if (resp_header_copy (resp, "Content-Disposition", hdrval, sizeof 
(hdrval)))
        /* Honor Content-Disposition. */
        {
          hs->local_file = xstrdup (hdrval);
        }
      else
        /* Choose filename according to URL name. */
        {
          hs->local_file = url_file_name (u);
        }
    }

I don't think you're supposed to just take Content-Disposition
literally; we should parse the "filename" attribute.

Also note that you can use resp_header_strdup rather than
resp_header_copy+xstrdup.  The benefit is that it avoids the arbitrary
limit of sizeof(hdrval) (which is meant for numerical quantities such
as Content-Length and such).

Reply via email to