X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=sope-appserver%2FNGObjWeb%2FWOSimpleHTTPParser.m;h=595a8ecdf47ae813e5d0043e76892dc1ccb1cff3;hb=4c28420c08c7ff8bfc0dd3c6faf08277f12dbb8e;hp=1336f2d963237d082851059d491953d2fd5ad681;hpb=9cc25bbf1a98e5999ceb80c784bae00881e6ca98;p=sope diff --git a/sope-appserver/NGObjWeb/WOSimpleHTTPParser.m b/sope-appserver/NGObjWeb/WOSimpleHTTPParser.m index 1336f2d9..595a8ecd 100644 --- a/sope-appserver/NGObjWeb/WOSimpleHTTPParser.m +++ b/sope-appserver/NGObjWeb/WOSimpleHTTPParser.m @@ -29,8 +29,8 @@ 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; @@ -42,7 +42,12 @@ static int maxUploadSize = 256 * 1024; /* 256MB */ 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); @@ -544,10 +549,12 @@ static NSString *stringForHeaderName(unsigned char *p) { } 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 */