Package: elinks
Version: 0.11.1-1
Severity: normal
Tags: upstream

Hello,

Elinks sends wrong Accept: header to http servers and breaks content
negotiation. For example: I have file named a.xml with source of some
webpage and a.xhtml with result (created with xsltproc or xalan). When
I request http://server/a (without extension), elinks sends
Accept: */*. Webserver send smaller file (probably a.xml), which elinks
can't understand, since elinks doesn't speak xml.

How does it work for other browsers?
====================================

First Opera 8, which also doesn't support xml:

#v+
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686; en) Opera 8.54
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, 
image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: en
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
#v-

It prefers text/html and application/xhtml+xml over application/xml and
*/*.

Elinks sends:

#v+
User-Agent: ELinks/0.11.1 (textmode; Linux 2.6.16-ck11 i686; 128x48)
Accept: */*
Accept-Encoding: gzip
Accept-Language: pl
#v-

With obviously wrong Accept: (since it doesn't support every format
equally).

Lynx (also not supporting xml):

#v+
Accept: text/html, text/plain, application/x-java-jnlp-file, 
application/x-bittorrent, application/x-troff-man, audio/mpeg, video/x-msvideo, 
video/mpeg, video/quicktime, video/x-ms-asf, video/x-ms-wmv, application/x-tar, 
application/x-gtar
Accept: application/ogg, application/x-msdos-program, image/*, video/x-mpeg, 
video/mpeg-system, video/x-mpeg-system, audio/x-wav, video/mpeg4, 
audio/mpegurl, audio/x-mp3, audio/mpeg4, application/mpeg4-iod, 
application/mpeg4-muxcodetable
Accept: application/x-ogg, application/x-ms-asf-plugin, application/x-mplayer2, 
application/wordperfect5.1, application/x-applix-word, 
application/x-palm-database, text/*, application/x-debian-package, audio/basic, 
*/*;q=0.01
Accept-Encoding: gzip, compress
Accept-Language: po,en
User-Agent: Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/1.0.16
#v-

It lists text/html explictly and lowers priority of */*. (It sends
wrong Language, but it's another bug ;-)

Even MS IE works correctly (by supporting xml ;-)

Other browsers headers in attachment.

How fix it?
===========

It will be rather easy, because wrong header is hardcoded in source:
file src/protocol/http/http.c, line 715.

You may set it to something like:
Accept: text/html, application/xhtml+xml;q=0.9, text/plain;q=0.8, text/*;q=0.7, 
*/*;q=0.1
The */* part is needed, because we want to download and save on disc
other types.

Not attaching patch, because I'm not sure if it's correct (but I think
so ;-) and because You (or Upstream) may prefer other Accept (but
please change it, the current one is wrong).

Thanks,
Jarek Kamiński


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-ck11
Locale: LANG=pl_PL, LC_CTYPE=pl_PL (charmap=ISO-8859-2) (ignored: LC_ALL set to 
pl_PL)

Versions of packages elinks depends on:
ii  debconf                       1.5.2      Debian configuration management sy
ii  libbz2-1.0                    1.0.3-3    high-quality block-sorting file co
ii  libc6                         2.3.6-16   GNU C Library: Shared libraries
ii  libexpat1                     1.95.8-3.2 XML parsing C library - runtime li
ii  libgnutls13                   1.4.1-1    the GNU TLS library - runtime libr
ii  libgpmg1                      1.19.6-22  General Purpose Mouse - shared lib
ii  libidn11                      0.6.5-1    GNU libidn library, implementation
ii  liblua50                      5.0.2-6    Main interpreter library for the L
ii  liblualib50                   5.0.2-6    Extension library for the Lua 5.0 
ii  libperl5.8                    5.8.8-6    Shared Perl library
ii  zlib1g                        1:1.2.3-13 compression library - runtime

elinks recommends no packages.

-- no debconf information

-- 
    Linux jest darmowy, jeśli twój czas nie przedstawia żadnej wartości.
    Jeśli jest coś warty(czas), Linux jest po prostu tańszy od innych.
        Jarek Kamiński
        gg# 453620
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, 
application/x-shockwave-flash, */*
Accept-Language: pl
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 
1.1.4322)

Accept: text/html, text/plain, application/x-java-jnlp-file, 
application/x-bittorrent, application/x-troff-man, audio/mpeg, video/x-msvideo, 
video/mpeg, video/quicktime, video/x-ms-asf, video/x-ms-wmv, application/x-tar, 
application/x-gtar
Accept: application/ogg, application/x-msdos-program, image/*, video/x-mpeg, 
video/mpeg-system, video/x-mpeg-system, audio/x-wav, video/mpeg4, 
audio/mpegurl, audio/x-mp3, audio/mpeg4, application/mpeg4-iod, 
application/mpeg4-muxcodetable
Accept: application/x-ogg, application/x-ms-asf-plugin, application/x-mplayer2, 
application/wordperfect5.1, application/x-applix-word, 
application/x-palm-database, text/*, application/x-debian-package, audio/basic, 
*/*;q=0.01
Accept-Encoding: gzip, compress
Accept-Language: po,en
User-Agent: Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/1.0.16

Accept: text/plain,text/html,*/*;q=0.3
Accept-Encoding: deflate
User-Agent: W3CLineMode/5.4.0 libwww/5.4.0

User-Agent: ELinks/0.11.1 (textmode; Linux 2.6.16-ck11 i686; 128x48)
Accept: */*
Accept-Encoding: gzip
Accept-Language: pl

User-Agent: Opera/9.01 (X11; Linux i686; U; pl)
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, 
image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: pl,en;q=0.9,de;q=0.8
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0

User-Agent: Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.8.0.6) Gecko/20060728 
Firefox/1.5.0.6 (Debian-1.5.dfsg+1.5.0.6-1)
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: pl,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686; en) Opera 8.54
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, 
image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: en
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0

Attachment: pgphUyHmggrqr.pgp
Description: PGP signature

Reply via email to