fixed bug with HTTP status code for Not Modified
This commit is contained in:
@@ -1,18 +1,15 @@
|
|||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
MAINTAINER Oggioni Walter <oggioni.walter@gmail.com>
|
MAINTAINER Oggioni Walter <oggioni.walter@gmail.com>
|
||||||
#ADD ../dist/md2html-0.2-py3-none-any.whl /
|
|
||||||
#COPY md2html-*.whl /
|
|
||||||
ADD md2html-*.whl /
|
|
||||||
RUN apk update
|
RUN apk update
|
||||||
RUN apk add python3 uwsgi uwsgi-python3
|
RUN apk add python3 uwsgi uwsgi-python3
|
||||||
RUN pip3 install /md2html-*.whl && rm /*.whl
|
|
||||||
RUN mkdir /srv/http
|
RUN mkdir /srv/http
|
||||||
VOLUME /srv/http
|
VOLUME /srv/http
|
||||||
WORKDIR /srv/http
|
WORKDIR /srv/http
|
||||||
|
ADD md2html-*.whl /
|
||||||
|
RUN pip3 install /md2html-*.whl && rm /md2html-*.whl
|
||||||
ENTRYPOINT ["uwsgi"]
|
ENTRYPOINT ["uwsgi"]
|
||||||
EXPOSE 1180/tcp
|
EXPOSE 1180/tcp
|
||||||
EXPOSE 1180/udp
|
EXPOSE 1180/udp
|
||||||
USER nobody
|
USER nobody
|
||||||
CMD ["--plugin", "/usr/lib/uwsgi/python_plugin.so", "-s", ":1180", "-w", "md2html.uwsgi"]
|
CMD ["--plugin", "/usr/lib/uwsgi/python_plugin.so", "-s", ":1180", "-w", "md2html.uwsgi"]
|
||||||
#RUN useradd luser -s /bin/bash -m -G users
|
|
||||||
|
|
||||||
|
@@ -51,29 +51,25 @@ def application(env, start_response):
|
|||||||
|
|
||||||
etag = parse_etag(env.get('HTTP_IF_NONE_MATCH'))
|
etag = parse_etag(env.get('HTTP_IF_NONE_MATCH'))
|
||||||
if etag and etag == digest:
|
if etag and etag == digest:
|
||||||
start_response('301 Not Modified', [
|
start_response('304 Not Modified', [
|
||||||
('Content-Type', 'text/html'),
|
('Etag', '"%s"' % (digest)),
|
||||||
('Content-Length', str(0)),
|
|
||||||
('Cache-Control', 'no-cache, must-revalidate, max-age=86400'),
|
('Cache-Control', 'no-cache, must-revalidate, max-age=86400'),
|
||||||
('Connection', 'keep-alive')
|
|
||||||
])
|
])
|
||||||
return []
|
return []
|
||||||
else:
|
else:
|
||||||
body = compile_html(path, ['extra', 'smarty', 'tables']).encode()
|
body = compile_html(path, ['extra', 'smarty', 'tables']).encode()
|
||||||
start_response('200 OK', [('Content-Type', 'text/html'),
|
start_response('200 OK', [('Content-Type', 'text/html'),
|
||||||
('Content-Length', str(len(body))),
|
('Etag', '"%s"' % (digest)),
|
||||||
('Etag', '"%s"' % digest),
|
|
||||||
('Cache-Control', 'no-cache, must-revalidate, max-age=86400'),
|
('Cache-Control', 'no-cache, must-revalidate, max-age=86400'),
|
||||||
('Connection', 'keep-alive'),
|
|
||||||
])
|
])
|
||||||
return [body]
|
return [body]
|
||||||
elif isdir(path):
|
elif isdir(path):
|
||||||
body = directory_listing(env['PATH_INFO'], path).encode()
|
body = directory_listing(env['PATH_INFO'], path).encode()
|
||||||
start_response('200 OK', [
|
start_response('200 OK', [
|
||||||
('Content-Type', 'text/html'), ('Content-Length', str(len(body))), ('Connection', 'keep-alive'),
|
('Content-Type', 'text/html'),
|
||||||
])
|
])
|
||||||
return [body]
|
return [body]
|
||||||
start_response('404 NOT_FOUND', [('Content-Length', str(0)), ('Connection', 'keep-alive')])
|
start_response('404 NOT_FOUND', [])
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user