| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Generic utilities for all python scripts.""" | 5 """Generic utilities for all python scripts.""" |
| 6 | 6 |
| 7 import atexit | 7 import atexit |
| 8 import httplib | 8 import httplib |
| 9 import os | 9 import os |
| 10 import signal | 10 import signal |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 conn.request('HEAD', parsed.path) | 142 conn.request('HEAD', parsed.path) |
| 143 response = conn.getresponse() | 143 response = conn.getresponse() |
| 144 except (socket.gaierror, socket.error): | 144 except (socket.gaierror, socket.error): |
| 145 return False | 145 return False |
| 146 finally: | 146 finally: |
| 147 conn.close() | 147 conn.close() |
| 148 # Follow both permanent (301) and temporary (302) redirects. | 148 # Follow both permanent (301) and temporary (302) redirects. |
| 149 if response.status == 302 or response.status == 301: | 149 if response.status == 302 or response.status == 301: |
| 150 return DoesUrlExist(response.getheader('location')) | 150 return DoesUrlExist(response.getheader('location')) |
| 151 return response.status == 200 | 151 return response.status == 200 |
| OLD | NEW |