Added a couple of explanatory comments.

CQTexperiment
vspader 2009-03-07 02:11:33 -08:00
parent 54c0d3b38d
commit d391d8c616
2 changed files with 5 additions and 0 deletions

View File

@ -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"];

View File

@ -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];