App Engine Java SDK version 1.9.14
[gae.git] / python / google / appengine / tools / devappserver2 / constants.py
blobffe6eb6476ccca2c641613ff273ae409dd7ef06b
1 #!/usr/bin/env python
3 # Copyright 2007 Google Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 """Constants used by the devappserver2."""
20 # These statuses must not include a response body (RFC 2616).
21 NO_BODY_RESPONSE_STATUSES = frozenset([100, 101, 204, 304])
23 # The Cache-Control directives that specify non-public caching.
24 # At least one of these directives must be given if the Set-Cookie header is
25 # present.
26 NON_PUBLIC_CACHE_CONTROLS = frozenset(['private', 'no-cache', 'no-store'])
28 # All of these headers will be stripped from the request.
29 # See:
30 # https://developers.google.com/appengine/docs/python/runtime#Request_Headers
32 IGNORED_REQUEST_HEADERS = frozenset([
33 'accept-encoding',
34 'connection',
35 'keep-alive',
36 'proxy-authorization',
37 'te',
38 'trailer',
39 'transfer-encoding',
40 'x-appengine-fake-is-admin',
41 'x-appengine-fake-logged-in',
44 # All of these headers will be stripped from the response.
45 # See: https://developers.google.com/appengine/docs/python/runtime#Responses
46 # Note: Content-Length is set by a subsequent rewriter or removed.
47 # Note: Server and Date are then set by devappserver2.
49 _COMMON_IGNORED_RESPONSE_HEADERS = frozenset([
50 'connection',
51 'content-encoding',
52 'date',
53 'keep-alive',
54 'proxy-authenticate',
55 'server',
56 'trailer',
57 'transfer-encoding',
58 'upgrade',
60 FRONTEND_IGNORED_RESPONSE_HEADERS = frozenset([
61 'x-appengine-blobkey',
62 ]) | _COMMON_IGNORED_RESPONSE_HEADERS
63 RUNTIME_IGNORED_RESPONSE_HEADERS = _COMMON_IGNORED_RESPONSE_HEADERS
65 # Maximum size of the response from the runtime. An error will be returned if
66 # this limit is exceeded.
67 MAX_RUNTIME_RESPONSE_SIZE = 32 << 20 # 32 MB
69 # A header that indicates to the authorization system that the request should
70 # be considered to have been made by an administrator.
71 FAKE_IS_ADMIN_HEADER = 'HTTP_X_APPENGINE_FAKE_IS_ADMIN'
73 # A header that indicates to the authorization system that the request should
74 # be considered to have been made by a logged-in user.
75 FAKE_LOGGED_IN_HEADER = 'HTTP_X_APPENGINE_FAKE_LOGGED_IN'