Added a couple of explanatory comments.
parent
54c0d3b38d
commit
d391d8c616
|
@ -15,6 +15,7 @@
|
|||
{
|
||||
_connection = [[HTTPConnection alloc] initWithURL:url];
|
||||
|
||||
// Note: The User-Agent CANNOT contain the string "Mozilla" or Shoutcast/Icecast will serve up HTML
|
||||
NSString *userAgent = [NSString stringWithFormat:@"Cog %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]];
|
||||
[_connection setValue:userAgent forRequestHeader:@"User-Agent"];
|
||||
[_connection setValue:@"close" forRequestHeader:@"Connection"];
|
||||
|
|
|
@ -85,9 +85,13 @@
|
|||
}
|
||||
|
||||
NSInteger lineLength = ((uint8_t *)newLine - (uint8_t *)_buffer);
|
||||
|
||||
// We are using ASCII encoding here because some Icecast servers will insert a random 0xaa or two into the headers
|
||||
NSString *line = [[NSString alloc] initWithBytes:_buffer length:lineLength encoding:NSASCIIStringEncoding];
|
||||
NSLog(@"Received line: \"%@\"", line);
|
||||
|
||||
memmove(_buffer, _buffer + lineLength + 2, _bufferSize - lineLength); // + 2 to skip the newline!
|
||||
|
||||
_bufferSize -= lineLength;
|
||||
|
||||
return [line autorelease];
|
||||
|
|
Loading…
Reference in New Issue