Skip to content

Instantly share code, notes, and snippets.

@knknkn1162
Created August 31, 2022 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knknkn1162/92c7e52996956a9a9d94e63c36e018bb to your computer and use it in GitHub Desktop.
Save knknkn1162/92c7e52996956a9a9d94e63c36e018bb to your computer and use it in GitHub Desktop.
$ curl -v http://localhost:8080
* Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.79.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
* no chunk, no close, no size. Assume close to signal end
<
sample
* Closing connection 0
knknkn-2:~ knknkn$ curl --trace /dev/stdout http://localhost:8080
== Info: Trying 127.0.0.1:8080...
== Info: Connected to localhost (127.0.0.1) port 8080 (#0)
=> Send header, 78 bytes (0x4e)
0000: 47 45 54 20 2f 20 48 54 54 50 2f 31 2e 31 0d 0a GET / HTTP/1.1..
0010: 48 6f 73 74 3a 20 6c 6f 63 61 6c 68 6f 73 74 3a Host: localhost:
0020: 38 30 38 30 0d 0a 55 73 65 72 2d 41 67 65 6e 74 8080..User-Agent
0030: 3a 20 63 75 72 6c 2f 37 2e 37 39 2e 31 0d 0a 41 : curl/7.79.1..A
0040: 63 63 65 70 74 3a 20 2a 2f 2a 0d 0a 0d 0a ccept: */*....
== Info: Mark bundle as not supporting multiuse
<= Recv header, 17 bytes (0x11)
0000: 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d HTTP/1.1 200 OK.
0010: 0a .
== Info: no chunk, no close, no size. Assume close to signal end
<= Recv header, 2 bytes (0x2)
0000: 0d 0a ..
<= Recv data, 8 bytes (0x8)
0000: 73 61 6d 70 6c 65 0d 0a sample..
sample
== Info: Closing connection 0
$ docker run -p 8080:8080 knknkn1162/netcat /bin/bash -c 'echo -en "HTTP/1.1 200 OK\r\n\r\nsample\r\n" | nc -lv -q0 8080'
Listening on 0.0.0.0 8080
GET / HTTP/1.1
Host: localhost:8080
User-Agent: curl/7.79.1
Accept: */*
Connection received on 172.17.0.1 56828
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment