HTTP İsteği Oluşturma

139.179.179.3 no'lu IP adresinin 80 no'lu portuna bağlantı kurulup lkd.org.tr veya kamp.linux.org.tr sayfalarını Host başlık değişkeni yardımıyla çağırabiliriz:

Request
telnet 139.179.179.3 80
GET / HTTP/1.1
Host: kamp.linux.org.tr
User-Agent: curl2

Yukarıdaki isteğin yanıtı aşağıdaki gibi olacaktır:

Response Header
HTTP/1.1 301 Moved Permanently
Date: Fri, 02 Aug 2019 14:01:26 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips
Location: https://kamp.linux.org.tr/
Content-Length: 234
Content-Type: text/html; charset=iso-8859-1
Response Body
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://kamp.linux.org.tr/">here</a>.</p>
</body></html>
Connection closed by foreign host.

Bu sefer lkd.org.tr sayfası için istekte bulunursak:

Request
telnet 139.179.179.3 80
GET / HTTP/1.1
Host: lkd.org.tr
User-Agent: curl2
Response Header
HTTP/1.1 301 Moved Permanently
Date: Fri, 02 Aug 2019 14:05:55 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips
Set-Cookie: qtrans_cookie_test=qTranslate+Cookie+Test; path=/; domain=lkd.org.tr
X-Pingback: http://www.lkd.org.tr/xmlrpc.php
Location: http://www.lkd.org.tr/
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Response Body
Connection closed by foreign host.

Yukarıdaki işlemleri SSL sayfalar için yapmak istersek nc veya telnet yerine bizim için SSL konuşan bir araca ihtiyaç var. Bunun için openssl veya gnutls kullanılabilir.

Herhangi bir sayfaya openssl ile 443 ssl bağlantısı aşağıdaki gibi kurulabilir:

openssl s_client -connect 139.179.179.3:443

Bundan sonra yukarıdaki HTTP isteklerini gönderdiğimizde HTTP 400 hata kodu geliyorsa aşağıdaki komut çalıştırılmalı:

openssl s_client -connect 139.179.179.3:443 -crlf

Yukardaki komuttan sonra CONNECTED(00000003) geliyorsa bağlantı kurulmuş demektir. Bundan sonra en alt satıra standart HTTP istekleri yapılabilir:

Request
GET / HTTP/1.1
Host: kamp.linux.org.tr
User-Agent: curl2
Response Header
HTTP/1.1 200 OK
Date: Fri, 02 Aug 2019 14:27:29 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips
Last-Modified: Thu, 07 Mar 2019 21:58:47 GMT
ETag: "39-5838835f41a7f"
Accept-Ranges: bytes
Content-Length: 57
Content-Type: text/html; charset=UTF-8
Response Body
<meta http-equiv="refresh" content="0;url=2019/yaz/" /> 
read:errno=0

Aynı şekilde Host: lkd.org.tr şeklindeki istek sonucunun gövdesinde (Body) bu sefer html kodlarını görecektik. Tabii bunu da tarayıcı veya bir program yardımıyla anlamdırabiliriz.

Yukarıdaki istekleri curl programı ile de yapmak mümkün. curl sonucunda sayfa html ne varsa onu döndürür. ssl de destekler:

curl https://139.179.179.3 -H "Host: lkd.org.tr"  -k -L

sonucu güzelce html sayfayı getirecektir.

Not: Burada -k parametresini SSL sorununu gidermek için -L parametresini de site yönlendirilmesinin takip edilmesi gerektiği ayarı için verildi.

Last updated

Was this helpful?