`curl -v`는 본문을 포함한 전체 HTTP 요청을 표시합니까?

`curl -v`는 본문을 포함한 전체 HTTP 요청을 표시합니까?

user=user&password=password요청 본문에 있을 줄 알았는데 찾을 수가 없네요. 어디야? -v본문을 포함한 전체 요청을 표시하시겠습니까 ? 감사해요.

$ curl --data "user=user&password=password" -v http://google.com/
*   Trying 172.217.3.110...
* TCP_NODELAY set
* Connected to google.com (172.217.3.110) port 80 (#0)
> POST / HTTP/1.1
> Host: google.com
> User-Agent: curl/7.58.0
> Accept: */*
> Content-Length: 27
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 27 out of 27 bytes
< HTTP/1.1 405 Method Not Allowed
< Allow: GET, HEAD
< Date: Wed, 30 Jan 2019 14:01:40 GMT
< Content-Type: text/html; charset=UTF-8
< Server: gws
< Content-Length: 1589
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
< 
<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 405 (Method Not Allowed)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>405.</b> <ins>That’s an error.</ins>
  <p>The request method <code>POST</code> is inappropriate for the URL <code>/</code>.  <ins>That’s all we know.</ins>
* Connection #0 to host google.com left intact

답변1

curl옵션 설명에 -v보면

-v,--verbose

작동 중에 컬링을 장황하게 만듭니다. 디버깅하고 "뒤에서" 무슨 일이 일어나고 있는지 확인하는 데 유용합니다. ">"로 시작하는 줄은 컬이 보낸 "헤더 데이터"를 나타내고, "<"는 컬이 받은 "헤더 데이터"를 나타내며, 이는 일반적인 상황에서는 숨겨지며, "*"로 시작하는 줄은 제공된 "헤더 데이터"를 나타냅니다. 컬 추가 정보.

출력에 HTTP 헤더만 포함하려는 경우 -i찾고 --include 있는 옵션이 될 수 있습니다.

이 옵션이 여전히 충분한 세부 정보를 제공하지 못한다고 생각되면 대신 --trace또는 사용을 고려해 보세요 --trace-ascii.

따라서 -v헤더가 표시되며(어쨌든 표시되는 응답 본문 외에 ) 본문을 확인 curl해야 합니다 .--trace

curl --data "user=user&password=password" --trace google.log http://google.com/

자세한 로그가 출력됩니다 google.log.

답변2

컬에 다음 매개변수를 추가해야 한다고 생각합니다.

--trace-ascii -

전체 CURL 요청은 다음과 같습니다.

curl 'https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=fgfgkg' -H 'Content-Type: application/json' --data-binary '{"token":"[CUSTOM_TOKEN]","returnSecureToken":true}' --trace-ascii -

SSL 핸드셰이크 후에는 CURL에 의해 위조된 요청의 모든 HTTP 헤더와 HTTP 본문이 반환됩니다.

따라서 POST 요청 본문에서 실제로 전송된 내용을 확인할 수 있습니다. 아래 예제 하단에서 요청의 HTTP 본문으로 전송된 JSON 개체를 볼 수 있습니다. 일반적으로 일반 컬 명령을 실행한 후에는 나타나지 않습니다.

0000: {"token":"[CUSTOM_TOKEN]","returnSecureToken":true}

"-"는 파일 대신 화면에 인쇄하는 데 도움이 됩니다. 다음 예는 정리되었습니다. 더 짧게 만들기 위해 전체 응답을 붙여넣지 않습니다.

    jojo@royan:~$ curl 'https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=fgfgkg' -H 'Content-Type: application/json' --data-binary '{"token":"[CUSTOM_TOKEN]","returnSecureToken":true}' --trace-ascii -
== Info:   Trying 142.250.178.170:443...
== Info: Connected to identitytoolkit.googleapis.com (142.250.178.170) port 443 (#0)
== Info: ALPN, offering h2
== Info: ALPN, offering http/1.1
== Info: successfully set certificate verify locations:
== Info:  CAfile: /etc/ssl/certs/ca-certificates.crt
== Info:  CApath: /etc/ssl/certs
=> Send SSL data, 5 bytes (0x5)
0000: .....
== Info: TLSv1.3 (OUT), TLS handshake, Client hello (1):
=> Send SSL data, 512 bytes (0x200)
0000: .......`7.=..F pJ}.`..<:.YD...\.1_v... .q.q2;c..nt...'T1}.A.P.+.
0040: Px..T...>.......,.0.........+./...$.(.k.#.'.g.....9.....3.....=.
0080: <.5./.....u...#.!...identitytoolkit.googleapis.com..............
00c0: ..........3t.........h2.http/1.1.........1.....*.(..............
0100: ...........................+........-.....3.&.$... .j....C7AO...
0140: .I....G...:....J^?R.............................................
0180: ................................................................
01c0: ................................................................
<= Recv SSL data, 5 bytes (0x5)
0000: ....z
== Info: TLSv1.3 (IN), TLS handshake, Server hello (2):
<= Recv SSL data, 122 bytes (0x7a)
0000: ...v.....H........x.g3..$.mE.3%m...... .q.q2;c..nt...'T1}.A.P.+.
0040: Px..T........3.$... ..n4X.......1....J......1r,.5n}\.+....
<= Recv SSL data, 5 bytes (0x5)
0000: .....
<= Recv SSL data, 5 bytes (0x5)
0000: .....
<= Recv SSL data, 1 bytes (0x1)
0000: .
== Info: TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
<= Recv SSL data, 15 bytes (0xf)
0000: .............h2
== Info: TLSv1.3 (IN), TLS handshake, Certificate (11):
<= Recv SSL data, 4396 bytes (0x112c)
0000: ...(...$...0...0............i...f........6V0...*.H........0F1.0.
0040: ..U....US1"0 ..U....Google Trust Services LLC1.0...U....GTS CA 1
0080: C30...211018095256Z..220110095255Z0"1 0...U....upload.video.goog
00c0: le.com0Y0...*.H.=....*.H.=....B...D.1.U.aJ......z.{C.,f....:R*..
0100: .*.R..*........+.sq....`......y......0...0...U...........0...U.%
0140: ..0...+.......0...U.......0.0...U.......a..sP...q..3/_.8...0...U
0180: .#..0....t......=...F..q5.'0j..+........^0\0'..+.....0...http:/
01c0: /ocsp.pki.goog/gts1c301..+.....0..%http://pki.goog/repo/certs/gt
0200: s1c3.der0.....U......0.....upload.video.google.com..*.clients.go
0240: ogle.com..*.docs.google.com..*.drive.google.com..*.gdata.youtube
0280: .com..*.googleapis.com..*.photos.google.com..*.youtube-3rd-party
02c0: .com..upload.google.com..*.upload.google.com..upload.youtube.com
0300: ..*.upload.youtube.com..uploads.stage.gdata.youtube.com..bg-call
0340: -donation.goog..bg-call-donation-alpha.goog..bg-call-donation-ca
0380: nary.goog..bg-call-donation-dev.goog0!..U. ..0.0...g.....0...+..
03c0: ...y...0<..U...50301./.-.+http://crls.pki.goog/gts1c3/QqFxbi9M48
0400: c.crl0.....+.....y............v.F.U.u.. 0...i..}.,At..I.....p.mG
0440: ...|..{......G0E. Qd..V.3QE...O...^.Z.h3OW...q.MAp.!....T..iY>..
0480: ...$.Q.3...n .....Ptv.u.A...."FJ...:.B.^N1.....K.h..b......|..|.
04c0: .....F0D. |.....ye..t..M..t..F.L<......... R&..M...9Y.8It..s..J
0500: ...#[-.....r0...*.H...............-.....*...?..dh ...7/;ZP..x...
0540: .-........T.O...j.d.AL.:.Cj........Q9..n.Pr9..3.....5O......C..7
0580: S.......7.yI{.lS..T..DC..q?..j~R...g3..+e!.......x......b...t.)
05c0: ... x.+a.....<+..e-...!..?e$...Y...^u.x9A......~0.....n......|.3
0600: Kh....M...I....2...............h.....0...0..~..........SYk4....P
0640: f0...*.H........0G1.0...U....US1"0 ..U....Google Trust Services
0680: LLC1.0...U....GTS Root R10...200813000042Z..270930000042Z0F1.0..
06c0: .U....US1"0 ..U....Google Trust Services LLC1.0...U....GTS CA 1C
0700: 30.."0...*.H.............0............b..7.7B.l...e.%...k..m.Z#
0740: .........|....B.^V$.z3....i..t.WLfh.w7US.9.M.4._%w7;...<......C.
0780: ..G..D.c..A..A0H......E.!..B...+eV4.&....}....H|7M?.....u..yW\.W
07c0: n.........%..,...*....c.<PI...._.+Y.....Q..w....O.pI.\m .......
0800: w.-...k....+........'....Q.................0..|0...U...........0
0840: ...U.%..0...+.........+.......0...U.......0.......0...U.......t
0880: ......=...F..q5.'0...U.#..0.....+&q.+H'./Rf,....q>0h..+........\
08c0: 0Z0&..+.....0...http://ocsp.pki.goog/gtsr100..+.....0..$http://p
0900: ki.goog/repo/certs/gtsr1.der04..U...-0+0).'.%.#http://crl.pki.go
0940: og/gtsr1/gtsr1.crl0W..U. .P0N08..+.....y...0*0(..+.........https
0980: ://pki.goog/repository/0...g.....0...g.....0...*.H..............
09c0: }. \.<[email protected]...$..Pq"...n..jo......_.l.......
0a00: b....[.f.........i>z.FI_F.A...Me4...?O.lI..SA..!.....D[*P..M.S6
0a40: .B..T..wS.d8'...X..|9-[..........S$....y.&.a.SR.B..f+?..........
0a80: .q.5($.....-.H.=Y.Q.t..|...[..4..........."....q....s$.7S...?..\
0ac0: .6..;.)...:b;lc...Yq.c'.L....s..*....l2.3...Qq.4...].QX......Y.q
0b00: ..M(..m......F...k.w.....#.........D..u#.4.. ..^...RF.....!pQ...
0b40: ..U.+.3w.KB..w..s.....7?..*f.s.2.2l2....#.[}Mep.+.=...m.2.....c.
0b80: ..]...q^*..."..e:...e.....[.Y.G.-.$:...&....7..o....Q......Q...
0bc0: ...f0..b0..J.......w..l.6...!...X..0...*.H........0W1.0...U....B
0c00: E1.0...U....GlobalSign nv-sa1.0...U....Root CA1.0...U....GlobalS
0c40: ign Root CA0...200619000042Z..280128000042Z0G1.0...U....US1"0 ..
0c80: U....Google Trust Services LLC1.0...U....GTS Root R10.."0...*.H.
0cc0: ............0...............w.;...>...@<....}2..q.......j.....K
0d00: .+...................^..R..#'....c...~..^.h...ZG.M.3.N.....lK...
0d40: ...d)%#....=.`.......H.M..z.....Y........1.......ml....~&.E.=.y.
0d80: .(..&......<h.S..:.+.....z..u....Vd..Oh.=......@..\....5l..P..
0dc0: L... .3.R..2.).%*.H.r..d...........8f..c...x.{\w.v......y.W..&..
0e00: ............U.....K)...2%N*.eD.....I...|..@{.C..l..}...L......K.
0e40: ....E.v..@+.S....;......1..w.o{>...".....2..c.Qr.]....)h3.:f...&
0e80: ...Wex'.^I......!............lH<@.~.Z.V<.....K.9K..?.U.n$..q...
0ec0: .......A...=:..z.7...........80..40...U...........0...U.......0.
0f00: ...0...U........+&q.+H'./Rf,....q>0...U.#..0...`{f.E....P/}..4..
0f40: ..K0`..+........T0R0%..+.....0...http://ocsp.pki.goog/gsr10)..+.
0f80: ....0...http://pki.goog/gsr1/gsr1.crt02..U...+0)0'.%.#.!http://c
0fc0: rl.pki.goog/gsr1/gsr1.crl0;..U. .4020...g.....0...g.....0...+...
1000: ..y....0...+.....y....0...*.H.............4...(...v..1z!..R>..t.
1040: A..=5......\_...|......W.&o[..Fh.7okz...7.%Q..h...I.Z...#...+...
1080: ..Ij.u.......XHW.5.....o..o.......*..Ni..-.h..+s....".7..f.I..U.
10c0: g.2..&.p.=.gm=|.4..2..n.jo.....K.;..7..D.~.l..F.....!.f...Ul.)..
1100: .f[.wIH(....3rS..5.b..$...9..~*A.R.......?..
== Info: TLSv1.3 (IN), TLS handshake, CERT verify (15):
<= Recv SSL data, 79 bytes (0x4f)
0000: ...K...G0E.!........IIE.[......j .......2q.... {F=.0...........)
0040: ..n(.x.......&.
== Info: TLSv1.3 (IN), TLS handshake, Finished (20):
<= Recv SSL data, 52 bytes (0x34)
0000: ...0...Z.....n.Z;...Q.PZ}%-N.Kn.....X....Wt....L...
=> Send SSL data, 5 bytes (0x5)
0000: .....
== Info: TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
=> Send SSL data, 1 bytes (0x1)
0000: .
=> Send SSL data, 5 bytes (0x5)
0000: ....E
=> Send SSL data, 1 bytes (0x1)
0000: .
== Info: TLSv1.3 (OUT), TLS handshake, Finished (20):
=> Send SSL data, 52 bytes (0x34)
0000: ...0Io#r...a......i6....d'..K.Br=.....B.k.B.......@.
== Info: SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
== Info: ALPN, server accepted to use h2
== Info: Server certificate:
== Info:  subject: CN=upload.video.google.com
== Info:  start date: Oct 18 09:52:56 2021 GMT
== Info:  expire date: Jan 10 09:52:55 2022 GMT
== Info:  subjectAltName: host "identitytoolkit.googleapis.com" matched cert's "*.googleapis.com"
== Info:  issuer: C=US; O=Google Trust Services LLC; CN=GTS CA 1C3
== Info:  SSL certificate verify ok.
== Info: Using HTTP2, server supports multi-use
== Info: Connection state changed (HTTP/2 confirmed)
== Info: Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
=> Send SSL data, 5 bytes (0x5)
0000: ....)
=> Send SSL data, 1 bytes (0x1)
0000: .
=> Send SSL data, 5 bytes (0x5)
0000: ....,
=> Send SSL data, 1 bytes (0x1)
0000: .
=> Send SSL data, 5 bytes (0x5)
0000: .....
=> Send SSL data, 1 bytes (0x1)
0000: .
== Info: Using Stream ID: 1 (easy handle 0x7fffd59e9560)
=> Send SSL data, 5 bytes (0x5)
0000: ....x
=> Send SSL data, 1 bytes (0x1)
0000: .
=> Send header, 189 bytes (0xbd)
0000: POST /v1/accounts:signInWithCustomToken?key=fgfgkg HTTP/2
003b: Host: identitytoolkit.googleapis.com
0061: user-agent: curl/7.74.0
007a: accept: */*
0087: content-type: application/json
00a7: content-length: 51
00bb:
=> Send SSL data, 5 bytes (0x5)
0000: ....M
=> Send SSL data, 1 bytes (0x1)
0000: .
=> Send data, 51 bytes (0x33)
0000: {"token":"[CUSTOM_TOKEN]","returnSecureToken":true}
== Info: We are completely uploaded and fine

관련 정보