DamonOehlman / detect-browser

Unpack a browser type and version from the useragent string

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Detecting MobileSafari/604.1 CFNetwork/1121.2.2 Darwin/19.3.0 as "unknown"

brookback opened this issue Β· comments

Hi! Thanks for a great package! πŸ’›

We're seeing this UA string in our logs:

MobileSafari/604.1 CFNetwork/1121.2.2 Darwin/19.3.0

I couldn't find that in past issues – any chance it can be detected as ios or ios-webview or similar? It doesn't seem like #67 is covering this UA string.

I found this on SO: https://stackoverflow.com/questions/24464883/serverhttp-user-agent-changing-on-safari-ios. It suggests:

The CFNetwork user agent is only a crawler process of the mobile safari. This will retrieve fav or touch icons. The CFNetwork requests depends on the iOS or Mac OS X version, the first token only identify the APP.

So this might be a no-op, depending on the goal of this module. But it'd be nice to have it identified somehow.

@brookback Thanks for the report mate, and apologies for the delay in responding. I'll take a look at getting this regex in shortly.

Just prepping a PR for this now, and having a look at the options for the return type, it feels like this is most appropriately treated as a bot-device return type (it seems to be a bot simulating a device). Is that correct?

I'm thinking that the result type would look something like this (see recent changes on master re including a type disciminator):

{
  type: 'bot-device',
  name: 'ios',
  version: '604.1',
  os: 'Mac OS',
  bot: 'CFNetwork'
}

Does that seem right to you?

it feels like this is most appropriately treated as a bot-device return type (it seems to be a bot simulating a device). Is that correct?

Yea, I'd say so too. It's not a user controlling this request.

Type looks cool! Two things:

  • The name prop could probably be more specific, like ios-crawler, ios-safari-crawler, or similar.
  • The os: "Mac OS" prop seems like it's lying a bit – the bot is clearly MobileSafari, so it could be ios?

Thanks for quick turnaround!