Repository: Kinto/kinto

Issue:
Using the _since querystring filter has no effect
I've tried using the `_since` querystring filter as explained in the tutorial, but it seems to have no effect.

`GET`ing any of those urls returns the exact same list (the full list of records)

```
http GET http://0.0.0.0:8888/v1/buckets/default/collections/tasks/records?_since=1436094288171 -v  --auth 'user:password'
http GET http://0.0.0.0:8888/v1/buckets/default/collections/tasks/records?_since=foobar -v  --auth 'user:password'
http GET http://0.0.0.0:8888/v1/buckets/default/collections/tasks/records?_since=`date +%s` -v  --auth 'user:password'
```

The last one uses the current timestamp as the value, which means it should return an empty list.



Discussion:
Similarly, providing the `If-None-Match` header never returns a `304` (which might be "normal", as the full list is always returned).

`?_since=<non integer value>` is supposed to raise 400. But doesn't.

```
http "https://kinto.dev.mozaws.net/v1/buckets/default/collections/tasks/records?_since=toto" --auth 'user:password'
HTTP/1.1 200 OK
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Next-Page, Total-Records, Last-Modified, ETag
Backoff: 10
Connection: keep-alive
Content-Length: 11
Content-Type: application/json; charset=UTF-8
Date: Mon, 06 Jul 2015 08:32:32 GMT
ETag: "1436170881918"
Last-Modified: Mon, 06 Jul 2015 08:21:21 GMT
Server: nginx/1.4.6 (Ubuntu)
Total-Records: 0

{
    "data": []
}
```

Confirmed with Kinto 1.2

```
GET /v1/buckets/default/collections/tasks/records?_since=1436172070772 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Authorization: Basic dXNlcjpwYXNzd29yZA==
Connection: keep-alive
Host: kinto.dev.mozaws.net
User-Agent: HTTPie/0.9.2


HTTP/1.1 200 OK
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Next-Page, Total-Records, Last-Modified, ETag
Backoff: 10
Connection: keep-alive
Content-Length: 182
Content-Type: application/json; charset=UTF-8
Date: Mon, 06 Jul 2015 08:49:38 GMT
ETag: "1436172501156"
Last-Modified: Mon, 06 Jul 2015 08:48:21 GMT
Server: nginx/1.4.6 (Ubuntu)
Total-Records: 2

{
    "data": [
        {
            "id": "f90c266f-7425-49b4-b2dc-3b242a3cea99", 
            "last_modified": 1436172070772, 
            "title": 2
        }, 
        {
            "id": "6c5f255d-65cf-4eec-a0ee-4c1132b19f15", 
            "last_modified": 1436172059952, 
            "title": 1
        }
    ]
}
```


Resolving patch:
diff --git a/kinto/views/buckets.py b/kinto/views/buckets.py
--- a/kinto/views/buckets.py
+++ b/kinto/views/buckets.py
@@ -59,6 +59,8 @@ def default_bucket(request):
     # Build the user unguessable bucket_id UUID from its user_id
     bucket_id = hmac_digest(hmac_secret, request.prefixed_userid)[:32]
     path = request.path.replace('default', bucket_id)
+    querystring = request.url[(request.url.index(request.path) +
+                               len(request.path)):]
 
     # Make sure bucket exists
     create_bucket(request, bucket_id)
@@ -68,7 +70,7 @@ def default_bucket(request):
 
     subrequest = build_request(request, {
         'method': request.method,
-        'path': path,
+        'path': path + querystring,
         'body': request.body
     })
 


Test patch:
diff --git a/kinto/tests/test_default_bucket.py b/kinto/tests/test_default_bucket.py
--- a/kinto/tests/test_default_bucket.py
+++ b/kinto/tests/test_default_bucket.py
@@ -51,3 +51,8 @@ def test_second_call_on_default_bucket_doesnt_raise_a_412(self):
     def test_second_call_on_default_bucket_collection_doesnt_raise_a_412(self):
         self.app.get(self.collection_url, headers=self.headers)
         self.app.get(self.collection_url, headers=self.headers)
+
+    def test_querystring_parameters_are_taken_into_account(self):
+        self.app.get(self.collection_url + '/records?_since=invalid',
+                     headers=self.headers,
+                     status=400)