README.asciidoc 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. = Compressed response example
  2. To try this example, you need GNU `make` and `git` in your PATH.
  3. To build and run the example, use the following command:
  4. [source,bash]
  5. $ make run
  6. Then point your browser to http://localhost:8080
  7. == HTTP/1.1 example output
  8. Without compression:
  9. [source,bash]
  10. ----
  11. $ curl -i http://localhost:8080
  12. HTTP/1.1 200 OK
  13. connection: keep-alive
  14. server: Cowboy
  15. date: Mon, 07 Jan 2013 18:42:29 GMT
  16. content-length: 909
  17. A cowboy is an animal herder who tends cattle on ranches in North America,
  18. traditionally on horseback, and often performs a multitude of other ranch-
  19. related tasks. The historic American cowboy of the late 19th century arose
  20. from the vaquero traditions of northern Mexico and became a figure of special
  21. significance and legend. A subtype, called a wrangler, specifically tends the
  22. horses used to work cattle. In addition to ranch work, some cowboys work for
  23. or participate in rodeos. Cowgirls, first defined as such in the late 19th
  24. century, had a less-well documented historical role, but in the modern world
  25. have established the ability to work at virtually identical tasks and obtained
  26. considerable respect for their achievements. There are also cattle handlers
  27. in many other parts of the world, particularly South America and Australia,
  28. who perform work similar to the cowboy in their respective nations.
  29. ----
  30. With compression:
  31. [source,bash]
  32. ----
  33. $ curl -i --compressed http://localhost:8080
  34. HTTP/1.1 200 OK
  35. connection: keep-alive
  36. server: Cowboy
  37. date: Mon, 07 Jan 2013 18:42:30 GMT
  38. content-encoding: gzip
  39. content-length: 510
  40. A cowboy is an animal herder who tends cattle on ranches in North America,
  41. traditionally on horseback, and often performs a multitude of other ranch-
  42. related tasks. The historic American cowboy of the late 19th century arose
  43. from the vaquero traditions of northern Mexico and became a figure of special
  44. significance and legend. A subtype, called a wrangler, specifically tends the
  45. horses used to work cattle. In addition to ranch work, some cowboys work for
  46. or participate in rodeos. Cowgirls, first defined as such in the late 19th
  47. century, had a less-well documented historical role, but in the modern world
  48. have established the ability to work at virtually identical tasks and obtained
  49. considerable respect for their achievements. There are also cattle handlers
  50. in many other parts of the world, particularly South America and Australia,
  51. who perform work similar to the cowboy in their respective nations.
  52. ----
  53. == HTTP/2 example output
  54. Without compression:
  55. [source,bash]
  56. ----
  57. $ nghttp -v -H 'accept-encoding: compress' http://localhost:8080
  58. [ 0.001] Connected
  59. [ 0.001] send SETTINGS frame <length=12, flags=0x00, stream_id=0>
  60. (niv=2)
  61. [SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
  62. [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
  63. [ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=3>
  64. (dep_stream_id=0, weight=201, exclusive=0)
  65. [ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=5>
  66. (dep_stream_id=0, weight=101, exclusive=0)
  67. [ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=7>
  68. (dep_stream_id=0, weight=1, exclusive=0)
  69. [ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=9>
  70. (dep_stream_id=7, weight=1, exclusive=0)
  71. [ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=11>
  72. (dep_stream_id=3, weight=1, exclusive=0)
  73. [ 0.002] send HEADERS frame <length=45, flags=0x25, stream_id=13>
  74. ; END_STREAM | END_HEADERS | PRIORITY
  75. (padlen=0, dep_stream_id=11, weight=16, exclusive=0)
  76. ; Open new stream
  77. :method: GET
  78. :path: /
  79. :scheme: http
  80. :authority: localhost:8080
  81. accept: */*
  82. accept-encoding: compress
  83. user-agent: nghttp2/1.18.1
  84. [ 0.002] recv SETTINGS frame <length=0, flags=0x00, stream_id=0>
  85. (niv=0)
  86. [ 0.002] recv SETTINGS frame <length=0, flags=0x01, stream_id=0>
  87. ; ACK
  88. (niv=0)
  89. [ 0.002] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
  90. ; ACK
  91. (niv=0)
  92. [ 0.003] recv (stream_id=13) :status: 200
  93. [ 0.003] recv (stream_id=13) content-length: 909
  94. [ 0.003] recv (stream_id=13) date: Sun, 22 Jan 2017 19:13:47 GMT
  95. [ 0.003] recv (stream_id=13) server: Cowboy
  96. [ 0.003] recv HEADERS frame <length=37, flags=0x04, stream_id=13>
  97. ; END_HEADERS
  98. (padlen=0)
  99. ; First response header
  100. A cowboy is an animal herder who tends cattle on ranches in North America,
  101. traditionally on horseback, and often performs a multitude of other ranch-
  102. related tasks. The historic American cowboy of the late 19th century arose
  103. from the vaquero traditions of northern Mexico and became a figure of special
  104. significance and legend. A subtype, called a wrangler, specifically tends the
  105. horses used to work cattle. In addition to ranch work, some cowboys work for
  106. or participate in rodeos. Cowgirls, first defined as such in the late 19th
  107. century, had a less-well documented historical role, but in the modern world
  108. have established the ability to work at virtually identical tasks and obtained
  109. considerable respect for their achievements. There are also cattle handlers
  110. in many other parts of the world, particularly South America and Australia,
  111. who perform work similar to the cowboy in their respective nations.
  112. [ 0.003] recv DATA frame <length=909, flags=0x01, stream_id=13>
  113. ; END_STREAM
  114. [ 0.003] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
  115. (last_stream_id=0, error_code=NO_ERROR(0x00), opaque_data(0)=[])
  116. ----
  117. With compression:
  118. [source,bash]
  119. ----
  120. $ nghttp -v http://localhost:8080
  121. [ERROR] Could not connect to the address ::1
  122. Trying next address 127.0.0.1
  123. [ 0.000] Connected
  124. [ 0.000] send SETTINGS frame <length=12, flags=0x00, stream_id=0>
  125. (niv=2)
  126. [SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
  127. [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
  128. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=3>
  129. (dep_stream_id=0, weight=201, exclusive=0)
  130. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=5>
  131. (dep_stream_id=0, weight=101, exclusive=0)
  132. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=7>
  133. (dep_stream_id=0, weight=1, exclusive=0)
  134. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=9>
  135. (dep_stream_id=7, weight=1, exclusive=0)
  136. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=11>
  137. (dep_stream_id=3, weight=1, exclusive=0)
  138. [ 0.000] send HEADERS frame <length=38, flags=0x25, stream_id=13>
  139. ; END_STREAM | END_HEADERS | PRIORITY
  140. (padlen=0, dep_stream_id=11, weight=16, exclusive=0)
  141. ; Open new stream
  142. :method: GET
  143. :path: /
  144. :scheme: http
  145. :authority: localhost:8080
  146. accept: */*
  147. accept-encoding: gzip, deflate
  148. user-agent: nghttp2/1.18.1
  149. [ 0.000] recv SETTINGS frame <length=0, flags=0x00, stream_id=0>
  150. (niv=0)
  151. [ 0.000] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
  152. ; ACK
  153. (niv=0)
  154. [ 0.000] recv SETTINGS frame <length=0, flags=0x01, stream_id=0>
  155. ; ACK
  156. (niv=0)
  157. [ 0.000] recv (stream_id=13) :status: 200
  158. [ 0.000] recv (stream_id=13) content-encoding: gzip
  159. [ 0.000] recv (stream_id=13) content-length: 510
  160. [ 0.000] recv (stream_id=13) date: Sun, 22 Jan 2017 19:15:16 GMT
  161. [ 0.000] recv (stream_id=13) server: Cowboy
  162. [ 0.000] recv HEADERS frame <length=41, flags=0x04, stream_id=13>
  163. ; END_HEADERS
  164. (padlen=0)
  165. ; First response header
  166. A cowboy is an animal herder who tends cattle on ranches in North America,
  167. traditionally on horseback, and often performs a multitude of other ranch-
  168. related tasks. The historic American cowboy of the late 19th century arose
  169. from the vaquero traditions of northern Mexico and became a figure of special
  170. significance and legend. A subtype, called a wrangler, specifically tends the
  171. horses used to work cattle. In addition to ranch work, some cowboys work for
  172. or participate in rodeos. Cowgirls, first defined as such in the late 19th
  173. century, had a less-well documented historical role, but in the modern world
  174. have established the ability to work at virtually identical tasks and obtained
  175. considerable respect for their achievements. There are also cattle handlers
  176. in many other parts of the world, particularly South America and Australia,
  177. who perform work similar to the cowboy in their respective nations.
  178. [ 0.000] recv DATA frame <length=510, flags=0x01, stream_id=13>
  179. ; END_STREAM
  180. [ 0.000] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
  181. (last_stream_id=0, error_code=NO_ERROR(0x00), opaque_data(0)=[])
  182. ----