Cleaned up HTTP code a little.

CQTexperiment
vspader 2009-03-05 08:09:02 -08:00
parent acf8f8f3be
commit 5d91bda8fe
1 changed files with 6 additions and 5 deletions

View File

@ -25,10 +25,13 @@
_get->addheader("Accept:*/*"); _get->addheader("Accept:*/*");
_get->connect([[url absoluteString] UTF8String]); _get->connect([[url absoluteString] UTF8String]);
for(;;) for(;;) {
{
int status = _get->get_status(); int status = _get->get_status();
if (status < 0 || status > 1) break;
if (status < 0 || status > 1) {
break;
}
if (_get->run() < 0) { if (_get->run() < 0) {
return 0; return 0;
} }
@ -40,8 +43,6 @@
return NO; return NO;
} }
// length = _get.content_length();
const char *mimeType = _get->getheader("content-type"); const char *mimeType = _get->getheader("content-type");
if (NULL != mimeType) { if (NULL != mimeType) {
_mimeType = [[NSString alloc] initWithUTF8String:mimeType]; _mimeType = [[NSString alloc] initWithUTF8String:mimeType];