repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
gunicorn | tests/docker/asgi_framework_compat/frameworks/django_app/routing.py | .py | """
WebSocket routing for Django Channels.
"""
from django.urls import path
from consumers import (
EchoConsumer,
EchoBinaryConsumer,
ScopeConsumer,
SubprotocolConsumer,
CloseConsumer,
)
websocket_urlpatterns = [
path("ws/echo", EchoConsumer.as_asgi()),
path("ws/echo-binary", EchoBinaryCon... | 21 | 493 |
gunicorn | tests/docker/uwsgi/app.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
Test WSGI application for uWSGI protocol integration tests.
This application provides various endpoints to test different aspects
of the uWSGI binary protocol when proxied through nginx.
"""
import json
def... | 227 | 6,741 |
gunicorn | tests/docker/uwsgi/test_uwsgi_integration.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
Integration tests for gunicorn's uWSGI binary protocol with nginx.
These tests verify that gunicorn correctly implements the uWSGI binary
protocol by running actual requests through nginx's uwsgi_pass directiv... | 317 | 11,888 |
gunicorn | tests/docker/uwsgi/conftest.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
pytest fixtures for uWSGI Docker integration tests.
"""
import os
import subprocess
import time
import pytest
import requests
COMPOSE_FILE = os.path.join(os.path.dirname(__file__), 'docker-compose.yml')
NGI... | 126 | 3,249 |
gunicorn | tests/docker/per_app_allocation/app.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
WSGI and Dirty applications for per-app worker allocation testing.
Contains:
- A WSGI app that can make dirty client requests
- A lightweight dirty app (loads on all workers)
- A heavy dirty app (limited to 2 ... | 185 | 5,751 |
gunicorn | tests/docker/per_app_allocation/test_per_app_e2e.py | .py | #!/usr/bin/env python
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
Docker-based end-to-end tests for per-app worker allocation.
These tests verify:
1. Apps with worker limits are only loaded on limited workers
2. Requests are routed to workers that have ... | 394 | 13,964 |
gunicorn | tests/docker/per_app_allocation/gunicorn_conf.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
Gunicorn configuration for per-app worker allocation e2e tests.
Configuration:
- 4 dirty workers total
- LightweightApp: loads on ALL 4 workers (workers=None)
- HeavyApp: loads on 2 workers (via class attribut... | 39 | 934 |
gunicorn | tests/dirty/test_client_streaming.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Tests for dirty client sync streaming functionality."""
import socket
import struct
import pytest
from unittest import mock
from gunicorn.dirty.protocol import (
DirtyProtocol,
BinaryProtocol,
make... | 233 | 7,341 |
gunicorn | tests/dirty/test_arbiter_streaming.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Tests for dirty arbiter streaming functionality."""
import asyncio
import struct
from unittest import mock
import pytest
from gunicorn.dirty.protocol import (
DirtyProtocol,
BinaryProtocol,
make_r... | 328 | 11,210 |
gunicorn | tests/dirty/test_worker_streaming.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Tests for dirty worker streaming functionality."""
import asyncio
import struct
from unittest import mock
import pytest
from gunicorn.dirty.protocol import (
DirtyProtocol,
BinaryProtocol,
make_re... | 423 | 14,455 |
gunicorn | tests/dirty/test_client_streaming_async.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Tests for dirty client async streaming functionality."""
import asyncio
import struct
import pytest
from gunicorn.dirty.protocol import (
DirtyProtocol,
BinaryProtocol,
make_chunk_message,
make... | 264 | 8,454 |
gunicorn | tests/dirty/test_streaming_integration.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Integration tests for dirty streaming functionality.
These tests verify the full streaming pipeline:
client -> arbiter -> worker -> generator -> chunks -> client
"""
import asyncio
import os
import struct
impo... | 478 | 15,944 |
gunicorn | tests/dirty/test_per_app_worker_allocation.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Integration tests for per-app worker allocation."""
import pytest
from gunicorn.config import Config
from gunicorn.dirty.arbiter import DirtyArbiter
class MockLog:
"""Mock logger for testing."""
def... | 325 | 10,757 |
gunicorn | tests/dirty/test_arbiter_signals.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Tests for dirty arbiter TTIN/TTOU signal handling."""
import signal
from unittest.mock import Mock
import pytest
class TestDirtyArbiterSignals:
"""Test TTIN/TTOU signal handling in DirtyArbiter."""
... | 235 | 8,302 |
gunicorn | tests/dirty/test_multi_app_routing.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Tests for routing requests to multiple dirty apps.
This module verifies that when multiple dirty apps are configured,
messages are correctly routed to the appropriate app based on app_path.
"""
import asyncio
... | 630 | 20,930 |
gunicorn | tests/config/test_cfg.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
bind = "unix:/tmp/bar/baz"
workers = 3
proc_name = "fooey"
default_proc_name = "blurgh"
| 9 | 194 |
gunicorn | tests/ctl/test_client.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Tests for control socket client."""
import os
import socket
import tempfile
import threading
import pytest
from gunicorn.ctl.client import (
ControlClient,
ControlClientError,
parse_command,
)
fro... | 276 | 9,177 |
gunicorn | tests/ctl/test_server.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Tests for control socket server."""
import os
import tempfile
import time
from unittest.mock import MagicMock
import pytest
from gunicorn.ctl.server import ControlSocketServer
from gunicorn.ctl.client import ... | 470 | 14,859 |
gunicorn | tests/ctl/test_protocol.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Tests for control socket protocol."""
import json
import struct
import pytest
from gunicorn.ctl.protocol import (
ControlProtocol,
ProtocolError,
make_request,
make_response,
make_error_res... | 250 | 7,587 |
gunicorn | tests/ctl/test_handlers.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Tests for control socket command handlers."""
import signal
import time
from unittest.mock import MagicMock, patch
from gunicorn.ctl.handlers import CommandHandlers
class MockWorker:
"""Mock worker for t... | 469 | 13,207 |
gunicorn | tests/workers/test_gevent_import_order.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
Test for gevent worker compatibility with concurrent.futures import order.
Issue: https://github.com/benoitc/gunicorn/issues/3482
Discussion: https://github.com/benoitc/gunicorn/discussions/3481
Gist: https://... | 362 | 14,137 |
gunicorn | tests/workers/test_ggevent.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from unittest import mock
import pytest
try:
import gevent
HAS_GEVENT = True
except ImportError:
HAS_GEVENT = False
pytestmark = pytest.mark.skipif(not HAS_GEVENT, reason="gevent not installed")
de... | 217 | 8,018 |
gunicorn | tests/requests/invalid/chunked_07.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.http.errors import InvalidHeaderName
from gunicorn.config import Config
cfg = Config()
cfg.set("header_map", "refuse")
request = InvalidHeaderName
| 12 | 269 |
gunicorn | tests/requests/invalid/012.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
from gunicorn.http.errors import LimitRequestHeaders
request = LimitRequestHeaders
cfg = Config()
cfg.set('limit_request_field_size', 98)
| 11 | 280 |
gunicorn | tests/requests/invalid/013.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
from gunicorn.http.errors import LimitRequestHeaders
request = LimitRequestHeaders
cfg = Config()
cfg.set('limit_request_field_size', 14)
# once this option is removed, this tes... | 15 | 442 |
gunicorn | tests/requests/invalid/pp_03.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
from gunicorn.http.errors import InvalidProxyLine
cfg = Config()
cfg.set('proxy_protocol', True)
request = InvalidProxyLine
| 12 | 267 |
gunicorn | tests/requests/invalid/limit_header_default_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
from gunicorn.http.errors import LimitRequestHeaders
cfg = Config()
# Setting limit_request_field_size=0 should use default max (8190)
cfg.set('limit_request_field_size', 0)
requ... | 12 | 346 |
gunicorn | tests/requests/invalid/010.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
from gunicorn.http.errors import LimitRequestHeaders
request = LimitRequestHeaders
cfg = Config()
cfg.set('limit_request_field_size', 10)
| 11 | 280 |
gunicorn | tests/requests/invalid/pp_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
from gunicorn.http.errors import InvalidProxyLine
cfg = Config()
cfg.set("proxy_protocol", True)
request = InvalidProxyLine
| 12 | 267 |
gunicorn | tests/requests/invalid/019.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
from gunicorn.http.errors import InvalidSchemeHeaders
request = InvalidSchemeHeaders
cfg = Config()
cfg.set('forwarded_allow_ips', '*')
| 11 | 278 |
gunicorn | tests/requests/invalid/011.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
from gunicorn.http.errors import LimitRequestHeaders
request = LimitRequestHeaders
cfg = Config()
cfg.set('limit_request_fields', 2)
| 11 | 275 |
gunicorn | tests/requests/valid/005.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/forums/1/topics/2375?page=1#posts-17408"),
"version": (1, 1),
"headers": [],
"body": b""
}
| 12 | 259 |
gunicorn | tests/requests/valid/023.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
req1 = {
"method": "POST",
"uri": uri("/two_chunks_mult_zero_end"),
"version": (1, 1),
"headers": [
("TRANSFER-ENCODING", "chunked")
],
"body": b"hello world"
}
req2 = {
"method... | 24 | 441 |
gunicorn | tests/requests/valid/004.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/silly"),
"version": (1, 1),
"headers": [
("AAAAAAAAAAAAA", "++++++++++")
],
"body": b""
}
| 14 | 270 |
gunicorn | tests/requests/valid/padding_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/"),
"version": (1, 1),
"headers": [
("HOST", "localhost"),
("NAME", "value")
],
"body": b"",
}
| 16 | 284 |
gunicorn | tests/requests/valid/025_line.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "POST",
"uri": uri("/chunked"),
"version": (1, 1),
"headers": [
('TRANSFER-ENCODING', 'gzip,chunked')
],
"body": b"hello world"
}
| 15 | 291 |
gunicorn | tests/requests/valid/027.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/\xc3\xa0%20k"),
"version": (1, 0),
"headers": [
],
"body": ''
}
| 13 | 236 |
gunicorn | tests/requests/valid/031.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "-BLARGH",
"uri": uri("/foo"),
"version": (1, 1),
"headers": [],
"body": b""
}
| 12 | 227 |
gunicorn | tests/requests/valid/rfc9110_body_framing_get_cl_zero_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9110 section 8.6: Content-Length: 0 on GET is valid.
request = {
"method": "GET",
"uri": uri("/foo"),
"version": (1, 1),
"headers": [
("HOST", "example.com"),
("CONTENT-LENGTH"... | 16 | 354 |
gunicorn | tests/requests/valid/rfc9110_field_name_special_chars_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9110 section 5.6.2: token = 1*tchar; tchar includes !#$%&'*+-.^_`|~
# and alphanumerics. Dot, pipe, and other specials are legal in field-names.
request = {
"method": "GET",
"uri": uri("/foo"),
"v... | 17 | 446 |
gunicorn | tests/requests/valid/028.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
cfg.set("strip_header_spaces", True)
request = {
"method": "GET",
"uri": uri("/stuff/here?foo=bar"),
"version": (1, 1),
"headers": [
("CON... | 18 | 367 |
gunicorn | tests/requests/valid/012.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "POST",
"uri": uri("/chunked_w_trailing_headers"),
"version": (1, 1),
"headers": [
("TRANSFER-ENCODING", "chunked")
],
"body": b"hello world",
"trailers": [... | 18 | 391 |
gunicorn | tests/requests/valid/024.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
# Request line is 8194 bytes, header line is 8209 bytes (both include CRLF)
cfg.set('limit_request_line', 8200)
cfg.set('limit_request_field_size', 8210)
request =... | 21 | 16,827 |
gunicorn | tests/requests/valid/001.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "PUT",
"uri": uri("/stuff/here?foo=bar"),
"version": (1, 0),
"headers": [
("SERVER", "http://127.0.0.1:5984"),
("CONTENT-TYPE", "application/json"),
("C... | 16 | 381 |
gunicorn | tests/requests/valid/031compat2.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
cfg.set("permit_unconventional_http_method", True)
request = {
"method": "-blargh",
"uri": uri("/foo"),
"version": (1, 1),
"headers": [],
"bod... | 17 | 330 |
gunicorn | tests/requests/valid/030.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
request = {
"method": "GET",
"uri": uri("/stuff/here?foo=bar"),
"version": (1, 1),
"headers": [
('TRANSFER-ENCODING', 'identity'),
... | 19 | 384 |
gunicorn | tests/requests/valid/rfc9112_target_authority_connect_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 3.2.3: authority-form, only valid with CONNECT.
request = {
"method": "CONNECT",
"uri": uri("example.com:443"),
"version": (1, 1),
"headers": [
("HOST", "example.com:443")... | 15 | 348 |
gunicorn | tests/requests/valid/rfc9112_target_asterisk_options_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 3.2.4: asterisk-form, only valid with OPTIONS.
request = {
"method": "OPTIONS",
"uri": uri("*"),
"version": (1, 1),
"headers": [
("HOST", "example.com"),
],
"body"... | 15 | 329 |
gunicorn | tests/requests/valid/006.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/get_no_headers_no_body/world"),
"version": (1, 1),
"headers": [],
"body": b""
}
| 12 | 248 |
gunicorn | tests/requests/valid/015.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/test"),
"version": (1, 0),
"headers": [
("HOST", "0.0.0.0:5000"),
("USER-AGENT", "ApacheBench/2.3"),
("ACCEPT", "*/*")
],
"b... | 16 | 332 |
gunicorn | tests/requests/valid/026.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
# Header line is 8209 bytes (name + ": " + value + CRLF)
cfg.set('limit_request_field_size', 8210)
request = {
"method": "GET",
"uri": uri("/"),
"versi... | 19 | 8,593 |
gunicorn | tests/requests/valid/rfc9112_chunked_size_leading_zeros_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 7.1: chunk-size is 1*HEXDIG. Leading zeros are permitted
# but have been used in smuggling vectors; fixture pins accepted behavior.
request = {
"method": "POST",
"uri": uri("/upload"),
... | 17 | 464 |
gunicorn | tests/requests/valid/rfc9112_chunked_ext_quoted_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 7.1.1: chunk-ext-val can be token or quoted-string.
request = {
"method": "POST",
"uri": uri("/upload"),
"version": (1, 1),
"headers": [
("HOST", "example.com"),
(... | 16 | 384 |
gunicorn | tests/requests/valid/rfc9110_field_value_htab_trim_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9110 section 5.5: OWS around field-value is optional and not part
# of the value; leading and trailing HTAB must be stripped.
request = {
"method": "GET",
"uri": uri("/foo"),
"version": (1, 1),
... | 17 | 422 |
gunicorn | tests/requests/valid/013.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "POST",
"uri": uri("/chunked_w_extensions"),
"version": (1, 1),
"headers": [
("TRANSFER-ENCODING", "chunked")
],
"body": b"hello world"
}
| 14 | 298 |
gunicorn | tests/requests/valid/099.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "POST",
"uri": uri("/test-form"),
"version": (1, 1),
"headers": [
("HOST", "0.0.0.0:5000"),
("USER-AGENT", "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:25.0) Gecko/2... | 279 | 9,241 |
gunicorn | tests/requests/valid/022.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
req1 = {
"method": "GET",
"uri": uri("/first"),
"version": (1, 0),
"headers": [("CONNECTION", "Keep-Alive")],
"body": b""
}
req2 = {
"method": "GET",
"uri": uri("/second"),
"version... | 22 | 392 |
gunicorn | tests/requests/valid/rfc9112_target_absolute_ipv6_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 3.2.2 + RFC 3986 section 3.2.2: absolute-form with an
# IP-literal (IPv6) host wrapped in brackets.
request = {
"method": "GET",
"uri": uri("http://[::1]:8080/foo"),
"version": (1, 1)... | 16 | 397 |
gunicorn | tests/requests/valid/002.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/test"),
"version": (1, 1),
"headers": [
("USER-AGENT", "curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1"),
... | 16 | 402 |
gunicorn | tests/requests/valid/pp_03.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
cfg.set("proxy_protocol", True)
request = {
"method": "GET",
"uri": uri("/no/proxy/header"),
"version": (1, 1),
"headers": [
("HOST", "exa... | 20 | 389 |
gunicorn | tests/requests/valid/021.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/first"),
"version": (1, 1),
"headers": [("CONNECTION", "Close")],
"body": b""
}
| 12 | 248 |
gunicorn | tests/requests/valid/rfc9112_target_absolute_userinfo_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 3.2.2: absolute-form with userinfo and explicit port.
request = {
"method": "GET",
"uri": uri("http://user:pass@example.com:8080/foo?q=1"),
"version": (1, 1),
"headers": [
... | 15 | 377 |
gunicorn | tests/requests/valid/003.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/favicon.ico"),
"version": (1, 1),
"headers": [
("HOST", "0.0.0.0=5000"),
("USER-AGENT", "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gec... | 21 | 683 |
gunicorn | tests/requests/valid/020.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/first"),
"version": (1, 0),
"headers": [('CONTENT-LENGTH', '24')],
"body": b"GET /second HTTP/1.1\r\n\r\n"
}
| 12 | 277 |
gunicorn | tests/requests/valid/rfc9112_smuggle_gzip_chunked_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 6.1: Transfer-Encoding codings stack left-to-right;
# chunked must be the final coding. gzip before chunked is valid.
request = {
"method": "POST",
"uri": uri("/upload"),
"version": (... | 17 | 456 |
gunicorn | tests/requests/valid/040_compat.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
cfg.set("header_map", "dangerous")
request = {
"method": "GET",
"uri": uri("/keep/same/as?invalid/040"),
"version": (1, 0),
"headers": [
(... | 21 | 455 |
gunicorn | tests/requests/valid/009.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "POST",
"uri": uri("/post_identity_body_world?q=search#hey"),
"version": (1, 1),
"headers": [
("ACCEPT", "*/*"),
("TRANSFER-ENCODING", "identity"),
("CO... | 16 | 370 |
gunicorn | tests/requests/valid/rfc9110_field_value_obs_text_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9110 section 5.5: field-vchar = VCHAR / obs-text (0x80-0xFF).
# Value carries two obs-text bytes 0xC3 0xA9 (UTF-8 "e"-acute), stored
# as latin-1 per the WSGI environ convention.
request = {
"method": "GE... | 18 | 487 |
gunicorn | tests/requests/valid/014.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri('/with_"quotes"?foo="bar"'),
"version": (1, 1),
"headers": [],
"body": b""
}
| 12 | 243 |
gunicorn | tests/requests/valid/rfc9110_body_framing_http10_cl_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 6.1: Content-Length is the only framing option for
# HTTP/1.0 bodies (chunked was added in HTTP/1.1).
request = {
"method": "POST",
"uri": uri("/foo"),
"version": (1, 0),
"headers... | 17 | 422 |
gunicorn | tests/requests/valid/010.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "POST",
"uri": uri("/post_chunked_all_your_base"),
"version": (1, 1),
"headers": [
("TRANSFER-ENCODING", "chunked"),
],
"body": b"all your base are belong to us... | 14 | 324 |
gunicorn | tests/requests/valid/pp_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
cfg.set('proxy_protocol', True)
request = {
"method": "GET",
"uri": uri("/stuff/here?foo=bar"),
"version": (1, 0),
"headers": [
("SERVER",... | 21 | 465 |
gunicorn | tests/requests/valid/rfc9110_body_framing_get_cl_nonzero_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9110 section 8.6: a GET with a non-zero Content-Length is
# "discouraged" but not forbidden; the body must be preserved.
request = {
"method": "GET",
"uri": uri("/foo"),
"version": (1, 1),
"he... | 17 | 427 |
gunicorn | tests/requests/valid/compat_obs_fold.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.http.errors import ObsoleteFolding
from gunicorn.config import Config
cfg = Config()
cfg.set('permit_obsolete_folding', True)
request = {
"method": "GET",
"uri": uri("/"),
"version": (1,... | 21 | 427 |
gunicorn | tests/requests/valid/031compat.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
cfg.set("permit_unconventional_http_method", True)
cfg.set("casefold_http_method", True)
request = {
"method": "-BLARGH",
"uri": uri("/foo"),
"version... | 18 | 368 |
gunicorn | tests/requests/valid/019.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/first"),
"version": (1, 0),
"headers": [],
"body": b""
}
| 12 | 225 |
gunicorn | tests/requests/valid/025.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "POST",
"uri": uri("/chunked"),
"version": (1, 1),
"headers": [
('TRANSFER-ENCODING', 'gzip'),
('TRANSFER-ENCODING', 'chunked')
],
"body": b"hello world... | 15 | 324 |
gunicorn | tests/requests/valid/rfc9112_target_authority_ipv6_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 3.2.3: authority-form with IPv6 literal, used by CONNECT.
request = {
"method": "CONNECT",
"uri": uri("[::1]:443"),
"version": (1, 1),
"headers": [
("HOST", "[::1]:443"),
... | 15 | 346 |
gunicorn | tests/requests/valid/compat_obs_fold_huge.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
cfg.set('permit_obsolete_folding', True)
certificate = """-----BEGIN CERTIFICATE-----
MIIFbTCCBFWgAwIBAgICH4cwDQYJKoZIhvcNAQEFBQAwcDELMAkGA1UEBhMCVUsx
ETAPBgNVB... | 50 | 2,354 |
gunicorn | tests/requests/valid/pp_02.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
cfg.set("proxy_protocol", True)
req1 = {
"method": "GET",
"uri": uri("/stuff/here?foo=bar"),
"version": (1, 1),
"headers": [
("SERVER", "h... | 35 | 745 |
gunicorn | tests/requests/valid/011.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "POST",
"uri": uri("/two_chunks_mult_zero_end"),
"version": (1, 1),
"headers": [
("TRANSFER-ENCODING", "chunked")
],
"body": b"hello world"
}
| 14 | 302 |
gunicorn | tests/requests/valid/rfc9112_smuggle_te_identity_chunked_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 6.1: identity is a no-op coding and may precede chunked.
# Worth codifying because proxies have historically disagreed on this form.
request = {
"method": "POST",
"uri": uri("/upload"),
... | 17 | 475 |
gunicorn | tests/requests/valid/017.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/stuff/here?foo=bar"),
"version": (1, 0),
"headers": [
("IF-MATCH", "bazinga!"),
("IF-MATCH", "large-sound")
],
"body": b""
}
| 15 | 313 |
gunicorn | tests/requests/valid/rfc9112_chunked_size_uppercase_hex_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 7.1: chunk-size = 1*HEXDIG, which allows both cases.
request = {
"method": "POST",
"uri": uri("/upload"),
"version": (1, 1),
"headers": [
("HOST", "example.com"),
... | 16 | 390 |
gunicorn | tests/requests/valid/pp_05.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
cfg.set("proxy_protocol", True)
request = {
"method": "GET",
"uri": uri("/proxy/v2/ipv6"),
"version": (1, 1),
"headers": [
("HOST", "examp... | 20 | 387 |
gunicorn | tests/requests/valid/040.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/keep/same/as?invalid/040"),
"version": (1, 0),
"headers": [
("CONTENT-LENGTH", "7")
],
"body": b'tricked'
}
| 14 | 288 |
gunicorn | tests/requests/valid/018.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
req1 = {
"method": "GET",
"uri": uri("/first"),
"version": (1, 1),
"headers": [],
"body": b""
}
req2 = {
"method": "GET",
"uri": uri("/second"),
"version": (1, 1),
"headers": []... | 22 | 364 |
gunicorn | tests/requests/valid/pp_04.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
cfg.set("proxy_protocol", True)
request = {
"method": "GET",
"uri": uri("/proxy/v2/ipv4"),
"version": (1, 1),
"headers": [
("HOST", "examp... | 20 | 387 |
gunicorn | tests/requests/valid/rfc9112_target_absolute_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 3.2.2: absolute-form request-target.
request = {
"method": "GET",
"uri": uri("http://example.com/foo?q=1"),
"version": (1, 1),
"headers": [
("HOST", "example.com"),
],... | 15 | 340 |
gunicorn | tests/requests/valid/rfc9112_target_absolute_https_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 3.2.2: absolute-form with https scheme (proxy requests).
request = {
"method": "GET",
"uri": uri("https://example.com/foo"),
"version": (1, 1),
"headers": [
("HOST", "exam... | 15 | 357 |
gunicorn | tests/requests/valid/029.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
request = {
"method": "GET",
"uri": uri("/stuff/here?foo=bar"),
"version": (1, 1),
"headers": [
('TRANSFER-ENCODING', 'identity'),
... | 19 | 385 |
gunicorn | tests/requests/valid/008.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/unusual_content_length"),
"version": (1, 0),
"headers": [
("CONTENT-LENGTH", "5")
],
"body": b"HELLO"
}
| 14 | 284 |
gunicorn | tests/requests/valid/100.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("///keeping_slashes"),
"version": (1, 1),
"headers": [],
"body": b""
}
| 12 | 237 |
gunicorn | tests/requests/valid/007.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "GET",
"uri": uri("/get_one_header_no_body"),
"version": (1, 1),
"headers": [
("ACCEPT", "*/*")
],
"body": b""
}
| 14 | 273 |
gunicorn | scripts/build_settings_doc.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Generate the Markdown settings reference for MkDocs."""
from __future__ import annotations
import inspect
import textwrap
from pathlib import Path
from typing import List
import re
import gunicorn.config as g... | 259 | 8,584 |
gunicorn | scripts/update_thanks.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
#!/usr/bin/env python
# Usage: git log --format="%an <%ae>" | python update_thanks.py
# You will get a result.txt file, you can work with the file (update, remove, ...)
#
# Install
# =======
# pip install validate_... | 45 | 1,186 |
gunicorn | examples/boot_fail.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
raise RuntimeError("Bad app!")
def app(environ, start_response):
assert 1 == 2, "Shouldn't get here."
| 9 | 213 |
gunicorn | examples/sendfile.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
#
# Example code from Eventlet sources
import os
from wsgiref.validate import validator
# @validator # breaks sendfile
def app(environ, start_response):
"""Simplest possible application object"""
status ... | 24 | 583 |
gunicorn | examples/echo.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
#
# Example code from Eventlet sources
from gunicorn import __version__
def app(environ, start_response):
"""Simplest possible application object"""
if environ['REQUEST_METHOD'].upper() != 'POST':
... | 27 | 654 |
gunicorn | examples/read_django_settings.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
Use this config file in your script like this:
$ gunicorn project_name.wsgi:application -c read_django_settings.py
"""
settings_dict = {}
with open('frameworks/django/testing/testing/settings.py') as f:
... | 24 | 509 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.