![]() |
Forum SELFHTML: Archives: |
|
|
Le message suivant est de: David,
DavidB86863917134@aol.com, 31. 07. 2003, 15:24
bonjour tout le monde c'est encore moi!!! :-)
Voilà mes amis j'ai un nouveau problème à vous soumettre: en plus du contenu .html de mon site j'ai eu l'idée sogrenue d'ajouter du .wml histoire d'etre present sur le wap. Etant soucieux du confort de mes visiteurs j'ai opter pour le contenue en alternative ( voir http://selfhtml.selfhtml.com.fr/divers/htaccess.htm#contenus_alternative) Voici donc mon fichier index.var:
URI: index
URI: accuframe.htm
Content-type: text/html
URI: accuwap.wml
Content-type: text/vnd.wap.wml
et voici le contenu de ma configuration Apache 1.3.28: j'ai bien mis le repertoire avec l'option Multiviews mon DirectoryIndex est pointé sur index, par contre au lieu de AddType application/x-type-map var
il est recommande dans la doc apache de preferer la commande AddHandler type-map var dans le mod_mime car depuis Apache 1.2.x ils ont refait leurs mod_negotiation.c (ca serait d'ailleurs bien de le signaler aux auteurs de Selfhtml, non?).
Et voilà les resultats: avec Netscape7.02 en tapant http://url_de_monsite/ ca marche je suis diriger vers accuframe.htm, pareil pour Opera 7.11
avec Deck-It WML previewer 1.2.3 (navigateur wap pour PC gratuit!) en tapant http://url_de_monsite/ ca marche je suis dirige vers accuwap.wml
Les ennuis arrivent avec IE 6.0 (on ne rigole pas! LOL), cet âne-baté n'affiche pas accuframe.htm mais veut télécharger accuwap.wml!!! Il est vraiment bête!!!
alors que faire? j'ai bien essayer de rajouter des qs aux content-type, rien n'y fait ca peut même être pire (IE et Deck-It deconnent alors!).
Je pense que mon code est bon, ma config d'apache aussi (c'est pas la premiere que je fais et j'en ai fais fonctionner des plus dur comme le Gzip!). Ca doit venir des en-têtes que balance IE lors de la requete, ce qui doit fausser les calculs d'Apache.
au secours!
David.
----------------------------------------------------------------
A bus station is where you're waiting for a bus, a train station is where you're waiting for a train. On my computer I have got a Workstation.
Le message suivant est de: CirTap,
cirtap@webmechanic.biz, 03. 08. 2003, 22:30
http://www.webmechanic.biz/
Salût David,
j'espère ça te ne dérange pas que je répond en anglais ...
Unfortunately "your" IE6 appears to send "text/vnd.wap.wml" (with or without wildcards) as part of its initial "HTTP_ACCEPT" response header, so the server assumes text/vnd.wap.wml files are "better suited" than text/html.
If you have PHP running on your site, have some script display the content of $_SERVER and check the value of 'HTTP_ACCEPT':
<?php
header('Content-Type:text/plain');
print_r($_SERVER);
// or print_r($HTTP_SERVER_VARS);
?>
Please note, that only the *very first* request to this script will contain the list of mime-types, e.g:
[HTTP_ACCEPT] => image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg, application/vnd.ms-excel, application/msword, */*
subsequent request in the same session may only report */* ! so you have to rename the file or close the browser to see any changes.
Because of the WML viewer you have installed on your machine, there's probably a matching 'text/vnd.wap.wml' in the registry so its actually not MSIE beeing "vraiment bête", it just does what you have configured on the system :-) Opera, Netscape & Co. and not bound this close to the operating system, so they don't care as much and do what they can do 'themseves'...
What's irritationg is the disorder in accepted mime types.
Quit MSIE before you do any of the following changes.
Search the registry for
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\
CurrentVersion\Internet Settings\Accepted Documents
and maybe its counterpart in HKEY_CURRENT_USER\Software\... (depending on your windows version this entry may not exist), and see if the list has an entry for 'text/vnd.wap.wml'.
If so, rename it to 'blabla-text/vnd.wap.wml' or write down it's key value (* ** or a number) and delete it entirely.
Load your website and see what happens, your may need to restart MSIE and/or windows before.
If nothing changes: find '.wml' in HKEY_CLASSES_ROOT, export the key to a .REG file and *remove* in from the registry, then reboot your machine and see if it has any effect.
If nothing changes: check all available options in the WML viewer application regarding "browser support", such as Adobe Reader can be configured to run in embedded or standalone mode. Try to find any settings that may "link" the viewer with MSIE, and turn them off.
If nothing changes: uninstall the viewer.
I'm running out of ideas now :-)
Hope one of this helps.
Have fun,
CirTap
Le message suivant est de: David,
DavidB863917134@aol.com, 04. 08. 2003, 10:41
Hello CirTap,
no problem, you can answer me in english!
php is running on my website so i have try your script. Here is the results: for MSIE: [HTTP_ACCEPT] => image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[HTTP_ACCEPT_LANGUAGE] => fr
and for Netscape: [HTTP_ACCEPT] => text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
[HTTP_ACCEPT_CHARSET] => ISO-8859-1, utf-8;q=0.66, *;q=0.66
[HTTP_ACCEPT_ENCODING] => gzip, deflate, compress;q=0.9
[HTTP_ACCEPT_LANGUAGE] => fr-fr, fr;q=0.50
So now we understood why MSIE try to load the .wml instead of the .html. I have try to change this with the Apache command-line: "level" and "accept". So my new index.var became:
URI: index
URI: accuframe.htm
Content-type: text/html; level=3
URI: accuwap.wml
Content-type: text/vnd.wap.wml; level=2
Accept: text/html, text/vnd.wap.wml, text/plain, */*
after this, Netscape and MSIE works correctly (they load accuframe.htm) Youpieeee!! but WML viewer load a http 406 error (request not acceptable) aarrrgghhhhhh!!!!
What do you think of that?
If we could not find a solution with the index.var and the alternative content, I have a solution using the Aliases of Apache but that's not the first aim.
thanks for your help!
see you later
David.
Le message suivant est de: CirTap,
cirtap@webmechanic.biz, 04. 08. 2003, 18:41
http://www.webmechanic.biz/
Salût David,
»» ... image/pjpeg, application/x-shockwave-flash, */*
ok, weired. IE sends */* with the same level as the other files, so my first assumption was totally wrong, but this value shouldn't harm, as */* is by default treated with a quality of 0.01
Did you try the "qs" attribute instead of "level"?
URI: index
URI: accuframe.htm
Content-type: text/html; qs=0.8
URI: accuwap.wml
Content-type: text/vnd.wap.wml; qs=0.5
However, if the WML viewer accepts text/html, you're still in trouble.
It would be interesting what the viewer's headers look like.
Let's do a little trick and have a PHP file pretend it's WML :)
You have to fix the markup herein, because I have no idea what these files look like :-) It's the stuff between the "here-docs": echo <<<WML ... WML;
"wmlsniffer.php" :
<?php
// fetch some vars for later use
$acc = $_SERVER['HTTP_ACCEPT'];
$set = $_SERVER['HTTP_ACCEPT_CHARSET'];
$enc = $_SERVER['HTTP_ACCEPT_ENCODING'];
$lan = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ;
// mimic a WML file by sending the appropriate content-type
header("Content-Type: text/vnd.wap.wml");
// turn this into some valid WML, please :-)
echo <<<WML
<card>
<p>accept: $acc</p>
<p>charset: $set</p>
<p>encoding: $enc</p>
<p>language: $lan</p>
</card>
WML; // LEAVE THIS at the beginning of the line !! no spaces/tabs in front
?>
now save it as "wmlsniffer.php" or what ever you want.
You should test, if the header() is sent correctly, so launch MOZILLA first! Yes, Mozilla, as IE will not tell you want you want to know or display the file.
With Mozilla open, locate "wmlsniffer.php" on your server, Mozilla should bring up a download dialog with a message like
"You have choosen to open a file of type: "xxxxx" (text/vnd.wap.wml) ... blabla""
wheras 'xxxxx' is what PHP files are called on your computer.
CANCEL THE DOWNLOAD!
Let the WML viewer load the file and it should display a WML card/deck. Check the "accept:" values if you can find some "text/html". It should have a lower priority than the xml mime-type, and of course the viwer should have sent 'text/vnd.wap.wml'.
For some reason, I fear this could be 'text/wml' or 'application/vnd.wap.wmlc' instead...
Find out and come back to let me know, what happened.
Have fun,
CirTap
Le message suivant est de: CirTap,
cirtap@webmechanic.biz, 04. 08. 2003, 18:46
oh, in case Mozilla instantly starts the download, goto
Edit > Preferences
to the left choose
Navigator > Helper Applications
remove the entry for the xml mime type or edit it and check the "always ask me if..." button at the bottom of the dialog box.
Confirm the preferences and try it again.
Good luck.
Le message suivant est de: David,
DavidB863917134@aol.com, 05. 08. 2003, 09:38
»» Salût David,
re CirTap !!
you're right Apache send the value 0.01 for the */*.
»» Did you try the "qs" attribute instead of "level"?
Yes that's what I have tried first, then IE and the WML viewer doesn't work properly, damned!
So let's have a look to the wml viewer header: I have turn your php script to a correct wml:
<?php
$acc = $_SERVER['HTTP_ACCEPT'];
$set = $_SERVER['HTTP_ACCEPT_CHARSET'];
$enc = $_SERVER['HTTP_ACCEPT_ENCODING'];
$lan = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ;
header("Content-Type: text/vnd.wap.wml");
echo <<<WML
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd" >
<wml>
<card id="card1">
<p>accept: $acc</p>
<p>charset: $set</p>
<p>encoding: $enc</p>
<p>language: $lan</p>
</card></wml>
WML;
?>
and now the results for the WML viewer:
accept: text/html, text/vnd.wap.wml, image/gif, image/jpeg, image/vnd.wap.wbmp
charset:
encoding:
language: fr
Note that this viewer could load .html and .wml, but in the first case he send an alert message:"this is not a correct wml page!". So I am sure that the sniffer.php is a correct wml document.I have try your trick with mozilla and he answer: "The file 'sniffer.php' is of type text/vnd.wap.wml, and mozilla does not know how to handle...."
What do you think of that?
»» Have fun,
viel spaB!
David.
Le message suivant est de: CirTap,
cirtap@webmechanic.biz, 11. 08. 2003, 03:31
Hi David,
sorry, I was pretty busy this week.
This is all pretty annoying :-(, and I'm running out of ideas.
I don't know if Apache comes with WML support out-of-the-box, so just to be sure: can you request a clean, proper, perfect WML file, without any redirections from .htaceess or .var files with that Viewer?
Drop some valid and proofed example files on your server and load them directly from the viewer to find out if "this" web-server can handle request for WMLs at all.
If your Apache installation lacks native support for WMLs, you'd need to find some other method than the .var redirection, but this would require some more investigations and usually some scripting.
I'm not quite sure if the header()s sent from sniffer.php were actually sufficent for WML (and this viewer). A response may need some more informations, hence the "not a correct wml page" error message.
It may require some more response headers, but I'm not sure about them:
header("Status: HTTP/1.1 200 OK");
header("Content-Type: text/vnd.wap.wml; encoding=iso-8859-1");
header("Content-Length: $ctLength"); // <-- NEEDS to be calculated
You can find $ctLength like this:
$wml <<<WML
.. the wml markup you have ..
WML;
$ctLength = strlen($wml);
However, this is like searching the needle in a haystack, and I recommend you consult some *real* Apache and WML Experts: http://www.experts-exchange.com/ - read their guidelines and get a free account. Try to find the right topic area, I expect it to be a problem with the Apache configuration, so you should post in this area.
Provide the experts with as much and as detailed information as possible: Apache Version & OS (Linux/Win), name and version of this Viewer Application (maybe it's a buggy release.?), exact content of your .var files, possible structure of the directories (but mask your root-directory <g>) - maybe some redirections go wrong etc.
The more you tell them, the more likely you'll get a solution.
Good luck!
Sorry, that I kept you busy and couldn't help you... maybe you've learned something useful in PHP ;-)
CirTap
Le message suivant est de: David,
DavidB863917134@aol.com, 12. 08. 2003, 12:03
hi CirTap!
I have made a perfect WML file (without any redirections) and the Viewer have request it without any problems. So Apache can handle request for WML, that was the first step of my tests but I have not tell you that, sorry :-(.
I have got a "working-well" solution (wihout the .var): I use the aliases of apache. For the http-browser the URI is http://mysite/ and for the wml-browser: http://mysite/wap/. In the first case you're redirect to index.html and in the second you are redirect to wap/index.wml. That's working without any problems.
That is strange then I could not use the .var, and I want to understand why! So I will ask some help from the http://www.experts-exchange.com/
You was very helpfull, so many thanks to you.
See you.
David.
© 1998-2004
selfhtml@fr.selfhtml.org