Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merging seatme-master

Fixing cURL and Wget formatters

Resolving analyzer warnings in -hash calculation
  • Loading branch information...
commit ee876f9f5d647305666e652337b4b6dcbaaada39 1 parent ff63ca7
@mattt authored
View
6 TTTHoursOfOperation/TTTHoursOfOperation.m
@@ -102,9 +102,9 @@ - (NSUInteger)hash {
NSUInteger result = 1;
result = prime + self.openingHour;
- result = prime * result + self.openingMinute;
- result = prime * result + self.closingHour;
- result = prime * result + self.closingMinute;
+ result = prime * (result + self.openingMinute);
+ result = prime * (result + self.closingHour);
+ result = prime * (result + self.closingMinute);
return result;
}
View
10 TTTURLRequestFormatter/TTTURLRequestFormatter.m
@@ -38,8 +38,12 @@ + (NSString *)cURLCommandFromURLRequest:(NSURLRequest *)request {
[command appendCommandLineArgument:[NSString stringWithFormat:@"-X %@", [request HTTPMethod]]];
if ([[request HTTPBody] length] > 0) {
- NSString *HTTPBodyString = [[[NSString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding] autorelease];
- [command appendCommandLineArgument:[NSString stringWithFormat:@"-d %@", HTTPBodyString]];
+ NSMutableString *HTTPBodyString = [[[NSMutableString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding] autorelease];
+ [HTTPBodyString replaceOccurrencesOfString:@"\\" withString:@"\\\\" options:0 range:NSMakeRange(0, [HTTPBodyString length])];
+ [HTTPBodyString replaceOccurrencesOfString:@"`" withString:@"\\`" options:0 range:NSMakeRange(0, [HTTPBodyString length])];
+ [HTTPBodyString replaceOccurrencesOfString:@"\"" withString:@"\\\"" options:0 range:NSMakeRange(0, [HTTPBodyString length])];
+ [HTTPBodyString replaceOccurrencesOfString:@"$" withString:@"\\$" options:0 range:NSMakeRange(0, [HTTPBodyString length])];
+ [command appendCommandLineArgument:[NSString stringWithFormat:@"-d \"%@\"", HTTPBodyString]];
}
NSString *acceptEncodingHeader = [[request allHTTPHeaderFields] valueForKey:@"Accept-Encoding"];
@@ -66,7 +70,7 @@ + (NSString *)WgetCommandFromURLRequest:(NSURLRequest *)request {
[NSException raise:@"Invalid HTTP Method" format:@"Wget can only make GET and POST requests", request];
}
- NSMutableString *command = [NSMutableString stringWithString:@"curl"];
+ NSMutableString *command = [NSMutableString stringWithString:@"wget"];
if ([[request HTTPBody] length] > 0) {
NSString *HTTPBodyString = [[[NSString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding] autorelease];
Please sign in to comment.
Something went wrong with that request. Please try again.