Debian Codegraph @

examples/echo_post/README.asciidoc

raw
1 = POST parameter echo example
2
3 To try this example, you need GNU `make` and `git` in your PATH.
4
5 To build and run the example, use the following command:
6
7 [source,bash]
8 $ make run
9
10 As this example echoes a POST parameter, it is a little more
11 complex to test. Some browsers feature tools that allow you
12 to perform one such request, or you can use the command line
13 tool `curl` as we will demonstrate.
14
15 == HTTP/1.1 example output
16
17 [source,bash]
18 ----
19 $ curl -i -d echo=echomeplz http://localhost:8080
20 HTTP/1.1 200 OK
21 connection: keep-alive
22 server: Cowboy
23 date: Fri, 28 Sep 2012 04:12:36 GMT
24 content-length: 9
25 content-type: text/plain; charset=utf-8
26
27 echomeplz
28 ----
29
30 == HTTP/2 example output
31
32 [source,bash]
33 ----
34 $ echo echo=echomeplz | nghttp -v -d - http://localhost:8080
35 [ 0.000] Connected
36 [ 0.000] send SETTINGS frame <length=12, flags=0x00, stream_id=0>
37 (niv=2)
38 [SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
39 [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
40 [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=3>
41 (dep_stream_id=0, weight=201, exclusive=0)
42 [ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=5>
43 (dep_stream_id=0, weight=101, exclusive=0)
44 [ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=7>
45 (dep_stream_id=0, weight=1, exclusive=0)
46 [ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=9>
47 (dep_stream_id=7, weight=1, exclusive=0)
48 [ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=11>
49 (dep_stream_id=3, weight=1, exclusive=0)
50 [ 0.001] send HEADERS frame <length=43, flags=0x24, stream_id=13>
51 ; END_HEADERS | PRIORITY
52 (padlen=0, dep_stream_id=11, weight=16, exclusive=0)
53 ; Open new stream
54 :method: POST
55 :path: /
56 :scheme: http
57 :authority: localhost:8080
58 accept: */*
59 accept-encoding: gzip, deflate
60 user-agent: nghttp2/1.7.1
61 content-length: 15
62 [ 0.001] send DATA frame <length=15, flags=0x00, stream_id=13>
63 [ 0.001] send DATA frame <length=0, flags=0x01, stream_id=13>
64 ; END_STREAM
65 [ 0.012] recv SETTINGS frame <length=0, flags=0x00, stream_id=0>
66 (niv=0)
67 [ 0.012] recv SETTINGS frame <length=0, flags=0x01, stream_id=0>
68 ; ACK
69 (niv=0)
70 [ 0.012] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
71 ; ACK
72 (niv=0)
73 [ 0.020] recv (stream_id=13) :status: 200
74 [ 0.020] recv (stream_id=13) content-length: 10
75 [ 0.020] recv (stream_id=13) content-type: text/plain; charset=utf-8
76 [ 0.020] recv (stream_id=13) date: Thu, 09 Jun 2016 09:19:35 GMT
77 [ 0.020] recv (stream_id=13) server: Cowboy
78 [ 0.020] recv HEADERS frame <length=57, flags=0x04, stream_id=13>
79 ; END_HEADERS
80 (padlen=0)
81 ; First response header
82 echomeplz
83 [ 0.020] recv DATA frame <length=10, flags=0x01, stream_id=13>
84 ; END_STREAM
85 [ 0.020] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
86 (last_stream_id=0, error_code=NO_ERROR(0x00), opaque_data(0)=[])
87 ----