Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make prepareRequestHttpClient() is cutting port number from uri passed in smsapiPlServiceWithUri() #131

Closed
domino316 opened this issue Mar 15, 2024 · 3 comments · Fixed by #132
Assignees

Comments

@domino316
Copy link

Hi,

I was trying to pass uri in smsapiPlServiceWithUri() method, and my uri contained port number. I saw that the messages was sent with default port 80. After some digging I saw that prepareRequestHttpClient is just not picking it from uri.

I have already figured it out and this is really small change.
Or perhaps this is not possible due to backward compatibility or some security related stuff?

@domino316
Copy link
Author

I suggest changes in files:

"smsapi/php-client/src/Curl/HttpClient.php"

private function prepareRequestHttpClient(RequestInterface $request)
{
    $port = $request->getUri()->getPort() ? ':' . (string) $request->getUri()->getPort() : '';
    $url = sprintf("%s://%s%s%s", $request->getUri()->getScheme(), $request->getUri()->getHost(), $port, $request->getRequestTarget());

"smsapi/php-client/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php"

prependBaseUri()

    $host = $baseUriParts['host'] ?? '';
    $port = $baseUriParts['port'] ?? '';
    $basePath = $baseUriParts['path'] ?? '';
    $basePath = rtrim($basePath, '/');

    $uri = $uri->withPath($basePath . '/' . $uri->getPath());
    $uri = $uri->withHost($host);
    $uri = $uri->withScheme($scheme);
    $uri = $uri->withPort($port);

@mpawikowski
Copy link
Collaborator

Hello,

I forwarded your requst to our IT department.

@maciejlew maciejlew self-assigned this Mar 27, 2024
@maciejlew maciejlew linked a pull request Mar 27, 2024 that will close this issue
@maciejlew
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants