Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

by pass local ip

  • Loading branch information...
commit 41bdca18bf9259636a5eb95004762ebc2f4a987d 1 parent 08a59bd
@robin authored
View
2  CocoaWebResource.xcodeproj/project.pbxproj
@@ -277,6 +277,7 @@
GCC_PREFIX_HEADER = CocoaWebResource_Prefix.pch;
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = CocoaWebResource;
+ SDKROOT = iphoneos4.0;
};
name = Debug;
};
@@ -289,6 +290,7 @@
GCC_PREFIX_HEADER = CocoaWebResource_Prefix.pch;
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = CocoaWebResource;
+ SDKROOT = iphoneos4.0;
};
name = Release;
};
View
9 CocoaWebResource/HTTPServer.m
@@ -1,6 +1,12 @@
#include <netdb.h>
#include <arpa/inet.h>
#include <ifaddrs.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <arpa/inet.h>
+#include <ifaddrs.h>
#import "AsyncSocket.h"
#import "HTTPServer.h"
#import "HTTPConnection.h"
@@ -223,7 +229,7 @@ - (NSString*)hostName
}
for (cursor = addrs; cursor; cursor = cursor->ifa_next)
{
- if (cursor->ifa_addr->sa_family == AF_INET)
+ if (cursor->ifa_addr->sa_family == AF_INET && (cursor->ifa_flags & IFF_LOOPBACK) == 0)
{
if([@"en0" compare:[NSString stringWithUTF8String:cursor->ifa_name]] == NSOrderedSame)
{
@@ -365,7 +371,6 @@ - (void)netService:(NSNetService *)ns didNotPublish:(NSDictionary *)errorDict
- (void)setupBuiltInDocroot
{
NSString* docroot =[NSString stringWithFormat:@"%@/tmp/docroot", NSHomeDirectory()];
- NSLog(docroot);
NSFileManager *manager = [NSFileManager defaultManager];
NSError *error;
if(![manager removeItemAtPath:docroot error:&error])
Please sign in to comment.
Something went wrong with that request. Please try again.