AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / unix / Perguntas / 497706
Accepted
Tim
Tim
Asked: 2019-01-31 06:04:57 +0800 CST2019-01-31 06:04:57 +0800 CST 2019-01-31 06:04:57 +0800 CST

O `curl -v` mostra a solicitação HTTP completa, incluindo o corpo?

  • 772

Achei user=user&password=passwordque estaria no corpo do pedido, mas não consigo encontrá-lo. Cadê? Mostra -vo pedido completo incluindo o corpo? Obrigado.

$ 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
curl
  • 2 2 respostas
  • 55142 Views

2 respostas

  • Voted
  1. Best Answer
    Stephen Kitt
    2019-01-31T06:12:44+08:002019-01-31T06:12:44+08:00

    A descrição da curlopção de -vdiz

    -v,--verbose

    Torna o curl verboso durante a operação. Útil para depurar e ver o que está acontecendo "sob o capô". Uma linha começando com '>' significa "dados de cabeçalho" enviados por curl, '<' significa "dados de cabeçalho" recebidos por curl que estão ocultos em casos normais e uma linha começando com '*' significa informações adicionais fornecidas por curl.

    Se você deseja apenas cabeçalhos HTTP na saída, -i, --include pode ser a opção que você está procurando.

    Se você acha que essa opção ainda não fornece detalhes suficientes, considere usar --traceou --trace-asciiem vez disso.

    Então -vmostra os cabeçalhos (além do corpo da resposta, que curlaparece de qualquer maneira), e você precisa --tracever os corpos:

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

    produzirá logs detalhados em google.log.

    • 32
  2. Nicolas Guérinet
    2021-11-16T04:47:33+08:002021-11-16T04:47:33+08:00

    Eu acho que você deve adicionar o seguinte parâmetro para curl:

    --trace-ascii -
    

    Isso retornará os cabeçalhos HTTP da solicitação e o corpo HTTP da solicitação que foi forjada pelo curl.

    Assim, você pode ver o que realmente é enviado no corpo de uma solicitação POST. Na parte inferior do exemplo abaixo, você pode ver o objeto JSON que foi enviado no corpo HTTP da solicitação. Normalmente, ele não aparece após a execução de um comando curl regular.

    o "-" ajuda a imprimir na tela em vez de um arquivo. Você também verá os dados relacionados ao handshake SSL. Pode parecer dados desnecessários, mas é útil verificar se está tudo bem. O exemplo a seguir foi aparado. Eu não colei a resposta para torná-la mais curta.

        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
    
    • 8

relate perguntas

  • Não baixe o arquivo com curl se o arquivo já existir localmente

  • Como enrolar e descompactar para um determinado diretório? [duplicado]

  • Verificando um redirecionamento de URL do terminal

  • Obtendo o endereço URL do arquivo e verificando o código HTTP

  • Como baixar um arquivo no terminal cujo link redireciona e parece funcionar apenas na GUI?

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Possível firmware ausente /lib/firmware/i915/* para o módulo i915

    • 3 respostas
  • Marko Smith

    Falha ao buscar o repositório de backports jessie

    • 4 respostas
  • Marko Smith

    Como exportar uma chave privada GPG e uma chave pública para um arquivo

    • 4 respostas
  • Marko Smith

    Como podemos executar um comando armazenado em uma variável?

    • 5 respostas
  • Marko Smith

    Como configurar o systemd-resolved e o systemd-networkd para usar o servidor DNS local para resolver domínios locais e o servidor DNS remoto para domínios remotos?

    • 3 respostas
  • Marko Smith

    apt-get update error no Kali Linux após a atualização do dist [duplicado]

    • 2 respostas
  • Marko Smith

    Como ver as últimas linhas x do log de serviço systemctl

    • 5 respostas
  • Marko Smith

    Nano - pule para o final do arquivo

    • 8 respostas
  • Marko Smith

    erro grub: você precisa carregar o kernel primeiro

    • 4 respostas
  • Marko Smith

    Como baixar o pacote não instalá-lo com o comando apt-get?

    • 7 respostas
  • Martin Hope
    user12345 Falha ao buscar o repositório de backports jessie 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl Por que a maioria dos exemplos do systemd contém WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky Como exportar uma chave privada GPG e uma chave pública para um arquivo 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll status systemctl mostra: "Estado: degradado" 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim Como podemos executar um comando armazenado em uma variável? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S Por que /dev/null é um arquivo? Por que sua função não é implementada como um programa simples? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 Como ver as últimas linhas x do log de serviço systemctl 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - pule para o final do arquivo 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla Por que verdadeiro e falso são tão grandes? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis Substitua a string em um arquivo de texto enorme (70 GB), uma linha 2017-12-30 06:58:33 +0800 CST

Hot tag

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve