Skip to content

Commit

Permalink
Added checks for malformed NSURL (closes #79)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeemster committed Aug 27, 2015
1 parent 8831d81 commit c55eb32
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Snowplow/SPEmitter.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,14 @@ - (id) init {
- (void) setup {
_dataOperationQueue.maxConcurrentOperationCount = _emitThreadPoolSize;

if (_httpMethod == SPRequestGet) {
_urlEndpoint = [_urlEndpoint URLByAppendingPathComponent:kEndpointGet];
if (_urlEndpoint && _urlEndpoint.scheme && _urlEndpoint.host) {
if (_httpMethod == SPRequestGet) {
_urlEndpoint = [_urlEndpoint URLByAppendingPathComponent:kEndpointGet];
} else {
_urlEndpoint = [_urlEndpoint URLByAppendingPathComponent:kEndpointPost];
}
} else {
_urlEndpoint = [_urlEndpoint URLByAppendingPathComponent:kEndpointPost];
[NSException raise:@"Invalid SPEmitter Endpoint" format:@"An invalid Emitter URL was found: %@", _urlEndpoint];
}

[self setNewBufferTime:kDefaultBufferTimeout];
Expand Down

0 comments on commit c55eb32

Please sign in to comment.