README.asciidoc 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. = Chunked hello world 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. or use `curl` to see the chunks arriving one at a time every second.
  8. == HTTP/1.1 example output
  9. [source,bash]
  10. ----
  11. $ time curl -i http://localhost:8080
  12. HTTP/1.1 200 OK
  13. transfer-encoding: chunked
  14. connection: keep-alive
  15. server: Cowboy
  16. date: Fri, 28 Sep 2012 04:24:16 GMT
  17. Hello
  18. World
  19. Chunked!
  20. curl -i http://localhost:8080 0.01s user 0.00s system 0% cpu 2.015 total
  21. ----
  22. == HTTP/2 example output
  23. [source,bash]
  24. ----
  25. $ nghttp -v http://localhost:8080
  26. [ 0.000] Connected
  27. [ 0.000] send SETTINGS frame <length=12, flags=0x00, stream_id=0>
  28. (niv=2)
  29. [SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
  30. [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
  31. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=3>
  32. (dep_stream_id=0, weight=201, exclusive=0)
  33. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=5>
  34. (dep_stream_id=0, weight=101, exclusive=0)
  35. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=7>
  36. (dep_stream_id=0, weight=1, exclusive=0)
  37. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=9>
  38. (dep_stream_id=7, weight=1, exclusive=0)
  39. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=11>
  40. (dep_stream_id=3, weight=1, exclusive=0)
  41. [ 0.000] send HEADERS frame <length=38, flags=0x25, stream_id=13>
  42. ; END_STREAM | END_HEADERS | PRIORITY
  43. (padlen=0, dep_stream_id=11, weight=16, exclusive=0)
  44. ; Open new stream
  45. :method: GET
  46. :path: /
  47. :scheme: http
  48. :authority: localhost:8080
  49. accept: */*
  50. accept-encoding: gzip, deflate
  51. user-agent: nghttp2/1.7.1
  52. [ 0.006] recv SETTINGS frame <length=0, flags=0x00, stream_id=0>
  53. (niv=0)
  54. [ 0.006] recv SETTINGS frame <length=0, flags=0x01, stream_id=0>
  55. ; ACK
  56. (niv=0)
  57. [ 0.006] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
  58. ; ACK
  59. (niv=0)
  60. [ 0.010] recv (stream_id=13) :status: 200
  61. [ 0.010] recv (stream_id=13) date: Mon, 13 Jun 2016 14:16:26 GMT
  62. [ 0.010] recv (stream_id=13) server: Cowboy
  63. [ 0.010] recv HEADERS frame <length=32, flags=0x04, stream_id=13>
  64. ; END_HEADERS
  65. (padlen=0)
  66. ; First response header
  67. Hello
  68. [ 0.010] recv DATA frame <length=7, flags=0x00, stream_id=13>
  69. World
  70. [ 1.012] recv DATA frame <length=7, flags=0x00, stream_id=13>
  71. Chunked!
  72. [ 2.013] recv DATA frame <length=10, flags=0x00, stream_id=13>
  73. [ 2.013] recv DATA frame <length=0, flags=0x01, stream_id=13>
  74. ; END_STREAM
  75. [ 2.013] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
  76. (last_stream_id=0, error_code=NO_ERROR(0x00), opaque_data(0)=[])
  77. ----