Author Topic: Different responses for BASS_streamCreateUrl on iOS  (Read 185 times)

ivanpetrov16130

  • Posts: 8
Greetings!

I have an old internet-radio streaming app, 4 iOS devices and two stations and crippling depression.
I've met up with some weird behavior.
Two devices(iPhone 6 10.3 and iPad 2 9.3) are able to stream station, and two(iPhone SE 10.3 and iPad Mini 8.3) are not. I can listen station on iPhone 6, but can't listen the same on iPhone SE.
I've checked out stream headers in DOWNLOADPROC, they are differ from one group of my devices to another.
I red them, so I'd like to know more about how requests are made  :)
And if someone faced that before or has any thoughts about why is this happening, pls let me know.

Thank you!

The headers log(it's short and pretty):
https://pastebin.com/kpD842Lg


 

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: Different responses for BASS_streamCreateUrl on iOS
« Reply #1 on: 24 Jul '17 - 17:30 »
Are you having the problem with all streams or only particular one(s)? If it's more than one, do they happen to be from the same server? Please also confirm that you're using the latest BASS library in all cases (use BASS_GetVersion to check).

ivanpetrov16130

  • Posts: 8
Re: Different responses for BASS_streamCreateUrl on iOS
« Reply #2 on: 25 Jul '17 - 12:21 »
Bass version is 2.4.12.

Problems with some streams.
I manually tested ~100 streams, and 8 of them were played with iPhone 6 but not with iPhone SE.
Servers aren't the same, they are located in different geografic places, have different engines(Caddy, Icecast) and different DNS-names.
I've noticed that most of weird streams have header's content-type as "audio/mpeg".

It's just like iPhone 6 creates stream and gets 200 OK, and iPhone SE gets 400 BAD REQUEST for the same BASS_StreamCreateURL call.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: Different responses for BASS_streamCreateUrl on iOS
« Reply #3 on: 25 Jul '17 - 14:54 »
Perhaps the devices are sending slightly different request headers. To check that, please try capturing the request headers by sending the device's traffic through a proxy on your Mac, as described here:

   https://www.engadget.com/2011/02/21/how-to-inspect-ioss-http-traffic-without-spending-a-dime/

And then post the request headers in each case. Please also confirm the full version number of BASS that you're using with BASS_GetVersion. If it isn't the latest (currently 0x2040c17), you can get that from the iOS thread:

   www.un4seen.com/forum/?topic=10910

ivanpetrov16130

  • Posts: 8
Re: Different responses for BASS_streamCreateUrl on iOS
« Reply #4 on: 31 Jul '17 - 16:09 »
I use latest BASS.


The problem was in

static NSString* kUSER_AGENT = @"My user agent";
...
BASS_SetConfigPtr(BASS_CONFIG_NET_AGENT, (__bridge const void *)(kUSER_AGENT));


Requests had contained corrupted unreadable user agent, that's why some servers had returned 400 code.
I'm not quite familiar with C(as you could notice), so I don't know, was it a good idea of previous programmer to cast NSString pointer to void pointer or not. I guess not. Now I'm using char pointer instead of NSString pointer without type casting, and now it feels good.

Thank you very much for idea of using snifflers, I've learned this skill now.