URL_FORMAT constant does not support IP address as servername
Submitted by spascoe on Mon, 05/19/2008 - 20:44.
| Project: | ProjectPier |
| Version: | 0.8.5.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | spascoe |
| Status: | patch - code needs review |
Jump to:
Description
I identified this problem by viewing the source of a page. The stylesheet link for the UserBoxMenu/widget.css was incorrect.
I tracked the problem down to being an issue with the URL_FORMAT constant in environment/constants.php
The current regex expects the final '.aaa' of the server name to be an a-z character repeated 2-5 times.
It should support [a-z0-9]{1,5} instead so that the url can be expressed as an IP address.
The attached patch was generated against r159.
| Attachment | Size |
|---|---|
| constants-url_format.patch | 2.01 KB |

As far as I can tell, it does work to be able to have a real URL or an IP address.
The only thing to me is that it would now allow URIs like http://abc.blabla.14 for example, which is not valid.
I don't think it's really a problem in itself because the URIs are used for the web-app itself on for the companies' homepages. If you mistype the former, nothing will work but it won't work better if you type http://abc.blablaa.com, in itself it's still a configuration problem that has not much to do with the URI being valid or not. If you mistype the latter, it won't affect the operation of ProjectPier.
I suppose the regex could be written to have either a "regular" URI or an IP, but not a mix of the two. The question is: is it really worth it? does the app really care so much if the URI is valid or not? why do we check the URI in the first place?
Anybody has any thoughts on that?