HTTP compression: Difference between revisions

Content deleted Content added
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags
Line 10:
 
1. The [[web client]] advertises which compression schemes it supports by including a list of tokens in the [[HTTP request]]. For ''Content-Encoding'', the list in a field called ''Accept-Encoding''; for ''Transfer-Encoding'', the field is called ''TE''.
<sourcesyntaxhighlight lang="http" highlight=3>
GET /encrypted-area HTTP/1.1
Host: www.example.com
Accept-Encoding: gzip, deflate
</syntaxhighlight>
</source>
2. If the server supports one or more compression schemes, the outgoing data may be compressed by one or more methods supported by both parties. If this is the case, the server will add a ''Content-Encoding'' or ''Transfer-Encoding'' field in the HTTP response with the used schemes, separated by commas.
 
<sourcesyntaxhighlight lang="http" highlight=9>
HTTP/1.1 200 OK
Date: mon, 26 June 2016 22:38:34 GMT
Line 27:
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
</syntaxhighlight>
</source>
 
The [[web server]] is by no means obligated to use any compression method&nbsp;– this depends on the internal settings of the web server and also may depend on the internal architecture of the website in question.