Merge lp:~david-goetz/swift/xml_rollback into lp:~hudson-openstack/swift/trunk

Proposed by David Goetz
Status: Merged
Approved by: gholt
Approved revision: 328
Merged at revision: 330
Proposed branch: lp:~david-goetz/swift/xml_rollback
Merge into: lp:~hudson-openstack/swift/trunk
Diff against target: 542 lines (+39/-241)
10 files modified
swift/account/server.py (+5/-8)
swift/common/constraints.py (+3/-6)
swift/common/utils.py (+2/-5)
swift/container/server.py (+6/-13)
test/functionalnosetests/test_account.py (+0/-27)
test/functionalnosetests/test_container.py (+0/-44)
test/functionalnosetests/test_object.py (+0/-24)
test/unit/account/test_server.py (+6/-54)
test/unit/container/test_server.py (+17/-46)
test/unit/proxy/test_server.py (+0/-14)
To merge this branch: bzr merge lp:~david-goetz/swift/xml_rollback
Reviewer Review Type Date Requested Status
gholt (community) Approve
Chuck Thier (community) Approve
Review via email: mp+68900@code.launchpad.net

Description of the change

Rollback of XML:
rolling back xml changes bzr merge -r323..322
rolling back xml changes bzr merge -r319..318

To post a comment you must log in.
Revision history for this message
Chuck Thier (cthier) wrote :

looks good

review: Approve
Revision history for this message
gholt (gholt) :
review: Approve
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :
Download full text (69.7 KiB)

The attempt to merge lp:~david-goetz/swift/xml_rollback into lp:swift failed. Below is the output from the failed tests.

running test
running egg_info
creating swift.egg-info
writing swift.egg-info/PKG-INFO
writing top-level names to swift.egg-info/top_level.txt
writing dependency_links to swift.egg-info/dependency_links.txt
writing entry points to swift.egg-info/entry_points.txt
writing manifest file 'swift.egg-info/SOURCES.txt'
reading manifest file 'swift.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'swift.egg-info/SOURCES.txt'
running build_ext

warning: no files found matching 'ChangeLog'
UNABLE TO READ FUNCTIONAL TESTS CONFIG FILE
UNABLE TO READ FUNCTIONAL TESTS CONFIG FILE
SKIPPING FUNCTIONAL TESTS DUE TO NO CONFIG
testAccountHead (test.functional.tests.TestAccount) ... SKIP
testContainerListing (test.functional.tests.TestAccount) ... SKIP
testContainerSerializedInfo (test.functional.tests.TestAccount) ... SKIP
testContainersOrderedByName (test.functional.tests.TestAccount) ... SKIP
testInvalidAuthToken (test.functional.tests.TestAccount) ... SKIP
testInvalidPath (test.functional.tests.TestAccount) ... SKIP
testInvalidUTF8Path (test.functional.tests.TestAccount) ... SKIP
testLastContainerMarker (test.functional.tests.TestAccount) ... SKIP
testListingLimit (test.functional.tests.TestAccount) ... SKIP
testMarkerLimitContainerList (test.functional.tests.TestAccount) ... SKIP
testNoAuthToken (test.functional.tests.TestAccount) ... SKIP
testPUT (test.functional.tests.TestAccount) ... SKIP
testVersionOnlyPath (test.functional.tests.TestAccount) ... SKIP
testGetRequest (test.functional.tests.TestAccountNoContainers) ... SKIP
testGetRequest (test.functional.tests.TestAccountNoContainersUTF8) ... SKIP
testAccountHead (test.functional.tests.TestAccountUTF8) ... SKIP
testContainerListing (test.functional.tests.TestAccountUTF8) ... SKIP
testContainerSerializedInfo (test.functional.tests.TestAccountUTF8) ... SKIP
testContainersOrderedByName (test.functional.tests.TestAccountUTF8) ... SKIP
testInvalidAuthToken (test.functional.tests.TestAccountUTF8) ... SKIP
testInvalidPath (test.functional.tests.TestAccountUTF8) ... SKIP
testInvalidUTF8Path (test.functional.tests.TestAccountUTF8) ... SKIP
testLastContainerMarker (test.functional.tests.TestAccountUTF8) ... SKIP
testListingLimit (test.functional.tests.TestAccountUTF8) ... SKIP
testMarkerLimitContainerList (test.functional.tests.TestAccountUTF8) ... SKIP
testNoAuthToken (test.functional.tests.TestAccountUTF8) ... SKIP
testPUT (test.functional.tests.TestAccountUTF8) ... SKIP
testVersionOnlyPath (test.functional.tests.TestAccountUTF8) ... SKIP
testContainerExistenceCachingProblem (test.functional.tests.TestContainer) ... SKIP
testContainerFileList (test.functional.tests.TestContainer) ... SKIP
testContainerFileListOnContainerThatDoesNotExist (test.functional.tests.TestContainer) ... SKIP
testContainerFileListWithLimit (test.functional.tests.TestContainer) ... SKIP
testContainerInfo (test.functional.tests.TestContainer) ... SKIP
testContainerInfoOnContainerThatDoesNotExist (test.functional.tests.TestContainer) ... SKIP
testContainerNameLimit (test.functional.tests....

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'swift/account/server.py'
2--- swift/account/server.py 2011-07-13 20:03:04 +0000
3+++ swift/account/server.py 2011-07-22 19:59:31 +0000
4@@ -29,7 +29,7 @@
5
6 from swift.common.db import AccountBroker
7 from swift.common.utils import get_logger, get_param, hash_path, \
8- normalize_timestamp, split_path, storage_directory, XML_EXTRA_ENTITIES
9+ normalize_timestamp, split_path, storage_directory
10 from swift.common.constraints import ACCOUNT_LISTING_LIMIT, \
11 check_mount, check_float, check_utf8
12 from swift.common.db_replicator import ReplicatorRpc
13@@ -79,9 +79,6 @@
14 try:
15 drive, part, account, container = split_path(unquote(req.path),
16 3, 4)
17- if (account and not check_utf8(account)) or \
18- (container and not check_utf8(container)):
19- raise ValueError('NULL characters not allowed in names')
20 except ValueError, err:
21 return HTTPBadRequest(body=str(err), content_type='text/plain',
22 request=req)
23@@ -204,8 +201,8 @@
24 marker = get_param(req, 'marker', '')
25 end_marker = get_param(req, 'end_marker')
26 query_format = get_param(req, 'format')
27- except (UnicodeDecodeError, ValueError), err:
28- return HTTPBadRequest(body='parameters not utf8 or contain NULLs',
29+ except UnicodeDecodeError, err:
30+ return HTTPBadRequest(body='parameters not utf8',
31 content_type='text/plain', request=req)
32 if query_format:
33 req.accept = 'application/%s' % query_format.lower()
34@@ -228,10 +225,10 @@
35 (name, object_count, bytes_used))
36 account_list = '[' + ','.join(json_out) + ']'
37 elif out_content_type.endswith('/xml'):
38- output_list = ['<?xml version="1.1" encoding="UTF-8"?>',
39+ output_list = ['<?xml version="1.0" encoding="UTF-8"?>',
40 '<account name="%s">' % account]
41 for (name, object_count, bytes_used, is_subdir) in account_list:
42- name = saxutils.escape(name, XML_EXTRA_ENTITIES)
43+ name = saxutils.escape(name)
44 if is_subdir:
45 output_list.append('<subdir name="%s" />' % name)
46 else:
47
48=== modified file 'swift/common/constraints.py'
49--- swift/common/constraints.py 2011-06-17 00:57:00 +0000
50+++ swift/common/constraints.py 2011-07-22 19:59:31 +0000
51@@ -159,16 +159,13 @@
52
53 def check_utf8(string):
54 """
55- Validate if a string is valid UTF-8 and has no NULL characters.
56+ Validate if a string is valid UTF-8.
57
58 :param string: string to be validated
59- :returns: True if the string is valid utf-8 and has no NULL characters,
60- False otherwise
61+ :returns: True if the string is valid utf-8, False otherwise
62 """
63 try:
64 string.decode('UTF-8')
65+ return True
66 except UnicodeDecodeError:
67 return False
68- if '\x00' in string:
69- return False
70- return True
71
72=== modified file 'swift/common/utils.py'
73--- swift/common/utils.py 2011-06-30 21:52:09 +0000
74+++ swift/common/utils.py 2011-07-22 19:59:31 +0000
75@@ -42,7 +42,6 @@
76 from eventlet.green import socket, subprocess, ssl, thread, threading
77 import netifaces
78
79-from swift.common.constraints import check_utf8
80 from swift.common.exceptions import LockTimeout, MessageTimeout
81
82 # logging doesn't import patched as cleanly as one would like
83@@ -75,8 +74,6 @@
84 # Used when reading config values
85 TRUE_VALUES = set(('true', '1', 'yes', 'on', 't', 'y'))
86
87-# Used with xml.sax.saxutils.escape
88-XML_EXTRA_ENTITIES = dict((chr(x), '&#x%x;' % x) for x in xrange(1, 0x20))
89
90 def validate_configuration():
91 if HASH_PATH_SUFFIX == '':
92@@ -113,8 +110,8 @@
93 :returns: HTTP request parameter value
94 """
95 value = req.str_params.get(name, default)
96- if value and not check_utf8(value):
97- raise ValueError('Not valid UTF-8 or contains NULL characters')
98+ if value:
99+ value.decode('utf8') # Ensure UTF8ness
100 return value
101
102
103
104=== modified file 'swift/container/server.py'
105--- swift/container/server.py 2011-07-14 20:07:45 +0000
106+++ swift/container/server.py 2011-07-22 19:59:31 +0000
107@@ -32,8 +32,7 @@
108
109 from swift.common.db import ContainerBroker
110 from swift.common.utils import get_logger, get_param, hash_path, \
111- normalize_timestamp, storage_directory, split_path, urlparse, \
112- validate_sync_to, XML_EXTRA_ENTITIES
113+ normalize_timestamp, storage_directory, split_path, validate_sync_to
114 from swift.common.constraints import CONTAINER_LISTING_LIMIT, \
115 check_mount, check_float, check_utf8
116 from swift.common.bufferedhttp import http_connect
117@@ -172,10 +171,6 @@
118 try:
119 drive, part, account, container, obj = split_path(
120 unquote(req.path), 4, 5, True)
121- if (account and not check_utf8(account)) or \
122- (container and not check_utf8(container)) or \
123- (obj and not check_utf8(obj)):
124- raise ValueError('NULL characters not allowed in names')
125 except ValueError, err:
126 return HTTPBadRequest(body=str(err), content_type='text/plain',
127 request=req)
128@@ -298,7 +293,7 @@
129 return HTTPPreconditionFailed(request=req,
130 body='Maximum limit is %d' % CONTAINER_LISTING_LIMIT)
131 query_format = get_param(req, 'format')
132- except (UnicodeDecodeError, ValueError), err:
133+ except UnicodeDecodeError, err:
134 return HTTPBadRequest(body='parameters not utf8',
135 content_type='text/plain', request=req)
136 if query_format:
137@@ -333,23 +328,21 @@
138 xml_output = []
139 for (name, created_at, size, content_type, etag) in container_list:
140 # escape name and format date here
141- name = saxutils.escape(name, XML_EXTRA_ENTITIES)
142+ name = saxutils.escape(name)
143 created_at = datetime.utcfromtimestamp(
144 float(created_at)).isoformat()
145 if content_type is None:
146 xml_output.append('<subdir name="%s"><name>%s</name>'
147 '</subdir>' % (name, name))
148 else:
149- content_type = saxutils.escape(content_type,
150- XML_EXTRA_ENTITIES)
151+ content_type = saxutils.escape(content_type)
152 xml_output.append('<object><name>%s</name><hash>%s</hash>'\
153 '<bytes>%d</bytes><content_type>%s</content_type>'\
154 '<last_modified>%s</last_modified></object>' % \
155 (name, etag, size, content_type, created_at))
156 container_list = ''.join([
157- '<?xml version="1.1" encoding="UTF-8"?>\n',
158- '<container name=%s>' %
159- saxutils.quoteattr(container, XML_EXTRA_ENTITIES),
160+ '<?xml version="1.0" encoding="UTF-8"?>\n',
161+ '<container name=%s>' % saxutils.quoteattr(container),
162 ''.join(xml_output), '</container>'])
163 else:
164 if not container_list:
165
166=== modified file 'test/functionalnosetests/test_account.py'
167--- test/functionalnosetests/test_account.py 2011-06-17 00:57:00 +0000
168+++ test/functionalnosetests/test_account.py 2011-07-22 19:59:31 +0000
169@@ -2,7 +2,6 @@
170
171 import unittest
172 from nose import SkipTest
173-from uuid import uuid4
174
175 from swift.common.constraints import MAX_META_COUNT, MAX_META_NAME_LENGTH, \
176 MAX_META_OVERALL_SIZE, MAX_META_VALUE_LENGTH
177@@ -133,32 +132,6 @@
178 resp.read()
179 self.assertEquals(resp.status, 400)
180
181- def test_name_control_chars(self):
182- if skip:
183- raise SkipTest
184-
185- container = uuid4().hex
186-
187- def put(url, token, parsed, conn):
188- conn.request('PUT', '%s/%s%%01test' %
189- (parsed.path, container), '',
190- {'X-Auth-Token': token, 'Content-Length': '0'})
191- return check_response(conn)
192-
193- resp = retry(put)
194- resp.read()
195- self.assertTrue(resp.status in (201, 202))
196-
197- def get(url, token, parsed, conn):
198- conn.request('GET', '%s?format=xml' % (parsed.path,), '',
199- {'X-Auth-Token': token})
200- return check_response(conn)
201-
202- resp = retry(get)
203- body = resp.read()
204- self.assertEquals(resp.status, 200)
205- self.assertTrue('<name>%s&#x1;test</name>' % (container,) in body)
206-
207
208 if __name__ == '__main__':
209 unittest.main()
210
211=== modified file 'test/functionalnosetests/test_container.py'
212--- test/functionalnosetests/test_container.py 2011-06-17 00:57:00 +0000
213+++ test/functionalnosetests/test_container.py 2011-07-22 19:59:31 +0000
214@@ -522,50 +522,6 @@
215 resp.read()
216 self.assertEquals(resp.status, 201)
217
218- def test_name_control_chars(self):
219- if skip:
220- raise SkipTest
221-
222- def put(url, token, parsed, conn):
223- conn.request('PUT', '%s/%s%%00test' % (parsed.path, self.name), '',
224- {'X-Auth-Token': token})
225- return check_response(conn)
226-
227- resp = retry(put)
228- resp.read()
229- # NULLs not allowed
230- self.assertEquals(resp.status, 412)
231-
232- def put(url, token, parsed, conn):
233- conn.request('PUT', '%s/%s%%01test' % (parsed.path, self.name), '',
234- {'X-Auth-Token': token})
235- return check_response(conn)
236-
237- resp = retry(put)
238- resp.read()
239- # 0x01 allowed
240- self.assertTrue(resp.status in (201, 202))
241-
242- def put(url, token, parsed, conn):
243- conn.request('PUT', '%s/%s/object%%01test' %
244- (parsed.path, self.name), '',
245- {'X-Auth-Token': token, 'Content-Length': '0'})
246- return check_response(conn)
247-
248- resp = retry(put)
249- resp.read()
250- self.assertTrue(resp.status in (201, 202))
251-
252- def get(url, token, parsed, conn):
253- conn.request('GET', '%s/%s?format=xml' % (parsed.path, self.name),
254- '', {'X-Auth-Token': token})
255- return check_response(conn)
256-
257- resp = retry(get)
258- body = resp.read()
259- self.assertEquals(resp.status, 200)
260- self.assertTrue('<name>object&#x1;test</name>' in body)
261-
262
263 if __name__ == '__main__':
264 unittest.main()
265
266=== modified file 'test/functionalnosetests/test_object.py'
267--- test/functionalnosetests/test_object.py 2011-06-30 21:52:09 +0000
268+++ test/functionalnosetests/test_object.py 2011-07-22 19:59:31 +0000
269@@ -541,30 +541,6 @@
270 resp.read()
271 self.assertEquals(resp.status, 204)
272
273- def test_name_control_chars(self):
274- if skip:
275- raise SkipTest
276-
277- def put(url, token, parsed, conn):
278- conn.request('PUT', '%s/%s/obj%%00test' % (parsed.path,
279- self.container), 'test', {'X-Auth-Token': token})
280- return check_response(conn)
281-
282- resp = retry(put)
283- resp.read()
284- # NULLs not allowed
285- self.assertEquals(resp.status, 412)
286-
287- def put(url, token, parsed, conn):
288- conn.request('PUT', '%s/%s/obj%%01test' % (parsed.path,
289- self.container), 'test', {'X-Auth-Token': token})
290- return check_response(conn)
291-
292- resp = retry(put)
293- resp.read()
294- # 0x01 allowed
295- self.assertEquals(resp.status, 201)
296-
297
298 if __name__ == '__main__':
299 unittest.main()
300
301=== modified file 'test/unit/account/test_server.py'
302--- test/unit/account/test_server.py 2011-06-17 00:57:00 +0000
303+++ test/unit/account/test_server.py 2011-07-22 19:59:31 +0000
304@@ -22,7 +22,6 @@
305 import simplejson
306 import xml.dom.minidom
307 from webob import Request
308-from xml.parsers.expat import ExpatError
309
310 from swift.account.server import AccountController, ACCOUNT_LISTING_LIMIT
311 from swift.common.utils import normalize_timestamp
312@@ -451,8 +450,7 @@
313 'X-Bytes-Used': '0',
314 'X-Timestamp': normalize_timestamp(0)})
315 self.controller.PUT(req)
316- req = Request.blank('/sda1/p/a/c2%04',
317- environ={'REQUEST_METHOD': 'PUT'},
318+ req = Request.blank('/sda1/p/a/c2', environ={'REQUEST_METHOD': 'PUT'},
319 headers={'X-Put-Timestamp': '2',
320 'X-Delete-Timestamp': '0',
321 'X-Object-Count': '0',
322@@ -464,15 +462,7 @@
323 resp = self.controller.GET(req)
324 self.assertEquals(resp.content_type, 'application/xml')
325 self.assertEquals(resp.status_int, 200)
326- try:
327- dom = xml.dom.minidom.parseString(resp.body)
328- except ExpatError, err:
329- # Expat doesn't like control characters, which are XML 1.1
330- # compatible. Soooo, we have to replace them. We'll do a specific
331- # replace in this case, but real code that uses Expat will need
332- # something more resilient.
333- dom = xml.dom.minidom.parseString(
334- resp.body.replace('&#x4;', '\\x04'))
335+ dom = xml.dom.minidom.parseString(resp.body)
336 self.assertEquals(dom.firstChild.nodeName, 'account')
337 listing = \
338 [n for n in dom.firstChild.childNodes if n.nodeName != '#text']
339@@ -493,7 +483,7 @@
340 self.assertEquals(sorted([n.nodeName for n in container]),
341 ['bytes', 'count', 'name'])
342 node = [n for n in container if n.nodeName == 'name'][0]
343- self.assertEquals(node.firstChild.nodeValue, 'c2\\x04')
344+ self.assertEquals(node.firstChild.nodeValue, 'c2')
345 node = [n for n in container if n.nodeName == 'count'][0]
346 self.assertEquals(node.firstChild.nodeValue, '0')
347 node = [n for n in container if n.nodeName == 'bytes'][0]
348@@ -505,8 +495,7 @@
349 'X-Bytes-Used': '2',
350 'X-Timestamp': normalize_timestamp(0)})
351 self.controller.PUT(req)
352- req = Request.blank('/sda1/p/a/c2%04',
353- environ={'REQUEST_METHOD': 'PUT'},
354+ req = Request.blank('/sda1/p/a/c2', environ={'REQUEST_METHOD': 'PUT'},
355 headers={'X-Put-Timestamp': '2',
356 'X-Delete-Timestamp': '0',
357 'X-Object-Count': '3',
358@@ -517,15 +506,7 @@
359 environ={'REQUEST_METHOD': 'GET'})
360 resp = self.controller.GET(req)
361 self.assertEquals(resp.status_int, 200)
362- try:
363- dom = xml.dom.minidom.parseString(resp.body)
364- except ExpatError, err:
365- # Expat doesn't like control characters, which are XML 1.1
366- # compatible. Soooo, we have to replace them. We'll do a specific
367- # replace in this case, but real code that uses Expat will need
368- # something more resilient.
369- dom = xml.dom.minidom.parseString(
370- resp.body.replace('&#x4;', '\\x04'))
371+ dom = xml.dom.minidom.parseString(resp.body)
372 self.assertEquals(dom.firstChild.nodeName, 'account')
373 listing = \
374 [n for n in dom.firstChild.childNodes if n.nodeName != '#text']
375@@ -545,7 +526,7 @@
376 self.assertEquals(sorted([n.nodeName for n in container]),
377 ['bytes', 'count', 'name'])
378 node = [n for n in container if n.nodeName == 'name'][0]
379- self.assertEquals(node.firstChild.nodeValue, 'c2\\x04')
380+ self.assertEquals(node.firstChild.nodeValue, 'c2')
381 node = [n for n in container if n.nodeName == 'count'][0]
382 self.assertEquals(node.firstChild.nodeValue, '3')
383 node = [n for n in container if n.nodeName == 'bytes'][0]
384@@ -978,35 +959,6 @@
385 resp = self.controller.GET(req)
386 self.assert_(resp.status_int in (204, 412), resp.status_int)
387
388- def test_params_no_null(self):
389- self.controller.PUT(Request.blank('/sda1/p/a',
390- headers={'X-Timestamp': normalize_timestamp(1)},
391- environ={'REQUEST_METHOD': 'PUT'}))
392- for param in ('delimiter', 'format', 'limit', 'marker',
393- 'prefix'):
394- req = Request.blank('/sda1/p/a?%s=\x00' % param,
395- environ={'REQUEST_METHOD': 'GET'})
396- resp = self.controller.GET(req)
397- self.assertEquals(resp.status_int, 400)
398-
399- def test_PUT_account_no_null(self):
400- req = Request.blank('/sda1/p/test\x00test',
401- environ={'REQUEST_METHOD': 'PUT', 'HTTP_X_TIMESTAMP': '1'})
402- resp = self.controller.PUT(req)
403- self.assertEquals(resp.status_int, 400)
404-
405- def test_PUT_container_no_null(self):
406- req = Request.blank('/sda1/p/a',
407- environ={'REQUEST_METHOD': 'PUT', 'HTTP_X_TIMESTAMP': '1'})
408- resp = self.controller.PUT(req)
409- self.assertEquals(resp.status_int, 201)
410- req = Request.blank('/sda1/p/a/test\x00test',
411- environ={'REQUEST_METHOD': 'PUT', 'HTTP_X_PUT_TIMESTAMP': '1',
412- 'HTTP_X_DELETE_TIMESTAMP': '0',
413- 'HTTP_X_OBJECT_COUNT': '0', 'HTTP_X_BYTES_USED': '0'})
414- resp = self.controller.PUT(req)
415- self.assertEquals(resp.status_int, 400)
416-
417
418 if __name__ == '__main__':
419 unittest.main()
420
421=== modified file 'test/unit/container/test_server.py'
422--- test/unit/container/test_server.py 2011-07-14 20:07:45 +0000
423+++ test/unit/container/test_server.py 2011-07-22 19:59:31 +0000
424@@ -246,24 +246,6 @@
425 resp = self.controller.PUT(req)
426 self.assertEquals(resp.status_int, 201)
427
428- def test_PUT_container_no_null(self):
429- req = Request.blank('/sda1/p/a/test\x00test',
430- environ={'REQUEST_METHOD': 'PUT', 'HTTP_X_TIMESTAMP': '1'})
431- resp = self.controller.PUT(req)
432- self.assertEquals(resp.status_int, 400)
433-
434- def test_PUT_object_no_null(self):
435- req = Request.blank('/sda1/p/a/test',
436- environ={'REQUEST_METHOD': 'PUT', 'HTTP_X_TIMESTAMP': '1'})
437- resp = self.controller.PUT(req)
438- self.assertEquals(resp.status_int, 201)
439- req = Request.blank('/sda1/p/a/test/test\x00test',
440- environ={'REQUEST_METHOD': 'PUT', 'HTTP_X_TIMESTAMP': '1',
441- 'HTTP_X_SIZE': '0', 'HTTP_X_CONTENT_TYPE': 'text/plain',
442- 'HTTP_X_ETAG': 'd41d8cd98f00b204e9800998ecf8427e'})
443- resp = self.controller.PUT(req)
444- self.assertEquals(resp.status_int, 400)
445-
446 def test_PUT_account_update(self):
447 bindsock = listen(('127.0.0.1', 0))
448 def accept(return_code, expected_timestamp):
449@@ -670,25 +652,25 @@
450 resp = self.controller.PUT(req)
451 # fill the container
452 for i in range(3):
453- req = Request.blank('/sda1/p/a/xmlc/%s%%%02x' % (i, i + 1),
454- environ={'REQUEST_METHOD': 'PUT',
455- 'HTTP_X_TIMESTAMP': '1',
456- 'HTTP_X_CONTENT_TYPE': 'text/plain',
457- 'HTTP_X_ETAG': 'x',
458- 'HTTP_X_SIZE': 0})
459+ req = Request.blank('/sda1/p/a/xmlc/%s'%i, environ=
460+ {'REQUEST_METHOD': 'PUT',
461+ 'HTTP_X_TIMESTAMP': '1',
462+ 'HTTP_X_CONTENT_TYPE': 'text/plain',
463+ 'HTTP_X_ETAG': 'x',
464+ 'HTTP_X_SIZE': 0})
465 resp = self.controller.PUT(req)
466 self.assertEquals(resp.status_int, 201)
467- xml_body = '<?xml version="1.1" encoding="UTF-8"?>\n' \
468+ xml_body = '<?xml version="1.0" encoding="UTF-8"?>\n' \
469 '<container name="xmlc">' \
470- '<object><name>0&#x1;</name><hash>x</hash><bytes>0</bytes>' \
471- '<content_type>text/plain</content_type>' \
472- '<last_modified>1970-01-01T00:00:01' \
473- '</last_modified></object>' \
474- '<object><name>1&#x2;</name><hash>x</hash><bytes>0</bytes>' \
475- '<content_type>text/plain</content_type>' \
476- '<last_modified>1970-01-01T00:00:01' \
477- '</last_modified></object>' \
478- '<object><name>2&#x3;</name><hash>x</hash><bytes>0</bytes>' \
479+ '<object><name>0</name><hash>x</hash><bytes>0</bytes>' \
480+ '<content_type>text/plain</content_type>' \
481+ '<last_modified>1970-01-01T00:00:01' \
482+ '</last_modified></object>' \
483+ '<object><name>1</name><hash>x</hash><bytes>0</bytes>' \
484+ '<content_type>text/plain</content_type>' \
485+ '<last_modified>1970-01-01T00:00:01' \
486+ '</last_modified></object>' \
487+ '<object><name>2</name><hash>x</hash><bytes>0</bytes>' \
488 '<content_type>text/plain</content_type>' \
489 '<last_modified>1970-01-01T00:00:01' \
490 '</last_modified></object>' \
491@@ -822,7 +804,7 @@
492 req = Request.blank('/sda1/p/a/c?prefix=US-&delimiter=-&format=xml',
493 environ={'REQUEST_METHOD': 'GET'})
494 resp = self.controller.GET(req)
495- self.assertEquals(resp.body, '<?xml version="1.1" encoding="UTF-8"?>'
496+ self.assertEquals(resp.body, '<?xml version="1.0" encoding="UTF-8"?>'
497 '\n<container name="c"><subdir name="US-OK-"><name>US-OK-</name></subdir>'
498 '<subdir name="US-TX-"><name>US-TX-</name></subdir>'
499 '<subdir name="US-UT-"><name>US-UT-</name></subdir></container>')
500@@ -910,17 +892,6 @@
501 resp = self.controller.GET(req)
502 self.assert_(resp.status_int in (204, 412), resp.status_int)
503
504- def test_params_no_null(self):
505- self.controller.PUT(Request.blank('/sda1/p/a/c',
506- headers={'X-Timestamp': normalize_timestamp(1)},
507- environ={'REQUEST_METHOD': 'PUT'}))
508- for param in ('delimiter', 'format', 'limit', 'marker', 'path',
509- 'prefix'):
510- req = Request.blank('/sda1/p/a/c?%s=\x00' % param,
511- environ={'REQUEST_METHOD': 'GET'})
512- resp = self.controller.GET(req)
513- self.assertEquals(resp.status_int, 400)
514-
515
516 if __name__ == '__main__':
517 unittest.main()
518
519=== modified file 'test/unit/proxy/test_server.py'
520--- test/unit/proxy/test_server.py 2011-06-30 15:20:36 +0000
521+++ test/unit/proxy/test_server.py 2011-07-22 19:59:31 +0000
522@@ -2111,20 +2111,6 @@
523 exp = 'HTTP/1.1 412'
524 self.assertEquals(headers[:len(exp)], exp)
525
526- def test_chunked_put_bad_utf8_null(self):
527- # Check invalid utf-8
528- (prolis, acc1lis, acc2lis, con2lis, con2lis, obj1lis, obj2lis) = \
529- _test_sockets
530- sock = connect_tcp(('localhost', prolis.getsockname()[1]))
531- fd = sock.makefile()
532- fd.write('GET /v1/a%00 HTTP/1.1\r\nHost: localhost\r\n'
533- 'Connection: close\r\nX-Auth-Token: t\r\n'
534- 'Content-Length: 0\r\n\r\n')
535- fd.flush()
536- headers = readuntil2crlfs(fd)
537- exp = 'HTTP/1.1 412'
538- self.assertEquals(headers[:len(exp)], exp)
539-
540 def test_chunked_put_bad_path_no_controller(self):
541 # Check bad path, no controller
542 (prolis, acc1lis, acc2lis, con2lis, con2lis, obj1lis, obj2lis) = \