[BUG] Scamper sends incorrect accept: HTTP header
Ned Konz
ned at bike-nomad.com
Thu Oct 19 00:26:27 UTC 2000
Try to view http://www.ebay.com
The reason you can't is that Scamper sends
Accept: application/octet-stream
as its accept header. If you change the code
to read 'text/html', it works. As does '*/*'.
Note that there's lots of places in the code where
'application/octet-stream' appear; this isn't really the
best place to use it. I think if you really don't care
about the type, you should use
Accept: */*
application/octet-stream should be used for the default content-type
of the *received* data *if none is sent*, but I think (from reading
the RFC, anyway) that a server is justified in not viewing
application/octet-stream as being the same as */*. There may be
(or there may have been in the past) servers that viewed these the
same, or that needed to be sent application/octet-stream to get
binary out (ones that incorrectly assumed that a missing accept:
header meant 'text/html').
Now, it seems like the accepted types should be
answered by the client, rather than the URL
(which is where this is coming from). Scamper
might well be able to handle a number of different
kinds of things, and it should be able to ask for
them.
So I think in this case, it ought to send (at least)
Accept: text/html, application/octet-stream
as well as whatever the flash type is, image types, etc.
Or we could just omit the Accept: header altogether, and
deal with unknown Mime types when they come in, but that doesn't
let the server give us what we prefer.
Or we could just send:
Accept: */*
and deal with it.
We could also give preference levels:
Accept: text/html, application/x-shockwave-flash; q=0.5
says we want HTML, but if that isn't available, give us Flash.
RFC 2068 (HTTP 1.1) says:
If no Accept header field is present, then it is assumed that the
client accepts all media types. If an Accept header field is present,
and if the server cannot send a response which is acceptable
according to the combined Accept field value, then the server SHOULD
send a 406 (not acceptable) response.
And eBay's server did just that. It only sends text/html, thank you.
Scamper should (but I don't think it does) accept gzip or deflate
encodings, as well. This can speed up transmission considerably over slow
modems. But this would require changes to the program code, I think.
If we could, we'd send this:
Accept-encoding: gzip, deflate
--
Ned Konz
currently: Stanwood, WA
email: ned at bike-nomad.com
homepage: http://bike-nomad.com
More information about the Squeak-dev
mailing list
|