Skip to content

Commit

Permalink
Merge branch 'fix-1976' of github.com:hodbn/urllib3 into fix-1976
Browse files Browse the repository at this point in the history
  • Loading branch information
hodbn committed Oct 4, 2020
2 parents d5d2a88 + 6566c6e commit fd7730e
Show file tree
Hide file tree
Showing 88 changed files with 1,630 additions and 479 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
@@ -1,2 +1,3 @@
tidelift: pypi/urllib3
open_collective: urllib3
custom: https://gitcoin.co/grants/65/urllib3
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/01_feature_request.md
@@ -0,0 +1,26 @@
---
name: 🎁 Feature Request
about: Suggest a new feature
---

### Context

What are you trying to do?
How do you expect to do it?
Is it something you currently cannot do?
Is this related to an existing issue/problem?

### Alternatives

Can you achieve the same result doing it in an alternative way?
Is the alternative considerable?

### Duplicate

Has the feature been requested before?
If so, please provide a link to the issue.

### Contribution

Would you be willing to submit a PR?
_(Help can be provided if you need assistance submitting a PR)_
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/02_bug_report.md
@@ -0,0 +1,35 @@
---
name: 🐞 Bug Report
about: Something is broken
---

### Subject

Describe the issue here.

### Environment

Describe your environment.
At least, paste here the output of:

```python
import platform
import urllib3

print("OS", platform.platform())
print("Python", platform.python_version())
print("urllib3", urllib3.__version__)
```

### Steps to Reproduce

A simple and isolated way to reproduce the issue. A code snippet would be great.

### Expected Behavior

What should happen.

### Actual Behavior

What happens instead.
You may attach logs, packet captures, etc.
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: 📚 Documentation
url: https://urllib3.readthedocs.io/en/latest/
about: Make sure you read the relevant docs
- name: ❓ Ask on StackOverflow
url: https://stackoverflow.com/questions/tagged/urllib3
about: Ask questions about usage in StackOverflow
- name: 💬 Ask the Community
url: https://discord.gg/CHEgCZN
about: Join urllib3's Discord server
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,8 @@
<!---
Thanks for your contribution! ♥️
If this is your first PR to urllib3 please review the Contributing Guide:
https://urllib3.readthedocs.io/en/latest/contributing.html
Adhering to the Contributing Guide means we can review, merge, and release your change faster! :)
--->
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -12,9 +12,9 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
Expand Down
4 changes: 0 additions & 4 deletions .travis.yml
Expand Up @@ -32,10 +32,6 @@ jobs:
allow_failures:
- python: nightly
include:
# Lint & documentation.
- python: 3.8
env: NOX_SESSION=docs

# Unit tests
- python: 2.7
env: NOX_SESSION=test-2.7
Expand Down
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
@@ -0,0 +1,128 @@

# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at @sethmlarson or @shazow.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
9 changes: 5 additions & 4 deletions README.rst
Expand Up @@ -6,11 +6,12 @@
</a>
</p>
<p align="center">
<a href="https://travis-ci.org/urllib3/urllib3"><img alt="Build status on Travis" src="https://travis-ci.org/urllib3/urllib3.svg?branch=master" /></a>
<a href="https://github.com/urllib3/urllib3/actions?query=workflow%3ACI"><img alt="Build status on GitHub" src="https://github.com/urllib3/urllib3/workflows/CI/badge.svg" /></a>
<a href="https://urllib3.readthedocs.io/en/latest/"><img alt="Documentation Status" src="https://readthedocs.org/projects/urllib3/badge/?version=latest" /></a>
<a href="https://pypi.org/project/urllib3"><img alt="PyPI Version" src="https://img.shields.io/pypi/v/urllib3.svg?maxAge=86400" /></a>
<a href="https://discord.gg/CHEgCZN"><img alt="Join our Discord" src="https://img.shields.io/discord/756342717725933608?color=%237289da&label=discord" /></a>
<a href="https://codecov.io/gh/urllib3/urllib3"><img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/urllib3/urllib3.svg" /></a>
<a href="https://pypi.org/project/urllib3/"><img alt="PyPI Version" src="https://img.shields.io/pypi/v/urllib3.svg?maxAge=86400" /></a>
<a href="https://github.com/urllib3/urllib3/actions?query=workflow%3ACI"><img alt="Build Status on GitHub" src="https://github.com/urllib3/urllib3/workflows/CI/badge.svg" /></a>
<a href="https://travis-ci.org/urllib3/urllib3"><img alt="Build Status on Travis" src="https://travis-ci.org/urllib3/urllib3.svg?branch=master" /></a>
<a href="https://urllib3.readthedocs.io"><img alt="Documentation Status" src="https://readthedocs.org/projects/urllib3/badge/?version=latest" /></a>
</p>

urllib3 is a powerful, *user-friendly* HTTP client for Python. Much of the
Expand Down
3 changes: 1 addition & 2 deletions docs/conf.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-

from datetime import date
import os
import sys
from datetime import date

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -30,7 +30,6 @@ def __getattr__(cls, name):

import urllib3


# -- General configuration -----------------------------------------------------


Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.rst
Expand Up @@ -13,7 +13,7 @@ If you wish to add a new feature or fix a bug:
to start making your changes.
#. Write a test which shows that the bug was fixed or that the feature works
as expected.
#. Format your changes with black using command `$ nox -rs blacken` and lint your
#. Format your changes with black using command `$ nox -rs format` and lint your
changes using command `nox -rs lint`.
#. Send a pull request and bug the maintainer until it gets merged and published.
:) Make sure to add yourself to ``CONTRIBUTORS.txt``.
Expand Down
2 changes: 1 addition & 1 deletion docs/images/banner.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/reference/urllib3.util.rst
Expand Up @@ -14,5 +14,4 @@ but can also be used independently.

.. automodule:: urllib3.util
:members:
:undoc-members:
:show-inheritance:
9 changes: 4 additions & 5 deletions dummyserver/handlers.py
Expand Up @@ -8,16 +8,15 @@
import sys
import time
import zlib

from datetime import datetime, timedelta
from io import BytesIO
from tornado.web import RequestHandler

from tornado import httputil
from datetime import datetime
from datetime import timedelta
from tornado.web import RequestHandler

from urllib3.packages.six import binary_type, ensure_str
from urllib3.packages.six.moves.http_client import responses
from urllib3.packages.six.moves.urllib.parse import urlsplit
from urllib3.packages.six import binary_type, ensure_str

log = logging.getLogger(__name__)

Expand Down
6 changes: 3 additions & 3 deletions dummyserver/proxy.py
Expand Up @@ -25,16 +25,16 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import sys
import socket
import ssl
import sys

import tornado.gen
import tornado.httpclient
import tornado.httpserver
import tornado.ioloop
import tornado.iostream
import tornado.web
import tornado.httpclient
import ssl

__all__ = ["ProxyHandler", "run_proxy"]

Expand Down
13 changes: 6 additions & 7 deletions dummyserver/server.py
Expand Up @@ -7,24 +7,23 @@

import logging
import os
import socket
import ssl
import sys
import threading
import socket
import warnings
import ssl
from datetime import datetime

from urllib3.exceptions import HTTPWarning
from urllib3.util import resolve_cert_reqs, resolve_ssl_version, ALPN_PROTOCOLS

from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
import tornado.httpserver
import tornado.ioloop
import tornado.netutil
import tornado.web
import trustme
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization

from urllib3.exceptions import HTTPWarning
from urllib3.util import ALPN_PROTOCOLS, resolve_cert_reqs, resolve_ssl_version

log = logging.getLogger(__name__)

Expand Down
13 changes: 6 additions & 7 deletions dummyserver/testcase.py
Expand Up @@ -4,17 +4,16 @@
import pytest
from tornado import ioloop, web

from urllib3.connection import HTTPConnection

from dummyserver.handlers import TestingApp
from dummyserver.proxy import ProxyHandler
from dummyserver.server import (
SocketServerThread,
run_tornado_app,
run_loop_in_thread,
DEFAULT_CERTS,
HAS_IPV6,
SocketServerThread,
run_loop_in_thread,
run_tornado_app,
)
from dummyserver.handlers import TestingApp
from dummyserver.proxy import ProxyHandler
from urllib3.connection import HTTPConnection


def consume_socket(sock, chunks=65536):
Expand Down

0 comments on commit fd7730e

Please sign in to comment.