Anonymous avatar Anonymous committed cc6d7c6

Fix bug in HTTP response header parsing.

Comments (0)

Files changed (1)

Plugins/HTTPSource/Utils/HTTPConnection.m

 	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
+	// Or I'm an idiot who doesn't know how to count (fixed now), but I don't remember what site I was seeing this on, so I can't really check.
 	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;
+	_bufferSize -= (lineLength + 2); // +2 since we also skipped the newline
 	
 	return [line autorelease];
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.