This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: clean distclean install run | |
ENV ?= env | |
VENV = $(shell python -c "import sys; print(int(hasattr(sys, 'real_prefix')));") | |
ifeq ($(VENV),1) | |
GUNICORN = gunicorn | |
else | |
GUNICORN = $(ENV)/bin/gunicorn | |
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# habraproxy.py — это простейший http-прокси-сервер, запускаемый локально (порт на ваше | |
# усмотрение), который показывает содержимое страниц Хабра. С одним исключением: после | |
# каждого слова из шести букв должен стоять значок «™». Примерно так: | |
# | |
# http://habrahabr.ru/company/yandex/blog/258673/ | |
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
# Сейчас на фоне уязвимости Logjam все в индустрии в очередной раз обсуждают проблемы и | |
# особенности TLS. Я хочу воспользоваться этой возможностью, чтобы поговорить об одной из | |
# них, а именно — о настройке ciphersiutes. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xml.sax | |
import xml.sax.handler | |
import re | |
class BodyNotFound(Exception): | |
pass | |
class BookHandler(xml.sax.handler.ContentHandler): | |
def __init__(self): | |
self.inBody = False |