LTD-Beget / LTD-Beget/beget_msgpack

host:port

Open
#6 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1
Forks
2
PR merge metrics
No merged PRs in 30d

Description

```
--- a/beget_msgpack/request_factory.py
+++ b/beget_msgpack/request_factory.py
@@ -18,8 +18,13 @@ class RequestFactory:
"""
В зависимости от имени сервера и его конфига, возвращаем ему соответствующий класс запроса.
"""
+ override_port = None
self.logger.debug('RequestFactory: get_request for server: %s', server_name)

+ server_name_split = server_name.split(':')
+ if len(server_name_split) == 2:
+ [server_name, override_port] = server_name_split
+
# проверяем конфиг на наличие настроек для сервера или настроект по умолчанию
if server_name in self.config.servers:
self.logger.debug('RequestFactory: find server in config')
@@ -60,7 +65,7 @@ class RequestFactory:
self.logger.debug('RequestFactory: return fcgi request')

return FcgiRequest(host,
- server_config['port'],
+ override_port or server_config['port'],
server_config['script_dir'],
server_config['script_name'],
server_config['secret'])
@@ -72,7 +77,7 @@ class RequestFactory:
raise ConfigError(error_msg)
self.logger.debug('RequestFactory: return msgpack request')

- return MsgpackRequest(host, server_config['port'])
+ return MsgpackRequest(host, override_port or server_config['port'])

else:
error_msg = 'RequestFactory: don`t have information about type connection for server'
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue only provides a proposed diff for beget_msgpack/request_factory.py, so start by reading RequestFactory.get_request and how FcgiRequest and MsgpackRequest receive their ports. Confirm the expected host:port behavior and identify the relevant existing tests before making changes. Done means host:port inputs work while configured ports continue to work when no override is provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.