You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

通过CocoaPods执行时HTTP请求失败问题排查

问题:CocoaPods执行pod spec lint时HTTP下载失败,直接运行curl命令正常

Podspec内容

Pod::Spec.new do |s|

  s.name         = "AirTurnInterface"
  s.version      = "4.7.0-b.6"
  s.summary      = "snip"

  s.description  = "snip"

  s.license = { :file => 'LICENSE', :type => 'AirTurn' }

  s.homepage     = "snip"

  s.author             = { "Nick Brook" => "snip@airturn.com" }

  s.ios.deployment_target = "11.0"

  s.frameworks = 'CoreBluetooth', 'GameController', 'Security', 'UIKit'

  s.source       = { :http => "https://airturn.com/framework/test/AirTurnInterface.#{s.version}.zip" }

    s.vendored_frameworks = "Framework-dynamic/AirTurnInterface.xcframework"

end

将上述内容保存为test.podspec后,执行pod spec lint test.podspec进行验证。

问题现象

此前该操作一直正常,但现在执行时下载zip包失败,报错:

curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)

CocoaPods调用的curl命令如下:

/opt/homebrew/opt/curl/bin/curl -f -L -o /var/folders/9j/jqc5qhp922b7c8jhrvkh7h8m0000gn/T/d20221021-48752-1fqts5p/file.zip https://airturn.com/framework/test/AirTurnInterface.4.7.0-b.6.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.11.3 cocoapods-downloader/1.5.1'

奇怪的是,直接在终端运行该curl命令可正常下载,用简单Ruby脚本调用该命令也正常,推测问题出在CocoaPods本身。

调试细节

修改CocoaPods的gems/cocoapods-downloader-1.5.1/lib/cocoapods-downloader/http.rb文件,为curl添加-v参数后,得到如下输出:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 35.209.185.188:443...
* Connected to airturn.com (35.209.185.188) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [88 bytes data]
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [187 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
{ [19 bytes data]
* TLSv1.3 (IN), TLS handshake, Certificate (11):
{ [4039 bytes data]
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
{ [264 bytes data]
* TLSv1.3 (IN), TLS handshake, Finished (20):
{ [52 bytes data]
* TLSv1.3 (OUT), TLS handshake, Finished (20):
} [52 bytes data]
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=*.airturn.com
*  start date: Oct  5 00:07:55 2022 GMT
*  expire date: Jan  3 00:07:54 2023 GMT
*  subjectAltName: host "airturn.com" matched cert's "airturn.com"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
} [5 bytes data]
* h2h3 [:method: GET]
* h2h3 [:path: /framework/test/AirTurnInterface.4.7.0-b.6.zip]
* h2h3 [:scheme: https]
* h2h3 [:authority: airturn.com]
* h2h3 [user-agent: 'CocoaPods/1.11.3 cocoapods-downloader/1.5.1']
* h2h3 [accept: */*]
* Using Stream ID: 1 (easy handle 0x15580f600)
} [5 bytes data]
> GET /framework/test/AirTurnInterface.4.7.0-b.6.zip HTTP/2
> Host: airturn.com
> user-agent:  'CocoaPods/1.11.3 cocoapods-downloader/1.5.1'
> accept: */*
> 
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [265 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [265 bytes data]
* old SSL session ID is stale, removing
{ [5 bytes data]
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
} [5 bytes data]
* HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Connection #0 to host airturn.com left intact
curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)

无效尝试

  • 为curl添加--http1.1参数强制使用HTTP/1.1,报错:
curl: (52) Empty reply from server

目前不知道该如何进一步调试。

内容的提问来源于stack exchange,提问作者Nick

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 21:55:20