http header etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
http header etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

5 Ağustos 2021 Perşembe

Http Authorization İstek Parametresi - Token Göndermek İçindir

Giriş
Açıklaması şöyle.
The "Authorization" header field allows a user agent to authenticate itself with an origin server -- usually, but not necessarily, after receiving a 401 (Unauthorized) response. Its value consists of credentials containing the authentication information of the user agent for the realm of the resource being requested.
Sunucuya credentials bilgisini göndermek için kullanılır. Şeklen şöyledir.
Authorization: <type> <credentials>
Type olarak OAuth, Basic Authentication, Digest Authentication, Bearer kullanılabilir.

1. Authorization Parametresi - Basic Authentication
Örnek
Basic authentication için şöyle yaparız. Kullanıcı adı ve şifre base64 olarak gönderilir.
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Kullanıcı adı ve şifrenin şekli şöyledir. Yani kısaca kullanıcı adı ve şifre ":" karakteri ile ayrılır ve base64 olarak kodlanır.
basic-credentials = base64-user-pass
base64-user-pass  = <base64 [4] encoding of user-pass,
                     except not limited to 76 char/line>
user-pass   = userid ":" password
userid      = *<TEXT excluding ":">
password    = *TEXT
Örnek
curl ile göndermek için şöyle yaparız.
curl -i http://username:password@dev.myapp.com/api/users
Örnek
Selenium ile göndermek için şöyle yaparız.
driver.get('http://username:password@abc.com')
Örnek
Servlet içinde bu alana erişmek için şöyle yaparız.
String AUTHENTICATION_HEADER = "Authorization";
HttpServletRequest request = ...
String authCredentials = request.getHeader(AUTHENTICATION_HEADER);
2. Authorization Parametresi - Bearer
Bearer'ın açıklaması şöyle.
Bearer Token
A security token with the property that any party in possession of the token (a "bearer") can use the token in any way that any other party in possession of it can. Using a bearer token does not require a bearer to prove possession of cryptographic key material (proof-of-possession).
Bear tipinde token olarak JSON Web Tokens - JWT kullanılabilir.

Örnek
Şöyle yaparız.
Authorization : Bearer cn389ncoiwuencr
Şöyle yaparız.
GET /resource HTTP/1.1
Host: server.example.com
Authorization: Bearer mF_9.B5f-4.1JqM
Örnek
Şöyle yaparız.
Authorization: OAuth oauth_version="2.0", oauth_token_type="Bearer" ...
3. Authorization Parametresi - Digest
Örnek ver

22 Mart 2021 Pazartesi

HTTP Durum Kodları - 1XX Informational Kodları

100 Continue
Sanırım büyük dosyaları upload ederken kullanılır.

101 Switching Protocols
Açıklaması şöyle
The correct status code to use here is without a doubt 301 Moved Permanently.

101 Switching Protocols is an internal status code that a server generally uses to automatically negotiate certain types of connections. It's not used when changing the URL from http to https. If you're curious about how it works, you can read about the 101 status code and the protocol upgrade mechanism on MDN, but you'll never need to know about it as a webmaster.

As a general rule, you should never directly use 100 or 200 series status codes unless you are actually developing web server software. The 300 and 400 series codes (especially 301, 302, and 404) are the ones you'll want to pay attention to when running a simple website.
102 Processing
Açıklaması şöyle. Sanırım uzun süren işlemlerde kullanılır.
The 102 (Processing) status code is an interim response used to inform the client that the server has accepted the complete request, but has not yet completed it. This status code SHOULD only be sent when the server has a reasonable expectation that the request will take significant time to complete. As  guidance, if a method is taking longer than 20 seconds (a reasonable, but arbitrary value) to process the server SHOULD return a 102 (Processing) response. The server MUST send a final response after the request has been completed.
Methods can potentially take a long period of time to process, especially methods that support the Depth header. In such cases the client may time-out the connection while waiting for a response. To prevent this the server may return a 102 (Processing) status code to indicate to the client that the server is still processing the method.
103 Early Hints
Açıklaması şöyle
Normally, when the browser sends a request, the server will receive it and process the request in less than a second and send an HTTP 200 OK response ...

Using the HTTP 103 Early Hints, however, there is room to improve the page rendering speed.

Once the server is updated with the HTTP 103 feature, when a browser sends a request, if the server knows that the content needs resources like style.css, script.js, and so on, then it will hint (respond) with the HTTP 103 Early Hints response to the browser to preload the content ...

Then, once the server processed the complete response, it will send normal HTTP 200 OK to the browser.

This process will help in the page rendering speed as the browser preloads the content ahead.

HTTP Durum Kodları - 2XX SUCCESS Kodları

Giriş
Açıklaması şöyle.
The 2xx (Successful) class of status code indicates that the client's request was successfully received, understood, and accepted.
200 - OK
Açıklaması şöyle.
200 means the server experienced no problems and has a representation of the results for the client to consume.
Sunucudaki bir dosyaya GET isteği gönderdiğimizi varsayalım. Cevap olarak 200 ile başlayan bir satır almamız tüm dosyayı indirdiğimiz anlamına gelmez. Http isteği bir bütün olarak düşünülmeli. Açıklaması şöyle.
HTTP 200 is generated by the server, and only means that it understood the request and thinks it is able to fulfill it (e.g. the file is actually there). All sorts of errors may occur during the transmission of the full response document (network connection breaking, packet loss, etc) which will not show up in the HTTP response, but need to be detected separately.
201 Created
Açıklaması şöyle. PUT isteği ile bir resource ilk defa yaratılırsa bu cevap döner.
If the target resource does not have a current representation and the PUT successfully creates one, then the origin server MUST inform the user agent by sending a 201 (Created) response. If the target resource does have a current representation and that representation is successfully modified in accordance with the state of the enclosed representation, then the origin server MUST send either a 200 (OK) or a 204 (No Content) response to indicate successful completion of the request.
202 Accepted - Async taskİsteğin alındığını belirtir. 200'den farkı gönderilen isteğin daha sonra asenkron olarak işleneceğini ifade etmesidir.

Örnek
Açıklaması şöyle
Assume that your web/mobile application UI accepts a task request from a user, such as uploading an image or creating a profile. The backend will take considerable time to process the task, which can’t be completed within the scope of an HTTP request.

The typical pattern is that the backend accepts the request, validates it, and returns HTTP 202 status to the UI, denoting that the task has been accepted for processing. 

203 - Non-Authoritative Information (since HTTP/1.1)
Açıklaması şöyle.
203 means that the response was modified between the authoritative server and the client. 
204 - No Content
Client tarafından gönderilen isteğe "No Result" gibi bir cevap vermek istersek kullanılabilir. Rest servisini normalde vereceği cevap şöyle olsun.
{
  "results": [
    {
      "name": "Pancakes",
      ....
    },
    {
      "name": "French Fries",
      ....
    }
  ]
}
Ancak dönülen cevap boş ise 204 ve şöyle bir cevap gönderilebilir.
{
  "results": []
}
205 - Reset Content
Örnek ver

206 - Partial Content
Açıklaması şöyle.
206 appears to be designed for returning a large resource over multiple responses. It also requires that the client ask for a part of the content in the headers (so pagination via query strings does not qualify).
207 Multi-Status
Açıklaması şöyle. Birden fazla işin sonucu dönüleceği zaman kullanılabilir.
A Multi-Status response conveys information about multiple resources in situations where multiple status codes might be appropriate. The default Multi-Status response body is a text/xml or application/xml HTTP entity with a 'multistatus' root element. Further elements contain 200, 300, 400, and 500 series status codes generated during the method invocation. 100 series status codes SHOULD NOT be recorded in a 'response' XML element.
Although '207' is used as the overall response status code, the recipient needs to consult the contents of the multistatus response body for further information about the success or failure of the method execution. The response MAY be used in success, partial success and also in failure situations.

HTTP Durum Kodları - 3XX REDIRECTION Kodları

Giriş
Redirection yerine HSTS kullanılabilir. Açıklaması şöyle.
If a user try to access some random http://example.com, HSTS will transform the request into https://example.com, however the website need to have a valid certificate in order to function properly.
300 Multiple Choices
Örnek ver

301 Moved Permanently
Örnek ver

302 Found (Previously "Moved temporarily")
302 ile tarayıcıyı başka sayfaya yönlendirebilmek mümkün. 302 kodu ile beraber yönlendirilen URL bilgisini de göndermek gerekir. 302 cevabı şöyledir.
$ curl -I https://google.net/
HTTP/1.1 302 Found
Location: https://www.google.com/
Cache-Control: private
Content-Type: text/html; charset=UTF-8
...
Örnek
302 durum kodu URL Shortening servisleri tarafından kullanılır.

Örnek
Wicket ile 302 göndermek için exception atılıyor. Örneğin RestartResponseException veya RedirectToUrlException ile bu gerçekleştirilebiliyor.

Eğer orijinal sayfaya tekrar dönülmesi gerekiyorsa RestartResponseAtInterceptPageException  kullanılıyor.

303 See Other
Örnek ver

304 Not Modified
Örnek ver

305 Use Proxy
Örnek ver

307 Temporary Redirect
Örnek ver

13 Kasım 2020 Cuma

HTTP Durum Kodları - 4XX CLIENT ERROR Kodları

Giriş
Http Durum Kodları yazısına bakabilirsiniz.

Hata kodları belli bir yere kadar kullanışlı ancak REST çağrılarında hatanın sebebini tam olarak anlamak için yeterli değil. Açıklaması şöyle.
One area of RESTful web API design that's quite frequently overlooked is how to report errors and problems, either related to the business or application. The proper usage of the HTTP status codes comes to mind first, and although quite handy, it is often not informative enough. Let us take 400 Bad Request as an  example. Yes, it clearly states that the request is problematic, but what exactly is wrong?
1. Cacheable Durumu
Açıklaması şöyle
All 4xx status codes are by default not cacheable, except for 404, 405, 410 and 414, which are cacheable. We presume that editors of the spec did this with the best intentions, but the number of people who knows this nuance is probably quite close to the number of the spec editors. As a result, there are lots of cases (the author of this book had to deal with one) when 404 was returned erroneously and cached on clients, thus prolonging the outage for an indefinite time.
2. Problem Details for HTTP APIs
Açıklaması şöyle
RFC 7807 has proposed “Problem Details for HTTP APIs” with the consideration of communicating non 2xx errors effectively (and in a standard way)
Bu belge şöyle
"This document defines a "problem detail" as a way to carry machine-readable details of errors in a HTTP response to avoid the need to define new error response formats for HTTP APIs."
Çıktısı şöyle
{
"type": "about:blank",
"title": "Invalid name passed",
"status": 400,
"detail": "Name should have only Alphabets",
"instance": "/greeting"
}
İstemci MediaType.APPLICATION_PROBLEM_JSON ile bu RFC'yi kabul edeceğini belirtir

3. Hata Kodları
Burada çok kullanılan hata kodları için açıklamalar var

400 Bad Request
Açıklaması şöyle.
Your browser sent a request that this server could not understand.
Açıklaması şöyle. Hangi parametrenin yanlış olduğunu standart olarak dönmenin yolu yok
... when some parameters are invalid or missing. This error makes absolutely no sense to clients unless specific missing or invalid field is specified — but that's exactly the thing the standard does nothing with! There are no conventional standards to specify which parameter is wrong exactly. Yes, we can, of course, invent a standard of ourselves, but that would contradict the REST idea of protocol transparency.
NB: some purists insist, that a 400 code indicates a problem with the request itself, i.e. malformed URI, or header, or body, etc. Sometimes 422 Unprocessable Entity or 412 Precondition Failed are claimed to be the ‘right’ code for invalid parameters error. It doesn't change anything, of course.
401 Not Authorized - Belirtilen Yetkilendirme Yöntemini Kullanarak Tekrar Gel
Sunucu bu cevabı gönderirse erişilmek istenen kaynağa yetkimiz olmadığını belirtir. 
- HTTP Digest Authentication
- OAuth2
gibi bir doğrulama/yetkilendirmek yöntemini kullanmak gerekir.

402 Payment Required
Örnek ver

403  Forbidden - Doğrulama/Yetkilendirme Problemi
Açıklaması şöyle. Doğrulama/Yetkilendirme problemi olunca sunucu bu değeri dönebilir.
the server understood the request but refuses to authorize it. A server that wishes to make public why the request has been forbidden can describe that reason in the response payload (if any). [..] However, a request might be forbidden for reasons unrelated to the credentials.
Çok fazla doğrulama/yetkilendirme yöntemi var. Bunlardan bazıları şöyle
403 Forbidden when some authorization or authentication error occurs. There are several quite different Forbidden situations, which require quite different actions from the client:
— an authorization token is missing — the user must be invited to log in;
— the token is expired — the token refreshing procedure must be conducted;
— the token belongs to other user — usually indicates that some caches are stall;
— the token is revoked — usually a result of user logging out on all devices;
— the user is bruteforcing the authorization endpoint — some antifraud action is required;
— etc.
Each 403 reason indicates quite different scenarios, some of them (bruteforcing) have nothing in common with others.
404 Not Found - Dikkat Önbellekte Saklanabilir
Bulunamayan sayfalar için bu hata kodu döndürülüyor. 

405 Method Not Allowed -  Dikkat Önbellekte Saklanabilir
Açıklaması şöyle. Yani POST adresine GET gönderirsem bu cevabı alırım
405 Method Not Allowed means that the HTTP method is simply not supported. For example, a client might do a POST request on a resource where POST is not implemented or it’s meaningless.

A server generating the 405 response must also tell the client which HTTP methods it can do, using the Allow header.
406 Unacceptable
Sunucu, istemci tarafından gönderilen Accept alanlarına uyan bir cevap üretemiyor. Bunların dışında bir cevap üretebiliyor. 

Örnek
Bir örnek şöyle
... to indicate invalid Accept-Language request header value

407  Proxy Authentication Required
Açıklaması şöyle.
In case of a 407 error, the response that you are receiving must contain a special Proxy-Authenticate header. This header will tell you what kind of authentication the proxy server is expecting.

What you need to do is include a Proxy-Authorization header in your request. The typical syntax for a Proxy-Authorization header is Proxy-Authorization:<type-of-authentication-scheme> <credentials-for-authentication-at-proxy-server>.

Proxy-Authenticate header will let you know the type of authentication scheme that you need to use.
408 Request Timeout
Örnek ver

409 Conflict
Açıklaması şöyle.
The 409 (Conflict) status code indicates that the request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and resubmit the request. The server SHOULD generate a payload that includes enough information for a user to recognize the source of the conflict.
Sistemin mevcut durumu istek ile çelişiyorsa gönderilir. Çıktı olarak şunu alırız.
409  Conflict

your proposed change has been declined because ${REASON}.  
The following resolution protocols are available: ${LINKS[@]})
Örnek
Optimistic Locking kullanıyorsak ve version numarası eski olan bir satırı güncellemek istersek şöyle yaparız
return ResponseEntity.status(HttpStatus.CONFLICT).body(exception.getMessage());
410 Gone  Dikkat Önbellekte Saklanabilir
Açıklaması şöyle. 404'te sunucu adresi bilmiyor, 410 kodunda 404'ten farklı olarak sunucu adresin kalıcı olarak yok olduğunu biliyor
A 410 Gone error occurs when a user tries to access an asset which no longer exists on the requested server. In order for a request to return a 410 Gone status, the resource must also have no forwarding address and be considered to be gone permanently. This is the key differentiator from a 404 Not Found in that with a 404 error, the server does not know if the resource may be available again in the future.
411 Length Required
Örnek ver

412 Precondition Failed
Örnek ver

413 Request Entity Too Large
Sunucudan çok fazla veri istenirse kullanılabilir. Örneğin 50 bin satır birden istenirse bu hata kodu döndürülebilir.

414 URI Too Long   Dikkat Önbellekte Saklanabilir
Örnek ver

415 Unsupported Media Type
Konu ile ilgili örnek lazım

416 Requested Range Not Satisfiable
Örnek ver

417 Expectation Failed
Örnek ver
429 Too Many Requests
Eğer sunucundaki bellek yetersizse, istekleri yerine getiremez. Bu durumda bu hatayı dönebilir.

9 Temmuz 2020 Perşembe

Http Header Parametreleri

Not:  Konuyla ilgili olarak Http header injection yazına bakmakta fayda var.

Http Header Nedir?
Http Header bir Http istek veya cevabının (Http Request or Response) başında bulunan veridir.
Http paketi

1.Http Header
2.Body
3. Trailer

alanlarından oluşur. Http Header alanları ile HTML'i birbiriyle karıştırmamak gerekir.
Http Header alanları RFC 2616'da tanımlı.


Http Header Hangi Kısımlardan Oluşur
Http Header da kendi içinde bölümlenmiştir. İki ana kısımdan oluşur.

1. Request veya Response isimli alanlar.
2. MIME Type ile ilgili alanlar. Aslında MIME alışkanlıktan dolayı kullanılana bir kelime. MIME yerine Internet Media Type kullanılmalı. MIME Type ile ilgili alanlar hem Request hem de Response ile birlikte kullanılabilir. Örneğin dosya yüklemek için POST veya PUT ile birlikte kullanılır. Dosya indirirken Response ile birlikte gönderilir.

Bu yazıdaki çoğu parametre HTTP Header kısmı ile ilgili.

Request Alanı
Http verb'lerini içerir. Açıklaması şöyle
Method         = "OPTIONS"                ; Section 9.2
                  | "GET"                    ; Section 9.3
                  | "HEAD"                   ; Section 9.4
                  | "POST"                   ; Section 9.5
                  | "PUT"                    ; Section 9.6
                  | "DELETE"                 ; Section 9.7
                  | "TRACE"                  ; Section 9.8
                  | "CONNECT"                ; Section 9.9
                  | extension-method
   extension-method = token
Verb'ler harflere duyarlıdır. Açıklaması şöyle
The Method token indicates the method to be performed on the
resource identified by the Request-URI. The method is case-sensitive.
Http2 protokolü Http/1.x'e göre çok daha karmaşık.

Http Head Verb
Head isteği Get isteği ile aynı. Aradaki tek fark istenilen şeyin içeriği yerine sadece meta-date bilgilerinin gelmesi. How to calculate a file size from URL in java sorusunda benzer bir cevap var.

Http Header Harf Duyarlılığı
Açıklaması şöyle
Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive.
Not : Bazı parametreleri Http İstek Parametreleri yazısına taşıdım.
Not : Bazı parametreleri  Http Cevap Parametreleri yazısına taşıdım.

Connection Parametresi
Http 1.0'da bu parametre mevcut değil. Sunucu bağlantıyı istek sonunda otomatik kapatır
Http 1.1'de sunucu bağlantıyı ne kadar açık tutacağını şöyle belirtir.
Connection: keep-alive
Keep-Alive: timeout=300
Hata ve zaman aşımının açıklaması şöyle. Taraflardan herhangisi birisi bağlantıyı istediği an kapatabilir.
6.5. Failures and Timeouts
A client, server, or proxy MAY close the transport connection at any time. [...]
A client sending a message body SHOULD monitor the network connection for an error response while it is transmitting the request. If the client sees a response that indicates the server does not wish to receive the message body and is closing the connection, the client SHOULD immediately cease transmitting the body and close its side of the connection.
Kapatmanın açıklaması şöyle
6.6. Tear-down
A server that sends a "close" connection option MUST initiate a close of the connection [...] after it sends the response containing "close". [...]
Kapatmak için şöyle bir veri alırız. Elle kodlanan basit bir web sunucusunda bu alanı kullanmadan direkt soketi kapatmıştım :)
Connection:close
Content-Type:application/json;charset=UTF-8
Date:Wed, 29 Mar 2017 03:30:51 GMT
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked
Content-Security-Policy Parametresi
Örnek
Şöyle yaparız.
Content-Security-Policy : default-src 'self'; (Allow everything but only from the same origin)
Content-Security-Policy : script-src 'self';  (Only Allow Scripts from the same origin)
Content-Security-Policy : script-src 'self' www.google-analytics.com ajax.googleapis.com; (Allow Google Analytics, Google AJAX CDN and Same Origin)
Content-Security-Policy : default-src https: (Allow any assets to be loaded over https from any origin)
Örnek
Scipt, frame, connection gibi şeyler etkinsizleştirip sadece image ve stylesheet'lerin kendi alanımızdan yüklenmesine izin vermek için şöyle yaparız.
Content-Security-Policy: default-src 'none'; img-src 'self'; style-src 'self';
Content-type Parametresi
Content-type MIME header alanlarından birisi. Gönderilen dosyanın ne tip olduğunu anlamak için ya dosyanın uzantısına bakmak veya magic number kullanmak gerekirdi. Bunun yerine bir standart oluşturularak dosyanın ne tip bir şey olduğu belirlenmiş. Dosya tipleri de belli başlıklar altında toplanmış. Bu başlıklar metin, audio, video gibi şeyler.
1. Metin Tipi
İnsan tarafından okunabilen metin olduğunu belirtir. Metin verisi genellikle character encoding ile beraber kullanılır. Mesela charset=UTF-8 gibi.

text/plain
"text/plain" ile gönderilen verinin metin olduğu belirtilir.

text/html
Örnek
Şöyledir.
HTTP/1.1 200 OK
Server: nginx/1.8.1
Date: Fri, 08 Apr 2016 02:10:14 GMT
Content-Type: text/html
Content-Length: 286
Connection: keep-alive
Vary: Accept-Encoding
Content-Encoding: gzip
Örnek
text/html;charset=ISO-8859-1 yapılırsa gönderilen içeriğin html olduğu ve encoding olarak ne kullandığı belirtilir. Metin olarak gönderilen verinin hangi encoding kullandığını belirtmekte fayda var. utf-8 için şöyle yaparız.
'Content-Type: text/html; charset=utf-8'
text/xml
Örnek
Şöyledir
POST /jwsbook/BookQuote HTTP/1.1
Host: www.Monson-Haefel.com
Content-Type: text/xml; charset="utf-8"
Content-Length: 295
SOAPAction=""

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:mh="http://www.Monson-Haefel.com/jwsbook/BookQuote">
   <soap:Body>
      <mh:getBookPrice>
          <isbn>0321146182</isbn>
      </mh:getBookPrice>
   </soap:Body>
</soap:Envelope>

2. Application Tipi
Multipurpose dosyalar için application grubu kullanılır.

Json Verisi
"application/json; charset=UTF-8" şeklinde veriliyor.

PDF Verisi
"application/pdf" şeklinde veriliyor. Tarayıcı bu linki kendi PDF göstericisi ile açar veya kendisini pdf MIME tipi için sisteme kaydetmiş uygulama ile açar.

Binary Veri
"application/octet-stream" verinin binary olduğunu belirtir. Tarayıcı bu linki diske kaydeder.
Örnek
Şöyle yaparız

curl -ILk http://clhs.lisp.se/Body/m_w_open.htm
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Accept-Ranges: bytes
Content-Length: 8896
Date: Sat, 21 Sep 2019 18:41:10 GMT
Server: lighttpd/1.4.45

Form Verisi
Http Post ve multipart/form-data yazısına taşıdım.


Excel
"application/vnd.ms-excel" şeklinde gönderilir.
Örnek
Sunucundan excel dosyası göndermek ve harici bir uygulama ile açmak için şöyle yaparız.
String fileName = "MyFile.xls";

response.setContentType("application/vnd.ms-excel"); //Tell browser to expect an excel
response.setHeader("Content-Disposition", "attachment; filename="+fileName);

HSSFWorkbook workbook = createExcel();
workbook.write(response.getOutputStream());
SOAP
Şöyle yaparız.
'Content-Type: application/soap+xml; charset=UTF-8'
Şöyle yaparız.
Content-Type: application/soap+xml; charset=utf-8
3. Unregistered Tip
token isteme
Örnek
Şöyle yaparız.
params.put("Content-Type","application/x-www-form-urlencoded");

Content-Encoding Parametresi
Http Cevap Parametreleri yazısına taşıdımf

Content-Disposition Parametresi
Bu parametre MIME header alanlarından birisi. inline veya attachment değerini alabilir. Eğer belirtilmezse inline varsayılır.

inline
Bu parametre inline ise browser içinde açılır.
Örnek
Şöyle yaparız. Bu bir png dosyası eğer gösterebiliyorsan göster, gösteremiyorsan belirtilen dosya ismi ile kaydet anlamına gelir.
Content-Type: image/png
Content-Disposition: inline; filename="picture.png"
Örnek
form-data upload için kullanılır. Şöyle yaparız.
"Content-Disposition: form-data; name="id"\r\n\r\nTTR";
Örnek
Şöyle yaparız.
"Content-Disposition: form-data; name="file"; 
filename="C:\test.jpg"\r\nContent-Type: image/jpeg\r\n\r\n"
attachment
Bu parametre attachment ise gönderilen dosya browser içindeki plug-in tarafından değil de harici bir uygulama tarafından açılır. Aynı zamanda dosyaya isim verebiliriz. Verinin tipini bilmiyorsak açıklaması şöyle
If this header [Content-Disposition: attachment] is used in a response with the application/octet-stream content-type, the implied suggestion is that the user agent should not display the response, but directly enter a `save response as...' dialog.
Örnek
Şöyle yaparız.
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="picture.png"
Örnek
Eğer verinin tipini biliyorsak şöyle yaparız. Bu bir png dosyası ve kaydet anlamına gelir.
Content-Type: image/png
Content-Disposition: attachment; filename="picture.png"
Örnek
pdf için şöyle yaparız.
Content-Disposition: attachment; filename="Schubert-Sonata-21-B-flat.pdf"
Content-Type: application/pdf
Cookie Parametresi
Cookie'ler '; ' karakteri ile ayrılır. Şöyle yaparız.
Cookie: XSRF-TOKEN=...; laravel_session=...
Last-Modified Parametresi
Bu parametre bir sayfanın en son ne zaman değiştiğini bildirir.

Proxy-Connection Parametresi
Eğer client, sunucunun bağlantıyı kapatmasını istemiyorsa, yani persistent connection istiyorsa
Connection : keep-alive gönderir.

Eğer arada proxy varsa, proxy yazılımının bu isteğe uygun davranması gerekir. Ancak eski proxy yazılımları bu isteğe uygun davranmıyordu. Bu yüzden geçici çözüm olarak Proxy-Connection parametresi icat edildi. Açıklaması şöyle.
One attempted solution was the introduction of a Proxy-Connection header field, targeted specifically at proxies.
Bir müddet sonra Proxy yazılımların akıllanarak bu alandadan kurtulunacağı düşünülüyordu. Dolayısıyla normalde bu alanı göndermemek lazım. Açıklaması şöyle.
As a result, clients are encouraged not to send the Proxy-Connection header field in any requests.
Ancak bu iş beklendiği gibi olmadı.Açıklaması şöyle. Dolayısıla ortada halen bir sürü eski proxy yazılımı var.
Back in 2016 we (in the curl project) actually removed the Proxy-Connection: Keep-Alive header from curl requests done to proxies for exactly that reason: it isn't necessary since the protocol implies keep-alive and the spec says so!

Then (after that change) we immediately got a stream of bug reports from people whose proxy connections broke down completely and persistent connections simply failed to work... and once we reverted that change everything went back to working again.
Örnek
Şöyle yaparız.
"Proxy-Connection: keep-alive";
"Connection: keep-alive";
Transfer-Encoding Parametresi
Şu değerlerden birisini alır
chunked,compress,deflate,gzip,identity
chunk seçeneği
HTTP2 ile kullanımdna kalkmıştır. Veriyi chunk halinde gönderebilmeye yarıyor. Açıklaması şöyle.
When the server needs to send large amount of data, chunked encoding is used by the server because it did not exactly know how big (length) the data is going to be. In HTTP terms, when server sends response Content-Length header is omitted by the server. Instead server writes the length of current chunk in hexadecimal format followed by \r\n and then chunk, followed by \r\n (Content begins with chunk size in hex followed by chunk)

This feature can be used for progressive rendering; however the server needs to flush the data as much as possible so that client can render content progressively (in case of html,css etc)

This feature is often used when server pushes data to the client in large amounts - usually in large size (mega/giga)

Örnek
Video streaming için kullanılabilir.

Örnek
Text için şöyle yaparız.
HTTP/1.1 200 OK\r\n
Transfer-Encoding: chunked\r\n
Content-Type: text/plain\r\n
\r\n
1e\r\n
Uh-oh, this will never stop.\n
1e\r\n
Uh-oh, this will never stop.\n
X-XSS-Protection Parametresi
Açıklaması şöyle
Setting this in HTTP response header will turn on the browsers built in XSS protection
Şöyle yaparız.
X-XSS-Protection: 1; mode=block