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

http client url project description #28

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

DarkhanShakhan
Copy link

No description provided.

Copy link
Contributor

@atlekbai atlekbai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хороший проект, но не хватает структурированности по заданиям. Нужно четко разделить каждое задание по отдельному функционалу.

Comment on lines 19 to 23
curl is a simple yet powerful tool for communicating with servers. Here are some common applications:
* Fetching Web Pages: You can easily retrieve web pages by running a command like curl https://example.com, which will display the HTML content directly in your terminal.
* Testing APIs: curl is frequently used to send requests to RESTful APIs. For instance, to fetch user information, you might use curl -X GET https://api.example.com/users/1.
* Uploading Files: You can upload files to a server using the POST method. For example: curl -X POST -F "file=@/path/to/file" https://upload.example.com.
* Debugging: You can check server responses and headers with commands like curl -I https://example.com, which retrieves only the HTTP headers.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Примеры вызова curl обернуть между backtick символами, например curl https://example.com

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

Comment on lines 35 to 37
When implementing the project, consider handling options similarly to how curl does. You can find more information about options [here](https://everything.curl.dev/cmdline/options/index.html).

Additionally, you should map errors to the appropriate exit codes. More details on exit codes can be found [here](https://everything.curl.dev/cmdline/options/index.html).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ссылка на error codes ведут на options. Возможно ошибка

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил ссылку

Comment on lines 46 to 49
- **Your code MUST be written in accordance with [gofumpt](https://github.com/mvdan/gofumpt). If not, you will be graded `0` automatically.
- **Your program MUST be able to compile successfully.**
- **Your program MUST not exit unexpectedly (any panics: `nil-pointer dereference`, `index out of range` etc.). If so, you will be get `0` during the defence.**
- **Only built-in packages from the Go standard library are allowed, excluding `net/http`.**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Убрать выделение жирным

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

Comment on lines 84 to 86
### Using only HTTP

The program must operate exclusively with the HTTP protocol, without relying on the `net/http` package or external HTTP libraries. Requests should be handled through raw TCP connections.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Перенеси этот текст в Usage, так как это не является отдельным заданием

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправил

Comment on lines 129 to 143
### Reading options from a configuration file

Your program should support reading options from a plain text configuration file. The file could look like:

```
method=GET
url=http://example.com
headers=User-Agent: MyClient
```

You should be able to run the program like this:

```bash
./http-url -c config.txt
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужна ссылка на спецификацию config файла

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавил ссылку

./http-url -c config.txt
```

### Supporting options
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supporting -> Supported

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправил

Comment on lines 150 to 151
- **`-d`** or **`data`**: Provide data for a POST request
- **`-F`** or **`--form`**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data -> --data

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправил


### Supported HTTP methods

The program must be able to send two types of requests: GET and POST. The desired method can be specified using the -X option.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Стоит подробнее описать, как он будет реагировать допустим на PUT, DELETE. Так как запросы успешно уйдут и отработуют. Вернуть --help message например

Suggested change
The program must be able to send two types of requests: GET and POST. The desired method can be specified using the -X option.
The program should only handle GET and POST requests. Other methodsъ should return a `--help` message to guide users on valid request types. The desired method can be specified using the -X option.

Copy link
Contributor

@atlekbai atlekbai Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Видимо я пропустил этот момент при прошлой проверке.

Я думаю что будет лучше если поддерживать произвольный (arbitrary) HTTP метод, так как HTTP протокол позволяет отправлять любую строку

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

добавил

- If no method is specified, GET is the default.
- The program must send a POST request if data is provided with the `-d` or `--data` option
- It must automatically follow up to 5 HTTP redirections (3xx status codes)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавить, что соединение обязательно должо быть закрыто, а программа завершена после выполнения.

Здесь про запросы, которые не успеют обработаться, или будут обрабатываться ошибочно, что не завершит выполнение программы

Copy link
Contributor

@atlekbai atlekbai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо добавить таймауты, чтобы можно было передавать как аргумент и чтобы был также дефолтный (например 30 сек).

Comment on lines 25 to 33
In this project, your primary task is to implement several functionalities found in curl.
Your program should be capable of:
* Communicating with servers using the HTTP protocol
* Sending GET requests
* Sending POST requests with additional data
* Handling redirections
* Allowing users to customize headers
* Handling errors
* Reading options from a plain text configuration file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь нужно отразить что нужно уметь отправлять запросы с любым методом

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

добавил


Notes:

- You are not allowed to use the `net/http` package or external HTTP libraries. All requests must be handled via direct TCP connections.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- You are not allowed to use the `net/http` package or external HTTP libraries. All requests must be handled via direct TCP connections.
- All requests must be handled via direct TCP connections.

Запрет net/http уже есть в General Criteria

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

убрал


- You are not allowed to use the `net/http` package or external HTTP libraries. All requests must be handled via direct TCP connections.
- If no method is specified, GET is the default.
- The program must send a POST request if data is provided with the `-d` or `--data` option
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо написать что если не указан метод при отправке данных, то используется POST

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

добавил

Comment on lines 134 to 156
### Details

The program must display detailed information about the HTTP request and response when `-v` or `--verbose` option specified. This helps in debugging and seeing exactly what’s happening during the HTTP transaction.

Example:

```bash
./http-curl -X GET -v http://example.com
```

This will output:

```
> GET / HTTP/1.1
> Host: example.com
> User-Agent: your_program/1.0
> Accept: */*
< HTTP/1.1 200 OK
< Content-Type: text/html
< Content-Length: 1024
...
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Давай уберем этот пункт. Он слишком сложен, так как есть разные verbosity levels, сложные сообщения при работе с SSL

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

убрал


### 1. Plan Before You Code

Before jumping into writing code, take a step back and plan out what you're going to do. Think about the idea first—code comes second. Having a clear plan makes coding smoother and helps avoid problems later on.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Before jumping into writing code, take a step back and plan out what you're going to do. Think about the idea firstcode comes second. Having a clear plan makes coding smoother and helps avoid problems later on.
Before jumping into writing code, take a step back and plan out what you're going to do. Think about the idea firstcode comes second. Having a clear plan makes coding smoother and helps avoid problems later on.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

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

Successfully merging this pull request may close these issues.

3 participants