summaryrefslogtreecommitdiff
path: root/webob
Commit message (Collapse)AuthorAgeFilesLines
* FieldStorage.read_multi needs fixup until Python bug 27777 is closedbugfix/cgi_FieldStorageBert JW Regeer2016-11-181-9/+7
|
* Add workaround for Python bug 27777Bert JW Regeer2016-11-171-52/+72
| | | | This also fixes Python bug 24764.
* Update documentation indentationBert JW Regeer2016-11-171-3/+3
|
* Remove key from Response.set_cookieBert JW Regeer2016-11-171-6/+1
| | | | We are upon WebOb 1.7
* Fix Response.__init__ documentationBert JW Regeer2016-11-161-6/+6
| | | | Closes #288
* Update PATH_SAFE to include all safe characters from RFC3989Bert JW Regeer2016-11-161-1/+1
| | | | Closes #290
* Further content_type/charset cleanupsBert JW Regeer2016-10-021-29/+71
|
* HTTP Status code 205 also has no bodyBert JW Regeer2016-10-021-1/+1
|
* Making Location header absolute is now less costlyBert JW Regeer2016-10-021-14/+21
| | | | | | __call__ and conditional_response_app both wanted a copy of the headerlist anyway, so iterate and if we stumble upon a Location header, make it absolute.
* Speedup header deletionBert JW Regeer2016-09-301-4/+1
|
* Content-Type is not added if a headerlist is providedBert JW Regeer2016-09-301-31/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the user provides a headerlist, Response.__init__ will no longer attempt to set the default Content-Type, nor will __init__ add a charset to any existing Content-Type. The Content-Type will only be set if no headerlist is provided, and the HTTP status code allows for a body. The charset will be set only if there is no charset on the Content-Type provided. Response(headerlist=[], content_type='text/plain', charset='UTF-8') will have a headerlist that is: [('Content-Length', '0')] Response(status='204 No Content') will have a headerlist that is: [] __init__ will now also ignore body/app_iter if the status code has no body. Response(status='204 No Content', app_iter=[b'test']) Will not have a Content-Length, and .body will return b''. If you would like to violate HTTP standards, you may of course do: resp = Response(status='204 No Content') resp.body = b'test' __init__ won't let you create an invalid resonse, what you do with the returned response however is up to you.
* Skip the property, use the underlying val directlyBert JW Regeer2016-09-301-1/+1
|
* Use list comprehension to return listBert JW Regeer2016-09-301-5/+1
|
* Speed up __setitem__ in ResponseHeaderBert JW Regeer2016-09-301-4/+1
| | | | | | When removing existing entries, just create a new list and assign it to the old list. This is faster than calling del item[i] on the items we want removed.
* Teach Response about default_body_encodingBert JW Regeer2016-09-301-8/+19
| | | | | | | This is mainly used to allow users to continue using .text even with Content-Types that don't have a charset. Looking at you Pyramid...
* Merge pull request #283 from Pylons/fix/bodies_on_everythingBert JW Regeer2016-09-301-145/+174
|\ | | | | All request methods may now have a body
| * Update docstringfix/bodies_on_everythingBert JW Regeer2016-09-291-2/+2
| |
| * Add DeprecationWarning for FakeCGIBodyBert JW Regeer2016-09-291-0/+7
| | | | | | | | Closes #276
| * PEP8Bert JW Regeer2016-09-291-33/+36
| |
| * Invalid indentBert JW Regeer2016-09-291-1/+1
| |
| * Rework req.copy_body()Bert JW Regeer2016-09-291-44/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | copy_body() used to treat chunked encoding (or at least reading from wsgi.input without a valid Content-Length, could be user provided body_file_raw and didn't set Content-Length) with no consideration for the amount of data that could be on the other end. This could potentially allow for a VERY large python bytes() object to be allocated followed by a very large BytesIO(), which then one line later it would copy to a temporary file, damage already done. The new changes will read up to Content-Length if it is available, if not but the body is still marked readable, it will attempt to read from the input until it is exhausted. Up to req.request_body_tempfile_limit will be stored in a BytesIO, after that it will instead write it to a temporary file. So even if the other end is sending 100's of MB worth of data it won't blow up your Python process.
| * req.body gets some minor cleanupsBert JW Regeer2016-09-291-10/+10
| | | | | | | | You can now set req.body for any request method.
| * Remove http_method_probably_has_bodyBert JW Regeer2016-09-291-39/+25
| | | | | | | | | | | | This also changes req.from_file in that now it will attempt to read the entire file for the body if no Content-Length is set, even if the request method generally does not have a body (such as GET/DELETE).
| * Remove unused importsBert JW Regeer2016-09-291-3/+0
| |
| * Req.body_file no longer accepts bytesBert JW Regeer2016-09-291-14/+17
| | | | | | | | | | This has been deprecated since WebOb 1.2 and non-functional for a long time.
* | Move the _lazified class out of the lazify functionbugfix/exc_performanceBert JW Regeer2016-09-291-6/+11
|/ | | | | | | | | | | Capturing the function, and returning a new object from a class that is defined within the capturing function seems to cause some sort of really pathological behavior that causes lazify() to take up a bunch of CPU time, especially when it is part of a hot code path. Thanks to Martijn Faassen for reporting! Closes #282
* Make the TypeError text usefulBert JW Regeer2016-07-301-1/+2
| | | | Closes #119
* Update ResponseBodyFile.tell() to use public APIBert JW Regeer2016-07-301-3/+4
|
* Merge branch 'master' into pr/117Bert JW Regeer2016-07-3013-378/+1301
|\
| * Merge branch 'master' into pr/228Bert JW Regeer2016-07-303-127/+308
| |\
| | * Don't set charset if already setfix/charset_handlingBert JW Regeer2016-07-291-1/+1
| | | | | | | | | | | | | | | The charset provided to the constructor should not be used if a charset is already set on the Content-Type.
| | * Don't set Content-Type if headerlist is providedBert JW Regeer2016-07-291-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the caller provides the headerlist, we shouldn't try to be too smart and add in a default Content-Type. This is used by Request.get_response() for example to create a Response object that matches the Response received from a WSGI application. We do still add a default charset even if there is none provided on Content-Types that are known to allow for a charset (basically texty responses). This way Response.text will function without additional work.
| | * Remove :py from Sphinx declarationsBert JW Regeer2016-07-291-17/+17
| | |
| | * Change the logic for the content_type settingBert JW Regeer2016-07-291-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already state that if the headerlist contains a Content-Type, then we won't accept the passed in value, nor will we set it to a default content type. There is no reason to pull the value out of the header because if it exists we won't set the content_type anyway. We have also have all of these fantastic properties, why are we changing the underlying headers list directly when we can just use the property and have it do it's appropriate magic.
| | * Fix content_type bug if content_type was emptyBert JW Regeer2016-07-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the new Content-Type value did not contain any semicolons we attempted to save any existing parameters from the existing Content-Type headers. If that header was empty, it would do nothing, and no Content-Type would be set at all. The new branch explicitly sets the Content-Type to the value if we don't find any paramters to save.
| | * Update more documentationBert JW Regeer2016-07-291-14/+23
| | |
| | * charset is not *that* specialBert JW Regeer2016-07-291-5/+1
| | |
| | * Turn DeprecationWarning into RuntimeWarningBert JW Regeer2016-07-291-2/+4
| | |
| | * improve presentation of class variablesSteve Piercy2016-07-181-45/+53
| | | | | | | | | | | | | | | | | | - make sub-classing notes an HTML list - fix grammar and punctuation - rewrap as needed
| | * Clarify headerlistBert JW Regeer2016-07-161-1/+2
| | |
| | * Documentation for Response()Bert JW Regeer2016-07-161-7/+83
| | | | | | | | | | | | The docs fairy came to town!
| | * Remove body_encodingBert JW Regeer2016-07-161-9/+4
| | | | | | | | | | | | | | | | | | | | | Just encode the json.dumps as UTF-8, then raise an error if the user passes a text type. This basically undoes a bunch of changes where we were attempting to stop the user from shooting their own foot off. Let them shoot.
| | * Add documentation for why lines existBert JW Regeer2016-07-161-0/+5
| | |
| | * Make charset a first-class keyword argumentBert JW Regeer2016-07-161-4/+4
| | |
| | * On HTTP status codes without body, don't set content typeBert JW Regeer2016-07-161-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | When using Request.get_response() the response from the application may contain a status code that does not allow for an message-body to be returned, in this case adding the content type header is not valid, and potentially changes the original response. Closes #205
| | * Up versions that raise instead of warnings.warnBert JW Regeer2016-07-161-2/+2
| | |
| | * Add a deprecation warning for charset removalBert JW Regeer2016-07-161-0/+6
| | |
| | * content_type removes charset unless text likeBert JW Regeer2016-07-161-8/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When changing the content_type, the charset parameter will no longer be saved and transferred to the new content_type unless the new content_type is likely to have charset as a parameter. For now that includes text/*, application/xml, */*+xml. For any others any change will require setting the charset explicitly after setting the content_type. Currently all other parameters are saved and restored onto the new content_type, this is deprecated and will be removed in future versions, and if parameters are to be kept, they will have to be kept explicitly.
| | * Instead of del, call prop function directlyBert JW Regeer2016-07-161-2/+3
| | |
| | * json.dumps/loads is now always UTF-8Bert JW Regeer2016-07-161-3/+2
| | |