summaryrefslogtreecommitdiff
path: root/cherrypy/lib/httputil.py
Commit message (Collapse)AuthorAgeFilesLines
* Don't convert bytes headers to strSviatoslav Sydorenko2018-09-051-1/+1
|\ | | | | PR #1736 by @tobiashenkel
| * Don't convert bytes headers to strTobias Henkel2018-09-041-1/+1
| | | | | | | | | | Don't convert bytes header values using str() as str(b'foo') becomes "b'foo'". Instead just leave bytes as is like it was prior to v18.0.0.
* | Use urllib.parseJason R. Coombs2018-09-041-1/+1
|/
* Remove more references to six in doctestJason R. Coombs2018-09-021-5/+5
|
* Remove reliance on sixJason R. Coombs2018-09-021-17/+12
|
* Consolidate header item encoding.Jason R. Coombs2018-08-191-14/+11
|
* Reorder operationsJason R. Coombs2018-08-191-3/+3
|
* Use 'string_types' when encoding headers.Jason R. Coombs2018-08-191-3/+2
|
* Replace the one use of unquote_qs with invocations of the stdlib functions.Jason R. Coombs2018-08-131-3/+3
|
* Fail with HTTP 400 for invalid headersSviatoslav Sydorenko2018-05-281-1/+16
| | | | | | | | | | Test malformed Accept-Charset quality values. Fixes #1370 Closes #1707 Co-authored-by: Zach Seils (seils) <seils@cisco.com> Co-authored-by: Zach Seils <zachseils@gmail.com>
* Use bytes literals where appropriatev14.0.0Jason R. Coombs2018-02-041-5/+5
|
* Merge branch 'master' into feature/reuse-case-insensitive-dictJason R. Coombs2017-12-171-11/+10
|\
| * Get cmp from builtinsJason R. Coombs2017-10-291-4/+4
| |
| * Honor E302Jason R. Coombs2017-10-291-1/+3
| |
| * Regarding E305, honor the style guide rather than suppressing errors.Jason R. Coombs2017-10-291-1/+2
| |
| * Python2.7 exposes header module as email.headerJason R. Coombs2017-10-281-5/+1
| |
* | For now inline the implementation until it can be linked. Ref #1673.Jason R. Coombs2017-12-171-3/+62
| |
* | Use jaraco.collections for code re-use on CaseInsensitiveDict. Fixes #1231.Jason R. Coombs2017-10-281-37/+6
|/
* Remove long-deprecated legacy 'has_any' methods on mappings.Jason R. Coombs2017-10-281-4/+0
|
* Add doctest for cherrypy.lib.httputil.valid_statusSviatoslav Sydorenko2017-10-201-0/+7
|
* Refactor docstring of cp.lib.httputil.valid_statusSviatoslav Sydorenko2017-10-201-3/+4
|
* Improve invalid status checksSviatoslav Sydorenko2017-10-201-1/+1
|
* Fix for http.client status codes.Aric Coady2017-10-191-9/+4
|
* Create function for conditionally decoding the textJason R. Coombs2017-09-261-0/+7
|
* Convert doc to doctestJason R. Coombs2017-09-261-1/+6
|
* Mark docstrings with slash escaping as raw str (PR #1610 by @scop)Ville Skyttä2017-07-101-1/+1
| | | | * https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior (Python 3.6 invalid escape sequence deprecation)
* Just use range as if on Python 3Jason R. Coombs2017-07-091-2/+3
|
* Use six for http importsJason R. Coombs2017-07-091-1/+2
|
* Remove 'sorted' and 'reversed' from _cp_compatJason R. Coombs2017-07-091-1/+1
|
* Replace iteritems with six usage.Jason R. Coombs2017-07-081-2/+2
|
* PEP8fy codebase: eliminated F821 flake8 errorSviatoslav Sydorenko2017-03-121-5/+5
|
* PEP8fy codebase: eliminated E111 flake8 errorSviatoslav Sydorenko2017-03-111-2/+2
|
* PEP8fy codebase: eliminated E302 flake8 errorSviatoslav Sydorenko2017-03-111-1/+1
|
* PEP8fy codebase: eliminated E305 flake8 errorSviatoslav Sydorenko2017-03-111-1/+1
|
* fixed a bunch of documentation warningsRick van Hattem2017-02-071-1/+1
|
* Convert all strings to conform single-quoted styleSviatoslav Sydorenko2016-09-081-33/+33
| | | | pre-commit run double-quote-string-fixer --all-files
* Fix E402 in lib/httputilSviatoslav Sydorenko2016-09-081-8/+8
|
* Use decorators where appropriate.Jason R. Coombs2016-08-031-7/+8
|
* Use the preferred name text_or_bytes to avoid conflation with 'basestring' ↵Jason R. Coombs2016-07-241-2/+2
| | | | which has no equivalent on Python 3.
* Use correct, but poorly-named parameter.Jason R. Coombs2016-07-241-1/+1
|
* Move HTTPDate to httputil, where it's actually exposed.Jason R. Coombs2016-07-241-1/+6
|
* Replaced 'unicodestr' with 'six.text_type'Jason R. Coombs2016-06-051-4/+6
|
* Remove use of bytestr and nativestr, which can be represented by 'bytes' and ↵Jason R. Coombs2016-06-051-2/+2
| | | | 'str' respectively now that Python 2.5 is not supported.
* Fix for issue #1397Jürn Brodersen2016-06-051-16/+2
|
* Replace references to bitbucket tickets with references to github tickets. ↵Jason R. Coombs2016-04-301-1/+1
| | | | Ref #1410.
* Fixing HTTP range headers for negative length larger than content size.Philip Zeyliger2014-07-281-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the RFC, clients are allows to request the "last N bytes", even if N is actually larger than the content size. Here's the relevant section: RFC 2616 Section 14.35.1: If the entity is shorter than the specified suffix-length, the entire entity-body is used. httpd follows this just fine. test.txt is only 11 bytes long, but if we request 500 bytes, we do fine: $ curl http://www.sf.cloudera.com/~philip/test.txt -r -500 -v > GET /~philip/test.txt HTTP/1.1 > Range: bytes=-500 > User-Agent: curl/7.30.0 > Host: www.sf.cloudera.com > Accept: */* > < HTTP/1.1 206 Partial Content < Date: Fri, 25 Jul 2014 23:31:39 GMT < Server: Apache/2.2.15 (CentOS) < Last-Modified: Fri, 25 Jul 2014 23:14:01 GMT < ETag: "221772d-b-4ff0cba900ab6" < Accept-Ranges: bytes < Content-Length: 11 < Content-Range: bytes 0-10/11 < Connection: close < Content-Type: text/plain; charset=UTF-8 < 1234567890 However, cherrypy would fail in this case. $curl -v http://localhost:8080/test.txt -r -100 > GET /test.txt HTTP/1.1 > Range: bytes=-100 > User-Agent: curl/7.30.0 > Host: localhost:8080 > Accept: */* > < HTTP/1.1 500 Internal Server Error < Content-Length: 1104 < Server: CherryPy/3.5.1 < Date: Mon, 28 Jul 2014 16:22:11 GMT < Content-Type: text/html;charset=utf-8 < [...] <title>500 Internal Server Error</title> [...] <pre id="traceback">Traceback (most recent call last): File "/Users/philip/src/cherrypy/cherrypy/_cprequest.py", line 667, in respond self.hooks.run('before_handler') File "/Users/philip/src/cherrypy/cherrypy/_cprequest.py", line 114, in run raise exc IOError: [Errno 22] Invalid argument [...] With this commit, cherrypy now works fine: $curl -v http://localhost:8080/test.txt -r -100 > GET /test.txt HTTP/1.1 > Range: bytes=-100 > User-Agent: curl/7.30.0 > Host: localhost:8080 > Accept: */* > < HTTP/1.1 206 Partial Content < Content-Length: 11 < Accept-Ranges: bytes < Server: CherryPy/3.5.1 < Last-Modified: Mon, 28 Jul 2014 16:20:47 GMT < Content-Range: bytes 0-10/11 < Date: Mon, 28 Jul 2014 16:25:46 GMT < Content-Type: text/plain < 0123456789 The above is run with the below minimalist script. import cherrypy import os class X(object): pass if __name__ == '__main__': conf = { '/': { 'tools.staticdir.on': True, 'tools.staticdir.root': os.path.abspath(os.getcwd()), 'tools.staticdir.dir': './' } } cherrypy.quickstart(X(), '/', conf) I've added a simple test to check this case and have run it with "nosetests -s test/test_core.py".
* Although already fixed, use the submitted regular expression to simplify ↵Allan Crooks2014-04-161-34/+2
| | | | | | | code to correctly parse headers which have quotas in their field value. Fixes #1079. Simplified code submitted by holm@podio.com. This ticket is linked to #1146.
* Don't split headers on commas contained between quotes. Fixes #1146.Allan Crooks2014-04-151-1/+33
|
* More PEP8 work.Gustavo Picon2014-01-121-4/+6
|
* Running: autopep8 -vvvvv -i `find . -name '*.py'`Gustavo Picon2014-01-121-10/+25
| | | | | --HG-- branch : autopep8