summaryrefslogtreecommitdiff
path: root/cherrypy/lib/httputil.py
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Merged in MichielOvertoom/cherrypyfixticketurls2 (pull request #11)Jason R. Coombs2012-12-051-1/+1
|\
| * Fix ticket URLs from http://www.cherrypy.org/ticket/XYZ toMichiel Overtoom2012-06-211-1/+1
| | | | | | | | https://bitbucket.org/cherrypy/cherrypy/issue/XYZ
| * Fixed issue in HeaderElement.__str__ where it could sometimes return a ↵Jason R. Coombs2012-04-061-1/+1
| | | | | | | | non-native string.
| * Removed trailing whitespace from the codebase.Gustavo Picon2012-04-031-69/+69
| | | | | | | | sed -i '' -e 's/ *$//' `find cherrypy -name '*.py'`
* | Extract 'encode_header_items' classmethod from HeaderMap.output. Now another ↵Jason R. Coombs2012-10-271-11/+17
| | | | | | | | | | | | | | | | | | function can prepare a header list the same way _cprequest does in .finalize. Updated customheaders documentation to use the new .encode_header_items to ensure the example doesn't fail on Python 3 with a TypeError. Fixes #1177. --HG-- branch : cherrypy-3.2.x
* | Fixed issue in HeaderElement.__str__ where it could sometimes return a ↵Jason R. Coombs2012-04-061-1/+1
| | | | | | | | | | | | | | non-native string. --HG-- branch : cherrypy-3.2.x
* | Removed trailing whitespace from the codebase.Gustavo Picon2012-04-031-69/+69
|/ | | | | | | sed -i '' -e 's/ *$//' `find cherrypy -name '*.py'` --HG-- branch : cherrypy-3.2.x
* Bye bye, py2/3.Robert Brewer2011-07-021-0/+506
|
* Bringing python3 back into trunk with its own py3 folder; what was in trunk ↵trunkRobert Brewer2011-02-251-469/+0
| | | | goes in the py2 folder, and we can use a single setup.py to install either, depending on the version of Python that runs setup.py install.
* Last few 3.2 tweaksRobert Brewer2011-02-251-1/+0
|
* Freeow. The magic cherrypy/_cpcompat.py module to take all our py3k fears away.Robert Brewer2011-02-241-16/+14
|
* Fix for #1003 (Security issue: HTTPRedirect exception can be used to inject ↵Robert Brewer2011-02-211-21/+44
| | | | headers). Fixed the hole in all headers, not just redirect Location.
* Sphinx docs in cherrypy.lib.*chbrown2010-02-241-16/+19
|
* Fix for #918 (caching does not respect Cache-Control: max-age header).Robert Brewer2009-08-191-0/+4
|
* Meh. Not much use for py3util now.Robert Brewer2009-06-151-3/+3
|
* Some syncs with python3.Robert Brewer2009-06-141-21/+27
|
* Moved RFC-2047 encoding back from wsgiserver to http lib. WSGI headers MUST ↵Robert Brewer2009-06-131-2/+27
| | | | be byte strings!
* trunk: A bunch more alignments between trunk and python3 syntax.Robert Brewer2009-06-021-9/+10
|
* Brought trunk up to par with the encoding changes from the python3 branch.Robert Brewer2009-06-011-6/+51
|
* Mostly-working _cpreqbody for Python 2.x.Robert Brewer2009-05-311-34/+9
|
* trunk - backport for [2212] - Moved response header encoding from app to server.Lakin Wecker2009-05-311-21/+1
|
* trunk - Porting the cherrypy.lib.httputil name change. It'll be easier to ↵Lakin Wecker2009-05-311-0/+410
maintain two released branches if the modules are named the same. However, in the 2.6 branch we'll leave cherrypy.lib.http working and deprecate it for 3.3.