Generating and accepting Routes with non standard ports

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Generating and accepting Routes with non standard ports

richard
Hello all,

I have recently stumbled across a requirement to generate urls with non standard ports using zf2 Treestack Router.

For example, I might want to generate the URL http://foo.example.com:8080/index from http://bah.example.com/lalaland

I have submitted a pull request (that was very quickly closed) here: https://github.com/zendframework/zf2/pull/3338

I am of the opinion that whilst foo.example.com:8080 is not a valid hostname, it is a valid uri, with hostname foo.example.com and port 8080.

Is it possible to configure the router to generate  http://foo.example.com:8080/index from http://bah.example.com/lalaland without changing the library codebase?

Regards
Reply | Threaded
Open this post in threaded view
|

Re: Generating and accepting Routes with non standard ports

masterpuppet
You could pass a Zend\Uri\Http to TreeRouteStack::assemble,

$uri = new \Zend\Uri\Http('http://foo.example.com:8080');
or
$uri = new \Zend\Uri\Http('http://foo.example.com');
$uri->setPort(8080);

$router->assemble(array(), array('name' => 'home', 'uri' => $uri)); //generates http://foo.example.com:8080/


2013/1/3 richard [via Zend Framework Community] <[hidden email]>
Hello all,

I have recently stumbled across a requirement to generate urls with non standard ports using zf2 Treestack Router.

For example, I might want to generate the URL http://foo.example.com:8080/index from http://bah.example.com/lalaland

I have submitted a pull request (that was very quickly closed) here: https://github.com/zendframework/zf2/pull/3338

I am of the opinion that whilst foo.example.com:8080 is not a valid hostname, it is a valid uri, with hostname foo.example.com and port 8080.

Is it possible to configure the router to generate  http://foo.example.com:8080/index from http://bah.example.com/lalaland without changing the library codebase?

Regards


If you reply to this email, your message will be added to the discussion below:
http://zend-framework-community.634137.n4.nabble.com/Generating-and-accepting-Routes-with-non-standard-ports-tp4658665.html
To start a new topic under Zend Framework, email [hidden email]
To unsubscribe from Zend Framework Community, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Generating and accepting Routes with non standard ports

weierophinney
Administrator
On Thu, Jan 3, 2013 at 5:08 PM, masterpuppet <[hidden email]> wrote:
> You could pass a Zend\Uri\Http to TreeRouteStack::assemble,
>
> $uri = new \Zend\Uri\Http('<a href="http://foo.example.com:8080');">http://foo.example.com:8080');
> or
> $uri = new \Zend\Uri\Http('http://foo.example.com');
> $uri->setPort(8080);
>
> $router->assemble(array(), array('name' => 'home', 'uri' => $uri));
> //generates http://foo.example.com:8080/

I think the point Richard is making is that he may be testing on a
system that uses a non-default port (for instance, using PHP 5.4's
built-in web server), and as such the port may not be known. As such,
he's suggesting that if the hostname route is in use, it may need to
check to see if the port + schema combination is standard, and, if
not, also provide the port.

Richard, does that sum up the concern for you? If so, I think we
should re-open the issue.

> 2013/1/3 richard [via Zend Framework Community] <
> [hidden email]>
>> I have recently stumbled across a requirement to generate urls with non
>> standard ports using zf2 Treestack Router.
>>
>> For example, I might want to generate the URL
>> http://foo.example.com:8080/index from http://bah.example.com/lalaland
>>
>> I have submitted a pull request (that was very quickly closed) here:
>> https://github.com/zendframework/zf2/pull/3338
>>
>> I am of the opinion that whilst foo.example.com:8080 is not a valid
>> hostname, it is a valid uri, with hostname foo.example.com and port 8080.
>>
>> Is it possible to configure the router to generate
>> http://foo.example.com:8080/index from http://bah.example.com/lalaland without
>> changing the library codebase?



--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Generating and accepting Routes with non standard ports

richard
This post has NOT been accepted by the mailing list yet.
weierophinney wrote
I think the point Richard is making is that he may be testing on a
system that uses a non-default port (for instance, using PHP 5.4's
built-in web server), and as such the port may not be known. As such,
he's suggesting that if the hostname route is in use, it may need to
check to see if the port + schema combination is standard, and, if
not, also provide the port.
That sums up the concern exactly. Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Generating and accepting Routes with non standard ports

richard
I cannot yet see any non standard port specification in the Hostname route port Mr weierophinney.