HTTP
This is a README.adoc file. The original repository is located here.
Task HTTP
You can use curl or wget commands
Branch:
http
Fenrir ID:http
Points:30
Your solution must be located at http:
...
├─ http
│ ├─ part-1.sh
│ ├─ part-2.sh
│ ├─ part-3.sh
│ └─ part-4.sh
└─ .git
Return codes (5 points)
Create a script part-1.sh which runs an http request and parses the return code.
The script must print the answer in the format <DESC>(<CODE>)
Where DESC is a textual description of the return code:
-
SUCCESS -
REDIRECT -
CLIENT_ERROR -
SERVER_ERROR
And CODE is the return code
To prevent waiting indefinitely for the response, set the maximum execution time to 5 sec.
- Synopsis
./part-1.sh <URL>
- Output
POST requests (10 points)
You are to create a script part-2.sh which sends a POST request to the server and parses its response.
Request body is defined by the following class:
data class pair(
val x : Int,
val y : Int,
)
You must support three content types:
-
JSON
-
YAML
-
XML
XML body must be wrapped in <req version="1.1">…</req>.
|
Response body is defined by this class:
data class response(
val result : Int,
)
The script must print only one number: the value of result.
- Synopsis
./part-2.sh {-x | -y | -j} <URL> <x> <y>
Options:
-x XML format
-y YAML format
-j JSON format
- Output
56
Redirections (10 points)
You are to create a script part-3.sh which sends a request to the server and collects all redirections.
The script must print all URLs that are encountered when resolving the server location.
- Synopsis
- Output
Download files (5 points)
You are to create a script part-4.sh which downloads a file from a URL. The file must be saved to the provided directory.
- Synopsis
The name is defined in the response:
Copyright
The project is licensed under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
© 2026-present Iwan Kalinin <koefic.cien@gmail.com>