| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
| |
This also fixes Python bug 24764.
|
| | |
|
| |
|
|
| |
We are upon WebOb 1.7
|
| |
|
|
| |
Closes #288
|
| |
|
|
| |
Closes #290
|
| | |
|
| | |
|
| |
|
|
|
|
| |
__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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
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...
|
| |\
| |
| | |
All request methods may now have a body
|
| | | |
|
| | |
| |
| |
| | |
Closes #276
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
| |
| |
| | |
You can now set req.body for any request method.
|
| | |
| |
| |
| |
| |
| | |
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).
|
| | | |
|
| | |
| |
| |
| |
| | |
This has been deprecated since WebOb 1.2 and non-functional for a long
time.
|
| |/
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
| |
Closes #119
|
| | |
|
| |\ |
|
| | |\ |
|
| | | |
| | |
| | |
| | |
| | | |
The charset provided to the constructor should not be used if a charset
is already set on the Content-Type.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | | |
- make sub-classing notes an HTML list
- fix grammar and punctuation
- rewrap as needed
|
| | | | |
|
| | | |
| | |
| | |
| | | |
The docs fairy came to town!
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | | |
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | | | |
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | | |
|
| | | | |
|