[^-]*-kfreebsd.*-gnu kfreebsd
[^-]*-knetbsd.*-gnu knetbsd
[^-]*-gnu[^-]* hurd
+[^-]*-darwin9 iphoneos
[^-]*-darwin darwin
# These are samples.
int main(int argc,const char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
CommandLine::Args Args[] = {
{'h',"help","help",0},
int main(int argc,const char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
CommandLine::Args Args[] = {
{'h',"help","help",0},
int main(int argc,const char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
CommandLine::Args Args[] = {
{'h',"help","help",0},
int main(int argc,const char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
CommandLine::Args Args[] = {
{'h',"help","help",0},
int main(int argc,const char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
CommandLine::Args Args[] = {
{'h',"help","help",0},
int main(int argc,const char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
CommandLine::Args Args[] = {
{'h',"help","help",0},
int main(int argc, const char **argv)
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
CommandLine::Args Args[] = {
{'h',"help","help",0},
int main(int argc, const char **argv)
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
CommandLine::Args Args[] = {
{'h',"help","help",0},
int main(int argc,const char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
CommandLine::Args Args[] = {
{'h',"help","help",0},
int main(int argc,const char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
CommandLine::Args Args[] = {
{'h',"help","help",0},
int main(unsigned int argc,const char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
CommandLine::Args Args[] = {
{'h',"help","help",0},
int main(unsigned int argc,const char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
CommandLine::Args Args[] = {
{'h',"help","help",0},
int main(int argc, const char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
CommandLine::Args Args[] = {
{'h',"help","help",0},
int main()
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
setlocale(LC_ALL, "");
int main()
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
setlocale(LC_ALL, "");
int main()
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
setlocale(LC_ALL, "");
int main(int argc,const char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
setlocale(LC_ALL, "");
int main()
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
setlocale(LC_ALL, "");
int main(int argc, char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
setlocale(LC_ALL, "");
// Internet stuff
#include <netdb.h>
+#include <arpa/inet.h>
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
/*}}}*/
using namespace std;
-void CfrsError(CFReadStreamRef rs) {
+void CfrsError(const char *name, CFReadStreamRef rs) {
CFStreamError se = CFReadStreamGetError(rs);
if (se.domain == kCFStreamErrorDomainCustom) {
} else if (se.domain == kCFStreamErrorDomainMacOSStatus) {
_error->Error("MacOSStatus: %ld", se.error);
} else if (se.domain == kCFStreamErrorDomainNetDB) {
- _error->Error("NetDB: %s", gai_strerror(se.error));
+ _error->Error("NetDB: %s %s", name, gai_strerror(se.error));
} else if (se.domain == kCFStreamErrorDomainMach) {
_error->Error("Mach: %ld", se.error);
} else if (se.domain == kCFStreamErrorDomainHTTP) {
char *url = strdup(Queue->Uri.c_str());
url:
- CFStringRef sr = CFStringCreateWithCString(kCFAllocatorDefault, url, se);
+ URI uri = Queue->Uri;
+ std::string hs = uri.Host;
+
+ struct hostent *he = gethostbyname(hs.c_str());
+ if (he == NULL || he->h_addr_list[0] == NULL) {
+ _error->Error(hstrerror(h_errno));
+ Fail(true);
+ free(url);
+ }
+
+ uri.Host = inet_ntoa(* (struct in_addr *) he->h_addr_list[0]);
+
+ std::string urs = uri;
+
+ CFStringRef sr = CFStringCreateWithCString(kCFAllocatorDefault, urs.c_str(), se);
CFURLRef ur = CFURLCreateWithString(kCFAllocatorDefault, sr, NULL);
CFRelease(sr);
CFHTTPMessageRef hm = CFHTTPMessageCreateRequest(kCFAllocatorDefault, CFSTR("GET"), ur, kCFHTTPVersion1_1);
}
CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("User-Agent"), CFSTR("Telesphoreo APT-HTTP/1.0.98"));
+
+ sr = CFStringCreateWithCString(kCFAllocatorDefault, hs.c_str(), se);
+ CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("Host"), sr);
+ CFRelease(sr);
+
CFReadStreamRef rs = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, hm);
CFRelease(hm);
//CFReadStreamSetProperty(rs, kCFStreamPropertyHTTPShouldAutoredirect, kCFBooleanTrue);
CFReadStreamSetProperty(rs, kCFStreamPropertyHTTPAttemptPersistentConnection, kCFBooleanTrue);
- URI uri = Queue->Uri;
-
FetchResult Res;
CFIndex rd;
UInt32 sc;
uint8_t data[10240];
size_t offset = 0;
- Status("Connecting to %s", uri.Host.c_str());
+ Status("Connecting to %s", hs.c_str());
if (!CFReadStreamOpen(rs)) {
- CfrsError(rs);
+ CfrsError("Open", rs);
Fail(true);
goto done;
}
rd = CFReadStreamRead(rs, data, sizeof(data));
if (rd == -1) {
- CfrsError(rs);
+ CfrsError(uri.Host.c_str(), rs);
Fail(true);
goto done;
}
URIStart(Res);
read: if (rd == -1) {
- CfrsError(rs);
+ CfrsError("rd", rs);
Fail(true);
} else if (rd == 0) {
if (Res.Size == 0)
int main()
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
setlocale(LC_ALL, "");
// Internet stuff
#include <netdb.h>
+#include <arpa/inet.h>
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
/*}}}*/
using namespace std;
-void CfrsError(CFReadStreamRef rs) {
+void CfrsError(const char *name, CFReadStreamRef rs) {
CFStreamError se = CFReadStreamGetError(rs);
if (se.domain == kCFStreamErrorDomainCustom) {
} else if (se.domain == kCFStreamErrorDomainMacOSStatus) {
_error->Error("MacOSStatus: %ld", se.error);
} else if (se.domain == kCFStreamErrorDomainNetDB) {
- _error->Error("NetDB: %s", gai_strerror(se.error));
+ _error->Error("NetDB: %s %s", name, gai_strerror(se.error));
} else if (se.domain == kCFStreamErrorDomainMach) {
_error->Error("Mach: %ld", se.error);
} else if (se.domain == kCFStreamErrorDomainHTTP) {
char *url = strdup(Queue->Uri.c_str());
url:
- CFStringRef sr = CFStringCreateWithCString(kCFAllocatorDefault, url, se);
+ URI uri = Queue->Uri;
+ std::string hs = uri.Host;
+
+ struct hostent *he = gethostbyname(hs.c_str());
+ if (he == NULL || he->h_addr_list[0] == NULL) {
+ _error->Error(hstrerror(h_errno));
+ Fail(true);
+ free(url);
+ }
+
+ uri.Host = inet_ntoa(* (struct in_addr *) he->h_addr_list[0]);
+
+ std::string urs = uri;
+
+ CFStringRef sr = CFStringCreateWithCString(kCFAllocatorDefault, urs.c_str(), se);
CFURLRef ur = CFURLCreateWithString(kCFAllocatorDefault, sr, NULL);
CFRelease(sr);
CFHTTPMessageRef hm = CFHTTPMessageCreateRequest(kCFAllocatorDefault, CFSTR("GET"), ur, kCFHTTPVersion1_1);
}
CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("User-Agent"), CFSTR("Telesphoreo APT-HTTP/1.0.98"));
+
+ sr = CFStringCreateWithCString(kCFAllocatorDefault, hs.c_str(), se);
+ CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("Host"), sr);
+ CFRelease(sr);
+
CFReadStreamRef rs = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, hm);
CFRelease(hm);
//CFReadStreamSetProperty(rs, kCFStreamPropertyHTTPShouldAutoredirect, kCFBooleanTrue);
CFReadStreamSetProperty(rs, kCFStreamPropertyHTTPAttemptPersistentConnection, kCFBooleanTrue);
- URI uri = Queue->Uri;
-
FetchResult Res;
CFIndex rd;
UInt32 sc;
uint8_t data[10240];
size_t offset = 0;
- Status("Connecting to %s", uri.Host.c_str());
+ Status("Connecting to %s", hs.c_str());
if (!CFReadStreamOpen(rs)) {
- CfrsError(rs);
+ CfrsError("Open", rs);
Fail(true);
goto done;
}
rd = CFReadStreamRead(rs, data, sizeof(data));
if (rd == -1) {
- CfrsError(rs);
+ CfrsError(uri.Host.c_str(), rs);
Fail(true);
goto done;
}
URIStart(Res);
read: if (rd == -1) {
- CfrsError(rs);
+ CfrsError("rd", rs);
Fail(true);
} else if (rd == 0) {
if (Res.Size == 0)
int main(int argc, char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
RredMethod Mth;
int main(int argc, const char *argv[])
{
+#if !defined(__ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ < 10200
struct nlist nl[2];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "_useMDNSResponder";
nlist("/usr/lib/libc.dylib", nl);
if (nl[0].n_type != N_UNDF)
*(int *) nl[0].n_value = 0;
+#endif
setlocale(LC_ALL, "");