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
26 NON_PUBLIC_CACHE_CONTROLS
= frozenset(['private', 'no-cache', 'no-store'])
28 # All of these headers will be stripped from the request.
30 # https://developers.google.com/appengine/docs/python/runtime#Request_Headers
32 IGNORED_REQUEST_HEADERS
= frozenset([
36 'proxy-authorization',
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([
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'