代码之家  ›  专栏  ›  技术社区  ›  CodingNow

“open”在这个curl命令行中是什么意思?

  •  0
  • CodingNow  · 技术社区  · 7 年前

    做什么? OPEN 在这个curl命令行中是什么意思?

    curl -i -H 'Content-Type: application/websocket-events' -d OPEN$'\r'$'\n' http://127.0.0.1:7999/users/socket/
    

    我的理解是 \r \n 意味着新的线路馈送,但是 打开 前面的意思是?我看过卷发手册,但找不到解释。

    2 回复  |  直到 7 年前
        1
  •  1
  •   Remy Lebeau    7 年前

    命令正在通过curl发布数据 -d 参数:

    将POST请求中的指定数据发送到HTTP服务器

    所以,发布的数据实际上是 OPEN\r\n .

    命令正在设置 Content-Type application/websocket-events . 见 WebSocket-Over-HTTP Protocol 有关该类型的详细信息。 OPEN 是该协议中交换的第一个命令。

    您的命令行转换为类似于以下内容的HTTP请求:

    POST /users/socket/ HTTP/1.1
    Host: 127.0.0.1:7999
    Connection: close
    Content-Type: application/websocket-events
    Content-Length: 6
    
    OPEN\r\n
    
        2
  •  2
  •   Remy Lebeau    7 年前

    curl-d定义了post数据

    在这种情况下,打开的只是您正在发送的特定负载

    推荐文章