README.asciidoc 2.8 KB

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