I'm not entirely sure that the middleware should actually be handling this though (since it's in the pipeline), not the server. Also, can versioned_writes handle a 412 in the middleware if someone lands a chunk transfer termination line?
The middleware should try to handle chunk termination lines while error handling is off (i.e. error handlers are in the pipeline). If not, then ideally the middleware should become aware of the chunk termination line (and maybe it can add some metadata to the request to help the client figure out the number of chunks it is receiving), rather than the client having to do that.
Since it appears you're not redirecting to a user home when you hit 411, you'll get a 500 during the start of your test. If you are redirecting to a user home, this will probably occur during the update phase.
The test is making a request to create a file with a slash in the path. According to the HTTP spec this request will be declined. The test then makes a request to retrieve the created file. Based on the HTTP spec this request should be a 200, but instead the test is receiving a 502, and then a 500. The test is receiving a 500 because, again, it is violating the HTTP spec. It is not possible, according to the HTTP spec, to retrieve a file that doesn't exist. HTTP spec: section 9.2.4
I believe it's possible to handle this test case by changing chunked encoding back to 0.6.x behaviour, which is the behaviour that the other tests use. I think these other tests are also violating the HTTP spec. I don't know why Sam sent the message about a 412 response. I believe it's just a misunderstanding.
The issue arose because a client (a different functional test) had a chunked POST request for a particular resource. That request made use of versioned_writes middleware, but did not have container_sync middleware in the proxy pipeline.
If this test was being used by a service that is unable to handle the 412 HTTP status we've introduced we need to fix that. Otherwise we can try to fix the problem with the existing code and let the test fail until we can fix the code. 827ec27edc