Fri*_*ang 5 twitter ssl uri smalltalk pharo
Since Twitter changed their website design, I cannot get a set of tweets from any account by using built-in Zinc classes. It throws an error that says: ConnectionClosed: Connection closed while waiting for data
I am using Pharo 5, and I don't know how to tweak the ZnClient settings in order to keep the connection open or something to the purpose of getting the data.
testTwitter
| client |
self ensureSocketStreamFactory.
self isNativeSSLPluginPresent ifFalse: [ ^ self ].
(client := ZnClient new)
get: 'https://www.twitter.com/pharoproject'.
self assert: client isSuccess.
self assert: (client contents includesSubstring: 'Twitter').
client close
Run Code Online (Sandbox Code Playgroud)
That's the test I have in place, it never passes, and throws the error mentioned above. What's missing here? I did a Ruby script using open-uri, openssl and Nokogiri and it fetched the tweets just fine. Perhaps it's a problem with the SSL connection itself?
这里的问题很容易回答,但你不会喜欢它。您的问题与Twitter 已于 2019 年 7 月 15 日不再支持 TLS 1.0、TLS 1.1有关。您的 pharo 正在使用已弃用的 TLS 进行连接。这就是您超时的原因。
您必须自己编译新的 SSL/TLS 支持,这不是一件容易的事。您必须至少使用 TLS 1.2进行编译才能再次连接。缺少如何编译对新库的支持的 Pharo 文档。我的猜测是您正在使用 TLS 1.0(请参阅下面的注释) - 由于 Pharo 6.1(因此您的 Pharo 5.x 将具有相同或较旧的库)已libgit2.so编译libssl.so.1.0.0(具有依赖性libcurl-gnutls.so.4) - 如果您更新库,您可以看到这些支持 >= TLS 1.2。
这与我不久前发布的问题有关。没有人投票或回答,因此它被自动删除 - 您可以投票取消删除它: https ://stackoverflow.com/questions/51399321/getting-error-when-adding-ossubprocess-to-my-pharo-6-1- on-centos-7-4x(请参阅帖子底部的问题)。我没有答案,因为我已经将时间投入到我的 Smalltalk/X 项目中。