2020-06-22 23:53:39 +00:00
|
|
|
"""React to configuration changes."""
|
2022-04-26 11:53:23 +00:00
|
|
|
from typing import Optional
|
All new documentation
This patch does a lot.
- Ditch sphinx in favor of hugo. This gives us complete control of the layout
and presentation of our docs. Henceforth, docs will be hosted on our website
rather than ReadTheDocs.
- Create a simple, clean doc layout and theme.
- Remove large parts of the documentaion. I've ditched anything that was a)
woefully out of date, b) too detailed, or c) too hard to maintain in the long
term.
- Huge updates to the docs themselves: completely rewrite addons documentation,
add docs for core concepts like commands and options, and revise and tweak a
lot of the existing docs.
With this patch, we're also changing the way we publish and maintain the docs.
From now on, we don't publish docs for every release. Instead, the website will
contain ONE set of docs for each major release. The online docs will be updated
if needed as minor releases are made. Docs are free to improve during minor
releases, but anything that changes behaviour sufficiently to require a doc
change warrants a new major release. This also leaves us free to progressively
update and improve docs out of step with our release cadence.
With this new scheme, I feel CI over the docs is less important. I've removed
it for now, but won't object if someone wants to add it back in.
2018-02-22 04:21:34 +00:00
|
|
|
|
|
|
|
from mitmproxy import ctx
|
|
|
|
from mitmproxy import exceptions
|
|
|
|
|
|
|
|
|
|
|
|
class AddHeader:
|
|
|
|
def load(self, loader):
|
|
|
|
loader.add_option(
|
|
|
|
name = "addheader",
|
2022-04-26 11:53:23 +00:00
|
|
|
typespec = Optional[int],
|
All new documentation
This patch does a lot.
- Ditch sphinx in favor of hugo. This gives us complete control of the layout
and presentation of our docs. Henceforth, docs will be hosted on our website
rather than ReadTheDocs.
- Create a simple, clean doc layout and theme.
- Remove large parts of the documentaion. I've ditched anything that was a)
woefully out of date, b) too detailed, or c) too hard to maintain in the long
term.
- Huge updates to the docs themselves: completely rewrite addons documentation,
add docs for core concepts like commands and options, and revise and tweak a
lot of the existing docs.
With this patch, we're also changing the way we publish and maintain the docs.
From now on, we don't publish docs for every release. Instead, the website will
contain ONE set of docs for each major release. The online docs will be updated
if needed as minor releases are made. Docs are free to improve during minor
releases, but anything that changes behaviour sufficiently to require a doc
change warrants a new major release. This also leaves us free to progressively
update and improve docs out of step with our release cadence.
With this new scheme, I feel CI over the docs is less important. I've removed
it for now, but won't object if someone wants to add it back in.
2018-02-22 04:21:34 +00:00
|
|
|
default = None,
|
|
|
|
help = "Add a header to responses",
|
|
|
|
)
|
|
|
|
|
|
|
|
def configure(self, updates):
|
|
|
|
if "addheader" in updates:
|
|
|
|
if ctx.options.addheader is not None and ctx.options.addheader > 100:
|
|
|
|
raise exceptions.OptionsError("addheader must be <= 100")
|
|
|
|
|
|
|
|
def response(self, flow):
|
|
|
|
if ctx.options.addheader is not None:
|
|
|
|
flow.response.headers["addheader"] = str(ctx.options.addheader)
|
|
|
|
|
|
|
|
|
|
|
|
addons = [
|
|
|
|
AddHeader()
|
|
|
|
]
|