mirror of
https://github.com/nodejs/node-v0.x-archive.git
synced 2026-04-28 03:01:10 -04:00
Compare commits
929 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4bb914bde9 | ||
|
|
d1f36accbf | ||
|
|
7d425a0a16 | ||
|
|
9eaf2329e7 | ||
|
|
d0beac70f4 | ||
|
|
e530507cb1 | ||
|
|
6d75c06e64 | ||
|
|
2dc17e93ee | ||
|
|
02aae22397 | ||
|
|
c9d3a81db0 | ||
|
|
033ab7ebb6 | ||
|
|
c6406f9e57 | ||
|
|
ea700a8851 | ||
|
|
632da2a393 | ||
|
|
c4161f32f5 | ||
|
|
c970968ee6 | ||
|
|
1dad95a3a9 | ||
|
|
7d73779446 | ||
|
|
1d78159e8f | ||
|
|
3d0627dc6a | ||
|
|
e27418ca3f | ||
|
|
a59483bd1d | ||
|
|
c9e5cfcc34 | ||
|
|
5bdcec67f0 | ||
|
|
e3d1808ef0 | ||
|
|
6636bfaa0a | ||
|
|
66767edf12 | ||
|
|
953561ab06 | ||
|
|
4f2ab03e97 | ||
|
|
f1762ff815 | ||
|
|
dc65cbd2e9 | ||
|
|
70baeba8a9 | ||
|
|
d4f1ab00d2 | ||
|
|
8ef683dead | ||
|
|
c444293be9 | ||
|
|
32e8692b06 | ||
|
|
5138992f3c | ||
|
|
a473b8dafb | ||
|
|
2ca63c8f79 | ||
|
|
137c361517 | ||
|
|
5a87bd168d | ||
|
|
a3c91c216f | ||
|
|
9a7fb3c988 | ||
|
|
dac4d486ec | ||
|
|
0ea0b921b7 | ||
|
|
a952231640 | ||
|
|
bb46b63e33 | ||
|
|
13b14300b9 | ||
|
|
a0c55dfe09 | ||
|
|
0ec57ea34c | ||
|
|
5d60b06b76 | ||
|
|
6bc9b2ef92 | ||
|
|
ee5366a410 | ||
|
|
c30f113712 | ||
|
|
5b8c62f7d1 | ||
|
|
180dfca03f | ||
|
|
0b0faceb19 | ||
|
|
5bca100afe | ||
|
|
093dfaf801 | ||
|
|
0665f0271e | ||
|
|
47c40bf18d | ||
|
|
dc2b4b2a81 | ||
|
|
6525c04522 | ||
|
|
0ce9cbab29 | ||
|
|
e76cd53431 | ||
|
|
02cc39f221 | ||
|
|
92789b16e5 | ||
|
|
a0159b4b29 | ||
|
|
fbdff52b44 | ||
|
|
5a21138e37 | ||
|
|
e9c7195471 | ||
|
|
8c6a7b5de4 | ||
|
|
c4f8f871c9 | ||
|
|
fcc38129a3 | ||
|
|
c70acbb1a3 | ||
|
|
e41e078159 | ||
|
|
e4bca19843 | ||
|
|
a0e9a510b0 | ||
|
|
c0d69a4883 | ||
|
|
d3532a4bf2 | ||
|
|
33685fee48 | ||
|
|
da96e07bbe | ||
|
|
712c74fc7a | ||
|
|
ea9006a5bc | ||
|
|
558e5ba2b0 | ||
|
|
7c57eb2aec | ||
|
|
c5c1dc5dda | ||
|
|
e681abe5cb | ||
|
|
cf1811a6d3 | ||
|
|
b46f10a11f | ||
|
|
a1138c6f2a | ||
|
|
dd53ceebe4 | ||
|
|
e232f6e735 | ||
|
|
ddbaeef1b3 | ||
|
|
09329cbb04 | ||
|
|
f22c248e4c | ||
|
|
ac58d3a665 | ||
|
|
11ea8da9c3 | ||
|
|
db78043d52 | ||
|
|
a128451004 | ||
|
|
08d8116f6b | ||
|
|
cd48649c61 | ||
|
|
d8f2880ca4 | ||
|
|
ec1589875c | ||
|
|
127f17a0ea | ||
|
|
c5d32b3c64 | ||
|
|
5dab4be53c | ||
|
|
89e398f075 | ||
|
|
855210ce0b | ||
|
|
28a86c3e56 | ||
|
|
504a80dc6d | ||
|
|
1fe450c62c | ||
|
|
09229820e7 | ||
|
|
5f3464cf4e | ||
|
|
355936dcde | ||
|
|
ea540c94f8 | ||
|
|
4b947310b2 | ||
|
|
09157369b3 | ||
|
|
e15e214747 | ||
|
|
7286b79521 | ||
|
|
486c74e72b | ||
|
|
70188499b0 | ||
|
|
81afb54c0a | ||
|
|
db98d6e4e0 | ||
|
|
5ea2a61596 | ||
|
|
fa94d55f87 | ||
|
|
4a329af418 | ||
|
|
4c16dd7c5c | ||
|
|
4476ce04dc | ||
|
|
d1d4695474 | ||
|
|
5a36d1b86f | ||
|
|
99ba903d46 | ||
|
|
9032bfce59 | ||
|
|
aed0ba3211 | ||
|
|
6d7242b485 | ||
|
|
a326eebac8 | ||
|
|
645c3b3713 | ||
|
|
22cf5a24db | ||
|
|
e514f575f3 | ||
|
|
1dbbaa7fa0 | ||
|
|
144b2a5338 | ||
|
|
02083412eb | ||
|
|
86727b15f3 | ||
|
|
bc02d47b21 | ||
|
|
711196cafa | ||
|
|
3fceb491d4 | ||
|
|
b6face1dce | ||
|
|
735b9d50a3 | ||
|
|
85827bde34 | ||
|
|
6057747e9e | ||
|
|
1db59afb75 | ||
|
|
7a7feb8cd3 | ||
|
|
105501c195 | ||
|
|
97970b05fe | ||
|
|
bf89872306 | ||
|
|
be2457aaca | ||
|
|
8012f2cb7a | ||
|
|
102b1d999d | ||
|
|
a52f59b437 | ||
|
|
6285fac232 | ||
|
|
7fcfb7b981 | ||
|
|
73318fa09d | ||
|
|
fa8ffaf9b2 | ||
|
|
1b6b090cdc | ||
|
|
14e6b07f63 | ||
|
|
342b8b2ed2 | ||
|
|
ea29cb4e46 | ||
|
|
a530c23d96 | ||
|
|
b57c1f51b9 | ||
|
|
a6f6532dfb | ||
|
|
a2b3c865c9 | ||
|
|
03e5da8429 | ||
|
|
4f32a59307 | ||
|
|
f123a1ab40 | ||
|
|
446beebd79 | ||
|
|
b52b4196ab | ||
|
|
12554380d5 | ||
|
|
d695486185 | ||
|
|
b64791c7e4 | ||
|
|
611dffabb6 | ||
|
|
6aa92d5289 | ||
|
|
7b2f5ab7f8 | ||
|
|
f0b8cc6a94 | ||
|
|
7a3971e433 | ||
|
|
80b5a52217 | ||
|
|
a87172f9b2 | ||
|
|
5749f91814 | ||
|
|
3422263414 | ||
|
|
f6479f2fb6 | ||
|
|
a16b3c3148 | ||
|
|
b1088d6bd2 | ||
|
|
bb6d468dd8 | ||
|
|
11b2ee7632 | ||
|
|
c11f3f8b0f | ||
|
|
6063ea62df | ||
|
|
5890272538 | ||
|
|
c321e9893d | ||
|
|
2320497992 | ||
|
|
794e7be4f8 | ||
|
|
d42098651b | ||
|
|
118b88e44f | ||
|
|
56074d1056 | ||
|
|
a93634007a | ||
|
|
464ced4a86 | ||
|
|
15d5378684 | ||
|
|
d722c8df73 | ||
|
|
7515360951 | ||
|
|
cbdcc1d5f3 | ||
|
|
f11291a220 | ||
|
|
9c29ac6feb | ||
|
|
952bbb86b5 | ||
|
|
296802c641 | ||
|
|
cd9515efd9 | ||
|
|
1f18648394 | ||
|
|
2ba3c10d62 | ||
|
|
849792e46b | ||
|
|
544877d12e | ||
|
|
0b1214c16b | ||
|
|
3884b4185a | ||
|
|
02039c9b53 | ||
|
|
42357645cb | ||
|
|
d3fbe3e3d1 | ||
|
|
fa556a1425 | ||
|
|
a6d8425382 | ||
|
|
5d6a03c9fe | ||
|
|
10ff559ec3 | ||
|
|
7c3c5c6861 | ||
|
|
5a84461e46 | ||
|
|
e1250a3333 | ||
|
|
5ba0be6166 | ||
|
|
d74c506044 | ||
|
|
dcc547d798 | ||
|
|
913789da3e | ||
|
|
df46c8e698 | ||
|
|
2a750bffcc | ||
|
|
8b980d729c | ||
|
|
57eb5cb9a0 | ||
|
|
6ff12c425e | ||
|
|
57d8172906 | ||
|
|
2219c64a04 | ||
|
|
5908bdab9a | ||
|
|
bce092aeb8 | ||
|
|
57de0b11db | ||
|
|
9f1b27bf76 | ||
|
|
8d27393aa2 | ||
|
|
8591057fa3 | ||
|
|
d4b726a1a6 | ||
|
|
9da29a6109 | ||
|
|
241ea7e595 | ||
|
|
17307e386e | ||
|
|
c87b7b7c69 | ||
|
|
ce9a54aa1f | ||
|
|
03fa258df7 | ||
|
|
cea3a95f9f | ||
|
|
cf05257fb7 | ||
|
|
a01e09502e | ||
|
|
9bf93de532 | ||
|
|
84a5a69d9f | ||
|
|
e5cc6388cb | ||
|
|
90d1e47323 | ||
|
|
4144024e6b | ||
|
|
939fba40fd | ||
|
|
ade8cf96e0 | ||
|
|
879a9e0548 | ||
|
|
702a923da7 | ||
|
|
473721979d | ||
|
|
00a1d61cc8 | ||
|
|
8b1082825c | ||
|
|
183f6c2077 | ||
|
|
a375c6ae9a | ||
|
|
19ed02b286 | ||
|
|
d39d3cec65 | ||
|
|
6b71e0b038 | ||
|
|
0b7fb01e67 | ||
|
|
d7e7161b27 | ||
|
|
9996b459e1 | ||
|
|
25eecd179b | ||
|
|
a6c3d7121b | ||
|
|
f9ad171085 | ||
|
|
09e60aa435 | ||
|
|
17595b5343 | ||
|
|
589e27948b | ||
|
|
d787a444c5 | ||
|
|
bc0118e519 | ||
|
|
b842fbd602 | ||
|
|
320e0020a2 | ||
|
|
e129630e9e | ||
|
|
5d80bdb6ae | ||
|
|
e5a0fbe500 | ||
|
|
de6e88c428 | ||
|
|
8e09b1e2e1 | ||
|
|
564a48643b | ||
|
|
d4af8a6b6a | ||
|
|
c7b24efd21 | ||
|
|
4b4d4afa0a | ||
|
|
06267f4d8d | ||
|
|
d23643051e | ||
|
|
8285f12864 | ||
|
|
c6029c75a4 | ||
|
|
07da49b095 | ||
|
|
a3750a9833 | ||
|
|
b4def4806c | ||
|
|
029180a93c | ||
|
|
6ce007e89a | ||
|
|
515f006b6e | ||
|
|
07812c47a4 | ||
|
|
97c9745063 | ||
|
|
41c1563584 | ||
|
|
f1391f33cd | ||
|
|
ea78d995e0 | ||
|
|
fd725efa8f | ||
|
|
7a7e88d44b | ||
|
|
6bf97808ee | ||
|
|
fac6db1b56 | ||
|
|
2b08bacd56 | ||
|
|
2fa260cef6 | ||
|
|
ae802e3867 | ||
|
|
7c90ff5d41 | ||
|
|
5e11b8a937 | ||
|
|
9c2969253b | ||
|
|
016fdab43e | ||
|
|
98e7d3506f | ||
|
|
ef9e716fd1 | ||
|
|
268bcbde7c | ||
|
|
ccdd979a69 | ||
|
|
7a48fd8455 | ||
|
|
fa7dcbec8b | ||
|
|
9bea4c8d58 | ||
|
|
818e56d44b | ||
|
|
23927751eb | ||
|
|
a6f246b9f5 | ||
|
|
c9f656baa9 | ||
|
|
d4f1e6a023 | ||
|
|
c032350f64 | ||
|
|
e190c9616e | ||
|
|
1eb547fec1 | ||
|
|
5171da5a6c | ||
|
|
65dced730f | ||
|
|
73cfda12bb | ||
|
|
ad61d77fa3 | ||
|
|
74d0a077ec | ||
|
|
899fffa395 | ||
|
|
987cbbc191 | ||
|
|
4c514a723c | ||
|
|
fd70d30a9c | ||
|
|
67652ddf27 | ||
|
|
38dde9684f | ||
|
|
aeb9bed63e | ||
|
|
ac54272218 | ||
|
|
79ecc8e9b7 | ||
|
|
bc47353bbe | ||
|
|
79944006e2 | ||
|
|
5cc29b80f2 | ||
|
|
dcc4fffe4d | ||
|
|
d1e5fbdde4 | ||
|
|
72aee8216c | ||
|
|
9bbc7e0bc7 | ||
|
|
2470d2ee92 | ||
|
|
a7b4af0ae5 | ||
|
|
5175864c0e | ||
|
|
43022eabf7 | ||
|
|
eaba4fc2bf | ||
|
|
5cf4ceff59 | ||
|
|
583c07bf8b | ||
|
|
97977640bd | ||
|
|
1128c0bf67 | ||
|
|
6ea61acf29 | ||
|
|
1ce4684a27 | ||
|
|
446d2ec19c | ||
|
|
8da020d39e | ||
|
|
9977831078 | ||
|
|
7eed71f8bb | ||
|
|
fcd0c3ebc0 | ||
|
|
15594eaf87 | ||
|
|
bb85e7751f | ||
|
|
1582cfebd6 | ||
|
|
477df1aaec | ||
|
|
38f117cb6d | ||
|
|
44234e9cc7 | ||
|
|
0ac2ef924f | ||
|
|
9bf2975f78 | ||
|
|
d9a5edb2b0 | ||
|
|
dd52737476 | ||
|
|
b3e60c7b25 | ||
|
|
d5e966154c | ||
|
|
d9b08d66d6 | ||
|
|
b2969a9155 | ||
|
|
fb8830a64f | ||
|
|
604f4fdf8c | ||
|
|
92c5634cbd | ||
|
|
99e19aa398 | ||
|
|
174a3a9a08 | ||
|
|
3b861db31d | ||
|
|
2629296c25 | ||
|
|
ceb5331a64 | ||
|
|
33e45bbe46 | ||
|
|
6570cd99e5 | ||
|
|
5a98fa4809 | ||
|
|
78da9cb052 | ||
|
|
5e14c8bec0 | ||
|
|
b0adaff67e | ||
|
|
bfc6b51d95 | ||
|
|
492fc0d752 | ||
|
|
b0aadbea6b | ||
|
|
8c0e87f9c3 | ||
|
|
bd8e4f656e | ||
|
|
226eff5104 | ||
|
|
3407dab07f | ||
|
|
179a7f6ffa | ||
|
|
a313f38c34 | ||
|
|
1b2f6f9e29 | ||
|
|
5d400cfd3a | ||
|
|
b14eeb3c1e | ||
|
|
c735b4663a | ||
|
|
40f675b64b | ||
|
|
4adadc38f4 | ||
|
|
97255c2651 | ||
|
|
56df0cbf93 | ||
|
|
74c8b5fd08 | ||
|
|
25b5bc01a6 | ||
|
|
cf1db4f304 | ||
|
|
ccf2a04ea2 | ||
|
|
a6ee3bac85 | ||
|
|
3cf4827ae0 | ||
|
|
ff456b3886 | ||
|
|
cdde22a27d | ||
|
|
9b1ff070e6 | ||
|
|
73b29d79b9 | ||
|
|
045bd4c7a4 | ||
|
|
6691aca229 | ||
|
|
f61b110cf6 | ||
|
|
0fcb3bd3a9 | ||
|
|
c4636a578c | ||
|
|
901d5fd0d2 | ||
|
|
32aadd9400 | ||
|
|
8139bb24c1 | ||
|
|
372a7c9a3e | ||
|
|
d2c47b4f87 | ||
|
|
a3604cf233 | ||
|
|
0e1a581916 | ||
|
|
7bfefb5250 | ||
|
|
83db91be41 | ||
|
|
c1aa8ea944 | ||
|
|
ee8522996a | ||
|
|
1879d8211d | ||
|
|
7e24a05cba | ||
|
|
e38eb0c5a4 | ||
|
|
0a0e90dcca | ||
|
|
50443f08e0 | ||
|
|
2944e03a03 | ||
|
|
007881b648 | ||
|
|
3cd09e7ba5 | ||
|
|
1d3142a882 | ||
|
|
81ac0d5088 | ||
|
|
cdd1d675a7 | ||
|
|
393f0071e4 | ||
|
|
8ab691726d | ||
|
|
1af52d28ca | ||
|
|
9d248f690a | ||
|
|
0cf03ab800 | ||
|
|
bc695475b9 | ||
|
|
fe74283e1d | ||
|
|
a6017660d8 | ||
|
|
5dd08c6c71 | ||
|
|
f23eb282c0 | ||
|
|
783f5019b0 | ||
|
|
39b9043bef | ||
|
|
d164989e3f | ||
|
|
b5359e40be | ||
|
|
ae87007478 | ||
|
|
634c4bf0b0 | ||
|
|
f7a9eea0d4 | ||
|
|
0003c701bc | ||
|
|
54e844cf08 | ||
|
|
3d4e4d8909 | ||
|
|
9481bc1009 | ||
|
|
5986a582d9 | ||
|
|
7fca101338 | ||
|
|
dbf0d6bb70 | ||
|
|
8ff7954165 | ||
|
|
38f8665f3a | ||
|
|
48d7a1edc1 | ||
|
|
3faa3b56f3 | ||
|
|
29cc78f824 | ||
|
|
e9b6b0b327 | ||
|
|
d59512f6f4 | ||
|
|
4a7562d28f | ||
|
|
c9627e0a0d | ||
|
|
5829716649 | ||
|
|
5a4c40beea | ||
|
|
914ff78df6 | ||
|
|
265cda97d7 | ||
|
|
1b24fc6678 | ||
|
|
43ddc04bb0 | ||
|
|
5cc1428d5f | ||
|
|
1a2c1c8a96 | ||
|
|
ee9af66990 | ||
|
|
c3bc48d451 | ||
|
|
f323f34353 | ||
|
|
55c65cc2d5 | ||
|
|
9911629de0 | ||
|
|
163485c8aa | ||
|
|
7bd94712a8 | ||
|
|
d89f8dce28 | ||
|
|
fe060916ec | ||
|
|
3a64c22cc1 | ||
|
|
069d973d74 | ||
|
|
7c5cc57ece | ||
|
|
f9d6b074cf | ||
|
|
353e2565d5 | ||
|
|
3fc9192d0d | ||
|
|
5535aa3d51 | ||
|
|
4d0456f827 | ||
|
|
4df999f85f | ||
|
|
893ebe7230 | ||
|
|
e227441248 | ||
|
|
cc1d61cbb3 | ||
|
|
dff1b5ad10 | ||
|
|
9922e4e433 | ||
|
|
754fde7325 | ||
|
|
1b1bee8099 | ||
|
|
0f16af7ee4 | ||
|
|
fc334b3a97 | ||
|
|
354150f4e1 | ||
|
|
bb08f0c219 | ||
|
|
2d348bb985 | ||
|
|
27af64ef46 | ||
|
|
8e246acd0e | ||
|
|
1e63cd69f8 | ||
|
|
124fbedc2f | ||
|
|
db73c71280 | ||
|
|
4962702e4a | ||
|
|
776754c33f | ||
|
|
9628e28aec | ||
|
|
01b3418e2e | ||
|
|
5a801d63d1 | ||
|
|
f8ce848d9b | ||
|
|
31f8fa222e | ||
|
|
6680c7fbf7 | ||
|
|
6eca948ca2 | ||
|
|
3def66ac3b | ||
|
|
431e43009c | ||
|
|
d2de8ba400 | ||
|
|
42eb5a6898 | ||
|
|
bbbcd1fee0 | ||
|
|
6da0593162 | ||
|
|
5a00d9d50f | ||
|
|
c8f9728de7 | ||
|
|
251d03197f | ||
|
|
a63fd0fe56 | ||
|
|
f08985c193 | ||
|
|
3e0a8f3ad8 | ||
|
|
4e6b9b0992 | ||
|
|
d429033fd7 | ||
|
|
6abbfa09ff | ||
|
|
bcad5403d6 | ||
|
|
f47ad10db7 | ||
|
|
6560ab9073 | ||
|
|
6bdc42cee7 | ||
|
|
ae8f8e7258 | ||
|
|
feea1330cc | ||
|
|
77fc61d539 | ||
|
|
4fe3007a1a | ||
|
|
83ff473d30 | ||
|
|
686d9f9cc6 | ||
|
|
61448bfc4e | ||
|
|
422d3c93bc | ||
|
|
debf389490 | ||
|
|
5c9b9c2e70 | ||
|
|
efdd73c8e4 | ||
|
|
aef0d8086b | ||
|
|
2d09ef8541 | ||
|
|
0ef8a86af2 | ||
|
|
678fa31136 | ||
|
|
9a701b0a70 | ||
|
|
3a9570386a | ||
|
|
85fb47c11c | ||
|
|
7628905a9b | ||
|
|
f870240dcf | ||
|
|
5d42cc3a44 | ||
|
|
98683d285c | ||
|
|
b8bfbdab48 | ||
|
|
5bc4efe820 | ||
|
|
380d12832c | ||
|
|
efc723787a | ||
|
|
71d67dbf48 | ||
|
|
ba2e4a2306 | ||
|
|
3e9f636b64 | ||
|
|
8078ed1f86 | ||
|
|
ff027d571b | ||
|
|
17ba821e60 | ||
|
|
d3fcd1c75a | ||
|
|
6135941eea | ||
|
|
8b4f1e05f9 | ||
|
|
5da4faf8c7 | ||
|
|
5f935f6c14 | ||
|
|
5506f99dfa | ||
|
|
ececd92f62 | ||
|
|
1f947f7b41 | ||
|
|
7b772f3f68 | ||
|
|
d5bdda74c1 | ||
|
|
6ea99721f1 | ||
|
|
1cf538a60a | ||
|
|
2dda6be799 | ||
|
|
565d862f3c | ||
|
|
b87669cbf4 | ||
|
|
2b07c9fcae | ||
|
|
746d487da8 | ||
|
|
ef54777fa5 | ||
|
|
17f3ffa633 | ||
|
|
ba0c32e2e1 | ||
|
|
9a6d2c35a1 | ||
|
|
8796ed2278 | ||
|
|
512016fd74 | ||
|
|
0e501f4ec5 | ||
|
|
ccf4afa256 | ||
|
|
f5e4047064 | ||
|
|
75f922c863 | ||
|
|
71651bf8b2 | ||
|
|
6789ab16d8 | ||
|
|
2a03d5802b | ||
|
|
8718fa54f6 | ||
|
|
24ac87f543 | ||
|
|
1d961a6630 | ||
|
|
5330fea954 | ||
|
|
cf4b5fc52a | ||
|
|
1d0fb850d9 | ||
|
|
4fe5e86a7e | ||
|
|
1be722a271 | ||
|
|
3c00ec4e48 | ||
|
|
cda1a38426 | ||
|
|
0e311717b5 | ||
|
|
7347fb3e2c | ||
|
|
5be6ab6cdb | ||
|
|
a055153cda | ||
|
|
f188b9d6d7 | ||
|
|
af9aa93e0c | ||
|
|
9c7c6e93e1 | ||
|
|
d5214b3627 | ||
|
|
db23af05b0 | ||
|
|
635986e433 | ||
|
|
e49be4768b | ||
|
|
37b6e10684 | ||
|
|
57642e2349 | ||
|
|
4fdebab005 | ||
|
|
f86ad1693f | ||
|
|
44a287987e | ||
|
|
e8b3751743 | ||
|
|
51224f12ca | ||
|
|
d9eb64928e | ||
|
|
6078c37be5 | ||
|
|
748469c71c | ||
|
|
fd3e84499e | ||
|
|
c209e57e50 | ||
|
|
072750e662 | ||
|
|
e55c486801 | ||
|
|
8ec21059dd | ||
|
|
0e1e00e68b | ||
|
|
bedca2e7a9 | ||
|
|
a834d93d2c | ||
|
|
2982e75a0b | ||
|
|
488aff085b | ||
|
|
33e919ae6f | ||
|
|
7fc794a8ec | ||
|
|
4fcbc1b64a | ||
|
|
9283e134e5 | ||
|
|
51ecba8da9 | ||
|
|
0c20c588af | ||
|
|
81a53e83ab | ||
|
|
60b93cca6d | ||
|
|
12a169e8ff | ||
|
|
293809b8b6 | ||
|
|
1aeaf8d289 | ||
|
|
5c1ffa165f | ||
|
|
2134982ea4 | ||
|
|
c5eb1b55d9 | ||
|
|
0906f945be | ||
|
|
28b21d15c3 | ||
|
|
5bce8ed118 | ||
|
|
2b126da395 | ||
|
|
5dc2b93311 | ||
|
|
9253333850 | ||
|
|
39b432e42a | ||
|
|
41ad33910f | ||
|
|
cf2b206a8e | ||
|
|
1872719b8c | ||
|
|
91757fa840 | ||
|
|
d4f4380f7e | ||
|
|
03dda31b75 | ||
|
|
32e309440f | ||
|
|
6744e59e46 | ||
|
|
4db608dbba | ||
|
|
ae5d613b3e | ||
|
|
4593c04959 | ||
|
|
cde80d9859 | ||
|
|
ff953dccf1 | ||
|
|
13a3bf5b7d | ||
|
|
361759d179 | ||
|
|
1b589be1d6 | ||
|
|
49cd211dff | ||
|
|
b14dd49222 | ||
|
|
a8c2bb41af | ||
|
|
03123435e0 | ||
|
|
4bbab14346 | ||
|
|
0e8d858aba | ||
|
|
d8642a8aa6 | ||
|
|
cf909e8725 | ||
|
|
758f12f34c | ||
|
|
083ee0f8b7 | ||
|
|
9acd76ed6e | ||
|
|
72e4a49cac | ||
|
|
8d5e05668b | ||
|
|
7059be19ec | ||
|
|
1c9a85b9a6 | ||
|
|
06634f48eb | ||
|
|
5185c15ef7 | ||
|
|
49888a01c3 | ||
|
|
883b3e2873 | ||
|
|
fd3cd755d1 | ||
|
|
9395786d11 | ||
|
|
3d551e5538 | ||
|
|
a5be730906 | ||
|
|
1c5d5e0b72 | ||
|
|
7d4e8a9a71 | ||
|
|
f4f05a8851 | ||
|
|
e07f568230 | ||
|
|
3aa5cfde10 | ||
|
|
5033da733d | ||
|
|
cf5ae13f85 | ||
|
|
7068912fbb | ||
|
|
e8c2453f6d | ||
|
|
aaa1f451e6 | ||
|
|
94914135df | ||
|
|
d408de87fc | ||
|
|
e8795cea30 | ||
|
|
a8e1e8d057 | ||
|
|
e15221a8de | ||
|
|
fe3e419687 | ||
|
|
ffbbc465d3 | ||
|
|
6cd32fb62e | ||
|
|
a4906c7c83 | ||
|
|
0a3eff8021 | ||
|
|
78520ba482 | ||
|
|
0b925d075d | ||
|
|
81f5ed5c65 | ||
|
|
7db5c8a10d | ||
|
|
24c6d26cca | ||
|
|
adec544fdd | ||
|
|
31b59400f8 | ||
|
|
1a1214866f | ||
|
|
e9aacd40c6 | ||
|
|
a6bc68a83b | ||
|
|
4b19bd2896 | ||
|
|
d9fbb8a580 | ||
|
|
3214116be6 | ||
|
|
71009ad3fe | ||
|
|
65037eeb32 | ||
|
|
dc8c079d90 | ||
|
|
e59b3f0eb3 | ||
|
|
b2a2bb736b | ||
|
|
c38dd24dc5 | ||
|
|
f72ac17c89 | ||
|
|
cf49fc7bfe | ||
|
|
f291fbc8a7 | ||
|
|
95638c9b0d | ||
|
|
b5b83b210b | ||
|
|
505178d82b | ||
|
|
8052dd0022 | ||
|
|
5459e5c606 | ||
|
|
b3c0359b56 | ||
|
|
d489555553 | ||
|
|
f7c5334195 | ||
|
|
23cf556c6c | ||
|
|
552cf28260 | ||
|
|
eeaf1ef970 | ||
|
|
93cb09642d | ||
|
|
eeb54c63d8 | ||
|
|
28db0c2562 | ||
|
|
66deea10c7 | ||
|
|
6fdb874e2e | ||
|
|
2a4568c85f | ||
|
|
402bcb83bc | ||
|
|
8ab3c3e7c3 | ||
|
|
a585c5bbb3 | ||
|
|
2c1ca4078d | ||
|
|
528015e0d8 | ||
|
|
138593b156 | ||
|
|
f0f247d7e5 | ||
|
|
e0d6f14b22 | ||
|
|
cb97cdb256 | ||
|
|
e4eeaa7fbc | ||
|
|
07ab34cd58 | ||
|
|
f5f7cb9264 | ||
|
|
56f200af5d | ||
|
|
8acea2693d | ||
|
|
5ebf6049d0 | ||
|
|
d75b63bc3c | ||
|
|
7067a7155f | ||
|
|
352b8c3ad5 | ||
|
|
49e0f14a2f | ||
|
|
a9d8cac4b0 | ||
|
|
299671b731 | ||
|
|
f18d9d8466 | ||
|
|
c7e0c64506 | ||
|
|
bb2acd5e75 | ||
|
|
eda1edd07f | ||
|
|
9a26946aaa | ||
|
|
0ed3532699 | ||
|
|
65f2e72d77 | ||
|
|
0fd1656d63 | ||
|
|
02746eddd6 | ||
|
|
341e41726f | ||
|
|
11a784d6da | ||
|
|
fa344d8514 | ||
|
|
0174ceb6b2 | ||
|
|
458bbb4687 | ||
|
|
1662c37c40 | ||
|
|
dcd41ca864 | ||
|
|
078a48a97b | ||
|
|
98341daee2 | ||
|
|
02729d4af7 | ||
|
|
6961bc568f | ||
|
|
bd05d83ae7 | ||
|
|
c926ab7746 | ||
|
|
8921bf454d | ||
|
|
4c6f4dabf5 | ||
|
|
9fd5e3c89c | ||
|
|
9472812569 | ||
|
|
ddad872020 | ||
|
|
6a57a42109 | ||
|
|
3a00470dbb | ||
|
|
5f30377bbc | ||
|
|
4e50197e53 | ||
|
|
e7c4f8cdaa | ||
|
|
b64a521d66 | ||
|
|
8e2530c320 | ||
|
|
870aa3d97f | ||
|
|
ace2be8aa6 | ||
|
|
82daa46e26 | ||
|
|
4f7f43762d | ||
|
|
e65c27062f | ||
|
|
e51aef7f3c | ||
|
|
208290b524 | ||
|
|
e5bb8abc9d | ||
|
|
8dbfe5ea8f | ||
|
|
30dadfc033 | ||
|
|
781d51285d | ||
|
|
fb645f75fb | ||
|
|
50c38dec70 | ||
|
|
16cb45103f | ||
|
|
2085909aeb | ||
|
|
6bf294d71a | ||
|
|
367b87d26d | ||
|
|
49066042a2 | ||
|
|
480164f923 | ||
|
|
99a5d1e293 | ||
|
|
ac2404283e | ||
|
|
c9e505791a | ||
|
|
abd3f8a02a | ||
|
|
4be4b5f6f4 | ||
|
|
554b02a14c | ||
|
|
d700a6f74a | ||
|
|
7a706e4206 | ||
|
|
6eb0b6ac27 | ||
|
|
760fb17bbf | ||
|
|
792c7caf40 | ||
|
|
4e3c5d88b3 | ||
|
|
c8dba94ff6 | ||
|
|
a7763d55e4 | ||
|
|
2b8a9a8358 | ||
|
|
a7e1efc5bd | ||
|
|
b1901cd5a5 | ||
|
|
facb904c5d | ||
|
|
70a8fb3763 | ||
|
|
1191ca052f | ||
|
|
8e9f59a452 | ||
|
|
0bceaaa3d4 | ||
|
|
3d948d85ce | ||
|
|
0315251d01 | ||
|
|
515dc2161b | ||
|
|
a6b8586e94 | ||
|
|
2072925f12 | ||
|
|
94cd83ef34 | ||
|
|
82ce3481fe | ||
|
|
192234c689 | ||
|
|
2998e3bafa | ||
|
|
24de2bd58c | ||
|
|
8a52fb7aeb | ||
|
|
8f8dcf8ed6 | ||
|
|
ce8c30c9de | ||
|
|
d49d53fd49 | ||
|
|
8c8534046c | ||
|
|
f8ca6b383c | ||
|
|
0a8bd34b69 | ||
|
|
02ed0ec93b | ||
|
|
898afbaf34 | ||
|
|
5e86d01385 | ||
|
|
0172cb39f0 | ||
|
|
8ec12339f5 | ||
|
|
d3f04933f1 | ||
|
|
6b430a95c9 | ||
|
|
5aadeae888 | ||
|
|
b69c6a03b1 | ||
|
|
c9e12204a2 | ||
|
|
23172c5d85 | ||
|
|
e2db605308 | ||
|
|
242161bef2 | ||
|
|
5a25338ac0 | ||
|
|
67f7fe5e5c | ||
|
|
bbdd61dc3f | ||
|
|
a2f70da4c9 | ||
|
|
aa491518f4 | ||
|
|
444b33584d | ||
|
|
0499618c2b | ||
|
|
8825c74e7a | ||
|
|
2c0d91be6c | ||
|
|
ba792ea202 | ||
|
|
4c21aa736f | ||
|
|
7b119f8b38 | ||
|
|
f541043618 | ||
|
|
fc175a089d | ||
|
|
f62979da6b | ||
|
|
20905d9d62 | ||
|
|
1b5ec7017d | ||
|
|
7105aeb22f | ||
|
|
ca35ba640a | ||
|
|
95b252e86d | ||
|
|
a8e9923b44 | ||
|
|
9bb890271b |
8
.gitignore
vendored
8
.gitignore
vendored
@@ -4,8 +4,10 @@ tags
|
||||
.lock-wscript
|
||||
*.pyc
|
||||
doc/api.xml
|
||||
doc/api.html
|
||||
doc/changelog.html
|
||||
doc/node.1
|
||||
tools/nodejs.pc
|
||||
test/fixtures/hello.txt
|
||||
tmp/
|
||||
node
|
||||
node_g
|
||||
*.swp
|
||||
.benchmark_reports
|
||||
|
||||
76
AUTHORS
76
AUTHORS
@@ -10,7 +10,7 @@ Jeff Smick <sprsquish@gmail.com>
|
||||
Jon Crosby <jon@joncrosby.me>
|
||||
Felix Geisendörfer <felix@debuggable.com>
|
||||
Ray Morgan <rmorgan@zappos.com>
|
||||
Jérémy Lal <holisme@gmail.com>
|
||||
Jérémy Lal <kapouer@melix.org>
|
||||
Isaac Z. Schlueter <i@izs.me>
|
||||
Brandon Beacher <brandon.beacher@gmail.com>
|
||||
Tim Caswell <tim@creationix.com>
|
||||
@@ -22,11 +22,11 @@ Rhys Jones <rhys@wave.to>
|
||||
Jan Lehnardt <jan@apache.org>
|
||||
Simon Willison <simon@simonwillison.net>
|
||||
Chew Choon Keat <choonkeat@gmail.com>
|
||||
Jed Schmidt <tr@nslator.jp>
|
||||
Jered Schmidt <tr@nslator.jp>
|
||||
Michaeljohn Clement <inimino@inimino.org>
|
||||
Karl Guertin <grayrest@gr.ayre.st>
|
||||
Xavier Shay <xavier@rhnh.net>
|
||||
Christopher Lenz <chris@lamech.local>
|
||||
Christopher Lenz <cmlenz@gmail.com>
|
||||
TJ Holowaychuk <tj@vision-media.ca>
|
||||
Johan Dahlberg <jfd@distrop.com>
|
||||
Simon Cornelius P. Umacob <simoncpu@gmail.com>
|
||||
@@ -38,13 +38,13 @@ David Sklar <david.sklar@gmail.com>
|
||||
Charles Lehner <celehner1@gmail.com>
|
||||
Elliott Cable <me@ell.io>
|
||||
Benjamin Thomas <benjamin@benjaminthomas.org>
|
||||
Vanilla Hsu <v@fatpipi.com>
|
||||
San-Tai Hsu <v@fatpipi.com>
|
||||
Ben Williamson <benw@pobox.com>
|
||||
Joseph Pecoraro <joepeck02@gmail.com>
|
||||
Erich Ocean <erich.ocean@me.com>
|
||||
Alexis Sellier <self@cloudhead.net>
|
||||
Blaine Cook <romeda@gmail.com>
|
||||
Standa Opichal <opichals@gmail.com>
|
||||
Stanislav Opichal <opichals@gmail.com>
|
||||
Aaron Heckmann <aaron.heckmann@gmail.com>
|
||||
Mikeal Rogers <mikeal.rogers@gmail.com>
|
||||
Matt Brubeck <mbrubeck@limpet.net>
|
||||
@@ -59,10 +59,10 @@ Arlo Breault <arlolra@gmail.com>
|
||||
Kris Kowal <kris.kowal@cixar.com>
|
||||
Jacek Becela <jacek.becela@gmail.com>
|
||||
Rob Ellis <kazoomer@gmail.com>
|
||||
Tim-Smart <timehAndGod@gmail.com>
|
||||
Tim Smart <timehAndGod@gmail.com>
|
||||
Herbert Vojčík <herby@mailbox.sk>
|
||||
Krishna Rajendran <krishna@emptybox.org>
|
||||
pyrotechnick <pyrotechnick@feistystudios.com>
|
||||
Nicholas Kinsey <pyrotechnick@feistystudios.com>
|
||||
Scott Taylor <scott@railsnewbie.com>
|
||||
Carson McDonald <carson@ioncannon.net>
|
||||
Matt Ranney <mjr@ranney.com>
|
||||
@@ -71,13 +71,13 @@ Julian Lamb <thepurlieu@gmail.com>
|
||||
Brian Hammond <brian@fictorial.com>
|
||||
Mathias Pettersson <mape@mape.me>
|
||||
Trevor Blackwell <tlb@tlb.org>
|
||||
Thomas Lee <tom@tom-debian.sensis.com.au>
|
||||
Thomas Lee <thomas.lee@shinetech.com>
|
||||
Daniel Berger <code+node@dpbis.net>
|
||||
Paulo Matias <paulo.matias@usp.br>
|
||||
Peter Griess <pg@std.in>
|
||||
Jonathan Knezek <jdknezek@gmail.com>
|
||||
Jonathan Rentzsch <jwr.git@redshed.net>
|
||||
Ben Noordhuis <bnoordhuis@bender.(none)>
|
||||
Ben Noordhuis <info@bnoordhuis.nl>
|
||||
Elijah Insua <tmpvar@gmail.com>
|
||||
Andrew Johnston <apjohnsto@gmail.com>
|
||||
Brian White <mscdex@mscdex.net>
|
||||
@@ -90,3 +90,61 @@ Paul Querna <pquerna@apache.org>
|
||||
Ben Lowery <ben@blowery.org>
|
||||
Peter Dekkers <soderblom.peter@gmail.com>
|
||||
David Siegel <david@artcom.de>
|
||||
Marshall Culpepper <marshall.law@gmail.com>
|
||||
Ruben Rodriguez <cha0s@therealcha0s.net>
|
||||
Dmitry Baranovskiy <Dmitry@Baranovskiy.com>
|
||||
Blake Mizerany <blake.mizerany@gmail.com>
|
||||
Jerome Etienne <jerome.etienne@gmail.com>
|
||||
Dmitriy Shalashov <skaurus@gmail.com>
|
||||
Adam Wiggins <adam@heroku.com>
|
||||
Rick Olson <technoweenie@gmail.com>
|
||||
David Siegel <david.siegel@artcom.de>
|
||||
Sergey Kzyzhanovsky <skryzhanovsky@gmail.com>
|
||||
Marco Rogers <marco.rogers@gmail.com>
|
||||
Benjamin Fritsch <beanie@benle.de>
|
||||
Jan Kassens <jan@kassens.net>
|
||||
Robert Keizer <root@black.bluerack.ca>
|
||||
Sam Shull <brickysam26@gmail.com>
|
||||
Chandra Sekar S <chandru.in@gmail.com>
|
||||
Andrew Naylor <argon@mkbot.net>
|
||||
Benjamin Kramer <benny.kra@gmail.com>
|
||||
Danny Coates <dannycoates@gmail.com>
|
||||
Nick Stenning <nick@whiteink.com>
|
||||
Bert Belder <bertbelder@gmail.com>
|
||||
Trent Mick <trentm@gmail.com>
|
||||
Fedor Indutny <fedor.indutny@gmail.com>
|
||||
Illarionov Oleg <oleg@emby.ru>
|
||||
Aria Stewart <aredridel@nbtsc.org>
|
||||
Johan Euphrosine <proppy@aminche.com>
|
||||
Russell Haering <russellhaering@gmail.com>
|
||||
Bradley Meck <bradley.meck@gmail.com>
|
||||
Tobie Langel <tobie.langel@gmail.com>
|
||||
Tony Metzidis <tonym@tonym.us>
|
||||
Mark Nottingham <mnot@mnot.net>
|
||||
Sam Stephenson <sam@37signals.com>
|
||||
Jorge Chamorro Bieling <jorge@jorgechamorro.com>
|
||||
Evan Larkin <evan.larkin.il.com>
|
||||
Sean Coates <sean@seancoates.com>
|
||||
Tom Hughes <tom.hughes@palm.com>
|
||||
Joshua Peek <josh@joshpeek.com>
|
||||
Nathan Rajlich <nathan@tootallnate.net>
|
||||
Peteris Krumins <peteris.krumins@gmail.com>
|
||||
AJ ONeal <coolaj86@gmail.com>
|
||||
Sami Samhuri <sami.samhuri@gmail.com>
|
||||
Nikhil Marathe <nsm.nikhil@gmail.com>
|
||||
Vitali Lovich <vitali.lovich@palm.com>
|
||||
Stéphan Kochen <stephan@kochen.nl>
|
||||
Oleg Efimov <efimovov@gmail.com>
|
||||
Guillaume Tuton <guillaume@tuton.fr>
|
||||
Tim Cooijmans <tim@aapopfiets.nl>
|
||||
Dan Søndergaard <dan1990@gmail.com>
|
||||
Silas Sewell <silas@sewell.ch>
|
||||
Wade Simmons <wade@wades.im>
|
||||
Daniel Gröber <darklord@darkboxed.org>
|
||||
Travis Swicegood <development@domain51.com>
|
||||
Oleg Slobodskoi <oleg008@gmail.com>
|
||||
Jeremy Martin <jmar777@gmail.com>
|
||||
Michael W <gcr@sneakygcr.net>
|
||||
Sean Braithwaite <brapse@gmail.com>
|
||||
Anders Conbere <aconbere@gmail.com>
|
||||
Devin Torres <devin@devintorres.com>
|
||||
|
||||
94
CMakeLists.txt
Normal file
94
CMakeLists.txt
Normal file
@@ -0,0 +1,94 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
project(node)
|
||||
|
||||
if(USE_GCOV)
|
||||
set(CMAKE_BUILD_TYPE "Debug")
|
||||
|
||||
# Set global c and c++ flags
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
|
||||
# Link flags used for creating executables
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov -fprofile-arcs")
|
||||
|
||||
# Link flags used for creating shared libraries
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lgcov -profile-arcs")
|
||||
endif()
|
||||
|
||||
#
|
||||
# options
|
||||
#
|
||||
|
||||
find_package(PythonInterp 2 REQUIRED)
|
||||
|
||||
option(SHARED_V8 "use system shared V8 library")
|
||||
option(SHARED_LIBEV "use system shared libev library")
|
||||
option(SHARED_CARES "use system shared c-ares library")
|
||||
option(V8_SNAPSHOT "turn on snapshot when building stock v8")
|
||||
|
||||
|
||||
# cmake policies to get rid of some warnings
|
||||
cmake_policy(SET CMP0009 NEW) # GLOB_RECURSE should no follow symlinks
|
||||
|
||||
# generic cmake configuration
|
||||
include("cmake/configure.cmake")
|
||||
|
||||
# find and configure libs
|
||||
include("cmake/libs.cmake")
|
||||
|
||||
# setup node build targets
|
||||
include("cmake/node_build.cmake")
|
||||
|
||||
# setup v8 build targets
|
||||
include("cmake/v8_build.cmake")
|
||||
|
||||
# docs
|
||||
## might want to move this to doc/CMakeLists.txt
|
||||
include("cmake/docs.cmake")
|
||||
|
||||
# tests
|
||||
enable_testing()
|
||||
include(CTest)
|
||||
add_subdirectory("test/")
|
||||
|
||||
# package
|
||||
include("cmake/package.cmake")
|
||||
|
||||
|
||||
#
|
||||
# Final build configuration output
|
||||
#
|
||||
|
||||
message("** Build Summary **")
|
||||
message(" Version: ${node_version_string}")
|
||||
message(" Prefix: ${PREFIX}")
|
||||
message(" Build Type: ${CMAKE_BUILD_TYPE}")
|
||||
message(" Architecture: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
||||
if(SHARED_V8)
|
||||
message(" V8: ${V8_LIBRARY_PATH}")
|
||||
#else()
|
||||
#message(" V8 jobs: ${parallel_jobs}")
|
||||
endif()
|
||||
|
||||
if(SHARED_libev)
|
||||
message(" libev: ${LIBEV_LIBRARY}")
|
||||
endif()
|
||||
|
||||
if(SHARED_CARES)
|
||||
message(" libc-ares: ${LIBCARES_LIBRARY}")
|
||||
endif()
|
||||
|
||||
message(" RT library: ${RT}")
|
||||
message(" DL library: ${DL}")
|
||||
|
||||
if(${OPENSSL_FOUND} MATCHES TRUE)
|
||||
message(" OpenSSL: ${OPENSSL_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
if(USE_GCOV)
|
||||
message(" gcov: enabled")
|
||||
endif()
|
||||
|
||||
message(" CCFLAGS: ${CCFLAGS}")
|
||||
message(" CPPFLAGS: ${CPPFLAGS}")
|
||||
7
CTestConfig.cmake
Normal file
7
CTestConfig.cmake
Normal file
@@ -0,0 +1,7 @@
|
||||
set(CTEST_PROJECT_NAME "node")
|
||||
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
|
||||
|
||||
set(CTEST_DROP_METHOD "http")
|
||||
set(CTEST_DROP_SITE "my.cdash.org")
|
||||
set(CTEST_DROP_LOCATION "/submit.php?project=node")
|
||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||
282
ChangeLog
282
ChangeLog
@@ -1,4 +1,282 @@
|
||||
2010.06.21, Version 0.1.99
|
||||
2010.12.16, Version 0.3.2 (unstable)
|
||||
|
||||
* Rip out the old (broken) TLS implementation introduce new tested
|
||||
implementation and API. See docs. HTTPS not supported in this release.
|
||||
|
||||
* Introduce 'os' and 'tty' modules.
|
||||
|
||||
* Callback parameters for socket.write() and socket.connect().
|
||||
|
||||
* Support CNAME lookups in DNS module. (Ben Noordhuis)
|
||||
|
||||
* cmake support (Tom Hughes)
|
||||
|
||||
* 'make lint'
|
||||
|
||||
* oprofile support (./configure --oprofile)
|
||||
|
||||
* Lots of bug fixes, including:
|
||||
- Memory leak in ChildProcess:Spawn(). (Tom Hughes)
|
||||
- buffer.slice(0, 0)
|
||||
- Global variable leaks
|
||||
- clearTimeouts calling multiple times (Michael W)
|
||||
- utils.inspect's detection of circular structures (Tim Cooijmans)
|
||||
- Apple's threaded write()s bug (Jorge Chamorro Bieling)
|
||||
- Make sure raw mode is disabled when exiting a terminal-based REPL.
|
||||
(Brian White)
|
||||
|
||||
* Deprecate process.compile, process.ENV
|
||||
|
||||
* Upgrade V8 to 3.0.3, upgrade http-parser.
|
||||
|
||||
|
||||
2010.11.16, Version 0.3.1 (unstable), ce9a54aa1fbf709dd30316af8a2f14d83150e947
|
||||
|
||||
* TLS improvments (Paul Querna)
|
||||
- Centralize error handling in SecureStream
|
||||
- Add SecurePair for handling of a ssl/tls stream.
|
||||
|
||||
* New documentation organization (Micheil Smith)
|
||||
|
||||
* allowHalfOpen TCP connections disabled by default.
|
||||
|
||||
* Add C++ API for constructing fast buffer from string
|
||||
|
||||
* Move idle timers into its own module
|
||||
|
||||
* Gracefully handle EMFILE and server.maxConnections
|
||||
|
||||
* make "node --eval" eval in the global scope.
|
||||
(Jorge Chamorro Bieling)
|
||||
|
||||
* Let exit listeners know the exit code (isaacs)
|
||||
|
||||
* Handle cyclic links smarter in fs.realpath (isaacs)
|
||||
|
||||
* Remove node-repl (just use 'node' without args)
|
||||
|
||||
* Rewrite libeio After callback to use req->result instead of req->errorno
|
||||
for error checking (Micheil Smith)
|
||||
|
||||
* Remove warning about deprecating 'sys' - too aggressive
|
||||
|
||||
* Make writes to process.env update the real environment. (Ben Noordhuis)
|
||||
|
||||
* Set FD_CLOEXEC flag on stdio FDs before spawning. (Guillaume Tuton)
|
||||
|
||||
* Move ev_loop out of javascript
|
||||
|
||||
* Switch \n with \r\n for all strings printed out.
|
||||
|
||||
* Added support for cross compilation (Rasmus Andersson)
|
||||
|
||||
* Add --profile flag to configure script, enables gprof profiling.
|
||||
(Ben Noordhuis)
|
||||
|
||||
* writeFileSync could exhibit pathological behavior when a buffer
|
||||
could not be written to the file in a single write() call.
|
||||
|
||||
* new path.join behavior (isaacs)
|
||||
- Express desired path.join behavior in tests.
|
||||
- Update fs.realpath to reflect new path.join behavior
|
||||
- Update url.resolve() to use new path.join behavior.
|
||||
|
||||
* API: Move process.binding('evals') to require('vm')
|
||||
|
||||
* Fix V8 build on Cygwin (Bert Belder)
|
||||
|
||||
* Add ref to buffer during fs.write and fs.read
|
||||
|
||||
* Fix segfault on test-crypto
|
||||
|
||||
* Upgrade http-parser to latest and V8 to 2.5.3
|
||||
|
||||
|
||||
2010.10.23, Version 0.3.0 (unstable) 1582cfebd6719b2d2373547994b3dca5c8c569c0
|
||||
|
||||
* Bugfix: Do not spin on aceept() with EMFILE
|
||||
|
||||
* Improvments to readline.js (Trent Mick, Johan Euphrosine, Brian White)
|
||||
|
||||
* Safe constructors (missing 'new' doesn't segfault)
|
||||
|
||||
* Fix process.nextTick so thrown errors don't confuse it.
|
||||
(Benjamin Thomas)
|
||||
|
||||
* Allow Strings for ports on net.Server.listen (Bradley Meck)
|
||||
|
||||
* fs bugfixes (Tj Holowaychuk, Tobie Langel, Marco Rogers, isaacs)
|
||||
|
||||
* http bug fixes (Fedor Indutny, Mikeal Rogers)
|
||||
|
||||
* Faster buffers; breaks C++ API (Tim-Smart, Stéphan Kochen)
|
||||
|
||||
* crypto, tls improvements (Paul Querna)
|
||||
|
||||
* Add lfs flags to node addon script
|
||||
|
||||
* Simpler querystring parsing; breaks API (Peter Griess)
|
||||
|
||||
* HTTP trailers (Mark Nottingham)
|
||||
|
||||
* http 100-continue support (Mark Nottingham)
|
||||
|
||||
* Module system simplifications (Herbert Vojčík, isaacs, Tim-Smart)
|
||||
- remove require.async
|
||||
- remove registerExtension, add .extensions
|
||||
- expose require.resolve
|
||||
- expose require.cache
|
||||
- require looks in node_modules folders
|
||||
|
||||
* Add --eval command line option (TJ Holowaychuk)
|
||||
|
||||
* Commas last in sys.inspect
|
||||
|
||||
* Constatnts moved from process object to require('constants')
|
||||
|
||||
* Fix parsing of linux memory (Vitali Lovich)
|
||||
|
||||
* inspect shows function names (Jorge Chamorro Bieling)
|
||||
|
||||
* uncaughtException corner cases (Felix Geisendörfer)
|
||||
|
||||
* TCP clients now buffer writes before connection
|
||||
|
||||
* Rename sys module to 'util' (Micheil Smith)
|
||||
|
||||
* Properly set stdio handlers to blocking on SIGTERM and SIGINT
|
||||
(Tom Hughes)
|
||||
|
||||
* Add destroy methods to HTTP messages
|
||||
|
||||
* base64 improvements (isaacs, Jorge Chamorro Bieling)
|
||||
|
||||
* API for defining REPL commands (Sami Samhuri)
|
||||
|
||||
* child_process.exec timeout fix (Aaron Heckmann)
|
||||
|
||||
* Upgrade V8 to 2.5.1, Libev to 4.00, libeio, http-parser
|
||||
|
||||
|
||||
2010.08.20, Version 0.2.0, 9283e134e558900ba89d9a33c18a9bdedab07cb9
|
||||
|
||||
* process.title support for FreeBSD, Macintosh, Linux
|
||||
|
||||
* Fix OpenSSL 100% CPU usage on error (Illarionov Oleg)
|
||||
|
||||
* Implement net.Server.maxConnections.
|
||||
|
||||
* Fix process.platform, add process.version.
|
||||
|
||||
* Add --without-snapshot configure option.
|
||||
|
||||
* Readline REPL improvements (Trent Mick)
|
||||
|
||||
* Bug fixes.
|
||||
|
||||
* Upgrade V8 to 2.3.8
|
||||
|
||||
|
||||
2010.08.13, Version 0.1.104
|
||||
|
||||
* Various bug fixes (console, querystring, require)
|
||||
|
||||
* Set cwd for child processes (Bert Belder)
|
||||
|
||||
* Tab completion for readline (Trent Mick)
|
||||
|
||||
* process.title getter/setter for OSX, Linux, Cygwin.
|
||||
(Rasmus Andersson, Bert Belder)
|
||||
|
||||
* Upgrade V8 to 2.3.6
|
||||
|
||||
|
||||
2010.08.04, Version 0.1.103, 0b925d075d359d03426f0b32bb58a5e05825b4ea
|
||||
|
||||
* Implement keep-alive for http.Client (Mikeal Rogers)
|
||||
|
||||
* base64 fixes. (Ben Noordhuis)
|
||||
|
||||
* Fix --debug-brk (Danny Coates)
|
||||
|
||||
* Don't let path.normalize get above the root. (Isaac Schlueter)
|
||||
|
||||
* Allow signals to be used with process.on in addition to
|
||||
process.addListener. (Brian White)
|
||||
|
||||
* Globalize the Buffer object
|
||||
|
||||
* Use kqueue on recent macintosh builds
|
||||
|
||||
* Fix addrlen for unix_dgram sockets (Benjamin Kramer)
|
||||
|
||||
* Fix stats.isDirectory() and friends (Benjamin Kramer)
|
||||
|
||||
* Upgrade http-parser, V8 to 2.3.5
|
||||
|
||||
|
||||
2010.07.25, Version 0.1.102, 2a4568c85f33869c75ff43ccd30f0ec188b43eab
|
||||
|
||||
* base64 encoding for Buffers.
|
||||
|
||||
* Buffer support for Cipher, Decipher, Hmac, Sign and Verify
|
||||
(Andrew Naylor)
|
||||
|
||||
* Support for reading byte ranges from files using fs.createReadStream.
|
||||
(Chandra Sekar)
|
||||
|
||||
* Fix Buffer.toString() on 0-length slices. (Peter Griess)
|
||||
|
||||
* Cache modules based on filename rather than ID (Isaac Schlueter)
|
||||
|
||||
* querystring improvments (Jan Kassens, Micheil Smith)
|
||||
|
||||
* Support DEL in the REPL. (Jérémy Lal)
|
||||
|
||||
* Upgrade http-parser, upgrade V8 to 2.3.2
|
||||
|
||||
|
||||
2010.07.16, Version 0.1.101, 0174ceb6b24caa0bdfc523934c56af9600fa9b58
|
||||
|
||||
* Added env to child_process.exec (Сергей Крыжановский)
|
||||
|
||||
* Allow modules to optionally be loaded in separate contexts
|
||||
with env var NODE_MODULE_CONTEXTS=1.
|
||||
|
||||
* setTTL and setBroadcast for dgram (Matt Ranney)
|
||||
|
||||
* Use execPath for default NODE_PATH, not installPrefix
|
||||
(Isaac Schlueter)
|
||||
|
||||
* Support of console.dir + console.assert (Jerome Etienne)
|
||||
|
||||
* on() as alias to addListener()
|
||||
|
||||
* Use javascript port of Ronn to build docs (Jérémy Lal)
|
||||
|
||||
* Upgrade V8 to 2.3.0
|
||||
|
||||
|
||||
2010.07.03, Version 0.1.100, a6b8586e947f9c3ced180fe68c233d0c252add8b
|
||||
|
||||
* process.execPath (Marshall Culpepper)
|
||||
|
||||
* sys.pump (Mikeal Rogers)
|
||||
|
||||
* Remove ini and mjsunit libraries.
|
||||
|
||||
* Introduce console.log() and friends.
|
||||
|
||||
* Switch order of arguments for Buffer.write (Blake Mizerany)
|
||||
|
||||
* On overlapping buffers use memmove (Matt Ranney)
|
||||
|
||||
* Resolve .local domains with getaddrinfo()
|
||||
|
||||
* Upgrade http-parser, V8 to 2.2.21
|
||||
|
||||
|
||||
2010.06.21, Version 0.1.99, a620b7298f68f68a855306437a3b60b650d61d78
|
||||
|
||||
* Datagram sockets (Paul Querna)
|
||||
|
||||
@@ -143,7 +421,7 @@
|
||||
|
||||
* Fix child process exit codes (Felix Geisendörfer)
|
||||
|
||||
* Allow callers to disable PHP/Rails style parameter mungeing in
|
||||
* Allow callers to disable PHP/Rails style parameter munging in
|
||||
querystring.stringify (Thomas Lee)
|
||||
|
||||
* Upgrade V8 to 2.2.6
|
||||
|
||||
12
LICENSE
12
LICENSE
@@ -25,9 +25,21 @@ are:
|
||||
Apache-style license. OpenSSL is not included in the Node distribution.
|
||||
See http://openssl.org/ for more information.
|
||||
|
||||
- tools/doctool/markdown.js is Released under MIT license and
|
||||
Copyright 2009-2010 Dominic Baggott and Ash Berli
|
||||
|
||||
- HTTP Parser, located at deps/http_parser, is a small C library
|
||||
copyrighted by Ryan Lienhart Dahl and has a MIT license.
|
||||
|
||||
- src/platform_darwin_proctitle.cc, has code taken from the Chromium
|
||||
project copyright Google Inc. and released with the BSD license.
|
||||
|
||||
- tools/closure_linter is copyrighted by The Closure Linter Authors and
|
||||
Google Inc and is released under the Apache license.
|
||||
|
||||
- tools/cpplint.py is copyrighted by Google Inc and is released under the
|
||||
BSD license.
|
||||
|
||||
|
||||
Node's license follows:
|
||||
|
||||
|
||||
107
Makefile
107
Makefile
@@ -1,11 +1,21 @@
|
||||
WAF=python tools/waf-light
|
||||
|
||||
all:
|
||||
@$(WAF) build
|
||||
web_root = ryan@nodejs.org:~/web/nodejs.org/
|
||||
|
||||
all: program
|
||||
|
||||
all-progress:
|
||||
@$(WAF) -p build
|
||||
|
||||
program:
|
||||
@$(WAF) --product-type=program build
|
||||
|
||||
staticlib:
|
||||
@$(WAF) --product-type=cstaticlib build
|
||||
|
||||
dynamiclib:
|
||||
@$(WAF) --product-type=cshlib build
|
||||
|
||||
install:
|
||||
@$(WAF) install
|
||||
|
||||
@@ -29,45 +39,71 @@ test-message: all
|
||||
|
||||
test-simple: all
|
||||
python tools/test.py simple
|
||||
|
||||
|
||||
test-pummel: all
|
||||
python tools/test.py pummel
|
||||
|
||||
|
||||
test-internet: all
|
||||
python tools/test.py internet
|
||||
|
||||
benchmark: all
|
||||
build/default/node benchmark/run.js
|
||||
build/default/node: all
|
||||
|
||||
# http://rtomayko.github.com/ronn
|
||||
# gem install ronn
|
||||
doc: doc/node.1 doc/api.html doc/index.html doc/changelog.html
|
||||
apidoc_sources = $(wildcard doc/api/*.markdown)
|
||||
apidocs = $(addprefix build/,$(apidoc_sources:.markdown=.html))
|
||||
|
||||
## HACK to give the ronn-generated page a TOC
|
||||
doc/api.html: doc/api.markdown doc/api_header.html doc/api_footer.html
|
||||
ronn -f --html doc/api.markdown \
|
||||
| sed "s/<h2>\(.*\)<\/h2>/<h2 id=\"\1\">\1<\/h2>/g" \
|
||||
| cat doc/api_header.html - doc/api_footer.html > doc/api.html
|
||||
apidoc_dirs = build/doc build/doc/api/ build/doc/api/assets
|
||||
|
||||
doc/changelog.html: ChangeLog doc/changelog_header.html doc/changelog_footer.html
|
||||
cat doc/changelog_header.html ChangeLog doc/changelog_footer.html > doc/changelog.html
|
||||
apiassets = $(subst api_assets,api/assets,$(addprefix build/,$(wildcard doc/api_assets/*)))
|
||||
|
||||
doc/node.1: doc/api.markdown
|
||||
ronn --roff doc/api.markdown > doc/node.1
|
||||
website_files = \
|
||||
build/doc/index.html \
|
||||
build/doc/cla.html \
|
||||
build/doc/sh_main.js \
|
||||
build/doc/sh_javascript.min.js \
|
||||
build/doc/sh_vim-dark.css \
|
||||
build/doc/logo.png \
|
||||
build/doc/sponsored.png \
|
||||
build/doc/pipe.css
|
||||
|
||||
doc: build/default/node $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs) build/doc/changelog.html
|
||||
|
||||
$(apidoc_dirs):
|
||||
mkdir -p $@
|
||||
|
||||
build/doc/api/assets/%: doc/api_assets/% build/doc/api/assets/
|
||||
cp $< $@
|
||||
|
||||
build/doc/%: doc/%
|
||||
cp $< $@
|
||||
|
||||
build/doc/api/%.html: doc/api/%.markdown build/default/node $(apidoc_dirs) $(apiassets) tools/doctool/doctool.js
|
||||
build/default/node tools/doctool/doctool.js doc/template.html $< > $@
|
||||
|
||||
build/doc/changelog.html: ChangeLog build/default/node build/doc/ $(apidoc_dirs) $(apiassets) tools/doctool/doctool.js
|
||||
build/default/node tools/doctool/doctool.js doc/template.html $< \
|
||||
| sed 's|assets/|api/assets/|g' \
|
||||
| sed 's|<body>|<body id="changelog">|g' > $@
|
||||
@echo $(apiassets)
|
||||
|
||||
|
||||
build/doc/%:
|
||||
|
||||
website-upload: doc
|
||||
scp doc/* ryan@nodejs.org:~/tinyclouds/node/
|
||||
scp -r build/doc/* $(web_root)
|
||||
|
||||
docopen: build/doc/api/all.html
|
||||
-google-chrome build/doc/api/all.html
|
||||
|
||||
docclean:
|
||||
@-rm -f doc/node.1 doc/api.html doc/changelog.html
|
||||
-rm -rf build/doc
|
||||
|
||||
clean:
|
||||
@$(WAF) clean
|
||||
@-find tools -name "*.pyc" | xargs rm -f
|
||||
$(WAF) clean
|
||||
-find tools -name "*.pyc" | xargs rm -f
|
||||
|
||||
distclean: docclean
|
||||
@-find tools -name "*.pyc" | xargs rm -f
|
||||
@-rm -rf build/ node node_g
|
||||
-find tools -name "*.pyc" | xargs rm -f
|
||||
-rm -rf build/ node node_g
|
||||
|
||||
check:
|
||||
@tools/waf-light check
|
||||
@@ -75,14 +111,31 @@ check:
|
||||
VERSION=$(shell git describe)
|
||||
TARNAME=node-$(VERSION)
|
||||
|
||||
dist: doc/node.1 doc/api.html
|
||||
#dist: doc/node.1 doc/api
|
||||
dist: doc
|
||||
git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
|
||||
mkdir -p $(TARNAME)/doc
|
||||
cp doc/node.1 $(TARNAME)/doc/node.1
|
||||
cp doc/api.html $(TARNAME)/doc/api.html
|
||||
cp -r build/doc/api $(TARNAME)/doc/api
|
||||
rm -rf $(TARNAME)/deps/v8/test # too big
|
||||
tar -cf $(TARNAME).tar $(TARNAME)
|
||||
rm -rf $(TARNAME)
|
||||
gzip -f -9 $(TARNAME).tar
|
||||
|
||||
.PHONY: benchmark clean docclean dist distclean check uninstall install all test test-all website-upload
|
||||
bench:
|
||||
benchmark/http_simple_bench.sh
|
||||
|
||||
bench-idle:
|
||||
./node benchmark/idle_server.js &
|
||||
sleep 1
|
||||
./node benchmark/idle_clients.js &
|
||||
|
||||
jslint:
|
||||
PYTHONPATH=tools/closure_linter/ python tools/closure_linter/closure_linter/gjslint.py --unix_mode --strict --nojsdoc -r lib/ -r src/ -r test/
|
||||
|
||||
cpplint:
|
||||
@python tools/cpplint.py $(wildcard src/*.cc src/*.h src/*.c)
|
||||
|
||||
lint: jslint cpplint
|
||||
|
||||
.PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean check uninstall install all program staticlib dynamiclib test test-all website-upload
|
||||
|
||||
39
Makefile.cmake
Normal file
39
Makefile.cmake
Normal file
@@ -0,0 +1,39 @@
|
||||
BUILD?=build
|
||||
VERBOSE?=0
|
||||
PARALLEL_JOBS?=1
|
||||
CMAKE?=cmake
|
||||
|
||||
all: doc package
|
||||
|
||||
$(BUILD)/Makefile:
|
||||
mkdir $(BUILD) || exit 0
|
||||
cd $(BUILD) && $(CMAKE) -DCMAKE_VERBOSE_MAKEFILE=$(VERBOSE) ..
|
||||
|
||||
build: $(BUILD)/Makefile
|
||||
cd $(BUILD) && make -j $(PARALLEL_JOBS)
|
||||
|
||||
install: build
|
||||
cd $(BUILD) && sudo make install
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD)
|
||||
|
||||
doc: $(BUILD)/Makefile
|
||||
cd $(BUILD) && make doc
|
||||
|
||||
package: $(BUILD)/Makefile
|
||||
cd $(BUILD) && make package
|
||||
|
||||
test: $(BUILD)/Makefile
|
||||
cd $(BUILD) && make test
|
||||
|
||||
cdash: $(BUILD)/Makefile
|
||||
cd $(BUILD) && make Experimental
|
||||
|
||||
cdash-cov: $(BUILD)/Makefile
|
||||
cd $(BUILD) && $(CMAKE) -DUSE_GCOV=True .. && make Experimental
|
||||
|
||||
cdash-mem: $(BUILD)/Makefile
|
||||
cd $(BUILD) && make NightlyMemoryCheck
|
||||
|
||||
.PHONY: build install clean doc package test cdash cdash-cov cdash-mem
|
||||
4
README
4
README
@@ -10,9 +10,9 @@ To run the tests:
|
||||
|
||||
make test
|
||||
|
||||
To build the documentation and install it, you will need ronn:
|
||||
To build the documentation:
|
||||
|
||||
make doc install
|
||||
make doc
|
||||
|
||||
To read the documentation:
|
||||
|
||||
|
||||
65
README.cmake
Normal file
65
README.cmake
Normal file
@@ -0,0 +1,65 @@
|
||||
Instructions for building with cmake
|
||||
|
||||
Make sure you have cmake:
|
||||
Ubuntu/Debian: sudo apt-get install cmake
|
||||
Mac: http://www.cmake.org/files/v2.8/cmake-2.8.3-Darwin-universal.dmg
|
||||
Other platforms: http://www.cmake.org/cmake/resources/software.html
|
||||
|
||||
To build:
|
||||
|
||||
make -f Makefile.cmake
|
||||
make -f Makefile.cmake install
|
||||
|
||||
To run the tests:
|
||||
|
||||
make -f Makefile.cmake test
|
||||
|
||||
To build the documentation:
|
||||
|
||||
make -f Makefile.cmake doc
|
||||
|
||||
To read the documentation:
|
||||
|
||||
man doc/node.1
|
||||
|
||||
To build distro packages (tgz, deb, rpm, PackageMaker):
|
||||
|
||||
make -f Makefile.cmake package
|
||||
|
||||
To submit test results (see http://my.cdash.org/index.php?project=node):
|
||||
|
||||
make -f Makefile.cmake cdash
|
||||
|
||||
To submit coverage test results:
|
||||
|
||||
make -f Makefile.cmake cdash-cov
|
||||
|
||||
To submit valgrind test results:
|
||||
|
||||
make -f Makefile.cmake cdash-mem
|
||||
|
||||
Using cmake directly:
|
||||
cd ~/your-node-source-dir
|
||||
mkdir name-of-build-dir (can be anything)
|
||||
cd name-of-build-dir
|
||||
cmake ..
|
||||
|
||||
At this point you have generated a set of Makefiles and can use the standard
|
||||
make commands (make, make install, etc.). The Makefile.cmake file is just a
|
||||
wrapper around these commands; take a look at it for more details.
|
||||
|
||||
Other build targets:
|
||||
make Experimental
|
||||
make Nightly
|
||||
make NightlyMemoryCheck
|
||||
make Continuous
|
||||
|
||||
Additional options:
|
||||
In the CMakeLists.txt, you'll see things like
|
||||
option(SHARED_V8, ...). If you want to enable any of those options you can
|
||||
pass "-DOPTION=True" when running cmake (e.g., cmake -DSHARED_V8=True).
|
||||
|
||||
See http://nodejs.org/ for more information. For help and discussion
|
||||
subscribe to the mailing list by visiting
|
||||
http://groups.google.com/group/nodejs or by sending an email to
|
||||
nodejs+subscribe@googlegroups.com.
|
||||
34
TODO
Normal file
34
TODO
Normal file
@@ -0,0 +1,34 @@
|
||||
- fix tests for NODE_MODULE_CONTEXTS=1
|
||||
- readline
|
||||
- fix for two column glyphs. use Markus Kuhn's wcwidth.c
|
||||
- fix for commands that extend beyond term width
|
||||
- Erradicate all traces of 'binary' encoding. Only used, now, in OpenSSL
|
||||
binding.
|
||||
- EventSource branch merged
|
||||
- Use C++ style casts everywhere.
|
||||
- Ruby-like Process#detach (is that possible?)
|
||||
- stderr isn't flushing on exit
|
||||
- ReadStream should not use an offset in calls to fs.read
|
||||
(so that it can pull in files larger than 2G)
|
||||
- process object should be defined in src/node.js not in c++
|
||||
- Test for EMFILE accept spin bug.
|
||||
- Deprecate setEncoding() and instead add option to on('data').
|
||||
Example:
|
||||
|
||||
stdin.on('data', { encoding: 'utf8' }, function (chunk) {
|
||||
process.stdout.write('WRITE: ' + chunk);
|
||||
});
|
||||
|
||||
Perhaps by assigning cb.opts.encoding and calling
|
||||
EventEmitter.optHandlers.encoding() if it exists.
|
||||
|
||||
- DOCS
|
||||
- anchor links next to each function, for easy linking.
|
||||
EG <a href="#fs.stat">#</a>
|
||||
|
||||
- Add callbacks to write() on other streams (fs.WriteStream, http outgoing)
|
||||
callbacks are already on net.Stream streams.
|
||||
- Add callback to net.Stream.connect
|
||||
- new TLS frontend api using securepair
|
||||
- "node --raw-js script.js" should bipass all Node code and load a raw V8
|
||||
interpreter
|
||||
6
benchmark/buffer_creation.js
Normal file
6
benchmark/buffer_creation.js
Normal file
@@ -0,0 +1,6 @@
|
||||
SlowBuffer = require('buffer').SlowBuffer;
|
||||
|
||||
for (var i = 0; i < 1e6; i++) {
|
||||
b = new SlowBuffer(10);
|
||||
b[1] = 2
|
||||
}
|
||||
42
benchmark/fast_buffer2.js
Normal file
42
benchmark/fast_buffer2.js
Normal file
@@ -0,0 +1,42 @@
|
||||
var SlowBuffer = require('buffer').SlowBuffer;
|
||||
var POOLSIZE = 8*1024;
|
||||
var pool;
|
||||
|
||||
function allocPool () {
|
||||
pool = new SlowBuffer(POOLSIZE);
|
||||
pool.used = 0;
|
||||
}
|
||||
|
||||
function FastBuffer (length) {
|
||||
this.length = length;
|
||||
|
||||
if (length > POOLSIZE) {
|
||||
// Big buffer, just alloc one.
|
||||
this.parent = new Buffer(length);
|
||||
this.offset = 0;
|
||||
} else {
|
||||
// Small buffer.
|
||||
if (!pool || pool.length - pool.used < length) allocPool();
|
||||
this.parent = pool;
|
||||
this.offset = pool.used;
|
||||
pool.used += length;
|
||||
}
|
||||
|
||||
// HERE HERE HERE
|
||||
SlowBuffer.makeFastBuffer(this.parent, this, this.offset, this.length);
|
||||
}
|
||||
|
||||
exports.FastBuffer = FastBuffer;
|
||||
|
||||
FastBuffer.prototype.get = function (i) {
|
||||
if (i < 0 || i >= this.length) throw new Error("oob");
|
||||
return this.parent[this.offset + i];
|
||||
};
|
||||
|
||||
FastBuffer.prototype.set = function (i, v) {
|
||||
if (i < 0 || i >= this.length) throw new Error("oob");
|
||||
return this.parent[this.offset + i] = v;
|
||||
};
|
||||
|
||||
// TODO define slice, toString, write, etc.
|
||||
// slice should not use c++
|
||||
6
benchmark/fast_buffer2_creation.js
Normal file
6
benchmark/fast_buffer2_creation.js
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
FastBuffer = require('./fast_buffer2').FastBuffer;
|
||||
for (var i = 0; i < 1e6; i++) {
|
||||
b = new FastBuffer(10);
|
||||
b[1] = 2;
|
||||
}
|
||||
4
benchmark/fast_buffer_creation.js
Normal file
4
benchmark/fast_buffer_creation.js
Normal file
@@ -0,0 +1,4 @@
|
||||
for (var i = 0; i < 1e6; i++) {
|
||||
b = new Buffer(10);
|
||||
b[1] = 2;
|
||||
}
|
||||
43
benchmark/function_call/bench.js
Normal file
43
benchmark/function_call/bench.js
Normal file
@@ -0,0 +1,43 @@
|
||||
var binding = require('./build/default/binding');
|
||||
|
||||
c = 0
|
||||
|
||||
function js() {
|
||||
return c++; //(new Date()).getTime();
|
||||
}
|
||||
|
||||
var cxx = binding.hello;
|
||||
|
||||
var i, N = 100000000;
|
||||
|
||||
console.log(js());
|
||||
console.log(cxx());
|
||||
|
||||
|
||||
|
||||
var start = new Date();
|
||||
for (i = 0; i < N; i++) {
|
||||
js();
|
||||
}
|
||||
var jsDiff = new Date() - start;
|
||||
console.log(N +" JS function calls: " + jsDiff);
|
||||
|
||||
|
||||
var start = new Date();
|
||||
for (i = 0; i < N; i++) {
|
||||
cxx();
|
||||
}
|
||||
var cxxDiff = new Date() - start;
|
||||
console.log(N +" C++ function calls: " + cxxDiff);
|
||||
|
||||
function toMicro (diff) {
|
||||
return (diff / N) * 1000000;
|
||||
}
|
||||
|
||||
console.log("\nJS function call speed: %d microseconds", toMicro(jsDiff));
|
||||
console.log("C++ function call speed: %d microseconds", toMicro(cxxDiff));
|
||||
|
||||
|
||||
console.log("\nJS speedup " + (cxxDiff / jsDiff));
|
||||
|
||||
|
||||
19
benchmark/function_call/binding.cc
Normal file
19
benchmark/function_call/binding.cc
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <v8.h>
|
||||
#include <node.h>
|
||||
#include <time.h>
|
||||
|
||||
using namespace v8;
|
||||
|
||||
static int c = 0;
|
||||
|
||||
static Handle<Value> Hello(const Arguments& args) {
|
||||
HandleScope scope;
|
||||
//time_t tv = time(NULL);
|
||||
return scope.Close(Integer::New(c++));
|
||||
}
|
||||
|
||||
extern "C" void init (Handle<Object> target) {
|
||||
HandleScope scope;
|
||||
//target->Set(String::New("hello"), String::New("World"));
|
||||
NODE_SET_METHOD(target, "hello", Hello);
|
||||
}
|
||||
15
benchmark/function_call/wscript
Normal file
15
benchmark/function_call/wscript
Normal file
@@ -0,0 +1,15 @@
|
||||
srcdir = '.'
|
||||
blddir = 'build'
|
||||
VERSION = '0.0.1'
|
||||
|
||||
def set_options(opt):
|
||||
opt.tool_options('compiler_cxx')
|
||||
|
||||
def configure(conf):
|
||||
conf.check_tool('compiler_cxx')
|
||||
conf.check_tool('node_addon')
|
||||
|
||||
def build(bld):
|
||||
obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
|
||||
obj.target = 'binding'
|
||||
obj.source = 'binding.cc'
|
||||
@@ -1,26 +1,40 @@
|
||||
path = require("path");
|
||||
Buffer = require("buffer").Buffer;
|
||||
exec = require("child_process").exec;
|
||||
http = require("http");
|
||||
|
||||
port = parseInt(process.env.PORT || 8000);
|
||||
|
||||
var puts = require("sys").puts;
|
||||
|
||||
var old = (process.argv[2] == 'old');
|
||||
|
||||
puts('pid ' + process.pid);
|
||||
|
||||
http = require(old ? "http_old" : 'http');
|
||||
if (old) puts('old version');
|
||||
console.log('pid ' + process.pid);
|
||||
|
||||
fixed = ""
|
||||
for (var i = 0; i < 20*1024; i++) {
|
||||
fixed += "C";
|
||||
}
|
||||
|
||||
var uname, rev;
|
||||
|
||||
exec('git rev-list -1 HEAD', function (e, stdout) {
|
||||
if (e) {
|
||||
console.error("Problem executing: 'git rev-list -1 HEAD'");
|
||||
throw new Error(e);
|
||||
}
|
||||
rev = stdout.replace(/\s/g, '');
|
||||
});
|
||||
|
||||
exec('uname -a', function (e, stdout) {
|
||||
if (e) {
|
||||
console.error("Problem executing: 'uname -a'");
|
||||
throw new Error(e);
|
||||
}
|
||||
uname = stdout.replace(/[\r\n]/g, '');
|
||||
});
|
||||
|
||||
|
||||
|
||||
stored = {};
|
||||
storedBuffer = {};
|
||||
|
||||
http.createServer(function (req, res) {
|
||||
var server = http.createServer(function (req, res) {
|
||||
var commands = req.url.split("/");
|
||||
var command = commands[1];
|
||||
var body = "";
|
||||
@@ -30,9 +44,9 @@ http.createServer(function (req, res) {
|
||||
if (command == "bytes") {
|
||||
var n = parseInt(arg, 10)
|
||||
if (n <= 0)
|
||||
throw "bytes called with n <= 0"
|
||||
throw "bytes called with n <= 0"
|
||||
if (stored[n] === undefined) {
|
||||
puts("create stored[n]");
|
||||
console.log("create stored[n]");
|
||||
stored[n] = "";
|
||||
for (var i = 0; i < n; i++) {
|
||||
stored[n] += "C"
|
||||
@@ -44,7 +58,7 @@ http.createServer(function (req, res) {
|
||||
var n = parseInt(arg, 10)
|
||||
if (n <= 0) throw new Error("bytes called with n <= 0");
|
||||
if (storedBuffer[n] === undefined) {
|
||||
puts("create storedBuffer[n]");
|
||||
console.log("create storedBuffer[n]");
|
||||
storedBuffer[n] = new Buffer(n);
|
||||
for (var i = 0; i < n; i++) {
|
||||
storedBuffer[n][i] = "C".charCodeAt(0);
|
||||
@@ -59,6 +73,9 @@ http.createServer(function (req, res) {
|
||||
} else if (command == "fixed") {
|
||||
body = fixed;
|
||||
|
||||
} else if (command == "info") {
|
||||
body = 'rev=' + rev + '\nuname="' + uname + '"\n';
|
||||
|
||||
} else {
|
||||
status = 404;
|
||||
body = "not found\n";
|
||||
@@ -66,17 +83,13 @@ http.createServer(function (req, res) {
|
||||
|
||||
var content_length = body.length.toString();
|
||||
|
||||
res.writeHead( status
|
||||
, { "Content-Type": "text/plain"
|
||||
, "Content-Length": content_length
|
||||
}
|
||||
);
|
||||
if (old) {
|
||||
res.write(body, 'ascii');
|
||||
res.close();
|
||||
} else {
|
||||
res.end(body, 'ascii');
|
||||
}
|
||||
}).listen(port);
|
||||
res.writeHead(status, { "Content-Type": "text/plain",
|
||||
"Content-Length": content_length });
|
||||
res.end(body);
|
||||
|
||||
});
|
||||
|
||||
server.listen(port, function () {
|
||||
console.log('Listening at http://127.0.0.1:'+port+'/');
|
||||
});
|
||||
|
||||
puts('Listening at http://127.0.0.1:'+port+'/');
|
||||
|
||||
@@ -7,45 +7,45 @@ end
|
||||
|
||||
def wait(seconds)
|
||||
n = (seconds / 0.01).to_i
|
||||
n.times do
|
||||
n.times do
|
||||
sleep(0.01)
|
||||
#File.read(DIR + '/yahoo.html')
|
||||
#File.read(DIR + '/yahoo.html')
|
||||
end
|
||||
end
|
||||
|
||||
class SimpleApp
|
||||
@@responses = {}
|
||||
|
||||
|
||||
def initialize
|
||||
@count = 0
|
||||
end
|
||||
|
||||
|
||||
def deferred?(env)
|
||||
false
|
||||
end
|
||||
|
||||
|
||||
def call(env)
|
||||
path = env['PATH_INFO'] || env['REQUEST_URI']
|
||||
commands = path.split('/')
|
||||
|
||||
|
||||
@count += 1
|
||||
if commands.include?('periodical_activity') and @count % 10 != 1
|
||||
return [200, {'Content-Type'=>'text/plain'}, "quick response!\r\n"]
|
||||
end
|
||||
|
||||
|
||||
if commands.include?('fibonacci')
|
||||
n = commands.last.to_i
|
||||
raise "fibonacci called with n <= 0" if n <= 0
|
||||
body = (1..n).to_a.map { |i| fib(i).to_s }.join(' ')
|
||||
status = 200
|
||||
|
||||
|
||||
elsif commands.include?('wait')
|
||||
n = commands.last.to_f
|
||||
raise "wait called with n <= 0" if n <= 0
|
||||
wait(n)
|
||||
body = "waited about #{n} seconds"
|
||||
status = 200
|
||||
|
||||
|
||||
elsif commands.include?('bytes')
|
||||
n = commands.last.to_i
|
||||
raise "bytes called with n <= 0" if n <= 0
|
||||
@@ -56,17 +56,17 @@ class SimpleApp
|
||||
n = 20 * 1024;
|
||||
body = @@responses[n] || "C"*n
|
||||
status = 200
|
||||
|
||||
|
||||
elsif commands.include?('test_post_length')
|
||||
input_body = ""
|
||||
while chunk = env['rack.input'].read(512)
|
||||
input_body << chunk
|
||||
input_body << chunk
|
||||
end
|
||||
if env['CONTENT_LENGTH'].to_i == input_body.length
|
||||
body = "Content-Length matches input length"
|
||||
status = 200
|
||||
else
|
||||
body = "Content-Length doesn't matches input length!
|
||||
body = "Content-Length doesn't matches input length!
|
||||
content_length = #{env['CONTENT_LENGTH'].to_i}
|
||||
input_body.length = #{input_body.length}"
|
||||
status = 500
|
||||
@@ -75,7 +75,7 @@ class SimpleApp
|
||||
status = 404
|
||||
body = "Undefined url"
|
||||
end
|
||||
|
||||
|
||||
body += "\r\n"
|
||||
headers = {'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s }
|
||||
[status, headers, [body]]
|
||||
@@ -90,6 +90,6 @@ if $0 == __FILE__
|
||||
require 'thin'
|
||||
require 'ebb'
|
||||
# Rack::Handler::Mongrel.run(SimpleApp.new, :Port => 8000)
|
||||
Thin::Server.start("0.0.0.0", 8000, SimpleApp.new)
|
||||
Thin::Server.start("0.0.0.0", 8000, SimpleApp.new)
|
||||
# Ebb::start_server(SimpleApp.new, :port => 8000)
|
||||
end
|
||||
|
||||
77
benchmark/http_simple_bench.sh
Executable file
77
benchmark/http_simple_bench.sh
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
|
||||
SERVER=127.0.0.1
|
||||
PORT=8000
|
||||
|
||||
# You may want to configure your TCP settings to make many ports available
|
||||
# to node and ab. On macintosh use:
|
||||
# sudo sysctl -w net.inet.ip.portrange.first=32768
|
||||
# sudo sysctl -w net.inet.tcp.msl=1000
|
||||
|
||||
if [ ! -d benchmark/ ]; then
|
||||
echo "Run this script from the node root directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $SERVER == "127.0.0.1" ]; then
|
||||
./node benchmark/http_simple.js &
|
||||
node_pid=$!
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
info=`curl -s http://$SERVER:$PORT/info`
|
||||
eval $info
|
||||
|
||||
date=`date "+%Y%m%d%H%M%S"`
|
||||
|
||||
ab_hello_world() {
|
||||
local type="$1"
|
||||
local ressize="$2"
|
||||
if [ $type == "string" ]; then
|
||||
local uri="bytes/$ressize"
|
||||
else
|
||||
local uri="buffer/$ressize"
|
||||
fi
|
||||
|
||||
|
||||
name="ab-hello-world-$type-$ressize"
|
||||
|
||||
dir=".benchmark_reports/$name/$rev/"
|
||||
if [ ! -d $dir ]; then
|
||||
mkdir -p $dir
|
||||
fi
|
||||
|
||||
summary_fn="$dir/$date.summary"
|
||||
data_fn="$dir/$date.data"
|
||||
|
||||
echo "Bench $name starts in 3 seconds..."
|
||||
# let shit calm down
|
||||
sleep 3
|
||||
|
||||
# hammer that as hard as it can for 10 seconds.
|
||||
ab -g $data_fn -c 100 -t 10 http://$SERVER:$PORT/$uri > $summary_fn
|
||||
|
||||
# add our data about the server
|
||||
echo >> $summary_fn
|
||||
echo >> $summary_fn
|
||||
echo "webserver-rev: $rev" >> $summary_fn
|
||||
echo "webserver-uname: $uname" >> $summary_fn
|
||||
|
||||
grep Req $summary_fn
|
||||
|
||||
echo "Summary: $summary_fn"
|
||||
echo
|
||||
}
|
||||
|
||||
# 1k
|
||||
ab_hello_world 'string' '1024'
|
||||
ab_hello_world 'buffer' '1024'
|
||||
|
||||
# 100k
|
||||
ab_hello_world 'string' '102400'
|
||||
ab_hello_world 'buffer' '102400'
|
||||
|
||||
|
||||
if [ ! -z $node_pid ]; then
|
||||
kill -9 $node_pid
|
||||
fi
|
||||
49
benchmark/idle_clients.js
Normal file
49
benchmark/idle_clients.js
Normal file
@@ -0,0 +1,49 @@
|
||||
net = require('net');
|
||||
|
||||
var errors = 0, connections = 0;
|
||||
|
||||
var lastClose = 0;
|
||||
|
||||
function connect () {
|
||||
process.nextTick(function () {
|
||||
var s = net.Stream();
|
||||
var gotConnected = false;
|
||||
s.connect(9000);
|
||||
|
||||
s.on('connect', function () {
|
||||
gotConnected = true;
|
||||
connections++;
|
||||
connect();
|
||||
});
|
||||
|
||||
s.on('close', function () {
|
||||
if (gotConnected) connections--;
|
||||
lastClose = new Date();
|
||||
});
|
||||
|
||||
s.on('error', function () {
|
||||
errors++;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
connect();
|
||||
|
||||
|
||||
var oldConnections, oldErrors;
|
||||
|
||||
// Try to start new connections every so often
|
||||
setInterval(connect, 5000);
|
||||
|
||||
setInterval(function () {
|
||||
if (oldConnections != connections) {
|
||||
oldConnections = connections;
|
||||
console.log("CLIENT %d connections: %d", process.pid, connections);
|
||||
}
|
||||
|
||||
if (oldErrors != errors) {
|
||||
oldErrors = errors;
|
||||
console.log("CLIENT %d errors: %d", process.pid, errors);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
31
benchmark/idle_server.js
Normal file
31
benchmark/idle_server.js
Normal file
@@ -0,0 +1,31 @@
|
||||
net = require('net');
|
||||
connections = 0;
|
||||
|
||||
var errors = 0;
|
||||
|
||||
server = net.Server(function (socket) {
|
||||
|
||||
socket.on('error', function () {
|
||||
errors++;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//server.maxConnections = 128;
|
||||
|
||||
server.listen(9000);
|
||||
|
||||
var oldConnections, oldErrors;
|
||||
|
||||
setInterval(function () {
|
||||
if (oldConnections != server.connections) {
|
||||
oldConnections = server.connections;
|
||||
console.log("SERVER %d connections: %d", process.pid, server.connections);
|
||||
}
|
||||
|
||||
if (oldErrors != errors) {
|
||||
oldErrors = errors;
|
||||
console.log("SERVER %d errors: %d", process.pid, errors);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
110
benchmark/io.c
Normal file
110
benchmark/io.c
Normal file
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* gcc -o iotest io.c
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int tsize = 1000 * 1048576;
|
||||
const char *path = "/tmp/wt.dat";
|
||||
|
||||
int c = 0;
|
||||
|
||||
char* bufit(size_t l)
|
||||
{
|
||||
char *p = malloc(l);
|
||||
memset(p, '!', l);
|
||||
return p;
|
||||
}
|
||||
|
||||
void writetest(int size, size_t bsize)
|
||||
{
|
||||
int i;
|
||||
char *buf = bufit(bsize);
|
||||
struct timeval start, end;
|
||||
double elapsed;
|
||||
double mbps;
|
||||
|
||||
int fd = open(path, O_CREAT|O_WRONLY, 0644);
|
||||
if (fd < 0) {
|
||||
perror("open failed");
|
||||
exit(254);
|
||||
}
|
||||
|
||||
assert(0 == gettimeofday(&start, NULL));
|
||||
for (i = 0; i < size; i += bsize) {
|
||||
int rv = write(fd, buf, bsize);
|
||||
if (c++ % 2000 == 0) fprintf(stderr, ".");
|
||||
if (rv < 0) {
|
||||
perror("write failed");
|
||||
exit(254);
|
||||
}
|
||||
}
|
||||
#ifdef __linux__
|
||||
fdatasync(fd);
|
||||
#else
|
||||
fsync(fd);
|
||||
#endif
|
||||
close(fd);
|
||||
assert(0 == gettimeofday(&end, NULL));
|
||||
elapsed = (end.tv_sec - start.tv_sec) + ((double)(end.tv_usec - start.tv_usec))/100000.;
|
||||
mbps = ((tsize/elapsed)) / 1048576;
|
||||
fprintf(stderr, "\nWrote %d bytes in %03fs using %ld byte buffers: %03fmB/s\n", size, elapsed, bsize, mbps);
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
||||
void readtest(int size, size_t bsize)
|
||||
{
|
||||
int i;
|
||||
char *buf = bufit(bsize);
|
||||
struct timeval start, end;
|
||||
double elapsed;
|
||||
double mbps;
|
||||
|
||||
int fd = open(path, O_RDONLY, 0644);
|
||||
if (fd < 0) {
|
||||
perror("open failed");
|
||||
exit(254);
|
||||
}
|
||||
|
||||
assert(0 == gettimeofday(&start, NULL));
|
||||
for (i = 0; i < size; i += bsize) {
|
||||
int rv = read(fd, buf, bsize);
|
||||
if (rv < 0) {
|
||||
perror("write failed");
|
||||
exit(254);
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
assert(0 == gettimeofday(&end, NULL));
|
||||
elapsed = (end.tv_sec - start.tv_sec) + ((double)(end.tv_usec - start.tv_usec))/100000.;
|
||||
mbps = ((tsize/elapsed)) / 1048576;
|
||||
fprintf(stderr, "Read %d bytes in %03fs using %ld byte buffers: %03fmB/s\n", size, elapsed, bsize, mbps);
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
||||
void cleanup() {
|
||||
unlink(path);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
int bsizes[] = {1024, 4096, 8192, 16384, 32768, 65536, 0};
|
||||
|
||||
for (i = 0; bsizes[i] != 0; i++) {
|
||||
writetest(tsize, bsizes[i]);
|
||||
}
|
||||
for (i = 0; bsizes[i] != 0; i++) {
|
||||
readtest(tsize, bsizes[i]);
|
||||
}
|
||||
atexit(cleanup);
|
||||
return 0;
|
||||
}
|
||||
109
benchmark/io.js
Normal file
109
benchmark/io.js
Normal file
@@ -0,0 +1,109 @@
|
||||
var fs = require('fs');
|
||||
var util = require('util');
|
||||
var Buffer = require('buffer').Buffer;
|
||||
|
||||
var path = "/tmp/wt.dat";
|
||||
var tsize = 1000 * 1048576;
|
||||
var bsizes = [1024, 4096, 8192, 16384, 32768, 65536];
|
||||
|
||||
function bufit(size) {
|
||||
var buf = new Buffer(size);
|
||||
for (var i = 0; i <buf.length ; i += 1) {
|
||||
buf[i] = 33;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
function once(emitter, name, cb) {
|
||||
function incb() {
|
||||
cb.apply(undefined, arguments);
|
||||
emitter.removeListener(name, incb);
|
||||
}
|
||||
emitter.addListener(name, incb);
|
||||
}
|
||||
|
||||
c = 0
|
||||
|
||||
function writetest(size, bsize) {
|
||||
var s = fs.createWriteStream(path, {'flags': 'w', 'mode': 0644});
|
||||
var remaining = size;
|
||||
var buf = bufit(bsize);
|
||||
|
||||
function dowrite() {
|
||||
var rv = s.write(buf);
|
||||
remaining -= buf.length;
|
||||
if (remaining > 0) {
|
||||
//if (remaining % 90000 == 0) console.error("remaining: %d", remaining);
|
||||
//process.nextTick(dowrite);
|
||||
} else {
|
||||
s.emit('done')
|
||||
s.end();
|
||||
}
|
||||
}
|
||||
|
||||
s.on('drain', function () {
|
||||
dowrite();
|
||||
if (c++ % 2000 == 0) util.print(".");
|
||||
});
|
||||
|
||||
dowrite();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function readtest(size, bsize) {
|
||||
var s = fs.createReadStream(path, {'flags': 'r', 'encoding': 'binary', 'mode': 0644, 'bufferSize': bsize});
|
||||
s.addListener("data", function (chunk) {
|
||||
// got a chunk...
|
||||
|
||||
});
|
||||
return s;
|
||||
}
|
||||
|
||||
function wt(tsize, bsize, done) {
|
||||
var start = Date.now();
|
||||
s = writetest(tsize, bsizes[0]);
|
||||
s.addListener('close', function() {
|
||||
var end = Date.now();
|
||||
var diff = end - start;
|
||||
console.log('Wrote '+ tsize +' bytes in '+ diff/1000 +'s using '+ bsize +' byte buffers: '+ ((tsize/(diff/1000)) / 1048576) +' mB/s');
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
||||
function rt(tsize, bsize, done) {
|
||||
var start = Date.now();
|
||||
s = readtest(tsize, bsizes[0]);
|
||||
s.addListener('close', function() {
|
||||
var end = Date.now();
|
||||
var diff = end - start;
|
||||
console.log('Read '+ tsize +' bytes in '+ diff/1000 +'s using '+ bsize +' byte buffers: '+ ((tsize/(diff/1000)) / 1048576) +' mB/s');
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
||||
var bs= 0;
|
||||
|
||||
function nextwt() {
|
||||
if (bsizes.length <= bs) {
|
||||
bs = 0;
|
||||
nextrt();
|
||||
return;
|
||||
}
|
||||
wt(tsize, bsizes[bs], nextwt);
|
||||
bs += 1;
|
||||
}
|
||||
|
||||
function nextrt() {
|
||||
if (bsizes.length <= bs) {
|
||||
fs.unlink(path, function (err) {
|
||||
if (err) throw err;
|
||||
console.log('All done!');
|
||||
});
|
||||
return;
|
||||
}
|
||||
rt(tsize, bsizes[bs], nextrt);
|
||||
bs += 1;
|
||||
}
|
||||
|
||||
nextwt();
|
||||
86
benchmark/plot.R
Executable file
86
benchmark/plot.R
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env Rscript
|
||||
|
||||
# To use this script you'll need to install R: http://www.r-project.org/
|
||||
# and a library for R called ggplot2
|
||||
# Which can be done by starting R and typing install.packages("ggplot2")
|
||||
# like this:
|
||||
#
|
||||
# shell% R
|
||||
# R version 2.11.0 beta (2010-04-12 r51689)
|
||||
# > install.packages("ggplot2")
|
||||
# (follow prompt)
|
||||
#
|
||||
# Then you can try this script by providing a full path to .data file
|
||||
# outputed from 'make bench'
|
||||
#
|
||||
# > cd ~/src/node
|
||||
# > make bench
|
||||
# ...
|
||||
# > ./benchmark/plot.R .benchmark_reports/ab-hello-world-buffer-1024/ff456b38862de3fd0118c6ac6b3f46edb1fbb87f/20101013162056.data
|
||||
#
|
||||
# This will generate a PNG file which you can view
|
||||
#
|
||||
#
|
||||
# Hopefully these steps will be automated in the future.
|
||||
|
||||
|
||||
|
||||
library(ggplot2)
|
||||
|
||||
args <- commandArgs(TRUE)
|
||||
|
||||
ab.load <- function (filename, name) {
|
||||
raw <- data.frame(read.csv(filename, sep="\t", header=T), server=name)
|
||||
raw <- data.frame(raw, time=raw$seconds-min(raw$seconds))
|
||||
raw <- data.frame(raw, time_s=raw$time/1000000)
|
||||
raw
|
||||
}
|
||||
|
||||
#ab.tsPoint <- function (d) {
|
||||
# qplot(time_s, ttime, data=d, facets=server~.,
|
||||
# geom="point", alpha=I(1/15), ylab="response time (ms)",
|
||||
# xlab="time (s)", main="c=30, res=26kb",
|
||||
# ylim=c(0,100))
|
||||
#}
|
||||
#
|
||||
#ab.tsLine <- function (d) {
|
||||
# qplot(time_s, ttime, data=d, facets=server~.,
|
||||
# geom="line", ylab="response time (ms)",
|
||||
# xlab="time (s)", main="c=30, res=26kb",
|
||||
# ylim=c(0,100))
|
||||
#}
|
||||
|
||||
|
||||
filename <- args[0:1]
|
||||
data <- ab.load(filename, "node")
|
||||
|
||||
|
||||
# histogram
|
||||
|
||||
#hist_png_filename <- gsub(".data", "_hist.png", filename)
|
||||
hist_png_filename <- "hist.png"
|
||||
|
||||
png(filename = hist_png_filename, width = 480, height = 380, units = "px")
|
||||
|
||||
qplot(ttime, data=data, geom="histogram",
|
||||
main="xxx",
|
||||
binwidth=1, xlab="response time (ms)",
|
||||
xlim=c(0,50))
|
||||
|
||||
print(hist_png_filename)
|
||||
|
||||
|
||||
|
||||
# time series
|
||||
|
||||
#ts_png_filename <- gsub(".data", "_ts.png", filename)
|
||||
ts_png_filename = "ts.png"
|
||||
|
||||
png(filename = ts_png_filename, width = 480, height = 380, units = "px")
|
||||
|
||||
qplot(time, ttime, data=data, facets=server~.,
|
||||
geom="point", alpha=I(1/15), ylab="response time (ms)",
|
||||
xlab="time (s)", main="xxx",
|
||||
ylim=c(0,100))
|
||||
|
||||
print(ts_png_filename)
|
||||
@@ -1,4 +1,4 @@
|
||||
var sys = require("sys"),
|
||||
var util = require("util"),
|
||||
childProcess = require("child_process");
|
||||
|
||||
function next (i) {
|
||||
@@ -7,7 +7,7 @@ function next (i) {
|
||||
var child = childProcess.spawn("echo", ["hello"]);
|
||||
|
||||
child.stdout.addListener("data", function (chunk) {
|
||||
sys.print(chunk);
|
||||
util.print(chunk);
|
||||
});
|
||||
|
||||
child.addListener("exit", function (code) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var path = require("path");
|
||||
var sys = require("sys");
|
||||
var util = require("util");
|
||||
var childProcess = require("child_process");
|
||||
var benchmarks = [ "timers.js"
|
||||
, "process_loop.js"
|
||||
@@ -19,12 +19,12 @@ function exec (script, callback) {
|
||||
|
||||
function runNext (i) {
|
||||
if (i >= benchmarks.length) return;
|
||||
sys.print(benchmarks[i] + ": ");
|
||||
util.print(benchmarks[i] + ": ");
|
||||
exec(benchmarks[i], function (elapsed, code) {
|
||||
if (code != 0) {
|
||||
sys.puts("ERROR ");
|
||||
console.log("ERROR ");
|
||||
}
|
||||
sys.puts(elapsed);
|
||||
console.log(elapsed);
|
||||
runNext(i+1);
|
||||
});
|
||||
};
|
||||
|
||||
15
benchmark/settimeout.js
Normal file
15
benchmark/settimeout.js
Normal file
@@ -0,0 +1,15 @@
|
||||
console.log("wait...");
|
||||
var done = 0;
|
||||
var N = 5000000;
|
||||
var begin = new Date();
|
||||
for (var i = 0; i < N; i++) {
|
||||
setTimeout(function () {
|
||||
if (++done == N) {
|
||||
var end = new Date();
|
||||
console.log("smaller is better");
|
||||
console.log("startup: %d", start - begin);
|
||||
console.log("done: %d", end - start);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
var start = new Date();
|
||||
26
benchmark/startup.js
Normal file
26
benchmark/startup.js
Normal file
@@ -0,0 +1,26 @@
|
||||
var spawn = require('child_process').spawn,
|
||||
path = require('path'),
|
||||
emptyJsFile = path.join(__dirname, '../test/fixtures/semicolon.js'),
|
||||
starts = 100,
|
||||
i = 0,
|
||||
start;
|
||||
|
||||
function startNode() {
|
||||
var node = spawn(process.execPath || process.argv[0], [emptyJsFile]);
|
||||
node.on('exit', function(exitCode) {
|
||||
if (exitCode !== 0) {
|
||||
throw new Error('Error during node startup');
|
||||
}
|
||||
|
||||
i++;
|
||||
if (i < starts) {
|
||||
startNode();
|
||||
} else{
|
||||
var duration = +new Date - start;
|
||||
console.log('Started node %d times in %s ms. %d ms / start.', starts, duration, duration / starts);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
start = +new Date;
|
||||
startNode();
|
||||
6
benchmark/string_creation.js
Normal file
6
benchmark/string_creation.js
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
for (var i = 0; i < 9e7; i++) {
|
||||
s = '01234567890';
|
||||
s[1] = "a";
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var puts = require("sys").puts;
|
||||
|
||||
puts("Type '.help' for options.");
|
||||
puts("(The REPL can also be started by typing 'node' without arguments)");
|
||||
|
||||
require('repl').start();
|
||||
|
||||
// vim:ft=javascript
|
||||
2
cmake/CTestCustom.cmake
Normal file
2
cmake/CTestCustom.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(CTEST_CUSTOM_PRE_TEST "sh -c \"rm -rf ../test/tmp && mkdir ../test/tmp\"")
|
||||
set(CTEST_CUSTOM_POST_TEST ${CTEST_CUSTOM_PRE_TEST})
|
||||
92
cmake/configure.cmake
Normal file
92
cmake/configure.cmake
Normal file
@@ -0,0 +1,92 @@
|
||||
#
|
||||
# configure node for building
|
||||
#
|
||||
include(CheckFunctionExists)
|
||||
|
||||
|
||||
if(NOT "v${CMAKE_BUILD_TYPE}" MATCHES vDebug)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
|
||||
string(TOLOWER ${CMAKE_SYSTEM_NAME} node_platform)
|
||||
|
||||
# Get system architecture
|
||||
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i686*)
|
||||
set(node_arch x86)
|
||||
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES i386*)
|
||||
set(node_arch x86)
|
||||
else()
|
||||
set(node_arch ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
|
||||
if(${node_arch} MATCHES unknown)
|
||||
set(node_arch x86)
|
||||
endif()
|
||||
|
||||
|
||||
# Copy tools directory for out-of-source build
|
||||
string(COMPARE EQUAL $(PROJECT_BINARY_DIR) ${PROJECT_SOURCE_DIR} in_source_build)
|
||||
if(NOT ${in_source_build})
|
||||
execute_process(COMMAND cmake -E copy_directory ${PROJECT_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools)
|
||||
endif()
|
||||
|
||||
# Set some compiler/linker flags..
|
||||
set(CMAKE_C_FLAGS_DEBUG "-O0 -Wall -g -Wextra -DDEBUG $ENV{CFLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -Wall -g -Wextra -DDEBUG $ENV{CXXFLAGS}")
|
||||
|
||||
set(CMAKE_C_FLAGS_RELEASE "-g -O3 -DNDEBUG $ENV{CFLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 -DNDEBUG $ENV{CXXFLAGS}")
|
||||
|
||||
if(${node_platform} MATCHES sunos)
|
||||
add_definitions(-threads)
|
||||
elseif(NOT ${node_platform} MATCHES cygwin*)
|
||||
add_definitions(-pthread)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
|
||||
endif()
|
||||
|
||||
if(${node_platform} MATCHES darwin)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Carbon")
|
||||
endif()
|
||||
|
||||
check_function_exists(fdatasync HAVE_FDATASYNC)
|
||||
if(HAVE_FDATASYNC)
|
||||
add_definitions(-DHAVE_FDATASYNC=1)
|
||||
else()
|
||||
add_definitions(-DHAVE_FDATASYNC=0)
|
||||
endif()
|
||||
|
||||
add_definitions(
|
||||
-DPLATFORM=${node_platform}
|
||||
-DX_STACKSIZE=65536
|
||||
-D_LARGEFILE_SOURCE
|
||||
-D_FILE_OFFSET_BITS=64
|
||||
-DEV_MULTIPLICITY=0
|
||||
)
|
||||
|
||||
# set the exec output path to be compatible with the current waf build system
|
||||
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/debug/)
|
||||
else()
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/default/)
|
||||
endif()
|
||||
|
||||
#
|
||||
## ---------------------------------------------------------
|
||||
#
|
||||
|
||||
file(GLOB js2c_files ${PROJECT_SOURCE_DIR}/lib/*.js)
|
||||
set(js2c_files ${PROJECT_SOURCE_DIR}/src/node.js ${js2c_files})
|
||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/src)
|
||||
|
||||
set(PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
||||
set(CCFLAGS "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS}")
|
||||
else()
|
||||
set(CCFLAGS "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
get_directory_property(compile_defs COMPILE_DEFINITIONS)
|
||||
foreach(def ${compile_defs})
|
||||
set(CPPFLAGS "${CPPFLAGS} -D${def}")
|
||||
endforeach()
|
||||
80
cmake/docs.cmake
Normal file
80
cmake/docs.cmake
Normal file
@@ -0,0 +1,80 @@
|
||||
#
|
||||
# docs
|
||||
#
|
||||
|
||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/doc)
|
||||
|
||||
set(node_binary ${PROJECT_BINARY_DIR}/default/node)
|
||||
set(doctool tools/doctool/doctool.js)
|
||||
set(changelog_html ${PROJECT_BINARY_DIR}/doc/changelog.html)
|
||||
|
||||
file(GLOB_RECURSE doc_sources RELATIVE ${PROJECT_SOURCE_DIR} doc/*)
|
||||
|
||||
foreach(FILE ${doc_sources})
|
||||
string(REGEX REPLACE "(.*)api_assets(.*)" "\\1api/assets\\2" OUT_FILE ${FILE})
|
||||
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/${OUT_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PROJECT_SOURCE_DIR}/${FILE} ${PROJECT_BINARY_DIR}/${OUT_FILE}
|
||||
DEPENDS ${PROJECT_SOURCE_DIR}/${FILE}
|
||||
)
|
||||
list(APPEND doc_sources_copy ${PROJECT_BINARY_DIR}/${OUT_FILE})
|
||||
endforeach()
|
||||
|
||||
file(GLOB_RECURSE api_markdown RELATIVE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/doc/api/*)
|
||||
|
||||
foreach(file ${api_markdown})
|
||||
string(REGEX REPLACE "(.*)\\.markdown" "\\1" tmp ${file})
|
||||
set(api_basenames ${api_basenames} ${tmp})
|
||||
endforeach()
|
||||
|
||||
foreach(api ${api_basenames})
|
||||
set(api_html ${api_html} ${PROJECT_BINARY_DIR}/${api}.html)
|
||||
add_custom_command(
|
||||
OUTPUT "${PROJECT_BINARY_DIR}/${api}.html"
|
||||
COMMAND ${node_binary} ${doctool} ${PROJECT_BINARY_DIR}/doc/template.html "${PROJECT_BINARY_DIR}/${api}.markdown" > "${PROJECT_BINARY_DIR}/${api}.html"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
DEPENDS node ${doctool} ${doc_sources_copy}
|
||||
VERBATIM
|
||||
)
|
||||
endforeach()
|
||||
|
||||
add_custom_target(
|
||||
doc
|
||||
DEPENDS node ${doc_sources_copy} ${api_html} ${changelog_html}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
#add_custom_command(
|
||||
# OUTPUT ${PROJECT_BINARY_DIR}/doc/api.html
|
||||
# COMMAND ${PROJECT_BINARY_DIR}/default/node tools/ronnjs/bin/ronn.js --fragment doc/api.markdown
|
||||
# | sed "s/<h2>\\\(.*\\\)<\\/h2>/<h2 id=\"\\1\">\\1<\\/h2>/g"
|
||||
# | cat doc/api_header.html - doc/api_footer.html > ${PROJECT_BINARY_DIR}/doc/api.html
|
||||
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
# DEPENDS node doc/api.markdown doc/api_header.html doc/api_footer.html
|
||||
# VERBATIM
|
||||
# )
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${changelog_html}
|
||||
COMMAND ${node_binary} ${doctool} doc/template.html ChangeLog
|
||||
| sed "s|assets/|api/assets/|g"
|
||||
| sed "s|<body>|<body id=\"changelog\">|g" > ${changelog_html}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
DEPENDS ChangeLog node ${doctool} ${doc_sources_copy}
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
#add_custom_command(
|
||||
# OUTPUT ${PROJECT_BINARY_DIR}/doc/changelog.html
|
||||
# COMMAND cat doc/changelog_header.html ChangeLog doc/changelog_footer.html > ${PROJECT_BINARY_DIR}/doc/changelog.html
|
||||
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
# DEPENDS ChangeLog doc/changelog_header.html doc/changelog_footer.html
|
||||
# VERBATIM
|
||||
# )
|
||||
|
||||
#add_custom_command(
|
||||
# OUTPUT ${PROJECT_BINARY_DIR}/doc/node.1
|
||||
# COMMAND ${PROJECT_BINARY_DIR}/default/node tools/ronnjs/bin/ronn.js --roff doc/api.markdown > ${PROJECT_BINARY_DIR}/doc/node.1
|
||||
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
# DEPENDS node doc/api.markdown tools/ronnjs/bin/ronn.js
|
||||
# VERBATIM
|
||||
# )
|
||||
18
cmake/libc-ares.cmake
Normal file
18
cmake/libc-ares.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
if(SHARED_CARES)
|
||||
find_library(LIBCARES_LIBRARY NAMES cares)
|
||||
find_path(LIBCARES_INCLUDE_DIR ares.h
|
||||
PATH_SUFFIXES include
|
||||
) # Find header
|
||||
find_package_handle_standard_args(libcares DEFAULT_MSG LIBCARES_LIBRARY LIBCARES_INCLUDE_DIR)
|
||||
else()
|
||||
set(cares_arch ${node_arch})
|
||||
|
||||
if(${node_arch} MATCHES x86_64)
|
||||
set(cares_arch x64)
|
||||
elseif(${node_arch} MATCHES x86)
|
||||
set(cares_arch ia32)
|
||||
endif()
|
||||
|
||||
add_subdirectory(deps/c-ares)
|
||||
set(LIBCARES_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/deps/c-ares ${CMAKE_SOURCE_DIR}/deps/c-ares/${node_platform}-${cares_arch})
|
||||
endif()
|
||||
10
cmake/libev.cmake
Normal file
10
cmake/libev.cmake
Normal file
@@ -0,0 +1,10 @@
|
||||
if(SHARED_LIBEV)
|
||||
find_library(LIBEV_LIBRARY NAMES ev)
|
||||
find_path(LIBEV_INCLUDE_DIR ev.h
|
||||
PATH_SUFFIXES include/ev include
|
||||
) # Find header
|
||||
find_package_handle_standard_args(libev DEFAULT_MSG LIBEV_LIBRARY LIBEV_INCLUDE_DIR)
|
||||
else()
|
||||
add_subdirectory(deps/libev)
|
||||
set(LIBEV_INCLUDE_DIR deps/libev)
|
||||
endif()
|
||||
50
cmake/libs.cmake
Normal file
50
cmake/libs.cmake
Normal file
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# libraries
|
||||
#
|
||||
|
||||
include(CheckLibraryExists)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
set(HAVE_CONFIG_H True)
|
||||
add_definitions(-DHAVE_CONFIG_H=1)
|
||||
|
||||
find_package(OpenSSL QUIET)
|
||||
find_package(Threads)
|
||||
find_library(RT rt)
|
||||
find_library(DL dl)
|
||||
check_library_exists(socket socket "" HAVE_SOCKET_LIB)
|
||||
check_library_exists(nsl gethostbyname "" HAVE_NSL_LIB)
|
||||
|
||||
if(RT)
|
||||
set(extra_libs ${extra_libs} ${RT})
|
||||
endif()
|
||||
|
||||
if(DL)
|
||||
set(extra_libs ${extra_libs} ${DL})
|
||||
endif()
|
||||
|
||||
if(${node_platform} MATCHES freebsd)
|
||||
find_library(KVM NAMES kvm)
|
||||
set(extra_libs ${extra_libs} KVM)
|
||||
endif()
|
||||
|
||||
if(${HAVE_SOCKET_LIB})
|
||||
set(extra_libs ${extra_libs} socket)
|
||||
endif()
|
||||
|
||||
if(${HAVE_NSL_LIB})
|
||||
set(extra_libs ${extra_libs} nsl)
|
||||
endif()
|
||||
|
||||
if(${OPENSSL_FOUND} MATCHES True)
|
||||
add_definitions(-DHAVE_OPENSSL=1)
|
||||
set(HAVE_OPENSSL True)
|
||||
set(node_extra_src ${node_extra_src} src/node_crypto.cc)
|
||||
set(extra_libs ${extra_libs} ${OPENSSL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
include("cmake/libc-ares.cmake")
|
||||
include("cmake/libev.cmake")
|
||||
include("cmake/libv8.cmake")
|
||||
|
||||
add_subdirectory(deps/libeio)
|
||||
add_subdirectory(deps/http_parser)
|
||||
25
cmake/libv8.cmake
Normal file
25
cmake/libv8.cmake
Normal file
@@ -0,0 +1,25 @@
|
||||
set(V8_INCLUDE_NAMES v8.h v8-debug.h v8-profiler.h v8stdint.h)
|
||||
set(V8_LIBRARY_NAMES v8)
|
||||
|
||||
if(SHARED_V8)
|
||||
find_path(V8_INCLUDE_DIR NAMES ${V8_INCLUDE_NAMES})
|
||||
find_library(V8_LIBRARY_PATH NAMES ${V8_LIBRARY_NAMES} NO_CMAKE_PATH)
|
||||
else()
|
||||
set(V8_INCLUDE_DIR "${PROJECT_BINARY_DIR}/deps/v8/include")
|
||||
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
||||
set(v8_fn "libv8_g.a")
|
||||
else()
|
||||
set(v8_fn "libv8.a")
|
||||
endif()
|
||||
set(V8_LIBRARY_PATH "${PROJECT_BINARY_DIR}/deps/v8/${v8_fn}")
|
||||
install(DIRECTORY
|
||||
## Do NOT remove the trailing slash
|
||||
## it is required so that v8 headers are
|
||||
## copied directly into include/node
|
||||
## rather than in a subdirectory
|
||||
## See CMake's install(DIRECTORY) manual for details
|
||||
${V8_INCLUDE_DIR}/
|
||||
|
||||
DESTINATION include/node
|
||||
)
|
||||
endif()
|
||||
77
cmake/node_build.cmake
Normal file
77
cmake/node_build.cmake
Normal file
@@ -0,0 +1,77 @@
|
||||
#
|
||||
# node build stuff
|
||||
#
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/src/node_natives.h
|
||||
COMMAND ${PYTHON_EXECUTABLE} tools/js2c.py ${PROJECT_BINARY_DIR}/src/node_natives.h ${js2c_files}
|
||||
DEPENDS ${js2c_files})
|
||||
|
||||
set(node_extra_src "src/platform_${node_platform}.cc")
|
||||
|
||||
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/${node_extra_src})
|
||||
set(node_extra_src "src/platform_none.cc")
|
||||
endif()
|
||||
|
||||
set(node_sources
|
||||
src/node_main.cc
|
||||
src/node.cc
|
||||
src/node_buffer.cc
|
||||
src/node_javascript.cc
|
||||
src/node_extensions.cc
|
||||
src/node_http_parser.cc
|
||||
src/node_net.cc
|
||||
src/node_io_watcher.cc
|
||||
src/node_child_process.cc
|
||||
src/node_constants.cc
|
||||
src/node_cares.cc
|
||||
src/node_events.cc
|
||||
src/node_file.cc
|
||||
src/node_signal_watcher.cc
|
||||
src/node_stat_watcher.cc
|
||||
src/node_stdio.cc
|
||||
src/node_timer.cc
|
||||
src/node_script.cc
|
||||
src/node_os.cc
|
||||
src/node_natives.h
|
||||
${node_extra_src})
|
||||
|
||||
configure_file(src/node_config.h.in ${PROJECT_BINARY_DIR}/src/node_config.h)
|
||||
configure_file(config.h.cmake ${PROJECT_BINARY_DIR}/config.h)
|
||||
|
||||
include_directories(
|
||||
src
|
||||
deps/libeio
|
||||
deps/http_parser
|
||||
${V8_INCLUDE_DIR}
|
||||
${LIBEV_INCLUDE_DIR}
|
||||
${LIBCARES_INCLUDE_DIR}
|
||||
|
||||
${PROJECT_BINARY_DIR}
|
||||
${PROJECT_BINARY_DIR}/src
|
||||
)
|
||||
|
||||
add_executable(node ${node_sources})
|
||||
set_target_properties(node PROPERTIES DEBUG_POSTFIX "_g")
|
||||
target_link_libraries(node
|
||||
ev
|
||||
eio
|
||||
cares
|
||||
http_parser
|
||||
${V8_LIBRARY_PATH}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${extra_libs})
|
||||
|
||||
|
||||
install(TARGETS node RUNTIME DESTINATION bin)
|
||||
install(FILES
|
||||
${PROJECT_BINARY_DIR}/config.h
|
||||
src/node.h
|
||||
src/node_object_wrap.h
|
||||
src/node_buffer.h
|
||||
src/node_events.h
|
||||
src/node_version.h
|
||||
${PROJECT_BINARY_DIR}/src/node_config.h
|
||||
|
||||
DESTINATION include/node
|
||||
)
|
||||
35
cmake/package.cmake
Normal file
35
cmake/package.cmake
Normal file
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# package
|
||||
#
|
||||
|
||||
if(${node_platform} MATCHES darwin)
|
||||
set(CPACK_GENERATOR "TGZ;PackageMaker")
|
||||
# CPack requires the files to end in .txt
|
||||
configure_file(LICENSE ${PROJECT_BINARY_DIR}/LICENSE.txt COPYONLY)
|
||||
configure_file(ChangeLog ${PROJECT_BINARY_DIR}/ChangeLog.txt COPYONLY)
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_BINARY_DIR}/LICENSE.txt")
|
||||
set(CPACK_RESOURCE_FILE_README "${PROJECT_BINARY_DIR}/ChangeLog.txt")
|
||||
#set(CPACK_RESOURCE_FILE_WELCOME "")
|
||||
elseif(${node_platform} MATCHES linux)
|
||||
set(CPACK_GENERATOR "TGZ;DEB;RPM")
|
||||
else()
|
||||
set(CPACK_GENERATOR "TGZ")
|
||||
endif()
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Tom Hughes <tom.hughes@palm.com>")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Evented I/O for V8 JavaScript.")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "Evented I/O for V8 JavaScript.
|
||||
Node's goal is to provide an easy way to build scalable network programs.
|
||||
Node is similar in design to and influenced by systems like Ruby's Event
|
||||
Machine or Python's Twisted. Node takes the event model a bit further—it
|
||||
presents the event loop as a language construct instead of as a library.")
|
||||
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION "web")
|
||||
file(READ ${PROJECT_SOURCE_DIR}/src/node_version.h node_version_h LIMIT 1024 OFFSET 0)
|
||||
string(REGEX REPLACE ".*NODE_MAJOR_VERSION[ ]*([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MAJOR "${node_version_h}")
|
||||
string(REGEX REPLACE ".*NODE_MINOR_VERSION[ ]*([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MINOR "${node_version_h}")
|
||||
string(REGEX REPLACE ".*NODE_PATCH_VERSION[ ]*([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_PATCH "${node_version_h}")
|
||||
set(node_version_string "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
||||
|
||||
# Note: this is intentionally at the bottom so that the above CPACK variables
|
||||
# are used by CPack.
|
||||
include(CPack)
|
||||
91
cmake/v8_build.cmake
Normal file
91
cmake/v8_build.cmake
Normal file
@@ -0,0 +1,91 @@
|
||||
#
|
||||
# v8 build stuff
|
||||
#
|
||||
|
||||
string(TOLOWER ${CMAKE_BUILD_TYPE} v8mode)
|
||||
set(v8arch ${node_arch})
|
||||
|
||||
if(${node_arch} MATCHES x86_64)
|
||||
set(v8arch x64)
|
||||
elseif(${node_arch} MATCHES x86)
|
||||
set(v8arch ia32)
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT SHARED_V8)
|
||||
if(V8_SNAPSHOT)
|
||||
set(v8snapshot snapshot=on)
|
||||
endif()
|
||||
|
||||
if(${node_platform} MATCHES darwin)
|
||||
execute_process(COMMAND hwprefs cpu_count OUTPUT_VARIABLE cpu_count)
|
||||
elseif(${node_platform} MATCHES linux)
|
||||
execute_process(COMMAND sh -c "cat /proc/cpuinfo | grep processor | sort | uniq | wc -l"
|
||||
OUTPUT_VARIABLE cpu_count)
|
||||
elseif(${node_platform} MATCHES sunos)
|
||||
execute_process(COMMAND sh -c "psrinfo | wc -l" OUTPUT_VARIABLE cpu_count)
|
||||
else()
|
||||
set(cpu_count 1)
|
||||
endif()
|
||||
|
||||
if(${cpu_count} GREATER 1)
|
||||
math(EXPR parallel_jobs ${cpu_count}*2)
|
||||
else()
|
||||
set(parallel_jobs 1)
|
||||
endif()
|
||||
|
||||
add_library(v8 STATIC IMPORTED)
|
||||
set_property(TARGET v8
|
||||
PROPERTY IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/deps/v8/${v8_fn})
|
||||
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER 2.8 OR CMAKE_VERSION VERSION_EQUAL 2.8)
|
||||
# use ExternalProject for CMake >2.8
|
||||
include(ExternalProject)
|
||||
|
||||
ExternalProject_Add(v8_extprj
|
||||
URL ${PROJECT_SOURCE_DIR}/deps/v8
|
||||
|
||||
BUILD_IN_SOURCE True
|
||||
BUILD_COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/tools/scons/scons.py library=static visibility=default ${v8snapshot} mode=${v8mode} verbose=on arch=${v8arch} -j ${parallel_jobs}
|
||||
|
||||
SOURCE_DIR ${PROJECT_BINARY_DIR}/deps/v8
|
||||
# ignore this stuff, it's not needed for building v8 but ExternalProject
|
||||
# demands these steps
|
||||
|
||||
CONFIGURE_COMMAND "true" # fake configure
|
||||
INSTALL_COMMAND "true" # fake install
|
||||
)
|
||||
|
||||
add_dependencies(node v8_extprj)
|
||||
else()
|
||||
# copy v8 sources inefficiently with CMake versions <2.8
|
||||
file(GLOB_RECURSE v8_sources RELATIVE ${PROJECT_SOURCE_DIR} deps/v8/*)
|
||||
|
||||
if(NOT ${in_source_build})
|
||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/deps/v8)
|
||||
|
||||
foreach(FILE ${v8_sources})
|
||||
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/${FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PROJECT_SOURCE_DIR}/${FILE} ${PROJECT_BINARY_DIR}/${FILE}
|
||||
DEPENDS ${PROJECT_SOURCE_DIR}/${FILE}
|
||||
)
|
||||
list(APPEND v8_sources_dest ${PROJECT_BINARY_DIR}/${FILE})
|
||||
endforeach()
|
||||
else()
|
||||
set(v8_sources_dest ${v8_sources})
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/deps/v8/${v8_fn}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/tools/scons/scons.py library=static visibility=default ${v8snapshot} mode=${v8mode} verbose=on arch=${v8arch} -j ${parallel_jobs}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/deps/v8/
|
||||
DEPENDS ${v8_sources_dest}
|
||||
)
|
||||
|
||||
add_custom_target(v8_stock ALL DEPENDS ${PROJECT_BINARY_DIR}/deps/v8/${v8_fn})
|
||||
set_property(TARGET v8 PROPERTY
|
||||
IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/deps/v8/${v8_fn})
|
||||
add_dependencies(node v8_stock)
|
||||
endif()
|
||||
endif()
|
||||
2
config.h.cmake
Normal file
2
config.h.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
#cmakedefine HAVE_OPENSSL 1
|
||||
#cmakedefine HAVE_CONFIG_H 1
|
||||
22
deps/c-ares/CMakeLists.txt
vendored
Normal file
22
deps/c-ares/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
include_directories(${node_platform}-${cares_arch})
|
||||
add_definitions(-DHAVE_CONFIG_H=1)
|
||||
|
||||
include(CheckLibraryExists)
|
||||
check_library_exists(socket socket "" HAVE_SOCKET_LIB)
|
||||
check_library_exists(nsl gethostbyname "" HAVE_NSL_LIB)
|
||||
|
||||
file(GLOB lib_sources *.c)
|
||||
add_library(cares ${lib_sources})
|
||||
|
||||
if(${HAVE_SOCKET_LIB})
|
||||
set(cares_libs ${cares_libs} socket)
|
||||
endif()
|
||||
|
||||
if(${HAVE_NSL_LIB})
|
||||
set(cares_libs ${cares_libs} nsl)
|
||||
endif()
|
||||
|
||||
if(cares_libs)
|
||||
target_link_libraries(cares ${cares_libs})
|
||||
endif()
|
||||
2
deps/c-ares/ares_parse_a_reply.c
vendored
2
deps/c-ares/ares_parse_a_reply.c
vendored
@@ -201,7 +201,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
|
||||
}
|
||||
}
|
||||
|
||||
if (status == ARES_SUCCESS && naddrs == 0)
|
||||
if (status == ARES_SUCCESS && naddrs == 0 && naliases == 0)
|
||||
status = ARES_ENODATA;
|
||||
if (status == ARES_SUCCESS)
|
||||
{
|
||||
|
||||
111
deps/c-ares/win32-ia32/ares_build.h
vendored
Normal file
111
deps/c-ares/win32-ia32/ares_build.h
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
/* ares_build.h. Generated from ares_build.h.in by configure. */
|
||||
#ifndef __CARES_BUILD_H
|
||||
#define __CARES_BUILD_H
|
||||
|
||||
|
||||
/* Copyright (C) 2009 by Daniel Stenberg et al
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted, provided
|
||||
* that the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of M.I.T. not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. M.I.T. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
/* ================================================================ */
|
||||
/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
|
||||
/* ================================================================ */
|
||||
|
||||
/*
|
||||
* NOTE 1:
|
||||
* -------
|
||||
*
|
||||
* Nothing in this file is intended to be modified or adjusted by the
|
||||
* c-ares library user nor by the c-ares library builder.
|
||||
*
|
||||
* If you think that something actually needs to be changed, adjusted
|
||||
* or fixed in this file, then, report it on the c-ares development
|
||||
* mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/
|
||||
*
|
||||
* This header file shall only export symbols which are 'cares' or 'CARES'
|
||||
* prefixed, otherwise public name space would be polluted.
|
||||
*
|
||||
* NOTE 2:
|
||||
* -------
|
||||
*
|
||||
* Right now you might be staring at file ares_build.h.in or ares_build.h,
|
||||
* this is due to the following reason:
|
||||
*
|
||||
* On systems capable of running the configure script, the configure process
|
||||
* will overwrite the distributed ares_build.h file with one that is suitable
|
||||
* and specific to the library being configured and built, which is generated
|
||||
* from the ares_build.h.in template file.
|
||||
*
|
||||
*/
|
||||
|
||||
/* ================================================================ */
|
||||
/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
|
||||
/* ================================================================ */
|
||||
|
||||
#ifdef CARES_SIZEOF_LONG
|
||||
# error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h"
|
||||
Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CARES_TYPEOF_ARES_SOCKLEN_T
|
||||
# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
|
||||
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CARES_SIZEOF_ARES_SOCKLEN_T
|
||||
# error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
|
||||
Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined
|
||||
#endif
|
||||
|
||||
/* ================================================================ */
|
||||
/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */
|
||||
/* ================================================================ */
|
||||
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file ws2tcpip.h must be included by the external interface. */
|
||||
#define CARES_PULL_WS2TCPIP_H 1
|
||||
#ifdef CARES_PULL_WS2TCPIP_H
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN 1
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file sys/types.h must be included by the external interface. */
|
||||
/* #undef CARES_PULL_SYS_TYPES_H */
|
||||
#ifdef CARES_PULL_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file sys/socket.h must be included by the external interface. */
|
||||
/* #undef CARES_PULL_SYS_SOCKET_H */
|
||||
#ifdef CARES_PULL_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#define CARES_SIZEOF_LONG 4
|
||||
|
||||
/* Integral data type used for ares_socklen_t. */
|
||||
#define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
|
||||
|
||||
/* The size of `ares_socklen_t', as computed by sizeof. */
|
||||
#define CARES_SIZEOF_ARES_SOCKLEN_T 4
|
||||
|
||||
/* Data type definition of ares_socklen_t. */
|
||||
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
|
||||
|
||||
#endif /* __CARES_BUILD_H */
|
||||
513
deps/c-ares/win32-ia32/ares_config.h
vendored
Normal file
513
deps/c-ares/win32-ia32/ares_config.h
vendored
Normal file
@@ -0,0 +1,513 @@
|
||||
/* ares_config.h. Generated from ares_config.h.in by configure. */
|
||||
/* ares_config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */
|
||||
|
||||
/* define this if ares is built for a big endian system */
|
||||
/* #undef ARES_BIG_ENDIAN */
|
||||
|
||||
/* when building as static part of libcurl */
|
||||
/* #undef BUILDING_LIBCURL */
|
||||
|
||||
/* when building c-ares library */
|
||||
/* #undef CARES_BUILDING_LIBRARY */
|
||||
|
||||
/* when not building a shared library */
|
||||
#define CARES_STATICLIB 1
|
||||
|
||||
/* Define to 1 to enable hiding of library internal symbols. */
|
||||
/* #undef CARES_SYMBOL_HIDING */
|
||||
|
||||
/* Definition to make a library symbol externally visible. */
|
||||
/* #undef CARES_SYMBOL_SCOPE_EXTERN */
|
||||
|
||||
/* if a /etc/inet dir is being used */
|
||||
/* #undef ETC_INET */
|
||||
|
||||
/* Define to the type qualifier of arg 1 for getnameinfo. */
|
||||
/* #undef GETNAMEINFO_QUAL_ARG1 */
|
||||
|
||||
/* Define to the type of arg 1 for getnameinfo. */
|
||||
/* #undef GETNAMEINFO_TYPE_ARG1 */
|
||||
|
||||
/* Define to the type of arg 2 for getnameinfo. */
|
||||
/* #undef GETNAMEINFO_TYPE_ARG2 */
|
||||
|
||||
/* Define to the type of args 4 and 6 for getnameinfo. */
|
||||
/* #undef GETNAMEINFO_TYPE_ARG46 */
|
||||
|
||||
/* Define to the type of arg 7 for getnameinfo. */
|
||||
/* #undef GETNAMEINFO_TYPE_ARG7 */
|
||||
|
||||
/* Specifies the number of arguments to getservbyport_r */
|
||||
/* #undef GETSERVBYPORT_R_ARGS */
|
||||
|
||||
/* Specifies the size of the buffer to pass to getservbyport_r */
|
||||
/* #undef GETSERVBYPORT_R_BUFSIZE */
|
||||
|
||||
/* Define to 1 if you have AF_INET6. */
|
||||
#define HAVE_AF_INET6 1
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
/* #undef HAVE_ARPA_INET_H */
|
||||
|
||||
/* Define to 1 if you have the <arpa/nameser_compat.h> header file. */
|
||||
/* #undef HAVE_ARPA_NAMESER_COMPAT_H */
|
||||
|
||||
/* Define to 1 if you have the <arpa/nameser.h> header file. */
|
||||
/* #undef HAVE_ARPA_NAMESER_H */
|
||||
|
||||
/* Define to 1 if you have the <assert.h> header file. */
|
||||
#define HAVE_ASSERT_H 1
|
||||
|
||||
/* Define to 1 if you have the `bitncmp' function. */
|
||||
/* #undef HAVE_BITNCMP */
|
||||
|
||||
/* Define to 1 if bool is an available type. */
|
||||
#define HAVE_BOOL_T 1
|
||||
|
||||
/* Define to 1 if you have the clock_gettime function and monotonic timer. */
|
||||
/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */
|
||||
|
||||
/* Define to 1 if you have the closesocket function. */
|
||||
#define HAVE_CLOSESOCKET 1
|
||||
|
||||
/* Define to 1 if you have the CloseSocket camel case function. */
|
||||
/* #undef HAVE_CLOSESOCKET_CAMEL */
|
||||
|
||||
/* Define to 1 if you have the connect function. */
|
||||
#define HAVE_CONNECT 1
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
/* #undef HAVE_DLFCN_H */
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#define HAVE_ERRNO_H 1
|
||||
|
||||
/* Define to 1 if you have the fcntl function. */
|
||||
/* #undef HAVE_FCNTL */
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */
|
||||
/* #undef HAVE_FCNTL_O_NONBLOCK */
|
||||
|
||||
/* Define to 1 if you have the freeaddrinfo function. */
|
||||
/* #undef HAVE_FREEADDRINFO */
|
||||
|
||||
/* Define to 1 if you have a working getaddrinfo function. */
|
||||
/* #undef HAVE_GETADDRINFO */
|
||||
|
||||
/* Define to 1 if the getaddrinfo function is threadsafe. */
|
||||
/* #undef HAVE_GETADDRINFO_THREADSAFE */
|
||||
|
||||
/* Define to 1 if you have the gethostbyaddr function. */
|
||||
#define HAVE_GETHOSTBYADDR 1
|
||||
|
||||
/* Define to 1 if you have the gethostbyname function. */
|
||||
#define HAVE_GETHOSTBYNAME 1
|
||||
|
||||
/* Define to 1 if you have the gethostname function. */
|
||||
#define HAVE_GETHOSTNAME 1
|
||||
|
||||
/* Define to 1 if you have the getnameinfo function. */
|
||||
/* #undef HAVE_GETNAMEINFO */
|
||||
|
||||
/* Define to 1 if you have the getservbyport_r function. */
|
||||
/* #undef HAVE_GETSERVBYPORT_R */
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define to 1 if you have the `if_indextoname' function. */
|
||||
/* #undef HAVE_IF_INDEXTONAME */
|
||||
|
||||
/* Define to 1 if you have the `inet_net_pton' function. */
|
||||
/* #undef HAVE_INET_NET_PTON */
|
||||
|
||||
/* Define to 1 if inet_net_pton supports IPv6. */
|
||||
/* #undef HAVE_INET_NET_PTON_IPV6 */
|
||||
|
||||
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */
|
||||
/* #undef HAVE_INET_NTOP */
|
||||
|
||||
/* Define to 1 if you have a IPv6 capable working inet_pton function. */
|
||||
/* #undef HAVE_INET_PTON */
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the ioctl function. */
|
||||
/* #undef HAVE_IOCTL */
|
||||
|
||||
/* Define to 1 if you have the ioctlsocket function. */
|
||||
#define HAVE_IOCTLSOCKET 1
|
||||
|
||||
/* Define to 1 if you have the IoctlSocket camel case function. */
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL */
|
||||
|
||||
/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function.
|
||||
*/
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */
|
||||
|
||||
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */
|
||||
#define HAVE_IOCTLSOCKET_FIONBIO 1
|
||||
|
||||
/* Define to 1 if you have a working ioctl FIONBIO function. */
|
||||
/* #undef HAVE_IOCTL_FIONBIO */
|
||||
|
||||
/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */
|
||||
/* #undef HAVE_IOCTL_SIOCGIFADDR */
|
||||
|
||||
/* Define to 1 if you have the `resolve' library (-lresolve). */
|
||||
/* #undef HAVE_LIBRESOLVE */
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* if your compiler supports LL */
|
||||
#define HAVE_LL 1
|
||||
|
||||
/* Define to 1 if the compiler supports the 'long long' data type. */
|
||||
#define HAVE_LONGLONG 1
|
||||
|
||||
/* Define to 1 if you have the malloc.h header file. */
|
||||
#define HAVE_MALLOC_H 1
|
||||
|
||||
/* Define to 1 if you have the memory.h header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the MSG_NOSIGNAL flag. */
|
||||
/* #undef HAVE_MSG_NOSIGNAL */
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
/* #undef HAVE_NETDB_H */
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
/* #undef HAVE_NETINET_IN_H */
|
||||
|
||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */
|
||||
/* #undef HAVE_NETINET_TCP_H */
|
||||
|
||||
/* Define to 1 if you have the <net/if.h> header file. */
|
||||
/* #undef HAVE_NET_IF_H */
|
||||
|
||||
/* Define to 1 if you have PF_INET6. */
|
||||
#define HAVE_PF_INET6 1
|
||||
|
||||
/* Define to 1 if you have the recv function. */
|
||||
#define HAVE_RECV 1
|
||||
|
||||
/* Define to 1 if you have the recvfrom function. */
|
||||
#define HAVE_RECVFROM 1
|
||||
|
||||
/* Define to 1 if you have the send function. */
|
||||
#define HAVE_SEND 1
|
||||
|
||||
/* Define to 1 if you have the setsockopt function. */
|
||||
#define HAVE_SETSOCKOPT 1
|
||||
|
||||
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */
|
||||
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* Define to 1 if sig_atomic_t is an available typedef. */
|
||||
#define HAVE_SIG_ATOMIC_T 1
|
||||
|
||||
/* Define to 1 if sig_atomic_t is already defined as volatile. */
|
||||
/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */
|
||||
|
||||
/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
|
||||
|
||||
/* Define to 1 if you have the socket function. */
|
||||
#define HAVE_SOCKET 1
|
||||
|
||||
/* Define to 1 if you have the <socket.h> header file. */
|
||||
/* #undef HAVE_SOCKET_H */
|
||||
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */
|
||||
#define HAVE_STDBOOL_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the strcasecmp function. */
|
||||
#define HAVE_STRCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the strcmpi function. */
|
||||
#define HAVE_STRCMPI 1
|
||||
|
||||
/* Define to 1 if you have the strdup function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
/* Define to 1 if you have the stricmp function. */
|
||||
#define HAVE_STRICMP 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the strncasecmp function. */
|
||||
#define HAVE_STRNCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the strncmpi function. */
|
||||
/* #undef HAVE_STRNCMPI */
|
||||
|
||||
/* Define to 1 if you have the strnicmp function. */
|
||||
/* #undef HAVE_STRNICMP */
|
||||
|
||||
/* Define to 1 if you have the <stropts.h> header file. */
|
||||
/* #undef HAVE_STROPTS_H */
|
||||
|
||||
/* Define to 1 if you have struct addrinfo. */
|
||||
#define HAVE_STRUCT_ADDRINFO 1
|
||||
|
||||
/* Define to 1 if you have struct in6_addr. */
|
||||
#define HAVE_STRUCT_IN6_ADDR 1
|
||||
|
||||
/* Define to 1 if you have struct sockaddr_in6. */
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1
|
||||
|
||||
/* if struct sockaddr_storage is defined */
|
||||
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
|
||||
|
||||
/* Define to 1 if you have the timeval struct. */
|
||||
#define HAVE_STRUCT_TIMEVAL 1
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
/* #undef HAVE_SYS_IOCTL_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
/* #undef HAVE_SYS_SELECT_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
/* #undef HAVE_SYS_SOCKET_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */
|
||||
/* #undef HAVE_SYS_UIO_H */
|
||||
|
||||
/* Define to 1 if you have the <time.h> header file. */
|
||||
#define HAVE_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the windows.h header file. */
|
||||
#define HAVE_WINDOWS_H 1
|
||||
|
||||
/* Define to 1 if you have the winsock2.h header file. */
|
||||
#define HAVE_WINSOCK2_H 1
|
||||
|
||||
/* Define to 1 if you have the winsock.h header file. */
|
||||
#define HAVE_WINSOCK_H 1
|
||||
|
||||
/* Define to 1 if you have the writev function. */
|
||||
/* #undef HAVE_WRITEV */
|
||||
|
||||
/* Define to 1 if you have the ws2tcpip.h header file. */
|
||||
#define HAVE_WS2TCPIP_H 1
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Define to 1 if you are building a native Windows target. */
|
||||
#define NATIVE_WINDOWS 1
|
||||
|
||||
/* Define to 1 if you need the malloc.h header file even with stdlib.h */
|
||||
/* #undef NEED_MALLOC_H */
|
||||
|
||||
/* Define to 1 if you need the memory.h header file even with stdlib.h */
|
||||
/* #undef NEED_MEMORY_H */
|
||||
|
||||
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */
|
||||
/* #undef NEED_REENTRANT */
|
||||
|
||||
/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */
|
||||
/* #undef NEED_THREAD_SAFE */
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
/* #undef NO_MINUS_C_MINUS_O */
|
||||
|
||||
/* cpu-machine-OS */
|
||||
#define OS "i686-pc-mingw32"
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "c-ares"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "c-ares"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "c-ares 1.7.3"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "c-ares"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "1.7.3"
|
||||
|
||||
/* a suitable file/device to read random data from */
|
||||
#define RANDOM_FILE "/dev/urandom"
|
||||
|
||||
/* Define to the type of arg 1 for recvfrom. */
|
||||
#define RECVFROM_TYPE_ARG1 SOCKET
|
||||
|
||||
/* Define to the type pointed by arg 2 for recvfrom. */
|
||||
#define RECVFROM_TYPE_ARG2 char
|
||||
|
||||
/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */
|
||||
/* #undef RECVFROM_TYPE_ARG2_IS_VOID */
|
||||
|
||||
/* Define to the type of arg 3 for recvfrom. */
|
||||
#define RECVFROM_TYPE_ARG3 int
|
||||
|
||||
/* Define to the type of arg 4 for recvfrom. */
|
||||
#define RECVFROM_TYPE_ARG4 int
|
||||
|
||||
/* Define to the type pointed by arg 5 for recvfrom. */
|
||||
#define RECVFROM_TYPE_ARG5 struct sockaddr
|
||||
|
||||
/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */
|
||||
/* #undef RECVFROM_TYPE_ARG5_IS_VOID */
|
||||
|
||||
/* Define to the type pointed by arg 6 for recvfrom. */
|
||||
#define RECVFROM_TYPE_ARG6 int
|
||||
|
||||
/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */
|
||||
/* #undef RECVFROM_TYPE_ARG6_IS_VOID */
|
||||
|
||||
/* Define to the function return type for recvfrom. */
|
||||
#define RECVFROM_TYPE_RETV int
|
||||
|
||||
/* Define to the type of arg 1 for recv. */
|
||||
#define RECV_TYPE_ARG1 SOCKET
|
||||
|
||||
/* Define to the type of arg 2 for recv. */
|
||||
#define RECV_TYPE_ARG2 char *
|
||||
|
||||
/* Define to the type of arg 3 for recv. */
|
||||
#define RECV_TYPE_ARG3 int
|
||||
|
||||
/* Define to the type of arg 4 for recv. */
|
||||
#define RECV_TYPE_ARG4 int
|
||||
|
||||
/* Define to the function return type for recv. */
|
||||
#define RECV_TYPE_RETV int
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define to the type qualifier of arg 2 for send. */
|
||||
#define SEND_QUAL_ARG2 const
|
||||
|
||||
/* Define to the type of arg 1 for send. */
|
||||
#define SEND_TYPE_ARG1 SOCKET
|
||||
|
||||
/* Define to the type of arg 2 for send. */
|
||||
#define SEND_TYPE_ARG2 char *
|
||||
|
||||
/* Define to the type of arg 3 for send. */
|
||||
#define SEND_TYPE_ARG3 int
|
||||
|
||||
/* Define to the type of arg 4 for send. */
|
||||
#define SEND_TYPE_ARG4 int
|
||||
|
||||
/* Define to the function return type for send. */
|
||||
#define SEND_TYPE_RETV int
|
||||
|
||||
/* The size of `int', as computed by sizeof. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG 4
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#define SIZEOF_SIZE_T 4
|
||||
|
||||
/* The size of `struct in6_addr', as computed by sizeof. */
|
||||
#define SIZEOF_STRUCT_IN6_ADDR 16
|
||||
|
||||
/* The size of `struct in_addr', as computed by sizeof. */
|
||||
#define SIZEOF_STRUCT_IN_ADDR 4
|
||||
|
||||
/* The size of `time_t', as computed by sizeof. */
|
||||
#define SIZEOF_TIME_T 4
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Define to disable non-blocking sockets. */
|
||||
/* #undef USE_BLOCKING_SOCKETS */
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "1.7.3"
|
||||
|
||||
/* Define to avoid automatic inclusion of winsock.h */
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
/* # undef WORDS_BIGENDIAN */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define to 1 if OS is AIX. */
|
||||
#ifndef _ALL_SOURCE
|
||||
/* # undef _ALL_SOURCE */
|
||||
#endif
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
/* #undef _FILE_OFFSET_BITS */
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
/* #undef _LARGE_FILES */
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Type to use in place of in_addr_t when system does not provide it. */
|
||||
#define in_addr_t unsigned long
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
|
||||
/* the signed version of size_t */
|
||||
/* #undef ssize_t */
|
||||
198
deps/c-ares/win32-ia32/ares_setup.h
vendored
Normal file
198
deps/c-ares/win32-ia32/ares_setup.h
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
#ifndef HEADER_CARES_SETUP_H
|
||||
#define HEADER_CARES_SETUP_H
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 2004 - 2009 by Daniel Stenberg et al
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted, provided
|
||||
* that the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of M.I.T. not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. M.I.T. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define WIN32 when build target is Win32 API
|
||||
*/
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Include configuration script results or hand-crafted
|
||||
* configuration file for platforms which lack config tool.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "ares_config.h"
|
||||
#else
|
||||
|
||||
#ifdef WIN32
|
||||
#include "config-win32.h"
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
/* ================================================================ */
|
||||
/* Definition of preprocessor macros/symbols which modify compiler */
|
||||
/* behaviour or generated code characteristics must be done here, */
|
||||
/* as appropriate, before any system header file is included. It is */
|
||||
/* also possible to have them defined in the config file included */
|
||||
/* before this point. As a result of all this we frown inclusion of */
|
||||
/* system header files in our config files, avoid this at any cost. */
|
||||
/* ================================================================ */
|
||||
|
||||
/*
|
||||
* AIX 4.3 and newer needs _THREAD_SAFE defined to build
|
||||
* proper reentrant code. Others may also need it.
|
||||
*/
|
||||
|
||||
#ifdef NEED_THREAD_SAFE
|
||||
# ifndef _THREAD_SAFE
|
||||
# define _THREAD_SAFE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Tru64 needs _REENTRANT set for a few function prototypes and
|
||||
* things to appear in the system header files. Unixware needs it
|
||||
* to build proper reentrant code. Others may also need it.
|
||||
*/
|
||||
|
||||
#ifdef NEED_REENTRANT
|
||||
# ifndef _REENTRANT
|
||||
# define _REENTRANT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* ================================================================ */
|
||||
/* If you need to include a system header file for your platform, */
|
||||
/* please, do it beyond the point further indicated in this file. */
|
||||
/* ================================================================ */
|
||||
|
||||
/*
|
||||
* c-ares external interface definitions are also used internally,
|
||||
* and might also include required system header files to define them.
|
||||
*/
|
||||
|
||||
#include <ares_build.h>
|
||||
|
||||
/*
|
||||
* Compile time sanity checks must also be done when building the library.
|
||||
*/
|
||||
|
||||
#include <ares_rules.h>
|
||||
|
||||
/* ================================================================= */
|
||||
/* No system header file shall be included in this file before this */
|
||||
/* point. The only allowed ones are those included from ares_build.h */
|
||||
/* ================================================================= */
|
||||
|
||||
/*
|
||||
* Include header files for windows builds before redefining anything.
|
||||
* Use this preproessor block only to include or exclude windows.h,
|
||||
* winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
|
||||
* to any other further and independent block. Under Cygwin things work
|
||||
* just as under linux (e.g. <sys/socket.h>) and the winsock headers should
|
||||
* never be included when __CYGWIN__ is defined. configure script takes
|
||||
* care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
|
||||
* neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# ifdef HAVE_WS2TCPIP_H
|
||||
# include <ws2tcpip.h>
|
||||
# endif
|
||||
# else
|
||||
# ifdef HAVE_WINSOCK_H
|
||||
# include <winsock.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
|
||||
* define USE_WINSOCK to 1 if we have and use WINSOCK API, else
|
||||
* undefine USE_WINSOCK.
|
||||
*/
|
||||
|
||||
#undef USE_WINSOCK
|
||||
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
# define USE_WINSOCK 2
|
||||
#else
|
||||
# ifdef HAVE_WINSOCK_H
|
||||
# define USE_WINSOCK 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Work-arounds for systems without configure support
|
||||
*/
|
||||
|
||||
#ifndef HAVE_CONFIG_H
|
||||
|
||||
#if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER) && !defined(__WATCOMC__)
|
||||
#define HAVE_SYS_TIME_H
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER)
|
||||
#define HAVE_UNISTD_H 1
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SYS_UIO_H) && !defined(WIN32) && !defined(MSDOS)
|
||||
#define HAVE_SYS_UIO_H
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#ifdef __POCC__
|
||||
# include <sys/types.h>
|
||||
# include <unistd.h>
|
||||
# define ESRCH 3
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Recent autoconf versions define these symbols in ares_config.h. We don't
|
||||
* want them (since they collide with the libcurl ones when we build
|
||||
* --enable-debug) so we undef them again here.
|
||||
*/
|
||||
|
||||
#undef PACKAGE_STRING
|
||||
#undef PACKAGE_TARNAME
|
||||
#undef PACKAGE_VERSION
|
||||
#undef PACKAGE_BUGREPORT
|
||||
#undef PACKAGE_NAME
|
||||
#undef VERSION
|
||||
#undef PACKAGE
|
||||
|
||||
/* IPv6 compatibility */
|
||||
#if !defined(HAVE_AF_INET6)
|
||||
#if defined(HAVE_PF_INET6)
|
||||
#define AF_INET6 PF_INET6
|
||||
#else
|
||||
#define AF_INET6 AF_MAX+1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Include macros and defines that should only be processed once.
|
||||
*/
|
||||
|
||||
#ifndef __SETUP_ONCE_H
|
||||
#include "setup_once.h"
|
||||
#endif
|
||||
|
||||
#endif /* HEADER_CARES_SETUP_H */
|
||||
2
deps/http_parser/CMakeLists.txt
vendored
Normal file
2
deps/http_parser/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
include_directories (.)
|
||||
add_library (http_parser http_parser.c)
|
||||
4
deps/http_parser/CONTRIBUTIONS
vendored
Normal file
4
deps/http_parser/CONTRIBUTIONS
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
Contributors must agree to the Contributor License Agreement before patches
|
||||
can be accepted.
|
||||
|
||||
http://spreadsheets2.google.com/viewform?hl=en&formkey=dDJXOGUwbzlYaWM4cHN1MERwQS1CSnc6MQ
|
||||
14
deps/http_parser/Makefile
vendored
14
deps/http_parser/Makefile
vendored
@@ -1,30 +1,32 @@
|
||||
OPT_DEBUG=-O0 -g -Wall -Wextra -Werror -I.
|
||||
OPT_FAST=-O3 -DHTTP_PARSER_STRICT=0 -I.
|
||||
|
||||
CC?=gcc
|
||||
|
||||
|
||||
test: test_g
|
||||
./test_g
|
||||
|
||||
test_g: http_parser_g.o test_g.o
|
||||
gcc $(OPT_DEBUG) http_parser_g.o test_g.o -o $@
|
||||
$(CC) $(OPT_DEBUG) http_parser_g.o test_g.o -o $@
|
||||
|
||||
test_g.o: test.c http_parser.h Makefile
|
||||
gcc $(OPT_DEBUG) -c test.c -o $@
|
||||
$(CC) $(OPT_DEBUG) -c test.c -o $@
|
||||
|
||||
test.o: test.c http_parser.h Makefile
|
||||
gcc $(OPT_FAST) -c test.c -o $@
|
||||
$(CC) $(OPT_FAST) -c test.c -o $@
|
||||
|
||||
http_parser_g.o: http_parser.c http_parser.h Makefile
|
||||
gcc $(OPT_DEBUG) -c http_parser.c -o $@
|
||||
$(CC) $(OPT_DEBUG) -c http_parser.c -o $@
|
||||
|
||||
test-valgrind: test_g
|
||||
valgrind ./test_g
|
||||
|
||||
http_parser.o: http_parser.c http_parser.h Makefile
|
||||
gcc $(OPT_FAST) -c http_parser.c
|
||||
$(CC) $(OPT_FAST) -c http_parser.c
|
||||
|
||||
test_fast: http_parser.o test.c http_parser.h
|
||||
gcc $(OPT_FAST) http_parser.o test.c -o $@
|
||||
$(CC) $(OPT_FAST) http_parser.o test.c -o $@
|
||||
|
||||
test-run-timed: test_fast
|
||||
while(true) do time ./test_fast > /dev/null; done
|
||||
|
||||
4
deps/http_parser/README.md
vendored
4
deps/http_parser/README.md
vendored
@@ -5,7 +5,7 @@ This is a parser for HTTP messages written in C. It parses both requests and
|
||||
responses. The parser is designed to be used in performance HTTP
|
||||
applications. It does not make any syscalls nor allocations, it does not
|
||||
buffer data, it can be interrupted at anytime. Depending on your
|
||||
architecture, it only requires between 100 and 200 bytes of data per message
|
||||
architecture, it only requires about 40 bytes of data per message
|
||||
stream (in a web server that is per connection).
|
||||
|
||||
Features:
|
||||
@@ -39,10 +39,10 @@ like this for a request parser:
|
||||
settings.on_path = my_path_callback;
|
||||
settings.on_header_field = my_header_field_callback;
|
||||
/* ... */
|
||||
settings.data = my_socket;
|
||||
|
||||
http_parser *parser = malloc(sizeof(http_parser));
|
||||
http_parser_init(parser, HTTP_REQUEST);
|
||||
parser->data = my_socket;
|
||||
|
||||
When data is received on the socket execute the parser and check for errors.
|
||||
|
||||
|
||||
472
deps/http_parser/http_parser.c
vendored
472
deps/http_parser/http_parser.c
vendored
@@ -1,7 +1,4 @@
|
||||
/* Copyright 2009,2010 Ryan Dahl <ry@tinyclouds.org>
|
||||
*
|
||||
* Some parts of this source file were taken from NGINX
|
||||
* (src/http/ngx_http_parser.c) copyright (C) 2002-2009 Igor Sysoev.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
@@ -22,7 +19,6 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
#include <http_parser.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
@@ -77,18 +73,76 @@ do { \
|
||||
#define CLOSE "close"
|
||||
|
||||
|
||||
static const unsigned char lowcase[] =
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0-\0\0" "0123456789\0\0\0\0\0\0"
|
||||
"\0abcdefghijklmnopqrstuvwxyz\0\0\0\0_"
|
||||
"\0abcdefghijklmnopqrstuvwxyz\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
||||
static const char *method_strings[] =
|
||||
{ "DELETE"
|
||||
, "GET"
|
||||
, "HEAD"
|
||||
, "POST"
|
||||
, "PUT"
|
||||
, "CONNECT"
|
||||
, "OPTIONS"
|
||||
, "TRACE"
|
||||
, "COPY"
|
||||
, "LOCK"
|
||||
, "MKCOL"
|
||||
, "MOVE"
|
||||
, "PROPFIND"
|
||||
, "PROPPATCH"
|
||||
, "UNLOCK"
|
||||
, "REPORT"
|
||||
, "MKACTIVITY"
|
||||
, "CHECKOUT"
|
||||
, "MERGE"
|
||||
, "M-SEARCH"
|
||||
, "NOTIFY"
|
||||
, "SUBSCRIBE"
|
||||
, "UNSUBSCRIBE"
|
||||
};
|
||||
|
||||
|
||||
static const int unhex[] =
|
||||
/* Tokens as defined by rfc 2616. Also lowercases them.
|
||||
* token = 1*<any CHAR except CTLs or separators>
|
||||
* separators = "(" | ")" | "<" | ">" | "@"
|
||||
* | "," | ";" | ":" | "\" | <">
|
||||
* | "/" | "[" | "]" | "?" | "="
|
||||
* | "{" | "}" | SP | HT
|
||||
*/
|
||||
static const char tokens[256] = {
|
||||
/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* 16 dle 17 dc1 18 dc2 19 dc3 20 dc4 21 nak 22 syn 23 etb */
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us */
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* 32 sp 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' */
|
||||
' ', '!', '"', '#', '$', '%', '&', '\'',
|
||||
/* 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / */
|
||||
0, 0, '*', '+', 0, '-', '.', '/',
|
||||
/* 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 */
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
/* 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? */
|
||||
'8', '9', 0, 0, 0, 0, 0, 0,
|
||||
/* 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G */
|
||||
0, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
|
||||
/* 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O */
|
||||
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
/* 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W */
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
|
||||
/* 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ */
|
||||
'x', 'y', 'z', 0, 0, 0, '^', '_',
|
||||
/* 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g */
|
||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
|
||||
/* 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o */
|
||||
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
/* 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w */
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
|
||||
/* 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del */
|
||||
'x', 'y', 'z', 0, '|', '}', '~', 0 };
|
||||
|
||||
|
||||
static const int8_t unhex[256] =
|
||||
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
@@ -100,32 +154,45 @@ static const int unhex[] =
|
||||
};
|
||||
|
||||
|
||||
|
||||
static const uint32_t usual[] = {
|
||||
0xffffdbfe, /* 1111 1111 1111 1111 1101 1011 1111 1110 */
|
||||
|
||||
/* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */
|
||||
0x7ffffff6, /* 0111 1111 1111 1111 1111 1111 1111 0110 */
|
||||
|
||||
/* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */
|
||||
0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */
|
||||
|
||||
/* ~}| {zyx wvut srqp onml kjih gfed cba` */
|
||||
0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */
|
||||
|
||||
0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */
|
||||
0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */
|
||||
0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */
|
||||
0xffffffff /* 1111 1111 1111 1111 1111 1111 1111 1111 */
|
||||
};
|
||||
|
||||
#define USUAL(c) (usual[c >> 5] & (1 << (c & 0x1f)))
|
||||
static const uint8_t normal_url_char[256] = {
|
||||
/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* 16 dle 17 dc1 18 dc2 19 dc3 20 dc4 21 nak 22 syn 23 etb */
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us */
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* 32 sp 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' */
|
||||
0, 1, 1, 0, 1, 1, 1, 1,
|
||||
/* 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / */
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
/* 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 */
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
/* 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? */
|
||||
1, 1, 1, 1, 1, 1, 1, 0,
|
||||
/* 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G */
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
/* 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O */
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
/* 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W */
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
/* 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ */
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
/* 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g */
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
/* 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o */
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
/* 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w */
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
/* 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del */
|
||||
1, 1, 1, 1, 1, 1, 1, 0 };
|
||||
|
||||
|
||||
enum state
|
||||
{ s_dead = 1 /* important that this is > 0 */
|
||||
|
||||
, s_start_res_or_resp
|
||||
, s_start_req_or_res
|
||||
, s_res_or_resp_H
|
||||
, s_start_res
|
||||
, s_res_H
|
||||
@@ -234,6 +301,7 @@ enum flags
|
||||
#define CR '\r'
|
||||
#define LF '\n'
|
||||
#define LOWER(c) (unsigned char)(c | 0x20)
|
||||
#define TOKEN(c) tokens[(unsigned char)c]
|
||||
|
||||
|
||||
#define start_state (parser->type == HTTP_REQUEST ? s_start_req : s_start_res)
|
||||
@@ -248,35 +316,6 @@ enum flags
|
||||
#endif
|
||||
|
||||
|
||||
#define ngx_str3_cmp(m, c0, c1, c2) \
|
||||
m[0] == c0 && m[1] == c1 && m[2] == c2
|
||||
|
||||
#define ngx_str3Ocmp(m, c0, c1, c2, c3) \
|
||||
m[0] == c0 && m[2] == c2 && m[3] == c3
|
||||
|
||||
#define ngx_str4cmp(m, c0, c1, c2, c3) \
|
||||
m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3
|
||||
|
||||
#define ngx_str5cmp(m, c0, c1, c2, c3, c4) \
|
||||
m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 && m[4] == c4
|
||||
|
||||
#define ngx_str6cmp(m, c0, c1, c2, c3, c4, c5) \
|
||||
m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 \
|
||||
&& m[4] == c4 && m[5] == c5
|
||||
|
||||
#define ngx_str7_cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
|
||||
m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 \
|
||||
&& m[4] == c4 && m[5] == c5 && m[6] == c6
|
||||
|
||||
#define ngx_str8cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
|
||||
m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 \
|
||||
&& m[4] == c4 && m[5] == c5 && m[6] == c6 && m[7] == c7
|
||||
|
||||
#define ngx_str9cmp(m, c0, c1, c2, c3, c4, c5, c6, c7, c8) \
|
||||
m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 \
|
||||
&& m[4] == c4 && m[5] == c5 && m[6] == c6 && m[7] == c7 && m[8] == c8
|
||||
|
||||
|
||||
size_t http_parser_execute (http_parser *parser,
|
||||
const http_parser_settings *settings,
|
||||
const char *data,
|
||||
@@ -284,12 +323,12 @@ size_t http_parser_execute (http_parser *parser,
|
||||
{
|
||||
char c, ch;
|
||||
const char *p = data, *pe;
|
||||
ssize_t to_read;
|
||||
int64_t to_read;
|
||||
|
||||
enum state state = (enum state) parser->state;
|
||||
enum header_states header_state = (enum header_states) parser->header_state;
|
||||
size_t index = parser->index;
|
||||
size_t nread = parser->nread;
|
||||
uint64_t index = parser->index;
|
||||
uint64_t nread = parser->nread;
|
||||
|
||||
if (len == 0) {
|
||||
if (state == s_body_identity_eof) {
|
||||
@@ -321,15 +360,17 @@ size_t http_parser_execute (http_parser *parser,
|
||||
if (state == s_req_path || state == s_req_schema || state == s_req_schema_slash
|
||||
|| state == s_req_schema_slash_slash || state == s_req_port
|
||||
|| state == s_req_query_string_start || state == s_req_query_string
|
||||
|| state == s_req_host
|
||||
|| state == s_req_fragment_start || state == s_req_fragment)
|
||||
url_mark = data;
|
||||
|
||||
for (p=data, pe=data+len; p != pe; p++) {
|
||||
ch = *p;
|
||||
|
||||
if (++nread > HTTP_MAX_HEADER_SIZE && PARSING_HEADER(state)) {
|
||||
if (PARSING_HEADER(state)) {
|
||||
++nread;
|
||||
/* Buffer overflow attack */
|
||||
goto error;
|
||||
if (nread > HTTP_MAX_HEADER_SIZE) goto error;
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
@@ -340,7 +381,7 @@ size_t http_parser_execute (http_parser *parser,
|
||||
*/
|
||||
goto error;
|
||||
|
||||
case s_start_res_or_resp:
|
||||
case s_start_req_or_res:
|
||||
{
|
||||
if (ch == CR || ch == LF)
|
||||
break;
|
||||
@@ -353,10 +394,7 @@ size_t http_parser_execute (http_parser *parser,
|
||||
state = s_res_or_resp_H;
|
||||
else {
|
||||
parser->type = HTTP_REQUEST;
|
||||
if (ch < 'A' || 'Z' < ch) goto error;
|
||||
parser->buffer[0] = ch;
|
||||
index = 0;
|
||||
state = s_req_method;
|
||||
goto start_req_method_assign;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -366,12 +404,10 @@ size_t http_parser_execute (http_parser *parser,
|
||||
parser->type = HTTP_RESPONSE;
|
||||
state = s_res_HT;
|
||||
} else {
|
||||
if (ch < 'A' || 'Z' < ch) goto error;
|
||||
if (ch != 'E') goto error;
|
||||
parser->type = HTTP_REQUEST;
|
||||
parser->method = (enum http_method) 0;
|
||||
parser->buffer[0] = 'H';
|
||||
parser->buffer[1] = ch;
|
||||
index = 1;
|
||||
parser->method = HTTP_HEAD;
|
||||
index = 2;
|
||||
state = s_req_method;
|
||||
}
|
||||
break;
|
||||
@@ -534,133 +570,75 @@ size_t http_parser_execute (http_parser *parser,
|
||||
|
||||
if (ch < 'A' || 'Z' < ch) goto error;
|
||||
|
||||
start_req_method_assign:
|
||||
parser->method = (enum http_method) 0;
|
||||
index = 0;
|
||||
parser->buffer[0] = ch;
|
||||
index = 1;
|
||||
switch (ch) {
|
||||
case 'C': parser->method = HTTP_CONNECT; /* or COPY, CHECKOUT */ break;
|
||||
case 'D': parser->method = HTTP_DELETE; break;
|
||||
case 'G': parser->method = HTTP_GET; break;
|
||||
case 'H': parser->method = HTTP_HEAD; break;
|
||||
case 'L': parser->method = HTTP_LOCK; break;
|
||||
case 'M': parser->method = HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE, M-SEARCH */ break;
|
||||
case 'N': parser->method = HTTP_NOTIFY; break;
|
||||
case 'O': parser->method = HTTP_OPTIONS; break;
|
||||
case 'P': parser->method = HTTP_POST; /* or PROPFIND or PROPPATCH or PUT */ break;
|
||||
case 'R': parser->method = HTTP_REPORT; break;
|
||||
case 'S': parser->method = HTTP_SUBSCRIBE; break;
|
||||
case 'T': parser->method = HTTP_TRACE; break;
|
||||
case 'U': parser->method = HTTP_UNLOCK; /* or UNSUBSCRIBE */ break;
|
||||
default: goto error;
|
||||
}
|
||||
state = s_req_method;
|
||||
break;
|
||||
}
|
||||
|
||||
case s_req_method:
|
||||
if (ch == ' ') {
|
||||
assert(index+1 < HTTP_PARSER_MAX_METHOD_LEN);
|
||||
parser->buffer[index+1] = '\0';
|
||||
{
|
||||
if (ch == '\0')
|
||||
goto error;
|
||||
|
||||
switch (index+1) {
|
||||
case 3:
|
||||
if (ngx_str3_cmp(parser->buffer, 'G', 'E', 'T')) {
|
||||
parser->method = HTTP_GET;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ngx_str3_cmp(parser->buffer, 'P', 'U', 'T')) {
|
||||
parser->method = HTTP_PUT;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (ngx_str4cmp(parser->buffer, 'P', 'O', 'S', 'T')) {
|
||||
parser->method = HTTP_POST;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ngx_str4cmp(parser->buffer, 'H', 'E', 'A', 'D')) {
|
||||
parser->method = HTTP_HEAD;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ngx_str4cmp(parser->buffer, 'C', 'O', 'P', 'Y')) {
|
||||
parser->method = HTTP_COPY;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ngx_str4cmp(parser->buffer, 'M', 'O', 'V', 'E')) {
|
||||
parser->method = HTTP_MOVE;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (ngx_str5cmp(parser->buffer, 'M', 'K', 'C', 'O', 'L')) {
|
||||
parser->method = HTTP_MKCOL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ngx_str5cmp(parser->buffer, 'T', 'R', 'A', 'C', 'E')) {
|
||||
parser->method = HTTP_TRACE;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
if (ngx_str6cmp(parser->buffer, 'D', 'E', 'L', 'E', 'T', 'E')) {
|
||||
parser->method = HTTP_DELETE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ngx_str6cmp(parser->buffer, 'U', 'N', 'L', 'O', 'C', 'K')) {
|
||||
parser->method = HTTP_UNLOCK;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 7:
|
||||
if (ngx_str7_cmp(parser->buffer,
|
||||
'O', 'P', 'T', 'I', 'O', 'N', 'S', '\0')) {
|
||||
parser->method = HTTP_OPTIONS;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ngx_str7_cmp(parser->buffer,
|
||||
'C', 'O', 'N', 'N', 'E', 'C', 'T', '\0')) {
|
||||
parser->method = HTTP_CONNECT;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if (ngx_str8cmp(parser->buffer,
|
||||
'P', 'R', 'O', 'P', 'F', 'I', 'N', 'D')) {
|
||||
parser->method = HTTP_PROPFIND;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
if (ngx_str9cmp(parser->buffer,
|
||||
'P', 'R', 'O', 'P', 'P', 'A', 'T', 'C', 'H')) {
|
||||
parser->method = HTTP_PROPPATCH;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
const char *matcher = method_strings[parser->method];
|
||||
if (ch == ' ' && matcher[index] == '\0') {
|
||||
state = s_req_spaces_before_url;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ch < 'A' || 'Z' < ch) goto error;
|
||||
|
||||
if (++index >= HTTP_PARSER_MAX_METHOD_LEN - 1) {
|
||||
} else if (ch == matcher[index]) {
|
||||
; /* nada */
|
||||
} else if (parser->method == HTTP_CONNECT) {
|
||||
if (index == 1 && ch == 'H') {
|
||||
parser->method = HTTP_CHECKOUT;
|
||||
} else if (index == 2 && ch == 'P') {
|
||||
parser->method = HTTP_COPY;
|
||||
}
|
||||
} else if (parser->method == HTTP_MKCOL) {
|
||||
if (index == 1 && ch == 'O') {
|
||||
parser->method = HTTP_MOVE;
|
||||
} else if (index == 1 && ch == 'E') {
|
||||
parser->method = HTTP_MERGE;
|
||||
} else if (index == 1 && ch == '-') {
|
||||
parser->method = HTTP_MSEARCH;
|
||||
} else if (index == 2 && ch == 'A') {
|
||||
parser->method = HTTP_MKACTIVITY;
|
||||
}
|
||||
} else if (index == 1 && parser->method == HTTP_POST && ch == 'R') {
|
||||
parser->method = HTTP_PROPFIND; /* or HTTP_PROPPATCH */
|
||||
} else if (index == 1 && parser->method == HTTP_POST && ch == 'U') {
|
||||
parser->method = HTTP_PUT;
|
||||
} else if (index == 2 && parser->method == HTTP_UNLOCK && ch == 'S') {
|
||||
parser->method = HTTP_UNSUBSCRIBE;
|
||||
} else if (index == 4 && parser->method == HTTP_PROPFIND && ch == 'P') {
|
||||
parser->method = HTTP_PROPPATCH;
|
||||
} else {
|
||||
goto error;
|
||||
}
|
||||
|
||||
parser->buffer[index] = ch;
|
||||
|
||||
++index;
|
||||
break;
|
||||
|
||||
}
|
||||
case s_req_spaces_before_url:
|
||||
{
|
||||
if (ch == ' ') break;
|
||||
|
||||
if (ch == '/') {
|
||||
if (ch == '/' || ch == '*') {
|
||||
MARK(url);
|
||||
MARK(path);
|
||||
state = s_req_path;
|
||||
@@ -690,6 +668,9 @@ size_t http_parser_execute (http_parser *parser,
|
||||
} else if (ch == '.') {
|
||||
state = s_req_host;
|
||||
break;
|
||||
} else if ('0' <= ch && ch <= '9') {
|
||||
state = s_req_host;
|
||||
break;
|
||||
}
|
||||
|
||||
goto error;
|
||||
@@ -756,7 +737,7 @@ size_t http_parser_execute (http_parser *parser,
|
||||
|
||||
case s_req_path:
|
||||
{
|
||||
if (USUAL(ch)) break;
|
||||
if (normal_url_char[(unsigned char)ch]) break;
|
||||
|
||||
switch (ch) {
|
||||
case ' ':
|
||||
@@ -767,12 +748,14 @@ size_t http_parser_execute (http_parser *parser,
|
||||
case CR:
|
||||
CALLBACK(url);
|
||||
CALLBACK(path);
|
||||
parser->http_major = 0;
|
||||
parser->http_minor = 9;
|
||||
state = s_req_line_almost_done;
|
||||
break;
|
||||
case LF:
|
||||
CALLBACK(url);
|
||||
CALLBACK(path);
|
||||
parser->http_major = 0;
|
||||
parser->http_minor = 9;
|
||||
state = s_header_field_start;
|
||||
break;
|
||||
@@ -792,7 +775,7 @@ size_t http_parser_execute (http_parser *parser,
|
||||
|
||||
case s_req_query_string_start:
|
||||
{
|
||||
if (USUAL(ch)) {
|
||||
if (normal_url_char[(unsigned char)ch]) {
|
||||
MARK(query_string);
|
||||
state = s_req_query_string;
|
||||
break;
|
||||
@@ -800,18 +783,20 @@ size_t http_parser_execute (http_parser *parser,
|
||||
|
||||
switch (ch) {
|
||||
case '?':
|
||||
break; // XXX ignore extra '?' ... is this right?
|
||||
break; /* XXX ignore extra '?' ... is this right? */
|
||||
case ' ':
|
||||
CALLBACK(url);
|
||||
state = s_req_http_start;
|
||||
break;
|
||||
case CR:
|
||||
CALLBACK(url);
|
||||
parser->http_major = 0;
|
||||
parser->http_minor = 9;
|
||||
state = s_req_line_almost_done;
|
||||
break;
|
||||
case LF:
|
||||
CALLBACK(url);
|
||||
parser->http_major = 0;
|
||||
parser->http_minor = 9;
|
||||
state = s_header_field_start;
|
||||
break;
|
||||
@@ -826,11 +811,11 @@ size_t http_parser_execute (http_parser *parser,
|
||||
|
||||
case s_req_query_string:
|
||||
{
|
||||
if (USUAL(ch)) break;
|
||||
if (normal_url_char[(unsigned char)ch]) break;
|
||||
|
||||
switch (ch) {
|
||||
case '?':
|
||||
// allow extra '?' in query string
|
||||
/* allow extra '?' in query string */
|
||||
break;
|
||||
case ' ':
|
||||
CALLBACK(url);
|
||||
@@ -840,12 +825,14 @@ size_t http_parser_execute (http_parser *parser,
|
||||
case CR:
|
||||
CALLBACK(url);
|
||||
CALLBACK(query_string);
|
||||
parser->http_major = 0;
|
||||
parser->http_minor = 9;
|
||||
state = s_req_line_almost_done;
|
||||
break;
|
||||
case LF:
|
||||
CALLBACK(url);
|
||||
CALLBACK(query_string);
|
||||
parser->http_major = 0;
|
||||
parser->http_minor = 9;
|
||||
state = s_header_field_start;
|
||||
break;
|
||||
@@ -861,7 +848,7 @@ size_t http_parser_execute (http_parser *parser,
|
||||
|
||||
case s_req_fragment_start:
|
||||
{
|
||||
if (USUAL(ch)) {
|
||||
if (normal_url_char[(unsigned char)ch]) {
|
||||
MARK(fragment);
|
||||
state = s_req_fragment;
|
||||
break;
|
||||
@@ -874,11 +861,13 @@ size_t http_parser_execute (http_parser *parser,
|
||||
break;
|
||||
case CR:
|
||||
CALLBACK(url);
|
||||
parser->http_major = 0;
|
||||
parser->http_minor = 9;
|
||||
state = s_req_line_almost_done;
|
||||
break;
|
||||
case LF:
|
||||
CALLBACK(url);
|
||||
parser->http_major = 0;
|
||||
parser->http_minor = 9;
|
||||
state = s_header_field_start;
|
||||
break;
|
||||
@@ -896,7 +885,7 @@ size_t http_parser_execute (http_parser *parser,
|
||||
|
||||
case s_req_fragment:
|
||||
{
|
||||
if (USUAL(ch)) break;
|
||||
if (normal_url_char[(unsigned char)ch]) break;
|
||||
|
||||
switch (ch) {
|
||||
case ' ':
|
||||
@@ -907,12 +896,14 @@ size_t http_parser_execute (http_parser *parser,
|
||||
case CR:
|
||||
CALLBACK(url);
|
||||
CALLBACK(fragment);
|
||||
parser->http_major = 0;
|
||||
parser->http_minor = 9;
|
||||
state = s_req_line_almost_done;
|
||||
break;
|
||||
case LF:
|
||||
CALLBACK(url);
|
||||
CALLBACK(fragment);
|
||||
parser->http_major = 0;
|
||||
parser->http_minor = 9;
|
||||
state = s_header_field_start;
|
||||
break;
|
||||
@@ -1034,9 +1025,9 @@ size_t http_parser_execute (http_parser *parser,
|
||||
goto headers_almost_done;
|
||||
}
|
||||
|
||||
c = LOWER(ch);
|
||||
c = TOKEN(ch);
|
||||
|
||||
if (c < 'a' || 'z' < c) goto error;
|
||||
if (!c) goto error;
|
||||
|
||||
MARK(header_field);
|
||||
|
||||
@@ -1069,7 +1060,7 @@ size_t http_parser_execute (http_parser *parser,
|
||||
|
||||
case s_header_field:
|
||||
{
|
||||
c = lowcase[(int)ch];
|
||||
c = TOKEN(ch);
|
||||
|
||||
if (c) {
|
||||
switch (header_state) {
|
||||
@@ -1205,23 +1196,18 @@ size_t http_parser_execute (http_parser *parser,
|
||||
state = s_header_value;
|
||||
index = 0;
|
||||
|
||||
c = lowcase[(int)ch];
|
||||
|
||||
if (!c) {
|
||||
if (ch == CR) {
|
||||
CALLBACK(header_value);
|
||||
header_state = h_general;
|
||||
state = s_header_almost_done;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ch == LF) {
|
||||
CALLBACK(header_value);
|
||||
state = s_header_field_start;
|
||||
break;
|
||||
}
|
||||
c = LOWER(ch);
|
||||
|
||||
if (ch == CR) {
|
||||
CALLBACK(header_value);
|
||||
header_state = h_general;
|
||||
state = s_header_almost_done;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ch == LF) {
|
||||
CALLBACK(header_value);
|
||||
state = s_header_field_start;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1266,22 +1252,19 @@ size_t http_parser_execute (http_parser *parser,
|
||||
|
||||
case s_header_value:
|
||||
{
|
||||
c = lowcase[(int)ch];
|
||||
c = LOWER(ch);
|
||||
|
||||
if (!c) {
|
||||
if (ch == CR) {
|
||||
CALLBACK(header_value);
|
||||
state = s_header_almost_done;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ch == LF) {
|
||||
CALLBACK(header_value);
|
||||
goto header_almost_done;
|
||||
}
|
||||
if (ch == CR) {
|
||||
CALLBACK(header_value);
|
||||
state = s_header_almost_done;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ch == LF) {
|
||||
CALLBACK(header_value);
|
||||
goto header_almost_done;
|
||||
}
|
||||
|
||||
switch (header_state) {
|
||||
case h_general:
|
||||
break;
|
||||
@@ -1292,6 +1275,7 @@ size_t http_parser_execute (http_parser *parser,
|
||||
break;
|
||||
|
||||
case h_content_length:
|
||||
if (ch == ' ') break;
|
||||
if (ch < '0' || ch > '9') goto error;
|
||||
parser->content_length *= 10;
|
||||
parser->content_length += ch - '0';
|
||||
@@ -1378,10 +1362,11 @@ size_t http_parser_execute (http_parser *parser,
|
||||
break;
|
||||
}
|
||||
|
||||
parser->body_read = 0;
|
||||
nread = 0;
|
||||
|
||||
if (parser->flags & F_UPGRADE) parser->upgrade = 1;
|
||||
if (parser->flags & F_UPGRADE || parser->method == HTTP_CONNECT) {
|
||||
parser->upgrade = 1;
|
||||
}
|
||||
|
||||
/* Here we call the headers_complete callback. This is somewhat
|
||||
* different than other callbacks because if the user returns 1, we
|
||||
@@ -1403,8 +1388,8 @@ size_t http_parser_execute (http_parser *parser,
|
||||
}
|
||||
}
|
||||
|
||||
// Exit, the rest of the connect is in a different protocol.
|
||||
if (parser->flags & F_UPGRADE) {
|
||||
/* Exit, the rest of the connect is in a different protocol. */
|
||||
if (parser->upgrade) {
|
||||
CALLBACK2(message_complete);
|
||||
return (p - data);
|
||||
}
|
||||
@@ -1439,12 +1424,12 @@ size_t http_parser_execute (http_parser *parser,
|
||||
}
|
||||
|
||||
case s_body_identity:
|
||||
to_read = MIN(pe - p, (ssize_t)(parser->content_length - parser->body_read));
|
||||
to_read = MIN(pe - p, (int64_t)parser->content_length);
|
||||
if (to_read > 0) {
|
||||
if (settings->on_body) settings->on_body(parser, p, to_read);
|
||||
p += to_read - 1;
|
||||
parser->body_read += to_read;
|
||||
if (parser->body_read == parser->content_length) {
|
||||
parser->content_length -= to_read;
|
||||
if (parser->content_length == 0) {
|
||||
CALLBACK2(message_complete);
|
||||
state = NEW_MESSAGE();
|
||||
}
|
||||
@@ -1457,7 +1442,6 @@ size_t http_parser_execute (http_parser *parser,
|
||||
if (to_read > 0) {
|
||||
if (settings->on_body) settings->on_body(parser, p, to_read);
|
||||
p += to_read - 1;
|
||||
parser->body_read += to_read;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1465,7 +1449,7 @@ size_t http_parser_execute (http_parser *parser,
|
||||
{
|
||||
assert(parser->flags & F_CHUNKED);
|
||||
|
||||
c = unhex[(int)ch];
|
||||
c = unhex[(unsigned char)ch];
|
||||
if (c == -1) goto error;
|
||||
parser->content_length = c;
|
||||
state = s_chunk_size;
|
||||
@@ -1481,7 +1465,7 @@ size_t http_parser_execute (http_parser *parser,
|
||||
break;
|
||||
}
|
||||
|
||||
c = unhex[(int)ch];
|
||||
c = unhex[(unsigned char)ch];
|
||||
|
||||
if (c == -1) {
|
||||
if (ch == ';' || ch == ' ') {
|
||||
@@ -1525,7 +1509,7 @@ size_t http_parser_execute (http_parser *parser,
|
||||
{
|
||||
assert(parser->flags & F_CHUNKED);
|
||||
|
||||
to_read = MIN(pe - p, (ssize_t)(parser->content_length));
|
||||
to_read = MIN(pe - p, (int64_t)(parser->content_length));
|
||||
|
||||
if (to_read > 0) {
|
||||
if (settings->on_body) settings->on_body(parser, p, to_read);
|
||||
@@ -1573,6 +1557,7 @@ size_t http_parser_execute (http_parser *parser,
|
||||
return len;
|
||||
|
||||
error:
|
||||
parser->state = s_dead;
|
||||
return (p - data);
|
||||
}
|
||||
|
||||
@@ -1598,12 +1583,19 @@ http_should_keep_alive (http_parser *parser)
|
||||
}
|
||||
|
||||
|
||||
const char * http_method_str (enum http_method m)
|
||||
{
|
||||
return method_strings[m];
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
http_parser_init (http_parser *parser, enum http_parser_type t)
|
||||
{
|
||||
parser->type = t;
|
||||
parser->state = (t == HTTP_REQUEST ? s_start_req : (t == HTTP_RESPONSE ? s_start_res : s_start_res_or_resp));
|
||||
parser->state = (t == HTTP_REQUEST ? s_start_req : (t == HTTP_RESPONSE ? s_start_res : s_start_req_or_res));
|
||||
parser->nread = 0;
|
||||
parser->upgrade = 0;
|
||||
parser->flags = 0;
|
||||
parser->method = 0;
|
||||
}
|
||||
|
||||
|
||||
75
deps/http_parser/http_parser.h
vendored
75
deps/http_parser/http_parser.h
vendored
@@ -26,7 +26,21 @@ extern "C" {
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
typedef __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
typedef unsigned int size_t;
|
||||
typedef int ssize_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
/* Compile with -DHTTP_PARSER_STRICT=0 to make less checks, but run
|
||||
* faster
|
||||
@@ -63,29 +77,35 @@ typedef int (*http_data_cb) (http_parser*, const char *at, size_t length);
|
||||
typedef int (*http_cb) (http_parser*);
|
||||
|
||||
|
||||
/* Should be at least one longer than the longest request method */
|
||||
#define HTTP_PARSER_MAX_METHOD_LEN 10
|
||||
|
||||
|
||||
/* Request Methods */
|
||||
enum http_method
|
||||
{ HTTP_DELETE = 0x0001
|
||||
, HTTP_GET = 0x0002
|
||||
, HTTP_HEAD = 0x0004
|
||||
, HTTP_POST = 0x0008
|
||||
, HTTP_PUT = 0x0010
|
||||
{ HTTP_DELETE = 0
|
||||
, HTTP_GET
|
||||
, HTTP_HEAD
|
||||
, HTTP_POST
|
||||
, HTTP_PUT
|
||||
/* pathological */
|
||||
, HTTP_CONNECT = 0x0020
|
||||
, HTTP_OPTIONS = 0x0040
|
||||
, HTTP_TRACE = 0x0080
|
||||
, HTTP_CONNECT
|
||||
, HTTP_OPTIONS
|
||||
, HTTP_TRACE
|
||||
/* webdav */
|
||||
, HTTP_COPY = 0x0100
|
||||
, HTTP_LOCK = 0x0200
|
||||
, HTTP_MKCOL = 0x0400
|
||||
, HTTP_MOVE = 0x0800
|
||||
, HTTP_PROPFIND = 0x1000
|
||||
, HTTP_PROPPATCH = 0x2000
|
||||
, HTTP_UNLOCK = 0x4000
|
||||
, HTTP_COPY
|
||||
, HTTP_LOCK
|
||||
, HTTP_MKCOL
|
||||
, HTTP_MOVE
|
||||
, HTTP_PROPFIND
|
||||
, HTTP_PROPPATCH
|
||||
, HTTP_UNLOCK
|
||||
/* subversion */
|
||||
, HTTP_REPORT
|
||||
, HTTP_MKACTIVITY
|
||||
, HTTP_CHECKOUT
|
||||
, HTTP_MERGE
|
||||
/* upnp */
|
||||
, HTTP_MSEARCH
|
||||
, HTTP_NOTIFY
|
||||
, HTTP_SUBSCRIBE
|
||||
, HTTP_UNSUBSCRIBE
|
||||
};
|
||||
|
||||
|
||||
@@ -94,23 +114,20 @@ enum http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH };
|
||||
|
||||
struct http_parser {
|
||||
/** PRIVATE **/
|
||||
unsigned char type;
|
||||
unsigned char type : 2;
|
||||
unsigned char flags : 6;
|
||||
unsigned char state;
|
||||
unsigned char header_state;
|
||||
unsigned char index;
|
||||
|
||||
char flags;
|
||||
|
||||
size_t nread;
|
||||
ssize_t body_read;
|
||||
ssize_t content_length;
|
||||
uint32_t nread;
|
||||
int64_t content_length;
|
||||
|
||||
/** READ-ONLY **/
|
||||
unsigned short status_code; /* responses only */
|
||||
unsigned short method; /* requests only */
|
||||
unsigned short http_major;
|
||||
unsigned short http_minor;
|
||||
char buffer[HTTP_PARSER_MAX_METHOD_LEN];
|
||||
unsigned short status_code; /* responses only */
|
||||
unsigned char method; /* requests only */
|
||||
|
||||
/* 1 = Upgrade header was present and the parser has exited because of that.
|
||||
* 0 = No upgrade header present.
|
||||
@@ -155,6 +172,8 @@ size_t http_parser_execute(http_parser *parser,
|
||||
*/
|
||||
int http_should_keep_alive(http_parser *parser);
|
||||
|
||||
/* Returns a string version of the HTTP method. */
|
||||
const char *http_method_str(enum http_method);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
434
deps/http_parser/test.c
vendored
434
deps/http_parser/test.c
vendored
@@ -31,7 +31,7 @@
|
||||
#undef FALSE
|
||||
#define FALSE 0
|
||||
|
||||
#define MAX_HEADERS 10
|
||||
#define MAX_HEADERS 13
|
||||
#define MAX_ELEMENT_SIZE 500
|
||||
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
@@ -498,7 +498,7 @@ const struct message requests[] =
|
||||
#define CONNECT_REQUEST 17
|
||||
, {.name = "connect request"
|
||||
,.type= HTTP_REQUEST
|
||||
,.raw= "CONNECT home.netscape.com:443 HTTP/1.0\r\n"
|
||||
,.raw= "CONNECT home0.netscape.com:443 HTTP/1.0\r\n"
|
||||
"User-agent: Mozilla/1.1N\r\n"
|
||||
"Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n"
|
||||
"\r\n"
|
||||
@@ -510,15 +510,78 @@ const struct message requests[] =
|
||||
,.query_string= ""
|
||||
,.fragment= ""
|
||||
,.request_path= ""
|
||||
,.request_url= "home.netscape.com:443"
|
||||
,.request_url= "home0.netscape.com:443"
|
||||
,.num_headers= 2
|
||||
,.upgrade=0
|
||||
,.upgrade=1
|
||||
,.headers= { { "User-agent", "Mozilla/1.1N" }
|
||||
, { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" }
|
||||
}
|
||||
,.body= ""
|
||||
}
|
||||
|
||||
#define REPORT_REQ 18
|
||||
, {.name= "report request"
|
||||
,.type= HTTP_REQUEST
|
||||
,.raw= "REPORT /test HTTP/1.1\r\n"
|
||||
"\r\n"
|
||||
,.should_keep_alive= TRUE
|
||||
,.message_complete_on_eof= FALSE
|
||||
,.http_major= 1
|
||||
,.http_minor= 1
|
||||
,.method= HTTP_REPORT
|
||||
,.query_string= ""
|
||||
,.fragment= ""
|
||||
,.request_path= "/test"
|
||||
,.request_url= "/test"
|
||||
,.num_headers= 0
|
||||
,.headers= {}
|
||||
,.body= ""
|
||||
}
|
||||
|
||||
#define NO_HTTP_VERSION 19
|
||||
, {.name= "request with no http version"
|
||||
,.type= HTTP_REQUEST
|
||||
,.raw= "GET /\r\n"
|
||||
"\r\n"
|
||||
,.should_keep_alive= FALSE
|
||||
,.message_complete_on_eof= FALSE
|
||||
,.http_major= 0
|
||||
,.http_minor= 9
|
||||
,.method= HTTP_GET
|
||||
,.query_string= ""
|
||||
,.fragment= ""
|
||||
,.request_path= "/"
|
||||
,.request_url= "/"
|
||||
,.num_headers= 0
|
||||
,.headers= {}
|
||||
,.body= ""
|
||||
}
|
||||
|
||||
#define MSEARCH_REQ 19
|
||||
, {.name= "m-search request"
|
||||
,.type= HTTP_REQUEST
|
||||
,.raw= "M-SEARCH * HTTP/1.1\r\n"
|
||||
"HOST: 239.255.255.250:1900\r\n"
|
||||
"MAN: \"ssdp:discover\"\r\n"
|
||||
"ST: \"ssdp:all\"\r\n"
|
||||
"\r\n"
|
||||
,.should_keep_alive= TRUE
|
||||
,.message_complete_on_eof= FALSE
|
||||
,.http_major= 1
|
||||
,.http_minor= 1
|
||||
,.method= HTTP_MSEARCH
|
||||
,.query_string= ""
|
||||
,.fragment= ""
|
||||
,.request_path= "*"
|
||||
,.request_url= "*"
|
||||
,.num_headers= 3
|
||||
,.headers= { { "HOST", "239.255.255.250:1900" }
|
||||
, { "MAN", "\"ssdp:discover\"" }
|
||||
, { "ST", "\"ssdp:all\"" }
|
||||
}
|
||||
,.body= ""
|
||||
}
|
||||
|
||||
, {.name= NULL } /* sentinel */
|
||||
};
|
||||
|
||||
@@ -532,9 +595,10 @@ const struct message responses[] =
|
||||
"Content-Type: text/html; charset=UTF-8\r\n"
|
||||
"Date: Sun, 26 Apr 2009 11:11:49 GMT\r\n"
|
||||
"Expires: Tue, 26 May 2009 11:11:49 GMT\r\n"
|
||||
"X-$PrototypeBI-Version: 1.6.0.3\r\n" /* $ char in header field */
|
||||
"Cache-Control: public, max-age=2592000\r\n"
|
||||
"Server: gws\r\n"
|
||||
"Content-Length: 219\r\n"
|
||||
"Content-Length: 219 \r\n"
|
||||
"\r\n"
|
||||
"<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n"
|
||||
"<TITLE>301 Moved</TITLE></HEAD><BODY>\n"
|
||||
@@ -547,15 +611,16 @@ const struct message responses[] =
|
||||
,.http_major= 1
|
||||
,.http_minor= 1
|
||||
,.status_code= 301
|
||||
,.num_headers= 7
|
||||
,.num_headers= 8
|
||||
,.headers=
|
||||
{ { "Location", "http://www.google.com/" }
|
||||
, { "Content-Type", "text/html; charset=UTF-8" }
|
||||
, { "Date", "Sun, 26 Apr 2009 11:11:49 GMT" }
|
||||
, { "Expires", "Tue, 26 May 2009 11:11:49 GMT" }
|
||||
, { "X-$PrototypeBI-Version", "1.6.0.3" }
|
||||
, { "Cache-Control", "public, max-age=2592000" }
|
||||
, { "Server", "gws" }
|
||||
, { "Content-Length", "219" }
|
||||
, { "Content-Length", "219 " }
|
||||
}
|
||||
,.body= "<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n"
|
||||
"<TITLE>301 Moved</TITLE></HEAD><BODY>\n"
|
||||
@@ -782,6 +847,103 @@ const struct message responses[] =
|
||||
,.body= ""
|
||||
}
|
||||
|
||||
#define SPACE_IN_FIELD_RES 9
|
||||
/* Should handle spaces in header fields */
|
||||
, {.name= "field space"
|
||||
,.type= HTTP_RESPONSE
|
||||
,.raw= "HTTP/1.1 200 OK\r\n"
|
||||
"Server: Microsoft-IIS/6.0\r\n"
|
||||
"X-Powered-By: ASP.NET\r\n"
|
||||
"en-US Content-Type: text/xml\r\n" /* this is the problem */
|
||||
"Content-Type: text/xml\r\n"
|
||||
"Content-Length: 16\r\n"
|
||||
"Date: Fri, 23 Jul 2010 18:45:38 GMT\r\n"
|
||||
"Connection: keep-alive\r\n"
|
||||
"\r\n"
|
||||
"<xml>hello</xml>" /* fake body */
|
||||
,.should_keep_alive= TRUE
|
||||
,.message_complete_on_eof= FALSE
|
||||
,.http_major= 1
|
||||
,.http_minor= 1
|
||||
,.status_code= 200
|
||||
,.num_headers= 7
|
||||
,.headers=
|
||||
{ { "Server", "Microsoft-IIS/6.0" }
|
||||
, { "X-Powered-By", "ASP.NET" }
|
||||
, { "en-US Content-Type", "text/xml" }
|
||||
, { "Content-Type", "text/xml" }
|
||||
, { "Content-Length", "16" }
|
||||
, { "Date", "Fri, 23 Jul 2010 18:45:38 GMT" }
|
||||
, { "Connection", "keep-alive" }
|
||||
}
|
||||
,.body= "<xml>hello</xml>"
|
||||
}
|
||||
|
||||
|
||||
#define RES_FIELD_UNDERSCORE 10
|
||||
/* Should handle spaces in header fields */
|
||||
, {.name= "field underscore"
|
||||
,.type= HTTP_RESPONSE
|
||||
,.raw= "HTTP/1.1 200 OK\r\n"
|
||||
"Date: Tue, 28 Sep 2010 01:14:13 GMT\r\n"
|
||||
"Server: Apache\r\n"
|
||||
"Cache-Control: no-cache, must-revalidate\r\n"
|
||||
"Expires: Mon, 26 Jul 1997 05:00:00 GMT\r\n"
|
||||
".et-Cookie: PlaxoCS=1274804622353690521; path=/; domain=.plaxo.com\r\n"
|
||||
"Vary: Accept-Encoding\r\n"
|
||||
"_eep-Alive: timeout=45\r\n" /* semantic value ignored */
|
||||
"_onnection: Keep-Alive\r\n" /* semantic value ignored */
|
||||
"Transfer-Encoding: chunked\r\n"
|
||||
"Content-Type: text/html\r\n"
|
||||
"Connection: close\r\n"
|
||||
"\r\n"
|
||||
"0\r\n\r\n"
|
||||
,.should_keep_alive= FALSE
|
||||
,.message_complete_on_eof= FALSE
|
||||
,.http_major= 1
|
||||
,.http_minor= 1
|
||||
,.status_code= 200
|
||||
,.num_headers= 11
|
||||
,.headers=
|
||||
{ { "Date", "Tue, 28 Sep 2010 01:14:13 GMT" }
|
||||
, { "Server", "Apache" }
|
||||
, { "Cache-Control", "no-cache, must-revalidate" }
|
||||
, { "Expires", "Mon, 26 Jul 1997 05:00:00 GMT" }
|
||||
, { ".et-Cookie", "PlaxoCS=1274804622353690521; path=/; domain=.plaxo.com" }
|
||||
, { "Vary", "Accept-Encoding" }
|
||||
, { "_eep-Alive", "timeout=45" }
|
||||
, { "_onnection", "Keep-Alive" }
|
||||
, { "Transfer-Encoding", "chunked" }
|
||||
, { "Content-Type", "text/html" }
|
||||
, { "Connection", "close" }
|
||||
}
|
||||
,.body= ""
|
||||
}
|
||||
|
||||
#define NON_ASCII_IN_STATUS_LINE 11
|
||||
/* Should handle non-ASCII in status line */
|
||||
, {.name= "non-ASCII in status line"
|
||||
,.type= HTTP_RESPONSE
|
||||
,.raw= "HTTP/1.1 500 Oriëntatieprobleem\r\n"
|
||||
"Date: Fri, 5 Nov 2010 23:07:12 GMT+2\r\n"
|
||||
"Content-Length: 0\r\n"
|
||||
"Connection: close\r\n"
|
||||
"\r\n"
|
||||
,.should_keep_alive= FALSE
|
||||
,.message_complete_on_eof= FALSE
|
||||
,.http_major= 1
|
||||
,.http_minor= 1
|
||||
,.status_code= 500
|
||||
,.num_headers= 3
|
||||
,.headers=
|
||||
{ { "Date", "Fri, 5 Nov 2010 23:07:12 GMT+2" }
|
||||
, { "Content-Length", "0" }
|
||||
, { "Connection", "close" }
|
||||
}
|
||||
,.body= ""
|
||||
}
|
||||
|
||||
|
||||
, {.name= NULL } /* sentinel */
|
||||
};
|
||||
|
||||
@@ -932,6 +1094,19 @@ static http_parser_settings settings_count_body =
|
||||
,.on_message_complete = message_complete_cb
|
||||
};
|
||||
|
||||
static http_parser_settings settings_null =
|
||||
{.on_message_begin = 0
|
||||
,.on_header_field = 0
|
||||
,.on_header_value = 0
|
||||
,.on_path = 0
|
||||
,.on_url = 0
|
||||
,.on_fragment = 0
|
||||
,.on_query_string = 0
|
||||
,.on_body = 0
|
||||
,.on_headers_complete = 0
|
||||
,.on_message_complete = 0
|
||||
};
|
||||
|
||||
void
|
||||
parser_init (enum http_parser_type type)
|
||||
{
|
||||
@@ -955,7 +1130,7 @@ parser_free ()
|
||||
parser = NULL;
|
||||
}
|
||||
|
||||
inline size_t parse (const char *buf, size_t len)
|
||||
size_t parse (const char *buf, size_t len)
|
||||
{
|
||||
size_t nparsed;
|
||||
currently_parsing_eof = (len == 0);
|
||||
@@ -963,7 +1138,7 @@ inline size_t parse (const char *buf, size_t len)
|
||||
return nparsed;
|
||||
}
|
||||
|
||||
inline size_t parse_count_body (const char *buf, size_t len)
|
||||
size_t parse_count_body (const char *buf, size_t len)
|
||||
{
|
||||
size_t nparsed;
|
||||
currently_parsing_eof = (len == 0);
|
||||
@@ -1097,38 +1272,57 @@ print_error (const char *raw, size_t error_location)
|
||||
void
|
||||
test_message (const struct message *message)
|
||||
{
|
||||
parser_init(message->type);
|
||||
size_t raw_len = strlen(message->raw);
|
||||
size_t msg1len;
|
||||
for (msg1len = 0; msg1len < raw_len; msg1len++) {
|
||||
parser_init(message->type);
|
||||
|
||||
size_t read;
|
||||
size_t read;
|
||||
const char *msg1 = message->raw;
|
||||
const char *msg2 = msg1 + msg1len;
|
||||
size_t msg2len = raw_len - msg1len;
|
||||
|
||||
read = parse(message->raw, strlen(message->raw));
|
||||
if (msg1len) {
|
||||
read = parse(msg1, msg1len);
|
||||
|
||||
if (message->upgrade && parser->upgrade) goto test;
|
||||
if (message->upgrade && parser->upgrade) goto test;
|
||||
|
||||
if (read != strlen(message->raw)) {
|
||||
print_error(message->raw, read);
|
||||
exit(1);
|
||||
if (read != msg1len) {
|
||||
print_error(msg1, read);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
read = parse(msg2, msg2len);
|
||||
|
||||
if (message->upgrade && parser->upgrade) goto test;
|
||||
|
||||
if (read != msg2len) {
|
||||
print_error(msg2, read);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
read = parse(NULL, 0);
|
||||
|
||||
if (message->upgrade && parser->upgrade) goto test;
|
||||
|
||||
if (read != 0) {
|
||||
print_error(message->raw, read);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
test:
|
||||
|
||||
if (num_messages != 1) {
|
||||
printf("\n*** num_messages != 1 after testing '%s' ***\n\n", message->name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(!message_eq(0, message)) exit(1);
|
||||
|
||||
parser_free();
|
||||
}
|
||||
|
||||
read = parse(NULL, 0);
|
||||
|
||||
if (message->upgrade && parser->upgrade) goto test;
|
||||
|
||||
if (read != 0) {
|
||||
print_error(message->raw, read);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
test:
|
||||
|
||||
if (num_messages != 1) {
|
||||
printf("\n*** num_messages != 1 after testing '%s' ***\n\n", message->name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(!message_eq(0, message)) exit(1);
|
||||
|
||||
parser_free();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1168,23 +1362,80 @@ test_message_count_body (const struct message *message)
|
||||
}
|
||||
|
||||
void
|
||||
test_error (const char *buf)
|
||||
test_simple (const char *buf, int should_pass)
|
||||
{
|
||||
parser_init(HTTP_REQUEST);
|
||||
|
||||
size_t parsed;
|
||||
|
||||
int pass;
|
||||
parsed = parse(buf, strlen(buf));
|
||||
if (parsed != strlen(buf)) goto out;
|
||||
pass = (parsed == strlen(buf));
|
||||
parsed = parse(NULL, 0);
|
||||
if (parsed != 0) goto out;
|
||||
pass &= (parsed == 0);
|
||||
|
||||
fprintf(stderr, "\n*** Error expected but none found ***\n\n%s", buf);
|
||||
parser_free();
|
||||
|
||||
if (pass != should_pass) {
|
||||
fprintf(stderr, "\n*** test_simple expected %s ***\n\n%s", should_pass ? "success" : "error", buf);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
test_header_overflow_error (int req)
|
||||
{
|
||||
http_parser parser;
|
||||
http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
|
||||
size_t parsed;
|
||||
const char *buf;
|
||||
buf = req ? "GET / HTTP/1.1\r\n" : "HTTP/1.0 200 OK\r\n";
|
||||
parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf));
|
||||
assert(parsed == strlen(buf));
|
||||
|
||||
buf = "header-key: header-value\r\n";
|
||||
int i;
|
||||
for (i = 0; i < 10000; i++) {
|
||||
if (http_parser_execute(&parser, &settings_null, buf, strlen(buf)) != strlen(buf)) {
|
||||
//fprintf(stderr, "error found on iter %d\n", i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n*** Error expected but none in header overflow test ***\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
test_no_overflow_long_body (int req, size_t length)
|
||||
{
|
||||
http_parser parser;
|
||||
http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
|
||||
size_t parsed;
|
||||
size_t i;
|
||||
char buf1[3000];
|
||||
size_t buf1len = sprintf(buf1, "%s\r\nConnection: Keep-Alive\r\nContent-Length: %zu\r\n\r\n",
|
||||
req ? "POST / HTTP/1.0" : "HTTP/1.0 200 OK", length);
|
||||
parsed = http_parser_execute(&parser, &settings_null, buf1, buf1len);
|
||||
if (parsed != buf1len)
|
||||
goto err;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
char foo = 'a';
|
||||
parsed = http_parser_execute(&parser, &settings_null, &foo, 1);
|
||||
if (parsed != 1)
|
||||
goto err;
|
||||
}
|
||||
|
||||
parsed = http_parser_execute(&parser, &settings_null, buf1, buf1len);
|
||||
if (parsed != buf1len) goto err;
|
||||
return;
|
||||
|
||||
out:
|
||||
parser_free();
|
||||
err:
|
||||
fprintf(stderr,
|
||||
"\n*** error in test_no_overflow_long_body %s of length %zu ***\n",
|
||||
req ? "REQUEST" : "RESPONSE",
|
||||
length);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1299,18 +1550,27 @@ test_scan (const struct message *r1, const struct message *r2, const struct mess
|
||||
buf3[buf3_len] = 0;
|
||||
|
||||
read = parse(buf1, buf1_len);
|
||||
|
||||
if (r3->upgrade && parser->upgrade) goto test;
|
||||
|
||||
if (read != buf1_len) {
|
||||
print_error(buf1, read);
|
||||
goto error;
|
||||
}
|
||||
|
||||
read = parse(buf2, buf2_len);
|
||||
|
||||
if (r3->upgrade && parser->upgrade) goto test;
|
||||
|
||||
if (read != buf2_len) {
|
||||
print_error(buf2, read);
|
||||
goto error;
|
||||
}
|
||||
|
||||
read = parse(buf3, buf3_len);
|
||||
|
||||
if (r3->upgrade && parser->upgrade) goto test;
|
||||
|
||||
if (read != buf3_len) {
|
||||
print_error(buf3, read);
|
||||
goto error;
|
||||
@@ -1318,6 +1578,8 @@ test_scan (const struct message *r1, const struct message *r2, const struct mess
|
||||
|
||||
parse(NULL, 0);
|
||||
|
||||
test:
|
||||
|
||||
if (3 != num_messages) {
|
||||
fprintf(stderr, "\n\nParser didn't see 3 messages only %d\n", num_messages);
|
||||
goto error;
|
||||
@@ -1359,23 +1621,17 @@ char *
|
||||
create_large_chunked_message (int body_size_in_kb, const char* headers)
|
||||
{
|
||||
int i;
|
||||
size_t needed, wrote = 0;
|
||||
size_t wrote = 0;
|
||||
size_t headers_len = strlen(headers);
|
||||
size_t bufsize = headers_len + 10;
|
||||
size_t bufsize = headers_len + (5+1024+2)*body_size_in_kb + 6;
|
||||
char * buf = malloc(bufsize);
|
||||
|
||||
strncpy(buf, headers, headers_len);
|
||||
memcpy(buf, headers, headers_len);
|
||||
wrote += headers_len;
|
||||
|
||||
for (i = 0; i < body_size_in_kb; i++) {
|
||||
// write 1kb chunk into the body.
|
||||
needed = 5 + 1024 + 2; // "400\r\nCCCC...CCCC\r\n"
|
||||
if (bufsize - wrote < needed) {
|
||||
buf = realloc(buf, bufsize + needed);
|
||||
bufsize += needed;
|
||||
}
|
||||
|
||||
strcpy(buf + wrote, "400\r\n");
|
||||
memcpy(buf + wrote, "400\r\n", 5);
|
||||
wrote += 5;
|
||||
memset(buf + wrote, 'C', 1024);
|
||||
wrote += 1024;
|
||||
@@ -1383,15 +1639,9 @@ create_large_chunked_message (int body_size_in_kb, const char* headers)
|
||||
wrote += 2;
|
||||
}
|
||||
|
||||
needed = 5; // "0\r\n\r\n"
|
||||
if (bufsize - wrote < needed) {
|
||||
buf = realloc(buf, bufsize + needed);
|
||||
bufsize += needed;
|
||||
}
|
||||
strcpy(buf + wrote, "0\r\n\r\n");
|
||||
wrote += 5;
|
||||
|
||||
assert(buf[wrote] == 0);
|
||||
memcpy(buf + wrote, "0\r\n\r\n", 6);
|
||||
wrote += 6;
|
||||
assert(wrote == bufsize);
|
||||
|
||||
return buf;
|
||||
}
|
||||
@@ -1410,6 +1660,16 @@ main (void)
|
||||
for (request_count = 0; requests[request_count].name; request_count++);
|
||||
for (response_count = 0; responses[response_count].name; response_count++);
|
||||
|
||||
//// OVERFLOW CONDITIONS
|
||||
|
||||
test_header_overflow_error(HTTP_REQUEST);
|
||||
test_no_overflow_long_body(HTTP_REQUEST, 1000);
|
||||
test_no_overflow_long_body(HTTP_REQUEST, 100000);
|
||||
|
||||
test_header_overflow_error(HTTP_RESPONSE);
|
||||
test_no_overflow_long_body(HTTP_RESPONSE, 1000);
|
||||
test_no_overflow_long_body(HTTP_RESPONSE, 100000);
|
||||
|
||||
//// RESPONSES
|
||||
|
||||
for (i = 0; i < response_count; i++) {
|
||||
@@ -1464,7 +1724,7 @@ main (void)
|
||||
, &responses[NO_REASON_PHRASE]
|
||||
);
|
||||
|
||||
printf("response scan 1/2 ");
|
||||
printf("response scan 2/2 ");
|
||||
test_scan( &responses[BONJOUR_MADAME_FR]
|
||||
, &responses[UNDERSTORE_HEADER_KEY]
|
||||
, &responses[NO_CARRIAGE_RET]
|
||||
@@ -1476,8 +1736,36 @@ main (void)
|
||||
/// REQUESTS
|
||||
|
||||
|
||||
test_error("hello world");
|
||||
test_error("GET / HTP/1.1\r\n\r\n");
|
||||
test_simple("hello world", 0);
|
||||
test_simple("GET / HTP/1.1\r\n\r\n", 0);
|
||||
|
||||
test_simple("ASDF / HTTP/1.1\r\n\r\n", 0);
|
||||
test_simple("PROPPATCHA / HTTP/1.1\r\n\r\n", 0);
|
||||
test_simple("GETA / HTTP/1.1\r\n\r\n", 0);
|
||||
|
||||
static const char *all_methods[] = {
|
||||
"DELETE",
|
||||
"GET",
|
||||
"HEAD",
|
||||
"POST",
|
||||
"PUT",
|
||||
//"CONNECT", //CONNECT can't be tested like other methods, it's a tunnel
|
||||
"OPTIONS",
|
||||
"TRACE",
|
||||
"COPY",
|
||||
"LOCK",
|
||||
"MKCOL",
|
||||
"MOVE",
|
||||
"PROPFIND",
|
||||
"PROPPATCH",
|
||||
"UNLOCK",
|
||||
0 };
|
||||
const char **this_method;
|
||||
for (this_method = all_methods; *this_method; this_method++) {
|
||||
char buf[200];
|
||||
sprintf(buf, "%s / HTTP/1.1\r\n\r\n", *this_method);
|
||||
test_simple(buf, 1);
|
||||
}
|
||||
|
||||
const char *dumbfuck2 =
|
||||
"GET / HTTP/1.1\r\n"
|
||||
@@ -1514,7 +1802,7 @@ main (void)
|
||||
"\tRA==\r\n"
|
||||
"\t-----END CERTIFICATE-----\r\n"
|
||||
"\r\n";
|
||||
test_error(dumbfuck2);
|
||||
test_simple(dumbfuck2, 0);
|
||||
|
||||
#if 0
|
||||
// NOTE(Wed Nov 18 11:57:27 CET 2009) this seems okay. we just read body
|
||||
@@ -1526,7 +1814,7 @@ main (void)
|
||||
"Accept: */*\r\n"
|
||||
"\r\n"
|
||||
"HELLO";
|
||||
test_error(bad_get_no_headers_no_body);
|
||||
test_simple(bad_get_no_headers_no_body, 0);
|
||||
#endif
|
||||
/* TODO sending junk and large headers gets rejected */
|
||||
|
||||
@@ -1548,24 +1836,30 @@ main (void)
|
||||
}
|
||||
}
|
||||
|
||||
printf("request scan 1/3 ");
|
||||
printf("request scan 1/4 ");
|
||||
test_scan( &requests[GET_NO_HEADERS_NO_BODY]
|
||||
, &requests[GET_ONE_HEADER_NO_BODY]
|
||||
, &requests[GET_NO_HEADERS_NO_BODY]
|
||||
);
|
||||
|
||||
printf("request scan 2/3 ");
|
||||
printf("request scan 2/4 ");
|
||||
test_scan( &requests[POST_CHUNKED_ALL_YOUR_BASE]
|
||||
, &requests[POST_IDENTITY_BODY_WORLD]
|
||||
, &requests[GET_FUNKY_CONTENT_LENGTH]
|
||||
);
|
||||
|
||||
printf("request scan 3/3 ");
|
||||
printf("request scan 3/4 ");
|
||||
test_scan( &requests[TWO_CHUNKS_MULT_ZERO_END]
|
||||
, &requests[CHUNKED_W_TRAILING_HEADERS]
|
||||
, &requests[CHUNKED_W_BULLSHIT_AFTER_LENGTH]
|
||||
);
|
||||
|
||||
printf("request scan 4/4 ");
|
||||
test_scan( &requests[QUERY_URL_WITH_QUESTION_MARK_GET]
|
||||
, &requests[PREFIX_NEWLINE_GET ]
|
||||
, &requests[CONNECT_REQUEST]
|
||||
);
|
||||
|
||||
puts("requests okay");
|
||||
|
||||
return 0;
|
||||
|
||||
240
deps/libeio/0001-Make-libeio-build-on-windows.patch
vendored
Normal file
240
deps/libeio/0001-Make-libeio-build-on-windows.patch
vendored
Normal file
@@ -0,0 +1,240 @@
|
||||
From 528e56fd134a98429b7c1aeaac1fc09b3e261804 Mon Sep 17 00:00:00 2001
|
||||
From: Bert Belder <bertbelder@gmail.com>
|
||||
Date: Wed, 24 Nov 2010 02:34:32 +0100
|
||||
Subject: [PATCH] Make libeio build on windows
|
||||
|
||||
---
|
||||
eio.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++--------------
|
||||
eio.h | 5 +++
|
||||
xthread.h | 7 +++-
|
||||
3 files changed, 82 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/eio.c b/eio.c
|
||||
index f810de2..fbd3816 100644
|
||||
--- a/eio.c
|
||||
+++ b/eio.c
|
||||
@@ -42,6 +42,9 @@
|
||||
#ifdef EIO_STACKSIZE
|
||||
# define XTHREAD_STACKSIZE EIO_STACKSIZE
|
||||
#endif
|
||||
+#ifdef _WIN32
|
||||
+# define PTW32_STATIC_LIB 1
|
||||
+#endif
|
||||
#include "xthread.h"
|
||||
|
||||
#include <errno.h>
|
||||
@@ -51,11 +54,14 @@
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
-#include <sys/statvfs.h>
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <assert.h>
|
||||
|
||||
+#ifndef _WIN32
|
||||
+#include <sys/statvfs.h>
|
||||
+#endif
|
||||
+
|
||||
#ifndef EIO_FINISH
|
||||
# define EIO_FINISH(req) ((req)->finish) && !EIO_CANCELLED (req) ? (req)->finish (req) : 0
|
||||
#endif
|
||||
@@ -70,7 +76,22 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
- /*doh*/
|
||||
+# include <errno.h>
|
||||
+# include <sys/time.h>
|
||||
+# include <unistd.h>
|
||||
+# include <utime.h>
|
||||
+# include <signal.h>
|
||||
+# include <dirent.h>
|
||||
+# include <windows.h>
|
||||
+
|
||||
+# define ENOTSOCK WSAENOTSOCK
|
||||
+# define EOPNOTSUPP WSAEOPNOTSUPP
|
||||
+# define ECANCELED 140
|
||||
+
|
||||
+# ifndef EIO_STRUCT_DIRENT
|
||||
+# define EIO_STRUCT_DIRENT struct dirent
|
||||
+# endif
|
||||
+
|
||||
#else
|
||||
|
||||
# include "config.h"
|
||||
@@ -849,6 +870,10 @@ static int eio__futimes (int fd, const struct timeval tv[2])
|
||||
|
||||
#endif
|
||||
|
||||
+#ifdef _WIN32
|
||||
+# define fsync(fd) (FlushFileBuffers((HANDLE)_get_osfhandle(fd)) ? 0 : -1)
|
||||
+#endif
|
||||
+
|
||||
#if !HAVE_FDATASYNC
|
||||
# undef fdatasync
|
||||
# define fdatasync(fd) fsync (fd)
|
||||
@@ -974,14 +999,14 @@ eio__sendfile (int ofd, int ifd, off_t offset, size_t count, etp_worker *self)
|
||||
|
||||
# endif
|
||||
|
||||
-#elif defined (_WIN32)
|
||||
-
|
||||
- /* does not work, just for documentation of what would need to be done */
|
||||
- {
|
||||
- HANDLE h = TO_SOCKET (ifd);
|
||||
- SetFilePointer (h, offset, 0, FILE_BEGIN);
|
||||
- res = TransmitFile (TO_SOCKET (ofd), h, count, 0, 0, 0, 0);
|
||||
- }
|
||||
+//#elif defined (_WIN32)
|
||||
+//
|
||||
+// /* does not work, just for documentation of what would need to be done */
|
||||
+// {
|
||||
+// HANDLE h = TO_SOCKET (ifd);
|
||||
+// SetFilePointer (h, offset, 0, FILE_BEGIN);
|
||||
+// res = TransmitFile (TO_SOCKET (ofd), h, count, 0, 0, 0, 0);
|
||||
+// }
|
||||
|
||||
#else
|
||||
res = -1;
|
||||
@@ -1396,20 +1421,31 @@ eio__scandir (eio_req *req, etp_worker *self)
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
#ifdef PAGESIZE
|
||||
# define eio_pagesize() PAGESIZE
|
||||
-#else
|
||||
-static intptr_t
|
||||
-eio_pagesize (void)
|
||||
-{
|
||||
- static intptr_t page;
|
||||
|
||||
- if (!page)
|
||||
- page = sysconf (_SC_PAGESIZE);
|
||||
+#elif defined(_WIN32)
|
||||
+ /* Windows */
|
||||
+ static intptr_t
|
||||
+ eio_pagesize (void)
|
||||
+ {
|
||||
+ SYSTEM_INFO si;
|
||||
+ GetSystemInfo(&si);
|
||||
+ return si.dwPageSize;
|
||||
+ }
|
||||
+
|
||||
+#else
|
||||
+ /* POSIX */
|
||||
+ static intptr_t
|
||||
+ eio_pagesize (void)
|
||||
+ {
|
||||
+ static intptr_t page;
|
||||
|
||||
- return page;
|
||||
-}
|
||||
+ if (!page)
|
||||
+ page = sysconf (_SC_PAGESIZE);
|
||||
+
|
||||
+ return page;
|
||||
+ }
|
||||
#endif
|
||||
|
||||
static void
|
||||
@@ -1647,21 +1683,25 @@ static void eio_execute (etp_worker *self, eio_req *req)
|
||||
|
||||
case EIO_STAT: ALLOC (sizeof (EIO_STRUCT_STAT));
|
||||
req->result = stat (req->ptr1, (EIO_STRUCT_STAT *)req->ptr2); break;
|
||||
+#ifndef _WIN32
|
||||
case EIO_LSTAT: ALLOC (sizeof (EIO_STRUCT_STAT));
|
||||
req->result = lstat (req->ptr1, (EIO_STRUCT_STAT *)req->ptr2); break;
|
||||
+#endif
|
||||
case EIO_FSTAT: ALLOC (sizeof (EIO_STRUCT_STAT));
|
||||
req->result = fstat (req->int1, (EIO_STRUCT_STAT *)req->ptr2); break;
|
||||
-
|
||||
+#ifndef _WIN32
|
||||
case EIO_STATVFS: ALLOC (sizeof (EIO_STRUCT_STATVFS));
|
||||
req->result = statvfs (req->ptr1, (EIO_STRUCT_STATVFS *)req->ptr2); break;
|
||||
case EIO_FSTATVFS: ALLOC (sizeof (EIO_STRUCT_STATVFS));
|
||||
req->result = fstatvfs (req->int1, (EIO_STRUCT_STATVFS *)req->ptr2); break;
|
||||
-
|
||||
case EIO_CHOWN: req->result = chown (req->ptr1, req->int2, req->int3); break;
|
||||
case EIO_FCHOWN: req->result = fchown (req->int1, req->int2, req->int3); break;
|
||||
+#endif
|
||||
case EIO_CHMOD: req->result = chmod (req->ptr1, (mode_t)req->int2); break;
|
||||
+#ifndef _WIN32
|
||||
case EIO_FCHMOD: req->result = fchmod (req->int1, (mode_t)req->int2); break;
|
||||
case EIO_TRUNCATE: req->result = truncate (req->ptr1, req->offs); break;
|
||||
+#endif
|
||||
case EIO_FTRUNCATE: req->result = ftruncate (req->int1, req->offs); break;
|
||||
|
||||
case EIO_OPEN: req->result = open (req->ptr1, req->int1, (mode_t)req->int2); break;
|
||||
@@ -1669,16 +1709,26 @@ static void eio_execute (etp_worker *self, eio_req *req)
|
||||
case EIO_DUP2: req->result = dup2 (req->int1, req->int2); break;
|
||||
case EIO_UNLINK: req->result = unlink (req->ptr1); break;
|
||||
case EIO_RMDIR: req->result = rmdir (req->ptr1); break;
|
||||
+#ifdef _WIN32
|
||||
+ case EIO_MKDIR: req->result = mkdir (req->ptr1); break;
|
||||
+#else
|
||||
case EIO_MKDIR: req->result = mkdir (req->ptr1, (mode_t)req->int2); break;
|
||||
+#endif
|
||||
case EIO_RENAME: req->result = rename (req->ptr1, req->ptr2); break;
|
||||
+#ifndef _WIN32
|
||||
case EIO_LINK: req->result = link (req->ptr1, req->ptr2); break;
|
||||
case EIO_SYMLINK: req->result = symlink (req->ptr1, req->ptr2); break;
|
||||
case EIO_MKNOD: req->result = mknod (req->ptr1, (mode_t)req->int2, (dev_t)req->int3); break;
|
||||
+#endif
|
||||
|
||||
+#ifndef _WIN32
|
||||
case EIO_READLINK: ALLOC (PATH_MAX);
|
||||
req->result = readlink (req->ptr1, req->ptr2, PATH_MAX); break;
|
||||
+#endif
|
||||
|
||||
+#ifndef _WIN32
|
||||
case EIO_SYNC: req->result = 0; sync (); break;
|
||||
+#endif
|
||||
case EIO_FSYNC: req->result = fsync (req->int1); break;
|
||||
case EIO_FDATASYNC: req->result = fdatasync (req->int1); break;
|
||||
case EIO_MSYNC: req->result = eio__msync (req->ptr2, req->size, req->int1); break;
|
||||
diff --git a/eio.h b/eio.h
|
||||
index bcbb579..7c6124f 100644
|
||||
--- a/eio.h
|
||||
+++ b/eio.h
|
||||
@@ -47,6 +47,11 @@ extern "C" {
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
+#ifdef _WIN32
|
||||
+# define uid_t int
|
||||
+# define gid_t int
|
||||
+#endif
|
||||
+
|
||||
typedef struct eio_req eio_req;
|
||||
typedef struct eio_dirent eio_dirent;
|
||||
|
||||
diff --git a/xthread.h b/xthread.h
|
||||
index 8400fdd..31d97f1 100644
|
||||
--- a/xthread.h
|
||||
+++ b/xthread.h
|
||||
@@ -16,7 +16,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef _WIN32
|
||||
-typedef int ssize_t;
|
||||
+
|
||||
+#ifndef __MINGW32__
|
||||
+typedef int ssize_t
|
||||
+#endif
|
||||
|
||||
#define NTDDI_VERSION NTDDI_WIN2K // needed to get win2000 api calls
|
||||
#define _WIN32_WINNT 0x400
|
||||
@@ -27,7 +30,7 @@ typedef int ssize_t;
|
||||
#include <winsock2.h>
|
||||
#include <process.h>
|
||||
#include <windows.h>
|
||||
-#include <pthread.h>
|
||||
+#include "pthread.h"
|
||||
#define sigset_t int
|
||||
#define pthread_sigmask(a,b,c)
|
||||
#define sigaddset(a,b)
|
||||
--
|
||||
1.7.3.1.msysgit.0
|
||||
|
||||
26
deps/libeio/CMakeLists.txt
vendored
Normal file
26
deps/libeio/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
include(CheckFunctionExists)
|
||||
include(FindThreads)
|
||||
|
||||
if(!${CMAKE_USE_PTHREADS_INIT})
|
||||
message(FATAL_ERROR "Unable to find pthreads")
|
||||
endif()
|
||||
|
||||
add_definitions(-DHAVE_CONFIG_H=1 -D_GNU_SOURCE)
|
||||
|
||||
check_function_exists(futimes HAVE_FUTIMES)
|
||||
check_function_exists(readahead HAVE_READAHEAD)
|
||||
check_function_exists(fdatasync HAVE_FDATASYNC)
|
||||
check_function_exists(pread HAVE_PREAD)
|
||||
check_function_exists(pwrite HAVE_PWRITE)
|
||||
check_function_exists(sendfile HAVE_SENDFILE)
|
||||
check_function_exists(sync_file_range HAVE_SYNC_FILE_RANGE)
|
||||
|
||||
if(${HAVE_PREAD} AND ${HAVE_PWRITE})
|
||||
set(HAVE_PREADWRITE 1)
|
||||
endif()
|
||||
|
||||
configure_file(config.h.cmake ${PROJECT_BINARY_DIR}/deps/libeio/config.h)
|
||||
include_directories(${PROJECT_BINARY_DIR}/deps/libeio)
|
||||
|
||||
add_library(eio eio.c)
|
||||
target_link_libraries(eio ${CMAKE_THREAD_LIBS_INIT})
|
||||
2
deps/libeio/Changes
vendored
2
deps/libeio/Changes
vendored
@@ -1,6 +1,7 @@
|
||||
Revision history for libeio
|
||||
|
||||
TODO: maybe add mincore support? available on at least darwin, solaris, linux, freebsd
|
||||
TODO: openbsd requites stdint.h for intptr_t - why posix?
|
||||
|
||||
1.0
|
||||
- readdir: correctly handle malloc failures.
|
||||
@@ -23,4 +24,5 @@ TODO: maybe add mincore support? available on at least darwin, solaris, linux, f
|
||||
error codes.
|
||||
- add OS-independent EIO_MT_* and EIO_MS_* flag enums.
|
||||
- add eio_statvfs/eio_fstatvfs.
|
||||
- add eio_mlock/eio_mlockall and OS-independent MCL_* flag enums.
|
||||
|
||||
|
||||
17
deps/libeio/config.h.cmake
vendored
Normal file
17
deps/libeio/config.h.cmake
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/* futimes(2) is available */
|
||||
#cmakedefine HAVE_FUTIMES 1
|
||||
|
||||
/* readahead(2) is available (linux) */
|
||||
#cmakedefine HAVE_READAHEAD 1
|
||||
|
||||
/* fdatasync(2) is available */
|
||||
#cmakedefine HAVE_FDATASYNC 1
|
||||
|
||||
/* pread(2) and pwrite(2) are available */
|
||||
#cmakedefine HAVE_PREADWRITE 1
|
||||
|
||||
/* sendfile(2) is available and supported */
|
||||
#cmakedefine HAVE_SENDFILE 1
|
||||
|
||||
/* sync_file_range(2) is available */
|
||||
#cmakedefine HAVE_SYNC_FILE_RANGE 1
|
||||
21
deps/libeio/config.h.in
vendored
21
deps/libeio/config.h.in
vendored
@@ -48,26 +48,5 @@
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
211
deps/libeio/eio.c
vendored
211
deps/libeio/eio.c
vendored
@@ -42,6 +42,9 @@
|
||||
#ifdef EIO_STACKSIZE
|
||||
# define XTHREAD_STACKSIZE EIO_STACKSIZE
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
# define PTW32_STATIC_LIB 1
|
||||
#endif
|
||||
#include "xthread.h"
|
||||
|
||||
#include <errno.h>
|
||||
@@ -51,11 +54,13 @@
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/statvfs.h>
|
||||
#endif
|
||||
|
||||
#ifndef EIO_FINISH
|
||||
# define EIO_FINISH(req) ((req)->finish) && !EIO_CANCELLED (req) ? (req)->finish (req) : 0
|
||||
@@ -71,18 +76,36 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
/*doh*/
|
||||
# include <errno.h>
|
||||
# include <sys/time.h>
|
||||
# include <unistd.h>
|
||||
# include <utime.h>
|
||||
# include <signal.h>
|
||||
# include <dirent.h>
|
||||
# include <windows.h>
|
||||
|
||||
# define ENOTSOCK WSAENOTSOCK
|
||||
# define EOPNOTSUPP WSAEOPNOTSUPP
|
||||
# define ECANCELED 140
|
||||
|
||||
# ifndef EIO_STRUCT_DIRENT
|
||||
# define EIO_STRUCT_DIRENT struct dirent
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
# include "config.h"
|
||||
# include <sys/time.h>
|
||||
# include <sys/select.h>
|
||||
# include <sys/mman.h>
|
||||
# include <unistd.h>
|
||||
# include <utime.h>
|
||||
# include <signal.h>
|
||||
# include <dirent.h>
|
||||
|
||||
#if _POSIX_MEMLOCK || _POSIX_MAPPED_FILES
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
/* POSIX_SOURCE is useless on bsd's, and XOPEN_SOURCE is unreliable there, too */
|
||||
# if __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__
|
||||
# define _DIRENT_HAVE_D_TYPE /* sigh */
|
||||
@@ -230,6 +253,10 @@ static xmutex_t reslock = X_MUTEX_INIT;
|
||||
static xmutex_t reqlock = X_MUTEX_INIT;
|
||||
static xcond_t reqwait = X_COND_INIT;
|
||||
|
||||
#if defined (__APPLE__)
|
||||
static xmutex_t apple_bug_writelock = X_MUTEX_INIT;
|
||||
#endif
|
||||
|
||||
#if !HAVE_PREADWRITE
|
||||
/*
|
||||
* make our pread/pwrite emulation safe against themselves, but not against
|
||||
@@ -783,7 +810,7 @@ int eio_poll (void)
|
||||
# define pread eio__pread
|
||||
# define pwrite eio__pwrite
|
||||
|
||||
static ssize_t
|
||||
ssize_t
|
||||
eio__pread (int fd, void *buf, size_t count, off_t offset)
|
||||
{
|
||||
ssize_t res;
|
||||
@@ -799,7 +826,7 @@ eio__pread (int fd, void *buf, size_t count, off_t offset)
|
||||
return res;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
ssize_t
|
||||
eio__pwrite (int fd, void *buf, size_t count, off_t offset)
|
||||
{
|
||||
ssize_t res;
|
||||
@@ -847,6 +874,10 @@ static int eio__futimes (int fd, const struct timeval tv[2])
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# define fsync(fd) (FlushFileBuffers((HANDLE)_get_osfhandle(fd)) ? 0 : -1)
|
||||
#endif
|
||||
|
||||
#if !HAVE_FDATASYNC
|
||||
# undef fdatasync
|
||||
# define fdatasync(fd) fsync (fd)
|
||||
@@ -972,14 +1003,14 @@ eio__sendfile (int ofd, int ifd, off_t offset, size_t count, etp_worker *self)
|
||||
|
||||
# endif
|
||||
|
||||
#elif defined (_WIN32)
|
||||
|
||||
/* does not work, just for documentation of what would need to be done */
|
||||
{
|
||||
HANDLE h = TO_SOCKET (ifd);
|
||||
SetFilePointer (h, offset, 0, FILE_BEGIN);
|
||||
res = TransmitFile (TO_SOCKET (ofd), h, count, 0, 0, 0, 0);
|
||||
}
|
||||
//#elif defined (_WIN32)
|
||||
//
|
||||
// /* does not work, just for documentation of what would need to be done */
|
||||
// {
|
||||
// HANDLE h = TO_SOCKET (ifd);
|
||||
// SetFilePointer (h, offset, 0, FILE_BEGIN);
|
||||
// res = TransmitFile (TO_SOCKET (ofd), h, count, 0, 0, 0, 0);
|
||||
// }
|
||||
|
||||
#else
|
||||
res = -1;
|
||||
@@ -1394,6 +1425,80 @@ eio__scandir (eio_req *req, etp_worker *self)
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef PAGESIZE
|
||||
# define eio_pagesize() PAGESIZE
|
||||
|
||||
#elif defined(_WIN32)
|
||||
/* Windows */
|
||||
static intptr_t
|
||||
eio_pagesize (void)
|
||||
{
|
||||
SYSTEM_INFO si;
|
||||
GetSystemInfo(&si);
|
||||
return si.dwPageSize;
|
||||
}
|
||||
|
||||
#else
|
||||
/* POSIX */
|
||||
static intptr_t
|
||||
eio_pagesize (void)
|
||||
{
|
||||
static intptr_t page;
|
||||
|
||||
if (!page)
|
||||
page = sysconf (_SC_PAGESIZE);
|
||||
|
||||
return page;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
eio_page_align (void **addr, size_t *length)
|
||||
{
|
||||
intptr_t mask = eio_pagesize () - 1;
|
||||
|
||||
/* round down addr */
|
||||
intptr_t adj = mask & (intptr_t)*addr;
|
||||
|
||||
*addr = (void *)((intptr_t)*addr - adj);
|
||||
*length += adj;
|
||||
|
||||
/* round up length */
|
||||
*length = (*length + mask) & ~mask;
|
||||
}
|
||||
|
||||
#if !_POSIX_MEMLOCK
|
||||
# define eio__mlock(a,b) ((errno = ENOSYS), -1)
|
||||
# define eio__mlockall(a) ((errno = ENOSYS), -1)
|
||||
#else
|
||||
|
||||
static int
|
||||
eio__mlock (void *addr, size_t length)
|
||||
{
|
||||
eio_page_align (&addr, &length);
|
||||
|
||||
return mlock (addr, length);
|
||||
}
|
||||
|
||||
static int
|
||||
eio__mlockall (int flags)
|
||||
{
|
||||
#if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 7
|
||||
extern int mallopt (int, int);
|
||||
mallopt (-6, 238); /* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=473812 */
|
||||
#endif
|
||||
|
||||
if (EIO_MCL_CURRENT != MCL_CURRENT
|
||||
|| EIO_MCL_FUTURE != MCL_FUTURE)
|
||||
{
|
||||
flags = 0
|
||||
| (flags & EIO_MCL_CURRENT ? MCL_CURRENT : 0)
|
||||
| (flags & EIO_MCL_FUTURE ? MCL_FUTURE : 0);
|
||||
}
|
||||
|
||||
return mlockall (flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(_POSIX_MAPPED_FILES && _POSIX_SYNCHRONIZED_IO)
|
||||
# define eio__msync(a,b,c) ((errno = ENOSYS), -1)
|
||||
@@ -1402,6 +1507,8 @@ eio__scandir (eio_req *req, etp_worker *self)
|
||||
int
|
||||
eio__msync (void *mem, size_t len, int flags)
|
||||
{
|
||||
eio_page_align (&mem, &len);
|
||||
|
||||
if (EIO_MS_ASYNC != MS_SYNC
|
||||
|| EIO_MS_INVALIDATE != MS_INVALIDATE
|
||||
|| EIO_MS_SYNC != MS_SYNC)
|
||||
@@ -1420,25 +1527,19 @@ eio__msync (void *mem, size_t len, int flags)
|
||||
int
|
||||
eio__mtouch (void *mem, size_t len, int flags)
|
||||
{
|
||||
intptr_t addr = (intptr_t)mem;
|
||||
intptr_t end = addr + len;
|
||||
#ifdef PAGESIZE
|
||||
const intptr_t page = PAGESIZE;
|
||||
#else
|
||||
static intptr_t page;
|
||||
eio_page_align (&mem, &len);
|
||||
|
||||
if (!page)
|
||||
page = sysconf (_SC_PAGESIZE);
|
||||
#endif
|
||||
{
|
||||
intptr_t addr = (intptr_t)mem;
|
||||
intptr_t end = addr + len;
|
||||
intptr_t page = eio_pagesize ();
|
||||
|
||||
/* round down to start of page, although this is probably useless */
|
||||
addr &= ~(page - 1); /* assume page size is always a power of two */
|
||||
|
||||
if (addr < end)
|
||||
if (flags & EIO_MT_MODIFY) /* modify */
|
||||
do { *((volatile sig_atomic_t *)addr) |= 0; } while ((addr += page) < len);
|
||||
else
|
||||
do { *((volatile sig_atomic_t *)addr) ; } while ((addr += page) < len);
|
||||
if (addr < end)
|
||||
if (flags & EIO_MT_MODIFY) /* modify */
|
||||
do { *((volatile sig_atomic_t *)addr) |= 0; } while ((addr += page) < len);
|
||||
else
|
||||
do { *((volatile sig_atomic_t *)addr) ; } while ((addr += page) < len);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1579,30 +1680,44 @@ static void eio_execute (etp_worker *self, eio_req *req)
|
||||
req->result = req->offs >= 0
|
||||
? pread (req->int1, req->ptr2, req->size, req->offs)
|
||||
: read (req->int1, req->ptr2, req->size); break;
|
||||
case EIO_WRITE: req->result = req->offs >= 0
|
||||
case EIO_WRITE:
|
||||
#if defined (__APPLE__)
|
||||
pthread_mutex_lock (&apple_bug_writelock);
|
||||
#endif
|
||||
|
||||
req->result = req->offs >= 0
|
||||
? pwrite (req->int1, req->ptr2, req->size, req->offs)
|
||||
: write (req->int1, req->ptr2, req->size); break;
|
||||
: write (req->int1, req->ptr2, req->size);
|
||||
|
||||
#if defined (__APPLE__)
|
||||
pthread_mutex_unlock (&apple_bug_writelock);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case EIO_READAHEAD: req->result = readahead (req->int1, req->offs, req->size); break;
|
||||
case EIO_SENDFILE: req->result = eio__sendfile (req->int1, req->int2, req->offs, req->size, self); break;
|
||||
|
||||
case EIO_STAT: ALLOC (sizeof (EIO_STRUCT_STAT));
|
||||
req->result = stat (req->ptr1, (EIO_STRUCT_STAT *)req->ptr2); break;
|
||||
#ifndef _WIN32
|
||||
case EIO_LSTAT: ALLOC (sizeof (EIO_STRUCT_STAT));
|
||||
req->result = lstat (req->ptr1, (EIO_STRUCT_STAT *)req->ptr2); break;
|
||||
#endif
|
||||
case EIO_FSTAT: ALLOC (sizeof (EIO_STRUCT_STAT));
|
||||
req->result = fstat (req->int1, (EIO_STRUCT_STAT *)req->ptr2); break;
|
||||
|
||||
#ifndef _WIN32
|
||||
case EIO_STATVFS: ALLOC (sizeof (EIO_STRUCT_STATVFS));
|
||||
req->result = statvfs (req->ptr1, (EIO_STRUCT_STATVFS *)req->ptr2); break;
|
||||
case EIO_FSTATVFS: ALLOC (sizeof (EIO_STRUCT_STATVFS));
|
||||
req->result = fstatvfs (req->int1, (EIO_STRUCT_STATVFS *)req->ptr2); break;
|
||||
|
||||
case EIO_CHOWN: req->result = chown (req->ptr1, req->int2, req->int3); break;
|
||||
case EIO_FCHOWN: req->result = fchown (req->int1, req->int2, req->int3); break;
|
||||
#endif
|
||||
case EIO_CHMOD: req->result = chmod (req->ptr1, (mode_t)req->int2); break;
|
||||
#ifndef _WIN32
|
||||
case EIO_FCHMOD: req->result = fchmod (req->int1, (mode_t)req->int2); break;
|
||||
case EIO_TRUNCATE: req->result = truncate (req->ptr1, req->offs); break;
|
||||
#endif
|
||||
case EIO_FTRUNCATE: req->result = ftruncate (req->int1, req->offs); break;
|
||||
|
||||
case EIO_OPEN: req->result = open (req->ptr1, req->int1, (mode_t)req->int2); break;
|
||||
@@ -1610,33 +1725,45 @@ static void eio_execute (etp_worker *self, eio_req *req)
|
||||
case EIO_DUP2: req->result = dup2 (req->int1, req->int2); break;
|
||||
case EIO_UNLINK: req->result = unlink (req->ptr1); break;
|
||||
case EIO_RMDIR: req->result = rmdir (req->ptr1); break;
|
||||
#ifdef _WIN32
|
||||
case EIO_MKDIR: req->result = mkdir (req->ptr1); break;
|
||||
#else
|
||||
case EIO_MKDIR: req->result = mkdir (req->ptr1, (mode_t)req->int2); break;
|
||||
#endif
|
||||
case EIO_RENAME: req->result = rename (req->ptr1, req->ptr2); break;
|
||||
#ifndef _WIN32
|
||||
case EIO_LINK: req->result = link (req->ptr1, req->ptr2); break;
|
||||
case EIO_SYMLINK: req->result = symlink (req->ptr1, req->ptr2); break;
|
||||
case EIO_MKNOD: req->result = mknod (req->ptr1, (mode_t)req->int2, (dev_t)req->int3); break;
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
case EIO_READLINK: ALLOC (PATH_MAX);
|
||||
req->result = readlink (req->ptr1, req->ptr2, PATH_MAX); break;
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
case EIO_SYNC: req->result = 0; sync (); break;
|
||||
#endif
|
||||
case EIO_FSYNC: req->result = fsync (req->int1); break;
|
||||
case EIO_FDATASYNC: req->result = fdatasync (req->int1); break;
|
||||
case EIO_MSYNC: req->result = eio__msync (req->ptr2, req->size, req->int1); break;
|
||||
case EIO_MTOUCH: req->result = eio__mtouch (req->ptr2, req->size, req->int1); break;
|
||||
case EIO_MLOCK: req->result = eio__mlock (req->ptr2, req->size); break;
|
||||
case EIO_MLOCKALL: req->result = eio__mlockall (req->int1); break;
|
||||
case EIO_SYNC_FILE_RANGE: req->result = eio__sync_file_range (req->int1, req->offs, req->size, req->int2); break;
|
||||
|
||||
case EIO_READDIR: eio__scandir (req, self); break;
|
||||
|
||||
case EIO_BUSY:
|
||||
#ifdef _WIN32
|
||||
Sleep (req->nv1 * 1000.);
|
||||
Sleep (req->nv1 * 1e3);
|
||||
#else
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
tv.tv_sec = req->nv1;
|
||||
tv.tv_usec = (req->nv1 - tv.tv_sec) * 1000000.;
|
||||
tv.tv_usec = (req->nv1 - tv.tv_sec) * 1e6;
|
||||
|
||||
req->result = select (0, 0, 0, 0, &tv);
|
||||
}
|
||||
@@ -1719,6 +1846,16 @@ eio_req *eio_mtouch (void *addr, size_t length, int flags, int pri, eio_cb cb, v
|
||||
REQ (EIO_MTOUCH); req->ptr2 = addr; req->size = length; req->int1 = flags; SEND;
|
||||
}
|
||||
|
||||
eio_req *eio_mlock (void *addr, size_t length, int pri, eio_cb cb, void *data)
|
||||
{
|
||||
REQ (EIO_MLOCK); req->ptr2 = addr; req->size = length; SEND;
|
||||
}
|
||||
|
||||
eio_req *eio_mlockall (int flags, int pri, eio_cb cb, void *data)
|
||||
{
|
||||
REQ (EIO_MLOCKALL); req->int1 = flags; SEND;
|
||||
}
|
||||
|
||||
eio_req *eio_sync_file_range (int fd, off_t offset, size_t nbytes, unsigned int flags, int pri, eio_cb cb, void *data)
|
||||
{
|
||||
REQ (EIO_SYNC_FILE_RANGE); req->int1 = fd; req->offs = offset; req->size = nbytes; req->int2 = flags; SEND;
|
||||
|
||||
69
deps/libeio/eio.h
vendored
69
deps/libeio/eio.h
vendored
@@ -47,6 +47,15 @@ extern "C" {
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# define uid_t int
|
||||
# define gid_t int
|
||||
#endif
|
||||
|
||||
typedef struct eio_req eio_req;
|
||||
typedef struct eio_dirent eio_dirent;
|
||||
|
||||
@@ -67,7 +76,8 @@ typedef int (*eio_cb)(eio_req *req);
|
||||
/* for readdir */
|
||||
|
||||
/* eio_readdir flags */
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
EIO_READDIR_DENTS = 0x01, /* ptr2 contains eio_dirents, not just the (unsorted) names */
|
||||
EIO_READDIR_DIRS_FIRST = 0x02, /* dirents gets sorted into a good stat() ing order to find directories first */
|
||||
EIO_READDIR_STAT_ORDER = 0x04, /* dirents gets sorted into a good stat() ing order to quickly stat all files */
|
||||
@@ -78,7 +88,8 @@ enum {
|
||||
};
|
||||
|
||||
/* using "typical" values in the hope that the compiler will do something sensible */
|
||||
enum eio_dtype {
|
||||
enum eio_dtype
|
||||
{
|
||||
EIO_DT_UNKNOWN = 0,
|
||||
EIO_DT_FIFO = 1,
|
||||
EIO_DT_CHR = 2,
|
||||
@@ -98,7 +109,8 @@ enum eio_dtype {
|
||||
EIO_DT_MAX = 15 /* highest DT_VALUE ever, hopefully */
|
||||
};
|
||||
|
||||
struct eio_dirent {
|
||||
struct eio_dirent
|
||||
{
|
||||
int nameofs; /* offset of null-terminated name string in (char *)req->ptr2 */
|
||||
unsigned short namelen; /* size of filename without trailing 0 */
|
||||
unsigned char type; /* one of EIO_DT_* */
|
||||
@@ -107,7 +119,8 @@ struct eio_dirent {
|
||||
};
|
||||
|
||||
/* eio_msync flags */
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
EIO_MS_ASYNC = 1,
|
||||
EIO_MS_INVALIDATE = 2,
|
||||
EIO_MS_SYNC = 4
|
||||
@@ -115,13 +128,15 @@ enum {
|
||||
|
||||
/* eio_mtouch flags */
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
EIO_MT_MODIFY = 1
|
||||
};
|
||||
|
||||
/* eio_sync_file_range flags */
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
EIO_SYNC_FILE_RANGE_WAIT_BEFORE = 1,
|
||||
EIO_SYNC_FILE_RANGE_WRITE = 2,
|
||||
EIO_SYNC_FILE_RANGE_WAIT_AFTER = 4
|
||||
@@ -131,7 +146,8 @@ typedef double eio_tstamp; /* feel free to use double in your code directly */
|
||||
|
||||
/* the eio request structure */
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
EIO_CUSTOM,
|
||||
EIO_OPEN, EIO_CLOSE, EIO_DUP2,
|
||||
EIO_READ, EIO_WRITE,
|
||||
@@ -144,6 +160,7 @@ enum {
|
||||
EIO_CHOWN, EIO_FCHOWN,
|
||||
EIO_SYNC, EIO_FSYNC, EIO_FDATASYNC,
|
||||
EIO_MSYNC, EIO_MTOUCH, EIO_SYNC_FILE_RANGE,
|
||||
EIO_MLOCK, EIO_MLOCKALL,
|
||||
EIO_UNLINK, EIO_RMDIR, EIO_MKDIR, EIO_RENAME,
|
||||
EIO_MKNOD, EIO_READDIR,
|
||||
EIO_LINK, EIO_SYMLINK, EIO_READLINK,
|
||||
@@ -151,6 +168,21 @@ enum {
|
||||
EIO_BUSY
|
||||
};
|
||||
|
||||
/* mlockall constants */
|
||||
enum
|
||||
{
|
||||
EIO_MCL_CURRENT = 1,
|
||||
EIO_MCL_FUTURE = 2,
|
||||
};
|
||||
|
||||
/* request priorities */
|
||||
|
||||
enum {
|
||||
EIO_PRI_MIN = -4,
|
||||
EIO_PRI_MAX = 4,
|
||||
EIO_PRI_DEFAULT = 0
|
||||
};
|
||||
|
||||
/* eio request structure */
|
||||
/* this structure is mostly read-only */
|
||||
/* when initialising it, all members must be zero-initialised */
|
||||
@@ -160,14 +192,14 @@ struct eio_req
|
||||
|
||||
ssize_t result; /* result of syscall, e.g. result = read (... */
|
||||
off_t offs; /* read, write, truncate, readahead, sync_file_range: file offset */
|
||||
size_t size; /* read, write, readahead, sendfile, msync, sync_file_range: length */
|
||||
size_t size; /* read, write, readahead, sendfile, msync, mlock, sync_file_range: length */
|
||||
void *ptr1; /* all applicable requests: pathname, old name; readdir: optional eio_dirents */
|
||||
void *ptr2; /* all applicable requests: new name or memory buffer; readdir: name strings */
|
||||
eio_tstamp nv1; /* utime, futime: atime; busy: sleep time */
|
||||
eio_tstamp nv2; /* utime, futime: mtime */
|
||||
|
||||
int type; /* EIO_xxx constant ETP */
|
||||
int int1; /* all applicable requests: file descriptor; sendfile: output fd; open, msync, readdir: flags */
|
||||
int int1; /* all applicable requests: file descriptor; sendfile: output fd; open, msync, mlockall, readdir: flags */
|
||||
long int2; /* chown, fchown: uid; sendfile: input fd; open, chmod, mkdir, mknod: file mode, sync_file_range: flags */
|
||||
long int3; /* chown, fchown: gid; mknod: dev_t */
|
||||
int errorno; /* errno value on syscall return */
|
||||
@@ -185,7 +217,7 @@ struct eio_req
|
||||
eio_req *grp, *grp_prev, *grp_next, *grp_first; /* private */
|
||||
};
|
||||
|
||||
/* _private_ flags */
|
||||
/* _private_ request flags */
|
||||
enum {
|
||||
EIO_FLAG_CANCELLED = 0x01, /* request was cancelled */
|
||||
EIO_FLAG_PTR1_FREE = 0x02, /* need to free(ptr1) */
|
||||
@@ -193,11 +225,8 @@ enum {
|
||||
EIO_FLAG_GROUPADD = 0x08 /* some request was added to the group */
|
||||
};
|
||||
|
||||
enum {
|
||||
EIO_PRI_MIN = -4,
|
||||
EIO_PRI_MAX = 4,
|
||||
EIO_PRI_DEFAULT = 0,
|
||||
};
|
||||
/* undocumented/unsupported/private helper */
|
||||
/*void eio_page_align (void **addr, size_t *length);*/
|
||||
|
||||
/* returns < 0 on error, errno set
|
||||
* need_poll, if non-zero, will be called when results are available
|
||||
@@ -238,6 +267,8 @@ eio_req *eio_fsync (int fd, int pri, eio_cb cb, void *data);
|
||||
eio_req *eio_fdatasync (int fd, int pri, eio_cb cb, void *data);
|
||||
eio_req *eio_msync (void *addr, size_t length, int flags, int pri, eio_cb cb, void *data);
|
||||
eio_req *eio_mtouch (void *addr, size_t length, int flags, int pri, eio_cb cb, void *data);
|
||||
eio_req *eio_mlock (void *addr, size_t length, int pri, eio_cb cb, void *data);
|
||||
eio_req *eio_mlockall (int flags, int pri, eio_cb cb, void *data);
|
||||
eio_req *eio_sync_file_range (int fd, off_t offset, size_t nbytes, unsigned int flags, int pri, eio_cb cb, void *data);
|
||||
eio_req *eio_close (int fd, int pri, eio_cb cb, void *data);
|
||||
eio_req *eio_readahead (int fd, off_t offset, size_t length, int pri, eio_cb cb, void *data);
|
||||
@@ -305,6 +336,14 @@ void eio_destroy (eio_req *req);
|
||||
|
||||
ssize_t eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* export these so node_file can use these function instead of pread/write */
|
||||
|
||||
#if !HAVE_PREADWRITE
|
||||
ssize_t eio__pread (int fd, void *buf, size_t count, off_t offset);
|
||||
ssize_t eio__pwrite (int fd, void *buf, size_t count, off_t offset);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
8
deps/libeio/wscript
vendored
8
deps/libeio/wscript
vendored
@@ -11,10 +11,12 @@ def configure(conf):
|
||||
|
||||
conf.check(lib='pthread', uselib_store='PTHREAD')
|
||||
conf.check_cc(lib="pthread", header_name="pthread.h", function_name="pthread_create", mandatory=True)
|
||||
if not sys.platform.startswith("cygwin"):
|
||||
conf.check_cc(lib="pthread", header_name="pthread.h", function_name="pthread_atfork", mandatory=True)
|
||||
else:
|
||||
if sys.platform.startswith("cygwin"):
|
||||
conf.check_cc(lib="pthread", header_name="unistd.h", function_name="pthread_atfork", mandatory=True)
|
||||
elif sys.platform.startswith("win32"):
|
||||
conf.check_cc(lib="pthread", header_name="pthread.h", function_name="pthread_atfork")
|
||||
else:
|
||||
conf.check_cc(lib="pthread", header_name="pthread.h", function_name="pthread_atfork", mandatory=True)
|
||||
|
||||
conf.check_cc(msg="Checking for futimes(2)", define_name="HAVE_FUTIMES", fragment="""
|
||||
#include <sys/types.h>
|
||||
|
||||
7
deps/libeio/xthread.h
vendored
7
deps/libeio/xthread.h
vendored
@@ -16,7 +16,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef int ssize_t;
|
||||
|
||||
#ifndef __MINGW32__
|
||||
typedef int ssize_t
|
||||
#endif
|
||||
|
||||
#define NTDDI_VERSION NTDDI_WIN2K // needed to get win2000 api calls
|
||||
#define _WIN32_WINNT 0x400
|
||||
@@ -27,7 +30,7 @@ typedef int ssize_t;
|
||||
#include <winsock2.h>
|
||||
#include <process.h>
|
||||
#include <windows.h>
|
||||
#include <pthread.h>
|
||||
#include "pthread.h"
|
||||
#define sigset_t int
|
||||
#define sigfillset(a)
|
||||
#define pthread_sigmask(a,b,c)
|
||||
|
||||
37
deps/libev/CMakeLists.txt
vendored
Normal file
37
deps/libev/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckLibraryExists)
|
||||
|
||||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
include_directories(${PROJECT_BINARY_DIR}/deps/libev)
|
||||
add_definitions(-DHAVE_CONFIG_H=1 -DEV_MULTIPLICITY=0)
|
||||
|
||||
check_include_files(sys/inotify.h HAVE_SYS_INOTIFY_H)
|
||||
check_include_files(sys/epoll.h HAVE_SYS_EPOLL_H)
|
||||
check_include_files(sys/event.h HAVE_SYS_EVENT_H)
|
||||
check_include_files(sys/queue.h HAVE_SYS_QUEUE_H)
|
||||
check_include_files(port.h HAVE_PORT_H)
|
||||
check_include_files(poll.h HAVE_POLL_H)
|
||||
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
|
||||
check_include_files(sys/eventfd.h HAVE_SYS_EVENTFD_H)
|
||||
|
||||
check_function_exists(inotify_init HAVE_INOTIFY_INIT)
|
||||
check_function_exists(epoll_ctl HAVE_EPOLL_CTL)
|
||||
check_function_exists(kqueue HAVE_KQUEUE)
|
||||
check_function_exists(port_create HAVE_PORT_CREATE)
|
||||
check_function_exists(poll HAVE_POLL)
|
||||
check_function_exists(select HAVE_SELECT)
|
||||
check_function_exists(eventfd HAVE_EVENTFD)
|
||||
check_function_exists(nanosleep HAVE_NANOSLEEP)
|
||||
|
||||
# check first without rt
|
||||
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
|
||||
|
||||
check_library_exists(rt clock_gettime "" HAVE_LIBRT)
|
||||
# then check with rt
|
||||
check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
|
||||
|
||||
check_library_exists(m ceil "" HAVE_LIBM)
|
||||
|
||||
configure_file(config.h.cmake ${PROJECT_BINARY_DIR}/deps/libev/config.h)
|
||||
add_library (ev ev.c)
|
||||
46
deps/libev/Changes
vendored
46
deps/libev/Changes
vendored
@@ -1,5 +1,51 @@
|
||||
Revision history for libev, a high-performance and full-featured event loop.
|
||||
|
||||
TODO: include ev_xyz_start in each example?
|
||||
TODO: section watcher states/lifetime
|
||||
TODO: use enums //TODO: enum?
|
||||
- "PORTING FROM LIBEV 3.X TO 4.X" (in ev.pod) is recommended reading.
|
||||
- ev_embed_stop did not correctly stop the watcher (very good
|
||||
testcase by Vladimir Timofeev).
|
||||
- ev_run will now always update the current loop time - it errornously
|
||||
didn't when idle watchers were active, causing timers not to fire.
|
||||
- fix a bug where a timeout of zero caused the timer not to fire
|
||||
in the libevent emulation (testcase by Péter Szabó).
|
||||
- applied win32 fixes by Michael Lenaghan (also James Mansion).
|
||||
- replace EV_MINIMAL by EV_FEATURES.
|
||||
- prefer EPOLL_CTL_ADD over EPOLL_CTL_MOD in some more cases, as it
|
||||
seems the former is *much* faster than the latter.
|
||||
- reduce the number of spurious wake-ups with the ports backend.
|
||||
- remove dependency on sys/queue.h on freebsd (patch by Vanilla Hsu).
|
||||
- do async init within ev_async_start, not ev_async_set, which avoids
|
||||
an API quirk where the set function must be called in the C++ API
|
||||
even when there is nothing to set.
|
||||
- add (undocumented) EV_ENABLE when adding events with kqueue,
|
||||
this might help with OS X, which seems to need it despite documenting
|
||||
not to need it (helpfully pointed out by Tilghman Lesher).
|
||||
- do not use poll by default on freebsd, it's broken (what isn't
|
||||
on freebsd...).
|
||||
- configure now prepends -O3, not appends it, so one can still
|
||||
override it.
|
||||
- greatly expanded the portability section.
|
||||
- disable poll backend on AIX, the poll header spams the namespace
|
||||
and it's not worth working around dead platforms (reported
|
||||
and analyzed by Aivars Kalvans).
|
||||
- improve header file compatibility of the standalone eventfd code
|
||||
in an obscure case.
|
||||
- implement EV_AVOID_STDIO option.
|
||||
- do not use sscanf to parse linux version number (smaller, faster,
|
||||
no sscanf dependency).
|
||||
- new EV_CHILD_ENABLE and EV_SIGNAL_ENABLE configurable settings.
|
||||
- update libev.m4 HAVE_CLOCK_SYSCALL test for newer glibcs.
|
||||
- add section on accept() problems to the manpage.
|
||||
- rename EV_TIMEOUT to EV_TIMER.
|
||||
- rename ev_loop_count/depth/verify.
|
||||
- switch to two-digit minor version.
|
||||
- work around an apparent gentoo compiler bug.
|
||||
- define _DARWIN_UNLIMITED_SELECT. just so.
|
||||
- use enum instead of #define for most constants.
|
||||
- improve compatibility to older C++ compilers.
|
||||
|
||||
3.9 Thu Dec 31 07:59:59 CET 2009
|
||||
- signalfd is no longer used by default and has to be requested
|
||||
explicitly - this means that easy to catch bugs become hard to
|
||||
|
||||
2
deps/libev/Makefile.am
vendored
2
deps/libev/Makefile.am
vendored
@@ -1,6 +1,6 @@
|
||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||
|
||||
VERSION_INFO = 3:0
|
||||
VERSION_INFO = 4:0
|
||||
|
||||
EXTRA_DIST = LICENSE Changes libev.m4 autogen.sh \
|
||||
ev_vars.h ev_wrap.h \
|
||||
|
||||
65
deps/libev/config.h.cmake
vendored
Normal file
65
deps/libev/config.h.cmake
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
/* Define to 1 if you have the `clock_gettime' function. */
|
||||
#cmakedefine HAVE_CLOCK_GETTIME 1
|
||||
|
||||
/* "use syscall interface for clock_gettime" */
|
||||
#cmakedefine HAVE_CLOCK_SYSCALL 1
|
||||
|
||||
/* Define to 1 if you have the `epoll_ctl' function. */
|
||||
#cmakedefine HAVE_EPOLL_CTL 1
|
||||
|
||||
/* Define to 1 if you have the `eventfd' function. */
|
||||
#cmakedefine HAVE_EVENTFD 1
|
||||
|
||||
/* Define to 1 if you have the `inotify_init' function. */
|
||||
#cmakedefine HAVE_INOTIFY_INIT 1
|
||||
|
||||
/* Define to 1 if you have the `kqueue' function. */
|
||||
#cmakedefine HAVE_KQUEUE 1
|
||||
|
||||
/* Define to 1 if you have the `m' library (-lm). */
|
||||
#cmakedefine HAVE_LIBM 1
|
||||
|
||||
/* Define to 1 if you have the `rt' library (-lrt). */
|
||||
/* #undef HAVE_LIBRT */
|
||||
|
||||
/* Define to 1 if you have the `nanosleep' function. */
|
||||
#cmakedefine HAVE_NANOSLEEP 1
|
||||
|
||||
/* Define to 1 if you have the `poll' function. */
|
||||
#cmakedefine HAVE_POLL 1
|
||||
|
||||
/* Define to 1 if you have the <poll.h> header file. */
|
||||
#cmakedefine HAVE_POLL_H 1
|
||||
|
||||
/* Define to 1 if you have the `port_create' function. */
|
||||
#cmakedefine HAVE_PORT_CREATE 1
|
||||
|
||||
/* Define to 1 if you have the <port.h> header file. */
|
||||
#cmakedefine HAVE_PORT_H 1
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#cmakedefine HAVE_SELECT 1
|
||||
|
||||
/* Define to 1 if you have the <sys/epoll.h> header file. */
|
||||
#cmakedefine HAVE_SYS_EPOLL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/eventfd.h> header file. */
|
||||
#cmakedefine HAVE_SYS_EVENTFD_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/event.h> header file. */
|
||||
#cmakedefine HAVE_SYS_EVENT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/inotify.h> header file. */
|
||||
#cmakedefine HAVE_SYS_INOTIFY_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/queue.h> header file. */
|
||||
#cmakedefine HAVE_SYS_QUEUE_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#cmakedefine HAVE_SYS_SELECT_H 1
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "libev"
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "3.9"
|
||||
97
deps/libev/config.h.in
vendored
Normal file
97
deps/libev/config.h.in
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the `clock_gettime' function. */
|
||||
#undef HAVE_CLOCK_GETTIME
|
||||
|
||||
/* "use syscall interface for clock_gettime" */
|
||||
#undef HAVE_CLOCK_SYSCALL
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `epoll_ctl' function. */
|
||||
#undef HAVE_EPOLL_CTL
|
||||
|
||||
/* Define to 1 if you have the `eventfd' function. */
|
||||
#undef HAVE_EVENTFD
|
||||
|
||||
/* Define to 1 if you have the `inotify_init' function. */
|
||||
#undef HAVE_INOTIFY_INIT
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `kqueue' function. */
|
||||
#undef HAVE_KQUEUE
|
||||
|
||||
/* Define to 1 if you have the `m' library (-lm). */
|
||||
#undef HAVE_LIBM
|
||||
|
||||
/* Define to 1 if you have the `rt' library (-lrt). */
|
||||
#undef HAVE_LIBRT
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `nanosleep' function. */
|
||||
#undef HAVE_NANOSLEEP
|
||||
|
||||
/* Define to 1 if you have the `poll' function. */
|
||||
#undef HAVE_POLL
|
||||
|
||||
/* Define to 1 if you have the <poll.h> header file. */
|
||||
#undef HAVE_POLL_H
|
||||
|
||||
/* Define to 1 if you have the `port_create' function. */
|
||||
#undef HAVE_PORT_CREATE
|
||||
|
||||
/* Define to 1 if you have the <port.h> header file. */
|
||||
#undef HAVE_PORT_H
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
/* Define to 1 if you have the `signalfd' function. */
|
||||
#undef HAVE_SIGNALFD
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/epoll.h> header file. */
|
||||
#undef HAVE_SYS_EPOLL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/eventfd.h> header file. */
|
||||
#undef HAVE_SYS_EVENTFD_H
|
||||
|
||||
/* Define to 1 if you have the <sys/event.h> header file. */
|
||||
#undef HAVE_SYS_EVENT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/inotify.h> header file. */
|
||||
#undef HAVE_SYS_INOTIFY_H
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/signalfd.h> header file. */
|
||||
#undef HAVE_SYS_SIGNALFD_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
4
deps/libev/configure.ac
vendored
4
deps/libev/configure.ac
vendored
@@ -1,7 +1,7 @@
|
||||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([ev_epoll.c])
|
||||
|
||||
AM_INIT_AUTOMAKE(libev,3.9) dnl also update ev.h!
|
||||
AM_INIT_AUTOMAKE(libev,4.00) dnl also update ev.h!
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
@@ -9,7 +9,7 @@ AC_PROG_INSTALL
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
if test "x$GCC" = xyes ; then
|
||||
CFLAGS="$CFLAGS -O3"
|
||||
CFLAGS="-O3 $CFLAGS"
|
||||
fi
|
||||
|
||||
m4_include([libev.m4])
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user