Dumped Google+ SDK.
[UPDATED] Google+ SDK.
This commit is contained in:
@@ -294,6 +294,51 @@ static NSString* gLoggingProcessName = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setLogRequestBody:(NSString *)bodyString {
|
||||
@synchronized(self) {
|
||||
[logRequestBody_ release];
|
||||
logRequestBody_ = [bodyString copy];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)logRequestBody {
|
||||
@synchronized(self) {
|
||||
return logRequestBody_;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setLogResponseBody:(NSString *)bodyString {
|
||||
@synchronized(self) {
|
||||
[logResponseBody_ release];
|
||||
logResponseBody_ = [bodyString copy];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)logResponseBody {
|
||||
@synchronized(self) {
|
||||
return logResponseBody_;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setShouldDeferResponseBodyLogging:(BOOL)flag {
|
||||
@synchronized(self) {
|
||||
if (flag != shouldDeferResponseBodyLogging_) {
|
||||
shouldDeferResponseBodyLogging_ = flag;
|
||||
if (!flag) {
|
||||
[self performSelectorOnMainThread:@selector(logFetchWithError:)
|
||||
withObject:nil
|
||||
waitUntilDone:NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)shouldDeferResponseBodyLogging {
|
||||
@synchronized(self) {
|
||||
return shouldDeferResponseBodyLogging_;
|
||||
}
|
||||
}
|
||||
|
||||
// stringFromStreamData creates a string given the supplied data
|
||||
//
|
||||
// If NSString can create a UTF-8 string from the data, then that is returned.
|
||||
@@ -528,16 +573,16 @@ static NSString* gLoggingProcessName = nil;
|
||||
|
||||
// write the date & time, the comment, and the link to the plain-text
|
||||
// (copyable) log
|
||||
NSString *dateLineFormat = @"<b>%@ ";
|
||||
NSString *const dateLineFormat = @"<b>%@ ";
|
||||
[outputHTML appendFormat:dateLineFormat, [NSDate date]];
|
||||
|
||||
NSString *comment = [self comment];
|
||||
if (comment) {
|
||||
NSString *commentFormat = @"%@ ";
|
||||
NSString *const commentFormat = @"%@ ";
|
||||
[outputHTML appendFormat:commentFormat, comment];
|
||||
}
|
||||
|
||||
NSString *reqRespFormat = @"</b><a href='%@'><i>request/response log</i></a><br>";
|
||||
NSString *const reqRespFormat = @"</b><a href='%@'><i>request/response log</i></a><br>";
|
||||
[outputHTML appendFormat:reqRespFormat, copyableFileName];
|
||||
|
||||
// write the request URL
|
||||
@@ -601,22 +646,28 @@ static NSString* gLoggingProcessName = nil;
|
||||
[outputHTML appendFormat:@" data: %d bytes, <code>%@</code><br>\n",
|
||||
(int)postDataLength, postType ? postType : @"<no type>"];
|
||||
|
||||
postDataStr = [self stringFromStreamData:postData
|
||||
contentType:postType];
|
||||
if (postDataStr) {
|
||||
// remove OAuth 2 client secret and refresh token
|
||||
postDataStr = [[self class] snipSubstringOfString:postDataStr
|
||||
betweenStartString:@"client_secret="
|
||||
endString:@"&"];
|
||||
if (logRequestBody_) {
|
||||
postDataStr = [[logRequestBody_ copy] autorelease];
|
||||
[logRequestBody_ release];
|
||||
logRequestBody_ = nil;
|
||||
} else {
|
||||
postDataStr = [self stringFromStreamData:postData
|
||||
contentType:postType];
|
||||
if (postDataStr) {
|
||||
// remove OAuth 2 client secret and refresh token
|
||||
postDataStr = [[self class] snipSubstringOfString:postDataStr
|
||||
betweenStartString:@"client_secret="
|
||||
endString:@"&"];
|
||||
|
||||
postDataStr = [[self class] snipSubstringOfString:postDataStr
|
||||
betweenStartString:@"refresh_token="
|
||||
endString:@"&"];
|
||||
postDataStr = [[self class] snipSubstringOfString:postDataStr
|
||||
betweenStartString:@"refresh_token="
|
||||
endString:@"&"];
|
||||
|
||||
// remove ClientLogin password
|
||||
postDataStr = [[self class] snipSubstringOfString:postDataStr
|
||||
betweenStartString:@"&Passwd="
|
||||
endString:@"&"];
|
||||
// remove ClientLogin password
|
||||
postDataStr = [[self class] snipSubstringOfString:postDataStr
|
||||
betweenStartString:@"&Passwd="
|
||||
endString:@"&"];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// no post data
|
||||
@@ -637,7 +688,7 @@ static NSString* gLoggingProcessName = nil;
|
||||
NSString *jsonCode = [[jsonError valueForKey:@"code"] description];
|
||||
NSString *jsonMessage = [jsonError valueForKey:@"message"];
|
||||
if (jsonCode || jsonMessage) {
|
||||
NSString *jsonErrFmt = @" <i>JSON error:</i> <FONT"
|
||||
NSString *const jsonErrFmt = @" <i>JSON error:</i> <FONT"
|
||||
@" COLOR='#FF00FF'>%@ %@ ⚑</FONT>"; // 2691 = ⚑
|
||||
statusString = [statusString stringByAppendingFormat:jsonErrFmt,
|
||||
jsonCode ? jsonCode : @"",
|
||||
@@ -648,7 +699,7 @@ static NSString* gLoggingProcessName = nil;
|
||||
} else {
|
||||
// purple for anything other than 200 or 201
|
||||
NSString *flag = (status >= 400 ? @" ⚑" : @""); // 2691 = ⚑
|
||||
NSString *statusFormat = @"<FONT COLOR='#FF00FF'>%ld %@</FONT>";
|
||||
NSString *const statusFormat = @"<FONT COLOR='#FF00FF'>%ld %@</FONT>";
|
||||
statusString = [NSString stringWithFormat:statusFormat,
|
||||
(long)status, flag];
|
||||
}
|
||||
@@ -659,7 +710,7 @@ static NSString* gLoggingProcessName = nil;
|
||||
NSURL *responseURL = [response URL];
|
||||
|
||||
if (responseURL && ![responseURL isEqual:[request URL]]) {
|
||||
NSString *responseURLFormat = @"<FONT COLOR='#FF00FF'>response URL:"
|
||||
NSString *const responseURLFormat = @"<FONT COLOR='#FF00FF'>response URL:"
|
||||
"</FONT> <code>%@</code><br>\n";
|
||||
responseURLStr = [NSString stringWithFormat:responseURLFormat,
|
||||
[responseURL absoluteString]];
|
||||
@@ -700,13 +751,13 @@ static NSString* gLoggingProcessName = nil;
|
||||
// Make a small inline image that links to the full image file
|
||||
[outputHTML appendFormat:@" data: %d bytes, <code>%@</code><br>",
|
||||
(int)responseDataLength, responseMIMEType];
|
||||
NSString *fmt = @"<a href=\"%@\"><img src='%@' alt='image'"
|
||||
NSString *const fmt = @"<a href=\"%@\"><img src='%@' alt='image'"
|
||||
" style='border:solid thin;max-height:32'></a>\n";
|
||||
[outputHTML appendFormat:fmt,
|
||||
escapedResponseFile, escapedResponseFile];
|
||||
} else {
|
||||
// The response data was XML; link to the xml file
|
||||
NSString *fmt = @" data: %d bytes, <code>"
|
||||
NSString *const fmt = @" data: %d bytes, <code>"
|
||||
"%@</code> <i><a href=\"%@\">%@</a></i>\n";
|
||||
[outputHTML appendFormat:fmt,
|
||||
(int)responseDataLength, responseMIMEType,
|
||||
@@ -747,6 +798,11 @@ static NSString* gLoggingProcessName = nil;
|
||||
[copyable appendFormat:@"Response body: (%u bytes)\n",
|
||||
(unsigned int) responseDataLength];
|
||||
if (responseDataLength > 0) {
|
||||
if (logResponseBody_) {
|
||||
responseDataStr = [[logResponseBody_ copy] autorelease];
|
||||
[logResponseBody_ release];
|
||||
logResponseBody_ = nil;
|
||||
}
|
||||
if (responseDataStr != nil) {
|
||||
[copyable appendFormat:@"%@\n", responseDataStr];
|
||||
} else if (status >= 400 && [temporaryDownloadPath_ length] > 0) {
|
||||
|
Reference in New Issue
Block a user