httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Kraemer <Martin.Krae...@mch.sni.de>
Subject Negotiation - can someone explain?
Date Tue, 26 May 1998 15:53:16 GMT
The language negotiation algorithm seems to be somewhat unpredictable.
Combined with DirectoryIndex and language definitions like "en-US" or
"de-CH" they even look broken to me.

In a directory containing these files...
lrwxrwxrwx   1 martin      14 May 26 16:38 index.html.shtml -> index.shtml.en
-rw-r--r--   1 martin     339 May  7 13:11 index.shtml.de
-rw-r--r--   1 martin     735 May  7 13:11 index.shtml.de-BY
-rw-r--r--   1 martin     735 May  7 13:09 index.shtml.de-By
-rw-r--r--   1 martin     339 May  7 13:11 index.shtml.en
-rw-r--r--   1 martin     295 May  7 13:11 index.shtml.fr

this script....
---snip---
#!/bin/sh
head  /etc/httpd.conf
n=0
for lang in th de en fr de-By "th, de-ch" "en;q=0.1, de-by;q=0.2" "en;q=0.6, de-by;q=0.2,
de;q=0.5" "en-US;q=0.6, de-by;q=0.2, de;q=0.5" "en-US;q=0.1, de-by;q=0.2, de;q=0.5"
do
  for URL in /~martin/neg/ /~martin/neg/index
  do
    n=`expr 1 + $n`
    echo "($n)=== Lang=$lang  URL=$URL ==="
    netcat localhost 80 <<-. | tr -d '\015' |
HEAD $URL HTTP/1.0
Accept-Language: $lang
Host: localhost

.
    (
      read proto status message
      if [ _$status = _200 ]; then
	 grep -i language
      else
	 echo "$status $message"
      fi
      cat
      echo ""
    )
  done
done
---snip---
...produces this output:

<Directory /home/martin/pgtm0035/WWW/neg/>
  AllowOverride AuthConfig FileInfo Indexes Limit
  Options +MultiViews -Indexes +FollowSymLinks +SymLinksIfOwnerMatch +ExecCGI
  DirectoryIndex index
  <Limit GET POST>
    order deny,allow
    allow from all
  </Limit>
</Directory>

(1)=== Lang=th  URL=/~martin/neg/ ===

(2)=== Lang=th  URL=/~martin/neg/index ===
Vary: accept-language

(3)=== Lang=de  URL=/~martin/neg/ ===
Vary: accept-language
Content-Language: de

(4)=== Lang=de  URL=/~martin/neg/index ===
Vary: accept-language
Content-Language: de

(5)=== Lang=en  URL=/~martin/neg/ ===
Vary: accept-language
Content-Language: en

(6)=== Lang=en  URL=/~martin/neg/index ===
Vary: accept-language
Content-Language: en

(7)=== Lang=fr  URL=/~martin/neg/ ===
Vary: accept-language
Content-Language: fr

(8)=== Lang=fr  URL=/~martin/neg/index ===
Vary: accept-language
Content-Language: fr

(9)=== Lang=de-By  URL=/~martin/neg/ ===
Vary: accept-language
Content-Language: de-by

(10)=== Lang=de-By  URL=/~martin/neg/index ===
Vary: accept-language
Content-Language: de-by

(11)=== Lang=th, de-ch  URL=/~martin/neg/ ===
Vary: accept-language
Content-Language: de

(12)=== Lang=th, de-ch  URL=/~martin/neg/index ===
Vary: accept-language

(13)=== Lang=en;q=0.1, de-by;q=0.2  URL=/~martin/neg/ ===
Vary: accept-language
Content-Language: de-by

(14)=== Lang=en;q=0.1, de-by;q=0.2  URL=/~martin/neg/index ===
Vary: accept-language
Content-Language: de-by

(15)=== Lang=en;q=0.6, de-by;q=0.2, de;q=0.5  URL=/~martin/neg/ ===
Vary: accept-language
Content-Language: en

(16)=== Lang=en;q=0.6, de-by;q=0.2, de;q=0.5  URL=/~martin/neg/index ===
Vary: accept-language
Content-Language: en

(17)=== Lang=en-US;q=0.6, de-by;q=0.2, de;q=0.5  URL=/~martin/neg/ ===
Vary: accept-language
Content-Language: de

(18)=== Lang=en-US;q=0.6, de-by;q=0.2, de;q=0.5  URL=/~martin/neg/index ===
Vary: accept-language
Content-Language: de

(19)=== Lang=en-US;q=0.1, de-by;q=0.2, de;q=0.5  URL=/~martin/neg/ ===
Vary: accept-language
Content-Language: de

(20)=== Lang=en-US;q=0.1, de-by;q=0.2, de;q=0.5  URL=/~martin/neg/index ===
Vary: accept-language
Content-Language: de

- - - - - -
Now my questions:

In (1),
 - why does a request for neg/ (with a "DirectoryIndex index") give
   different results from a request for neg/index ?
 - Why is there no "Vary: accept-language" header for the
   "index.html.shtml" file?

In (12),
 - why is there no "Content-Language: de" header, or better:
 - why was the "index.html.shtml" file chosen in preferance over
   "index.shtml.de"?

In (17) and (18),
 - why was the english variant not chosen? It still had a better quality
   than the german variant.

When I rename the index.html.shtml to index.shtml.shtml, then the same
test gives a different output:

--- x1	Tue May 26 17:11:32 1998
+++ x2	Tue May 26 17:12:49 1998
@@ -7,13 +7,14 @@
     allow from all
   </Limit>
 </Directory>
-lrwxrwxrwx   1 martin   dbx            14 May 26 16:38 index.html.shtml -> index.shtml.en
 -rw-r--r--   1 martin   dbx           339 May  7 13:11 index.shtml.de
 -rw-r--r--   1 martin   dbx           735 May  7 13:11 index.shtml.de-BY
 -rw-r--r--   1 martin   dbx           735 May  7 13:09 index.shtml.de-By
 -rw-r--r--   1 martin   dbx           339 May  7 13:11 index.shtml.en
 -rw-r--r--   1 martin   dbx           295 May  7 13:11 index.shtml.fr
+lrwxrwxrwx   1 martin   dbx            14 May 26 16:38 index.shtml.shtml -> index.shtml.en
 (1)=== Lang=th  URL=/~martin/neg/ ===
+Vary: accept-language
 
 (2)=== Lang=th  URL=/~martin/neg/index ===
 Vary: accept-language
@@ -56,6 +57,7 @@
 
 (12)=== Lang=th, de-ch  URL=/~martin/neg/index ===
 Vary: accept-language
+Content-Language: de
 
 (13)=== Lang=en;q=0.1, de-by;q=0.2  URL=/~martin/neg/ ===
 Vary: accept-language

So, in (1) and (12),
 - why does index.html.shtml give different output for a .../ request
   and a .../index request, while with index.shtml.shtml the two are
   identical?

Hmmm... Puzzled,

    Martin
-- 
| S I E M E N S |  <Martin.Kraemer@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Mime
View raw message