requests and urllib2 get different headers when connecting to the same host

Requests version: 2.11.1
Python: 2.7.12

We've got a server providing .txt files, basically some log files growing over time. When I use `urllib2` to send `GET` to the server `r = urllib2.urlopen('http://example.com')` , the headers of the response would be:

```
    Date: XXX
    Server: Apache
    Last-Modified: XXX
    Accept-Ranges: bytes
    Content-Length: 12345678
    Vary: Accept-Encoding
    Connection: close
    Content-Type: text/plain
```


While if `r = requests.get('http://example.com')`:

```
    Content-Encoding: gzip
    Accept-Ranges: bytes
    Vary: Accept-Encoding
    Keep-alive: timeout=5, max=128
    Last-Modified: XXX
    Connection: Keep-Alive
    ETag: xxxxxxxxx
    Content-Type: text/plain
```


The second response is the same with what I get using chrome develop tools. So why the two are different? I need the `Content-Length` header to determine how many bytes I need to download every time, becasue the file could grow really big.

Using `httpbin.org/get` to test:

urllib2 response:
```
    {u'args': {},
     u'headers': {u'Accept-Encoding': u'identity',
                  u'Host': u'httpbin.org',
                  u'User-Agent': u'Python-urllib/2.7'},
     u'origin': u'ip',
     u'url': u'http://httpbin.org/get'}
```

response headers:

```
    Server: nginx
    Date: Sat, 14 Jan 2017 07:41:16 GMT
    Content-Type: application/json
    Content-Length: 207
    Connection: close
    Access-Control-Allow-Origin: *
    Access-Control-Allow-Credentials: true
```


requests response:

```
    {u'args': {},
     u'headers': {u'Accept': u'*/*',
                  u'Accept-Encoding': u'gzip, deflate',
                  u'Host': u'httpbin.org',
                  u'User-Agent': u'python-requests/2.11.1'},
     u'origin': u'ip',
     u'url': u'http://httpbin.org/get'}
```

response headers:

```
    Server : nginx
    Date : Sat, 14 Jan 2017 07:42:39 GMT
    Content-Type : application/json
    Content-Length : 239
    Connection : keep-alive
    Access-Control-Allow-Origin : *
    Access-Control-Allow-Credentials : true
```

This is the code:

```
import urllib2 
import requests 

url = 'exmaple.com' 
headers = { 
"Authorization": "Basic xxxx", 
"Range": "bytes=0-" 
} 
req = urllib2.Request(url, headers=headers) 
resp = urllib2.urlopen(req) 
print resp.info() 

r = requests.get(url, headers=headers) 
print r.headers 
assert resp.info()['ETag'] == r.headers['ETag'] 
```

and output:

```
Date: Sat, 14 Jan 2017 09:39:50 GMT
Server: Apache
Last-Modified: Sat, 14 Jan 2017 09:39:49 GMT
ETag: "e91103-10e04f7-5460abb4743a3"
Accept-Ranges: bytes
Content-Length: 17695991
Vary: Accept-Encoding
Content-Range: bytes 0-17695990/17695991
Connection: close
Content-Type: text/plain
```
```
{'Content-Encoding': 'gzip', 'Transfer-Encoding': 'chunked', 'Accept-Ranges': 'bytes', 'Vary': 'Accept-Encoding', 'Keep-Alive': 'timeout=5, max=128', 'Server': 'Apache', 'Last-Modified': 'Sat, 14 Jan 2017 09:39:49 GMT', 'Connection': 'Keep-Alive', 'ETag': '"e91103-10e04f7-5460abb4743a3"', 'Date': 'Sat, 14 Jan 2017 09:39:50 GMT', 'Content-Type': 'text/plain'}
```

The response is different because requests indicates that it supports gzip-encoded bodies, by sending an `Accept-Encoding: gzip, deflate` header field. urllib2 does not. You'll find if you added that header to your urllib2 request that you get the new behaviour.

Clearly, in this case, the server is dynamically gzipping the responses. This means it doesn't know how long the response will be, so it is sending using chunked transfer encoding.

If you really must get the Content-Length header, then you should add the following headers to your Requests request: `{'Accept-Encoding': 'identity'}`.

Never mind. :) Forgot `stream=True`.
 Hi, when I use 

```python
for line in response.iter_lines():
    print line
```
on this server, it would print nothing until all the body content is downloaded, which is very slow for a large response. How should I change the behavior to be the same as `urllib2` in Python 2?