V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
sgq1128
V2EX  ›  问与答

curl 一样的请求返回的数据却不一样

  •  
  •   sgq1128 · 2018-11-29 10:34:35 +08:00 · 1721 次点击
    这是一个创建于 2186 天前的主题,其中的信息可能已经有所发展或是发生改变。

    本地的 curl

    curl 7.54.0 (x86_64-apple-darwin17.0) libcurl/7.54.0 LibreSSL/2.0.20 zlib/1.2.11 nghttp2/1.24.0
    Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
    Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy
    

    服务器上的 curl

    curl 7.62.0 (x86_64-redhat-linux-gnu) libcurl/7.62.0 OpenSSL/1.0.1e zlib/1.2.3 c-ares/1.15.0 libssh2/1.8.0 nghttp2/1.6.0
    Release-Date: 2018-10-31
    Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
    Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy Metalink 
    

    本地 curl 高德搜索 POI ( key 这里就不放出来了,引号里的内容百分百一致) 命令行

    curl -v 'https://restapi.amap.com/v3/place/text?keywords=宋都如意春江&city=hangzhou&output=JSON&offset=1&page=1&key=高德秘钥&extensions=all'
    

    本地返回

    *   Trying 106.11.249.5...
    * TCP_NODELAY set
    * Connected to restapi.amap.com (106.11.249.5) port 443 (#0)
    * ALPN, offering h2
    * ALPN, offering http/1.1
    * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
    * successfully set certificate verify locations:
    *   CAfile: /etc/ssl/cert.pem
      CApath: none
    * TLSv1.2 (OUT), TLS handshake, Client hello (1):
    * TLSv1.2 (IN), TLS handshake, Server hello (2):
    * TLSv1.2 (IN), TLS handshake, Certificate (11):
    * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
    * TLSv1.2 (IN), TLS handshake, Server finished (14):
    * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
    * TLSv1.2 (OUT), TLS change cipher, Client hello (1):
    * TLSv1.2 (OUT), TLS handshake, Finished (20):
    * TLSv1.2 (IN), TLS change cipher, Client hello (1):
    * TLSv1.2 (IN), TLS handshake, Finished (20):
    * SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
    * ALPN, server accepted to use http/1.1
    * Server certificate:
    *  subject: C=CN; ST=ZheJiang; L=HangZhou; O=Alibaba (China) Technology Co., Ltd.; CN=*.amap.com
    *  start date: Jul 16 02:51:07 2018 GMT
    *  expire date: Jul 17 02:51:07 2019 GMT
    *  subjectAltName: host "restapi.amap.com" matched cert's "*.amap.com"
    *  issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign Organization Validation CA - SHA256 - G2
    *  SSL certificate verify ok.
    > GET /v3/place/text?keywords=宋都如意春江&city=hangzhou&output=JSON&offset=1&page=1&key=&extensions=all HTTP/1.1
    > Host: restapi.amap.com
    > User-Agent: curl/7.54.0
    > Accept: */*
    > 
    < HTTP/1.1 200 OK
    < Server: Tengine
    < Date: Thu, 29 Nov 2018 02:29:00 GMT
    < Content-Type: application/json;charset=UTF-8
    < Content-Length: 940
    < Connection: close
    < Vary: Accept-Encoding
    < X-Powered-By: ring/1.0.0
    < gsid: c7e2cc15077776ba592e1dff2a384c5a
    < sc: 0.099
    < Access-Control-Allow-Origin: *
    < Access-Control-Allow-Methods: *
    < Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,key,x-biz,x-info,platinfo,encr,enginever,gzipped,poiid
    < 
    * Closing connection 0
    * TLSv1.2 (OUT), TLS alert, Client hello (1):
    {"status":"1","count":"2","info":"OK","infocode":"10000","suggestion":{"keywords":[],"cities":[]},"pois":[{"id":"B0FFJ0DVH0","parent":[],"name":"宋都·如意春江(建设中)","tag":[],"type":"商务住宅;商务住宅相关;商务住宅相关","typecode":"120000","biz_type":[],"address":"江滨东大道","location":"120.032125,30.081818","tel":"0571-63129999","postcode":[],"website":[],"email":[],"pcode":"330000","pname":"浙江省","citycode":"0571","cityname":"杭州市","adcode":"330111","adname":"富阳区","importance":[],"shopid":[],"shopinfo":"0","poiweight":[],"gridcode":"4520009221","distance":[],"navi_poiid":[],"entr_location":[],"business_area":"东洲","exit_location":[],"match":"0","recommend":"3","timestamp":[],"alias":[],"indoor_map":"0","indoor_data":{"cpid":[],"floor":[],"truefloor":[],"cmsid":[]},"groupbuy_num":"0","discount_num":"0","biz_ext":{"rating":[],"cost":[]},"event":[],"children":[],"photos":[]}]}
    

    服务器上返回

    *   Trying 106.11.6.22...
    * TCP_NODELAY set
    * Connected to restapi.amap.com (106.11.6.22) port 443 (#0)
    * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
    * successfully set certificate verify locations:
    *   CAfile: /etc/pki/tls/certs/ca-bundle.crt
      CApath: none
    * TLSv1.2 (OUT), TLS handshake, Client hello (1):
    * TLSv1.2 (IN), TLS handshake, Server hello (2):
    * NPN, negotiated HTTP1.1
    * TLSv1.2 (IN), TLS handshake, Certificate (11):
    * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
    * TLSv1.2 (IN), TLS handshake, Server finished (14):
    * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
    * TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
    * TLSv1.2 (OUT), TLS handshake, Next protocol (67):
    * TLSv1.2 (OUT), TLS handshake, Finished (20):
    * TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
    * TLSv1.2 (IN), TLS handshake, Finished (20):
    * SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
    * Server certificate:
    *  subject: C=CN; ST=ZheJiang; L=HangZhou; O=Alibaba (China) Technology Co., Ltd.; CN=*.amap.com
    *  start date: Jul 16 02:51:07 2018 GMT
    *  expire date: Jul 17 02:51:07 2019 GMT
    *  subjectAltName: host "restapi.amap.com" matched cert's "*.amap.com"
    *  issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign Organization Validation CA - SHA256 - G2
    *  SSL certificate verify ok.
    > GET /v3/place/text?keywords=宋都如意春江&city=hangzhou&output=JSON&offset=1&page=1&key=&extensions=all HTTP/1.1
    > Host: restapi.amap.com
    > User-Agent: curl/7.62.0
    > Accept: */*
    > 
    < HTTP/1.1 200 OK
    < Server: Tengine
    < Date: Thu, 29 Nov 2018 02:31:12 GMT
    < Content-Type: application/json;charset=UTF-8
    < Content-Length: 1045
    < Connection: close
    < Vary: Accept-Encoding
    < X-Powered-By: ring/1.0.0
    < gsid: 05f40ec7394c3ad27ad5d687928cdef3
    < sc: 0.105
    < Access-Control-Allow-Origin: *
    < Access-Control-Allow-Methods: *
    < Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,key,x-biz,x-info,platinfo,encr,enginever,gzipped,poiid
    < 
    {"status":"1","count":"275","info":"OK","infocode":"10000","suggestion":{"keywords":[],"cities":[]},"pois":[{"id":"B023B08Z1D","parent":[],"name":"春江名苑","tag":[],"type":"商务住宅;住宅区;住宅小区","typecode":"120302","biz_type":[],"address":"望江东路与富春路交叉口","location":"120.192263,30.227176","tel":[],"postcode":[],"website":[],"email":[],"pcode":"330000","pname":"浙江省","citycode":"0571","cityname":"杭州市","adcode":"330102","adname":"上城区","importance":[],"shopid":[],"shopinfo":"0","poiweight":[],"gridcode":"4520217501","distance":"2360","navi_poiid":"H51F022002_96256","entr_location":"120.193053,30.227074","business_area":[],"exit_location":[],"match":"0","recommend":"0","timestamp":[],"alias":[],"indoor_map":"0","indoor_data":{"cpid":[],"floor":[],"truefloor":[],"cmsid":[]},"groupbuy_num":"0","discount_num":"0","biz_ext":{"rating":[],"cost":"57259.00"},"event":[],"children":[],"photos":[{"title":[],"url":"http://store.is.autonavi.com/showpic/eebdbfb5a20d7088d* Closing connection 0
    * TLSv1.2 (OUT), TLS alert, close notify (256):
    3e882c41b7fc3bc"}]}]}
    

    可以看到返回的内容不一致,本地返回的才是正确的,服务器上之前升级到 h2 了,openssl 用的 OpenSSL/1.0.1e,有大佬知道为什么嘛

    第 1 条附言  ·  2018-11-30 16:35:39 +08:00
    2018-11-29 提了高德的工单
    2018-11-30 16:34 分 高德回复修复了 现在结果一致了
    5 条回复    2018-11-29 12:12:30 +08:00
    hcymk2
        1
    hcymk2  
       2018-11-29 10:47:53 +08:00
    每次都是一样的结果么?
    sgq1128
        2
    sgq1128  
    OP
       2018-11-29 10:51:03 +08:00
    @hcymk2 服务器返回的每次都一样的
    lululau
        3
    lululau  
       2018-11-29 10:53:18 +08:00 via iPhone
    怎么看出来一样的,连服务端地址都不一样
    sgq1128
        4
    sgq1128  
    OP
       2018-11-29 11:02:35 +08:00
    lululau
        5
    lululau  
       2018-11-29 12:12:30 +08:00 via iPhone
    @sgq1128 对啊,先换成同一个 IP 试试啊
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1785 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 16:36 · PVG 00:36 · LAX 08:36 · JFK 11:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.