On Fri, 9 Nov 2001, David A. Desrosiers wrote:

> $ HEAD http://www.netlet.net/interact/Babe.jpg
> 406 No acceptable objects were found
> Content-Type: text/html
> Client-Date: Sat, 10 Nov 2001 00:58:20 GMT
> Client-Peer: 206.58.152.238:80

Looks like a missing/bad Accept: header.  I didn't think it was required
by the HTTP RFC, but Microsoft has never been one to adhere to standards.
RFC 2616 should explain The Right Way to do things, but I'm too tired to
look right now.  But, testing with the following yields promising results:

$ HEAD -H "Accept: image/jpeg" http://www.netlet.net/interact/Babe.jpg
200 OK
Date: Sat, 10 Nov 2001 07:15:28 GMT
Accept-Ranges: bytes
Server: Microsoft-IIS/2.0
Content-Length: 19494
Content-Type: image/jpeg
Last-Modified: Fri, 09 Nov 2001 11:51:29 GMT
Client-Date: Sat, 10 Nov 2001 07:15:24 GMT

>       It smells like a missing Content-type header, and I thought there
> was a fix in cvs for this. I recall someone mentioning this before, but I
> can't find the reference in my archives.

Well, Content-type: isn't really relevant as a request header.  It's
probably a missing Accept: header. What plucker-build is sending is:

GET /interact/Babe.jpg HTTP/1.0
Host: www.netlet.net
User-agent: Plucker/Py-1.0

Hooray for /etc/hosts and netcat.  Anyway... no Accept: header there,
which appears to offend the remote server.

It's probably correct to send an Accept: header that looks something like:

  Accept: text/*, image/*

I think this can be accomplished by adding
        self.addheader ('Accept:', 'text/*, image/*')
after
        self.addheader ('User-agent', 'Plucker/Py-%s' % __version__)\
in Retriever.py, but I haven't tested it.

That should cover most, if not all, of the things you can handle with
plucker-build.  By comparison, Mozilla sends (line split into three for
the benefit of 80-column mailreaders):
  Accept: text/xml, application/xml, application/xhtml+xml,
          text/html;q=0.9, image/png, image/jpeg, image/gif;q=0.2,
          text/plain;q=0.8, text/css, */*;q=0.1

We could send an "Accept: */*" header and be done with it, but without
looking at what different HTTP servers are expecting, it might be a bad
idea to only send a wildcard.

-dave0
--
aitchteeteepeecolonslashslashtripledoubleyoudotevilplotdotorgslashtildedave
"Not much call for a barbarian hairdresser, I expect.  I mean, no-one
 wants a shampoo-and-beheading"   -- ``Sourcery'', Terry Pratchett

Reply via email to