【问题标题】:Airplay http requestsAirplay http 请求
【发布时间】:2013-04-20 17:24:15
【问题描述】:

我正在尝试为 airplay 接收器(包含在电视媒体播放器中)构建一个 android 控制器。

我正在使用 curl 来测试请求以及 postman,这是一个构建 http 请求的 chrome 扩展。 如果我使用邮递员,服务器可以很好地理解请求,但我不能用 curl 重现请求。

例如,请求当前播放的媒体的当前位置:

curl -i \
192.168.1.42:7000/scrub \
-H "Connection: keep-alive" \
-H "Cache-Control: no-cache" \
-H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31" \
-H "Accept: */*" \
-H "Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4" \
-H "Accept-Encoding: gzip,deflate,sdch" \
-H "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3" \

返回:

HTTP/1.1 200 OK
Content-Type: text/parameters
Content-Length: 38

duration: 0.000000
position: 0.000000

当邮递员返回正确的值时:

duration: 275.838989
position: 13.000000

curl 请求中使用的标头来自 postman 使用 Chrome 的开发工具发出的请求。

那么,Chrome 中的请求在有效发送的请求和我在开发工具中看到的请求之间有什么区别吗?问题当然可能来自其他地方,因为 curl 无法重现相同的响应对我来说毫无意义。

【问题讨论】:

    标签: curl google-chrome-devtools airplay


    【解决方案1】:

    尝试两件事:

    • 使用 -v 检查 curl 的结果以查看您从命令行传递的标头。确保所有内容都与通过邮递员发送的标头匹配

    • 检查主机是否在设置 cookie(邮递员中的选项卡)。如果是,请尝试使用 -b 选项 http://curl.haxx.se/docs/http-cookies.html

    • 在您的 curl 请求中启用 cookie

    【讨论】:

    • 是的,请求头是正确的,我什至使用wireshard查看原始请求。没有 cookie。
    • 我找到了!请求必须在同一个 tcp 流上进行。
    猜你喜欢
    • 1970-01-01
    • 2015-04-10
    • 1970-01-01
    • 2010-11-26
    • 2011-12-07
    • 2012-06-28
    • 2015-11-12
    • 2018-01-27
    • 2021-11-03
    相关资源
    最近更新 更多