29 Commits

Author SHA1 Message Date
ZhiQiang Fan
f72704fc82 Change OpenStack LLC to Foundation
Change-Id: I7c3df47c31759dbeb3105f8883e2688ada848d58
Closes-bug: #1214176
2013-09-20 01:02:31 +08:00
Peter Portante
0ebddd87d1 Pep8 unit tests in middleware > 20 violations (7 of 12)
Change-Id: I9dfae1a473a8212ef25dcc01e338d8bdade7ef4e
Signed-off-by: Peter Portante <peter.portante@redhat.com>
2013-09-01 16:12:50 -04:00
Alex Gaynor
be688c3156 Encode unicode from JSON before using it as a string.
Right now this code fails when used with a JSON
decoder that always produces unicode. This isn't
usually the case with CPython, where simplejson
is used most of the time, however with the stdlib
JSON library (as used on PyPy), this code fails.

Change-Id: Ib2343243f40194d5b2784551a807c7f58970a6e9
2013-07-29 14:56:50 -07:00
Jenkins
87ab2f6e8c Merge "Fix incorrect status handling at staticweb" 2013-07-29 21:54:50 +00:00
Kota Tsuyuzaki
0508842470 Fix incorrect status handling at staticweb
Staticweb middleware always searchs html
for error response when response status code
is not redirect.
It causes swift to return error response
even if the request succeeded.
(e.g. When finding index.html with 200,
      staticweb returns 200error.html
      if it exist)

This patch modifies the constraint on response
status and fix bug 1204319.

Fixes bug #1204319.

Change-Id: Ib83c303917da7fb94999f2d4d35063b450d0e992
2013-07-24 18:46:15 -07:00
Alex Gaynor
ff5a6d0111 Corrected many style violations in the tests.
I focussed primarily on F-category violations, they are all but all fixed with
this patch.

Change-Id: I343f6945c97984ed1093bc347b6def6994297041
2013-07-24 10:18:47 -07:00
Samuel Merritt
8b4520a483 Remove dead code and tests for staticweb.
Dead since e499b91.

Change-Id: I3c571ae471eb4a0b95772b19eac90183cfc7fe22
2013-06-25 23:18:57 -07:00
Michael Barton
e499b9100b use get_container_info for staticweb
Update staticweb to use get_container_info instead of its own memcache entry.

Change-Id: I59bc0d94b9e45f3d5776a5462f53b82ab78101d4
2013-06-20 01:04:53 -07:00
Dan Hersam
99be1615e0 Treat directory objects as not found
Make StaticWeb search for an index file rather than returning a 0-byte
object.

Add new StaticWeb header to identify a directory marker object:
X-Container-Meta-Web-Directory-Type (default to application/directory)
so user can specify the content type for directory marker objects.
This required requesting the container headers earlier in the code and
clearing the value of _error for non-404 errors.

Add unit tests for directory object scenarios.
Fix end tags in an unrelated HTML block.

Bug 1178817

DocImpact

Change-Id: I561f00c099feaa82fd658f5050bd90c76717da24
2013-06-06 20:56:08 +00:00
Greg Lange
44f00a23c1 fixed some minor things in tests that pyflakes complained about
Change-Id: Ifeab56a964630bcf941e932fcbe39e6572e62975
2013-03-26 20:42:26 +00:00
Eohyung Lee
05c8d61aeb Fix for unicode issues in staticweb
When prefix or subdir is unicode, it fails.
Fixes: bug #1158092

Change-Id: I966a7a198a5ca5ea152872c94240e8c2ebe57d36
2013-03-21 11:35:11 +09:00
Chuck Thier
e88ff34685 Cleanup of file permissions
Mostly removed execute on non-executable files

Change-Id: Ibfbe7e0cf0fbeabef602d70b20f75e1dd3bdf9c9
2013-02-15 11:06:11 -06:00
Tong Li
2267b030bf Swift MemcacheRing (set) interface is incompatible fixes
This patch fixes the Swift MemcacheRing set and set_multi
interface incompatible problem with python memcache. The fix
added two extra named parameters to both set and set_multi
method. When only time or timeout parameter is present, then one
of the value will be used. When both time and timeout are present,
the time parameter will be used.

Named parameter min_compress_len is added for pure compatibility
purposes. The current implementation ignores this parameter.

To make swift memcached methods all consistent cross the board,
method incr and decr have also been changed to include a new
named parameter time.

In future OpenStack releases, the named parameter timeout will be
removed, keep the named parameter timeout around for now is
to make sure that mismatched releases between client and server
will still work.

From now on, when a call is made to set, set_multi, decr, incr
by using timeout parametner, a warning message will be logged to
indicate the deprecation of the parameter.

Fixes: bug #1095730
Change-Id: I07af784a54d7d79395fc3265e74145f92f38a893
2013-02-13 13:56:04 -05:00
David Goetz
a622349eda Use a doubled proxy-logging instead of each middleware handling it
differently (if at all)

Adding a swift.source to wsgi pre_auth funcs and all middleware that makes
subrequests to proxy server.

NOTE: This change will result in a change in the number of proxy logs made for
staticweb, formpost, tempurl, and any other middleware that performs sub
requests (including swauth and SOS).

Please see docs for details.

DocImpact

Change-Id: I80cf2806add1c3d34054147e2515944be340455b
2013-02-11 09:22:25 -08:00
Michael Barton
5e3e9a882d local WSGI Request and Response classes
This change replaces WebOb with a mostly compatible local library,
swift.common.swob.  Subtle changes to WebOb's API over the years have been a
huge headache.  Swift doesn't even run on the current version.

There are a few incompatibilities to simplify the implementation/interface:
 * It only implements the header properties we use.  More can be easily added.
 * Casts header values to str on assignment.
 * Response classes ("HTTPNotFound") are no longer subclasses, but partials
   on Response, so things like isinstance no longer work on them.
 * Unlike newer webob versions, will never return unicode objects.

Change-Id: I76617a0903ee2286b25a821b3c935c86ff95233f
2012-09-28 14:48:48 -07:00
gholt
3800fdc1a9 Fixed bug in staticweb with log_headers
Change-Id: I7e5e254660e2ce35bc7fa95435db0a987d5acd0a
2012-07-29 18:17:14 +00:00
gholt
1c3b75c291 Reverted the pulling out of various middleware:
RateLimit
StaticWeb
TempURL/FormPOST

Change-Id: I988e93e6f4aacb817a2e354d43a04e47516fdf88
2012-05-16 21:25:10 +00:00
gholt
7dde909621 Pulled StaticWeb out to separate project
StaticWeb is now at http://gholt.github.com/swift-staticweb/

For current users of StaticWeb, this will require installing the new
package and changing the "use" line of the staticweb filter conf
section to:

use = egg:swiftstaticweb#middleware

And then 'swift-init proxy reload'.

Change-Id: Iab32adb5927698a667c5c6d6a572c44ca23414eb
2012-05-05 00:40:33 +00:00
gholt
e07f4ded3f StaticWeb fixes.
The previous staticweb had the silly problem of global state for
concurrent requests. This fixes that.

Also, the WSGI spec indicates start_response might not be called
right away and is only guaranteed to be called just before the first
"chunk" of the output iterator returns. This fixes StaticWeb's
previously incorrect assumption.

A thorough review of this code would be much appreciated; I've
messed it up enough times to not be completely trusted with it.

Change-Id: Ie751c24e21db7a884a83a731fbf2f4309437302c
2012-03-28 14:28:32 +00:00
gholt
aa55f198f7 Small change to staticweb with container reques...
Small change to staticweb with container requests. Before, a request
to a container that had no x-container-meta-web-index and no
x-container-meta-web-listings would pass the request on to the proxy
server, even if x-web-mode was set to true. Now, if x-web-mode is set
true, it will 404.

This mostly important to folks that are using staticweb with an
external service that uses authenticated requests and x-web-mode set
to true, in which case the above 404 previously would return the
container listing (you were authenticated after all). Unauthenticated
requests would have received 401s anyway.

Change-Id: Ifd321a8a076a79c1e119c5259a40bf08defdbe3c
2012-03-13 22:09:34 +00:00
Doug Weimer
f73cf2b3eb Add support for URLs and absolute paths in staticweb CSS listings.
Fixes bug 939267. Return the quoted web-listings-css value
if it starts with '/', 'http://', or 'https://.' All other values
are treated as relative paths.

Change-Id: I55ee4ec77cf8db99aa48c9a398e29767b200e1eb
2012-02-23 06:44:45 +00:00
gholt
a7cc6e1cb9 Fix for UTF-8 encoding/quoting issues in staticweb
Also added ; charset=UTF-8 to the content-type.

Change-Id: I144a9fa2647b47663863b06636968beaa68a5d60
2012-01-18 16:39:20 +00:00
gholt
2c6ba9cc3d Save extra request with staticweb when possible
Change-Id: I6459d11e64c9b1a857574fd943ed5c0ed5f4f792
2011-12-21 20:55:37 +00:00
gholt
7b6b85aef8 Update staticweb generated test data to match utf-8 update 2011-06-10 19:33:53 +00:00
gholt
175fd2a811 A bit more unit tests. 2011-03-25 20:22:04 +00:00
gholt
7a850affb0 Specific unit test for previous bugfix 2011-03-25 20:00:21 +00:00
gholt
40505e892d Added logging 2011-03-25 08:33:46 +00:00
gholt
0e3040f989 Changing some semantics and defaults; .r:* listings are off by default now and .rlistings turn them on; new x-container-meta-web-listings header to turn webmode listings on/off (off by default) 2011-03-24 22:53:08 +00:00
gholt
b09b5e64e1 Tests; bug fixes 2011-03-24 07:46:02 +00:00