README.asciidoc 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. = 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. == HTTP/1.1 example output
  8. [source,bash]
  9. ----
  10. $ curl -i http://localhost:8080
  11. HTTP/1.1 200 OK
  12. connection: keep-alive
  13. server: Cowboy
  14. date: Fri, 28 Sep 2012 04:10:25 GMT
  15. content-length: 12
  16. content-type: text/plain
  17. Hello world!
  18. ----
  19. == HTTP/2 example output
  20. [source,bash]
  21. ----
  22. $ nghttp -v http://localhost:8080
  23. [ 0.000] Connected
  24. [ 0.000] send SETTINGS frame <length=12, flags=0x00, stream_id=0>
  25. (niv=2)
  26. [SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
  27. [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
  28. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=3>
  29. (dep_stream_id=0, weight=201, exclusive=0)
  30. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=5>
  31. (dep_stream_id=0, weight=101, exclusive=0)
  32. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=7>
  33. (dep_stream_id=0, weight=1, exclusive=0)
  34. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=9>
  35. (dep_stream_id=7, weight=1, exclusive=0)
  36. [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=11>
  37. (dep_stream_id=3, weight=1, exclusive=0)
  38. [ 0.000] send HEADERS frame <length=38, flags=0x25, stream_id=13>
  39. ; END_STREAM | END_HEADERS | PRIORITY
  40. (padlen=0, dep_stream_id=11, weight=16, exclusive=0)
  41. ; Open new stream
  42. :method: GET
  43. :path: /
  44. :scheme: http
  45. :authority: localhost:8080
  46. accept: */*
  47. accept-encoding: gzip, deflate
  48. user-agent: nghttp2/1.7.1
  49. [ 0.008] recv SETTINGS frame <length=0, flags=0x00, stream_id=0>
  50. (niv=0)
  51. [ 0.008] recv SETTINGS frame <length=0, flags=0x01, stream_id=0>
  52. ; ACK
  53. (niv=0)
  54. [ 0.008] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
  55. ; ACK
  56. (niv=0)
  57. [ 0.013] recv (stream_id=13) :status: 200
  58. [ 0.013] recv (stream_id=13) content-length: 12
  59. [ 0.013] recv (stream_id=13) content-type: text/plain
  60. [ 0.013] recv (stream_id=13) date: Thu, 09 Jun 2016 08:56:56 GMT
  61. [ 0.013] recv (stream_id=13) server: Cowboy
  62. [ 0.013] recv HEADERS frame <length=46, flags=0x04, stream_id=13>
  63. ; END_HEADERS
  64. (padlen=0)
  65. ; First response header
  66. Hello world![ 0.013] recv DATA frame <length=12, flags=0x01, stream_id=13>
  67. ; END_STREAM
  68. [ 0.013] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
  69. (last_stream_id=0, error_code=NO_ERROR(0x00), opaque_data(0)=[])
  70. ----