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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to