static Class NSStringClass = Nil;
static BOOL debugOn = NO;
static BOOL heavyDebugOn = NO;
-static int fileIOBoundary = 16384;
-static int maxUploadSize = 256 * 1024; /* 256MB */
+static int fileIOBoundary = 0;
+static int maxUploadSize = 0;
+ (int)version {
return 1;
heavyDebugOn = [ud boolForKey:@"WOSimpleHTTPParserHeavyDebugEnabled"];
fileIOBoundary = [ud integerForKey:@"WOSimpleHTTPParserFileIOBoundary"];
maxUploadSize = [ud integerForKey:@"WOSimpleHTTPParserMaxUploadSizeInKB"];
-
+
+ if (maxUploadSize == 0)
+ maxUploadSize = 256 * 1024; /* 256MB */
+ if (fileIOBoundary == 0)
+ fileIOBoundary = 16384;
+
if (debugOn) {
NSLog(@"WOSimpleHTTPParser: max-upload-size: %dKB", maxUploadSize);
NSLog(@"WOSimpleHTTPParser: file-IO boundary: %d", fileIOBoundary);
}
else if (self->clen > maxUploadSize*1024) {
/* entity is too large */
+ NSString *s;
+
+ s = [NSString stringWithFormat:@"The maximum HTTP transaction size was "
+ @"exceeded (%d vs %d)", self->clen, maxUploadSize * 1024];
return [NSException exceptionWithName:@"LimitException"
- reason:
- @"the maximum HTTP transaction size was exceeded"
- userInfo:nil];
+ reason:s userInfo:nil];
}
else if (self->clen > fileIOBoundary) {
/* we are streaming the content to a file and use a memory mapped data */