Debian Codegraph @

examples/echo_get/README.asciidoc

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