// $Id$ #include "common.h" #include "NGFileManager+DAV.h" @interface SkyProject_GET : NSObject @end /* SkyProject_GET */ @implementation SkyProject_GET - (WOResponse *)handleRequest:(WORequest *)_request fileManager:(SkyProjectFileManager *)_fm { WOResponse *response = nil; BOOL isDir = NO; NSString *path = nil; response = [(WOResponse *)[WOResponse alloc] initWithRequest:_request]; AUTORELEASE(response); path = [_request uri]; path = [path stringByUnescapingURL]; if ([path length] == 0) { NSLog(@"WARNING[%s] missing path", __PRETTY_FUNCTION__); [response setStatus:404]; return response; } if ([_fm fileExistsAtPath:path isDirectory:&isDir] == YES) { NSData *data = nil; if (isDir == YES) { /* data for browser */ id agent = nil; NSString *agStr = nil; if ((agStr = [_request headerForKey:@"user-agent"]) != nil) { agent = [[NGHttpUserAgent alloc] initWithString:agStr]; if ([agent isMozilla] == YES || [agent isInternetExplorer] == YES) { NSEnumerator *enumerator = nil; NSString *file = nil; NSMutableString *content = nil; NSData *data = nil; NSString *url = nil; NSMutableArray *dirC = nil; int i = 0; int cnt = 0; url = [_request valueForKey:@"x-webobjects-server-url"]; content = [[NSMutableString alloc] initWithCapacity:512]; [content appendString:@"
"]; [content appendString:@"."]; [content appendString:@""]; [content appendString:@" |
"]; [content appendString:@".."]; [content appendString:@""]; [content appendString:@" |
"]; [content appendString:@""]; [content appendString:subDir]; [content appendString:@"\\"]; [content appendString:@" |
"]; [content appendString:@""]; [content appendString:file]; [content appendString:@""]; [content appendString:@" |