Mercurial > hg
annotate mercurial/compat.h @ 36861:a88d68dc3ee8
hgweb: create dedicated type for WSGI responses
We have refactored the request side of WSGI processing into a dedicated
type. Now let's do the same thing for the response side.
We invent a ``wsgiresponse`` type. It takes an instance of a
request (for consulation) and the WSGI application's "start_response"
handler.
The type basically allows setting the HTTP status line, response
headers, and the response body.
The WSGI application calls sendresponse() to start sending output.
Output is emitted as a generator to be fed through the WSGI application.
According to PEP 3333, this is the preferred way for output to be
transmitted. (Our legacy ``wsgirequest`` exposed a write() to send
data. We do not wish to support this API because it isn't recommended
by PEP 3333.)
The wire protocol code has been ported to use the new API.
Differential Revision: https://phab.mercurial-scm.org/D2775
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 10 Mar 2018 11:23:05 -0800 |
parents | f4433f2713d0 |
children | 11ed2eadf937 |
rev | line source |
---|---|
29444
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
1 #ifndef _HG_COMPAT_H_ |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
2 #define _HG_COMPAT_H_ |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
3 |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
4 #ifdef _WIN32 |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
5 #ifdef _MSC_VER |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
6 /* msvc 6.0 has problems */ |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
7 #define inline __inline |
29521
83147ff53112
compat: provide a declaration of ssize_t, for MS windows
Maciej Fijalkowski <fijall@gmail.com>
parents:
29444
diff
changeset
|
8 #if defined(_WIN64) |
83147ff53112
compat: provide a declaration of ssize_t, for MS windows
Maciej Fijalkowski <fijall@gmail.com>
parents:
29444
diff
changeset
|
9 typedef __int64 ssize_t; |
33926
f4433f2713d0
encoding: add function to test if a str consists of ASCII characters
Yuya Nishihara <yuya@tcha.org>
parents:
29549
diff
changeset
|
10 typedef unsigned __int64 uintptr_t; |
29521
83147ff53112
compat: provide a declaration of ssize_t, for MS windows
Maciej Fijalkowski <fijall@gmail.com>
parents:
29444
diff
changeset
|
11 #else |
29549
7b22599dcb85
compat: define ssize_t as int on 32bit Windows, silences C4142 warning
Yuya Nishihara <yuya@tcha.org>
parents:
29521
diff
changeset
|
12 typedef int ssize_t; |
33926
f4433f2713d0
encoding: add function to test if a str consists of ASCII characters
Yuya Nishihara <yuya@tcha.org>
parents:
29549
diff
changeset
|
13 typedef unsigned int uintptr_t; |
29521
83147ff53112
compat: provide a declaration of ssize_t, for MS windows
Maciej Fijalkowski <fijall@gmail.com>
parents:
29444
diff
changeset
|
14 #endif |
29444
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
15 typedef signed char int8_t; |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
16 typedef short int16_t; |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
17 typedef long int32_t; |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
18 typedef __int64 int64_t; |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
19 typedef unsigned char uint8_t; |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
20 typedef unsigned short uint16_t; |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
21 typedef unsigned long uint32_t; |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
22 typedef unsigned __int64 uint64_t; |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
23 #else |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
24 #include <stdint.h> |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
25 #endif |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
26 #else |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
27 /* not windows */ |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
28 #include <sys/types.h> |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
29 #if defined __BEOS__ && !defined __HAIKU__ |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
30 #include <ByteOrder.h> |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
31 #else |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
32 #include <arpa/inet.h> |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
33 #endif |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
34 #include <inttypes.h> |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
35 #endif |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
36 |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
37 #if defined __hpux || defined __SUNPRO_C || defined _AIX |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
38 #define inline |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
39 #endif |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
40 |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
41 #ifdef __linux |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
42 #define inline __inline |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
43 #endif |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
44 |
284d742e5611
internals: move the bitmanipulation routines into its own file
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
45 #endif |