mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
fix all libpathod->pathod references
This commit is contained in:
parent
d95a1f9819
commit
1785f70a19
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
pygmentize -f html ../examples/test_context.py > ../libpathod/templates/examples_context.html
|
||||
pygmentize -f html ../examples/test_setup.py > ../libpathod/templates/examples_setup.html
|
||||
pygmentize -f html ../examples/test_setupall.py > ../libpathod/templates/examples_setupall.html
|
||||
pygmentize -f html ../examples/libpathod_pathoc.py > ../libpathod/templates/libpathod_pathoc.html
|
||||
pygmentize -f html ../examples/test_context.py > ../pathod/templates/examples_context.html
|
||||
pygmentize -f html ../examples/test_setup.py > ../pathod/templates/examples_setup.html
|
||||
pygmentize -f html ../examples/test_setupall.py > ../pathod/templates/examples_setupall.html
|
||||
pygmentize -f html ../examples/pathod_pathoc.py > ../pathod/templates/pathod_pathoc.html
|
||||
|
@ -1,2 +1,2 @@
|
||||
graft libpathod
|
||||
graft pathod
|
||||
recursive-exclude * *.pyc *.pyo *.swo *.swp *.map
|
@ -8,7 +8,7 @@ clients and servers. The project has three components:
|
||||
|
||||
- ``pathod``, an pathological HTTP daemon.
|
||||
- ``pathoc``, a perverse HTTP client.
|
||||
- ``libpathod.test``, an API for easily using pathod and pathoc in unit tests.
|
||||
- ``pathod.test``, an API for easily using pathod and pathoc in unit tests.
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from libpathod import pathoc_cmdline as cmdline
|
||||
from pathod import pathoc_cmdline as cmdline
|
||||
|
||||
if __name__ == "__main__":
|
||||
cmdline.go_pathoc()
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from libpathod import pathod_cmdline as cmdline
|
||||
from pathod import pathod_cmdline as cmdline
|
||||
|
||||
if __name__ == "__main__":
|
||||
cmdline.go_pathod()
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
from libpathod import pathoc
|
||||
from pathod import pathoc
|
||||
|
||||
p = pathoc.Pathoc(("google.com", 80))
|
||||
p.connect()
|
||||
|
@ -1,5 +1,5 @@
|
||||
import requests
|
||||
from libpathod import test
|
||||
from pathod import test
|
||||
|
||||
|
||||
def test_simple():
|
||||
|
@ -1,5 +1,5 @@
|
||||
import requests
|
||||
from libpathod import test
|
||||
from pathod import test
|
||||
|
||||
|
||||
class Test:
|
||||
|
@ -1,5 +1,5 @@
|
||||
import requests
|
||||
from libpathod import test
|
||||
from pathod import test
|
||||
|
||||
|
||||
class Test:
|
||||
|
@ -86,10 +86,10 @@ def make_app(noapi, debug):
|
||||
"docs_pathoc.html", True, section="docs", subsection="pathoc"
|
||||
)
|
||||
|
||||
@app.route('/docs/libpathod')
|
||||
def docs_libpathod():
|
||||
@app.route('/docs/lib_pathod')
|
||||
def docs_lib_pathod():
|
||||
return render(
|
||||
"docs_libpathod.html", True, section="docs", subsection="libpathod"
|
||||
"docs_lib_pathod.html", True, section="docs", subsection="pathod"
|
||||
)
|
||||
|
||||
@app.route('/docs/test')
|
||||
|
@ -14,8 +14,8 @@
|
||||
<li {{subs( "pathod")}}><a href="/docs/pathod">pathod</a></li>
|
||||
<li {{subs( "pathoc")}}><a href="/docs/pathoc">pathoc</a></li>
|
||||
<li {{subs( "lang")}}><a href="/docs/language">language</a></li>
|
||||
<li {{subs( "libpathod")}}><a href="/docs/libpathod">libpathod</a></li>
|
||||
<li {{subs( "test")}}><a href="/docs/test">libpathod.test</a></li>
|
||||
<li {{subs( "pathod")}}><a href="/docs/pathod">pathod</a></li>
|
||||
<li {{subs( "test")}}><a href="/docs/test">pathod.test</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends "docframe.html" %} {% block body %}
|
||||
<div class="page-header">
|
||||
<h1>
|
||||
libpathod
|
||||
pathod
|
||||
<small>Using pathod and pathoc in code.</small>
|
||||
</h1>
|
||||
</div>
|
||||
@ -9,7 +9,7 @@
|
||||
<div class="row">
|
||||
<div class="span6">
|
||||
<p>
|
||||
Behind the pathod and pathoc command-line tools lurks <b>libpathod</b>,
|
||||
Behind the pathod and pathoc command-line tools lurks <b>pathod</b>,
|
||||
a powerful library for manipulating and serving HTTP requests and responses.
|
||||
The canonical documentation for the library is in the code, and can be
|
||||
accessed using pydoc.
|
||||
@ -17,7 +17,7 @@
|
||||
</div>
|
||||
<div class="span6">
|
||||
<h1>pathoc</h1>
|
||||
{% include "libpathod_pathoc.html" %}
|
||||
{% include "pathod_pathoc.html" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -1,12 +1,12 @@
|
||||
{% extends "docframe.html" %} {% block body %}
|
||||
<div class="page-header">
|
||||
<h1>
|
||||
libpathod.test
|
||||
<small>Using libpathod in unit tests.</small>
|
||||
pathod.test
|
||||
<small>Using pathod in unit tests.</small>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<p>The <b>libpathod.test</b> module is a light, flexible testing layer for HTTP clients.
|
||||
<p>The <b>pathod.test</b> module is a light, flexible testing layer for HTTP clients.
|
||||
It works by firing up a Pathod instance in a separate thread, letting you use
|
||||
Pathod's full abilities to generate responses, and then query Pathod's internal
|
||||
logs to establish what happened. All the mechanics of startup, shutdown, finding
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
<p>The canonical docs can be accessed using pydoc: </p>
|
||||
|
||||
<pre class="terminal">pydoc libpathod.test</pre>
|
||||
<pre class="terminal">pydoc pathod.test</pre>
|
||||
|
||||
<p>
|
||||
The remainder of this page demonstrates some common interaction patterns using
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="highlight"><pre><span class="kn">import</span> <span class="nn">requests</span>
|
||||
<span class="kn">from</span> <span class="nn">libpathod</span> <span class="kn">import</span> <span class="n">test</span>
|
||||
<span class="kn">from</span> <span class="nn">pathod</span> <span class="kn">import</span> <span class="n">test</span>
|
||||
|
||||
|
||||
<span class="k">def</span> <span class="nf">test_simple</span><span class="p">():</span>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="highlight"><pre><span class="kn">import</span> <span class="nn">requests</span>
|
||||
<span class="kn">from</span> <span class="nn">libpathod</span> <span class="kn">import</span> <span class="n">test</span>
|
||||
<span class="kn">from</span> <span class="nn">pathod</span> <span class="kn">import</span> <span class="n">test</span>
|
||||
|
||||
|
||||
<span class="k">class</span> <span class="nc">Test</span><span class="p">:</span>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="highlight"><pre><span class="kn">import</span> <span class="nn">requests</span>
|
||||
<span class="kn">from</span> <span class="nn">libpathod</span> <span class="kn">import</span> <span class="n">test</span>
|
||||
<span class="kn">from</span> <span class="nn">pathod</span> <span class="kn">import</span> <span class="n">test</span>
|
||||
|
||||
|
||||
<span class="k">class</span> <span class="nc">Test</span><span class="p">:</span>
|
||||
|
@ -1,8 +0,0 @@
|
||||
<div class="highlight"><pre><span class="c">#!/usr/bin/env python</span>
|
||||
<span class="kn">from</span> <span class="nn">libpathod</span> <span class="kn">import</span> <span class="n">pathoc</span>
|
||||
|
||||
<span class="n">p</span> <span class="o">=</span> <span class="n">pathoc</span><span class="o">.</span><span class="n">Pathoc</span><span class="p">((</span><span class="s">"google.com"</span><span class="p">,</span> <span class="mi">80</span><span class="p">))</span>
|
||||
<span class="n">p</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
|
||||
<span class="k">print</span> <span class="n">p</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="s">"get:/"</span><span class="p">)</span>
|
||||
<span class="k">print</span> <span class="n">p</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="s">"get:/foo"</span><span class="p">)</span>
|
||||
</pre></div>
|
@ -9,7 +9,7 @@ import sys
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
sys.path.append(os.path.join(here, "..", "netlib"))
|
||||
from libpathod import version
|
||||
from pathod import version
|
||||
|
||||
with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
|
||||
long_description = f.read()
|
||||
@ -42,8 +42,8 @@ setup(
|
||||
include_package_data=True,
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
"pathod = libpathod.pathod_cmdline:go_pathod",
|
||||
"pathoc = libpathod.pathoc_cmdline:go_pathoc"
|
||||
"pathod = pathod.pathod_cmdline:go_pathod",
|
||||
"pathoc = pathod.pathoc_cmdline:go_pathoc"
|
||||
]
|
||||
},
|
||||
install_requires=[
|
||||
|
@ -8,7 +8,7 @@ from mitmproxy.proxy.config import process_proxy_options
|
||||
from mitmproxy.models.connections import ServerConnection
|
||||
from mitmproxy.proxy.server import DummyServer, ProxyServer, ConnectionHandler
|
||||
from netlib.exceptions import TcpDisconnect
|
||||
from libpathod import test
|
||||
from pathod import test
|
||||
from netlib.http import http1
|
||||
from . import tutils
|
||||
|
||||
|
@ -10,7 +10,7 @@ from netlib import tcp, http, socks
|
||||
from netlib.certutils import SSLCert
|
||||
from netlib.http import authentication, CONTENT_MISSING, http1
|
||||
from netlib.tutils import raises
|
||||
from libpathod import pathoc, pathod
|
||||
from pathod import pathoc, pathod
|
||||
|
||||
from mitmproxy.proxy.config import HostMatcher
|
||||
from mitmproxy.protocol import Kill
|
||||
|
@ -6,8 +6,8 @@ import mock
|
||||
|
||||
from mitmproxy.proxy.config import ProxyConfig
|
||||
from mitmproxy.proxy.server import ProxyServer
|
||||
import libpathod.test
|
||||
import libpathod.pathoc
|
||||
import pathod.test
|
||||
import pathod.pathoc
|
||||
from mitmproxy import flow, controller
|
||||
from mitmproxy.cmdline import APP_HOST, APP_PORT
|
||||
|
||||
@ -89,10 +89,10 @@ class ProxTestBase(object):
|
||||
|
||||
@classmethod
|
||||
def setup_class(cls):
|
||||
cls.server = libpathod.test.Daemon(
|
||||
cls.server = pathod.test.Daemon(
|
||||
ssl=cls.ssl,
|
||||
ssloptions=cls.ssloptions)
|
||||
cls.server2 = libpathod.test.Daemon(
|
||||
cls.server2 = pathod.test.Daemon(
|
||||
ssl=cls.ssl,
|
||||
ssloptions=cls.ssloptions)
|
||||
|
||||
@ -135,13 +135,13 @@ class ProxTestBase(object):
|
||||
class HTTPProxTest(ProxTestBase):
|
||||
|
||||
def pathoc_raw(self):
|
||||
return libpathod.pathoc.Pathoc(("127.0.0.1", self.proxy.port), fp=None)
|
||||
return pathod.pathoc.Pathoc(("127.0.0.1", self.proxy.port), fp=None)
|
||||
|
||||
def pathoc(self, sni=None):
|
||||
"""
|
||||
Returns a connected Pathoc instance.
|
||||
"""
|
||||
p = libpathod.pathoc.Pathoc(
|
||||
p = pathod.pathoc.Pathoc(
|
||||
("localhost", self.proxy.port), ssl=self.ssl, sni=sni, fp=None
|
||||
)
|
||||
if self.ssl:
|
||||
@ -164,7 +164,7 @@ class HTTPProxTest(ProxTestBase):
|
||||
|
||||
def app(self, page):
|
||||
if self.ssl:
|
||||
p = libpathod.pathoc.Pathoc(
|
||||
p = pathod.pathoc.Pathoc(
|
||||
("127.0.0.1", self.proxy.port), True, fp=None
|
||||
)
|
||||
p.connect((APP_HOST, APP_PORT))
|
||||
@ -224,7 +224,7 @@ class TransparentProxTest(ProxTestBase):
|
||||
"""
|
||||
Returns a connected Pathoc instance.
|
||||
"""
|
||||
p = libpathod.pathoc.Pathoc(
|
||||
p = pathod.pathoc.Pathoc(
|
||||
("localhost", self.proxy.port), ssl=self.ssl, sni=sni, fp=None
|
||||
)
|
||||
p.connect()
|
||||
@ -248,7 +248,7 @@ class ReverseProxTest(ProxTestBase):
|
||||
"""
|
||||
Returns a connected Pathoc instance.
|
||||
"""
|
||||
p = libpathod.pathoc.Pathoc(
|
||||
p = pathod.pathoc.Pathoc(
|
||||
("localhost", self.proxy.port), ssl=self.ssl, sni=sni, fp=None
|
||||
)
|
||||
p.connect()
|
||||
|
@ -21,7 +21,7 @@ class TestApp(tutils.DaemonTests):
|
||||
assert self.getpath("/docs/pathod").status_code == 200
|
||||
assert self.getpath("/docs/pathoc").status_code == 200
|
||||
assert self.getpath("/docs/language").status_code == 200
|
||||
assert self.getpath("/docs/libpathod").status_code == 200
|
||||
assert self.getpath("/docs/pathod").status_code == 200
|
||||
assert self.getpath("/docs/test").status_code == 200
|
||||
|
||||
def test_log(self):
|
||||
|
@ -1,7 +1,7 @@
|
||||
import cStringIO
|
||||
|
||||
from libpathod.language import actions
|
||||
from libpathod import language
|
||||
from pathod.language import actions
|
||||
from pathod import language
|
||||
|
||||
|
||||
def parse_request(s):
|
||||
|
@ -1,6 +1,6 @@
|
||||
import os
|
||||
from libpathod import language
|
||||
from libpathod.language import base, exceptions
|
||||
from pathod import language
|
||||
from pathod.language import base, exceptions
|
||||
import tutils
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import os
|
||||
|
||||
from libpathod.language import generators
|
||||
from pathod.language import generators
|
||||
import tutils
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import cStringIO
|
||||
|
||||
from libpathod import language
|
||||
from libpathod.language import http, base
|
||||
from pathod import language
|
||||
from pathod.language import http, base
|
||||
import tutils
|
||||
|
||||
|
||||
|
@ -4,8 +4,8 @@ import netlib
|
||||
from netlib import tcp
|
||||
from netlib.http import user_agents
|
||||
|
||||
from libpathod import language
|
||||
from libpathod.language import http2, base
|
||||
from pathod import language
|
||||
from pathod.language import http2, base
|
||||
import tutils
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
from libpathod import language
|
||||
from libpathod.language import websockets
|
||||
from pathod import language
|
||||
from pathod.language import websockets
|
||||
import netlib.websockets
|
||||
import tutils
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import cStringIO
|
||||
|
||||
from libpathod import language
|
||||
from libpathod.language import writer
|
||||
from pathod import language
|
||||
from pathod.language import writer
|
||||
|
||||
|
||||
def test_send_chunk():
|
||||
|
@ -1,5 +1,5 @@
|
||||
import StringIO
|
||||
from libpathod import log
|
||||
from pathod import log
|
||||
from netlib.exceptions import TcpDisconnect
|
||||
import netlib.tcp
|
||||
|
||||
|
@ -9,7 +9,7 @@ from netlib import tcp, http, socks
|
||||
from netlib.exceptions import HttpException, TcpException, NetlibException
|
||||
from netlib.http import http1, http2
|
||||
|
||||
from libpathod import pathoc, test, version, pathod, language
|
||||
from pathod import pathoc, test, version, pathod, language
|
||||
from netlib.tutils import raises
|
||||
import tutils
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from libpathod import pathoc_cmdline as cmdline
|
||||
from pathod import pathoc_cmdline as cmdline
|
||||
import tutils
|
||||
import cStringIO
|
||||
import mock
|
||||
|
@ -3,7 +3,7 @@ import cStringIO
|
||||
import OpenSSL
|
||||
import pytest
|
||||
|
||||
from libpathod import pathod, version
|
||||
from pathod import pathod, version
|
||||
from netlib import tcp, http
|
||||
from netlib.exceptions import HttpException, TlsException
|
||||
import tutils
|
||||
|
@ -1,4 +1,4 @@
|
||||
from libpathod import pathod_cmdline as cmdline
|
||||
from pathod import pathod_cmdline as cmdline
|
||||
import tutils
|
||||
import cStringIO
|
||||
import mock
|
||||
|
@ -1,6 +1,6 @@
|
||||
import logging
|
||||
import requests
|
||||
from libpathod import test
|
||||
from pathod import test
|
||||
import tutils
|
||||
logging.disable(logging.CRITICAL)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from libpathod import utils
|
||||
from pathod import utils
|
||||
import tutils
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@ import cStringIO
|
||||
from contextlib import contextmanager
|
||||
|
||||
import netlib
|
||||
from libpathod import utils, test, pathoc, pathod, language
|
||||
from pathod import utils, test, pathoc, pathod, language
|
||||
from netlib import tcp
|
||||
import requests
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user