Cocoapods: Social media URL validation doesn't work for Twitter URLs

Created on 25 Jul 2019  路  8Comments  路  Source: CocoaPods/CocoaPods

馃寛

Twitter has recently started doing a thing where if you request a page using a browser user agent and no cookies, it replies with a 302 redirect to the same URL and some set-cookie headers. Making the same request again with the cookies then gives a 200 and the actual page contents, but HTTP.get_actual_url() ignores the cookies and only looks at the location header, resulting in a redirect loop. The end result is that pod validation gives WARN | url: The URL (https://twitter.com/realm) is not reachable. even though the URL works in a browser.

Some examples HTTP requests that give 200s:

$ curl 'https://twitter.com/realm'
$ curl 'https://twitter.com/realm' -H 'user-agent: Fake'
$  curl 'https://twitter.com/realm' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36' -H 'cookie: rweb_optin=side_no_out'

HTTP requests that give 302s:

$ curl 'https://twitter.com/realm' -H 'user-agent: Safari'
help wanted

All 8 comments

Sure! Could use a bug fix here. Want to make a PR?

@dnkoutso I took a stab at it with a couple PRs, modifying the two different files you mentioned above. #9053 depends on the CocoaPods/Core#571 PR

I'm motivated by one of my builds breaking because of this issue, which is why I targeted my PRs to the 1.7 stable branches for each project. I'm guessing the build for #9053 won't succeed without the other being merged. Is there a way to mark a different branch or revision as a dependency?

@abbeycode thanks, I dont think we will do a 1.7.6 for this, we are very close to 1.8.0.beta.1 so please target master on these PRs.

In case it's helpful for others, here's the workaround we're using for Firebase CI - https://github.com/firebase/firebase-ios-sdk/blob/master/scripts/pod_lib_lint.rb#L75

@dnkoutso Is there a way to install CocoaPods into CI (Travis, for me) from master before the 1.8.0 beta is out?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pronebird picture pronebird  路  3Comments

luhui picture luhui  路  3Comments

k06a picture k06a  路  3Comments

tlandsmancars picture tlandsmancars  路  3Comments

pallaviMN picture pallaviMN  路  3Comments