-
Notifications
You must be signed in to change notification settings - Fork 0
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
Доп. задача #1
base: main
Are you sure you want to change the base?
Доп. задача #1
Conversation
… данных на клиенте. Если это был GET запрос, то в ответе присылается код ответа и количество вхождений под строчки в строку с результатом от сервера. В остальных случаях просто возвращает ответ от сервера. Также для клиента добавил формочку, которая запрашивает эту строчку, если выбрана кнопка GET запроса
server/server.py
Outdated
if not HttpServer.validate_body(settings): | ||
response = HttpServer.create_bad_request_response( | ||
origin, | ||
'Вы не ввели либо url, либо тип запроса' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а давай писать чего именно недостает - а то чот ка кто непонятненько
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Переделал. Теперь возвращаются понятные сообщения от валидации
server/server.py
Outdated
|
||
client_data = client.get_data() | ||
if client_data == 'Неправильный url адрес или port': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мммммммммм, хардкод строк, вкусно
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Добавил все в енамы
server/server.py
Outdated
|
||
response = self.create_response(client_data, origin) | ||
conn.sendall(response.encode()) | ||
if settings.get('request').lower() == 'get' and len(settings.get('get_form')) != 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
уверен, что именно так надо сравнивать?)))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вынес все в енамы
server/server.py
Outdated
if \ | ||
body.get('url') is None or \ | ||
body.get('request') is None or \ | ||
type(body.get('cookie')) != dict or \ | ||
type(body.get('headers')) != dict or \ | ||
type(body.get('body')) != str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а давай условие в скобки занесем, и не будем такие переносы делать?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сделал несколько отдельных if для этого
server/server.py
Outdated
if \ | ||
body.get('url') is None or \ | ||
body.get('request') is None or \ | ||
type(body.get('cookie')) != dict or \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а еще типы сравнивают как isinstance а не чеканьем типов от type)))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поменял на isinstance
server/server.py
Outdated
""" | ||
|
||
if \ | ||
body.get('url') is None or \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
body.get('url') is None or \ | |
not body.get('url') or |
No description provided.