Onion Information
Rad s protokolima aplikacijske razine - GASERI
Rad s protokolima aplikacijske razine korištenjem cURL-a - Pregled protokola aplikacijske razine - Pojam URL-a - Uniform Resource Locator (URL) je znakovni niz koji predstavlja vezu na neki resurs. URL se često koristi za pristupanje web st...
Onion Details
Page Clicks: 0
First Seen: 03/15/2024
Last Indexed: 10/23/2024
Onion Content
Preskoči na sadržaj Rad s protokolima aplikacijske razine korištenjem cURL-a Pregled protokola aplikacijske razine Pojam URL-a Uniform Resource Locator (URL) je znakovni niz koji predstavlja vezu na neki resurs. URL se često koristi za pristupanje web stranicama korištenjem protokola HTTP ( http:// ) i HTTPS ( https:// ), ali podržava i druge protokole, npr. FTP ( ftp:// ) i e-mail ( mailto: ). Primjerice, URL može biti http://example.group.miletic.net:80/category/page.html . Njegovi su dijelovi: protokol ( http:// ), domena ( example.group.miletic.net ), umjesto domene se može koristiti i IP adresa, broj vrata ( 80 , opcionalan) i putanja do resursa ( /category/page.html ). Pritom resurs može biti HTML datoteka kao u primjeru, ali i bilo što drugo (npr. CSS datoteka, slika ili video). Protokoli HTTP i HTTPS Hypertext Transfer Protocol (HTTP) je aplikacijski protokol i temelj podatkovne komunikacije za World Wide Web (WWW). Internet Engineering Task Force (IETF) i the World Wide Web Consortium (W3C) stoje iza njegovog razvijanja. HTTP radi na request-response paradigmi po kljent-poslužitelj modelu. Jedna HTTP sesija sastoji se od niza zahtjeva (klijent) i odgovora (poslužitelj). Hypertext Transfer Protocol Secure (HTTPS) je proširenje HTTP protokola SSL/TLS slojem. HTTPS se koristi za sigurnu komunikaciju preko računalne mreže. U srži TLS-a je korištenje privatnih i javnih ključeva te enkripcija podataka. HTTPS još podrazumijeva autentifikaciju i korištenje certifikata za dokazivanje identiteta. Protokol FTP File Transfer Protocol (FTP) je mrežni protokol koji omogućuje transfer datoteka sa jednog domaćina na drugi preko TCP veze. Radi na klijent-poslužitelj principu. FTP može, ali ne mora koristiti autentifikaciju. FTP-SSL (FTPS, poznat kao i FTP Secure) proširuje FTP tako da uz autentifikaciju omogućuje i enkripciju (SSL/TLS usluge). FTPS treba razlikovati od SFTP protokola koji je vezan uz SSH (Secure Shell). Osnovne značajke i način korištenja alata cURL (naredba curl ) je komandno linijski alat za prijenos podataka korištenjem URL sintakse. Podržava brojne protokole (DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet i TFTP), od kojih ćemo u nastavku koristiti manji dio. cURL je slobodan softver dostupan pod MIT licencom . cURL podržava SSL certifikate, HTTP naredbe POST i PUT, FTP upload, HTTP upload zasnovan na obrascima, proxy poslužitelje, keksiće, autentifikaciju korištenjem korisničkog imena i zaproke (Basic, Digest, NTLM, Negotiate, kerberos i druge), nastavljanje prijenosa datoteke, tuneliranje putem proxy poslužitelja i još mnogo toga. Mi ćemo se ograničiti na osnovnu funkcionalnost, ali službena dokumentacija dostupna na cURL-ovim stranicama ima više detalja. Preuzimanje stranice ili datoteke Preuzimanje se vrši navođenjem URL-a. Pristupimo HTTP poslužitelju na domeni example.group.miletic.net za primjer: $ curl http://example.group.miletic.net/ Apache2 Debian Default Page: It works * { margin: 0px ; padding: 0px ; } body, html { padding: 3px ; background-color: #D8DBE2; font-family: Verdana, sans-serif ; font-size: 11pt ; text-align: center ; } div.main_page { position: relative ; display: table ; width: 800px ; margin-bottom: 3px ; margin-left: auto ; margin-right: auto ; padding: 0px ; border-width: 2px ; border-color: #212738; border-style: solid ; background-color: #FFFFFF; text-align: center ; } div.page_header { height: 99px ; width: 100 % ; background-color: #F5F6F7; } div.page_header span { margin: 15px 0px 50px ; font-size: 180 % ; font-weight: bold ; } div.page_header img { margin: 3px 0px 40px ; border: 0px ; } div.table_of_contents { clear: left ; min-width: 200px ; margin: 3px ; background-color: #FFFFFF; text-align: left ; } div.table_of_contents_item { clear: left ; width: 100 % ; margin: 4px 0px ; background-color: #FFFFFF; color: #000000; text-align: left ; } div.table_of_contents_item a { margin: 6px 0px 6px ; } div.content_section { margin: 3px ; background-color: #FFFFFF; text-align: left ; } div.content_section_text { padding: 4px 8px ; color: #000000; font-size: 100 % ; } div.content_section_text pre { margin: 8px 0px ; padding: 8px ; border-width: 1px ; border-style: dotted ; border-color: #000000; background-color: #F5F6F7; font-style: italic ; } div.content_section_text p { margin-bottom: 6px ; } div.content_section_text ul, div.content_section_text li { padding: 4px 8px 4px 16px ; } div.section_header { padding: 3px 6px ; background-color: #8E9CB2; color: #FFFFFF; font-weight: bold ; font-size: 112 % ; text-align: center ; } div.section_header_red { background-color: #CD214F; } div.section_header_grey { background-color: #9F9386; } .floating_element { position: relative ; float: left ; } div.table_of_contents_item a, div.content_section_text a { text-decoration: none ; font-weight: bold ; } div.table_of_contents_item a:link, div.table_of_contents_item a:visited, div.table_of_contents_item a:active { color: #000000; } div.table_of_contents_item a:hover { background-color: #000000; color: #FFFFFF; } div.content_section_text a:link, div.content_section_text a:visited, div.content_section_text a:active { background-color: #DCDFE6; color: #000000; } div.content_section_text a:hover { background-color: #000000; color: #DCDFE6; } div.validator { } Apache2 Debian Default Page TABLE OF CONTENTS About Changes Scope Config files --> It works! This is the default welcome page used to test the correct operation of the Apache2 server after installation on Debian systems. If you can read this page, it means that the Apache HTTP server installed at this site is working properly. You should replace this file ( located at /var/www/html/index.html ) before continuing to operate your HTTP server. If you are a normal user of this web site and don 't know what this page is about, this probably means that the site is currently unavailable due to maintenance. If the problem persists, please contact the site' s administrator. Configuration Overview Debian ' s Apache2 default configuration is different from the upstream default configuration, and split into several files optimized for interaction with Debian tools. The configuration system is fully documented in /usr/share/doc/apache2/README.Debian.gz . Refer to this for the full documentation. Documentation for the web server itself can be found by accessing the manual if the apache2-doc package was installed on this server. The configuration layout for an Apache2 web server installation on Debian systems is as follows: /etc/apache2/ | - apache2.conf | ` -- ports.conf | - mods-enabled | | - *.load | ` -- *.conf | - conf-enabled | ` -- *.conf | - sites-enabled | ` -- *.conf apache2.conf is the main configuration file. It puts the pieces together by including all remaining configuration files when starting up the web server. ports.conf is always included from the main configuration file. It is used to determine the listening ports for incoming connections, and this file can be customized anytime. Configuration files in the mods-enabled/ , conf-enabled/ and sites-enabled/ directories contain particular configuration snippets which manage modules, global configuration fragments, or virtual host configurations, respectively. They are activated by symlinking available configuration files from their respective *-available/ counterparts. These should be managed by using our helpers a2enmod, a2dismod, a2ensite, a2dissite, and a2enconf, a2disconf . See their respective man pages for detailed information. The binary is called apache2. Due to the use of environment variables, in the default configuration, apache2 needs to be started/stopped with /etc/init.d/apache2 or apache2ctl . Calling /usr/bin/apache2 directly will not work with the default configuration. Document Roots By default, Debian does not allow access through the web browser to any file apart of those located in /var/www , public_html directories ( when enabled ) and /usr/share ( for web applications ) . If your site is using a web document root located elsewhere ( such as in /srv ) you may need to whitelist your document root directory in /etc/apache2/apache2.conf . The default Debian document root is /var/www/html . You can make your own virtual hosts under /var/www. This is different to previous releases which provides better security out of the box. Reporting Problems Please use the reportbug tool to report bugs in the Apache2 package with Debian. However, check existing bug reports before reporting a new bug. Please report bugs specific to modules ( such as PHP and others ) to respective packages, not to the web server itself. Ukoliko želimo spremiti izlaz u datoteku umjesto ispisati na standardni izlaz, koristimo parametar -o i navodimo ime datoteke: $ curl -o example-index.html http://example.group.miletic.net/ % Total % Received % Xferd Average Speed Time Current Dload Upload Total Spent Left Speed 100 2033 0 74324 0 --: -: - 75296 Parametrom -O izlaz možemo spremiti u lokalnu datoteku istog imena kao datoteka na poslužitelju: $ curl -O http://example.group.miletic.net/index.html % Total % Received % Xferd Average Speed Time Current Dload Upload Total Spent Left Speed 100 2033 0 120k 0 --: -: - 124k $ ls index.html Preuzimanje dijela datoteke Parametrom -r moguće je specificirati raspon podataka datoteke koji će bit preuzet: $ curl -r 0 -350 http://example.group.miletic.net/index.html Apache2 Debian Default Page: It works Mjerenje napretka Kod većih datoteka može se uočiti da je mjerenje napretka interaktivno: $ curl -O https://mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-basic-20220215.47946.qcow2 % Total % Received % Xferd Average Speed Time Current Dload Upload Total Spent Left Speed 5 459M 5 23 .7M 0 1777k 0 :04:24 0 :00:13 0 :04:11 2849k Tip Poveznica u primjeru iznad je na verziju od 15. veljače 2022. i vjerojatno je zastarjela. Provjerite mirror.pkgbuild.com/images/latest/ za točno ime aktualne verzije. Sa lijeva na desno stupci redom imaju sljedeće značenje. Stupac Značenje % postotak obavljenog ukupnog prijenosa Total ukupna veličina očekivanog prijenosa % postotak obavljenog prijenosa (download) Received trenutno preuzetih bajtova % postatak obavljenog prijenosa (upload) Xferd trenutno prenesenih bajtova Average Speed: Dload srednja bzina prijenosa (download) Average Speed: Upload srednja bzina prijenosa (upload) Time Total očekivano vrijeme za ukupni prijenos Time Current proteklo vrijeme Time Left preostalo vrijeme Current Speed srednja brzina prijenosa zadnjih 5 sekundi Jednostavniji prikaz napretka parametrom -# prikazuje samo postotak obavljenog prijenosa numerički i znakom # : $ curl -O -# https://mirror.pkgbuild.com/images/latest/Arch-Linux-x86...