Re: NSURLRequest returning bizarre page
Re: NSURLRequest returning bizarre page
- Subject: Re: NSURLRequest returning bizarre page
- From: Alex Zavatone <email@hidden>
- Date: Mon, 10 Jun 2013 20:15:55 -0400
What is the header of the file being fetched set to?
On Jun 10, 2013, at 8:06 PM, Trygve Inda wrote:
> I am using the following code (url changed, but it is a .txt file)
>
> NSString* tleAddress = @"http://www.somesite.com/somefile.txt";
>
> NSURLRequest* tleRequest = [NSURLRequest requestWithURL:[NSURL
> URLWithString:tleAddress] cachePolicy:0 timeoutInterval:5.0];
>
> NSURLResponse* tleResponse = nil;
>
> NSError* tleError = nil;
>
> NSData* tleData = [NSURLConnection sendSynchronousRequest:tleRequest
> returningResponse:&tleResponse error:&tleError];
>
> NSString* tleString = [[[NSString alloc] initWithData:tleData
> encoding:NSUTF8StringEncoding] autorelease];
>
>
> This works fine on my test systems and the vast majority of my customer's
> systems. I am able to open the URL in Safari and see that it is a raw text
> file.
>
> tleString comes back with the correct text.
>
> However, on some customer's systems, despite NSError not showing anything
> wrong, I get:
>
> ^M\n<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
> Transitional//EN"^M\n"http://www.w3.org/TR/html4/loose.dtd">^M\n<html>^M\n<h
> ead>^M\n<meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">^M\n<title>Untitled Document</title>^M\n<script
> language="javascript">^M\n var loc = escape(document.location.href);^M\n
> //var ref = escape(document.referrer);^M\n var newLoc =
> "/redirect.asp?loc=" + loc;^M\n
> window.location.href(newLoc);^M\n</script>^M\n</head>^M\n^M\n<body>^M\n</bod
> y>^M\n</html>^M
>
> I have no idea where this is coming from as it is certainly not in the file.
> The customer is not using a proxy or firewall and it happens in two
> different locations (so it could be related to the machine rather than the
> internet).
>
> Ideas?
>
> Thanks,
>
> Trygve
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden