This is a migrated thread and some comments may be shown as answers.

intercpet curl command to get body request

1 Answer 1430 Views
Windows
This is a migrated thread and some comments may be shown as answers.
fabrizio
Top achievements
Rank 1
fabrizio asked on 31 Aug 2018, 01:17 PM

windows 10 connected to the internet through wifi, no proxy. I need to read a curl request to rewrite in c# code.

using curl 7.61.0 and fiddler 5.

this command just works fine:

  curl -X POST -u "73b63264-b68c-4591-af76-96f325969d0b":"X7bECApaBi0o" -F "file=@c:\temp\1.json" https://gateway-fra.watsonplatform.net/discovery/api/v1/environments/e40e7c0d-25de-4ae5-a079-90877a745de0/collections/029a29d3-2ed1-4cf3-be81-b78e35d5ce0f/documents?version=2017-11-07

with fiddler running the command above works fine too ma no traced into fiddler.

this command is traced into fiddler but fails to execute:

curl --proxy http://127.0.0.1:8888 -X POST -u "73b63264-b68c-4591-af76-96f325969d0b":"X7bECApaBi0o" -F "file=@c:\temp\1.json" https://gateway-fra.watsonplatform.net/discovery/api/v1/environments/e40e7c0d-25de-4ae5-a079-90877a745de0/collections/029a29d3-2ed1-4cf3-be81-b78e35d5ce0f/documents?version=2017-11-07

this the error "curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above"

 

Inspecting the requerst in fiddler , this the raw data of request, but i need to extract the body of request. How do i do?

Thanks.

 

CONNECT gateway-fra.watsonplatform.net:443 HTTP/1.1
Host: gateway-fra.watsonplatform.net:443
User-Agent: curl/7.61.0
Connection: Keep-Alive

A SSLv3-compatible ClientHello handshake was found. Fiddler extracted the parameters below.

Version: 3.3 (TLS/1.2)
Random: 14 67 89 3B 5E 0D 45 EF 2B 75 A0 39 5D C0 B0 BB EB 78 1E 49 BC F1 64 5C ED F6 19 BF 37 79 80 07
"Time": 26/08/2001 23:16:04
SessionID: empty
Extensions:
    server_name    gateway-fra.watsonplatform.net
    ec_point_formats    uncompressed [0x0], ansiX962_compressed_prime [0x1], ansiX962_compressed_char2  [0x2]
    elliptic_curves    unknown [0x1D), secp256r1 [0x17], secp521r1 [0x19], secp384r1 [0x18]
    NextProtocolNego    empty
    ALPN        h2, http/1.1
    encrypt_then_mac (RFC7366)    empty
    extended_master_secret    empty
    signature_algs    sha512_rsa, sha512_dsa, sha512_ecdsa, sha384_rsa, sha384_dsa, sha384_ecdsa, sha256_rsa, sha256_dsa, sha256_ecdsa, sha224_rsa, sha224_dsa, sha224_ecdsa, sha1_rsa, sha1_dsa, sha1_ecdsa
Ciphers:
    [C02C]    TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
    [C030]    TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
    [009F]    TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
    [CCA9]    TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
    [CCA8]    TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
    [CCAA]    TLS_DHE_RSA_WITH_CHACHA20_POLY1305
    [C02B]    TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
    [C02F]    TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
    [009E]    TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
    [C024]    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
    [C028]    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
    [006B]    TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
    [C023]    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
    [C027]    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
    [0067]    TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
    [C00A]    TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
    [C014]    TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA
    [0039]    TLS_DHE_RSA_WITH_AES_256_SHA
    [C009]    TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
    [C013]    TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA
    [0033]    TLS_DHE_RSA_WITH_AES_128_SHA
    [009D]    TLS_RSA_WITH_AES_256_GCM_SHA384
    [009C]    TLS_RSA_WITH_AES_128_GCM_SHA256
    [003D]    TLS_RSA_WITH_AES_256_CBC_SHA256
    [003C]    TLS_RSA_WITH_AES_128_CBC_SHA256
    [0035]    TLS_RSA_AES_256_SHA
    [002F]    TLS_RSA_AES_128_SHA
    [00FF]    TLS_EMPTY_RENEGOTIATION_INFO_SCSV

Compression:
    [00]    NO_COMPRESSION


 

 

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 04 Sep 2018, 01:48 PM
Hello,

It seems that curl does not trust Fiddler's root certificate as a certificate authority. You should get Fiddler's certificate (Tools -> Options -> HTTPS -> Actions -> Export Root Certificate to Desktop) and add it to curl's trusted CA certificate store.

Regards,
Alexander
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Windows
Asked by
fabrizio
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or