http client url project description#28
http client url project description#28DarkhanShakhan wants to merge 5 commits intoalem-platform:mainfrom
Conversation
atlekbai
left a comment
There was a problem hiding this comment.
Хороший проект, но не хватает структурированности по заданиям. Нужно четко разделить каждое задание по отдельному функционалу.
http-curl/README.md
Outdated
| 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. |
There was a problem hiding this comment.
Примеры вызова curl обернуть между backtick символами, например curl https://example.com
http-curl/README.md
Outdated
| 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). |
There was a problem hiding this comment.
Ссылка на error codes ведут на options. Возможно ошибка
http-curl/README.md
Outdated
| - **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`.** |
http-curl/README.md
Outdated
| ### 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. |
There was a problem hiding this comment.
Перенеси этот текст в Usage, так как это не является отдельным заданием
http-curl/README.md
Outdated
| ### 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 | ||
| ``` |
There was a problem hiding this comment.
Нужна ссылка на спецификацию config файла
http-curl/README.md
Outdated
| ./http-url -c config.txt | ||
| ``` | ||
|
|
||
| ### Supporting options |
http-curl/README.md
Outdated
| - **`-d`** or **`data`**: Provide data for a POST request | ||
| - **`-F`** or **`--form`** |
http-curl/README.md
Outdated
|
|
||
| ### 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. |
There was a problem hiding this comment.
Стоит подробнее описать, как он будет реагировать допустим на PUT, DELETE. Так как запросы успешно уйдут и отработуют. Вернуть --help message например
| 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. |
There was a problem hiding this comment.
Видимо я пропустил этот момент при прошлой проверке.
Я думаю что будет лучше если поддерживать произвольный (arbitrary) HTTP метод, так как HTTP протокол позволяет отправлять любую строку
| - 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) | ||
|
|
There was a problem hiding this comment.
Добавить, что соединение обязательно должо быть закрыто, а программа завершена после выполнения.
Здесь про запросы, которые не успеют обработаться, или будут обрабатываться ошибочно, что не завершит выполнение программы
atlekbai
left a comment
There was a problem hiding this comment.
Надо добавить таймауты, чтобы можно было передавать как аргумент и чтобы был также дефолтный (например 30 сек).
| 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 |
There was a problem hiding this comment.
Здесь нужно отразить что нужно уметь отправлять запросы с любым методом
http-curl/README.md
Outdated
|
|
||
| Notes: | ||
|
|
||
| - You are not allowed to use the `net/http` package or external HTTP libraries. All requests must be handled via direct TCP connections. |
There was a problem hiding this comment.
| - 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
http-curl/README.md
Outdated
|
|
||
| - 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 |
There was a problem hiding this comment.
Надо написать что если не указан метод при отправке данных, то используется POST
http-curl/README.md
Outdated
| ### 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 | ||
| ... | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Давай уберем этот пункт. Он слишком сложен, так как есть разные verbosity levels, сложные сообщения при работе с SSL
http-curl/README.md
Outdated
|
|
||
| ### 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. |
There was a problem hiding this comment.
| 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. | |
| 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. |
No description provided.