Help us understand the problem. What is going on with this article?

NSURLConnectionデフォルトのHTTPヘッダ

More than 5 years have passed since last update.
- (void)send
{
  NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://ifconfig.me"]];
  NSLog(@"Accept-Encoding: %@", [req valueForHTTPHeaderField:@"Accept-Encoding"]);
  NSURLConnection *connection = [NSURLConnection connectionWithRequest:req delegate:self];
  [connection start];
}

- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response
{
  NSLog(@"Accept-Encoding: %@", [request valueForHTTPHeaderField:@"Accept-Encoding"]);
  return request;
}

がこうなる。

2014-08-06 16:45:33.576 URLCache[299:60b] Accept-Encoding: (null)
2014-08-06 16:45:33.648 URLCache[299:60b] Accept-Encoding: gzip, deflate

po [request allHTTPHeaderFields]

po [request allHTTPHeaderFields]
{
    Accept = "*/*";
    "Accept-Encoding" = "gzip, deflate";
    "Accept-Language" = "ja-jp";
}

送られてるHTTPヘッダ。URLCacheはアプリ名。

Host                    ifconfig.me
Accept-Encoding         gzip, deflate
Accept                  */*
Accept-Language         ja-jp
Connection              keep-alive
User-Agent              URLCache/1.0 CFNetwork/672.0.8 Darwin/14.0.0
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした