cubicweb #2542815 gethostname() -> getfqdn() [done]
CubicWeb fait parfois appel à gethostname() pour créer les URL proposés dans ses pages Web. Il remplacer l'appel à gethostname() par un appel à getfqdn() pour otenir le fully qualified name. En effet gethostname() peut renvoyer le nom court et la résolution correcte des URL dépend alors du client - et plus précisement de la présence du domaine DNS du serveur dans les chemins de recherche DNS du client. J'ai cru comprendre qu'il vaudrait mieux positionner "base-url" dans all-in-one.conf, mais d'une part ce n'est pas dans la doc d'installation et d'autre part l'utilisation de getfqdn() est uen bonne chose, que ce soit dans une optique de least astonishment ou de KISS (keep it simple). | |
priority | normal |
---|---|
type | bug |
done in | <not specified> |
load left | 0.000 |
closed by | #1437c47925c3 default base-url now uses fdqn instead of hostname only (closes #2542815) |
patch | default base-url now uses fdqn instead of hostname only (closes #2542815) [applied] |
Comments
-
2013/01/25 09:28, written by jcristau
-
2013/03/13 18:17, written by acampeas
-
2013/03/14 08:27, written by jcristau
-
2013/03/14 08:38, written by acampeas
-
2013/03/14 08:47, written by jcristau
-
2013/01/25 12:56, written by dimitri
add commentI'm not sure this is such a good idea. gethostname() works well enough for local tests, for anything more serious setting base-url is the way to go, IMO. getfqdn() depends on working forward and reverse name resolution, so it's not without issues either. If the doc needs to make that clear then let's do that.
Why not consider base-url as an override and by default use getfqdn ?
Is having a working (reverse-dns) so rare that it would hurt ?
doesn't really matter how rare it is; if it doesn't work you're screwed. plus, depending on dns queries means blocking for a random amount of time. (to be frank i don't care much whether this goes in, i'm just not convinced it's an improvement.)
This is probably (should ...) called at startup, so the performance issue is not that important.
What are the failures mode of this thing ? Can you expand on them ?
nevermind about the failure mode, looks like getfqdn falls back to gethostname if the dns query fails.
Even basic testing does not mean the domaine name of the server and the DNS search path of the client are the same. This is the first piece of software I have such an issue with, it's hard to believe there are no solutions. I guess most other programs don't use absolute URLs, only relative URLs, that is: /my/path/ instead of: http://my.server.org/my/path/