.editorconfig
author Gregory Szorc <gregory.szorc@gmail.com>
Sat, 10 Mar 2018 10:48:34 -0800
changeset 36860 290fc4c3d1e0
parent 28793 d30fdd6d1bf7
child 38293 1d6066336d7b
permissions -rw-r--r--
hgweb: use a capped reader for WSGI input stream Per PEP 3333, the input stream from WSGI should respect EOF and prevent reads past the end of the request body. However, not all WSGI servers guarantee this. Notably, our BaseHTTPServer based built-in HTTP server doesn't. Instead, it exposes the raw socket and you can read() from it all you want, getting the connection in a bad state by doing so. We have a "cappedreader" utility class that proxies a file object and prevents reading past a limit. This commit converts the WSGI input stream into a capped reader when the input length is advertised via Content-Length headers. "cappedreader" only exposes a read() method. PEP 3333 states that the input stream MUST also support readline(), readlines(hint), and __iter__(). However, since our WSGI application code only calls read() and since we're not manipulating the stream exposed by the WSGI server, we're not violating the spec here. Differential Revision: https://phab.mercurial-scm.org/D2768
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28793
d30fdd6d1bf7 mercurial: add editorconfig
Jun Wu <quark@fb.com>
parents:
diff changeset
     1
# See http://EditorConfig.org for the specification
d30fdd6d1bf7 mercurial: add editorconfig
Jun Wu <quark@fb.com>
parents:
diff changeset
     2
d30fdd6d1bf7 mercurial: add editorconfig
Jun Wu <quark@fb.com>
parents:
diff changeset
     3
root = true
d30fdd6d1bf7 mercurial: add editorconfig
Jun Wu <quark@fb.com>
parents:
diff changeset
     4
d30fdd6d1bf7 mercurial: add editorconfig
Jun Wu <quark@fb.com>
parents:
diff changeset
     5
[*.py]
d30fdd6d1bf7 mercurial: add editorconfig
Jun Wu <quark@fb.com>
parents:
diff changeset
     6
indent_size = 4
d30fdd6d1bf7 mercurial: add editorconfig
Jun Wu <quark@fb.com>
parents:
diff changeset
     7
indent_style = space
d30fdd6d1bf7 mercurial: add editorconfig
Jun Wu <quark@fb.com>
parents:
diff changeset
     8
trim_trailing_whitespace = true
d30fdd6d1bf7 mercurial: add editorconfig
Jun Wu <quark@fb.com>
parents:
diff changeset
     9
d30fdd6d1bf7 mercurial: add editorconfig
Jun Wu <quark@fb.com>
parents:
diff changeset
    10
[*.{c,h}]
d30fdd6d1bf7 mercurial: add editorconfig
Jun Wu <quark@fb.com>
parents:
diff changeset
    11
indent_size = 8
d30fdd6d1bf7 mercurial: add editorconfig
Jun Wu <quark@fb.com>
parents:
diff changeset
    12
indent_style = tab
d30fdd6d1bf7 mercurial: add editorconfig
Jun Wu <quark@fb.com>
parents:
diff changeset
    13
trim_trailing_whitespace = true