Hacker DirectoryHacker Directory
Öğrenmeye devam et
ENHTML kaydet ↓

WEB / WEB-07.04

Framing, compression ve negotiation

Aynı Çay representation’ı 4-byte identity content, 24-byte gzip content veya chunked message olarak görünebilir. Seçim, dönüşüm ve message boundary ayrı katmanlardır.

CORE · RED · BLUE · ARTIFACT · PRACTICE

1. Core · Mekanizma

Hareket olmadan bütün senaryoları oku

Gzip + Content-Length

  1. Preferences hazır

    Media ve coding preference’ları ayrı; authentication kanıtı değildir.

    Browser / Duru
    GET /tea-label hazır; text/plain / gzip;q=1, identity;q=0.5; response bekleniyor
    Atlas selection ve encoder
    Request yok
    Representation inventory
    Representation: Çay; 4 byte
  2. GET ulaştı

    Application Accept ve Accept-Encoding değerlerini aldı; selection henüz yok.

    Browser / Duru
    GET /tea-label hazır; text/plain / gzip;q=1, identity;q=0.5; response bekleniyor
    Atlas selection ve encoder
    Preferences alındı
    Representation inventory
    Representation: Çay; 4 byte
  3. Variant seçimi

    Fixture gzip representation seçer; coding henüz uygulanmadı.

    Browser / Duru
    Response bekleniyor
    Atlas selection ve encoder
    text/plain + gzip seçildi
    Representation inventory
    Representation: Çay; 4 byte
  4. Native gzip coding

    Fixture’ın gzip bytes’ı 24; decoded input 4 byte.

    Browser / Duru
    Response bekleniyor
    Atlas selection ve encoder
    Gzip content: 24 byte
    Representation inventory
    Representation: Çay; 4 byte
  5. Framing ve Vary

    Content-Length: 24; Transfer-Encoding yok; Vary selection context’i bildirir.

    Browser / Duru
    Response bekleniyor
    Atlas selection ve encoder
    200 hazır; CL=24
    Representation inventory
    Representation: Çay; 4 byte
  6. Complete response ulaştı

    Receiver’a coded/framed bytes ulaştı; decoded text aşaması ayrıca gelir.

    Browser / Duru
    24-byte gzip content alındı
    Atlas selection ve encoder
    200 hazır; CL=24
    Representation inventory
    Representation: Çay; 4 byte
  7. Decode ve yorumla

    Önce gzip content coding açılır, sonra UTF-8 yorumlanır. Decoded Çay dört byte’tır; bu ölçü, Content-Length: 24 ile verilen coded uzunluktan farklıdır.

    Browser / Duru
    Çay; decoded 4 byte
    Atlas selection ve encoder
    200 hazır; CL=24
    Representation inventory
    Representation: Çay; 4 byte

Identity + chunks

  1. Preferences hazır

    Media ve coding preference’ları ayrı; authentication kanıtı değildir.

    Browser / Duru
    GET /tea-label hazır; text/plain / identity; response bekleniyor
    Atlas selection ve encoder
    Request yok
    Representation inventory
    Representation: Çay; 4 byte
  2. GET ulaştı

    Application Accept ve Accept-Encoding değerlerini aldı; selection henüz yok.

    Browser / Duru
    GET /tea-label hazır; text/plain / identity; response bekleniyor
    Atlas selection ve encoder
    Preferences alındı
    Representation inventory
    Representation: Çay; 4 byte
  3. Variant seçimi

    Identity content seçilir; chunked framing ayrıca uygulanacak.

    Browser / Duru
    Response bekleniyor
    Atlas selection ve encoder
    text/plain + identity seçildi
    Representation inventory
    Representation: Çay; 4 byte
  4. Framing ve Vary

    Valid chunks; Content-Length yok; Vary selecting values’ı bildirir.

    Browser / Duru
    Response bekleniyor
    Atlas selection ve encoder
    200 chunked hazır; framed body 19 byte
    Representation inventory
    Representation: Çay; 4 byte
  5. Complete response ulaştı

    Receiver’a coded/framed bytes ulaştı; decoded text aşaması ayrıca gelir.

    Browser / Duru
    19-byte chunked body alındı
    Atlas selection ve encoder
    200 chunked hazır; framed body 19 byte
    Representation inventory
    Representation: Çay; 4 byte
  6. Decode ve yorumla

    Chunked framing kaldırıldıktan sonra UTF-8 Çay dört byte olarak okunur. Framing dahil 19 byte toplamı, representation’ın boyutu değildir.

    Browser / Duru
    Çay; decoded 4 byte
    Atlas selection ve encoder
    200 chunked hazır; framed body 19 byte
    Representation inventory
    Representation: Çay; 4 byte

Strict policy: 406

  1. Preferences hazır

    Media ve coding preference’ları ayrı; authentication kanıtı değildir.

    Browser / Duru
    GET /tea-label hazır; image/png / identity; response bekleniyor
    Atlas selection ve encoder
    Request yok
    Representation inventory
    Representation: Çay; 4 byte
  2. GET ulaştı

    Application Accept ve Accept-Encoding değerlerini aldı; selection henüz yok.

    Browser / Duru
    GET /tea-label hazır; image/png / identity; response bekleniyor
    Atlas selection ve encoder
    Preferences alındı
    Representation inventory
    Representation: Çay; 4 byte
  3. Variant seçimi

    Strict policy 406 seçer; target representation yok.

    Browser / Duru
    Response bekleniyor
    Atlas selection ve encoder
    406 explanation seçildi
    Representation inventory
    Representation: Çay; 4 byte
  4. Framing ve Vary

    Content-Length: 28; Transfer-Encoding yok; Vary selection context’i bildirir.

    Browser / Duru
    Response bekleniyor
    Atlas selection ve encoder
    406 hazır; CL=28
    Representation inventory
    Representation: Çay; 4 byte
  5. Complete response ulaştı

    Browser’a Content-Length: 28 ile sınırlandırılmış text/plain hata açıklaması ulaştı. Content-Encoding yoktur; sonraki yerel aşama UTF-8 yorumlamadır, gzip açma değildir.

    Browser / Duru
    406 explanation alındı
    Atlas selection ve encoder
    406 hazır; CL=28
    Representation inventory
    Representation: Çay; 4 byte
  6. Decode ve yorumla

    Text açıklama okunur; image target seçildiği iddia edilmez.

    Browser / Duru
    406: uygun target variant yok
    Atlas selection ve encoder
    406 hazır; CL=28
    Representation inventory
    Representation: Çay; 4 byte

ROLLER · STATE · VERİ AKIŞI

Content-Length hangi bytes’ı sayar?

Atlas GET /tea-label için Çay döndürür. UTF-8 identity representation 3 code point ama 4 byte’tır. HTTP/1.1’de Content-Length: 4 bu content’in beklenen octet uzunluğunu verir; start-line, headers ve boş ayırıcı satırın byte’ları buna katılmaz. Receiver framing’e göre bütün gerekli content octets’ını almadan mesajı complete sayamaz.

Aynı response gzip ile content-coded ise Content-Length decoded Çay uzunluğunu değil aktarılacak gzip content bytes’ını sayar. Bu fixture Node’un native zlib gzipSync’iyle üretildi: 4-byte UTF-8 input, level=9 ile 24-byte gzip output. Bu yalnız bu küçük input’un gerçek local sonucudur; algorithm bütün küçük/büyük content için aynı kazancı vaat etmez.

HTTP/1.1’de Content-Length ile Transfer-Encoding aynı message’da sender tarafından birlikte üretilmez. Content-Length yoksa her message otomatik body’siz değildir: request/response, method/status ve version-specific framing birlikte okunur. HEAD’in would-be GET metadata’sı ve 204’ün content yasağı WEB-07.02’deki ayrı kuralları korur.

Chunked: content sınırı parça parça bulunur

Transfer-Encoding: chunked HTTP/1.1 message content’ini size-prefixed chunks ile taşır. Chunk size hexadecimal octet sayısıdır; character count değildir. Fixture iki valid chunk kullanır: Ç UTF-8’de 2 byte, ay 2 byte. Ardından zero-sized last chunk ve empty trailer section gelir. Dechunk işlemi birleşik 4 content byte’ını verir; size satırları ve CRLF wrapper content’e dahil değildir.

Bu örneğin framing dahil chunked body’si toplam 19 byte’tır: 4 byte content, 15 byte size/CRLF overhead. Dechunked content 4 byte’tır. HTTP headers bu 19-byte ölçüye de katılmaz. Artifact, chunks ve tam CRLF body notation’ı birlikte verir. Static chunks öğretim için sabittir; gerçek streaming timing veya bilinmeyen uzunluk üretimini simüle etmez.

Chunked bir content media type veya encryption değildir. Transfer coding belirli HTTP/1.1 message taşımasına aittir; content coding representation’a aittir. HTTP/2 ve HTTP/3 Transfer-Encoding’i connection-specific field olarak yasaklar, kendi stream framing’ini kullanır. TE field’ının requests’te yalnız trailers istisnası, Transfer-Encoding’in kullanılabileceği anlamına gelmez.

Content-Encoding: aynı anlamın başka byte gösterimi

Content-Type: text/plain; charset=utf-8 decoded representation’ın formatını anlatır. Content-Encoding: gzip önce gzip’i açma ihtiyacını anlatır. Gösterimde receiver 24 coded byte’ı alır, gzip’i çözer, sonra 4 UTF-8 byte’ı yorumlar. Bu katman sırası bütün body’yi buffer etmek zorunluluğu değildir; streaming implementation aynı sırayı gelen parçalar üzerinde uygulayabilir. Media parser doğrudan gzip bytes’ını Çay sanarak okuyamaz.

Gzip, bu çok küçük content’i 4 byte’tan 24 byte’a büyütür; format overhead’i kazancı aşar. Compression kararında content size, zaten compressed formatlar, CPU maliyeti ve cache variants önemlidir. Buradaki level=9, örneğin sıkıştırma parametresidir; bütün production content için uygun ayar olduğu anlamına gelmez.

Header compression da başka mekanizmadır: HTTP/2 HPACK ve HTTP/3 QPACK header field blocks için kullanılır. Gzip body coding ile aynı katman sayılmaz. Bir response aynı anda negotiated gzip representation ve uygun version framing kullanabilir; burada gzip+Content-Length ile identity+chunked iki ayrı valid alternatif olarak gösterilir.

Preferences, selection ve cache reuse

Accept media preferences, Accept-Encoding content-coding preferences taşır. q weight göreli tercih bildirir; q=0 kabul edilmediğini, omitted q ise 1 değerini ifade eder. Server seçim yaparken kendi available variants ve policy’sini kullanır. Preferences, permission listesi veya kesin response contract’ı değildir.

Normal fixture text/plain ister ve gzip’i identity’den yüksek weight ile kabul eder; server özellikle demonstration için gzip variant seçer. Chunked branch identity ister; server content coding uygulamaz ama HTTP/1.1 message’ı chunked frame eder. Content coding tercihinin framing tercihi olmadığını bu fark gösterir.

Strict branch Accept: image/png gönderir, Atlas yalnız text/plain representation sunar ve kendi strict policy’siyle 406 seçer. Genel HTTP davranışında server preference’ı karşılayamıyorsa bazı durumlarda default representation göndermeyi tercih edebilir; 406 her mismatch için zorunlu değildir. Error explanation target’ın seçilmiş image representation’ı sayılmaz.

Response Vary: Accept, Accept-Encoding hangi request fields’ın representation seçimini etkilediğini cache’e bildirir. Stored response reuse ilgili selecting values ile eşleşmeli veya origin validation’a dayanmalıdır. Vary ne resource permission verir ne de bütün caching policy’sini tanımlar; personalized/private data kuralları ayrıca gerekir.

2. Red · Güven ve etki

Hareket olmadan bütün senaryoları oku

Coded/decoded

  1. Uzunluğun hangi katmana ait olduğu seçildi

    Çay metni gzip ile taşındığında coded content 24 byte, decoded UTF-8 content 4 byte olur. Content-Length, bu response’ta 24 olan coded uzunluğu bildirir; karakter sayısını veya decoded uzunluğu bildirmez.

    Content ledger
    gzip: coded 24 / decoded 4
    Framing/selection gate
    Katman kontrolü bekliyor
    Reuse sınırı
    Kabul sonucu yok
  2. Framing completeness doğru sayıyla değerlendirildi

    Decoded 4 byte’ı Content-Length 24 ile karşılaştırmak, normal response’u eksik sanmaya yol açar. Framing gate coded content’i sayar; decoder başka aşamada çalışır. Küçük decoded sonuç, bütün processing limits’in yeterli olduğunu göstermez.

    Content ledger
    gzip: coded 24 / decoded 4
    Framing/selection gate
    Content-Length = coded 24
    Reuse sınırı
    Kabul sonucu yok
  3. Completeness izin sonucuna çevrilmedi

    Bu ledger’ın coded uzunluğu tutarlıdır. Bundan resource permission veya cache paylaşım izni çıkarılmaz. Coded ve decoded processing limits kendi amaçlarıyla değerlendirilir; bu dört byte’lık örnek büyük content davranışını kanıtlamaz.

    Content ledger
    gzip: coded 24 / decoded 4
    Framing/selection gate
    Content-Length = coded 24
    Reuse sınırı
    Length consistent / permission unknown
  4. Chunk wrapper başka uzunluk üretir

    Identity branch’inde content yine 4 byte’tır, fakat geçerli chunk wrapper ile body notation 19 byte olur. İki chunk’ın data uzunluğu 2 ve 2’dir. Wrapper overhead’i content veya gzip coding olarak adlandırmak katmanları karıştırır.

    Content ledger
    Identity: content 4 / chunked wire 19
    Framing/selection gate
    Content-Length = coded 24
    Reuse sınırı
    Length consistent / permission unknown
  5. Transfer coding ve content coding ayrıldı

    Transfer-Encoding: chunked, burada HTTP/1.1 message boundary’sini kurar. Content-Encoding: gzip ise representation coding’ini belirtir. Identity chunked branch’inde contentCoding null’dır; aynı metni vermeleri aynı byte düzenini kullandıkları anlamına gelmez.

    Content ledger
    Identity: content 4 / chunked wire 19
    Framing/selection gate
    Chunked H1 framing / contentCoding null
    Reuse sınırı
    Length consistent / permission unknown
  6. Katman sonucu kendi sınırında kaldı

    Normal gzip ve chunked branch’leri aynı Çay text’ine ulaşır. Doğru kontrol her count’u kendi katmanında karşılaştırır. Bu sonuç tam HTTP parser, browser decoding veya network delivery ölçümü değildir; access-control kararı da değildir.

    Content ledger
    Identity: content 4 / chunked wire 19
    Framing/selection gate
    Chunked H1 framing / contentCoding null
    Reuse sınırı
    Separate coded/decoded/framing checks

Variant scope

  1. Aynı target iki seçim context’i taşır

    Eski request gzip;q=1, identity;q=0.5 isterken yeni request identity ister. İkisi /tea-label target’ına gider. Aynı target metni, farklı Accept-Encoding değerlerini eşit yapmaz; hangi field’ların seçime katıldığı açık olmalıdır.

    Content ledger
    Old gzip / new identity
    Framing/selection gate
    Katman kontrolü bekliyor
    Reuse sınırı
    Kabul sonucu yok
  2. Vary eşleşmesi representation’ı sınırlandırdı

    Vary, Accept ve Accept-Encoding alanlarını içerir. Bu nedenle değişen coding tercihi için selectingValuesMatch false ve cacheReuse false olur. Eşleşmeyen dimension’ı yok saymak, ledger’ın reuse koşulunu yanlış uygulamak olur.

    Content ledger
    Old gzip / new identity
    Framing/selection gate
    selectingValuesMatch=false / cacheReuse=false
    Reuse sınırı
    Kabul sonucu yok
  3. Reuse kararı private paylaşım izni olmadı

    Diğer satırda selecting values eşleşince cacheReuse true olabilir; originValidated yine false’tur. Bu yalnız seçilmiş matching hesabıdır. Vary, private data’yı public cache’e açmaz ve recipient authorization’ın yerini tutmaz.

    Content ledger
    Old gzip / new identity
    Framing/selection gate
    selectingValuesMatch=false / cacheReuse=false
    Reuse sınırı
    Matching only / originValidated=false
  4. Media isteğinin karşılığı ayrıca seçildi

    strict406 request’i image/png ister; endpoint yalnız text/plain representation destekler. Açıkça seçilmiş strict policy, 406 ve No acceptable representation açıklamasını üretir. Bu text açıklaması seçilmiş bir PNG representation değildir.

    Content ledger
    Accept image/png / status 406
    Framing/selection gate
    selectingValuesMatch=false / cacheReuse=false
    Reuse sınırı
    Matching only / originValidated=false
  5. Policy tercihi evrensel zorunluluk sayılmadı

    Bu case’te 406, endpoint’in açık selectionPolicy tercihidir. Başka origin bir default response seçebilir. Media seçimi, content coding ve framing kararları ayrı kaydedilirse normal failure’ın hangi koşuldan çıktığı anlaşılır.

    Content ledger
    Accept image/png / status 406
    Framing/selection gate
    Explicit strict406 / other policies possible
    Reuse sınırı
    Matching only / originValidated=false
  6. Representation kontrolünün kapsamı kapandı

    İki reuse satırı ve strict406 sonucu, seçilmiş representation koşullarını açıklar. Gerçek cache store, farklı kullanıcıya delivery veya origin revalidation gözlenmemiştir. Bu yüzden matching sonucundan application confidentiality hükmü çıkarılmaz.

    Content ledger
    Accept image/png / status 406
    Framing/selection gate
    Explicit strict406 / other policies possible
    Reuse sınırı
    Selection known / recipient policy separate

VARSAYIM · SINIR · KONTROL

İki uzunluğu aynı ölçü sanmak yanlış boundary oluşturur

Normal coded response Content-Length=24 taşır; decoded text 4 byte’tır. Decoded size ile wire content size’ı karşılaştırmak yanlış completeness veya limit değerlendirmesi doğurur. Ayrıca chunk wrapper overhead’i content size’a karıştırılmamalıdır; gerçek stack bu katmanları farklı aşamalarda işler.

Kontrol established HTTP framing ve compression library’sini kullanmak, coded/decoded byte limits ile bounded processing ihtiyacını ayrı tanımlamaktır. Bu ders normal valid bounded bytes kullanır; conflicting headers, parser differential veya malformed chunk reproduction üretmez. Küçük content’in tamamlanması büyük content için resource-limit kanıtı değildir.

Negotiated variant doğru cache scope’unda kalmalı

Aynı target farklı acceptable coding veya media context’i için farklı representation seçebilir. Yanlış selecting-field envanteri cache’in uyumsuz variant reuse kararına katkı verebilir; etki concrete cache ve recipient behavior’a bağlıdır. Accept/User-Agent gibi client metadata access-control kanıtı sayılmaz.

Savunma variant dimension, Vary, cache directives ve output media metadata’yı birlikte incelemektir. Vary: Accept-Encoding yalnız coding seçim context’ini anlatır; private response’u herkes için cacheable yapmaz. Burada cache entry store veya cross-user serving yoktur; sadece reuse matching öğretim predicate’i vardır.

3. Blue · Güvenli geliştirme ve savunma

Hareket olmadan bütün senaryoları oku

Byte ledger

  1. Hex ile decoded text birlikte tutuldu

    gzip.codedHex, 24 byte’lık content’i tanımlar; decodedHex c3876179 dört UTF-8 byte’ıdır. Çay üç code point taşır. Bu üç sayı farklı ölçülerdir; diagnostic kayıtta hangi sayının kullanıldığı açık kalmalıdır.

    Encoding record
    Coded 24 / decoded 4 / code points 3
    Evidence comparison
    Comparison bekliyor
    Coverage verdict
    Verdict verilmedi
  2. Decoder çıktısı kendi byte hesabıyla eşleşti

    Verilen gzip bytes açıldığında Çay text’i ve c3876179 hex’i beklenir. Eşleşme local encoding/decoding hesabını doğrulayabilir. Bir decoder çalıştırılması HTTP framing, socket transfer veya browser’ın content gösterimini ayrıca doğrulamaz.

    Encoding record
    Coded 24 / decoded 4 / code points 3
    Evidence comparison
    gzip decoded bytes match c3876179
    Coverage verdict
    Verdict verilmedi
  3. Valid chunk data wrapper’dan ayrıldı

    İlk chunk Ç karakterinin iki byte’ını, ikinci chunk ay text’inin iki byte’ını taşır. Size satırları, CRLF ve son zero chunk ile notation 19 byte’tır. Wrapper çıkarıldığında dört content byte kalır.

    Encoding record
    Chunks 2+2 / wire 19 / content 4
    Evidence comparison
    gzip decoded bytes match c3876179
    Coverage verdict
    Verdict verilmedi
  4. İki representation content’te karşılaştırıldı

    Dechunked content ile gunzip sonucu aynı c3876179 byte’larını verir. Ancak gzip coded content ve chunked wire notation byte-for-byte eşit değildir. Comparison, aynı text’e ulaşmayı bütün message eşitliğiyle karıştırmaz.

    Encoding record
    Chunks 2+2 / wire 19 / content 4
    Evidence comparison
    Decoded content equal / encodings differ
    Coverage verdict
    Verdict verilmedi
  5. Byte doğrulaması teslimat kanıtı sayılmadı

    Count ve content comparison bu küçük local fixture için tutarlıdır. Network transfer, TLS, streaming performansı ve browser decode gözlemi bulunmaz. Bu eksikler hatalı byte hesabı değildir; farklı evidence scope’larıdır.

    Encoding record
    Chunks 2+2 / wire 19 / content 4
    Evidence comparison
    Decoded content equal / encodings differ
    Coverage verdict
    Local bytes consistent / delivery unknown
  6. Regression doğru katmanı yeniden kontrol eder

    Bir serialization değişirse coded ve decoded byte counts yeniden hesaplanır; text’in aynı kalması eski count’u geçerli yapmaz. Kontrol bu valid bounded content’e aittir. Bütün parser input’ları veya production resource limits hakkında genelleme yapılmaz.

    Encoding record
    Chunks 2+2 / wire 19 / content 4
    Evidence comparison
    Decoded content equal / encodings differ
    Coverage verdict
    Recompute counts after serialization changes

Observation gap

  1. Selecting fields evidence için seçildi

    Reuse incelemesi eski ve yeni Accept ile Accept-Encoding değerlerini birlikte ister. Normal artifact bu alanları sağlar. Bir observation’da selecting field bulunmaması, field’ın eşleştiğinin veya farklı olduğunun kanıtı değildir.

    Encoding record
    Required: old/new Accept and Accept-Encoding
    Evidence comparison
    Comparison bekliyor
    Coverage verdict
    Verdict verilmedi
  2. Normal ve negative eşleşmeler ayrıldı

    Tam satırlarda matching values için reuse true, değişen Accept-Encoding için reuse false olur. originValidated false kalır. Bu iki normal sonuç birbirinin negative control’üdür; cache runtime’ında gerçekleşmiş event sayılmaz.

    Encoding record
    Required: old/new Accept and Accept-Encoding
    Evidence comparison
    Match→reuse true / mismatch→reuse false
    Coverage verdict
    Verdict verilmedi
  3. Positive control oracle’ın koşulunu gösterdi

    Selector’ın ayrı positiveFixtureXml kaydı selectingValuesMatch false iken cacheReuse true bildirir. XPath bu tutarsız observation’ı bir kez seçer. Bu kayıt oracle’ı sınar; gerçek cache’in yanlış kullanıcıya content verdiği iddiası değildir.

    Encoding record
    Positive fixture: mismatch / reuse=true
    Evidence comparison
    Match→reuse true / mismatch→reuse false
    Coverage verdict
    Verdict verilmedi
  4. Zero match için coverage sorgulandı

    Normal XML’de count sıfırdır; eksik observation da sıfır verebilir. Field coverage bilinmeden iki durumu eşit kabul etmek yanlış güven üretir. Review gate, karşılaştırma için gerekli alanların mevcut olup olmadığını ayrı sorar.

    Encoding record
    Positive fixture: mismatch / reuse=true
    Evidence comparison
    Zero matches / field coverage required
    Coverage verdict
    Verdict verilmedi
  5. Eksik field sonucu unknown bıraktı

    Bu alternatif review’de gerekli selecting field gözlenmemiş kabul edilir. Normal artifact’in tam satırını kopyalamak eksik observation’ı doldurmaz. Cache’in doğru çalıştığına dair verdict UNKNOWN kalır; veri eksikliği misuse kanıtı da değildir.

    Encoding record
    Positive fixture: mismatch / reuse=true
    Evidence comparison
    Zero matches / field coverage required
    Coverage verdict
    UNKNOWN: selecting-field coverage
  6. Yeni kanıt için minimum field seti belirlendi

    Cache seçiminden sorumlu bileşen, aynı target için eski ve yeni Accept/Accept-Encoding değerlerini, Vary’ı ve reuse kararını ilişkilendirmelidir. Header’ın gönderilmemesi bir selecting value olabilir; o header’ın gözlenmemesi ise kanıt boşluğudur. Yeni kayıt gelene kadar hüküm UNKNOWN kalır.

    Encoding record
    Positive fixture: mismatch / reuse=true
    Evidence comparison
    Zero matches / field coverage required
    Coverage verdict
    Needed: selecting values + decision + scope

UYGULAMA · GÜVENLİK KONTROLÜ · DOĞRULAMA

Aynı content’i katmanları çıkararak karşılaştır

Manual exercise’de gzip hex’i decoded UTF-8 hex ile ayır, Content-Length’i coded size ile eşleştir. Chunked notation’da her chunk size’ı data bytes ile eşleştir, wrapper’ı çıkarınca aynı Çay bytes’ının kaldığını göster. Text’in eşit olması bütün HTTP message’ların byte-for-byte eşit olduğu anlamına gelmez.

Gzip hex’ini bir gzip decoder ile açınca c3876179, yani Çay elde edilir. Geçerli iki chunk’ın data bytes’ı birleştirilince de aynı dört byte kalır. Decoder ve byte hesabı bu yerel dönüşümü kanıtlayabilir; HTTP receiver’ın mesajı aldığını, browser’ın gösterdiğini veya streaming performansını kanıtlamaz.

Selecting values ve missing evidence

Artifact reuse rows iki Accept-Encoding context’ini karşılaştırır: gzip isteyen eski request ile identity isteyen yeni request, Vary bu field’ı içerdiğinde aynı matching key sayılmaz. Her field için actual eski/yeni value gerekir; yokluğun kendisi de bir değerdir. Bu örnek origin revalidation yolunu false supplied alır.

XPath cacheReuse=true ama selectingValuesMatch=false gözlemini seçer. Normal rows 0, inconsistent pozitif fixture 1 verir. Missing observation da 0 verebilir; bu temiz cache davranışı ispatı değildir. Diagnostic kayıtta declared content coding, coded/decoded counts ve selection reason yeterli olabilir; sensitive content’in tamamını loglamak gerekmez.

Origin’de desteklenen representation ve content coding seçeneklerini açık tut; yalnız client tercihini okuyup üretmediğin bir formatı ilan etme. Bu target Accept ile media type, Accept-Encoding ile coding seçtiği için response Vary alanı ikisini de bildirir. Yeni request identity isterken saklanan gzip sonucunu koşulsuz reuse etmek bu seçimi kaybeder. Aynı tercihleri taşıyan normal reuse ile farklı encoding context’inde reuse yapılmayan dalı birlikte doğrula; strict406 burada seçilen ürün policy’sidir.

ŞİMDİ VAKAYA UYGULA

Gzip, chunk wrapper ve Vary hangi farklı boundary’leri kontrol eder?

Çay text’i üç code point ve dört UTF-8 byte taşır. Gzip content 24 byte, valid chunked notation 19 byte olur. /tea-label için coding tercihi değişince Vary eşleşmesi de yeniden değerlendirilir.

Vakadaki 200, media type ve parse error kayıtlarını ayrı değerlendir. Bu dersteki representation kurallarıyla usable data için henüz hangi koşulun gerektiğini açıkla.

Bağlı vaka dosyasını aç ↗

ÖRNEĞİ BİRLİKTE OKUYALIM

Çay: gzip content ve valid chunked mesaj

Bir alan seç; hangi sonucu desteklediğini ve nerede yetersiz kaldığını incele.

Ham kaydı ve alan açıklamalarını oku
{
  "target": "/tea-label",
  "gzip": {
    "decodedText": "Çay",
    "decodedCodePoints": 3,
    "decodedOctets": 4,
    "decodedHex": "c3876179",
    "codedHex": "1f8b08000000000002133bdc9e5809008f00f9f404000000",
    "codedOctets": 24,
    "fixtureCompressionLevel": 9
  },
  "chunked": {
    "chunks": [
      {
        "sizeHex": "2",
        "dataText": "Ç",
        "dataUtf8Hex": "c387",
        "dataOctets": 2
      },
      {
        "sizeHex": "2",
        "dataText": "ay",
        "dataUtf8Hex": "6179",
        "dataOctets": 2
      }
    ],
    "lastChunkSizeHex": "0",
    "trailerFields": [],
    "bodyNotation": "2\r\nÇ\r\n2\r\nay\r\n0\r\n\r\n",
    "bodyWireOctets": 19,
    "dechunkedText": "Çay",
    "dechunkedOctets": 4
  },
  "gzipResponseHead": "HTTP/1.1 200 OK\r\nDate: Thu, 08 Oct 2026 00:00:00 GMT\r\nContent-Type: text/plain; charset=utf-8\r\nContent-Encoding: gzip\r\nContent-Length: 24\r\nVary: Accept, Accept-Encoding\r\n\r\n",
  "chunkedResponseHttp11": "HTTP/1.1 200 OK\r\nDate: Thu, 08 Oct 2026 00:00:00 GMT\r\nContent-Type: text/plain; charset=utf-8\r\nTransfer-Encoding: chunked\r\nVary: Accept, Accept-Encoding\r\n\r\n2\r\nÇ\r\n2\r\nay\r\n0\r\n\r\n",
  "variants": [
    {
      "case": "normal",
      "requestHeaders": {
        "Accept": "text/plain",
        "Accept-Encoding": "gzip;q=1, identity;q=0.5"
      },
      "status": 200,
      "selectedMediaType": "text/plain; charset=utf-8",
      "contentCoding": "gzip",
      "framing": "content-length",
      "responseHeaders": {
        "Content-Type": "text/plain; charset=utf-8",
        "Content-Encoding": "gzip",
        "Content-Length": "24",
        "Vary": "Accept, Accept-Encoding"
      },
      "contentOctets": 24,
      "decodedOctets": 4,
      "browserDecodedText": "Çay"
    },
    {
      "case": "chunked-identity",
      "requestHeaders": {
        "Accept": "text/plain",
        "Accept-Encoding": "identity"
      },
      "status": 200,
      "selectedMediaType": "text/plain; charset=utf-8",
      "contentCoding": null,
      "framing": "chunked",
      "responseHeaders": {
        "Content-Type": "text/plain; charset=utf-8",
        "Transfer-Encoding": "chunked",
        "Vary": "Accept, Accept-Encoding"
      },
      "contentOctets": 4,
      "chunkedBodyWireOctets": 19,
      "decodedOctets": 4,
      "browserDecodedText": "Çay"
    },
    {
      "case": "strict406",
      "requestHeaders": {
        "Accept": "image/png",
        "Accept-Encoding": "identity"
      },
      "status": 406,
      "selectedMediaType": null,
      "contentCoding": null,
      "framing": "content-length",
      "responseHeaders": {
        "Content-Type": "text/plain; charset=utf-8",
        "Content-Length": "28",
        "Vary": "Accept, Accept-Encoding"
      },
      "contentOctets": 28,
      "decodedOctets": 28,
      "browserDecodedText": "No acceptable representation",
      "policy": "strict negotiated target selection; explanatory text is not a selected image representation"
    }
  ],
  "selectionPolicy": {
    "supportedMediaTypes": [
      "text/plain"
    ],
    "supportedContentCodings": [
      "gzip",
      "identity"
    ],
    "normalGzipChosenForDemonstration": true,
    "unmatchedMedia": "explicit strict406; other origins may choose a default response"
  },
  "cacheReuseRows": [
    {
      "oldAccept": "text/plain",
      "newAccept": "text/plain",
      "oldAcceptEncoding": "gzip;q=1, identity;q=0.5",
      "newAcceptEncoding": "gzip;q=1, identity;q=0.5",
      "selectingValuesMatch": true,
      "originValidated": false,
      "cacheReuse": true
    },
    {
      "oldAccept": "text/plain",
      "newAccept": "text/plain",
      "oldAcceptEncoding": "gzip;q=1, identity;q=0.5",
      "newAcceptEncoding": "identity",
      "selectingValuesMatch": false,
      "originValidated": false,
      "cacheReuse": false
    }
  ],
  "selector": {
    "language": "XPath",
    "xml": "<observations><reuse selectingValuesMatch=\"true\" cacheReuse=\"true\"/><reuse selectingValuesMatch=\"false\" cacheReuse=\"false\"/></observations>",
    "xpath": "count(/observations/reuse[@selectingValuesMatch=\"false\" and @cacheReuse=\"true\"])",
    "expected": 0,
    "positiveFixtureXml": "<observations><reuse selectingValuesMatch=\"false\" cacheReuse=\"true\"/></observations>",
    "positiveExpected": 1,
    "scope": "Only authored protocol-decision observations, not product log field names or a live HTTP capture.",
    "missingFieldBehavior": "Missing observation is insufficient evidence; zero matches is not proof of correct runtime behavior."
  }
}
gzip.codedOctets / decodedOctets
Native local gzip 24 byte; decoded UTF-8 4 byte; tüm HTTP message boyutu değil.
chunked.bodyWireOctets
Valid chunk wrapper dahil 19 byte; dechunked content 4 byte.
variants
Explicit server selection, media, coding ve framing kararları.
cacheReuseRows
Sadece Vary selecting-values matching; gerçek cache store değil.

Gzip native local fixture gerçekten üretildi; HTTP/TLS/Browser çalışmadı. Chunks bounded valid sentetik bytes’tır. Level ve boyutlar production tuning önermez.

İki yanlış kanı

Gzip response Content-Length’i decoded text uzunluğudur.

Aktarılan coded content octets’ını sayar: bu fixture 24 gzip byte’tan 4 UTF-8 byte’a açılır; küçük body’de compression büyütebilir.

Accept preference uyuşmazsa her server 406 döndürmek zorundadır.

Bu fixture strict policy ile 406 seçer. Genel proactive negotiation’da server uygun durumda default representation seçebilir; Vary seçim context’ini anlatır, izin vermez.

SIRA SENDE

Bu hikâyeyi sen çöz.

Sonucu tahmin et, kanıtın sınırını bul ve nedenini kendi cümlenle anlat.

Gzip content 24 byte; decoded Çay 4 byte. Content-Length hangi boyutu tanımlar?

  1. Bu response için 24 coded octet.
  2. 4 byte. Her zaman decompressed text uzunluğu kullanılır.
Gerekçeli cevabı oku

Bu response için 24 coded octet. — Response head Content-Encoding: gzip ve Content-Length: 24 taşır. Decode sonrasındaki boyut farklıdır.

sizeHex=2 olan iki chunk nasıl 4 content octet ve 19 body-wire octet üretir?

Dersten seçilen artifact alanları; öğretim örneği

chunked.chunks
[{"sizeHex":"2","dataText":"Ç","dataUtf8Hex":"c387","dataOctets":2},{"sizeHex":"2","dataText":"ay","dataUtf8Hex":"6179","dataOctets":2}]
chunked.bodyWireOctets
19
chunked.dechunkedOctets
4
  1. 19 application karakteri var; chunk size code point sayısıdır.
  2. Data toplamı 4; framing satırları wire boyutunu artırır.
Gerekçeli cevabı oku

Data toplamı 4; framing satırları wire boyutunu artırır. — Ç iki UTF-8 octet, ay iki octet’tir. Dechunking, size satırlarını ve framing ayraçlarını kaldırır.

Eski cached request gzip, yeni request identity tercih ediyor. Vary neden doğrudan reuse kararını değiştirir?

Gerekçeli cevabı oku

Response Vary: Accept, Accept-Encoding taşır. Yeni Accept-Encoding değeri stored response’un seçildiği değerle eşleşmediği için doğrudan reuse yapılmaz. Vary private veriyi public yapmaz. strict406 da bu origin’in policy’sidir; bütün origin’lerin zorunlu davranışı değildir.

□ Representation seçimi ile cache reuse kararını ilişkilendirdim.

□ Vary’dan privacy garantisi çıkarmadım.

Uygulama konsolunu aç · request / response / browser
Request, URL, cookie ve DOM örneklerini ayrıca aç

Kaynaklar ve kapsam

  • RFC 9110 — HTTP Semantics8.4 Content-Encoding · 8.6 Content-Length · 12.1 Proactive Negotiation · 12.4.2 Quality Values · 12.5.1 Accept · 12.5.3 Accept-Encoding · 12.5.5 Vary
  • RFC 9112 — HTTP/1.16.1 Transfer-Encoding · 6.2 Content-Length · 6.3 Message Body Length · 7.1 Chunked Transfer Coding
  • RFC 9113 — HTTP/28.2.2 Connection-Specific Header Fields · 4.3 Field Section Compression and Decompression · 4.3.1 Compression State
  • RFC 9114 — HTTP/34.2 HTTP Fields · 4.2.1 Field Compression
  • MDN — Content negotiationServer-driven content negotiation · The Accept header · The Vary response header