Compare commits
743 Commits
curl-7_32_
...
curl-7_35_
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2bf90d0710 | ||
![]() |
9873fd5317 | ||
![]() |
d735d3e803 | ||
![]() |
1a20f59237 | ||
![]() |
f00899d73e | ||
![]() |
00b1e52823 | ||
![]() |
31860ab8c8 | ||
![]() |
2070a140fd | ||
![]() |
bcb19883a8 | ||
![]() |
f2e42dd056 | ||
![]() |
5a47062cad | ||
![]() |
0f46b3b3dd | ||
![]() |
23a04863aa | ||
![]() |
33f9c05082 | ||
![]() |
00787f94b2 | ||
![]() |
49b63cf30d | ||
![]() |
f55f8d4c18 | ||
![]() |
88b074df3f | ||
![]() |
f5860fd5fc | ||
![]() |
e17446b097 | ||
![]() |
0d959c64b2 | ||
![]() |
606e67c812 | ||
![]() |
b4b28c7001 | ||
![]() |
e6130c0310 | ||
![]() |
da9864fb72 | ||
![]() |
755dc2f058 | ||
![]() |
6c014e4283 | ||
![]() |
4013a2aa64 | ||
![]() |
0b5b52ff2d | ||
![]() |
251305cd7f | ||
![]() |
852a018e78 | ||
![]() |
82de54dd38 | ||
![]() |
12ecd56da7 | ||
![]() |
6217cf6ba3 | ||
![]() |
afd288b28f | ||
![]() |
39f7e80a52 | ||
![]() |
b0fa530c98 | ||
![]() |
4f334ba017 | ||
![]() |
33b8960dc8 | ||
![]() |
de966b403a | ||
![]() |
2cac75c4e4 | ||
![]() |
aba98991a5 | ||
![]() |
db1beab1d7 | ||
![]() |
93ca1d2065 | ||
![]() |
e35ffda0b3 | ||
![]() |
d2671340a6 | ||
![]() |
ecaf2f02f1 | ||
![]() |
d4296f6f06 | ||
![]() |
eb02a99c61 | ||
![]() |
3f5546b2be | ||
![]() |
345891edba | ||
![]() |
821094ba72 | ||
![]() |
7e0c2c47ab | ||
![]() |
7b774482e7 | ||
![]() |
27ecc22649 | ||
![]() |
7f807f394f | ||
![]() |
9520c62049 | ||
![]() |
ce82a1be0d | ||
![]() |
c7a76bb056 | ||
![]() |
8b984641f2 | ||
![]() |
5b591829b6 | ||
![]() |
9d497c6afe | ||
![]() |
89dbb6a0da | ||
![]() |
2d15958711 | ||
![]() |
bbc1705fa9 | ||
![]() |
87ade5f0eb | ||
![]() |
a33e7edcec | ||
![]() |
0fea86afe3 | ||
![]() |
3a4cd2ad8d | ||
![]() |
82c472228e | ||
![]() |
0089e65008 | ||
![]() |
2492fd30e5 | ||
![]() |
190e41f840 | ||
![]() |
5d25d626b1 | ||
![]() |
e473a4d2f3 | ||
![]() |
7e85964080 | ||
![]() |
9bd2fdb8e2 | ||
![]() |
3b5c75ef3d | ||
![]() |
3b183df9cc | ||
![]() |
7cd45b297e | ||
![]() |
9362603f05 | ||
![]() |
980659a2ca | ||
![]() |
041d1e14d6 | ||
![]() |
21aa79f463 | ||
![]() |
28933f9d30 | ||
![]() |
5b2342d377 | ||
![]() |
31075a8897 | ||
![]() |
2d435c7fb5 | ||
![]() |
0151316183 | ||
![]() |
aa1ee9e7a2 | ||
![]() |
f61e0a34ea | ||
![]() |
e35458bc08 | ||
![]() |
e96b67a70f | ||
![]() |
8ae35102c4 | ||
![]() |
fc0b4b0d31 | ||
![]() |
619d1704ae | ||
![]() |
d5f1590d5c | ||
![]() |
fca7930dfa | ||
![]() |
e9c0f1f658 | ||
![]() |
279c95b5b3 | ||
![]() |
61312fe66f | ||
![]() |
149e0c8d10 | ||
![]() |
0f4bf77bd3 | ||
![]() |
ecb0dc4c90 | ||
![]() |
a6742a1c12 | ||
![]() |
e209d60713 | ||
![]() |
91d62e9abd | ||
![]() |
3e17db4882 | ||
![]() |
ef2d7cb44b | ||
![]() |
e948b9c6e3 | ||
![]() |
afb65c6cf3 | ||
![]() |
5be92d03b0 | ||
![]() |
3bc349b53b | ||
![]() |
ad39e7ec01 | ||
![]() |
98b7fc0195 | ||
![]() |
f9797871aa | ||
![]() |
d718abd968 | ||
![]() |
190bb785d8 | ||
![]() |
5c0eae136b | ||
![]() |
5220c1d692 | ||
![]() |
84a9f092dc | ||
![]() |
4fc8d83f5f | ||
![]() |
8fc4abedf1 | ||
![]() |
c216179af4 | ||
![]() |
4c51f2b578 | ||
![]() |
2b026784a8 | ||
![]() |
3c1519117a | ||
![]() |
602d28a210 | ||
![]() |
404794e97a | ||
![]() |
3b6420c0a5 | ||
![]() |
62da1e7458 | ||
![]() |
bf24b64e83 | ||
![]() |
d28b70d152 | ||
![]() |
231b23acbb | ||
![]() |
3529162405 | ||
![]() |
d237828ebc | ||
![]() |
c50d3ed075 | ||
![]() |
61288cbdef | ||
![]() |
42100cdead | ||
![]() |
4bb7400529 | ||
![]() |
303172d220 | ||
![]() |
0f340f0572 | ||
![]() |
f063773b83 | ||
![]() |
e9b9e287c1 | ||
![]() |
030303fa99 | ||
![]() |
5f8f512719 | ||
![]() |
6bc9e46bf1 | ||
![]() |
db11750cfa | ||
![]() |
1f47a77b29 | ||
![]() |
0757a9b941 | ||
![]() |
83ae98c6c6 | ||
![]() |
2658da7604 | ||
![]() |
c16e5dfbc8 | ||
![]() |
7de2e03258 | ||
![]() |
ab71241c88 | ||
![]() |
e9625c5bc6 | ||
![]() |
18a6467c8c | ||
![]() |
7b368e7f94 | ||
![]() |
34365e4b03 | ||
![]() |
60bd22620a | ||
![]() |
6e4d4a9b51 | ||
![]() |
c68758b621 | ||
![]() |
73a894170b | ||
![]() |
0aafd77fa4 | ||
![]() |
9f96f8a5c5 | ||
![]() |
01aaad7442 | ||
![]() |
610a55388b | ||
![]() |
5107d66b2e | ||
![]() |
4e1ece2e44 | ||
![]() |
28dd47d4d4 | ||
![]() |
147b2a546e | ||
![]() |
95b5036a59 | ||
![]() |
263616202b | ||
![]() |
c9dd4022f4 | ||
![]() |
f2d234a4dd | ||
![]() |
2a4ee0d221 | ||
![]() |
f88f9bed00 | ||
![]() |
9aa6e4357a | ||
![]() |
7b057f53fd | ||
![]() |
2dd9bfc5d9 | ||
![]() |
0ff0a994ad | ||
![]() |
e8b57d1e84 | ||
![]() |
7fd490732a | ||
![]() |
0c762f1c92 | ||
![]() |
15bf9389ce | ||
![]() |
2618e4caae | ||
![]() |
08e57f916c | ||
![]() |
6f2d5f0562 | ||
![]() |
82bf8edff3 | ||
![]() |
cd492a3ba8 | ||
![]() |
50aac1a37d | ||
![]() |
574db1a6fd | ||
![]() |
7246255416 | ||
![]() |
f763d1b1bb | ||
![]() |
48cd1292e2 | ||
![]() |
f718415bc7 | ||
![]() |
2715d7f948 | ||
![]() |
3db1f3dd81 | ||
![]() |
7da9c95bcf | ||
![]() |
95ae389e17 | ||
![]() |
91735102ac | ||
![]() |
248967e300 | ||
![]() |
cf2051764c | ||
![]() |
3ce2a3991b | ||
![]() |
195b63f99c | ||
![]() |
1deac31eba | ||
![]() |
bf468fb589 | ||
![]() |
ca4506b46a | ||
![]() |
727d798d68 | ||
![]() |
3917d73b36 | ||
![]() |
812c5ace75 | ||
![]() |
c3a02c3e54 | ||
![]() |
565c5b3dc3 | ||
![]() |
11e8066ef9 | ||
![]() |
92b9ae5c5d | ||
![]() |
a47c142a88 | ||
![]() |
eccf4fb7ee | ||
![]() |
9f260b5d66 | ||
![]() |
0452976711 | ||
![]() |
94d820b4cb | ||
![]() |
1cfb436a2f | ||
![]() |
fae7db8a31 | ||
![]() |
0a898655e8 | ||
![]() |
48043f87b6 | ||
![]() |
b7b126ee41 | ||
![]() |
91c8f81d72 | ||
![]() |
74476609c3 | ||
![]() |
6c62d84232 | ||
![]() |
c93bd31336 | ||
![]() |
933e6c9d16 | ||
![]() |
da24fbbc00 | ||
![]() |
367648d24a | ||
![]() |
bd3a59ad41 | ||
![]() |
c0245cc591 | ||
![]() |
13c696f37f | ||
![]() |
0966b324d9 | ||
![]() |
c0ef05e675 | ||
![]() |
1dc43de0dc | ||
![]() |
8a8f9a5d57 | ||
![]() |
be28223f35 | ||
![]() |
8e2d73bbde | ||
![]() |
dd4d9ea542 | ||
![]() |
169fedbdce | ||
![]() |
32b9c30e67 | ||
![]() |
75cd7fd667 | ||
![]() |
7246dffff5 | ||
![]() |
41d21e460f | ||
![]() |
aadca7f418 | ||
![]() |
3905bd637d | ||
![]() |
c4f46e97ca | ||
![]() |
bd3ca6630a | ||
![]() |
92e607abfa | ||
![]() |
ef118c13ba | ||
![]() |
1cf71bd76e | ||
![]() |
2c0ecac9d3 | ||
![]() |
b0b5b51193 | ||
![]() |
ff9b66a8d4 | ||
![]() |
e221b55f67 | ||
![]() |
865666afca | ||
![]() |
7fc9325a52 | ||
![]() |
4fb8241add | ||
![]() |
30e7e7552b | ||
![]() |
f58f843f66 | ||
![]() |
d92de3a7e9 | ||
![]() |
fe7fc61c6e | ||
![]() |
ad3836448e | ||
![]() |
f3ee587775 | ||
![]() |
c92c30edbd | ||
![]() |
4d10f48629 | ||
![]() |
dc68120e63 | ||
![]() |
0db811b69b | ||
![]() |
d81cbbcc2c | ||
![]() |
0dd6522036 | ||
![]() |
889cb9c982 | ||
![]() |
26ff1ea6c3 | ||
![]() |
59f1209fad | ||
![]() |
7b9365c65f | ||
![]() |
a900d45489 | ||
![]() |
e64f91feb7 | ||
![]() |
b2a55c8106 | ||
![]() |
030a2b8cb8 | ||
![]() |
edce855943 | ||
![]() |
35e476a3f6 | ||
![]() |
0434a19431 | ||
![]() |
2ff0c6f5f3 | ||
![]() |
8a94aedbd6 | ||
![]() |
95877cf8ae | ||
![]() |
d3325ae40a | ||
![]() |
23fabf8dea | ||
![]() |
7a36b2abc0 | ||
![]() |
e1c255f388 | ||
![]() |
6d3c832a30 | ||
![]() |
7935478397 | ||
![]() |
5ee64be9c6 | ||
![]() |
9f18cf15d5 | ||
![]() |
bf05da183e | ||
![]() |
2c04e8d80c | ||
![]() |
925df53580 | ||
![]() |
8191800a0c | ||
![]() |
2165298fe6 | ||
![]() |
e885dc85a1 | ||
![]() |
df58084695 | ||
![]() |
3c8c9b2779 | ||
![]() |
b27dc009cf | ||
![]() |
2c7a5578e1 | ||
![]() |
b56d7cda74 | ||
![]() |
8896b56488 | ||
![]() |
0d735c29f9 | ||
![]() |
3d50e91aee | ||
![]() |
0cbfe5a7d5 | ||
![]() |
eedca5055e | ||
![]() |
5d040632ac | ||
![]() |
314c3b8480 | ||
![]() |
d630e1f389 | ||
![]() |
0ea4a80bb2 | ||
![]() |
ed4ce23c23 | ||
![]() |
168aa59705 | ||
![]() |
f71b1ad908 | ||
![]() |
dac01ff6d7 | ||
![]() |
4a9fe26837 | ||
![]() |
90ec8763a5 | ||
![]() |
796333bc5e | ||
![]() |
f16c0de4e9 | ||
![]() |
786cba1ada | ||
![]() |
ed1662c374 | ||
![]() |
1f0616ea1a | ||
![]() |
55250d2d02 | ||
![]() |
c5d73167a6 | ||
![]() |
bde901ad89 | ||
![]() |
79c77f7c31 | ||
![]() |
986c249f2f | ||
![]() |
3b8c3eb911 | ||
![]() |
b29217d0d6 | ||
![]() |
534f90f9bf | ||
![]() |
dbe228353d | ||
![]() |
bf77101e5c | ||
![]() |
2ea9a125a6 | ||
![]() |
58a00d6d9f | ||
![]() |
57a27528e6 | ||
![]() |
632c1edd06 | ||
![]() |
434bc09263 | ||
![]() |
f2584627c8 | ||
![]() |
6901861fc9 | ||
![]() |
d7d8a8f922 | ||
![]() |
c19cfb79db | ||
![]() |
65ce9b6d6c | ||
![]() |
5f34a10445 | ||
![]() |
fa1253aee1 | ||
![]() |
f833f54979 | ||
![]() |
e7d77fb3ef | ||
![]() |
c8e63f247a | ||
![]() |
7396ad6e09 | ||
![]() |
6d295f8d7d | ||
![]() |
5bd999d0c5 | ||
![]() |
0f81fbe5da | ||
![]() |
9b67960421 | ||
![]() |
e10a26a9d6 | ||
![]() |
7b68b58bc0 | ||
![]() |
2d5455feac | ||
![]() |
ac05c80f19 | ||
![]() |
460adfef93 | ||
![]() |
c876f6ae6d | ||
![]() |
f49276bfcb | ||
![]() |
d08ee3c83d | ||
![]() |
cf7008670b | ||
![]() |
558034ab70 | ||
![]() |
27b7b1062f | ||
![]() |
af82661dbd | ||
![]() |
76f924131c | ||
![]() |
98a5fdaf29 | ||
![]() |
1ea05be46d | ||
![]() |
c9d8c00a41 | ||
![]() |
5aa290f0f2 | ||
![]() |
f0831f7931 | ||
![]() |
7fc3b2ce38 | ||
![]() |
02fbc26d59 | ||
![]() |
0074c9f5d1 | ||
![]() |
90acbfd52e | ||
![]() |
989b28fe97 | ||
![]() |
aa61e14dc1 | ||
![]() |
a84a09ad0b | ||
![]() |
66b8557aff | ||
![]() |
63cac69c2a | ||
![]() |
f77d9b6584 | ||
![]() |
2736b27df7 | ||
![]() |
297644fa70 | ||
![]() |
0177f28c51 | ||
![]() |
732d10ed6c | ||
![]() |
526a1c3b45 | ||
![]() |
5b315a273e | ||
![]() |
5094bb53f4 | ||
![]() |
052f24c9b7 | ||
![]() |
bce03fe144 | ||
![]() |
9a1755264f | ||
![]() |
3b59696a93 | ||
![]() |
cdccb42267 | ||
![]() |
753d44fa00 | ||
![]() |
cfdfdcdd9d | ||
![]() |
e232f5f3f9 | ||
![]() |
43400b4086 | ||
![]() |
8179354c2f | ||
![]() |
f6c335d63f | ||
![]() |
2bd72fa61c | ||
![]() |
e17c1b25bc | ||
![]() |
7d1eb66cd7 | ||
![]() |
255826c40f | ||
![]() |
1d0eead969 | ||
![]() |
8005e58983 | ||
![]() |
5d415815df | ||
![]() |
f68559c086 | ||
![]() |
08f97f3b1d | ||
![]() |
b87ba2c942 | ||
![]() |
e7a2ba41e3 | ||
![]() |
6fe619be7a | ||
![]() |
1e39b95682 | ||
![]() |
8230af0b94 | ||
![]() |
1709e5e966 | ||
![]() |
7d7df83198 | ||
![]() |
7de4cc35f8 | ||
![]() |
aa0eaef483 | ||
![]() |
9f503a254b | ||
![]() |
d44b014271 | ||
![]() |
469b423350 | ||
![]() |
0adad07690 | ||
![]() |
e4670a1029 | ||
![]() |
1f0e50f2b9 | ||
![]() |
2766262a68 | ||
![]() |
bdb1f0e53d | ||
![]() |
6e3613e6e6 | ||
![]() |
1cb5150dba | ||
![]() |
d24b7953c2 | ||
![]() |
13db74ffc3 | ||
![]() |
98905aa2c5 | ||
![]() |
820ed48a00 | ||
![]() |
973cc22529 | ||
![]() |
2cc9246477 | ||
![]() |
650036633f | ||
![]() |
78aee26be6 | ||
![]() |
947d431d50 | ||
![]() |
58bd0148fb | ||
![]() |
ca5c5be3e4 | ||
![]() |
9bd37a6d27 | ||
![]() |
1be69159f3 | ||
![]() |
a3da0a96e3 | ||
![]() |
626f8a85f0 | ||
![]() |
867b52a7ac | ||
![]() |
be31924f8c | ||
![]() |
f70b2c77f4 | ||
![]() |
ae495ffcc3 | ||
![]() |
0fdfe82c6a | ||
![]() |
dead10b1b8 | ||
![]() |
41d820d2c3 | ||
![]() |
5b31b38c27 | ||
![]() |
39f4e4fafa | ||
![]() |
587811c0a6 | ||
![]() |
7f7fbe7fbd | ||
![]() |
9b1eb2b421 | ||
![]() |
1034aa6680 | ||
![]() |
4be0af7f74 | ||
![]() |
72f850571d | ||
![]() |
e179d0eb12 | ||
![]() |
ce61510127 | ||
![]() |
86c64f3daf | ||
![]() |
65e556d0ce | ||
![]() |
6a1363128f | ||
![]() |
75b9b26465 | ||
![]() |
2c84ffe154 | ||
![]() |
e7452415c5 | ||
![]() |
87861c9b0e | ||
![]() |
4d49ffe165 | ||
![]() |
f63603dec4 | ||
![]() |
0218a737fe | ||
![]() |
18ca0aa984 | ||
![]() |
c4e6c33b13 | ||
![]() |
d774802eec | ||
![]() |
69c0d3fbc8 | ||
![]() |
076726f141 | ||
![]() |
ad34a2d5c8 | ||
![]() |
31e106c01c | ||
![]() |
1dcc433661 | ||
![]() |
a106abee62 | ||
![]() |
f77e89c5d2 | ||
![]() |
92cf6141ed | ||
![]() |
cf12d5b62f | ||
![]() |
39beaa5ffb | ||
![]() |
5df04bfafd | ||
![]() |
d015f4ccac | ||
![]() |
143d7c13d8 | ||
![]() |
9b33ecfd01 | ||
![]() |
ca1b34b887 | ||
![]() |
f0f95c97f7 | ||
![]() |
4cd444e01a | ||
![]() |
8264478490 | ||
![]() |
b46491900d | ||
![]() |
725288bf2f | ||
![]() |
173160c0d0 | ||
![]() |
3c3622b662 | ||
![]() |
a22c478ed7 | ||
![]() |
3d43a48781 | ||
![]() |
c8b05b809e | ||
![]() |
ca995010d0 | ||
![]() |
25a0c96a49 | ||
![]() |
a8b606b1a6 | ||
![]() |
20a99a45c0 | ||
![]() |
49341628b5 | ||
![]() |
ab7e6afd44 | ||
![]() |
4d7bf73fc3 | ||
![]() |
3c34f453fa | ||
![]() |
d5f687ed8f | ||
![]() |
a377fab015 | ||
![]() |
092f33d6bf | ||
![]() |
09a13a1c01 | ||
![]() |
30a09783b2 | ||
![]() |
733a4419d0 | ||
![]() |
77dc4ba877 | ||
![]() |
14d8209adc | ||
![]() |
a942d8ff5b | ||
![]() |
1695c67818 | ||
![]() |
f81d1e1666 | ||
![]() |
b71ed1fb3d | ||
![]() |
86ccfaa3fd | ||
![]() |
3b69462fc0 | ||
![]() |
22bccb0eda | ||
![]() |
4f591b9148 | ||
![]() |
52cefc8cd7 | ||
![]() |
8880f84e1a | ||
![]() |
9d4a8c7936 | ||
![]() |
fd8dc21fd0 | ||
![]() |
8ec6486d05 | ||
![]() |
59c1743c78 | ||
![]() |
60a2046162 | ||
![]() |
6dd8bd8d2f | ||
![]() |
b07709f741 | ||
![]() |
9215cee4c6 | ||
![]() |
34df869f99 | ||
![]() |
3f04d48495 | ||
![]() |
517b8e2290 | ||
![]() |
af44da38d6 | ||
![]() |
fcfa26a7ee | ||
![]() |
18db743851 | ||
![]() |
0e188e2dc3 | ||
![]() |
eecb0e969f | ||
![]() |
bd7d56ec71 | ||
![]() |
6f78aaad6f | ||
![]() |
89d320c2fd | ||
![]() |
b809bafb0c | ||
![]() |
3b6a1681dc | ||
![]() |
9300bb826d | ||
![]() |
dfe7ee1429 | ||
![]() |
841103c776 | ||
![]() |
8d2335ca23 | ||
![]() |
04064e89c1 | ||
![]() |
c873375123 | ||
![]() |
62d232c131 | ||
![]() |
98f7ca7e97 | ||
![]() |
4cfbb201c4 | ||
![]() |
dc016567ce | ||
![]() |
96b68c57ce | ||
![]() |
158dfe2c5c | ||
![]() |
8f5336a2fa | ||
![]() |
f8a9dbd391 | ||
![]() |
016879d477 | ||
![]() |
c03335ec68 | ||
![]() |
894585784c | ||
![]() |
33c1f2876b | ||
![]() |
00ee5c5cf1 | ||
![]() |
dadc495540 | ||
![]() |
eae86ba62d | ||
![]() |
e9cca79dd1 | ||
![]() |
4ba3b6c05a | ||
![]() |
187ac69374 | ||
![]() |
84ad1569e5 | ||
![]() |
45e0a661ce | ||
![]() |
4d6ef6297a | ||
![]() |
b68c52704b | ||
![]() |
4f4dc5832d | ||
![]() |
fbcefc0ce0 | ||
![]() |
83f6f58834 | ||
![]() |
0a691f8935 | ||
![]() |
c243d45aad | ||
![]() |
8a6dba520b | ||
![]() |
32352ed6ad | ||
![]() |
df69440d05 | ||
![]() |
345955e87e | ||
![]() |
6f5b46855c | ||
![]() |
5f93c5d658 | ||
![]() |
7fd84b14d2 | ||
![]() |
f2403140f9 | ||
![]() |
f3c9749a40 | ||
![]() |
3f6991766f | ||
![]() |
cfe5f7dbf4 | ||
![]() |
5840c918d5 | ||
![]() |
b0afb00000 | ||
![]() |
0b5ae7c80e | ||
![]() |
0d55f4e1bc | ||
![]() |
86d340af27 | ||
![]() |
5c14a7f068 | ||
![]() |
2879ffacfa | ||
![]() |
d89eb55906 | ||
![]() |
4a85e60cfe | ||
![]() |
bfefe2400a | ||
![]() |
25c6890375 | ||
![]() |
eb6314260d | ||
![]() |
313c38c9de | ||
![]() |
ae6096471a | ||
![]() |
66ea5c415b | ||
![]() |
2481ac358c | ||
![]() |
c639d725a3 | ||
![]() |
857f999353 | ||
![]() |
6d9cddc513 | ||
![]() |
e20e48cbf2 | ||
![]() |
ee5e2cf6cb | ||
![]() |
e8313697b6 | ||
![]() |
28427b4083 | ||
![]() |
131649a121 | ||
![]() |
632b3d81d6 | ||
![]() |
241aeadc50 | ||
![]() |
669e4ca366 | ||
![]() |
c9617d9f93 | ||
![]() |
f8986a2b34 | ||
![]() |
1b96ce04b2 | ||
![]() |
f851df88fb | ||
![]() |
18c595fde2 | ||
![]() |
56abdd07e7 | ||
![]() |
7e06c336d6 | ||
![]() |
8a4069fb17 | ||
![]() |
243ad539fe | ||
![]() |
3d60590422 | ||
![]() |
08fa4fed70 | ||
![]() |
4344fa926a | ||
![]() |
61672bde44 | ||
![]() |
13dbb41c49 | ||
![]() |
e5c2354fd5 | ||
![]() |
09634f46fb | ||
![]() |
0119a93b33 | ||
![]() |
9fa42beddc | ||
![]() |
d6cda9e8ab | ||
![]() |
2a7f1425d9 | ||
![]() |
900ccc26ae | ||
![]() |
01d7bbbebe | ||
![]() |
3dc6fc42bf | ||
![]() |
d2fe616e7e | ||
![]() |
316ca865e3 | ||
![]() |
812d49db90 | ||
![]() |
02370fff3a | ||
![]() |
e9de8e78f0 | ||
![]() |
2eabb7d590 | ||
![]() |
d707a975f6 | ||
![]() |
ac487842a1 | ||
![]() |
06b6e1d0d2 | ||
![]() |
b77997e6da | ||
![]() |
9e8ced9890 | ||
![]() |
698e3bdf82 | ||
![]() |
9011fb3f0c | ||
![]() |
073b03fab7 | ||
![]() |
f73f052010 | ||
![]() |
97ed1ac905 | ||
![]() |
322f0bc2f1 | ||
![]() |
af4bddf20b | ||
![]() |
f19efd07e7 | ||
![]() |
83f5332536 | ||
![]() |
497775024c | ||
![]() |
ea38a70539 | ||
![]() |
5eea336d01 | ||
![]() |
f3849a7b84 | ||
![]() |
1ca6ed7b75 | ||
![]() |
aa51d3a139 | ||
![]() |
64c8909071 | ||
![]() |
e848942505 | ||
![]() |
7e489c42f7 | ||
![]() |
75b52f9dcc | ||
![]() |
221825aebf | ||
![]() |
9d35ad9552 | ||
![]() |
c4a7ca038e | ||
![]() |
84f3b3dd44 | ||
![]() |
2ef83136d4 | ||
![]() |
d737aa19c8 | ||
![]() |
78e6683bb0 | ||
![]() |
2f9b64ac33 | ||
![]() |
6a353049ac | ||
![]() |
49e3d803ab | ||
![]() |
b644ae68c8 | ||
![]() |
4ae7b7ea69 | ||
![]() |
13a2e32548 | ||
![]() |
c3b513e75c | ||
![]() |
a74b36af2a | ||
![]() |
1b4dc10393 | ||
![]() |
45b6e2dd89 | ||
![]() |
6dca35c0e5 | ||
![]() |
a691e04470 | ||
![]() |
3d1a453d88 | ||
![]() |
d7a39f8f97 | ||
![]() |
3c929ff9f6 | ||
![]() |
9d957294cb | ||
![]() |
acf59be7f0 | ||
![]() |
e7dcc454c6 | ||
![]() |
84789e12fb | ||
![]() |
460fb12097 | ||
![]() |
63d8b3a507 | ||
![]() |
90ab65c632 | ||
![]() |
34122800b8 | ||
![]() |
7f41eab395 | ||
![]() |
0192ad65bb | ||
![]() |
06c1bea72f | ||
![]() |
19a05c908f | ||
![]() |
bb55293313 | ||
![]() |
817ceb09e0 | ||
![]() |
1a911f7ec4 | ||
![]() |
ea464d72e9 | ||
![]() |
22adb46a32 | ||
![]() |
fc99eaa5ae | ||
![]() |
4bea91fc67 | ||
![]() |
06d1b10cbe | ||
![]() |
816b639035 | ||
![]() |
8804ffd4fa | ||
![]() |
19122c0768 | ||
![]() |
c346c4c8f9 | ||
![]() |
bc7d806e3a | ||
![]() |
6cf8413e31 | ||
![]() |
062e5bfd9c | ||
![]() |
e4a1888bd0 | ||
![]() |
2f1a0bc0bf | ||
![]() |
09ddb1d61c | ||
![]() |
15f76bf7bb | ||
![]() |
36585b5395 | ||
![]() |
11baffbff6 | ||
![]() |
53333a43a1 | ||
![]() |
c56f9797e7 | ||
![]() |
9281be36d5 | ||
![]() |
f15a88f2b2 | ||
![]() |
5ca96cb844 | ||
![]() |
10afe7cf10 | ||
![]() |
6972335f50 | ||
![]() |
d5e2d0b6bf | ||
![]() |
f34b5fb4d8 | ||
![]() |
f584312e81 | ||
![]() |
0b4557f766 | ||
![]() |
204126a5f1 | ||
![]() |
2ae3d28f3d | ||
![]() |
8a42c2ef8d | ||
![]() |
e79535bc5e | ||
![]() |
4ad8e142da | ||
![]() |
e3ee73b70c |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -46,3 +46,4 @@ CHANGES.dist
|
||||
.cproject
|
||||
.settings
|
||||
/[0-9]*.patch
|
||||
.dirstamp
|
||||
|
11
.travis.yml
Normal file
11
.travis.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
language: c
|
||||
|
||||
before_script:
|
||||
- ./buildconf
|
||||
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
|
||||
notifications:
|
||||
email: false
|
@@ -108,7 +108,11 @@ if(NOT UNIX)
|
||||
set(HAVE_IN_ADDR_T 0)
|
||||
set(HAVE_INET_NTOA_R_DECL 0)
|
||||
set(HAVE_INET_NTOA_R_DECL_REENTRANT 0)
|
||||
set(HAVE_GETADDRINFO 0)
|
||||
if(ENABLE_IPV6)
|
||||
set(HAVE_GETADDRINFO 1)
|
||||
else()
|
||||
set(HAVE_GETADDRINFO 0)
|
||||
endif()
|
||||
set(STDC_HEADERS 1)
|
||||
set(RETSIGTYPE_TEST 1)
|
||||
|
||||
|
@@ -1,3 +1,24 @@
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
###########################################################################
|
||||
# cURL/libcurl CMake script
|
||||
# by Tetetest and Sukender (Benoit Neil)
|
||||
|
||||
@@ -23,6 +44,8 @@ include(Utilities)
|
||||
|
||||
project( CURL C )
|
||||
|
||||
message(WARNING "the curl cmake build system is poorly maintained. Be aware")
|
||||
|
||||
file (READ ${CURL_SOURCE_DIR}/include/curl/curlver.h CURL_VERSION_H_CONTENTS)
|
||||
string (REGEX MATCH "LIBCURL_VERSION_MAJOR[ \t]+([0-9]+)"
|
||||
LIBCURL_VERSION_MJ ${CURL_VERSION_H_CONTENTS})
|
||||
@@ -783,6 +806,17 @@ else()
|
||||
set(CURL_SIZEOF_CURL_SOCKLEN_T ${SIZEOF_INT})
|
||||
endif()
|
||||
|
||||
# TODO test which of these headers are required for the typedefs used in curlbuild.h
|
||||
if(WIN32)
|
||||
set(CURL_PULL_WS2TCPIP_H ${HAVE_WS2TCPIP_H})
|
||||
else()
|
||||
set(CURL_PULL_SYS_TYPES_H ${HAVE_SYS_TYPES_H})
|
||||
set(CURL_PULL_SYS_SOCKET_H ${HAVE_SYS_SOCKET_H})
|
||||
set(CURL_PULL_SYS_POLL_H ${HAVE_SYS_POLL_H})
|
||||
endif()
|
||||
set(CURL_PULL_STDINT_H ${HAVE_STDINT_H})
|
||||
set(CURL_PULL_INTTYPES_H ${HAVE_INTTYPES_H})
|
||||
|
||||
include(CMake/OtherTests.cmake)
|
||||
|
||||
add_definitions(-DHAVE_CONFIG_H)
|
||||
|
2
COPYING
2
COPYING
@@ -1,6 +1,6 @@
|
||||
COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright (c) 1996 - 2013, Daniel Stenberg, <daniel@haxx.se>.
|
||||
Copyright (c) 1996 - 2014, Daniel Stenberg, <daniel@haxx.se>.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
# Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
@@ -136,12 +136,36 @@ vc-zlib: $(VC)
|
||||
cd ..\src
|
||||
nmake /f Makefile.$(VC) cfg=release-zlib
|
||||
|
||||
vc-x64-zlib: $(VC)
|
||||
cd lib
|
||||
nmake /f Makefile.$(VC) MACHINE=x64 cfg=release-zlib
|
||||
cd ..\src
|
||||
nmake /f Makefile.$(VC) MACHINE=x64 cfg=release-zlib
|
||||
|
||||
vc-ssl: $(VC)
|
||||
cd lib
|
||||
nmake /f Makefile.$(VC) cfg=release-ssl
|
||||
cd ..\src
|
||||
nmake /f Makefile.$(VC) cfg=release-ssl
|
||||
|
||||
vc-winssl: $(VC)
|
||||
cd lib
|
||||
nmake /f Makefile.$(VC) cfg=release-winssl WINDOWS_SSPI=1
|
||||
cd ..\src
|
||||
nmake /f Makefile.$(VC) cfg=release-winssl WINDOWS_SSPI=1
|
||||
|
||||
vc-x64-ssl: $(VC)
|
||||
cd lib
|
||||
nmake /f Makefile.$(VC) MACHINE=x64 cfg=release-ssl
|
||||
cd ..\src
|
||||
nmake /f Makefile.$(VC) MACHINE=x64 cfg=release-ssl
|
||||
|
||||
vc-x64-winssl: $(VC)
|
||||
cd lib
|
||||
nmake /f Makefile.$(VC) MACHINE=x64 cfg=release-winssl WINDOWS_SSPI=1
|
||||
cd ..\src
|
||||
nmake /f Makefile.$(VC) MACHINE=x64 cfg=release-winssl WINDOWS_SSPI=1
|
||||
|
||||
vc-ssl-zlib: $(VC)
|
||||
cd lib
|
||||
nmake /f Makefile.$(VC) cfg=release-ssl-zlib
|
||||
@@ -266,6 +290,18 @@ linux-ssl: ssl
|
||||
# We don't need to do anything for vc6.
|
||||
vc6:
|
||||
|
||||
# VC7 makefiles are for use with VS.NET and VS.NET 2003
|
||||
vc7: lib/Makefile.vc7 src/Makefile.vc7
|
||||
|
||||
lib/Makefile.vc7: lib/Makefile.vc6
|
||||
@echo "generate $@"
|
||||
@sed -e "s/VC6/VC7/g" lib/Makefile.vc6 > lib/Makefile.vc7
|
||||
|
||||
src/Makefile.vc7: src/Makefile.vc6
|
||||
@echo "generate $@"
|
||||
@sed -e "s/VC6/VC7/g" src/Makefile.vc6 > src/Makefile.vc7
|
||||
|
||||
# VC8 makefiles are for use with VS2005
|
||||
vc8: lib/Makefile.vc8 src/Makefile.vc8
|
||||
|
||||
lib/Makefile.vc8: lib/Makefile.vc6
|
||||
@@ -298,6 +334,28 @@ src/Makefile.vc10: src/Makefile.vc6
|
||||
@echo "generate $@"
|
||||
@sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib/g" -e "s/vc6/vc10/g" -e "s/VC6/VC10/g" src/Makefile.vc6 > src/Makefile.vc10
|
||||
|
||||
# VC11 makefiles are for use with VS2012
|
||||
vc11: lib/Makefile.vc11 src/Makefile.vc11
|
||||
|
||||
lib/Makefile.vc11: lib/Makefile.vc6
|
||||
@echo "generate $@"
|
||||
@sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib/g" -e "s/vc6/vc11/g" -e "s/VC6/VC11/g" lib/Makefile.vc6 > lib/Makefile.vc11
|
||||
|
||||
src/Makefile.vc11: src/Makefile.vc6
|
||||
@echo "generate $@"
|
||||
@sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib/g" -e "s/vc6/vc11/g" -e "s/VC6/VC11/g" src/Makefile.vc6 > src/Makefile.vc11
|
||||
|
||||
# VC12 makefiles are for use with VS2013
|
||||
vc12: lib/Makefile.vc12 src/Makefile.vc12
|
||||
|
||||
lib/Makefile.vc12: lib/Makefile.vc6
|
||||
@echo "generate $@"
|
||||
@sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib/g" -e "s/vc6/vc12/g" -e "s/VC6/VC12/g" lib/Makefile.vc6 > lib/Makefile.vc12
|
||||
|
||||
src/Makefile.vc12: src/Makefile.vc6
|
||||
@echo "generate $@"
|
||||
@sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib/g" -e "s/vc6/vc12/g" -e "s/VC6/VC12/g" src/Makefile.vc6 > src/Makefile.vc12
|
||||
|
||||
ca-bundle: lib/mk-ca-bundle.pl
|
||||
@echo "generate a fresh ca-bundle.crt"
|
||||
@perl $< -b -l -u lib/ca-bundle.crt
|
||||
|
171
RELEASE-NOTES
171
RELEASE-NOTES
@@ -1,69 +1,68 @@
|
||||
Curl and libcurl 7.32.0
|
||||
Curl and libcurl 7.35.0
|
||||
|
||||
Public curl releases: 134
|
||||
Command line options: 152
|
||||
curl_easy_setopt() options: 199
|
||||
Public curl releases: 137
|
||||
Command line options: 161
|
||||
curl_easy_setopt() options: 206
|
||||
Public functions in libcurl: 58
|
||||
Known libcurl bindings: 42
|
||||
Contributors: 1049
|
||||
|
||||
***
|
||||
krb4 support is up for removal. If you care about it at all, speak up
|
||||
on the curl-library list asap!
|
||||
***
|
||||
Contributors: 1104
|
||||
|
||||
This release includes the following changes:
|
||||
|
||||
o curl: allow timeouts to accept decimal values
|
||||
o OS400: add slist and certinfo EBCDIC support
|
||||
o OS400: new SSL backend GSKit
|
||||
o CURLOPT_XFERINFOFUNCTION: introducing a new progress callback
|
||||
o LIBCURL-STRUCTS: new document
|
||||
o imap/pop3/smtp: Added support for SASL authentication downgrades
|
||||
o imap/pop3/smtp: Extended the login options to support multiple auth mechanisms
|
||||
o TheArtOfHttpScripting: major update, converted layout and more
|
||||
o mprintf: Added support for I, I32 and I64 size specifiers
|
||||
o makefile: Added support for VC7, VC11 and VC12
|
||||
|
||||
This release includes the following bugfixes:
|
||||
|
||||
o dotdot: introducing dot file path cleanup [1]
|
||||
o docs: fix typo in curl_easy_getinfo manpage
|
||||
o test1230: avoid using hard-wired port number
|
||||
o test1396: invoke the correct test tool
|
||||
o SIGPIPE: ignored while inside the library [2]
|
||||
o darwinssl: fix crash that started happening in Lion
|
||||
o OpenSSL: check for read errors, don't assume [3]
|
||||
o c-ares: improve error message on failed resolve [4]
|
||||
o printf: make sure %x are treated unsigned
|
||||
o formpost: better random boundaries [5]
|
||||
o url: restore the functionality of 'curl -u :' [6]
|
||||
o curl.1: fix typo in --xattr description [7]
|
||||
o digest: improve nonce generation
|
||||
o configure: automake 1.14 compatibility tweak
|
||||
o curl.1: document the --post303 option in the man page
|
||||
o curl.1: document the --sasl-ir option in the man page
|
||||
o setup-vms.h: sk_pop symbol tweak
|
||||
o tool_paramhlp: try harder to catch negatives
|
||||
o cmake: Fix for MSVC2010 project generation [8]
|
||||
o asyn-ares: Don't blank ares servers if none configured
|
||||
o curl_multi_wait: set revents for extra fds
|
||||
o Reinstate "WIN32 MemoryTracking: track wcsdup() _wcsdup() and _tcsdup()
|
||||
o ftp_do_more: consider DO_MORE complete when server connects back [9]
|
||||
o curl_easy_perform: gradually increase the delay time [10]
|
||||
o curl: fix symbolic names for CURLUSESSL_* enum in --libcurl output
|
||||
o curl: fix upload of a zip file in OpenVMS [11]
|
||||
o build: fix linking on Solaris 10 [12]
|
||||
o curl_formadd: CURLFORM_FILECONTENT wrongly rejected some option combos [13]
|
||||
o curl_formadd: fix file upload on VMS [14]
|
||||
o curl_easy_pause: on unpause, trigger mulit-socket handling [15]
|
||||
o md5 & metalink: use better build macros on Apple operating systems [16]
|
||||
o darwinssl: fix build error in crypto authentication under Snow Leopard [16]
|
||||
o curl: make --progress-bar update the line less frequently [17]
|
||||
o configure: don't error out on variable confusions (CFLAGS, LDFLAGS etc)
|
||||
o mk-ca-bundle: skip more untrusted certificates
|
||||
o formadd: wrong pointer for file name when CURLFORM_BUFFERPTR used [18]
|
||||
o FTP: when EPSV gets a 229 but fails to connect, retry with PASV
|
||||
o mk-ca-bundle.1: don't install on make install [19]
|
||||
o VMS: lots of updates and fixes of the build procedure
|
||||
o global dns cache: didn't work (regression)
|
||||
o global dns cache: fix memory leak
|
||||
o
|
||||
o SECURITY ADVISORY: re-use of wrong HTTP NTLM connection [25]
|
||||
|
||||
o curl_easy_setopt: Fixed OAuth 2.0 Bearer option name [1]
|
||||
o pop3: Fixed APOP being determined by CAPA response rather than by timestamp
|
||||
o Curl_pp_readresp: zero terminate line [2]
|
||||
o FILE: don't wait due to CURLOPT_MAX_RECV_SPEED_LARGE [3]
|
||||
o docs: mention CURLOPT_MAX_RECV/SEND_SPEED_LARGE don't work for FILE://
|
||||
o pop3: Fixed auth preference not being honored when CAPA not supported
|
||||
o imap: Fixed auth preference not being honored when CAPABILITY not supported
|
||||
o threaded resolver: Use pthread_t * for curl_thread_t [4]
|
||||
o FILE: we don't support paused transfers using this protocol [5]
|
||||
o connect: Try all addresses in first connection attempt [6]
|
||||
o curl_easy_setopt.3: Added SMTP information to CURLOPT_INFILESIZE_LARGE
|
||||
o OpenSSL: Fix forcing SSLv3 connections [7]
|
||||
o openssl: allow explicit sslv2 selection [8]
|
||||
o FTP parselist: fix "total" parser [9]
|
||||
o conncache: fix possible dereference of null pointer
|
||||
o multi.c: fix possible dereference of null pointer
|
||||
o mk-ca-bundle: introduces -d and warns about using this script
|
||||
o ConnectionExists: fix NTLM check for new connection [10]
|
||||
o trynextip: fix build for non-IPV6 capable systems [11]
|
||||
o Curl_updateconninfo: don't do anything for UDP "connections" [12]
|
||||
o darwinssl: un-break Leopard build after PKCS#12 change [13]
|
||||
o threaded-resolver: never use NULL hints with getaddrinf [14]
|
||||
o multi_socket: remind app if timeout didn't run
|
||||
o OpenSSL: deselect weak ciphers by default [15]
|
||||
o error message: Sensible message on timeout when transfer size unknown [16]
|
||||
o curl_easy_setopt.3: mention how to unset CURLOPT_INFILESIZE*
|
||||
o win32: Fixed use of deprecated function 'GetVersionInfoEx' for VC12 [17]
|
||||
o configure: fix gssapi linking on HP-UX [18]
|
||||
o chunked-parser: abort on overflows, allow 64 bit chunks
|
||||
o chunked parsing: relax the CR strictness [19]
|
||||
o cookie: max-age fixes [20]
|
||||
o progress bar: always update when at 100%
|
||||
o progress bar: increase update frequency to 10Hz
|
||||
o tool: Fixed incorrect return code if command line parser runs out of memory
|
||||
o tool: Fixed incorrect return code if password prompting runs out of memory
|
||||
o HTTP POST: omit Content-Length if data size is unknown [21]
|
||||
o GnuTLS: disable insecure ciphers
|
||||
o GnuTLS: honor --slv2 and the --tlsv1[.N] switches
|
||||
o multi: Fixed a memory leak on OOM condition
|
||||
o netrc: Fixed a memory and file descriptor leak on OOM
|
||||
o getpass: fix password parsing from console [22]
|
||||
o TFTP: fix crash on time-out [23]
|
||||
o hostip: don't remove DNS entries that are in use [24]
|
||||
o tests: lots of tests fixed to pass the OOM torture tests
|
||||
|
||||
This release includes the following known bugs:
|
||||
|
||||
@@ -72,34 +71,40 @@ This release includes the following known bugs:
|
||||
This release would not have looked like this without help, code, reports and
|
||||
advice from friends like these:
|
||||
|
||||
Alex Vinnik, Alessandro Ghedini, Nick Zitzmann, Kamil Dudka,
|
||||
Lluis Batlle i Rossell, Nach M. S., Kim Vandry, Ben Greear, Dan Fandrich,
|
||||
Dave Reisner, Evgeny Turnaev, Guenter Knauf, John E. Malmberg, Marc Hoersken,
|
||||
Patrick Monnerat, Sergei Nikulov, Yang Tse, Andreas Malzahn, Clemens Gruber,
|
||||
Jean-Noel Rouvignac, Markus Moeller, Fabian Keil, Dagobert Michelsen,
|
||||
Byrial Jensen, Justin Karneges, Edward Rudd, Marc Doughty, Konstantin Isakov,
|
||||
|
||||
Abram Pousada, Barry Abrahamson, Björn Stenberg, Cédric Deltheil, Chen Prog,
|
||||
Christian Weisgerber, Colin Hogben, Dan Fandrich, Daniel Stenberg,
|
||||
Fabian Frank, Glenn Sheridan, Guenter Knauf, He Qin, Iida Yosiaki,
|
||||
Jeff Hodges, Justin Maggard, Leif W, Luke Dashjr, Maks Naumov, Marc Hoersken,
|
||||
Michael Osipov, Michal Górny and Anthony G. Basile, Mohammad AlSaleh,
|
||||
Nick Zitzmann, Paras Sethia, Petr Novak, Priyanka Shah, Romulo A. Ceccon,
|
||||
Steve Holme, Tobias Markus, Viktor Szakáts, Yehezkel Horowitz, Yingwei Liu
|
||||
|
||||
Thanks! (and sorry if I forgot to mention someone)
|
||||
|
||||
References to bug reports and discussions on issues:
|
||||
|
||||
[1] = http://curl.haxx.se/bug/view.cgi?id=1200
|
||||
[2] = http://curl.haxx.se/bug/view.cgi?id=1180
|
||||
[3] = http://curl.haxx.se/bug/view.cgi?id=1249
|
||||
[4] = http://curl.haxx.se/bug/view.cgi?id=1191
|
||||
[5] = http://curl.haxx.se/bug/view.cgi?id=1251
|
||||
[6] = http://curl.haxx.se/mail/archive-2013-06/0052.html
|
||||
[7] = http://curl.haxx.se/bug/view.cgi?id=1252
|
||||
[8] = http://curl.haxx.se/mail/lib-2013-07/0046.html
|
||||
[9] = http://curl.haxx.se/mail/lib-2013-07/0115.html
|
||||
[10] = http://curl.haxx.se/mail/lib-2013-07/0103.html
|
||||
[11] = http://curl.haxx.se/bug/view.cgi?id=496
|
||||
[12] = http://curl.haxx.se/bug/view.cgi?id=1217
|
||||
[13] = http://curl.haxx.se/mail/lib-2013-07/0258.html
|
||||
[14] = http://curl.haxx.se/bug/view.cgi?id=758
|
||||
[15] = http://curl.haxx.se/mail/lib-2013-07/0239.html
|
||||
[16] = http://curl.haxx.se/bug/view.cgi?id=1255
|
||||
[17] = http://curl.haxx.se/mail/archive-2013-07/0031.html
|
||||
[18] = http://curl.haxx.se/bug/view.cgi?id=1262
|
||||
[19] = http://curl.haxx.se/mail/lib-2013-08/0057.html
|
||||
[1] = http://curl.haxx.se/bug/view.cgi?id=1313
|
||||
[2] = http://curl.haxx.se/mail/lib-2013-12/0113.html
|
||||
[3] = http://curl.haxx.se/bug/view.cgi?id=1312
|
||||
[4] = http://curl.haxx.se/bug/view.cgi?id=1314
|
||||
[5] = http://curl.haxx.se/bug/view.cgi?id=1286
|
||||
[6] = http://curl.haxx.se/bug/view.cgi?id=1315
|
||||
[7] = http://curl.haxx.se/mail/lib-2014-01/0002.html
|
||||
[8] = http://curl.haxx.se/mail/lib-2014-01/0013.html
|
||||
[9] = http://curl.haxx.se/mail/lib-2014-01/0019.html
|
||||
[10] = http://curl.haxx.se/mail/lib-2014-01/0046.html
|
||||
[11] = http://curl.haxx.se/bug/view.cgi?id=1322
|
||||
[12] = http://curl.haxx.se/mail/archive-2014-01/0016.html
|
||||
[13] = http://curl.haxx.se/mail/lib-2013-12/0150.html
|
||||
[14] = http://curl.haxx.se/mail/lib-2014-01/0061.html
|
||||
[15] = http://curl.haxx.se/bug/view.cgi?id=1323
|
||||
[16] = http://curl.haxx.se/mail/lib-2014-01/0115.html
|
||||
[17] = http://curl.haxx.se/mail/lib-2014-01/0134.html
|
||||
[18] = http://curl.haxx.se/bug/view.cgi?id=1321
|
||||
[19] = http://curl.haxx.se/mail/archive-2014-01/0000.html
|
||||
[20] = http://curl.haxx.se/mail/lib-2014-01/0130.html
|
||||
[21] = http://curl.haxx.se/mail/lib-2014-01/0103.html
|
||||
[22] = https://github.com/bagder/curl/pull/87
|
||||
[23] = http://curl.haxx.se/mail/lib-2014-01/0246.html
|
||||
[24] = http://curl.haxx.se/bug/view.cgi?id=1327
|
||||
[25] = http://curl.haxx.se/docs/adv_20140129.html
|
||||
|
73
acinclude.m4
73
acinclude.m4
@@ -2619,48 +2619,49 @@ AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
|
||||
fi
|
||||
capath="$want_capath"
|
||||
ca="no"
|
||||
elif test "x$cross_compiling" != "xyes"; then
|
||||
dnl NOT cross-compiling and...
|
||||
dnl neither of the --with-ca-* options are provided
|
||||
|
||||
else
|
||||
dnl first try autodetecting a CA bundle , then a CA path
|
||||
dnl both autodetections can be skipped by --without-ca-*
|
||||
ca="no"
|
||||
capath="no"
|
||||
if test "x$want_ca" = "xunset"; then
|
||||
dnl the path we previously would have installed the curl ca bundle
|
||||
dnl to, and thus we now check for an already existing cert in that place
|
||||
dnl in case we find no other
|
||||
if test "x$prefix" != xNONE; then
|
||||
cac="${prefix}/share/curl/curl-ca-bundle.crt"
|
||||
else
|
||||
cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
|
||||
fi
|
||||
if test "x$cross_compiling" != "xyes"; then
|
||||
dnl NOT cross-compiling and...
|
||||
dnl neither of the --with-ca-* options are provided
|
||||
if test "x$want_ca" = "xunset"; then
|
||||
dnl the path we previously would have installed the curl ca bundle
|
||||
dnl to, and thus we now check for an already existing cert in that
|
||||
dnl place in case we find no other
|
||||
if test "x$prefix" != xNONE; then
|
||||
cac="${prefix}/share/curl/curl-ca-bundle.crt"
|
||||
else
|
||||
cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
|
||||
fi
|
||||
|
||||
for a in /etc/ssl/certs/ca-certificates.crt \
|
||||
/etc/pki/tls/certs/ca-bundle.crt \
|
||||
/usr/share/ssl/certs/ca-bundle.crt \
|
||||
/usr/local/share/certs/ca-root.crt \
|
||||
/etc/ssl/cert.pem \
|
||||
"$cac"; do
|
||||
if test -f "$a"; then
|
||||
ca="$a"
|
||||
break
|
||||
fi
|
||||
done
|
||||
for a in /etc/ssl/certs/ca-certificates.crt \
|
||||
/etc/pki/tls/certs/ca-bundle.crt \
|
||||
/usr/share/ssl/certs/ca-bundle.crt \
|
||||
/usr/local/share/certs/ca-root.crt \
|
||||
/etc/ssl/cert.pem \
|
||||
"$cac"; do
|
||||
if test -f "$a"; then
|
||||
ca="$a"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
|
||||
"x$OPENSSL_ENABLED" = "x1"; then
|
||||
for a in /etc/ssl/certs/; do
|
||||
if test -d "$a" && ls "$a"/[[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]].0 >/dev/null 2>/dev/null; then
|
||||
capath="$a"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
else
|
||||
dnl no option given and cross-compiling
|
||||
AC_MSG_WARN([skipped the ca-cert path detection when cross-compiling])
|
||||
fi
|
||||
if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
|
||||
"x$OPENSSL_ENABLED" = "x1"; then
|
||||
for a in /etc/ssl/certs/; do
|
||||
if test -d "$a" && ls "$a"/[[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]].0 >/dev/null 2>/dev/null; then
|
||||
capath="$a"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
else
|
||||
dnl no option given and cross-compiling
|
||||
AC_MSG_WARN([skipped the ca-cert path detection when cross-compiling])
|
||||
fi
|
||||
|
||||
if test "x$ca" != "xno"; then
|
||||
|
226
configure.ac
226
configure.ac
@@ -5,7 +5,7 @@
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
# Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
@@ -31,7 +31,7 @@ XC_OVR_ZZ60
|
||||
CURL_OVERRIDE_AUTOCONF
|
||||
|
||||
dnl configure script copyright
|
||||
AC_COPYRIGHT([Copyright (c) 1998 - 2013 Daniel Stenberg, <daniel@haxx.se>
|
||||
AC_COPYRIGHT([Copyright (c) 1998 - 2014 Daniel Stenberg, <daniel@haxx.se>
|
||||
This configure script may be copied, distributed and modified under the
|
||||
terms of the curl license; see COPYING for more details])
|
||||
|
||||
@@ -150,7 +150,6 @@ dnl initialize all the info variables
|
||||
curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl,cyassl,axtls,winssl,darwinssl} )"
|
||||
curl_ssh_msg="no (--with-libssh2)"
|
||||
curl_zlib_msg="no (--with-zlib)"
|
||||
curl_krb4_msg="no (--with-krb4*)"
|
||||
curl_gss_msg="no (--with-gssapi)"
|
||||
curl_spnego_msg="no (--with-spnego)"
|
||||
curl_tls_srp_msg="no (--enable-tls-srp)"
|
||||
@@ -1066,6 +1065,7 @@ AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]),
|
||||
AC_TRY_RUN([ /* is AF_INET6 available? */
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <stdlib.h> /* for exit() */
|
||||
main()
|
||||
{
|
||||
if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
|
||||
@@ -1134,101 +1134,6 @@ no)
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Check for the presence of Kerberos4 libraries and headers
|
||||
dnl **********************************************************************
|
||||
|
||||
AC_ARG_WITH(krb4-includes,
|
||||
AC_HELP_STRING([--with-krb4-includes=DIR],
|
||||
[Specify location of kerberos4 headers]),[
|
||||
CPPFLAGS="$CPPFLAGS -I$withval"
|
||||
KRB4INC="$withval"
|
||||
want_krb4=yes
|
||||
])
|
||||
|
||||
AC_ARG_WITH(krb4-libs,
|
||||
AC_HELP_STRING([--with-krb4-libs=DIR],[Specify location of kerberos4 libs]),[
|
||||
LDFLAGS="$LDFLAGS -L$withval"
|
||||
KRB4LIB="$withval"
|
||||
want_krb4=yes
|
||||
])
|
||||
|
||||
|
||||
OPT_KRB4=off
|
||||
AC_ARG_WITH(krb4,dnl
|
||||
AC_HELP_STRING([--with-krb4=DIR],[where to look for Kerberos4]),[
|
||||
OPT_KRB4="$withval"
|
||||
if test X"$OPT_KRB4" != Xno; then
|
||||
want_krb4="yes"
|
||||
if test X"$OPT_KRB4" != Xyes; then
|
||||
LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib$libsuff"
|
||||
KRB4LIB="$OPT_KRB4/lib$libsuff"
|
||||
CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
|
||||
KRB4INC="$OPT_KRB4/include"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([if Kerberos4 support is requested])
|
||||
|
||||
if test "$want_krb4" = yes
|
||||
then
|
||||
if test "$ipv6" = "yes"; then
|
||||
echo krb4 is not compatible with IPv6
|
||||
exit 1
|
||||
fi
|
||||
AC_MSG_RESULT(yes)
|
||||
|
||||
dnl Check for & handle argument to --with-krb4
|
||||
|
||||
AC_MSG_CHECKING(where to look for Kerberos4)
|
||||
if test X"$OPT_KRB4" = Xyes
|
||||
then
|
||||
AC_MSG_RESULT([defaults])
|
||||
else
|
||||
AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
|
||||
fi
|
||||
|
||||
dnl Check for DES library
|
||||
AC_CHECK_LIB(des, des_pcbc_encrypt,
|
||||
[
|
||||
AC_CHECK_HEADERS(des.h)
|
||||
|
||||
dnl resolv lib?
|
||||
AC_CHECK_FUNC(res_search, , [AC_CHECK_LIB(resolv, res_search)])
|
||||
|
||||
dnl Check for the Kerberos4 library
|
||||
AC_CHECK_LIB(krb, krb_net_read,
|
||||
[
|
||||
dnl Check for header files
|
||||
AC_CHECK_HEADERS(krb.h)
|
||||
|
||||
dnl we found the required libraries, add to LIBS
|
||||
LIBS="-lkrb -lcom_err -ldes $LIBS"
|
||||
|
||||
dnl Check for function krb_get_our_ip_for_realm
|
||||
dnl this is needed for NAT networks
|
||||
AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
|
||||
|
||||
dnl add define KRB4
|
||||
AC_DEFINE(HAVE_KRB4, 1,
|
||||
[if you have the Kerberos4 libraries (including -ldes)])
|
||||
|
||||
dnl substitute it too!
|
||||
KRB4_ENABLED=1
|
||||
AC_SUBST(KRB4_ENABLED)
|
||||
|
||||
curl_krb4_msg="enabled"
|
||||
|
||||
dnl the krb4 stuff needs a strlcpy()
|
||||
AC_CHECK_FUNCS(strlcpy)
|
||||
|
||||
])
|
||||
])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Check for FBopenssl(SPNEGO) libraries
|
||||
dnl **********************************************************************
|
||||
@@ -1389,6 +1294,12 @@ if test x"$want_gss" = xyes; then
|
||||
*-*-darwin*)
|
||||
LIBS="-lgssapi_krb5 -lresolv $LIBS"
|
||||
;;
|
||||
*-hp-hpux*)
|
||||
if test "$GSSAPI_ROOT" != "yes"; then
|
||||
LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
|
||||
fi
|
||||
LIBS="-lgss $LIBS"
|
||||
;;
|
||||
*)
|
||||
if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
|
||||
dnl krb5-config doesn't have --libs-only-L or similar, put everything
|
||||
@@ -1405,7 +1316,14 @@ if test x"$want_gss" = xyes; then
|
||||
esac
|
||||
else
|
||||
LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
|
||||
LIBS="-lgssapi $LIBS"
|
||||
case $host in
|
||||
*-hp-hpux*)
|
||||
LIBS="-lgss $LIBS"
|
||||
;;
|
||||
*)
|
||||
LIBS="-lgssapi $LIBS"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
@@ -2079,6 +1997,9 @@ if test "$curl_ssl_msg" = "$init_ssl_msg"; then
|
||||
if test "x$USE_CYASSL" = "xyes"; then
|
||||
AC_MSG_NOTICE([detected CyaSSL])
|
||||
|
||||
dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
|
||||
AC_CHECK_SIZEOF(long long)
|
||||
|
||||
LIBS="-lcyassl -lm $LIBS"
|
||||
|
||||
if test -n "$cyassllib"; then
|
||||
@@ -2163,8 +2084,8 @@ if test "$curl_ssl_msg" = "$init_ssl_msg"; then
|
||||
CPPFLAGS="$CPPFLAGS $addcflags"
|
||||
fi
|
||||
|
||||
dnl The function PK11_CreateGenericObject is needed to load libnsspem.so
|
||||
AC_CHECK_LIB(nss3, PK11_CreateGenericObject,
|
||||
dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0
|
||||
AC_CHECK_LIB(nss3, SSL_VersionRangeSet,
|
||||
[
|
||||
AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
|
||||
AC_SUBST(USE_NSS, [1])
|
||||
@@ -2180,14 +2101,6 @@ if test "$curl_ssl_msg" = "$init_ssl_msg"; then
|
||||
if test "x$USE_NSS" = "xyes"; then
|
||||
AC_MSG_NOTICE([detected NSS version $version])
|
||||
|
||||
dnl NSS_InitContext() was introduced in NSS 3.12.5 and helps to prevent
|
||||
dnl collisions on NSS initialization/shutdown with other libraries
|
||||
AC_CHECK_FUNC(NSS_InitContext,
|
||||
[
|
||||
AC_DEFINE(HAVE_NSS_INITCONTEXT, 1, [if you have the NSS_InitContext function])
|
||||
AC_SUBST(HAVE_NSS_INITCONTEXT, [1])
|
||||
])
|
||||
|
||||
dnl when shared libs were found in a path that the run-time
|
||||
dnl linker doesn't search through, we need to add it to
|
||||
dnl LD_LIBRARY_PATH to prevent further configure tests to fail
|
||||
@@ -2808,6 +2721,92 @@ dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
|
||||
dnl genprogc/thread_quick_ref.htm
|
||||
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Check for nghttp2
|
||||
dnl **********************************************************************
|
||||
|
||||
AC_MSG_CHECKING([whether to build with nghttp2])
|
||||
OPT_H2="no"
|
||||
AC_ARG_WITH(nghttp2,
|
||||
AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
|
||||
AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
|
||||
[OPT_H2=$withval])
|
||||
case "$OPT_H2" in
|
||||
no)
|
||||
dnl --without-nghttp2 option used
|
||||
want_idn="no"
|
||||
AC_MSG_RESULT([no])
|
||||
;;
|
||||
default)
|
||||
dnl configure option not specified
|
||||
want_h2="no"
|
||||
want_h2_path="default"
|
||||
AC_MSG_RESULT([no])
|
||||
;;
|
||||
yes)
|
||||
dnl --with-nghttp2 option used without path
|
||||
want_h2="yes"
|
||||
want_h2_path=""
|
||||
AC_MSG_RESULT([yes])
|
||||
;;
|
||||
*)
|
||||
dnl --with-nghttp2 option used with path
|
||||
want_h2="yes"
|
||||
want_h2_path="$withval"
|
||||
AC_MSG_RESULT([yes ($withval)])
|
||||
;;
|
||||
esac
|
||||
|
||||
curl_h2_msg="disabled (--with-nghttp2)"
|
||||
if test X"$OPT_H2" != Xno; then
|
||||
dnl backup the pre-librtmp variables
|
||||
CLEANLDFLAGS="$LDFLAGS"
|
||||
CLEANCPPFLAGS="$CPPFLAGS"
|
||||
CLEANLIBS="$LIBS"
|
||||
|
||||
h2pcdir=${want_h2_path}/lib/pkgconfig
|
||||
CURL_CHECK_PKGCONFIG(libnghttp2, $h2pcdir)
|
||||
|
||||
if test "$PKGCONFIG" != "no" ; then
|
||||
LIB_H2=`CURL_EXPORT_PCDIR([$h2pcdir])
|
||||
$PKGCONFIG --libs-only-l libnghttp2`
|
||||
AC_MSG_NOTICE([-l is $LIB_H2])
|
||||
|
||||
CPP_H2=`CURL_EXPORT_PCDIR([$h2pcdir]) dnl
|
||||
$PKGCONFIG --cflags-only-I libnghttp2`
|
||||
AC_MSG_NOTICE([-I is $CPP_H2])
|
||||
|
||||
LD_H2=`CURL_EXPORT_PCDIR([$h2pcdir])
|
||||
$PKGCONFIG --libs-only-L libnghttp2`
|
||||
AC_MSG_NOTICE([-L is $LD_H2])
|
||||
|
||||
else
|
||||
dnl To avoid link errors, we do not allow --libnghttp2 without
|
||||
dnl a pkgconfig file
|
||||
AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
|
||||
fi
|
||||
|
||||
LDFLAGS="$LDFLAGS $LD_H2"
|
||||
CPPFLAGS="$CPPFLAGS $CPP_H2"
|
||||
LIBS="$LIB_H2 $LIBS"
|
||||
|
||||
AC_CHECK_LIB(nghttp2, nghttp2_session_client_new,
|
||||
[
|
||||
AC_CHECK_HEADERS(nghttp2/nghttp2.h,
|
||||
curl_h2_msg="enabled (nghttp2)"
|
||||
NGHTTP2_ENABLED=1
|
||||
AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
|
||||
AC_SUBST(USE_NGHTTP2, [1])
|
||||
)
|
||||
],
|
||||
dnl not found, revert back to clean variables
|
||||
LDFLAGS=$CLEANLDFLAGS
|
||||
CPPFLAGS=$CLEANCPPFLAGS
|
||||
LIBS=$CLEANLIBS
|
||||
)
|
||||
|
||||
fi
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Back to "normal" configuring
|
||||
dnl **********************************************************************
|
||||
@@ -3365,9 +3364,6 @@ if test "x$USE_SSLEAY" = "x1"; then
|
||||
elif test -n "$SSL_ENABLED"; then
|
||||
SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
|
||||
fi
|
||||
if test "@KRB4_ENABLED@" = "x1"; then
|
||||
SUPPORT_FEATURES="$SUPPORT_FEATURES KRB4"
|
||||
fi
|
||||
if test "x$IPV6_ENABLED" = "x1"; then
|
||||
SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
|
||||
fi
|
||||
@@ -3397,6 +3393,10 @@ if test "x$USE_TLS_SRP" = "x1"; then
|
||||
SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
|
||||
fi
|
||||
|
||||
if test "x$USE_NGHTTP2" = "x1"; then
|
||||
SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
|
||||
fi
|
||||
|
||||
AC_SUBST(SUPPORT_FEATURES)
|
||||
|
||||
dnl For supported protocols in pkg-config file
|
||||
@@ -3542,7 +3542,6 @@ AC_MSG_NOTICE([Configured to build curl/libcurl:
|
||||
SSL support: ${curl_ssl_msg}
|
||||
SSH support: ${curl_ssh_msg}
|
||||
zlib support: ${curl_zlib_msg}
|
||||
krb4 support: ${curl_krb4_msg}
|
||||
GSSAPI support: ${curl_gss_msg}
|
||||
SPNEGO support: ${curl_spnego_msg}
|
||||
TLS-SRP support: ${curl_tls_srp_msg}
|
||||
@@ -3561,6 +3560,7 @@ AC_MSG_NOTICE([Configured to build curl/libcurl:
|
||||
RTSP support: ${curl_rtsp_msg}
|
||||
RTMP support: ${curl_rtmp_msg}
|
||||
metalink support: ${curl_mtlnk_msg}
|
||||
HTTP2 support: ${curl_h2_msg}
|
||||
Protocols: ${SUPPORT_PROTOCOLS}
|
||||
])
|
||||
|
||||
|
65
contributors.sh
Executable file
65
contributors.sh
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/bin/sh
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 2013-2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# This script shows all mentioned contributors from <hash> until HEAD. To aid
|
||||
# when writing RELEASE-NOTES and THANKS.
|
||||
#
|
||||
|
||||
start=$1
|
||||
|
||||
if test -z "$start"; then
|
||||
echo "Usage: $0 <since this tag/hash>"
|
||||
fi
|
||||
|
||||
# filter out Author:, Commit: and *by: lines
|
||||
# cut off the email parts
|
||||
# cut off spaces first and last on the line
|
||||
# only count names with a space (ie more than one word)
|
||||
# sort all unique names
|
||||
# awk them into RELEASE-NOTES format
|
||||
git log $start..HEAD | \
|
||||
egrep '(Author|Commit|by):' | \
|
||||
cut -d: -f2- | \
|
||||
cut '-d<' -f1 | \
|
||||
sed -e 's/^ //' -e 's/ $//g' | \
|
||||
grep ' ' | \
|
||||
sort -u |
|
||||
awk '{
|
||||
num++;
|
||||
n = sprintf("%s%s%s,", n, length(n)?" ":"", $0);
|
||||
#print n;
|
||||
if(length(n) > 78) {
|
||||
printf(" %s\n", p);
|
||||
n=sprintf("%s,", $0);
|
||||
}
|
||||
p=n;
|
||||
|
||||
}
|
||||
|
||||
END {
|
||||
printf(" %s\n", p);
|
||||
printf(" (%d contributors)\n", num);
|
||||
}
|
||||
|
||||
'
|
132
docs/FAQ
132
docs/FAQ
@@ -202,27 +202,25 @@ FAQ
|
||||
better. We do however believe in a few rules when it comes to the future of
|
||||
curl:
|
||||
|
||||
* Curl -- the command line tool -- is to remain a non-graphical command line
|
||||
tool. If you want GUIs or fancy scripting capabilities, you should look
|
||||
for another tool that uses libcurl.
|
||||
Curl -- the command line tool -- is to remain a non-graphical command line
|
||||
tool. If you want GUIs or fancy scripting capabilities, you should look for
|
||||
another tool that uses libcurl.
|
||||
|
||||
* We do not add things to curl that other small and available tools already
|
||||
do very fine at the side. Curl's output is fine to pipe into another
|
||||
program or redirect to another file for the next program to interpret.
|
||||
We do not add things to curl that other small and available tools already do
|
||||
very fine at the side. Curl's output is fine to pipe into another program or
|
||||
redirect to another file for the next program to interpret.
|
||||
|
||||
* We focus on protocol related issues and improvements. If you wanna do more
|
||||
magic with the supported protocols than curl currently does, chances are
|
||||
big we will agree. If you wanna add more protocols, we may very well
|
||||
agree.
|
||||
We focus on protocol related issues and improvements. If you wanna do more
|
||||
magic with the supported protocols than curl currently does, chances are big
|
||||
we will agree. If you wanna add more protocols, we may very well agree.
|
||||
|
||||
* If you want someone else to make all the work while you wait for us to
|
||||
implement it for you, that is not a very friendly attitude. We spend a
|
||||
considerable time already on maintaining and developing curl. In order to
|
||||
get more out of us, you should consider trading in some of your time and
|
||||
efforts in return.
|
||||
If you want someone else to make all the work while you wait for us to
|
||||
implement it for you, that is not a very friendly attitude. We spend a
|
||||
considerable time already on maintaining and developing curl. In order to
|
||||
get more out of us, you should consider trading in some of your time and
|
||||
efforts in return.
|
||||
|
||||
* If you write the code, chances are bigger that it will get into curl
|
||||
faster.
|
||||
If you write the code, chances are bigger that it will get into curl faster.
|
||||
|
||||
1.5 Who makes curl?
|
||||
|
||||
@@ -263,7 +261,7 @@ FAQ
|
||||
|
||||
Our project name curl has been in effective use since 1998. We were not the
|
||||
first computer related project to use the name "curl" and do not claim any
|
||||
first-hand rights to the name.
|
||||
rights to the name.
|
||||
|
||||
We recognize that we will be living in parallel with curl.com and wish them
|
||||
every success.
|
||||
@@ -424,7 +422,7 @@ FAQ
|
||||
|
||||
curl can be built to use one of the following SSL alternatives: OpenSSL,
|
||||
GnuTLS, yassl, NSS, PolarSSL, axTLS, Secure Transport (native iOS/OS X),
|
||||
schannel (native Windows) or qssl (native IBM i). They all have their pros
|
||||
WinSSL (native Windows) or qssl (native IBM i). They all have their pros
|
||||
and cons, and we try to maintain a comparison of them here:
|
||||
http://curl.haxx.se/docs/ssl-compared.html
|
||||
|
||||
@@ -620,15 +618,15 @@ FAQ
|
||||
|
||||
Some workarounds usually suggested to overcome this Javascript dependency:
|
||||
|
||||
- Depending on the Javascript complexity, write up a script that
|
||||
translates it to another language and execute that.
|
||||
Depending on the Javascript complexity, write up a script that translates it
|
||||
to another language and execute that.
|
||||
|
||||
- Read the Javascript code and rewrite the same logic in another language.
|
||||
Read the Javascript code and rewrite the same logic in another language.
|
||||
|
||||
- Implement a Javascript interpreter, people have successfully used the
|
||||
Mozilla Javascript engine in the past.
|
||||
Implement a Javascript interpreter, people have successfully used the
|
||||
Mozilla Javascript engine in the past.
|
||||
|
||||
- Ask your admins to stop this, for a static proxy setup or similar.
|
||||
Ask your admins to stop this, for a static proxy setup or similar.
|
||||
|
||||
3.15 Can I do recursive fetches with curl?
|
||||
|
||||
@@ -644,34 +642,38 @@ FAQ
|
||||
There are three different kinds of "certificates" to keep track of when we
|
||||
talk about using SSL-based protocols (HTTPS or FTPS) using curl or libcurl.
|
||||
|
||||
- Client certificate. The server you communicate may require that you can
|
||||
provide this in order to prove that you actually are who you claim to be.
|
||||
If the server doesn't require this, you don't need a client certificate.
|
||||
CLIENT CERTIFICATE
|
||||
|
||||
A client certificate is always used together with a private key, and the
|
||||
private key has a pass phrase that protects it.
|
||||
The server you communicate may require that you can provide this in order to
|
||||
prove that you actually are who you claim to be. If the server doesn't
|
||||
require this, you don't need a client certificate.
|
||||
|
||||
- Server certificate. The server you communicate with has a server
|
||||
certificate. You can and should verify this certificate to make sure that
|
||||
you are truly talking to the real server and not a server impersonating
|
||||
it.
|
||||
A client certificate is always used together with a private key, and the
|
||||
private key has a pass phrase that protects it.
|
||||
|
||||
- Certificate Authority certificate ("CA cert"). You often have several CA
|
||||
certs in a CA cert bundle that can be used to verify a server certificate
|
||||
that was signed by one of the authorities in the bundle. curl does not
|
||||
come with a CA cert bundle but most curl installs provide one. You can
|
||||
also override the default.
|
||||
SERVER CERTIFICATE
|
||||
|
||||
The server certificate verification process is made by using a Certificate
|
||||
Authority certificate ("CA cert") that was used to sign the server
|
||||
certificate. Server certificate verification is enabled by default in curl
|
||||
and libcurl and is often the reason for problems as explained in FAQ entry
|
||||
4.12 and the SSLCERTS document
|
||||
(http://curl.haxx.se/docs/sslcerts.html). Server certificates that are
|
||||
"self-signed" or otherwise signed by a CA that you do not have a CA cert
|
||||
for, cannot be verified. If the verification during a connect fails, you
|
||||
are refused access. You then need to explicitly disable the verification
|
||||
to connect to the server.
|
||||
The server you communicate with has a server certificate. You can and should
|
||||
verify this certificate to make sure that you are truly talking to the real
|
||||
server and not a server impersonating it.
|
||||
|
||||
CERTIFICATE AUTHORITY CERTIFICATE ("CA cert")
|
||||
|
||||
You often have several CA certs in a CA cert bundle that can be used to
|
||||
verify a server certificate that was signed by one of the authorities in the
|
||||
bundle. curl does not come with a CA cert bundle but most curl installs
|
||||
provide one. You can also override the default.
|
||||
|
||||
The server certificate verification process is made by using a Certificate
|
||||
Authority certificate ("CA cert") that was used to sign the server
|
||||
certificate. Server certificate verification is enabled by default in curl
|
||||
and libcurl and is often the reason for problems as explained in FAQ entry
|
||||
4.12 and the SSLCERTS document
|
||||
(http://curl.haxx.se/docs/sslcerts.html). Server certificates that are
|
||||
"self-signed" or otherwise signed by a CA that you do not have a CA cert
|
||||
for, cannot be verified. If the verification during a connect fails, you are
|
||||
refused access. You then need to explicitly disable the verification to
|
||||
connect to the server.
|
||||
|
||||
3.17 How do I list the root dir of an FTP server?
|
||||
|
||||
@@ -794,12 +796,13 @@ FAQ
|
||||
|
||||
curl 'http://www.altavista.com/cgi-bin/query?text=yes&q=curl'
|
||||
|
||||
In Windows, the standard DOS shell treats the %-symbol specially and you
|
||||
need to use TWO %-symbols for each single one you want to use in the URL.
|
||||
In Windows, the standard DOS shell treats the percent sign specially and you
|
||||
need to use TWO percent signs for each single one you want to use in the
|
||||
URL.
|
||||
|
||||
Also note that if you want the literal %-symbol to be part of the data you
|
||||
pass in a POST using -d/--data you must encode it as '%25' (which then also
|
||||
needs the %-symbol doubled on Windows machines).
|
||||
If you want a literal percent sign to be part of the data you pass in a POST
|
||||
using -d/--data you must encode it as '%25' (which then also needs the
|
||||
percent sign doubled on Windows machines).
|
||||
|
||||
4.3 How can I use {, }, [ or ] to specify multiple URLs?
|
||||
|
||||
@@ -968,13 +971,13 @@ FAQ
|
||||
4.14 Redirects work in browser but not with curl!
|
||||
|
||||
curl supports HTTP redirects fine (see item 3.8). Browsers generally support
|
||||
at least two other ways to perform directs that curl does not:
|
||||
at least two other ways to perform redirects that curl does not:
|
||||
|
||||
- Meta tags. You can write a HTML tag that will cause the browser to
|
||||
redirect to another given URL after a certain time.
|
||||
Meta tags. You can write a HTML tag that will cause the browser to redirect
|
||||
to another given URL after a certain time.
|
||||
|
||||
- Javascript. You can write a Javascript program embedded in a HTML page
|
||||
that redirects the browser to another given URL.
|
||||
Javascript. You can write a Javascript program embedded in a HTML page that
|
||||
redirects the browser to another given URL.
|
||||
|
||||
There is no way to make curl follow these redirects. You must either
|
||||
manually figure out what the page is set to do, or you write a script that
|
||||
@@ -1270,17 +1273,18 @@ FAQ
|
||||
|
||||
5.12 Can I make libcurl fake or hide my real IP address?
|
||||
|
||||
No. libcurl operates on a higher level than so. Besides, faking IP address
|
||||
would imply sending IP packages with a made-up source address, and then you
|
||||
normally get a problem with intercepting the packages sent back as they
|
||||
would then not be routed to you!
|
||||
No. libcurl operates on a higher level. Besides, faking IP address would
|
||||
imply sending IP packet with a made-up source address, and then you normally
|
||||
get a problem with receiving the packet sent back as they would then not be
|
||||
routed to you!
|
||||
|
||||
If you use a proxy to access remote sites, the sites will not see your local
|
||||
IP address but instead the address of the proxy.
|
||||
|
||||
Also note that on many networks NATs or other IP-munging techniques are used
|
||||
that makes you see and use a different IP address locally than what the
|
||||
remote server will see you coming from.
|
||||
remote server will see you coming from. You may also consider using
|
||||
http://www.torproject.org .
|
||||
|
||||
5.13 How do I stop an ongoing transfer?
|
||||
|
||||
|
@@ -176,14 +176,14 @@ IMAPS (*1)
|
||||
FOOTNOTES
|
||||
=========
|
||||
|
||||
*1 = requires OpenSSL, GnuTLS, NSS, yassl, axTLS, PolarSSL, schannel (native
|
||||
*1 = requires OpenSSL, GnuTLS, NSS, yassl, axTLS, PolarSSL, WinSSL (native
|
||||
Windows), Secure Transport (native iOS/OS X) or qssl (native IBM i)
|
||||
*2 = requires OpenLDAP
|
||||
*3 = requires a GSSAPI-compliant library, such as Heimdal or similar
|
||||
*4 = requires FBopenssl
|
||||
*5 = requires a krb4 library, such as the MIT one or similar
|
||||
*6 = requires c-ares
|
||||
*7 = requires OpenSSL, NSS, qssl, schannel or Secure Transport; GnuTLS, for
|
||||
*7 = requires OpenSSL, NSS, qssl, WinSSL or Secure Transport; GnuTLS, for
|
||||
example, only supports SSLv3 and TLSv1
|
||||
*8 = requires libssh2
|
||||
*9 = requires OpenSSL, GnuTLS, NSS, yassl, Secure Transport or SSPI (native
|
||||
|
@@ -993,6 +993,7 @@ REDUCING SIZE
|
||||
--disable-verbose (eliminates debugging strings and error code strings)
|
||||
--enable-hidden-symbols (eliminates unneeded symbols in the shared library)
|
||||
--without-libidn (disables support for the libidn DNS library)
|
||||
--without-librtmp (disables support for RTMP)
|
||||
--without-ssl (disables support for SSL/TLS)
|
||||
--without-zlib (disables support for on-the-fly decompression)
|
||||
|
||||
@@ -1011,9 +1012,9 @@ REDUCING SIZE
|
||||
.comment section).
|
||||
|
||||
Using these techniques it is possible to create a basic HTTP-only shared
|
||||
libcurl library for i386 Linux platforms that is only 106 KiB in size, and
|
||||
an FTP-only library that is 108 KiB in size (as of libcurl version 7.27.0,
|
||||
using gcc 4.6.3).
|
||||
libcurl library for i386 Linux platforms that is only 114 KiB in size, and
|
||||
an FTP-only library that is 115 KiB in size (as of libcurl version 7.34.1,
|
||||
using gcc 4.8.2).
|
||||
|
||||
You may find that statically linking libcurl to your application will
|
||||
result in a lower total size than dynamically linking.
|
||||
|
@@ -43,7 +43,7 @@ Portability
|
||||
openldap 2.0
|
||||
MIT krb5 lib 1.2.4
|
||||
qsossl V5R3M0
|
||||
NSS 3.12.x
|
||||
NSS 3.14.x
|
||||
axTLS 1.2.7
|
||||
Heimdal ?
|
||||
|
||||
@@ -337,10 +337,10 @@ SSL libraries
|
||||
in future libcurl versions.
|
||||
|
||||
To deal with this internally in the best way possible, we have a generic SSL
|
||||
function API as provided by the sslgen.[ch] system, and they are the only SSL
|
||||
functions we must use from within libcurl. sslgen is then crafted to use the
|
||||
function API as provided by the vtls.[ch] system, and they are the only SSL
|
||||
functions we must use from within libcurl. vtls is then crafted to use the
|
||||
appropriate lower-level function calls to whatever SSL library that is in
|
||||
use.
|
||||
use. For example vtls/openssl.[ch] for the OpenSSL library.
|
||||
|
||||
Library Symbols
|
||||
===============
|
||||
|
@@ -3,6 +3,28 @@ join in and help us correct one or more of these! Also be sure to check the
|
||||
changelog of the current development status, as one or more of these problems
|
||||
may have been fixed since this was written!
|
||||
|
||||
87. -J/--remote-header-name doesn't decode %-encoded file names. RFC6266
|
||||
details how it should be done. The can of worm is basically that we have no
|
||||
charset handling in curl and ascii >=128 is a challenge for us. Not to
|
||||
mention that decoding also means that we need to check for nastyness that is
|
||||
attempted, like "../" sequences and the like. Probably everything to the left
|
||||
of any embedded slashes should be cut off.
|
||||
http://curl.haxx.se/bug/view.cgi?id=1294
|
||||
|
||||
86. The disconnect commands (LOGOUT and QUIT) may not be sent by IMAP, POP3
|
||||
and SMTP if a failure occures during the authentication phase of a
|
||||
connection.
|
||||
|
||||
85. Wrong STARTTRANSFER timer accounting for POST requests
|
||||
Timer works fine with GET requests, but while using POST the time for
|
||||
CURLINFO_STARTTRANSFER_TIME is wrong. While using POST
|
||||
CURLINFO_STARTTRANSFER_TIME minus CURLINFO_PRETRANSFER_TIME is near to zero
|
||||
every time.
|
||||
http://curl.haxx.se/bug/view.cgi?id=1213
|
||||
|
||||
84. CURLINFO_SSL_VERIFYRESULT is only implemented for the OpenSSL and NSS
|
||||
backends, so relying on this information in a generic app is flaky.
|
||||
|
||||
83. curl is unable to load non-default openssl engines, because openssl isn't
|
||||
initialized properly. This seems to require OpenSSL_config() or
|
||||
CONF_modules_load_file() to be used by libcurl but the first seems to not
|
||||
@@ -24,18 +46,18 @@ may have been fixed since this was written!
|
||||
|
||||
80. Curl doesn't recognize certificates in DER format in keychain, but it
|
||||
works with PEM.
|
||||
http://curl.haxx.se/bug/view.cgi?id=3439999
|
||||
http://curl.haxx.se/bug/view.cgi?id=1065
|
||||
|
||||
79. SMTP. When sending data to multiple recipients, curl will abort and return
|
||||
failure if one of the recipients indicate failure (on the "RCPT TO"
|
||||
command). Ordinary mail programs would proceed and still send to the ones
|
||||
that can receive data. This is subject for change in the future.
|
||||
http://curl.haxx.se/bug/view.cgi?id=3438362
|
||||
http://curl.haxx.se/bug/view.cgi?id=1116
|
||||
|
||||
78. curl and libcurl don't always signal the client properly when "sending"
|
||||
zero bytes files - it makes for example the command line client not creating
|
||||
any file at all. Like when using FTP.
|
||||
http://curl.haxx.se/bug/view.cgi?id=3438362
|
||||
http://curl.haxx.se/bug/view.cgi?id=1063
|
||||
|
||||
77. CURLOPT_FORBID_REUSE on a handle prevents NTLM from working since it
|
||||
"abuses" the underlying connection re-use system and if connections are
|
||||
@@ -47,12 +69,12 @@ may have been fixed since this was written!
|
||||
option as for all other operating systems.
|
||||
|
||||
75. NTLM authentication involving unicode user name or password only works
|
||||
properly if built with UNICODE defined together with the schannel/winssl
|
||||
properly if built with UNICODE defined together with the WinSSL/schannel
|
||||
backend. The original problem was mentioned in:
|
||||
http://curl.haxx.se/mail/lib-2009-10/0024.html
|
||||
http://curl.haxx.se/bug/view.cgi?id=2944325
|
||||
http://curl.haxx.se/bug/view.cgi?id=896
|
||||
|
||||
The schannel version verified to work as mentioned in
|
||||
The WinSSL/schannel version verified to work as mentioned in
|
||||
http://curl.haxx.se/mail/lib-2012-07/0073.html
|
||||
|
||||
73. if a connection is made to a FTP server but the server then just never
|
||||
@@ -60,7 +82,7 @@ may have been fixed since this was written!
|
||||
acknowledge the connection timeout during that phase but only the "real"
|
||||
timeout - which may surprise users as it is probably considered to be the
|
||||
connect phase to most people. Brought up (and is being misunderstood) in:
|
||||
http://curl.haxx.se/bug/view.cgi?id=2844077
|
||||
http://curl.haxx.se/bug/view.cgi?id=856
|
||||
|
||||
72. "Pausing pipeline problems."
|
||||
http://curl.haxx.se/mail/lib-2009-07/0214.html
|
||||
@@ -78,7 +100,7 @@ may have been fixed since this was written!
|
||||
http://tools.ietf.org/html/draft-reschke-rfc2231-in-http-02
|
||||
|
||||
66. When using telnet, the time limitation options don't work.
|
||||
http://curl.haxx.se/bug/view.cgi?id=2818950
|
||||
http://curl.haxx.se/bug/view.cgi?id=846
|
||||
|
||||
65. When doing FTP over a socks proxy or CONNECT through HTTP proxy and the
|
||||
multi interface is used, libcurl will fail if the (passive) TCP connection
|
||||
@@ -109,7 +131,7 @@ may have been fixed since this was written!
|
||||
and instead the connection is "cancelled" (the operation is considered done)
|
||||
prematurely. There is a half-baked (busy-looping) patch provided in the bug
|
||||
report but it cannot be accepted as-is. See
|
||||
http://curl.haxx.se/bug/view.cgi?id=2006544
|
||||
http://curl.haxx.se/bug/view.cgi?id=748
|
||||
|
||||
55. libcurl fails to build with MIT Kerberos for Windows (KfW) due to KfW's
|
||||
library header files exporting symbols/macros that should be kept private
|
||||
@@ -133,12 +155,12 @@ may have been fixed since this was written!
|
||||
protocol code. This should be very rare.
|
||||
|
||||
43. There seems to be a problem when connecting to the Microsoft telnet server.
|
||||
http://curl.haxx.se/bug/view.cgi?id=1720605
|
||||
http://curl.haxx.se/bug/view.cgi?id=649
|
||||
|
||||
41. When doing an operation over FTP that requires the ACCT command (but not
|
||||
when logging in), the operation will fail since libcurl doesn't detect this
|
||||
and thus fails to issue the correct command:
|
||||
http://curl.haxx.se/bug/view.cgi?id=1693337
|
||||
http://curl.haxx.se/bug/view.cgi?id=635
|
||||
|
||||
39. Steffen Rumler's Race Condition in Curl_proxyCONNECT:
|
||||
http://curl.haxx.se/mail/lib-2007-01/0045.html
|
||||
@@ -151,7 +173,7 @@ may have been fixed since this was written!
|
||||
|
||||
34. The SOCKS4 connection codes don't properly acknowledge (connect) timeouts.
|
||||
Also see #12. According to bug #1556528, even the SOCKS5 connect code does
|
||||
not do it right: http://curl.haxx.se/bug/view.cgi?id=1556528,
|
||||
not do it right: http://curl.haxx.se/bug/view.cgi?id=604
|
||||
|
||||
31. "curl-config --libs" will include details set in LDFLAGS when configure is
|
||||
run that might be needed only for building libcurl. Further, curl-config
|
||||
@@ -166,13 +188,12 @@ may have been fixed since this was written!
|
||||
IDs in URLs to get around the problem of percent signs being
|
||||
special. According to the reporter, Firefox deals with the URL _with_ a
|
||||
percent letter (which seems like a blatant URL spec violation).
|
||||
libcurl supports zone IDs where the percent sign is URL-escaped (i.e. %25).
|
||||
|
||||
See http://curl.haxx.se/bug/view.cgi?id=1371118
|
||||
libcurl supports zone IDs where the percent sign is URL-escaped (i.e. %25):
|
||||
http://curl.haxx.se/bug/view.cgi?id=555
|
||||
|
||||
26. NTLM authentication using SSPI (on Windows) when (lib)curl is running in
|
||||
"system context" will make it use wrong(?) user name - at least when compared
|
||||
to what winhttp does. See http://curl.haxx.se/bug/view.cgi?id=1281867
|
||||
to what winhttp does. See http://curl.haxx.se/bug/view.cgi?id=535
|
||||
|
||||
23. SOCKS-related problems:
|
||||
B) libcurl doesn't support FTPS over a SOCKS proxy.
|
||||
@@ -218,7 +239,7 @@ may have been fixed since this was written!
|
||||
10. To get HTTP Negotiate authentication to work fine, you need to provide a
|
||||
(fake) user name (this concerns both curl and the lib) because the code
|
||||
wrongly only considers authentication if there's a user name provided.
|
||||
http://curl.haxx.se/bug/view.cgi?id=1004841. How?
|
||||
http://curl.haxx.se/bug/view.cgi?id=440 How?
|
||||
http://curl.haxx.se/mail/lib-2004-08/0182.html
|
||||
|
||||
8. Doing resumed upload over HTTP does not work with '-C -', because curl
|
||||
|
@@ -37,7 +37,7 @@ EXTRA_DIST = MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS SSLCERTS \
|
||||
README.win32 RESOURCES TODO TheArtOfHttpScripting THANKS VERSIONS \
|
||||
KNOWN_BUGS BINDINGS $(man_MANS) $(HTMLPAGES) HISTORY INSTALL \
|
||||
$(PDFPAGES) LICENSE-MIXING README.netware DISTRO-DILEMMA INSTALL.devcpp \
|
||||
MAIL-ETIQUETTE HTTP-COOKIES LIBCURL-STRUCTS
|
||||
MAIL-ETIQUETTE HTTP-COOKIES LIBCURL-STRUCTS SECURITY RELEASE-PROCEDURE
|
||||
|
||||
MAN2HTML= roffit < $< >$@
|
||||
|
||||
|
53
docs/RELEASE-PROCEDURE
Normal file
53
docs/RELEASE-PROCEDURE
Normal file
@@ -0,0 +1,53 @@
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
| (__| |_| | _ <| |___
|
||||
\___|\___/|_| \_\_____|
|
||||
|
||||
curl release procedure - how to do a release
|
||||
============================================
|
||||
|
||||
[in the source code repo]
|
||||
|
||||
- edit RELEASE-NOTES to be accurate
|
||||
|
||||
- update docs/THANKS
|
||||
|
||||
- make sure all relevant changes are committed on the master branch
|
||||
|
||||
- tag the git repo in this style: 'git tag -a curl-7_34_0'. -a annotates the
|
||||
tag and we use underscores instead of dots in the version number.
|
||||
|
||||
- run "./maketgz 7.34.0" to build the release tarballs. It is important that
|
||||
you run this on a machine with the correct set of autotools etc installed
|
||||
as this is what then will be shipped and used by most users on *nix like
|
||||
systems.
|
||||
|
||||
- push the git commits and the new tag
|
||||
|
||||
- gpg sign the 4 tarballs as maketgz suggests
|
||||
|
||||
- upload the 8 resulting files to the primary download directory
|
||||
|
||||
[data in the curl-www repo]
|
||||
|
||||
- edit Makefile (version number and date),
|
||||
_newslog.html (announce the new release) and
|
||||
_changes.html (insert changes+bugfixes from RELEASE-NOTES)
|
||||
|
||||
- commit all local changes
|
||||
|
||||
- tag the repo with the same tag as used for the source repo
|
||||
|
||||
- make sure all relevant changes are committed and pushed on the master branch
|
||||
|
||||
(the web site then updates its contents automatically)
|
||||
|
||||
[inform]
|
||||
|
||||
- send an email to curl-users, curl-announce and curl-library. Insert the
|
||||
RELEASE-NOTES into the mail.
|
||||
|
||||
[celebrate]
|
||||
|
||||
- suitable beverage intake is encouraged for the festivities
|
91
docs/SECURITY
Normal file
91
docs/SECURITY
Normal file
@@ -0,0 +1,91 @@
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
| (__| |_| | _ <| |___
|
||||
\___|\___/|_| \_\_____|
|
||||
|
||||
CURL SECURITY FOR DEVELOPERS
|
||||
|
||||
This document is intended to provide guidance to curl developers on how
|
||||
security vulnerabilities should be handled.
|
||||
|
||||
PUBLISHING INFORMATION
|
||||
|
||||
All known and public curl or libcurl related vulnerabilities are listed at
|
||||
http://curl.haxx.se/docs/security.html
|
||||
|
||||
Security vulnerabilities should not be entered in the project's public bug
|
||||
tracker unless the necessary configuration is in place to limit access to the
|
||||
issue to only the reporter and the project's security team.
|
||||
|
||||
VULNERABILITY HANDLING
|
||||
|
||||
The typical process for handling a new security vulnerability is as follows.
|
||||
|
||||
No information should be made public about a vulnerability until it is
|
||||
formally announced at the end of this process. That means, for example that a
|
||||
bug tracker entry must NOT be created to track the issue since that will make
|
||||
the issue public and it should not be discussed on any of the project's public
|
||||
mailing lists. Also messages associated with any commits should not make
|
||||
any reference to the security nature of the commit if done prior to the public
|
||||
announcement.
|
||||
|
||||
- The person discovering the issue, the reporter, reports the vulnerability
|
||||
privately to curl-security@haxx.se. That's an email alias that reaches a
|
||||
handful of selected and trusted people.
|
||||
|
||||
- Messages that do not relate to the reporting or managing of an undisclosed
|
||||
security vulnerability in curl or libcurl are ignored and no further action
|
||||
is required.
|
||||
|
||||
- A person in the security team sends an e-mail to the original reporter to
|
||||
acknowledge the report.
|
||||
|
||||
- The security team investigates the report and either rejects it or accepts
|
||||
it.
|
||||
|
||||
- If the report is rejected, the team writes to the reporter to explain why.
|
||||
|
||||
- If the report is accepted, the team writes to the reporter to let him/her
|
||||
know it is accepted and that they are working on a fix.
|
||||
|
||||
- The security team discusses the problem, works out a fix, considers the
|
||||
impact of the problem and suggests a release schedule. This discussion
|
||||
should involve the reporter as much as possible.
|
||||
|
||||
- The release of the information should be "as soon as possible" and is most
|
||||
often synced with an upcoming release that contains the fix. If the
|
||||
reporter, or anyone else, thinks the next planned release is too far away
|
||||
then a separate earlier release for security reasons should be considered.
|
||||
|
||||
- Write a security advisory draft about the problem that explains what the
|
||||
problem is, its impact, which versions it affects, solutions or
|
||||
work-arounds, when the release is out and make sure to credit all
|
||||
contributors properly.
|
||||
|
||||
- Request a CVE number from distros@openwall.org[1] when also informing and
|
||||
preparing them for the upcoming public security vulnerability announcement -
|
||||
attach the advisory draft for information. Note that 'distros' won't accept
|
||||
an embargo longer than 19 days.
|
||||
|
||||
- Update the "security advisory" with the CVE number.
|
||||
|
||||
- The security team commits the fix in a private branch. The commit message
|
||||
should ideally contain the CVE number. This fix is usually also distributed
|
||||
to the 'distros' mailing list to allow them to use the fix prior to the
|
||||
public announcement.
|
||||
|
||||
- At the day of the next release, the private branch is merged into the master
|
||||
branch and pushed. Once pushed, the information is accessible to the public
|
||||
and the actual release should follow suit immediately afterwards.
|
||||
|
||||
- The project team creates a release that includes the fix.
|
||||
|
||||
- The project team announces the release and the vulnerability to the world in
|
||||
the same manner we always announce releases. It gets sent to the
|
||||
curl-announce, curl-library and curl-users mailing lists.
|
||||
|
||||
- The security web page on the web site should get the new vulernability
|
||||
mentioned.
|
||||
|
||||
[1] = http://oss-security.openwall.org/wiki/mailing-lists/distros
|
47
docs/THANKS
47
docs/THANKS
@@ -27,6 +27,7 @@ Alessandro Vesely
|
||||
Alex Bligh
|
||||
Alex Fishman
|
||||
Alex Gruz
|
||||
Alex McLellan
|
||||
Alex Neblett
|
||||
Alex Suykov
|
||||
Alex Vinnik
|
||||
@@ -62,6 +63,7 @@ Andreas Schuldei
|
||||
Andreas Wurf
|
||||
Andrei Benea
|
||||
Andrei Cipu
|
||||
Andrej E Baranov
|
||||
Andres Garcia
|
||||
Andrew Benham
|
||||
Andrew Biggs
|
||||
@@ -109,9 +111,11 @@ Benbuck Nason
|
||||
Benjamin Gerard
|
||||
Benjamin Gilbert
|
||||
Benjamin Johnson
|
||||
Benoit Sigoure
|
||||
Bernard Leak
|
||||
Bernhard Reutner-Fischer
|
||||
Bertrand Demiddelaer
|
||||
Bill Doyle
|
||||
Bill Egert
|
||||
Bill Hoffman
|
||||
Bill Middlecamp
|
||||
@@ -154,6 +158,7 @@ Charles Kerr
|
||||
Chih-Chung Chang
|
||||
Chris "Bob Bob"
|
||||
Chris Combes
|
||||
Chris Conlon
|
||||
Chris Conroy
|
||||
Chris Deidun
|
||||
Chris Flerackers
|
||||
@@ -181,6 +186,7 @@ Clarence Gardner
|
||||
Clemens Gruber
|
||||
Clifford Wolf
|
||||
Cody Jones
|
||||
Colby Ranger
|
||||
Colin Hogben
|
||||
Colin Watson
|
||||
Colm Buckley
|
||||
@@ -194,6 +200,7 @@ Cristian Rodríguez
|
||||
Curt Bogmine
|
||||
Cyrill Osterwalder
|
||||
Cédric Deltheil
|
||||
D. Flinkmann
|
||||
Dag Ekengren
|
||||
Dagobert Michelsen
|
||||
Damien Adant
|
||||
@@ -221,6 +228,7 @@ Dave Halbakken
|
||||
Dave Hamilton
|
||||
Dave May
|
||||
Dave Reisner
|
||||
Dave Thompson
|
||||
Dave Vasilevsky
|
||||
David Bau
|
||||
David Binderman
|
||||
@@ -244,13 +252,16 @@ David Shaw
|
||||
David Strauss
|
||||
David Tarendash
|
||||
David Thiel
|
||||
David Walser
|
||||
David Wright
|
||||
David Yan
|
||||
Dengminwen
|
||||
Derek Higgins
|
||||
Detlef Schmier
|
||||
Didier Brisebourg
|
||||
Diego Casorran
|
||||
Dima Barsky
|
||||
Dima Tisnek
|
||||
Dimitre Dimitrov
|
||||
Dimitris Sarris
|
||||
Dinar
|
||||
@@ -289,6 +300,7 @@ Eelco Dolstra
|
||||
Eetu Ojanen
|
||||
Eldar Zaitov
|
||||
Ellis Pritchard
|
||||
Elmira A Semenova
|
||||
Emanuele Bovisio
|
||||
Emil Romanus
|
||||
Emiliano Ida
|
||||
@@ -298,6 +310,7 @@ Eric Cooper
|
||||
Eric Hu
|
||||
Eric Landes
|
||||
Eric Lavigne
|
||||
Eric Lubin
|
||||
Eric Melville
|
||||
Eric Mertens
|
||||
Eric Rautman
|
||||
@@ -318,10 +331,12 @@ Fabian Hiernaux
|
||||
Fabian Keil
|
||||
Fabrizio Ammollo
|
||||
Fedor Karpelevitch
|
||||
Felix Yan
|
||||
Felix von Leitner
|
||||
Feng Tu
|
||||
Florian Schoppmann
|
||||
Forrest Cahoon
|
||||
Francois Charlier
|
||||
Frank Hempel
|
||||
Frank Keeney
|
||||
Frank McGeough
|
||||
@@ -342,11 +357,13 @@ Gautam Kachroo
|
||||
Gautam Mani
|
||||
Gavrie Philipson
|
||||
Gaz Iqbal
|
||||
Geoff Beier
|
||||
Georg Horn
|
||||
Georg Huettenegger
|
||||
Georg Lippitsch
|
||||
Georg Wicherski
|
||||
Gerd v. Egidy
|
||||
Gergely Nagy
|
||||
Gerhard Herre
|
||||
Gerrit Bruchhäuser
|
||||
Ghennadi Procopciuc
|
||||
@@ -362,6 +379,8 @@ Giuseppe D'Ambrosio
|
||||
Glen Nakamura
|
||||
Glen Scott
|
||||
Gokhan Sengun
|
||||
Gordon Marler
|
||||
Gorilla Maguila
|
||||
Grant Erickson
|
||||
Greg Hewgill
|
||||
Greg Morse
|
||||
@@ -384,8 +403,10 @@ Hans-Jurgen May
|
||||
Hardeep Singh
|
||||
Harshal Pradhan
|
||||
Hauke Duden
|
||||
He Qin
|
||||
Heikki Korpela
|
||||
Heinrich Ko
|
||||
Heinrich Schaefer
|
||||
Hendrik Visage
|
||||
Henrik Storner
|
||||
Henry Ludemann
|
||||
@@ -422,6 +443,7 @@ James Bursa
|
||||
James Cheng
|
||||
James Clancy
|
||||
James Cone
|
||||
James Dury
|
||||
James Gallagher
|
||||
James Griffiths
|
||||
James Housley
|
||||
@@ -441,6 +463,7 @@ Jason Glasgow
|
||||
Jason Liu
|
||||
Jason McDonald
|
||||
Jason S. Priebe
|
||||
Javier Barroso
|
||||
Jay Austin
|
||||
Jayesh A Shah
|
||||
Jaz Fresh
|
||||
@@ -453,6 +476,7 @@ Jean-Noel Rouvignac
|
||||
Jean-Philippe Barrette-LaPierre
|
||||
Jeff Connelly
|
||||
Jeff Johnson
|
||||
Jeff King
|
||||
Jeff Lawson
|
||||
Jeff Phillips
|
||||
Jeff Pohlmeyer
|
||||
@@ -462,6 +486,7 @@ Jeremy Friesner
|
||||
Jeremy Huddleston
|
||||
Jerome Muffat-Meridol
|
||||
Jerome Vouillon
|
||||
Jerry Krinock
|
||||
Jerry Wu
|
||||
Jes Badwal
|
||||
Jesper Jensen
|
||||
@@ -486,6 +511,7 @@ Johannes Bauer
|
||||
John Bradshaw
|
||||
John Crow
|
||||
John Dennis
|
||||
John Dunn
|
||||
John E. Malmberg
|
||||
John Gardiner Myers
|
||||
John Janssen
|
||||
@@ -569,6 +595,7 @@ Krishnendu Majumdar
|
||||
Krister Johansen
|
||||
Kristian Gunstone
|
||||
Kristian Köhntopp
|
||||
Kyle L. Huff
|
||||
Kyle Sallee
|
||||
Lachlan O'Dea
|
||||
Larry Campbell
|
||||
@@ -611,6 +638,7 @@ Mandy Wu
|
||||
Manfred Schwarb
|
||||
Manuel Massing
|
||||
Marc Boucher
|
||||
Marc Deslauriers
|
||||
Marc Doughty
|
||||
Marc Hoersken
|
||||
Marc Kleine-Budde
|
||||
@@ -618,6 +646,7 @@ Marcel Raad
|
||||
Marcel Roelofs
|
||||
Marcelo Juchem
|
||||
Marcin Adamski
|
||||
Marcin Gryszkalis
|
||||
Marcin Konicki
|
||||
Marco G. Salvagno
|
||||
Marco Maggi
|
||||
@@ -672,6 +701,7 @@ Maxim Prohorov
|
||||
Maxime Larocque
|
||||
Mehmet Bozkurt
|
||||
Mekonikum
|
||||
Melissa Mears
|
||||
Mettgut Jamalla
|
||||
Michael Benedict
|
||||
Michael Calmer
|
||||
@@ -683,6 +713,7 @@ Michael Jahn
|
||||
Michael Jerris
|
||||
Michael Mealling
|
||||
Michael Mueller
|
||||
Michael Osipov
|
||||
Michael Smith
|
||||
Michael Stillwell
|
||||
Michael Wallner
|
||||
@@ -700,6 +731,7 @@ Mike Crowe
|
||||
Mike Dobbs
|
||||
Mike Giancola
|
||||
Mike Hommey
|
||||
Mike Mio
|
||||
Mike Power
|
||||
Mike Protts
|
||||
Mike Revi
|
||||
@@ -744,6 +776,7 @@ Olaf Flebbe
|
||||
Olaf Stueben
|
||||
Olaf Stüben
|
||||
Oliver Gondža
|
||||
Oliver Kuckertz
|
||||
Olivier Berger
|
||||
Oren Tirosh
|
||||
Ori Avtalion
|
||||
@@ -762,8 +795,10 @@ Patrick Scott
|
||||
Patrick Smith
|
||||
Patrik Thunstrom
|
||||
Pau Garcia i Quiles
|
||||
Paul Donohue
|
||||
Paul Harrington
|
||||
Paul Howarth
|
||||
Paul Marks
|
||||
Paul Marquis
|
||||
Paul Moore
|
||||
Paul Nolan
|
||||
@@ -792,6 +827,8 @@ Peter Todd
|
||||
Peter Verhas
|
||||
Peter Wullinger
|
||||
Peteris Krumins
|
||||
Petr Bahula
|
||||
Petr Pisar
|
||||
Phil Blundell
|
||||
Phil Karn
|
||||
Phil Lisiecki
|
||||
@@ -875,6 +912,7 @@ Roland Zimmermann
|
||||
Rolland Dudemaine
|
||||
Roman Koifman
|
||||
Roman Mamedov
|
||||
Romulo A. Ceccon
|
||||
Ron Zapp
|
||||
Rosimildo da Silva
|
||||
Roy Shan
|
||||
@@ -884,6 +922,7 @@ Rutger Hofman
|
||||
Ryan Chan
|
||||
Ryan Nelson
|
||||
Ryan Schmidt
|
||||
Rémy Léone
|
||||
S. Moonesamy
|
||||
Salvador Dávila
|
||||
Salvatore Sorrentino
|
||||
@@ -909,11 +948,13 @@ Sebastian Rasmussen
|
||||
Sebastien Willemijns
|
||||
Senthil Raja Velu
|
||||
Sergei Nikulov
|
||||
Sergey Tatarincev
|
||||
Sergio Ballestrero
|
||||
Seshubabu Pasam
|
||||
Sh Diao
|
||||
Sharad Gupta
|
||||
Shard
|
||||
Shawn Landden
|
||||
Shawn Poulson
|
||||
Shmulik Regev
|
||||
Siddhartha Prakash Jain
|
||||
@@ -997,6 +1038,7 @@ Tom Mueller
|
||||
Tom Regner
|
||||
Tom Wright
|
||||
Tom Zerucha
|
||||
Tomas Hoger
|
||||
Tomas Mlcoch
|
||||
Tomas Pospisek
|
||||
Tomas Szepe
|
||||
@@ -1014,7 +1056,9 @@ Traian Nicolescu
|
||||
Troels Walsted Hansen
|
||||
Troy Engel
|
||||
Tupone Alfredo
|
||||
Tyler Hall
|
||||
Ulf Härnhammar
|
||||
Ulf Samuelsson
|
||||
Ulrich Doehner
|
||||
Ulrich Zadow
|
||||
Venkat Akella
|
||||
@@ -1041,15 +1085,18 @@ Wesley Laxton
|
||||
Wesley Miaw
|
||||
Wez Furlong
|
||||
Wilfredo Sanchez
|
||||
Will Dietz
|
||||
Willem Sparreboom
|
||||
Wojciech Zwiefka
|
||||
Wouter Van Rooy
|
||||
Wu Yongzheng
|
||||
Xavier Bouchoux
|
||||
Yaakov Selkowitz
|
||||
Yamada Yasuharu
|
||||
Yang Tse
|
||||
Yarram Sunil
|
||||
Yehoshua Hershberg
|
||||
Yi Huang
|
||||
Yukihiro Kawada
|
||||
Yuriy Sosov
|
||||
Yves Arrouye
|
||||
|
104
docs/TODO
104
docs/TODO
@@ -16,8 +16,9 @@
|
||||
1.3 struct lifreq
|
||||
1.4 signal-based resolver timeouts
|
||||
1.5 get rid of PATH_MAX
|
||||
1.6 Happy Eyeball dual stack connect
|
||||
1.7 Modified buffer size approach
|
||||
1.6 Modified buffer size approach
|
||||
1.7 Detect when called from witin callbacks
|
||||
1.8 Allow SSL (HTTPS) to proxy
|
||||
|
||||
2. libcurl - multi interface
|
||||
2.1 More non-blocking
|
||||
@@ -31,14 +32,14 @@
|
||||
4.2 Alter passive/active on failure and retry
|
||||
4.3 Earlier bad letter detection
|
||||
4.4 REST for large files
|
||||
4.5 FTP proxy support
|
||||
4.6 ASCII support
|
||||
4.5 ASCII support
|
||||
|
||||
5. HTTP
|
||||
5.1 Better persistency for HTTP 1.0
|
||||
5.2 support FF3 sqlite cookie files
|
||||
5.3 Rearrange request header order
|
||||
5.4 HTTP2/SPDY
|
||||
5.5 auth= in URLs
|
||||
|
||||
6. TELNET
|
||||
6.1 ditch stdin
|
||||
@@ -48,17 +49,14 @@
|
||||
|
||||
7. SMTP
|
||||
7.1 Pipelining
|
||||
7.2 Graceful base64 decoding failure
|
||||
7.3 Enhanced capability support
|
||||
7.2 Enhanced capability support
|
||||
|
||||
8. POP3
|
||||
8.1 Pipelining
|
||||
8.2 Graceful base64 decoding failure
|
||||
8.3 Enhanced capability support
|
||||
8.2 Enhanced capability support
|
||||
|
||||
9. IMAP
|
||||
9.1 Graceful base64 decoding failure
|
||||
9.2 Enhanced capability support
|
||||
9.1 Enhanced capability support
|
||||
|
||||
10. LDAP
|
||||
10.1 SASL based authentication mechanisms
|
||||
@@ -73,9 +71,8 @@
|
||||
12.4 Cache OpenSSL contexts
|
||||
12.5 Export session ids
|
||||
12.6 Provide callback for cert verification
|
||||
12.7 Support other SSL libraries
|
||||
12.8 improve configure --with-ssl
|
||||
12.9 Support DANE
|
||||
12.7 improve configure --with-ssl
|
||||
12.8 Support DANE
|
||||
|
||||
13. GnuTLS
|
||||
13.1 SSL engine stuff
|
||||
@@ -157,19 +154,7 @@
|
||||
we need libssh2 to properly tell us when we pass in a too small buffer and
|
||||
its current API (as of libssh2 1.2.7) doesn't.
|
||||
|
||||
1.6 Happy Eyeball dual stack connect
|
||||
|
||||
In order to make alternative technologies not suffer when transitioning, like
|
||||
when introducing IPv6 as an alternative to IPv4 and there are more than one
|
||||
option existing simultaneously there are reasons to reconsider internal
|
||||
choices.
|
||||
|
||||
To make libcurl do blazing fast IPv6 in a dual-stack configuration, this needs
|
||||
to be addressed:
|
||||
|
||||
http://tools.ietf.org/html/rfc6555
|
||||
|
||||
1.7 Modified buffer size approach
|
||||
1.6 Modified buffer size approach
|
||||
|
||||
Current libcurl allocates a fixed 16K size buffer for download and an
|
||||
additional 16K for upload. They are always unconditionally part of the easy
|
||||
@@ -190,6 +175,18 @@
|
||||
Dynamically allocate buffer size depending on protocol in use in combination
|
||||
with freeing it after each individual transfer? Other suggestions?
|
||||
|
||||
1.7 Detect when called from witin callbacks
|
||||
|
||||
We should set a state variable before calling callbacks, so that we
|
||||
subsequently can add code within libcurl that returns error if called within
|
||||
callbacks for when that's not supported.
|
||||
|
||||
1.8 Allow SSL (HTTPS) to proxy
|
||||
|
||||
To prevent local users from snooping on your traffic to the proxy. Supported
|
||||
by Chrome already:
|
||||
http://www.chromium.org/developers/design-documents/secure-web-proxy
|
||||
|
||||
|
||||
2. libcurl - multi interface
|
||||
|
||||
@@ -246,13 +243,7 @@
|
||||
the server doesn't set the pointer to the requested index. The tricky
|
||||
(impossible?) part is to figure out if the server did the right thing or not.
|
||||
|
||||
4.5 FTP proxy support
|
||||
|
||||
Support the most common FTP proxies, Philip Newton provided a list allegedly
|
||||
from ncftp. This is not a subject without debate, and is probably not really
|
||||
suitable for libcurl. http://curl.haxx.se/mail/archive-2003-04/0126.html
|
||||
|
||||
4.6 ASCII support
|
||||
4.5 ASCII support
|
||||
|
||||
FTP ASCII transfers do not follow RFC959. They don't convert the data
|
||||
accordingly.
|
||||
@@ -300,6 +291,17 @@
|
||||
be a better option, either used directly or wrapped with a more spindly-like
|
||||
API.
|
||||
|
||||
5.5 auth= in URLs
|
||||
|
||||
Add the ability to specify the preferred authentication mechanism to use by
|
||||
using ;auth=<mech> in the login part of the URL.
|
||||
|
||||
For example:
|
||||
|
||||
http://test:pass;auth=NTLM@example.com would be equivalent to specifing --user
|
||||
test:pass;auth=NTLM or --user test:pass --ntlm from the command line.
|
||||
|
||||
Additionally this should be implemented for proxy base URLs as well.
|
||||
|
||||
6. TELNET
|
||||
|
||||
@@ -331,14 +333,7 @@ to provide the data to send.
|
||||
|
||||
Add support for pipelining emails.
|
||||
|
||||
7.2 Graceful base64 decoding failure
|
||||
|
||||
Rather than shutting down the session and returning an error when the
|
||||
decoding of a base64 encoded authentication response fails, we should
|
||||
gracefully shutdown the authentication process by sending a * response to the
|
||||
server as per RFC4954.
|
||||
|
||||
7.3 Enhanced capability support
|
||||
7.2 Enhanced capability support
|
||||
|
||||
Add the ability, for an application that uses libcurl, to obtain the list of
|
||||
capabilities returned from the EHLO command.
|
||||
@@ -349,28 +344,14 @@ to provide the data to send.
|
||||
|
||||
Add support for pipelining commands.
|
||||
|
||||
8.2 Graceful base64 decoding failure
|
||||
|
||||
Rather than shutting down the session and returning an error when the
|
||||
decoding of a base64 encoded authentication response fails, we should
|
||||
gracefully shutdown the authentication process by sending a * response to the
|
||||
server as per RFC5034.
|
||||
|
||||
8.3 Enhanced capability support
|
||||
8.2 Enhanced capability support
|
||||
|
||||
Add the ability, for an application that uses libcurl, to obtain the list of
|
||||
capabilities returned from the CAPA command.
|
||||
|
||||
9. IMAP
|
||||
|
||||
9.1 Graceful base64 decoding failure
|
||||
|
||||
Rather than shutting down the session and returning an error when the
|
||||
decoding of a base64 encoded authentication response fails, we should
|
||||
gracefully shutdown the authentication process by sending a * response to the
|
||||
server as per RFC3501.
|
||||
|
||||
9.2 Enhanced capability support
|
||||
9.1 Enhanced capability support
|
||||
|
||||
Add the ability, for an application that uses libcurl, to obtain the list of
|
||||
capabilities returned from the CAPABILITY command.
|
||||
@@ -434,17 +415,12 @@ to provide the data to send.
|
||||
certificate, but this doesn't seem to be exposed in the libcurl APIs. Could
|
||||
it be? There's so much that could be done if it were!
|
||||
|
||||
12.7 Support other SSL libraries
|
||||
|
||||
Make curl's SSL layer capable of using other free SSL libraries. Such as
|
||||
MatrixSSL (http://www.matrixssl.org/).
|
||||
|
||||
12.8 improve configure --with-ssl
|
||||
12.7 improve configure --with-ssl
|
||||
|
||||
make the configure --with-ssl option first check for OpenSSL, then GnuTLS,
|
||||
then NSS...
|
||||
|
||||
12.9 Support DANE
|
||||
12.8 Support DANE
|
||||
|
||||
DNS-Based Authentication of Named Entities (DANE) is a way to provide SSL
|
||||
keys and certs over DNS using DNSSEC as an alternative to the CA model.
|
||||
|
@@ -1,16 +1,72 @@
|
||||
Online: http://curl.haxx.se/docs/httpscripting.html
|
||||
Date: Jan 19, 2011
|
||||
Updated: Dec 24, 2013 (http://curl.haxx.se/docs/httpscripting.html)
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
| (__| |_| | _ <| |___
|
||||
\___|\___/|_| \_\_____|
|
||||
|
||||
The Art Of Scripting HTTP Requests Using Curl
|
||||
=============================================
|
||||
|
||||
This document will assume that you're familiar with HTML and general
|
||||
networking.
|
||||
The Art Of Scripting HTTP Requests Using Curl
|
||||
|
||||
The possibility to write scripts is essential to make a good computer
|
||||
system. Unix' capability to be extended by shell scripts and various tools to
|
||||
run various automated commands and scripts is one reason why it has succeeded
|
||||
so well.
|
||||
1. HTTP Scripting
|
||||
1.1 Background
|
||||
1.2 The HTTP Protocol
|
||||
1.3 See the Protocol
|
||||
1.4 See the Timing
|
||||
1.5 See the Response
|
||||
2. URL
|
||||
2.1 Spec
|
||||
2.2 Host
|
||||
2.3 Port number
|
||||
2.4 User name and password
|
||||
2.5 Path part
|
||||
3. Fetch a page
|
||||
3.1 GET
|
||||
3.2 HEAD
|
||||
4. HTML forms
|
||||
4.1 Forms explained
|
||||
4.2 GET
|
||||
4.3 POST
|
||||
4.4 File Upload POST
|
||||
4.5 Hidden Fields
|
||||
4.6 Figure Out What A POST Looks Like
|
||||
5. HTTP upload
|
||||
5.1 PUT
|
||||
6. HTTP Authentication
|
||||
6.1 Basic Authentication
|
||||
6.2 Other Authentication
|
||||
6.3 Proxy Authentication
|
||||
6.4 Hiding credentials
|
||||
7. More HTTP Headers
|
||||
7.1 Referer
|
||||
7.2 User Agent
|
||||
8. Redirects
|
||||
8.1 Location header
|
||||
8.2 Other redirects
|
||||
9. Cookies
|
||||
9.1 Cookie Basics
|
||||
9.2 Cookie options
|
||||
10. HTTPS
|
||||
10.1 HTTPS is HTTP secure
|
||||
10.2 Certificates
|
||||
11. Custom Request Elements
|
||||
11.1 Modify method and headers
|
||||
11.2 More on changed methods
|
||||
12. Web Login
|
||||
12.1 Some login tricks
|
||||
13. Debug
|
||||
13.1 Some debug tricks
|
||||
14. References
|
||||
14.1 Standards
|
||||
14.2 Sites
|
||||
|
||||
==============================================================================
|
||||
|
||||
1. HTTP Scripting
|
||||
|
||||
1.1 Background
|
||||
|
||||
This document assumes that you're familiar with HTML and general networking.
|
||||
|
||||
The increasing amount of applications moving to the web has made "HTTP
|
||||
Scripting" more frequently requested and wanted. To be able to automatically
|
||||
@@ -27,7 +83,7 @@ Date: Jan 19, 2011
|
||||
to glue everything together using some kind of script language or repeated
|
||||
manual invokes.
|
||||
|
||||
1. The HTTP Protocol
|
||||
1.2 The HTTP Protocol
|
||||
|
||||
HTTP is the protocol used to fetch data from web servers. It is a very simple
|
||||
protocol that is built upon TCP/IP. The protocol also allows information to
|
||||
@@ -44,7 +100,7 @@ Date: Jan 19, 2011
|
||||
well), response headers and most often also a response body. The "body" part
|
||||
is the plain data you requested, like the actual HTML or the image etc.
|
||||
|
||||
1.1 See the Protocol
|
||||
1.3 See the Protocol
|
||||
|
||||
Using curl's option --verbose (-v as a short option) will display what kind
|
||||
of commands curl sends to the server, as well as a few other informational
|
||||
@@ -59,13 +115,88 @@ Date: Jan 19, 2011
|
||||
|
||||
curl --trace-ascii debugdump.txt http://www.example.com/
|
||||
|
||||
1.4 See the Timing
|
||||
|
||||
Many times you may wonder what exactly is taking all the time, or you just
|
||||
want to know the amount of milliseconds between two points in a
|
||||
transfer. For those, and other similar situations, the --trace-time option
|
||||
is what you need. It'll prepend the time to each trace output line:
|
||||
|
||||
curl --trace-ascii d.txt --trace-time http://example.com/
|
||||
|
||||
1.5 See the Response
|
||||
|
||||
By default curl sends the response to stdout. You need to redirect it
|
||||
somewhere to avoid that, most often that is done with -o or -O.
|
||||
|
||||
2. URL
|
||||
|
||||
2.1 Spec
|
||||
|
||||
The Uniform Resource Locator format is how you specify the address of a
|
||||
particular resource on the Internet. You know these, you've seen URLs like
|
||||
http://curl.haxx.se or https://yourbank.com a million times.
|
||||
http://curl.haxx.se or https://yourbank.com a million times. RFC 3986 is the
|
||||
canonical spec.
|
||||
|
||||
3. GET a page
|
||||
2.2 Host
|
||||
|
||||
The host name is usually resolved using DNS or your /etc/hosts file to an IP
|
||||
address and that's what curl will communicate with. Alternatively you specify
|
||||
the IP address directly in the URL instead of a name.
|
||||
|
||||
For development and other trying out situation, you can point out a different
|
||||
IP address for a host name than what would otherwise be used, by using curl's
|
||||
--resolve option:
|
||||
|
||||
curl --resolve www.example.org:80:127.0.0.1 http://www.example.org/
|
||||
|
||||
2.3 Port number
|
||||
|
||||
Each protocol curl supports operate on a default port number, be it over TCP
|
||||
or in some cases UDP. Normally you don't have to take that into
|
||||
consideration, but at times you run test servers on other ports or
|
||||
similar. Then you can specify the port number in the URL with a colon and a
|
||||
number immediately following the host name. Like when doing HTTP to port
|
||||
1234:
|
||||
|
||||
curl http://www.example.org:1234/
|
||||
|
||||
The port number you specify in the URL is the number that the server uses to
|
||||
offer its services. Sometimes you may use a local proxy, and then you may
|
||||
need to specify that proxy's port number separate on what curl needs to
|
||||
connect to locally. Like when using a HTTP proxy on port 4321:
|
||||
|
||||
curl --proxy http://proxy.example.org:4321 http://remote.example.org/
|
||||
|
||||
2.4 User name and password
|
||||
|
||||
Some services are setup to require HTTP authentication and then you need to
|
||||
provide name and password which then is transfered to the remote site in
|
||||
various ways depending on the exact authentication protocol used.
|
||||
|
||||
You can opt to either insert the user and password in the URL or you can
|
||||
provide them separately:
|
||||
|
||||
curl http://user:password@example.org/
|
||||
|
||||
or
|
||||
|
||||
curl -u user:password http://example.org/
|
||||
|
||||
You need to pay attention that this kind of HTTP authentication is not what
|
||||
is usually done and requested by user-oriented web sites these days. They
|
||||
tend to use forms and cookies instead.
|
||||
|
||||
2.5 Path part
|
||||
|
||||
The path part is just sent off to the server to request that it sends back
|
||||
the associated response. The path is what is to the right side of the slash
|
||||
that follows the host name and possibly port number.
|
||||
|
||||
|
||||
3. Fetch a page
|
||||
|
||||
3.1 GET
|
||||
|
||||
The simplest and most common request/operation made using HTTP is to get a
|
||||
URL. The URL could itself refer to a web page, an image or a file. The client
|
||||
@@ -79,10 +210,23 @@ Date: Jan 19, 2011
|
||||
|
||||
All HTTP replies contain a set of response headers that are normally hidden,
|
||||
use curl's --include (-i) option to display them as well as the rest of the
|
||||
document. You can also ask the remote server for ONLY the headers by using
|
||||
the --head (-I) option (which will make curl issue a HEAD request).
|
||||
document.
|
||||
|
||||
4. Forms
|
||||
3.2 HEAD
|
||||
|
||||
You can ask the remote server for ONLY the headers by using the --head (-I)
|
||||
option which will make curl issue a HEAD request. In some special cases
|
||||
servers deny the HEAD method while others still work, which is a particular
|
||||
kind of annoyance.
|
||||
|
||||
The HEAD method is defined and made so that the server returns the headers
|
||||
exactly the way it would do for a GET, but without a body. It means that you
|
||||
may see a Content-Length: in the response headers, but there must not be an
|
||||
actual body in the HEAD response.
|
||||
|
||||
4. HTML forms
|
||||
|
||||
4.1 Forms explained
|
||||
|
||||
Forms are the general way a web site can present a HTML page with fields for
|
||||
the user to enter data in, and then press some kind of 'OK' or 'submit'
|
||||
@@ -95,7 +239,7 @@ Date: Jan 19, 2011
|
||||
Of course there has to be some kind of program in the server end to receive
|
||||
the data you send. You cannot just invent something out of the air.
|
||||
|
||||
4.1 GET
|
||||
4.2 GET
|
||||
|
||||
A GET-form uses the method GET, as specified in HTML like:
|
||||
|
||||
@@ -121,7 +265,7 @@ Date: Jan 19, 2011
|
||||
|
||||
curl "http://www.hotmail.com/when/junk.cgi?birthyear=1905&press=OK"
|
||||
|
||||
4.2 POST
|
||||
4.3 POST
|
||||
|
||||
The GET method makes all input field names get displayed in the URL field of
|
||||
your browser. That's generally a good thing when you want to be able to
|
||||
@@ -158,7 +302,7 @@ Date: Jan 19, 2011
|
||||
|
||||
curl --data-urlencode "name=I am Daniel" http://www.example.com
|
||||
|
||||
4.3 File Upload POST
|
||||
4.4 File Upload POST
|
||||
|
||||
Back in late 1995 they defined an additional way to post data over HTTP. It
|
||||
is documented in the RFC 1867, why this method sometimes is referred to as
|
||||
@@ -179,7 +323,7 @@ Date: Jan 19, 2011
|
||||
|
||||
curl --form upload=@localfilename --form press=OK [URL]
|
||||
|
||||
4.4 Hidden Fields
|
||||
4.5 Hidden Fields
|
||||
|
||||
A very common way for HTML based application to pass state information
|
||||
between pages is to add hidden fields to the forms. Hidden fields are
|
||||
@@ -200,7 +344,7 @@ Date: Jan 19, 2011
|
||||
|
||||
curl --data "birthyear=1905&press=OK&person=daniel" [URL]
|
||||
|
||||
4.5 Figure Out What A POST Looks Like
|
||||
4.6 Figure Out What A POST Looks Like
|
||||
|
||||
When you're about fill in a form and send to a server by using curl instead
|
||||
of a browser, you're of course very interested in sending a POST exactly the
|
||||
@@ -213,7 +357,9 @@ Date: Jan 19, 2011
|
||||
You will then clearly see the data get appended to the URL, separated with a
|
||||
'?'-letter as GET forms are supposed to.
|
||||
|
||||
5. PUT
|
||||
5. HTTP upload
|
||||
|
||||
5.1 PUT
|
||||
|
||||
The perhaps best way to upload data to a HTTP server is to use PUT. Then
|
||||
again, this of course requires that someone put a program or script on the
|
||||
@@ -225,6 +371,8 @@ Date: Jan 19, 2011
|
||||
|
||||
6. HTTP Authentication
|
||||
|
||||
6.1 Basic Authentication
|
||||
|
||||
HTTP Authentication is the ability to tell the server your username and
|
||||
password so that it can verify that you're allowed to do the request you're
|
||||
doing. The Basic authentication used in HTTP (which is the type curl uses by
|
||||
@@ -236,10 +384,14 @@ Date: Jan 19, 2011
|
||||
|
||||
curl --user name:password http://www.example.com
|
||||
|
||||
6.2 Other Authentication
|
||||
|
||||
The site might require a different authentication method (check the headers
|
||||
returned by the server), and then --ntlm, --digest, --negotiate or even
|
||||
--anyauth might be options that suit you.
|
||||
|
||||
6.3 Proxy Authentication
|
||||
|
||||
Sometimes your HTTP access is only available through the use of a HTTP
|
||||
proxy. This seems to be especially common at various companies. A HTTP proxy
|
||||
may require its own user and password to allow the client to get through to
|
||||
@@ -253,6 +405,8 @@ Date: Jan 19, 2011
|
||||
If you use any one these user+password options but leave out the password
|
||||
part, curl will prompt for the password interactively.
|
||||
|
||||
6.4 Hiding credentials
|
||||
|
||||
Do note that when a program is run, its parameters might be possible to see
|
||||
when listing the running processes of the system. Thus, other users may be
|
||||
able to watch your passwords if you pass them as plain command line
|
||||
@@ -262,7 +416,9 @@ Date: Jan 19, 2011
|
||||
many web sites will not use this concept when they provide logins etc. See
|
||||
the Web Login chapter further below for more details on that.
|
||||
|
||||
7. Referer
|
||||
7. More HTTP Headers
|
||||
|
||||
7.1 Referer
|
||||
|
||||
A HTTP request may include a 'referer' field (yes it is misspelled), which
|
||||
can be used to tell from which URL the client got to this particular
|
||||
@@ -276,7 +432,7 @@ Date: Jan 19, 2011
|
||||
|
||||
curl --referer http://www.example.come http://www.example.com
|
||||
|
||||
8. User Agent
|
||||
7.2 User Agent
|
||||
|
||||
Very similar to the referer field, all HTTP requests may set the User-Agent
|
||||
field. It names what user agent (client) that is being used. Many
|
||||
@@ -298,7 +454,9 @@ Date: Jan 19, 2011
|
||||
|
||||
curl --user-agent "Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" [URL]
|
||||
|
||||
9. Redirects
|
||||
8. Redirects
|
||||
|
||||
8.1 Location header
|
||||
|
||||
When a resource is requested from a server, the reply from the server may
|
||||
include a hint about where the browser should go next to find this page, or a
|
||||
@@ -318,7 +476,16 @@ Date: Jan 19, 2011
|
||||
only use POST in the first request, and then revert to GET in the following
|
||||
operations.
|
||||
|
||||
10. Cookies
|
||||
8.2 Other redirects
|
||||
|
||||
Browser typically support at least two other ways of redirects that curl
|
||||
doesn't: first the html may contain a meta refresh tag that asks the browser
|
||||
to load a specific URL after a set number of seconds, or it may use
|
||||
javascript to do it.
|
||||
|
||||
9. Cookies
|
||||
|
||||
9.1 Cookie Basics
|
||||
|
||||
The way the web browsers do "client side state control" is by using
|
||||
cookies. Cookies are just names with associated contents. The cookies are
|
||||
@@ -335,6 +502,8 @@ Date: Jan 19, 2011
|
||||
must be able to record and send back cookies the way the web application
|
||||
expects them. The same way browsers deal with them.
|
||||
|
||||
9.2 Cookie options
|
||||
|
||||
The simplest way to send a few cookies to the server when getting a page with
|
||||
curl is to add them on the command line like:
|
||||
|
||||
@@ -366,16 +535,18 @@ Date: Jan 19, 2011
|
||||
curl --cookie nada --location http://www.example.com
|
||||
|
||||
Curl has the ability to read and write cookie files that use the same file
|
||||
format that Netscape and Mozilla do. It is a convenient way to share cookies
|
||||
between browsers and automatic scripts. The --cookie (-b) switch
|
||||
automatically detects if a given file is such a cookie file and parses it,
|
||||
and by using the --cookie-jar (-c) option you'll make curl write a new cookie
|
||||
file at the end of an operation:
|
||||
format that Netscape and Mozilla once used. It is a convenient way to share
|
||||
cookies between scripts or invokes. The --cookie (-b) switch automatically
|
||||
detects if a given file is such a cookie file and parses it, and by using the
|
||||
--cookie-jar (-c) option you'll make curl write a new cookie file at the end
|
||||
of an operation:
|
||||
|
||||
curl --cookie cookies.txt --cookie-jar newcookies.txt \
|
||||
http://www.example.com
|
||||
|
||||
11. HTTPS
|
||||
10. HTTPS
|
||||
|
||||
10.1 HTTPS is HTTP secure
|
||||
|
||||
There are a few ways to do secure HTTP transfers. The by far most common
|
||||
protocol for doing this is what is generally known as HTTPS, HTTP over
|
||||
@@ -391,7 +562,7 @@ Date: Jan 19, 2011
|
||||
|
||||
curl https://secure.example.com
|
||||
|
||||
11.1 Certificates
|
||||
10.2 Certificates
|
||||
|
||||
In the HTTPS world, you use certificates to validate that you are the one
|
||||
you claim to be, as an addition to normal passwords. Curl supports client-
|
||||
@@ -413,7 +584,9 @@ Date: Jan 19, 2011
|
||||
|
||||
http://curl.haxx.se/docs/sslcerts.html
|
||||
|
||||
12. Custom Request Elements
|
||||
11. Custom Request Elements
|
||||
|
||||
11.1 Modify method and headers
|
||||
|
||||
Doing fancy stuff, you may need to add or change elements of a single curl
|
||||
request.
|
||||
@@ -434,7 +607,26 @@ Date: Jan 19, 2011
|
||||
|
||||
curl --header "Destination: http://nowhere" http://example.com
|
||||
|
||||
13. Web Login
|
||||
11.2 More on changed methods
|
||||
|
||||
It should be noted that curl selects which methods to use on its own
|
||||
depending on what action to ask for. -d will do POST, -I will do HEAD and so
|
||||
on. If you use the --request / -X option you can change the method keyword
|
||||
curl selects, but you will not modify curl's behavior. This means that if you
|
||||
for example use -d "data" to do a POST, you can modify the method to a
|
||||
PROPFIND with -X and curl will still think it sends a POST. You can change
|
||||
the normal GET to a POST method by simply adding -X POST in a command line
|
||||
like:
|
||||
|
||||
curl -X POST http://example.org/
|
||||
|
||||
... but curl will still think and act as if it sent a GET so it won't send any
|
||||
request body etc.
|
||||
|
||||
|
||||
12. Web Login
|
||||
|
||||
12.1 Some login tricks
|
||||
|
||||
While not strictly just HTTP related, it still cause a lot of people problems
|
||||
so here's the executive run-down of how the vast majority of all login forms
|
||||
@@ -463,7 +655,9 @@ Date: Jan 19, 2011
|
||||
to do a proper login POST. Remember that the contents need to be URL encoded
|
||||
when sent in a normal POST.
|
||||
|
||||
14. Debug
|
||||
13. Debug
|
||||
|
||||
13.1 Some debug tricks
|
||||
|
||||
Many times when you run curl on a site, you'll notice that the site doesn't
|
||||
seem to respond the same way to your curl requests as it does to your
|
||||
@@ -473,35 +667,40 @@ Date: Jan 19, 2011
|
||||
browser's requests:
|
||||
|
||||
* Use the --trace-ascii option to store fully detailed logs of the requests
|
||||
for easier analyzing and better understanding
|
||||
for easier analyzing and better understanding
|
||||
|
||||
* Make sure you check for and use cookies when needed (both reading with
|
||||
--cookie and writing with --cookie-jar)
|
||||
--cookie and writing with --cookie-jar)
|
||||
|
||||
* Set user-agent to one like a recent popular browser does
|
||||
|
||||
* Set referer like it is set by the browser
|
||||
|
||||
* If you use POST, make sure you send all the fields and in the same order as
|
||||
the browser does it. (See chapter 4.5 above)
|
||||
the browser does it.
|
||||
|
||||
A very good helper to make sure you do this right, is the LiveHTTPHeader tool
|
||||
that lets you view all headers you send and receive with Mozilla/Firefox
|
||||
(even when using HTTPS).
|
||||
(even when using HTTPS). Chrome features similar functionality out of the box
|
||||
among the developer's tools.
|
||||
|
||||
A more raw approach is to capture the HTTP traffic on the network with tools
|
||||
such as ethereal or tcpdump and check what headers that were sent and
|
||||
received by the browser. (HTTPS makes this technique inefficient.)
|
||||
|
||||
15. References
|
||||
14. References
|
||||
|
||||
14.1 Standards
|
||||
|
||||
RFC 2616 is a must to read if you want in-depth understanding of the HTTP
|
||||
protocol.
|
||||
protocol
|
||||
|
||||
RFC 3986 explains the URL syntax.
|
||||
RFC 3986 explains the URL syntax
|
||||
|
||||
RFC 2109 defines how cookies are supposed to work.
|
||||
RFC 1867 defines the HTTP post upload format
|
||||
|
||||
RFC 1867 defines the HTTP post upload format.
|
||||
RFC 6525 defines how HTTP cookies work
|
||||
|
||||
14.2 Sites
|
||||
|
||||
http://curl.haxx.se is the home of the cURL project
|
||||
|
236
docs/curl.1
236
docs/curl.1
@@ -103,6 +103,18 @@ any response data to the terminal.
|
||||
If you prefer a progress "bar" instead of the regular meter, \fI-#\fP is your
|
||||
friend.
|
||||
.SH OPTIONS
|
||||
Options start with one or two dashes. Many of the options require an addition
|
||||
value next to it.
|
||||
|
||||
The short "single-dash" form of the options, -d for example, may be used with
|
||||
or without a space between it and its value, although a space is a recommended
|
||||
separator. The long "double-dash" form, --data for example, requires a space
|
||||
between it and its value.
|
||||
|
||||
Short version options that don't need any additional values can be used
|
||||
immediately next to each other, like for example you can specify all the
|
||||
options -O, -L and -v at once as -OLv.
|
||||
|
||||
In general, all boolean options are enabled with --\fBoption\fP and yet again
|
||||
disabled with --\fBno-\fPoption. That is, you use the exact same option name
|
||||
but prefix it with "no-". However, in this list we mostly only list and show
|
||||
@@ -113,8 +125,14 @@ same command line option.)
|
||||
Make curl display progress as a simple progress bar instead of the standard,
|
||||
more informational, meter.
|
||||
.IP "-0, --http1.0"
|
||||
(HTTP) Forces curl to issue its requests using HTTP 1.0 instead of using its
|
||||
internally preferred: HTTP 1.1.
|
||||
(HTTP) Tells curl to use HTTP version 1.0 instead of using its internally
|
||||
preferred: HTTP 1.1.
|
||||
.IP "--http1.1"
|
||||
(HTTP) Tells curl to use HTTP version 1.1. This is the internal default
|
||||
version. (Added in 7.33.0)
|
||||
.IP "--http2.0"
|
||||
(HTTP) Tells curl to issue its requests using HTTP 2.0. This requires that the
|
||||
underlying libcurl was built to support it. (Added in 7.33.0)
|
||||
.IP "-1, --tlsv1"
|
||||
(SSL)
|
||||
Forces curl to use TLS version 1 when negotiating with a remote TLS server.
|
||||
@@ -269,10 +287,11 @@ data pieces specified will be merged together with a separating
|
||||
chunk that looks like \&'name=daniel&skill=lousy'.
|
||||
|
||||
If you start the data with the letter @, the rest should be a file name to
|
||||
read the data from, or - if you want curl to read the data from stdin. The
|
||||
contents of the file must already be URL-encoded. Multiple files can also be
|
||||
specified. Posting data from a file named 'foobar' would thus be done with
|
||||
\fI--data @foobar\fP.
|
||||
read the data from, or - if you want curl to read the data from
|
||||
stdin. Multiple files can also be specified. Posting data from a file
|
||||
named 'foobar' would thus be done with \fI--data\fP @foobar. When --data is
|
||||
told to read from a file like that, carriage returns and newlines will be
|
||||
stripped out.
|
||||
.IP "-D, --dump-header <file>"
|
||||
Write the protocol headers to the specified file.
|
||||
|
||||
@@ -294,7 +313,7 @@ whatsoever.
|
||||
|
||||
If you start the data with the letter @, the rest should be a filename. Data
|
||||
is posted in a similar manner as \fI--data-ascii\fP does, except that newlines
|
||||
are preserved and conversions are never done.
|
||||
and carriage returns are preserved and conversions are never done.
|
||||
|
||||
If this option is used several times, the ones following the first will append
|
||||
data as described in \fI-d, --data\fP.
|
||||
@@ -369,6 +388,39 @@ is an alias for \fB--disable-epsv\fP.
|
||||
|
||||
Disabling EPSV only changes the passive behavior. If you want to switch to
|
||||
active mode you need to use \fI-P, --ftp-port\fP.
|
||||
.IP "--dns-interface <interface>"
|
||||
Tell curl to send outgoing DNS requests through <interface>. This option
|
||||
is a counterpart to \fI--interface\fP (which does not affect DNS). The
|
||||
supplied string must be an interface name (not an address).
|
||||
|
||||
This option requires that libcurl was built with a resolver backend that
|
||||
supports this operation. The c-ares backend is the only such one. (Added in
|
||||
7.33.0)
|
||||
.IP "--dns-ipv4-addr <ip-address>"
|
||||
Tell curl to bind to <ip-address> when making IPv4 DNS requests, so that
|
||||
the DNS requests originate from this address. The argument should be a
|
||||
single IPv4 address.
|
||||
|
||||
This option requires that libcurl was built with a resolver backend that
|
||||
supports this operation. The c-ares backend is the only such one. (Added in
|
||||
7.33.0)
|
||||
.IP "--dns-ipv6-addr <ip-address>"
|
||||
Tell curl to bind to <ip-address> when making IPv6 DNS requests, so that
|
||||
the DNS requests originate from this address. The argument should be a
|
||||
single IPv6 address.
|
||||
|
||||
This option requires that libcurl was built with a resolver backend that
|
||||
supports this operation. The c-ares backend is the only such one. (Added in
|
||||
7.33.0)
|
||||
.IP "--dns-servers <ip-address,ip-address>"
|
||||
Set the list of DNS servers to be used instead of the system default.
|
||||
The list of IP addresses should be separated with commas. Port numbers
|
||||
may also optionally be given as \fI:<port-number>\fP after each IP
|
||||
address.
|
||||
|
||||
This option requires that libcurl was built with a resolver backend that
|
||||
supports this operation. The c-ares backend is the only such one. (Added in
|
||||
7.33.0)
|
||||
.IP "-e, --referer <URL>"
|
||||
(HTTP) Sends the "Referer Page" information to the HTTP server. This can also
|
||||
be set with the \fI-H, --header\fP flag of course. When used with
|
||||
@@ -380,7 +432,8 @@ If this option is used several times, the last one will be used.
|
||||
.IP "-E, --cert <certificate[:password]>"
|
||||
(SSL) Tells curl to use the specified client certificate file when getting a
|
||||
file with HTTPS, FTPS or another SSL-based protocol. The certificate must be
|
||||
in PEM format. If the optional password isn't specified, it will be queried
|
||||
in PKCS#12 format if using Secure Transport, or PEM format if using any other
|
||||
engine. If the optional password isn't specified, it will be queried
|
||||
for on the terminal. Note that this option assumes a \&"certificate" file that
|
||||
is the private key and the private certificate concatenated! See \fI--cert\fP
|
||||
and \fI--key\fP to specify them independently.
|
||||
@@ -396,9 +449,10 @@ recognized as password delimiter. If the nickname contains "\\", it needs to
|
||||
be escaped as "\\\\" so that it is not recognized as an escape character.
|
||||
|
||||
(iOS and Mac OS X only) If curl is built against Secure Transport, then the
|
||||
certificate string must match the name of a certificate that's in the system or
|
||||
user keychain. The private key corresponding to the certificate, and
|
||||
certificate chain (if any), must also be present in the keychain.
|
||||
certificate string can either be the name of a certificate/private key in the
|
||||
system or user keychain, or the path to a PKCS#12-encoded certificate and
|
||||
private key. If you want to use a file from the current directory, please
|
||||
precede it with "./" prefix, in order to avoid confusion with a nickname.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "--engine <name>"
|
||||
@@ -592,10 +646,10 @@ you can specify URLs that contain the letters {}[] without having them being
|
||||
interpreted by curl itself. Note that these letters are not normal legal URL
|
||||
contents but they should be encoded according to the URI standard.
|
||||
.IP "-G, --get"
|
||||
When used, this option will make all data specified with \fI-d, --data\fP or
|
||||
\fI--data-binary\fP to be used in an HTTP GET request instead of the POST
|
||||
request that otherwise would be used. The data will be appended to the URL
|
||||
with a '?' separator.
|
||||
When used, this option will make all data specified with \fI-d, --data\fP,
|
||||
\fI--data-binary\fP or \fI--data-urlencode\fP to be used in an HTTP GET
|
||||
request instead of the POST request that otherwise would be used. The data
|
||||
will be appended to the URL with a '?' separator.
|
||||
|
||||
If used in combination with -I, the POST data will instead be appended to the
|
||||
URL with a HEAD request.
|
||||
@@ -657,6 +711,9 @@ cookies when they're closed down.
|
||||
(HTTP) This option tells the \fI-O, --remote-name\fP option to use the
|
||||
server-specified Content-Disposition filename instead of extracting a filename
|
||||
from the URL.
|
||||
|
||||
There's no attempt to decode %-sequences (yet) in the provided file name, so
|
||||
this option may provide you with rather unexpected file names.
|
||||
.IP "-k, --insecure"
|
||||
(SSL) This option explicitly allows curl to perform "insecure" SSL connections
|
||||
and transfers. All SSL connections are attempted to be made secure by using
|
||||
@@ -668,16 +725,21 @@ See this online resource for further details:
|
||||
.IP "-K, --config <config file>"
|
||||
Specify which config file to read curl arguments from. The config file is a
|
||||
text file in which command line arguments can be written which then will be
|
||||
used as if they were written on the actual command line. Options and their
|
||||
parameters must be specified on the same config file line, separated by
|
||||
whitespace, colon, the equals sign or any combination thereof (however,
|
||||
the preferred separator is the equals sign). If the parameter is to contain
|
||||
whitespace, the parameter must be enclosed within quotes. Within double
|
||||
quotes, the following escape sequences are available: \\\\, \\", \\t, \\n,
|
||||
\\r and \\v. A backslash preceding any other letter is ignored. If the
|
||||
first column of a config line is a '#' character, the rest of the line will be
|
||||
treated as a comment. Only write one option per physical line in the config
|
||||
file.
|
||||
used as if they were written on the actual command line.
|
||||
|
||||
Options and their parameters must be specified on the same config file line,
|
||||
separated by whitespace, colon, or the equals sign. Long option names can
|
||||
optionally be given in the config file without the initial double dashes and
|
||||
if so, the colon or equals characters can be used as separators. If the option
|
||||
is specified with one or two dashes, there can be no colon or equals character
|
||||
between the option and its parameter.
|
||||
|
||||
If the parameter is to contain whitespace, the parameter must be enclosed
|
||||
within quotes. Within double quotes, the following escape sequences are
|
||||
available: \\\\, \\", \\t, \\n, \\r and \\v. A backslash preceding any other
|
||||
letter is ignored. If the first column of a config line is a '#' character,
|
||||
the rest of the line will be treated as a comment. Only write one option per
|
||||
physical line in the config file.
|
||||
|
||||
Specify the filename to -K, --config as '-' to make curl read the file from
|
||||
stdin.
|
||||
@@ -688,9 +750,6 @@ line. So, it could look similar to this:
|
||||
|
||||
url = "http://curl.haxx.se/docs/"
|
||||
|
||||
Long option names can optionally be given in the config file without the
|
||||
initial double dashes.
|
||||
|
||||
When curl is invoked, it always (unless \fI-q\fP is used) checks for a default
|
||||
config file and uses it if found. The default config file is checked for in
|
||||
the following places in this order:
|
||||
@@ -752,15 +811,23 @@ see if your curl supports it.
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-l, --list-only"
|
||||
(FTP)
|
||||
When listing an FTP directory, this switch forces a name-only view.
|
||||
Especially useful if you want to machine-parse the contents of an FTP
|
||||
directory since the normal directory view doesn't use a standard look
|
||||
or format.
|
||||
When listing an FTP directory, this switch forces a name-only view. This is
|
||||
especially useful if the user wants to machine-parse the contents of an FTP
|
||||
directory since the normal directory view doesn't use a standard look or
|
||||
format. When used like this, the option causes a NLST command to be sent to
|
||||
the server instead of LIST.
|
||||
|
||||
This option causes an FTP NLST command to be sent. Some FTP servers
|
||||
list only files in their response to NLST; they do not include
|
||||
subdirectories and symbolic links.
|
||||
Note: Some FTP servers list only files in their response to NLST; they do not
|
||||
include sub-directories and symbolic links.
|
||||
|
||||
(POP3)
|
||||
When retrieving a specific email from POP3, this switch forces a LIST command
|
||||
to be performed instead of RETR. This is particularly useful if the user wants
|
||||
to see if a specific message id exists on the server and what size it is.
|
||||
|
||||
Note: When combined with \fI-X, --request <command>\fP, this option can be used
|
||||
to send an UIDL command instead, so the user may use the email's unique
|
||||
identifier rather than it's message id to make the request. (Added in 7.21.5)
|
||||
.IP "-L, --location"
|
||||
(HTTP/HTTPS) If the server reports that the requested page has moved to a
|
||||
different location (indicated with a Location: header and a 3XX response code),
|
||||
@@ -840,10 +907,18 @@ return with exit code 63.
|
||||
files this option has no effect even if the file transfer ends up being larger
|
||||
than this given limit. This concerns both FTP and HTTP transfers.
|
||||
.IP "--mail-rcpt <address>"
|
||||
(SMTP) Specify a single address that the given mail should get sent to. This
|
||||
option can be used multiple times to specify many recipients.
|
||||
(SMTP) Specify a single address, user name or mailing list name.
|
||||
|
||||
(Added in 7.20.0)
|
||||
When performing a mail transfer, the recipient should specify a valid email
|
||||
address to send the mail to. (Added in 7.20.0)
|
||||
|
||||
When performing an address verification (VRFY command), the recipient should be
|
||||
specified as the user name or user name and domain (as per Section 3.5 of
|
||||
RFC5321). (Added in 7.34.0)
|
||||
|
||||
When performing a mailing list expand (EXPN command), the recipient should be
|
||||
specified using the mailing list name, such as "Friends" or "London-Office".
|
||||
(Added in 7.34.0)
|
||||
.IP "--max-redirs <num>"
|
||||
Set maximum number of redirection-followings allowed. If \fI-L, --location\fP
|
||||
is used, this option can be used to prevent curl from following redirections
|
||||
@@ -999,7 +1074,19 @@ Consequentially, the file will be saved in the current working directory. If
|
||||
you want the file saved in a different directory, make sure you change current
|
||||
working directory before you invoke curl with the \fB-O, --remote-name\fP flag!
|
||||
|
||||
There is no URL decoding done on the file name. If it has %20 or other URL
|
||||
encoded parts of the name, they will end up as-is as file name.
|
||||
|
||||
You may use this option as many times as the number of URLs you have.
|
||||
.IP "--oauth2-bearer"
|
||||
(IMAP, POP3, SMTP)
|
||||
Specify the Bearer Token for OAUTH 2.0 server authentication. The Bearer Token
|
||||
is used in conjunction with the user name which can be specified as part of the
|
||||
\fI--url\fP or \fI-u, --user\fP options.
|
||||
|
||||
The Bearer Token and user name are formatted according to RFC 6750.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-p, --proxytunnel"
|
||||
When an HTTP proxy is used (\fI-x, --proxy\fP), this option will cause non-HTTP
|
||||
protocols to attempt to tunnel through the proxy instead of merely using it to
|
||||
@@ -1436,14 +1523,26 @@ Set TLS authentication type. Currently, the only supported option is "SRP",
|
||||
for TLS-SRP (RFC 5054). If \fI--tlsuser\fP and \fI--tlspassword\fP are
|
||||
specified but \fI--tlsauthtype\fP is not, then this option defaults to "SRP".
|
||||
(Added in 7.21.4)
|
||||
.IP "--tlsuser <user>"
|
||||
Set username for use with the TLS authentication method specified with
|
||||
\fI--tlsauthtype\fP. Requires that \fI--tlspassword\fP also be set. (Added in
|
||||
7.21.4)
|
||||
.IP "--tlspassword <password>"
|
||||
Set password for use with the TLS authentication method specified with
|
||||
\fI--tlsauthtype\fP. Requires that \fI--tlsuser\fP also be set. (Added in
|
||||
7.21.4)
|
||||
.IP "--tlsuser <user>"
|
||||
Set username for use with the TLS authentication method specified with
|
||||
\fI--tlsauthtype\fP. Requires that \fI--tlspassword\fP also be set. (Added in
|
||||
7.21.4)
|
||||
.IP "--tlsv1.0"
|
||||
(SSL)
|
||||
Forces curl to use TLS version 1.0 when negotiating with a remote TLS server.
|
||||
(Added in 7.34.0)
|
||||
.IP "--tlsv1.1"
|
||||
(SSL)
|
||||
Forces curl to use TLS version 1.1 when negotiating with a remote TLS server.
|
||||
(Added in 7.34.0)
|
||||
.IP "--tlsv1.2"
|
||||
(SSL)
|
||||
Forces curl to use TLS version 1.2 when negotiating with a remote TLS server.
|
||||
(Added in 7.34.0)
|
||||
.IP "--tr-encoding"
|
||||
(HTTP) Request a compressed Transfer-Encoding response using one of the
|
||||
algorithms curl supports, and uncompress the data while receiving it.
|
||||
@@ -1473,16 +1572,23 @@ If this option is used several times, the last one will be used.
|
||||
.IP "--trace-time"
|
||||
Prepends a time stamp to each trace or verbose line that curl displays.
|
||||
(Added in 7.14.0)
|
||||
.IP "-u, --user <user:password>"
|
||||
Specify the user name and password to use for server authentication. Overrides
|
||||
\fI-n, --netrc\fP and \fI--netrc-optional\fP.
|
||||
.IP "-u, --user <user:password;options>"
|
||||
Specify the user name, password and optional login options to use for server
|
||||
authentication. Overrides \fI-n, --netrc\fP and \fI--netrc-optional\fP.
|
||||
|
||||
If you just give the user name (without entering a colon) curl will prompt for
|
||||
a password.
|
||||
If you simply specify the user name, with or without the login options, curl
|
||||
will prompt for a password.
|
||||
|
||||
If you use an SSPI-enabled curl binary and do NTLM authentication, you can
|
||||
force curl to pick up the user name and password from your environment by
|
||||
simply specifying a single colon with this option: "-u :".
|
||||
If you use an SSPI-enabled curl binary and perform NTLM authentication, you
|
||||
can force curl to select the user name and password from your environment by
|
||||
simply specifying a single colon with this option: "-u :" or by specfying the
|
||||
login options on their own, for example "-u ;auth=NTLM".
|
||||
|
||||
You can use the optional login options part to specify protocol specific
|
||||
options that may be used during authentication. At present only IMAP, POP3 and
|
||||
SMTP support login options as part of the user login information. For more
|
||||
information about the login options please see RFC 2384, RFC 5092 and IETF
|
||||
draft draft-earhart-url-smtp-00.txt (Added in 7.31.0).
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-U, --proxy-user <user:password>"
|
||||
@@ -1643,8 +1749,16 @@ to follow location: headers.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-x, --proxy <[protocol://][user:password@]proxyhost[:port]>"
|
||||
Use the specified HTTP proxy. If the port number is not specified, it is
|
||||
assumed at port 1080.
|
||||
Use the specified proxy.
|
||||
|
||||
The proxy string can be specified with a protocol:// prefix to specify
|
||||
alternative proxy protocols. Use socks4://, socks4a://, socks5:// or
|
||||
socks5h:// to request the specific SOCKS version to be used. No protocol
|
||||
specified, http:// and all others will be treated as HTTP proxies. (The
|
||||
protocol support was added in curl 7.21.7)
|
||||
|
||||
If the port number is not specified in the proxy string, it is assumed to be
|
||||
1080.
|
||||
|
||||
This option overrides existing environment variables that set the proxy to
|
||||
use. If there's an environment variable setting a proxy, you can set proxy to
|
||||
@@ -1663,11 +1777,6 @@ The proxy host can be specified the exact same way as the proxy environment
|
||||
variables, including the protocol prefix (http://) and the embedded user +
|
||||
password.
|
||||
|
||||
From 7.21.7, the proxy string may be specified with a protocol:// prefix to
|
||||
specify alternative proxy protocols. Use socks4://, socks4a://, socks5:// or
|
||||
socks5h:// to request the specific SOCKS version to be used. No protocol
|
||||
specified, http:// and all others will be treated as HTTP proxies.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-X, --request <command>"
|
||||
(HTTP) Specifies a custom request method to use when communicating with the
|
||||
@@ -1689,8 +1798,17 @@ option.
|
||||
Specifies a custom FTP command to use instead of LIST when doing file lists
|
||||
with FTP.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
(POP3)
|
||||
Specifies a custom POP3 command to use instead of LIST or RETR. (Added in
|
||||
7.26.0)
|
||||
|
||||
(IMAP)
|
||||
Specifies a custom IMAP command to use insead of LIST. (Added in 7.30.0)
|
||||
|
||||
(SMTP)
|
||||
Specifies a custom SMTP command to use instead of HELP or VRFY. (Added in 7.34.0)
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "--xattr"
|
||||
When saving output to a file, this option tells curl to store certain file
|
||||
metadata in extended file attributes. Currently, the URL is stored in the
|
||||
@@ -1983,6 +2101,8 @@ RTSP: mismatch of Session Identifiers
|
||||
unable to parse FTP file list
|
||||
.IP 88
|
||||
FTP chunk callback reported error
|
||||
.IP 89
|
||||
No connection available, the session will be queued
|
||||
.IP XX
|
||||
More error codes will appear here in future releases. The existing ones
|
||||
are meant to never change.
|
||||
|
@@ -4,8 +4,12 @@ check_PROGRAMS = 10-at-a-time anyauthput cookie_interface debug fileupload \
|
||||
https multi-app multi-debugcallback multi-double multi-post multi-single \
|
||||
persistant post-callback postit2 sepheaders simple simplepost simplessl \
|
||||
sendrecv httpcustomheader certinfo chkspeed ftpgetinfo ftp-wildcard \
|
||||
smtp-multi simplesmtp smtp-tls rtsp externalsocket resolve \
|
||||
progressfunc pop3s pop3slist imap url2file sftpget ftpsget
|
||||
smtp-mail smtp-multi smtp-ssl smtp-tls smtp-vrfy smtp-expn rtsp \
|
||||
externalsocket resolve progressfunc pop3-retr pop3-list pop3-uidl pop3-dele \
|
||||
pop3-top pop3-stat pop3-noop pop3-ssl pop3-tls pop3-multi imap-list \
|
||||
imap-fetch imap-store imap-append imap-examine imap-search imap-create \
|
||||
imap-delete imap-copy imap-noop imap-ssl imap-tls imap-multi url2file \
|
||||
sftpget ftpsget postinmemory
|
||||
|
||||
# These examples require external dependencies that may not be commonly
|
||||
# available on POSIX systems, so don't bother attempting to compile them here.
|
||||
@@ -13,4 +17,4 @@ COMPLICATED_EXAMPLES = curlgtk.c curlx.c htmltitle.cpp cacertinmem.c \
|
||||
ftpuploadresume.c ghiper.c hiperfifo.c htmltidy.c multithread.c \
|
||||
opensslthreadlock.c sampleconv.c synctime.c threaded-ssl.c evhiperfifo.c \
|
||||
smooth-gtk-thread.c version-check.pl href_extractor.c asiohiper.cpp \
|
||||
multi-uv.c xmlstream.c usercertinmem.c
|
||||
multi-uv.c xmlstream.c usercertinmem.c sessioninfo.c
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -98,10 +98,6 @@ int main(void)
|
||||
* bytes big and contains the remote file.
|
||||
*
|
||||
* Do something nice with it!
|
||||
*
|
||||
* You should be aware of the fact that at this point we might have an
|
||||
* allocated data block, and nothing has yet deallocated that data. So when
|
||||
* you're done with it, you should free() it as a nice application.
|
||||
*/
|
||||
|
||||
printf("%lu bytes retrieved\n", (long)chunk.size);
|
||||
|
@@ -22,8 +22,6 @@
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
/*
|
||||
@@ -59,7 +57,6 @@ int main(int argc, char **argv)
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
FILE * hd_src ;
|
||||
int hd ;
|
||||
struct stat file_info;
|
||||
|
||||
char *file;
|
||||
@@ -72,9 +69,7 @@ int main(int argc, char **argv)
|
||||
url = argv[2];
|
||||
|
||||
/* get the file size of the local file */
|
||||
hd = open(file, O_RDONLY) ;
|
||||
fstat(hd, &file_info);
|
||||
close(hd) ;
|
||||
stat(file, &file_info);
|
||||
|
||||
/* get a FILE * of the same file, could also be made with
|
||||
fdopen() from the previous descriptor, but hey this is just
|
||||
|
115
docs/examples/imap-append.c
Normal file
115
docs/examples/imap-append.c
Normal file
@@ -0,0 +1,115 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to send mail using libcurl's IMAP
|
||||
* capabilities.
|
||||
*
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
#define FROM "<sender@example.org>"
|
||||
#define TO "<addressee@example.net>"
|
||||
#define CC "<info@example.org>"
|
||||
|
||||
static const char *payload_text[] = {
|
||||
"Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
|
||||
"To: " TO "\r\n",
|
||||
"From: " FROM "(Example User)\r\n",
|
||||
"Cc: " CC "(Another example User)\r\n",
|
||||
"Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\r\n",
|
||||
"Subject: IMAP example message\r\n",
|
||||
"\r\n", /* empty line to divide headers from body, see RFC5322 */
|
||||
"The body of the message starts here.\r\n",
|
||||
"\r\n",
|
||||
"It could be a lot of lines, could be MIME encoded, whatever.\r\n",
|
||||
"Check RFC5322.\r\n",
|
||||
NULL
|
||||
};
|
||||
|
||||
struct upload_status {
|
||||
int lines_read;
|
||||
};
|
||||
|
||||
static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
struct upload_status *upload_ctx = (struct upload_status *)userp;
|
||||
const char *data;
|
||||
|
||||
if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
data = payload_text[upload_ctx->lines_read];
|
||||
|
||||
if(data) {
|
||||
size_t len = strlen(data);
|
||||
memcpy(ptr, data, len);
|
||||
upload_ctx->lines_read++;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
struct upload_status upload_ctx;
|
||||
|
||||
upload_ctx.lines_read = 0;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This will create a new message 100. Note that you should perform an
|
||||
* EXAMINE command to obtain the UID of the next message to create and a
|
||||
* SELECT to ensure you are creating the message in the OUTBOX. */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/100");
|
||||
|
||||
/* In this case, we're using a callback function to specify the data. You
|
||||
* could just use the CURLOPT_READDATA option to specify a FILE pointer to
|
||||
* read from. */
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
|
||||
curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
|
||||
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
|
||||
/* Perform the append */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
65
docs/examples/imap-copy.c
Normal file
65
docs/examples/imap-copy.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to copy a mail from one mailbox folder
|
||||
* to another using libcurl's IMAP capabilities.
|
||||
*
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This is source mailbox folder to select */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX");
|
||||
|
||||
/* Set the COPY command specifing the message ID and destination folder */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "COPY 1 FOLDER");
|
||||
|
||||
/* Note that to perform a move operation you will need to perform the copy,
|
||||
* then mark the original mail as Deleted and EXPUNGE or CLOSE. Please see
|
||||
* imap-store.c for more information on deleting messages. */
|
||||
|
||||
/* Perform the custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
61
docs/examples/imap-create.c
Normal file
61
docs/examples/imap-create.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to create a new mailbox folder using
|
||||
* libcurl's IMAP capabilities.
|
||||
*
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This is just the server URL */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");
|
||||
|
||||
/* Set the CREATE command specifing the new folder name */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "CREATE FOLDER");
|
||||
|
||||
/* Perform the custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
61
docs/examples/imap-delete.c
Normal file
61
docs/examples/imap-delete.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to delete an existing mailbox folder
|
||||
* using libcurl's IMAP capabilities.
|
||||
*
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This is just the server URL */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");
|
||||
|
||||
/* Set the DELETE command specifing the existing folder */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE FOLDER");
|
||||
|
||||
/* Perform the custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
61
docs/examples/imap-examine.c
Normal file
61
docs/examples/imap-examine.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to obtain information about a mailbox
|
||||
* folder using libcurl's IMAP capabilities via the EXAMINE command.
|
||||
*
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This is just the server URL */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");
|
||||
|
||||
/* Set the EXAMINE command specifing the mailbox folder */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "EXAMINE OUTBOX");
|
||||
|
||||
/* Perform the custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -22,6 +22,12 @@
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to fetch mail using libcurl's IMAP
|
||||
* capabilities.
|
||||
*
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
@@ -30,15 +36,23 @@ int main(void)
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This will fetch the mailbox named "foobar" */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/foobar");
|
||||
/* This will fetch message 1 from the user's inbox */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX/;UID=1");
|
||||
|
||||
/* Perform the fetch */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* always cleanup */
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
60
docs/examples/imap-list.c
Normal file
60
docs/examples/imap-list.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to list the folders within an IMAP
|
||||
* mailbox.
|
||||
*
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This will list the folders within the user's mailbox. If you want to
|
||||
* list the folders within a specific folder, for example the inbox, then
|
||||
* specify the folder as a path in the URL such as /INBOX */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");
|
||||
|
||||
/* Perform the list */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
145
docs/examples/imap-multi.c
Normal file
145
docs/examples/imap-multi.c
Normal file
@@ -0,0 +1,145 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to fetch mail using libcurl's IMAP
|
||||
* capabilities. It builds on the imap-fetch.c example to demonstrate how to
|
||||
* use libcurl's multi interface.
|
||||
*
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000
|
||||
|
||||
static struct timeval tvnow(void)
|
||||
{
|
||||
struct timeval now;
|
||||
|
||||
/* time() returns the value of time in seconds since the epoch */
|
||||
now.tv_sec = (long)time(NULL);
|
||||
now.tv_usec = 0;
|
||||
|
||||
return now;
|
||||
}
|
||||
|
||||
static long tvdiff(struct timeval newer, struct timeval older)
|
||||
{
|
||||
return (newer.tv_sec - older.tv_sec) * 1000 +
|
||||
(newer.tv_usec - older.tv_usec) / 1000;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLM *mcurl;
|
||||
int still_running = 1;
|
||||
struct timeval mp_start;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl)
|
||||
return 1;
|
||||
|
||||
mcurl = curl_multi_init();
|
||||
if(!mcurl)
|
||||
return 2;
|
||||
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This will fetch message 1 from the user's inbox */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX/;UID=1");
|
||||
|
||||
/* Tell the multi stack about our easy handle */
|
||||
curl_multi_add_handle(mcurl, curl);
|
||||
|
||||
/* Record the start time which we can use later */
|
||||
mp_start = tvnow();
|
||||
|
||||
/* We start some action by calling perform right away */
|
||||
curl_multi_perform(mcurl, &still_running);
|
||||
|
||||
while(still_running) {
|
||||
struct timeval timeout;
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
int maxfd = -1;
|
||||
int rc;
|
||||
|
||||
long curl_timeo = -1;
|
||||
|
||||
/* Initialise the file descriptors */
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
|
||||
/* Set a suitable timeout to play around with */
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
curl_multi_timeout(mcurl, &curl_timeo);
|
||||
if(curl_timeo >= 0) {
|
||||
timeout.tv_sec = curl_timeo / 1000;
|
||||
if(timeout.tv_sec > 1)
|
||||
timeout.tv_sec = 1;
|
||||
else
|
||||
timeout.tv_usec = (curl_timeo % 1000) * 1000;
|
||||
}
|
||||
|
||||
/* Get file descriptors from the transfers */
|
||||
curl_multi_fdset(mcurl, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
|
||||
/* In a real-world program you OF COURSE check the return code of the
|
||||
function calls. On success, the value of maxfd is guaranteed to be
|
||||
greater or equal than -1. We call select(maxfd + 1, ...), specially in
|
||||
case of (maxfd == -1), we call select(0, ...), which is basically equal
|
||||
to sleep. */
|
||||
rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
|
||||
if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
|
||||
fprintf(stderr,
|
||||
"ABORTING: Since it seems that we would have run forever.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
switch(rc) {
|
||||
case -1: /* select error */
|
||||
break;
|
||||
case 0: /* timeout */
|
||||
default: /* action */
|
||||
curl_multi_perform(mcurl, &still_running);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Always cleanup */
|
||||
curl_multi_remove_handle(mcurl, curl);
|
||||
curl_multi_cleanup(mcurl);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return 0;
|
||||
}
|
61
docs/examples/imap-noop.c
Normal file
61
docs/examples/imap-noop.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to perform a noop using libcurl's IMAP
|
||||
* capabilities.
|
||||
*
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This is just the server URL */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");
|
||||
|
||||
/* Set the NOOP command */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "NOOP");
|
||||
|
||||
/* Perform the custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
65
docs/examples/imap-search.c
Normal file
65
docs/examples/imap-search.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to search for new messages using
|
||||
* libcurl's IMAP capabilities.
|
||||
*
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This is mailbox folder to select */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX");
|
||||
|
||||
/* Set the SEARCH command specifing what we want to search for. Note that
|
||||
* this can contain a message sequence set and a number of search criteria
|
||||
* keywords including flags such as ANSWERED, DELETED, DRAFT, FLAGGED, NEW,
|
||||
* RECENT and SEEN. For more information about the search criteria please
|
||||
* see RFC-3501 section 6.4.4. */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "SEARCH NEW");
|
||||
|
||||
/* Perform the custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -22,52 +22,64 @@
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to fetch mail using libcurl's IMAP
|
||||
* capabilities. It builds on the imap-fetch.c example adding transport
|
||||
* security to protect the authentication details from being snooped.
|
||||
*
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This will list every message of the given mailbox */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "pop3s://user@pop.example.com/");
|
||||
/* This will fetch message 1 from the user's inbox. Note the use of
|
||||
* imaps:// rather than imap:// to request a SSL based connection. */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imaps://imap.example.com/INBOX/;UID=1");
|
||||
|
||||
#ifdef SKIP_PEER_VERIFICATION
|
||||
/*
|
||||
* If you want to connect to a site who isn't using a certificate that is
|
||||
/* If you want to connect to a site who isn't using a certificate that is
|
||||
* signed by one of the certs in the CA bundle you have, you can skip the
|
||||
* verification of the server's certificate. This makes the connection
|
||||
* A LOT LESS SECURE.
|
||||
*
|
||||
* If you have a CA cert for the server stored someplace else than in the
|
||||
* default bundle, then the CURLOPT_CAPATH option might come handy for
|
||||
* you.
|
||||
*/
|
||||
* you. */
|
||||
#ifdef SKIP_PEER_VERIFICATION
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
#endif
|
||||
|
||||
#ifdef SKIP_HOSTNAME_VERFICATION
|
||||
/*
|
||||
* If the site you're connecting to uses a different host name that what
|
||||
/* If the site you're connecting to uses a different host name that what
|
||||
* they have mentioned in their server certificate's commonName (or
|
||||
* subjectAltName) fields, libcurl will refuse to connect. You can skip
|
||||
* this check, but this will make the connection less secure.
|
||||
*/
|
||||
* this check, but this will make the connection less secure. */
|
||||
#ifdef SKIP_HOSTNAME_VERFICATION
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
#endif
|
||||
|
||||
/* Perform the request, res will get the return code */
|
||||
/* Since the traffic will be encrypted, it is very useful to turn on debug
|
||||
* information within libcurl to see what is happening during the
|
||||
* transfer */
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
/* Perform the fetch */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* always cleanup */
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
return 0;
|
||||
|
||||
return (int)res;
|
||||
}
|
76
docs/examples/imap-store.c
Normal file
76
docs/examples/imap-store.c
Normal file
@@ -0,0 +1,76 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to modify an existing mail using
|
||||
* libcurl's IMAP capabilities with the STORE command.
|
||||
*
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This is the mailbox folder to select */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX");
|
||||
|
||||
/* Set the STORE command with the Deleted flag for message 1. Note that
|
||||
* you can use the STORE command to set other flags such as Seen, Answered,
|
||||
* Flagged, Draft and Recent. */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "STORE 1 +Flags \\Deleted");
|
||||
|
||||
/* Perform the custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
else {
|
||||
/* Set the EXPUNGE command, although you can use the CLOSE command if you
|
||||
* don't want to know the result of the STORE */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "EXPUNGE");
|
||||
|
||||
/* Perform the second custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
}
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
84
docs/examples/imap-tls.c
Normal file
84
docs/examples/imap-tls.c
Normal file
@@ -0,0 +1,84 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to fetch mail using libcurl's IMAP
|
||||
* capabilities. It builds on the imap-fetch.c example adding transport
|
||||
* security to protect the authentication details from being snooped.
|
||||
*
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This will fetch message 1 from the user's inbox */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX/;UID=1");
|
||||
|
||||
/* In this example, we'll start with a plain text connection, and upgrade
|
||||
* to Transport Layer Security (TLS) using the STARTTLS command. Be careful
|
||||
* of using CURLUSESSL_TRY here, because if TLS upgrade fails, the transfer
|
||||
* will continue anyway - see the security discussion in the libcurl
|
||||
* tutorial for more details. */
|
||||
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
|
||||
|
||||
/* If your server doesn't have a valid certificate, then you can disable
|
||||
* part of the Transport Layer Security protection by setting the
|
||||
* CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST options to 0 (false).
|
||||
* curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
* curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
* That is, in general, a bad idea. It is still better than sending your
|
||||
* authentication details in plain text though.
|
||||
* Instead, you should get the issuer certificate (or the host certificate
|
||||
* if the certificate is self-signed) and add it to the set of certificates
|
||||
* that are known to libcurl using CURLOPT_CAINFO and/or CURLOPT_CAPATH. See
|
||||
* docs/SSLCERTS for more information. */
|
||||
curl_easy_setopt(curl, CURLOPT_CAINFO, "/path/to/certificate.pem");
|
||||
|
||||
/* Since the traffic will be encrypted, it is very useful to turn on debug
|
||||
* information within libcurl to see what is happening during the
|
||||
* transfer */
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
/* Perform the fetch */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
64
docs/examples/pop3-dele.c
Normal file
64
docs/examples/pop3-dele.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to delete an existing mail using
|
||||
* libcurl's POP3 capabilities.
|
||||
*
|
||||
* Note that this example requires libcurl 7.26.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* You can specify the message either in the URL or DELE command */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com/1");
|
||||
|
||||
/* Set the DELE command */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELE");
|
||||
|
||||
/* Do not perform a transfer as DELE returns no data */
|
||||
curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
|
||||
|
||||
/* Perform the custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
58
docs/examples/pop3-list.c
Normal file
58
docs/examples/pop3-list.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example using libcurl's POP3 capabilities to list the
|
||||
* contents of a mailbox.
|
||||
*
|
||||
* Note that this example requires libcurl 7.20.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This will list every message of the given mailbox */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com");
|
||||
|
||||
/* Perform the list */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
145
docs/examples/pop3-multi.c
Normal file
145
docs/examples/pop3-multi.c
Normal file
@@ -0,0 +1,145 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to retrieve mail using libcurl's POP3
|
||||
* capabilities. It builds on the pop3-retr.c example to demonstrate how to use
|
||||
* libcurl's multi interface.
|
||||
*
|
||||
* Note that this example requires libcurl 7.20.0 or above.
|
||||
*/
|
||||
|
||||
#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000
|
||||
|
||||
static struct timeval tvnow(void)
|
||||
{
|
||||
struct timeval now;
|
||||
|
||||
/* time() returns the value of time in seconds since the epoch */
|
||||
now.tv_sec = (long)time(NULL);
|
||||
now.tv_usec = 0;
|
||||
|
||||
return now;
|
||||
}
|
||||
|
||||
static long tvdiff(struct timeval newer, struct timeval older)
|
||||
{
|
||||
return (newer.tv_sec - older.tv_sec) * 1000 +
|
||||
(newer.tv_usec - older.tv_usec) / 1000;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLM *mcurl;
|
||||
int still_running = 1;
|
||||
struct timeval mp_start;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl)
|
||||
return 1;
|
||||
|
||||
mcurl = curl_multi_init();
|
||||
if(!mcurl)
|
||||
return 2;
|
||||
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This will retreive message 1 from the user's mailbox */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com/1");
|
||||
|
||||
/* Tell the multi stack about our easy handle */
|
||||
curl_multi_add_handle(mcurl, curl);
|
||||
|
||||
/* Record the start time which we can use later */
|
||||
mp_start = tvnow();
|
||||
|
||||
/* We start some action by calling perform right away */
|
||||
curl_multi_perform(mcurl, &still_running);
|
||||
|
||||
while(still_running) {
|
||||
struct timeval timeout;
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
int maxfd = -1;
|
||||
int rc;
|
||||
|
||||
long curl_timeo = -1;
|
||||
|
||||
/* Initialise the file descriptors */
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
|
||||
/* Set a suitable timeout to play around with */
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
curl_multi_timeout(mcurl, &curl_timeo);
|
||||
if(curl_timeo >= 0) {
|
||||
timeout.tv_sec = curl_timeo / 1000;
|
||||
if(timeout.tv_sec > 1)
|
||||
timeout.tv_sec = 1;
|
||||
else
|
||||
timeout.tv_usec = (curl_timeo % 1000) * 1000;
|
||||
}
|
||||
|
||||
/* Get file descriptors from the transfers */
|
||||
curl_multi_fdset(mcurl, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
|
||||
/* In a real-world program you OF COURSE check the return code of the
|
||||
function calls. On success, the value of maxfd is guaranteed to be
|
||||
greater or equal than -1. We call select(maxfd + 1, ...), specially in
|
||||
case of (maxfd == -1), we call select(0, ...), which is basically equal
|
||||
to sleep. */
|
||||
rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
|
||||
if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
|
||||
fprintf(stderr,
|
||||
"ABORTING: Since it seems that we would have run forever.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
switch(rc) {
|
||||
case -1: /* select error */
|
||||
break;
|
||||
case 0: /* timeout */
|
||||
default: /* action */
|
||||
curl_multi_perform(mcurl, &still_running);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Always cleanup */
|
||||
curl_multi_remove_handle(mcurl, curl);
|
||||
curl_multi_cleanup(mcurl);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return 0;
|
||||
}
|
64
docs/examples/pop3-noop.c
Normal file
64
docs/examples/pop3-noop.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to perform a noop using libcurl's POP3
|
||||
* capabilities.
|
||||
*
|
||||
* Note that this example requires libcurl 7.26.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This is just the server URL */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com");
|
||||
|
||||
/* Set the NOOP command */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "NOOP");
|
||||
|
||||
/* Do not perform a transfer as NOOP returns no data */
|
||||
curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
|
||||
|
||||
/* Perform the custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
58
docs/examples/pop3-retr.c
Normal file
58
docs/examples/pop3-retr.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to retrieve mail using libcurl's POP3
|
||||
* capabilities.
|
||||
*
|
||||
* Note that this example requires libcurl 7.20.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This will retreive message 1 from the user's mailbox */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com/1");
|
||||
|
||||
/* Perform the retr */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -22,52 +22,64 @@
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to retrieve mail using libcurl's POP3
|
||||
* capabilities. It builds on the pop3-retr.c example adding transport
|
||||
* security to protect the authentication details from being snooped.
|
||||
*
|
||||
* Note that this example requires libcurl 7.20.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This will only fetch the message with ID "1" of the given mailbox */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "pop3s://user@pop.example.com/1");
|
||||
/* This will retreive message 1 from the user's mailbox. Note the use of
|
||||
* pop3s:// rather than pop3:// to request a SSL based connection. */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "pop3s://pop.example.com/1");
|
||||
|
||||
#ifdef SKIP_PEER_VERIFICATION
|
||||
/*
|
||||
* If you want to connect to a site who isn't using a certificate that is
|
||||
/* If you want to connect to a site who isn't using a certificate that is
|
||||
* signed by one of the certs in the CA bundle you have, you can skip the
|
||||
* verification of the server's certificate. This makes the connection
|
||||
* A LOT LESS SECURE.
|
||||
*
|
||||
* If you have a CA cert for the server stored someplace else than in the
|
||||
* default bundle, then the CURLOPT_CAPATH option might come handy for
|
||||
* you.
|
||||
*/
|
||||
* you. */
|
||||
#ifdef SKIP_PEER_VERIFICATION
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
#endif
|
||||
|
||||
#ifdef SKIP_HOSTNAME_VERFICATION
|
||||
/*
|
||||
* If the site you're connecting to uses a different host name that what
|
||||
/* If the site you're connecting to uses a different host name that what
|
||||
* they have mentioned in their server certificate's commonName (or
|
||||
* subjectAltName) fields, libcurl will refuse to connect. You can skip
|
||||
* this check, but this will make the connection less secure.
|
||||
*/
|
||||
* this check, but this will make the connection less secure. */
|
||||
#ifdef SKIP_HOSTNAME_VERFICATION
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
#endif
|
||||
|
||||
/* Perform the request, res will get the return code */
|
||||
/* Since the traffic will be encrypted, it is very useful to turn on debug
|
||||
* information within libcurl to see what is happening during the
|
||||
* transfer */
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
/* Perform the retr */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* always cleanup */
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
return 0;
|
||||
|
||||
return (int)res;
|
||||
}
|
64
docs/examples/pop3-stat.c
Normal file
64
docs/examples/pop3-stat.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to obtain message statistics using
|
||||
* libcurl's POP3 capabilities.
|
||||
*
|
||||
* Note that this example requires libcurl 7.26.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This is just the server URL */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com");
|
||||
|
||||
/* Set the STAT command */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "STAT");
|
||||
|
||||
/* Do not perform a transfer as the data is in the response */
|
||||
curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
|
||||
|
||||
/* Perform the custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
84
docs/examples/pop3-tls.c
Normal file
84
docs/examples/pop3-tls.c
Normal file
@@ -0,0 +1,84 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to retrieve mail using libcurl's POP3
|
||||
* capabilities. It builds on the pop3-retr.c example adding transport
|
||||
* security to protect the authentication details from being snooped.
|
||||
*
|
||||
* Note that this example requires libcurl 7.20.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This will retreive message 1 from the user's mailbox */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com/1");
|
||||
|
||||
/* In this example, we'll start with a plain text connection, and upgrade
|
||||
* to Transport Layer Security (TLS) using the STLS command. Be careful of
|
||||
* using CURLUSESSL_TRY here, because if TLS upgrade fails, the transfer
|
||||
* will continue anyway - see the security discussion in the libcurl
|
||||
* tutorial for more details. */
|
||||
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
|
||||
|
||||
/* If your server doesn't have a valid certificate, then you can disable
|
||||
* part of the Transport Layer Security protection by setting the
|
||||
* CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST options to 0 (false).
|
||||
* curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
* curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
* That is, in general, a bad idea. It is still better than sending your
|
||||
* authentication details in plain text though.
|
||||
* Instead, you should get the issuer certificate (or the host certificate
|
||||
* if the certificate is self-signed) and add it to the set of certificates
|
||||
* that are known to libcurl using CURLOPT_CAINFO and/or CURLOPT_CAPATH. See
|
||||
* docs/SSLCERTS for more information. */
|
||||
curl_easy_setopt(curl, CURLOPT_CAINFO, "/path/to/certificate.pem");
|
||||
|
||||
/* Since the traffic will be encrypted, it is very useful to turn on debug
|
||||
* information within libcurl to see what is happening during the
|
||||
* transfer */
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
/* Perform the retr */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
61
docs/examples/pop3-top.c
Normal file
61
docs/examples/pop3-top.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to retrieve only the headers of a mail
|
||||
* using libcurl's POP3 capabilities.
|
||||
*
|
||||
* Note that this example requires libcurl 7.26.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This is just the server URL */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com");
|
||||
|
||||
/* Set the TOP command for message 1 to only include the headers */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "TOP 1 0");
|
||||
|
||||
/* Perform the custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
61
docs/examples/pop3-uidl.c
Normal file
61
docs/examples/pop3-uidl.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example using libcurl's POP3 capabilities to list the
|
||||
* contents of a mailbox by unique ID.
|
||||
*
|
||||
* Note that this example requires libcurl 7.26.0 or above.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This is just the server URL */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com");
|
||||
|
||||
/* Set the UIDL command */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "UIDL");
|
||||
|
||||
/* Perform the custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
111
docs/examples/postinmemory.c
Normal file
111
docs/examples/postinmemory.c
Normal file
@@ -0,0 +1,111 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
struct MemoryStruct {
|
||||
char *memory;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
static size_t
|
||||
WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
size_t realsize = size * nmemb;
|
||||
struct MemoryStruct *mem = (struct MemoryStruct *)userp;
|
||||
|
||||
mem->memory = realloc(mem->memory, mem->size + realsize + 1);
|
||||
if(mem->memory == NULL) {
|
||||
/* out of memory! */
|
||||
printf("not enough memory (realloc returned NULL)\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(&(mem->memory[mem->size]), contents, realsize);
|
||||
mem->size += realsize;
|
||||
mem->memory[mem->size] = 0;
|
||||
|
||||
return realsize;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
struct MemoryStruct chunk;
|
||||
static const char *postthis="Field=1&Field=2&Field=3";
|
||||
|
||||
chunk.memory = malloc(1); /* will be grown as needed by realloc above */
|
||||
chunk.size = 0; /* no data at this point */
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.org/");
|
||||
|
||||
/* send all data to this function */
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
|
||||
|
||||
/* we pass our 'chunk' struct to the callback function */
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
|
||||
|
||||
/* some servers don't like requests that are made without a user-agent
|
||||
field, so we provide one */
|
||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postthis);
|
||||
|
||||
/* if we don't provide POSTFIELDSIZE, libcurl will strlen() by
|
||||
itself */
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(postthis));
|
||||
|
||||
/* Perform the request, res will get the return code */
|
||||
res = curl_easy_perform(curl);
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK) {
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* Now, our chunk.memory points to a memory block that is chunk.size
|
||||
* bytes big and contains the remote file.
|
||||
*
|
||||
* Do something nice with it!
|
||||
*/
|
||||
printf("%s\n",chunk.memory);
|
||||
}
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
if(chunk.memory)
|
||||
free(chunk.memory);
|
||||
|
||||
/* we're done with libcurl, so clean it up */
|
||||
curl_global_cleanup();
|
||||
}
|
||||
return 0;
|
||||
}
|
105
docs/examples/sessioninfo.c
Normal file
105
docs/examples/sessioninfo.c
Normal file
@@ -0,0 +1,105 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* Note that this example currently requires cURL to be linked against
|
||||
GnuTLS (and this program must also be linked against -lgnutls). */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <gnutls/gnutls.h>
|
||||
|
||||
static CURL *curl;
|
||||
|
||||
static size_t wrfu(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
const struct curl_tlssessioninfo *info;
|
||||
unsigned int cert_list_size;
|
||||
const gnutls_datum_t *chainp;
|
||||
CURLcode res;
|
||||
|
||||
(void)stream;
|
||||
(void)ptr;
|
||||
|
||||
res = curl_easy_getinfo(curl, CURLINFO_TLS_SESSION, &info);
|
||||
|
||||
if(!res) {
|
||||
switch(info->backend) {
|
||||
case CURLSSLBACKEND_GNUTLS:
|
||||
/* info->internals is now the gnutls_session_t */
|
||||
chainp = gnutls_certificate_get_peers(info->internals, &cert_list_size);
|
||||
if((chainp) && (cert_list_size)) {
|
||||
unsigned int i;
|
||||
|
||||
for(i = 0; i < cert_list_size; i++) {
|
||||
gnutls_x509_crt_t cert;
|
||||
gnutls_datum_t dn;
|
||||
|
||||
if(GNUTLS_E_SUCCESS == gnutls_x509_crt_init(&cert)) {
|
||||
if(GNUTLS_E_SUCCESS ==
|
||||
gnutls_x509_crt_import(cert, &chainp[i], GNUTLS_X509_FMT_DER)) {
|
||||
if(GNUTLS_E_SUCCESS ==
|
||||
gnutls_x509_crt_print(cert, GNUTLS_CRT_PRINT_FULL, &dn)) {
|
||||
fprintf(stderr, "Certificate #%d: %.*s", i, dn.size, dn.data);
|
||||
|
||||
gnutls_free(dn.data);
|
||||
}
|
||||
}
|
||||
|
||||
gnutls_x509_crt_deinit(cert);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CURLSSLBACKEND_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return size * nmemb;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, wrfu);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L);
|
||||
|
||||
(void) curl_easy_perform(curl);
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
curl_global_cleanup();
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,87 +0,0 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
struct curl_slist *recipients = NULL;
|
||||
|
||||
/* value for envelope reverse-path */
|
||||
static const char *from = "<bradh@example.com>";
|
||||
|
||||
/* this becomes the envelope forward-path */
|
||||
static const char *to = "<bradh@example.net>";
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* this is the URL for your mailserver - you can also use an smtps:// URL
|
||||
* here */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.net.");
|
||||
|
||||
/* Note that this option isn't strictly required, omitting it will result in
|
||||
* libcurl will sent the MAIL FROM command with no sender data. All
|
||||
* autoresponses should have an empty reverse-path, and should be directed
|
||||
* to the address in the reverse-path which triggered them. Otherwise, they
|
||||
* could cause an endless loop. See RFC 5321 Section 4.5.5 for more details.
|
||||
*/
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, from);
|
||||
|
||||
/* Note that the CURLOPT_MAIL_RCPT takes a list, not a char array. */
|
||||
recipients = curl_slist_append(recipients, to);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
|
||||
|
||||
/* You provide the payload (headers and the body of the message) as the
|
||||
* "data" element. There are two choices, either:
|
||||
* - provide a callback function and specify the function name using the
|
||||
* CURLOPT_READFUNCTION option; or
|
||||
* - just provide a FILE pointer that can be used to read the data from.
|
||||
* The easiest case is just to read from standard input, (which is available
|
||||
* as a FILE pointer) as shown here.
|
||||
*/
|
||||
curl_easy_setopt(curl, CURLOPT_READDATA, stdin);
|
||||
|
||||
/* send the message (including headers) */
|
||||
res = curl_easy_perform(curl);
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* free the list of recipients */
|
||||
curl_slist_free_all(recipients);
|
||||
|
||||
/* curl won't send the QUIT command until you call cleanup, so you should be
|
||||
* able to re-use this connection for additional messages (setting
|
||||
* CURLOPT_MAIL_FROM and CURLOPT_MAIL_RCPT as required, and calling
|
||||
* curl_easy_perform() again. It may not be a good idea to keep the
|
||||
* connection open for a very long time though (more than a few minutes may
|
||||
* result in the server timing out the connection), and you do want to clean
|
||||
* up in the end.
|
||||
*/
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
return 0;
|
||||
}
|
73
docs/examples/smtp-expn.c
Normal file
73
docs/examples/smtp-expn.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to expand an email mailing list.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
* 1) This example requires libcurl 7.34.0 or above.
|
||||
* 2) Not all email servers support this command.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
struct curl_slist *recipients = NULL;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* This is the URL for your mailserver */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");
|
||||
|
||||
/* Note that the CURLOPT_MAIL_RCPT takes a list, not a char array */
|
||||
recipients = curl_slist_append(recipients, "Friends");
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
|
||||
|
||||
/* Set the EXPN command */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "EXPN");
|
||||
|
||||
/* Perform the custom request */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Free the list of recipients */
|
||||
curl_slist_free_all(recipients);
|
||||
|
||||
/* Curl won't send the QUIT command until you call cleanup, so you should
|
||||
* be able to re-use this connection for additional requests. It may not be
|
||||
* a good idea to keep the connection open for a very long time though
|
||||
* (more than a few minutes may result in the server timing out the
|
||||
* connection) and you do want to clean up in the end.
|
||||
*/
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
137
docs/examples/smtp-mail.c
Normal file
137
docs/examples/smtp-mail.c
Normal file
@@ -0,0 +1,137 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to send mail using libcurl's SMTP
|
||||
* capabilities. For an exmaple of using the multi interface please see
|
||||
* smtp-multi.c.
|
||||
*
|
||||
* Note that this example requires libcurl 7.20.0 or above.
|
||||
*/
|
||||
|
||||
#define FROM "<sender@example.org>"
|
||||
#define TO "<addressee@example.net>"
|
||||
#define CC "<info@example.org>"
|
||||
|
||||
static const char *payload_text[] = {
|
||||
"Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
|
||||
"To: " TO "\r\n",
|
||||
"From: " FROM "(Example User)\r\n",
|
||||
"Cc: " CC "(Another example User)\r\n",
|
||||
"Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\r\n",
|
||||
"Subject: SMTP example message\r\n",
|
||||
"\r\n", /* empty line to divide headers from body, see RFC5322 */
|
||||
"The body of the message starts here.\r\n",
|
||||
"\r\n",
|
||||
"It could be a lot of lines, could be MIME encoded, whatever.\r\n",
|
||||
"Check RFC5322.\r\n",
|
||||
NULL
|
||||
};
|
||||
|
||||
struct upload_status {
|
||||
int lines_read;
|
||||
};
|
||||
|
||||
static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
struct upload_status *upload_ctx = (struct upload_status *)userp;
|
||||
const char *data;
|
||||
|
||||
if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
data = payload_text[upload_ctx->lines_read];
|
||||
|
||||
if(data) {
|
||||
size_t len = strlen(data);
|
||||
memcpy(ptr, data, len);
|
||||
upload_ctx->lines_read++;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
struct curl_slist *recipients = NULL;
|
||||
struct upload_status upload_ctx;
|
||||
|
||||
upload_ctx.lines_read = 0;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* This is the URL for your mailserver */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");
|
||||
|
||||
/* Note that this option isn't strictly required, omitting it will result in
|
||||
* libcurl sending the MAIL FROM command with empty sender data. All
|
||||
* autoresponses should have an empty reverse-path, and should be directed
|
||||
* to the address in the reverse-path which triggered them. Otherwise, they
|
||||
* could cause an endless loop. See RFC 5321 Section 4.5.5 for more details.
|
||||
*/
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM);
|
||||
|
||||
/* Add two recipients, in this particular case they correspond to the
|
||||
* To: and Cc: addressees in the header, but they could be any kind of
|
||||
* recipient. */
|
||||
recipients = curl_slist_append(recipients, TO);
|
||||
recipients = curl_slist_append(recipients, CC);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
|
||||
|
||||
/* We're using a callback function to specify the payload (the headers and
|
||||
* body of the message). You could just use the CURLOPT_READDATA option to
|
||||
* specify a FILE pointer to read from. */
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
|
||||
curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
|
||||
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
|
||||
/* Send the message */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Free the list of recipients */
|
||||
curl_slist_free_all(recipients);
|
||||
|
||||
/* curl won't send the QUIT command until you call cleanup, so you should be
|
||||
* able to re-use this connection for additional messages (setting
|
||||
* CURLOPT_MAIL_FROM and CURLOPT_MAIL_RCPT as required, and calling
|
||||
* curl_easy_perform() again. It may not be a good idea to keep the
|
||||
* connection open for a very long time though (more than a few minutes may
|
||||
* result in the server timing out the connection), and you do want to clean
|
||||
* up in the end.
|
||||
*/
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -19,139 +19,151 @@
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
/* This is an example application source code sending SMTP mail using the
|
||||
* multi interface.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/*
|
||||
* This is the list of basic details you need to tweak to get things right.
|
||||
/* This is an example showing how to send mail using libcurl's SMTP
|
||||
* capabilities. It builds on the smtp-mail.c example to demonstrate how to use
|
||||
* libcurl's multi interface.
|
||||
*
|
||||
* Note that this example requires libcurl 7.20.0 or above.
|
||||
*/
|
||||
#define USERNAME "user@example.com"
|
||||
#define PASSWORD "123qwerty"
|
||||
#define SMTPSERVER "smtp.example.com"
|
||||
#define SMTPPORT ":587" /* it is a colon+port string, but you can set it
|
||||
to "" to use the default port */
|
||||
#define RECIPIENT "<recipient@example.com>"
|
||||
#define MAILFROM "<realuser@example.com>"
|
||||
|
||||
#define FROM "<sender@example.com>"
|
||||
#define TO "<recipient@example.com>"
|
||||
#define CC "<info@example.com>"
|
||||
|
||||
#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000
|
||||
|
||||
/* Note that you should include the actual meta data headers here as well if
|
||||
you want the mail to have a Subject, another From:, show a To: or whatever
|
||||
you think your mail should feature! */
|
||||
static const char *text[]={
|
||||
"one\n",
|
||||
"two\n",
|
||||
"three\n",
|
||||
" Hello, this is CURL email SMTP\n",
|
||||
static const char *payload_text[] = {
|
||||
"Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
|
||||
"To: " TO "\r\n",
|
||||
"From: " FROM "(Example User)\r\n",
|
||||
"Cc: " CC "(Another example User)\r\n",
|
||||
"Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\r\n",
|
||||
"Subject: SMTP multi example message\r\n",
|
||||
"\r\n", /* empty line to divide headers from body, see RFC5322 */
|
||||
"The body of the message starts here.\r\n",
|
||||
"\r\n",
|
||||
"It could be a lot of lines, could be MIME encoded, whatever.\r\n",
|
||||
"Check RFC5322.\r\n",
|
||||
NULL
|
||||
};
|
||||
|
||||
struct WriteThis {
|
||||
int counter;
|
||||
struct upload_status {
|
||||
int lines_read;
|
||||
};
|
||||
|
||||
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp)
|
||||
static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
struct WriteThis *pooh = (struct WriteThis *)userp;
|
||||
struct upload_status *upload_ctx = (struct upload_status *)userp;
|
||||
const char *data;
|
||||
|
||||
if(size*nmemb < 1)
|
||||
if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
data = text[pooh->counter];
|
||||
data = payload_text[upload_ctx->lines_read];
|
||||
|
||||
if(data) {
|
||||
size_t len = strlen(data);
|
||||
memcpy(ptr, data, len);
|
||||
pooh->counter++; /* advance pointer */
|
||||
upload_ctx->lines_read++;
|
||||
|
||||
return len;
|
||||
}
|
||||
return 0; /* no more data left to deliver */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct timeval tvnow(void)
|
||||
{
|
||||
/*
|
||||
** time() returns the value of time in seconds since the Epoch.
|
||||
*/
|
||||
struct timeval now;
|
||||
|
||||
/* time() returns the value of time in seconds since the epoch */
|
||||
now.tv_sec = (long)time(NULL);
|
||||
now.tv_usec = 0;
|
||||
|
||||
return now;
|
||||
}
|
||||
|
||||
static long tvdiff(struct timeval newer, struct timeval older)
|
||||
{
|
||||
return (newer.tv_sec-older.tv_sec)*1000+
|
||||
(newer.tv_usec-older.tv_usec)/1000;
|
||||
return (newer.tv_sec - older.tv_sec) * 1000 +
|
||||
(newer.tv_usec - older.tv_usec) / 1000;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLM *mcurl;
|
||||
int still_running = 1;
|
||||
struct timeval mp_start;
|
||||
struct WriteThis pooh;
|
||||
struct curl_slist* rcpt_list = NULL;
|
||||
CURL *curl;
|
||||
CURLM *mcurl;
|
||||
int still_running = 1;
|
||||
struct timeval mp_start;
|
||||
struct curl_slist *recipients = NULL;
|
||||
struct upload_status upload_ctx;
|
||||
|
||||
pooh.counter = 0;
|
||||
upload_ctx.lines_read = 0;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl)
|
||||
return 1;
|
||||
curl = curl_easy_init();
|
||||
if(!curl)
|
||||
return 1;
|
||||
|
||||
mcurl = curl_multi_init();
|
||||
if(!mcurl)
|
||||
return 2;
|
||||
mcurl = curl_multi_init();
|
||||
if(!mcurl)
|
||||
return 2;
|
||||
|
||||
rcpt_list = curl_slist_append(rcpt_list, RECIPIENT);
|
||||
/* more addresses can be added here
|
||||
rcpt_list = curl_slist_append(rcpt_list, "<others@example.com>");
|
||||
/* This is the URL for your mailserver */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");
|
||||
|
||||
/* Note that this option isn't strictly required, omitting it will result in
|
||||
* libcurl sending the MAIL FROM command with empty sender data. All
|
||||
* autoresponses should have an empty reverse-path, and should be directed
|
||||
* to the address in the reverse-path which triggered them. Otherwise, they
|
||||
* could cause an endless loop. See RFC 5321 Section 4.5.5 for more details.
|
||||
*/
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "smtp://" SMTPSERVER SMTPPORT);
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME);
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD);
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
|
||||
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
curl_easy_setopt(curl, CURLOPT_READDATA, &pooh);
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_SSLVERSION, 0L);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_SESSIONID_CACHE, 0L);
|
||||
curl_multi_add_handle(mcurl, curl);
|
||||
/* Add two recipients, in this particular case they correspond to the
|
||||
* To: and Cc: addressees in the header, but they could be any kind of
|
||||
* recipient. */
|
||||
recipients = curl_slist_append(recipients, TO);
|
||||
recipients = curl_slist_append(recipients, CC);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
|
||||
|
||||
mp_start = tvnow();
|
||||
/* We're using a callback function to specify the payload (the headers and
|
||||
* body of the message). You could just use the CURLOPT_READDATA option to
|
||||
* specify a FILE pointer to read from. */
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
|
||||
curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
|
||||
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
|
||||
/* we start some action by calling perform right away */
|
||||
/* Tell the multi stack about our easy handle */
|
||||
curl_multi_add_handle(mcurl, curl);
|
||||
|
||||
/* Record the start time which we can use later */
|
||||
mp_start = tvnow();
|
||||
|
||||
/* We start some action by calling perform right away */
|
||||
curl_multi_perform(mcurl, &still_running);
|
||||
|
||||
while(still_running) {
|
||||
struct timeval timeout;
|
||||
int rc; /* select() return code */
|
||||
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
int maxfd = -1;
|
||||
int rc;
|
||||
|
||||
long curl_timeo = -1;
|
||||
|
||||
/* Initialise the file descriptors */
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
|
||||
/* set a suitable timeout to play around with */
|
||||
/* Set a suitable timeout to play around with */
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
@@ -164,7 +176,7 @@ int main(void)
|
||||
timeout.tv_usec = (curl_timeo % 1000) * 1000;
|
||||
}
|
||||
|
||||
/* get file descriptors from the transfers */
|
||||
/* Get file descriptors from the transfers */
|
||||
curl_multi_fdset(mcurl, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
|
||||
/* In a real-world program you OF COURSE check the return code of the
|
||||
@@ -172,32 +184,32 @@ int main(void)
|
||||
greater or equal than -1. We call select(maxfd + 1, ...), specially in
|
||||
case of (maxfd == -1), we call select(0, ...), which is basically equal
|
||||
to sleep. */
|
||||
|
||||
rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
|
||||
if (tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
|
||||
fprintf(stderr, "ABORTING TEST, since it seems "
|
||||
"that it would have run forever.\n");
|
||||
if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
|
||||
fprintf(stderr,
|
||||
"ABORTING: Since it seems that we would have run forever.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
switch(rc) {
|
||||
case -1:
|
||||
/* select error */
|
||||
case -1: /* select error */
|
||||
break;
|
||||
case 0: /* timeout */
|
||||
default: /* action */
|
||||
case 0: /* timeout */
|
||||
default: /* action */
|
||||
curl_multi_perform(mcurl, &still_running);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
curl_slist_free_all(rcpt_list);
|
||||
/* Free the list of recipients */
|
||||
curl_slist_free_all(recipients);
|
||||
|
||||
/* Always cleanup */
|
||||
curl_multi_remove_handle(mcurl, curl);
|
||||
curl_multi_cleanup(mcurl);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
161
docs/examples/smtp-ssl.c
Normal file
161
docs/examples/smtp-ssl.c
Normal file
@@ -0,0 +1,161 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to send mail using libcurl's SMTP
|
||||
* capabilities. It builds on the smtp-mail.c example to add authentication
|
||||
* and, more importantly, transport security to protect the authentication
|
||||
* details from being snooped.
|
||||
*
|
||||
* Note that this example requires libcurl 7.20.0 or above.
|
||||
*/
|
||||
|
||||
#define FROM "<sender@example.org>"
|
||||
#define TO "<addressee@example.net>"
|
||||
#define CC "<info@example.org>"
|
||||
|
||||
static const char *payload_text[] = {
|
||||
"Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
|
||||
"To: " TO "\r\n",
|
||||
"From: " FROM "(Example User)\r\n",
|
||||
"Cc: " CC "(Another example User)\r\n",
|
||||
"Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\r\n",
|
||||
"Subject: SMTP SSL example message\r\n",
|
||||
"\r\n", /* empty line to divide headers from body, see RFC5322 */
|
||||
"The body of the message starts here.\r\n",
|
||||
"\r\n",
|
||||
"It could be a lot of lines, could be MIME encoded, whatever.\r\n",
|
||||
"Check RFC5322.\r\n",
|
||||
NULL
|
||||
};
|
||||
|
||||
struct upload_status {
|
||||
int lines_read;
|
||||
};
|
||||
|
||||
static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
struct upload_status *upload_ctx = (struct upload_status *)userp;
|
||||
const char *data;
|
||||
|
||||
if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
data = payload_text[upload_ctx->lines_read];
|
||||
|
||||
if(data) {
|
||||
size_t len = strlen(data);
|
||||
memcpy(ptr, data, len);
|
||||
upload_ctx->lines_read++;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
struct curl_slist *recipients = NULL;
|
||||
struct upload_status upload_ctx;
|
||||
|
||||
upload_ctx.lines_read = 0;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This is the URL for your mailserver. Note the use of smtps:// rather
|
||||
* than smtp:// to request a SSL based connection. */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "smtps://mainserver.example.net");
|
||||
|
||||
/* If you want to connect to a site who isn't using a certificate that is
|
||||
* signed by one of the certs in the CA bundle you have, you can skip the
|
||||
* verification of the server's certificate. This makes the connection
|
||||
* A LOT LESS SECURE.
|
||||
*
|
||||
* If you have a CA cert for the server stored someplace else than in the
|
||||
* default bundle, then the CURLOPT_CAPATH option might come handy for
|
||||
* you. */
|
||||
#ifdef SKIP_PEER_VERIFICATION
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
#endif
|
||||
|
||||
/* If the site you're connecting to uses a different host name that what
|
||||
* they have mentioned in their server certificate's commonName (or
|
||||
* subjectAltName) fields, libcurl will refuse to connect. You can skip
|
||||
* this check, but this will make the connection less secure. */
|
||||
#ifdef SKIP_HOSTNAME_VERFICATION
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
#endif
|
||||
|
||||
/* Note that this option isn't strictly required, omitting it will result in
|
||||
* libcurl sending the MAIL FROM command with empty sender data. All
|
||||
* autoresponses should have an empty reverse-path, and should be directed
|
||||
* to the address in the reverse-path which triggered them. Otherwise, they
|
||||
* could cause an endless loop. See RFC 5321 Section 4.5.5 for more details.
|
||||
*/
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM);
|
||||
|
||||
/* Add two recipients, in this particular case they correspond to the
|
||||
* To: and Cc: addressees in the header, but they could be any kind of
|
||||
* recipient. */
|
||||
recipients = curl_slist_append(recipients, TO);
|
||||
recipients = curl_slist_append(recipients, CC);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
|
||||
|
||||
/* We're using a callback function to specify the payload (the headers and
|
||||
* body of the message). You could just use the CURLOPT_READDATA option to
|
||||
* specify a FILE pointer to read from. */
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
|
||||
curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
|
||||
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
|
||||
/* Since the traffic will be encrypted, it is very useful to turn on debug
|
||||
* information within libcurl to see what is happening during the
|
||||
* transfer */
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
/* Send the message */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Free the list of recipients */
|
||||
curl_slist_free_all(recipients);
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return (int)res;
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -24,26 +24,29 @@
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to send mail using libcurl's SMTP
|
||||
* capabilities. It builds on the simplesmtp.c example, adding some
|
||||
* authentication and transport security.
|
||||
* capabilities. It builds on the smtp-mail.c example to add authentication
|
||||
* and, more importantly, transport security to protect the authentication
|
||||
* details from being snooped.
|
||||
*
|
||||
* Note that this example requires libcurl 7.20.0 or above.
|
||||
*/
|
||||
|
||||
#define FROM "<sender@example.org>"
|
||||
#define TO "<addressee@example.net>"
|
||||
#define CC "<info@example.org>"
|
||||
|
||||
static const char *payload_text[]={
|
||||
"Date: Mon, 29 Nov 2010 21:54:29 +1100\n",
|
||||
"To: " TO "\n",
|
||||
"From: " FROM "(Example User)\n",
|
||||
"Cc: " CC "(Another example User)\n",
|
||||
"Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\n",
|
||||
"Subject: SMTP TLS example message\n",
|
||||
"\n", /* empty line to divide headers from body, see RFC5322 */
|
||||
"The body of the message starts here.\n",
|
||||
"\n",
|
||||
"It could be a lot of lines, could be MIME encoded, whatever.\n",
|
||||
"Check RFC5322.\n",
|
||||
static const char *payload_text[] = {
|
||||
"Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
|
||||
"To: " TO "\r\n",
|
||||
"From: " FROM "(Example User)\r\n",
|
||||
"Cc: " CC "(Another example User)\r\n",
|
||||
"Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\r\n",
|
||||
"Subject: SMTP TLS example message\r\n",
|
||||
"\r\n", /* empty line to divide headers from body, see RFC5322 */
|
||||
"The body of the message starts here.\r\n",
|
||||
"\r\n",
|
||||
"It could be a lot of lines, could be MIME encoded, whatever.\r\n",
|
||||
"Check RFC5322.\r\n",
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -56,33 +59,38 @@ static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
|
||||
struct upload_status *upload_ctx = (struct upload_status *)userp;
|
||||
const char *data;
|
||||
|
||||
if ((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
|
||||
if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
data = payload_text[upload_ctx->lines_read];
|
||||
|
||||
if (data) {
|
||||
if(data) {
|
||||
size_t len = strlen(data);
|
||||
memcpy(ptr, data, len);
|
||||
upload_ctx->lines_read ++;
|
||||
upload_ctx->lines_read++;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
CURLcode res = CURLE_OK;
|
||||
struct curl_slist *recipients = NULL;
|
||||
struct upload_status upload_ctx;
|
||||
|
||||
upload_ctx.lines_read = 0;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if (curl) {
|
||||
if(curl) {
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
|
||||
|
||||
/* This is the URL for your mailserver. Note the use of port 587 here,
|
||||
* instead of the normal SMTP port (25). Port 587 is commonly used for
|
||||
* secure mail submission (see RFC4403), but you should use whatever
|
||||
@@ -106,18 +114,17 @@ int main(void)
|
||||
* Instead, you should get the issuer certificate (or the host certificate
|
||||
* if the certificate is self-signed) and add it to the set of certificates
|
||||
* that are known to libcurl using CURLOPT_CAINFO and/or CURLOPT_CAPATH. See
|
||||
* docs/SSLCERTS for more information.
|
||||
*/
|
||||
* docs/SSLCERTS for more information. */
|
||||
curl_easy_setopt(curl, CURLOPT_CAINFO, "/path/to/certificate.pem");
|
||||
|
||||
/* A common reason for requiring transport security is to protect
|
||||
* authentication details (user names and passwords) from being "snooped"
|
||||
* on the network. Here is how the user name and password are provided: */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user@example.net");
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, "P@ssw0rd");
|
||||
|
||||
/* value for envelope reverse-path */
|
||||
/* Note that this option isn't strictly required, omitting it will result in
|
||||
* libcurl sending the MAIL FROM command with empty sender data. All
|
||||
* autoresponses should have an empty reverse-path, and should be directed
|
||||
* to the address in the reverse-path which triggered them. Otherwise, they
|
||||
* could cause an endless loop. See RFC 5321 Section 4.5.5 for more details.
|
||||
*/
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM);
|
||||
|
||||
/* Add two recipients, in this particular case they correspond to the
|
||||
* To: and Cc: addressees in the header, but they could be any kind of
|
||||
* recipient. */
|
||||
@@ -125,28 +132,32 @@ int main(void)
|
||||
recipients = curl_slist_append(recipients, CC);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
|
||||
|
||||
/* In this case, we're using a callback function to specify the data. You
|
||||
* could just use the CURLOPT_READDATA option to specify a FILE pointer to
|
||||
* read from.
|
||||
*/
|
||||
/* We're using a callback function to specify the payload (the headers and
|
||||
* body of the message). You could just use the CURLOPT_READDATA option to
|
||||
* specify a FILE pointer to read from. */
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
|
||||
curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
|
||||
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
|
||||
/* Since the traffic will be encrypted, it is very useful to turn on debug
|
||||
* information within libcurl to see what is happening during the transfer.
|
||||
*/
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
/* send the message (including headers) */
|
||||
/* Send the message */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* free the list of recipients and clean up */
|
||||
/* Free the list of recipients */
|
||||
curl_slist_free_all(recipients);
|
||||
|
||||
/* Always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
return 0;
|
||||
|
||||
return (int)res;
|
||||
}
|
||||
|
73
docs/examples/smtp-vrfy.c
Normal file
73
docs/examples/smtp-vrfy.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* This is a simple example showing how to verify an email address from an
|
||||
* SMTP server.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
* 1) This example requires libcurl 7.34.0 or above.
|
||||
* 2) Not all email servers support this command and even if your email server
|
||||
* does support it, it may respond with a 252 response code even though the
|
||||
* address doesn't exist.
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
struct curl_slist *recipients = NULL;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* This is the URL for your mailserver */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");
|
||||
|
||||
/* Note that the CURLOPT_MAIL_RCPT takes a list, not a char array */
|
||||
recipients = curl_slist_append(recipients, "<recipient@example.com>");
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
|
||||
|
||||
/* Perform the VRFY */
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* Free the list of recipients */
|
||||
curl_slist_free_all(recipients);
|
||||
|
||||
/* Curl won't send the QUIT command until you call cleanup, so you should
|
||||
* be able to re-use this connection for additional requests. It may not be
|
||||
* a good idea to keep the connection open for a very long time though
|
||||
* (more than a few minutes may result in the server timing out the
|
||||
* connection) and you do want to clean up in the end.
|
||||
*/
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@@ -22,8 +22,9 @@
|
||||
/* Example using an in memory PEM user certificate and RSA key to retrieve an
|
||||
* https page.
|
||||
* Written by Ishan SinghLevett, based on Theo Borm's cacertinmem.c.
|
||||
* Note this example does not use a CA certificate, however one should be used
|
||||
* if you want a properly secure connection
|
||||
* Note that to maintain simplicity this example does not use a CA certificate
|
||||
* for peer verification. However, some form of peer verification
|
||||
* must be used in real circumstances when a secure connection is required.
|
||||
*/
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
@@ -152,6 +153,18 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
|
||||
printf("Use Key failed\n");
|
||||
}
|
||||
|
||||
/* free resources that have been allocated by openssl functions */
|
||||
if (bio)
|
||||
BIO_free(bio);
|
||||
|
||||
if (kbio)
|
||||
BIO_free(kbio);
|
||||
|
||||
if (rsa)
|
||||
RSA_free(rsa);
|
||||
|
||||
if (cert)
|
||||
X509_free(cert);
|
||||
|
||||
/* all set to go */
|
||||
return CURLE_OK ;
|
||||
|
@@ -79,9 +79,12 @@ PDFPAGES = curl_easy_cleanup.pdf curl_easy_getinfo.pdf \
|
||||
curl_multi_assign.pdf curl_easy_pause.pdf curl_easy_recv.pdf \
|
||||
curl_easy_send.pdf curl_multi_socket_action.pdf curl_multi_wait.pdf
|
||||
|
||||
m4macrodir = $(datadir)/aclocal
|
||||
dist_m4macro_DATA = libcurl.m4
|
||||
|
||||
CLEANFILES = $(HTMLPAGES) $(PDFPAGES)
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(HTMLPAGES) index.html $(PDFPAGES) libcurl.m4 ABI \
|
||||
EXTRA_DIST = $(man_MANS) $(HTMLPAGES) index.html $(PDFPAGES) ABI \
|
||||
symbols-in-versions symbols.pl
|
||||
MAN2HTML= roffit --mandir=. < $< >$@
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
.\" * | (__| |_| | _ <| |___
|
||||
.\" * \___|\___/|_| \_\_____|
|
||||
.\" *
|
||||
.\" * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
.\" * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
.\" *
|
||||
.\" * This software is licensed as described in the file COPYING, which
|
||||
.\" * you should have received as part of this distribution. The terms
|
||||
@@ -219,8 +219,20 @@ done. The struct reports how many certs it found and then you can extract info
|
||||
for each of those certs by following the linked lists. The info chain is
|
||||
provided in a series of data in the format "name:content" where the content is
|
||||
for the specific named data. See also the certinfo.c example. NOTE: this
|
||||
option is only available in libcurl built with OpenSSL support. (Added in
|
||||
7.19.1)
|
||||
option is only available in libcurl built with OpenSSL, NSS, GSKit or QsoSSL
|
||||
support. (Added in 7.19.1)
|
||||
.IP CURLINFO_TLS_SESSION
|
||||
Pass a pointer to a 'struct curl_tlsinfo *'. The pointer will be initialized
|
||||
to refer to a 'struct curl_tlsinfo *' that will contain an enum indicating the
|
||||
SSL library used for the handshake and the respective internal TLS session
|
||||
structure of this underlying SSL library.
|
||||
|
||||
This may then be used to extract certificate information in a format
|
||||
convenient for further processing, such as manual validation. NOTE: this
|
||||
option may not be available for all SSL backends; unsupported SSL backends
|
||||
will return 'CURLSSLBACKEND_NONE' to indicate that they are not supported;
|
||||
this does not mean that no SSL backend was used. (Added in 7.34.0)
|
||||
|
||||
.IP CURLINFO_CONDITION_UNMET
|
||||
Pass a pointer to a long to receive the number 1 if the condition provided in
|
||||
the previous request didn't match (see \fICURLOPT_TIMECONDITION\fP). Alas, if
|
||||
|
@@ -31,15 +31,18 @@ curl_easy_pause - pause and unpause a connection
|
||||
Using this function, you can explicitly mark a running connection to get
|
||||
paused, and you can unpause a connection that was previously paused.
|
||||
|
||||
A connection can be paused by using this function or by letting the read
|
||||
or the write callbacks return the proper magic return code
|
||||
A connection can be paused by using this function or by letting the read or
|
||||
the write callbacks return the proper magic return code
|
||||
(\fICURL_READFUNC_PAUSE\fP and \fICURL_WRITEFUNC_PAUSE\fP). A write callback
|
||||
that returns pause signals to the library that it couldn't take care of any
|
||||
data at all, and that data will then be delivered again to the callback when
|
||||
the writing is later unpaused.
|
||||
|
||||
NOTE: while it may feel tempting, take care and notice that you cannot call
|
||||
this function from another thread.
|
||||
While it may feel tempting, take care and notice that you cannot call this
|
||||
function from another thread. To unpause, you may for example call it from the
|
||||
progress callback (see \fIcurl_easy_setopt(3)\fP's
|
||||
\fICURLOPT_PROGRESSFUNCTION\fP), which gets called at least once per second,
|
||||
even if the connection is paused.
|
||||
|
||||
When this function is called to unpause reading, the chance is high that you
|
||||
will get your write callback called before this function returns.
|
||||
@@ -65,6 +68,10 @@ Convenience define that unpauses both directions
|
||||
CURLE_OK (zero) means that the option was set properly, and a non-zero return
|
||||
code means something wrong occurred after the new state was set. See the
|
||||
\fIlibcurl-errors(3)\fP man page for the full list with descriptions.
|
||||
.SH LIMITATIONS
|
||||
The pausing of transfers does not work with protocols that work without
|
||||
network connectivity, like FILE://. Trying to pause such a transfer, in any
|
||||
direction, will cause problems in the worst case or an error in the best case.
|
||||
.SH AVAILABILITY
|
||||
This function was added in libcurl 7.18.0. Before this version, there was no
|
||||
explicit support for pausing transfers.
|
||||
|
@@ -5,7 +5,7 @@
|
||||
.\" * | (__| |_| | _ <| |___
|
||||
.\" * \___|\___/|_| \_\_____|
|
||||
.\" *
|
||||
.\" * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
.\" *
|
||||
.\" * This software is licensed as described in the file COPYING, which
|
||||
.\" * you should have received as part of this distribution. The terms
|
||||
@@ -260,9 +260,9 @@ used to fast forward a file in a resumed upload (instead of reading all
|
||||
uploaded bytes with the normal read function/callback). It is also called to
|
||||
rewind a stream when doing a HTTP PUT or POST with a multi-pass authentication
|
||||
method. The function shall work like "fseek" or "lseek" and accepted SEEK_SET,
|
||||
SEEK_CUR and SEEK_END as argument for origin, although (in 7.18.0) libcurl
|
||||
only passes SEEK_SET. The callback must return 0 (CURL_SEEKFUNC_OK) on
|
||||
success, 1 (CURL_SEEKFUNC_FAIL) to cause the upload operation to fail or 2
|
||||
SEEK_CUR and SEEK_END as argument for origin, although libcurl currently only
|
||||
passes SEEK_SET. The callback must return 0 (CURL_SEEKFUNC_OK) on success, 1
|
||||
(CURL_SEEKFUNC_FAIL) to cause the upload operation to fail or 2
|
||||
(CURL_SEEKFUNC_CANTSEEK) to indicate that while the seek failed, libcurl is
|
||||
free to work around the problem if possible. The latter can sometimes be done
|
||||
by instead reading from the input or similar.
|
||||
@@ -891,6 +891,19 @@ Active Directory server.
|
||||
For more information about the individual components of a LDAP URL please
|
||||
see RFC4516.
|
||||
|
||||
.B RTMP
|
||||
|
||||
There's no official URL spec for RTMP so libcurl uses the URL syntax supported
|
||||
by the underlying librtmp library. It has a syntax where it wants a
|
||||
traditional URL, followed by a space and a series of space-separated
|
||||
name=value pairs.
|
||||
|
||||
While space is not typically a "legal" letter, libcurl accepts them. When a
|
||||
user wants to pass in a '#' (hash) character it will be treated as a fragment
|
||||
and get cut off by libcurl if provided literally. You will instead have to
|
||||
escape it by providing it as backslash and its ASCII value in hexadecimal:
|
||||
"\\23".
|
||||
|
||||
.B NOTES
|
||||
|
||||
Starting with version 7.20.0, the fragment part of the URI will not be sent as
|
||||
@@ -1118,7 +1131,7 @@ option is omitted, and \fICURLOPT_NETRC\fP is set, libcurl will attempt to
|
||||
find a .netrc file in the current user's home directory. (Added in 7.10.9)
|
||||
.IP CURLOPT_USERPWD
|
||||
Pass a char * as parameter, pointing to a zero terminated login details string
|
||||
for the connection. The format of which is: [user name]:[password];[options].
|
||||
for the connection. The format of which is: [user name]:[password].
|
||||
|
||||
When using NTLM, you can set the domain by prepending it to the user name and
|
||||
separating the domain and name with a forward (/) or backward slash (\\). Like
|
||||
@@ -1132,15 +1145,18 @@ and password information to hosts using the initial host name (unless
|
||||
other hosts it will not send the user and password to those. This is enforced
|
||||
to prevent accidental information leakage.
|
||||
|
||||
At present only IMAP, POP3 and SMTP support login options as part of the
|
||||
details string. For more information about the login options please see
|
||||
RFC2384, RFC5092 and IETF draft draft-earhart-url-smtp-00.txt (Added in 7.31.0).
|
||||
|
||||
Use \fICURLOPT_HTTPAUTH\fP to specify the authentication method for HTTP based
|
||||
connections.
|
||||
connections or \fICURLOPT_LOGIN_OPTIONS\fP to control IMAP, POP3 and SMTP
|
||||
options.
|
||||
|
||||
The user and password strings are not URL decoded, so there's no way to send
|
||||
in a user name containing a colon using this option. Use \fICURLOPT_USERNAME\fP
|
||||
for that, or include it in the URL.
|
||||
.IP CURLOPT_PROXYUSERPWD
|
||||
Pass a char * as parameter, which should be [user name]:[password] to use for
|
||||
the connection to the HTTP proxy.
|
||||
the connection to the HTTP proxy. Both the name and the password will be URL
|
||||
decoded before use, so to include for example a colon in the user name you
|
||||
should encode it as %3A.
|
||||
|
||||
Use \fICURLOPT_PROXYAUTH\fP to specify the authentication method.
|
||||
.IP CURLOPT_USERNAME
|
||||
@@ -1151,14 +1167,26 @@ user name to use for the transfer.
|
||||
authentication. You should not use this option together with the (older)
|
||||
CURLOPT_USERPWD option.
|
||||
|
||||
In order to specify the password to be used in conjunction with the user name
|
||||
use the \fICURLOPT_PASSWORD\fP option. (Added in 7.19.1)
|
||||
To specify the password and login options, along with the user name, use the
|
||||
\fICURLOPT_PASSWORD\fP and \fICURLOPT_LOGIN_OPTIONS\fP options. (Added in
|
||||
7.19.1)
|
||||
.IP CURLOPT_PASSWORD
|
||||
Pass a char * as parameter, which should be pointing to the zero terminated
|
||||
password to use for the transfer.
|
||||
|
||||
The CURLOPT_PASSWORD option should be used in conjunction with
|
||||
the \fICURLOPT_USERNAME\fP option. (Added in 7.19.1)
|
||||
The CURLOPT_PASSWORD option should be used in conjunction with the
|
||||
\fICURLOPT_USERNAME\fP option. (Added in 7.19.1)
|
||||
.IP CURLOPT_LOGIN_OPTIONS
|
||||
(Added in 7.34.0) Pass a char * as parameter, which should be pointing to the
|
||||
zero terminated options string to use for the transfer.
|
||||
|
||||
At present only IMAP, POP3 and SMTP support login options. For more
|
||||
information about the login options please see RFC2384, RFC5092 and IETF draft
|
||||
draft-earhart-url-smtp-00.txt
|
||||
|
||||
\fBCURLOPT_LOGIN_OPTIONS\fP can be used to set protocol specific login options,
|
||||
such as the preferred authentication mechanism via "AUTH=NTLM" or "AUTH=*",
|
||||
and should be used in conjunction with the \fICURLOPT_USERNAME\fP option.
|
||||
.IP CURLOPT_PROXYUSERNAME
|
||||
Pass a char * as parameter, which should be pointing to the zero terminated
|
||||
user name to use for the transfer while connecting to Proxy.
|
||||
@@ -1278,8 +1306,7 @@ authentication methods it supports and then pick the best one you allow it to
|
||||
use. For some methods, this will induce an extra network round-trip. Set the
|
||||
actual name and password with the \fICURLOPT_PROXYUSERPWD\fP option. The
|
||||
bitmask can be constructed by or'ing together the bits listed above for the
|
||||
\fICURLOPT_HTTPAUTH\fP option. As of this writing, only Basic, Digest and NTLM
|
||||
work. (Added in 7.10.7)
|
||||
\fICURLOPT_HTTPAUTH\fP option. \fICURLOPT_PROXYAUTH\fP was added in 7.10.7
|
||||
.IP CURLOPT_SASL_IR
|
||||
Pass a long. If the value is 1, curl will send the initial response to the
|
||||
server in the first authentication packet in order to reduce the number of
|
||||
@@ -1289,6 +1316,13 @@ mechanisms and to the IMAP, POP3 and SMTP protocols. (Added in 7.31.0)
|
||||
Note: Whilst IMAP supports this option there is no need to explicitly set it,
|
||||
as libcurl can determine the feature itself when the server supports the
|
||||
SASL-IR CAPABILITY.
|
||||
.IP CURLOPT_XOAUTH2_BEARER
|
||||
Pass a char * as parameter, which should point to the zero terminated OAuth
|
||||
2.0 Bearer Access Token for use with IMAP, POP3 and SMTP servers that support
|
||||
the OAuth 2.0 Authorization Framework. (Added in 7.33.0)
|
||||
|
||||
Note: The user name used to generate the Bearer Token should be supplied via
|
||||
the \fICURLOPT_USERNAME\fP option.
|
||||
.SH HTTP OPTIONS
|
||||
.IP CURLOPT_AUTOREFERER
|
||||
Pass a parameter set to 1 to enable this. When enabled, libcurl will
|
||||
@@ -1631,12 +1665,18 @@ SMTP mail request. The linked list should be a fully valid list of \fBstruct
|
||||
curl_slist\fP structs properly filled in. Use \fIcurl_slist_append(3)\fP to
|
||||
create the list and \fIcurl_slist_free_all(3)\fP to clean up an entire list.
|
||||
|
||||
Each recipient should be specified within a pair of angled brackets (<>),
|
||||
however, should you not use an angled bracket as the first character libcurl
|
||||
will assume you provided a single email address and enclose that address
|
||||
within brackets for you.
|
||||
When performing a mail transfer, each recipient should be specified within a
|
||||
pair of angled brackets (<>), however, should you not use an angled bracket as
|
||||
the first character libcurl will assume you provided a single email address and
|
||||
enclose that address within brackets for you. (Added in 7.20.0)
|
||||
|
||||
(Added in 7.20.0)
|
||||
When performing an address verification (VRFY command), each recipient should
|
||||
be specified as the user name or user name and domain (as per Section 3.5 of
|
||||
RFC5321). (Added in 7.34.0)
|
||||
|
||||
When performing a mailing list expand (EXPN command), each recipient should be
|
||||
specified using the mailing list name, such as "Friends" or "London-Office".
|
||||
(Added in 7.34.0)
|
||||
.IP CURLOPT_MAIL_AUTH
|
||||
Pass a pointer to a zero terminated string as parameter. This will be used
|
||||
to specify the authentication address (identity) of a submitted message that
|
||||
@@ -2008,35 +2048,32 @@ source file to the remote target file.
|
||||
Pass a curl_off_t as parameter. It contains the offset in number of bytes that
|
||||
you want the transfer to start from. (Added in 7.11.0)
|
||||
.IP CURLOPT_CUSTOMREQUEST
|
||||
Pass a pointer to a zero terminated string as parameter. It can be used to
|
||||
specify the request instead of GET or HEAD when performing HTTP based
|
||||
requests, instead of LIST and NLST when performing FTP directory listings and
|
||||
instead of LIST and RETR when issuing POP3 based commands. This is
|
||||
particularly useful, for example, for performing a HTTP DELETE request or a
|
||||
POP3 DELE command.
|
||||
Pass a pointer to a zero terminated string as parameter.
|
||||
|
||||
Please don't perform this at will, on HTTP based requests, by making sure
|
||||
your server supports the command you are sending first.
|
||||
|
||||
When you change the request method by setting \fBCURLOPT_CUSTOMREQUEST\fP to
|
||||
something, you don't actually change how libcurl behaves or acts in regards
|
||||
to the particular request method, it will only change the actual string sent
|
||||
in the request.
|
||||
|
||||
Restore to the internal default by setting this to NULL.
|
||||
|
||||
This option can be used to specify the request:
|
||||
|
||||
.B HTTP
|
||||
|
||||
Instead of GET or HEAD when performing HTTP based requests. This is
|
||||
particularly useful, for example, for performing a HTTP DELETE request.
|
||||
|
||||
For example:
|
||||
|
||||
With the HTTP protocol when you tell libcurl to do a HEAD request, but then
|
||||
specify a GET though a custom request libcurl will still act as if it sent a
|
||||
HEAD. To switch to a proper HEAD use \fICURLOPT_NOBODY\fP, to switch to a
|
||||
proper POST use \fICURLOPT_POST\fP or \fICURLOPT_POSTFIELDS\fP and to switch
|
||||
to a proper GET use CURLOPT_HTTPGET.
|
||||
When you tell libcurl to do a HEAD request, but then specify a GET though a
|
||||
custom request libcurl will still act as if it sent a HEAD. To switch to a
|
||||
proper HEAD use \fICURLOPT_NOBODY\fP, to switch to a proper POST use
|
||||
\fICURLOPT_POST\fP or \fICURLOPT_POSTFIELDS\fP and to switch to a proper GET
|
||||
use CURLOPT_HTTPGET.
|
||||
|
||||
With the POP3 protocol when you tell libcurl to use a custom request it will
|
||||
behave like a LIST or RETR command was sent where it expects data to be
|
||||
returned by the server. As such \fICURLOPT_NOBODY\fP should be used when
|
||||
specifying commands such as DELE and NOOP for example.
|
||||
|
||||
Restore to the internal default by setting this to NULL.
|
||||
Please don't perform this at will, on HTTP based requests, by making sure
|
||||
your server supports the command you are sending first.
|
||||
|
||||
Many people have wrongly used this option to replace the entire request with
|
||||
their own, including multiple headers and POST contents. While that might
|
||||
@@ -2046,7 +2083,35 @@ could possibly confuse the remote server badly. Use \fICURLOPT_POST\fP and
|
||||
replace or extend the set of headers sent by libcurl. Use
|
||||
\fICURLOPT_HTTP_VERSION\fP to change HTTP version.
|
||||
|
||||
(Support for POP3 added in 7.26.0)
|
||||
.B FTP
|
||||
|
||||
Instead of LIST and NLST when performing FTP directory listings.
|
||||
|
||||
.B IMAP
|
||||
|
||||
Instead of LIST when issuing IMAP based requests. (Added in 7.30.0)
|
||||
|
||||
.B POP3
|
||||
|
||||
Instead of LIST and RETR when issuing POP3 based requests. (Added in 7.26.0)
|
||||
|
||||
For example:
|
||||
|
||||
When you tell libcurl to use a custom request it will behave like a LIST or
|
||||
RETR command was sent where it expects data to be returned by the server. As
|
||||
such \fICURLOPT_NOBODY\fP should be used when specifying commands such as
|
||||
DELE and NOOP for example.
|
||||
|
||||
.B SMTP
|
||||
|
||||
Instead of a HELP or VRFY when issuing SMTP based requests. (Added in 7.34.0)
|
||||
|
||||
For example:
|
||||
|
||||
Normally a multiline response is returned which can be used, in conjuection with
|
||||
\fICURLOPT_MAIL_RCPT\fP, to specify an EXPN request. If the \fICURLOPT_NOBODY\fP
|
||||
option is specified then the request can be used to issue NOOP and RSET
|
||||
commands.
|
||||
.IP CURLOPT_FILETIME
|
||||
Pass a long. If it is 1, libcurl will attempt to get the modification date of
|
||||
the remote document in this operation. This requires that the remote server
|
||||
@@ -2068,6 +2133,8 @@ as a long. See also \fICURLOPT_INFILESIZE_LARGE\fP.
|
||||
For uploading using SCP, this option or \fICURLOPT_INFILESIZE_LARGE\fP is
|
||||
mandatory.
|
||||
|
||||
To "unset" this value again, set it to -1.
|
||||
|
||||
When sending emails using SMTP, this command can be used to specify the
|
||||
optional SIZE parameter for the MAIL FROM command. (Added in 7.23.0)
|
||||
|
||||
@@ -2080,6 +2147,11 @@ as a curl_off_t. (Added in 7.11.0)
|
||||
|
||||
For uploading using SCP, this option or \fICURLOPT_INFILESIZE\fP is mandatory.
|
||||
|
||||
To "unset" this value again, set it to -1.
|
||||
|
||||
When sending emails using SMTP, this command can be used to specify the
|
||||
optional SIZE parameter for the MAIL FROM command. (Added in 7.23.0)
|
||||
|
||||
This option does not limit how much data libcurl will actually send, as that
|
||||
is controlled entirely by what the read callback returns.
|
||||
.IP CURLOPT_UPLOAD
|
||||
@@ -2142,10 +2214,14 @@ In unix-like systems, this might cause signals to be used unless
|
||||
|
||||
Default timeout is 0 (zero) which means it never times out.
|
||||
.IP CURLOPT_TIMEOUT_MS
|
||||
Like \fICURLOPT_TIMEOUT\fP but takes number of milliseconds instead. If
|
||||
libcurl is built to use the standard system name resolver, that portion
|
||||
of the transfer will still use full-second resolution for timeouts with
|
||||
a minimum timeout allowed of one second.
|
||||
An alternative to \fICURLOPT_TIMEOUT\fP but takes number of milliseconds
|
||||
instead. If libcurl is built to use the standard system name resolver, that
|
||||
portion of the transfer will still use full-second resolution for timeouts
|
||||
with a minimum timeout allowed of one second.
|
||||
|
||||
If both \fICURLOPT_TIMEOUT\fP and \fICURLOPT_TIMEOUT_MS\fP are set, the value
|
||||
set last will be used.
|
||||
|
||||
(Added in 7.16.2)
|
||||
.IP CURLOPT_LOW_SPEED_LIMIT
|
||||
Pass a long as parameter. It contains the transfer speed in bytes per second
|
||||
@@ -2159,12 +2235,18 @@ it too slow and abort.
|
||||
Pass a curl_off_t as parameter. If an upload exceeds this speed (counted in
|
||||
bytes per second) on cumulative average during the transfer, the transfer will
|
||||
pause to keep the average rate less than or equal to the parameter value.
|
||||
Defaults to unlimited speed. (Added in 7.15.5)
|
||||
Defaults to unlimited speed.
|
||||
|
||||
This option doesn't affect transfer speeds done with FILE:// URLs. (Added in
|
||||
7.15.5)
|
||||
.IP CURLOPT_MAX_RECV_SPEED_LARGE
|
||||
Pass a curl_off_t as parameter. If a download exceeds this speed (counted in
|
||||
bytes per second) on cumulative average during the transfer, the transfer will
|
||||
pause to keep the average rate less than or equal to the parameter
|
||||
value. Defaults to unlimited speed. (Added in 7.15.5)
|
||||
value. Defaults to unlimited speed.
|
||||
|
||||
This option doesn't affect transfer speeds done with FILE:// URLs. (Added in
|
||||
7.15.5)
|
||||
.IP CURLOPT_MAXCONNECTS
|
||||
Pass a long. The set number will be the persistent connection cache size. The
|
||||
set amount will be the maximum amount of simultaneously open connections that
|
||||
@@ -2269,7 +2351,9 @@ ADDRESS can of course be either IPv4 or IPv6 style addressing.
|
||||
|
||||
This option effectively pre-populates the DNS cache with entries for the
|
||||
host+port pair so redirects and everything that operations against the
|
||||
HOST+PORT will instead use your provided ADDRESS.
|
||||
HOST+PORT will instead use your provided ADDRESS. Addresses to set with
|
||||
\fICURL_RESOLVE\fP will not time-out from the DNS cache like ordindary
|
||||
entries.
|
||||
|
||||
You can remove names from the DNS cache again, to stop providing these fake
|
||||
resolves, by including a string in the linked list that uses the format
|
||||
@@ -2291,6 +2375,36 @@ This option requires that libcurl was built with a resolver backend that
|
||||
supports this operation. The c-ares backend is the only such one.
|
||||
|
||||
(Added in 7.24.0)
|
||||
.IP CURLOPT_DNS_INTERFACE
|
||||
Pass a char * as parameter. Set the name of the network interface that
|
||||
the DNS resolver should bind to. This must be an interface name (not an
|
||||
address). Set this option to NULL to use the default setting (don't
|
||||
bind to a specific interface).
|
||||
|
||||
This option requires that libcurl was built with a resolver backend that
|
||||
supports this operation. The c-ares backend is the only such one.
|
||||
|
||||
(Added in 7.33.0)
|
||||
.IP CURLOPT_DNS_LOCAL_IP4
|
||||
Set the local IPv4 address that the resolver should bind to. The argument
|
||||
should be of type char * and contain a single IPv4 address as a string.
|
||||
Set this option to NULL to use the default setting (don't
|
||||
bind to a specific IP address).
|
||||
|
||||
This option requires that libcurl was built with a resolver backend that
|
||||
supports this operation. The c-ares backend is the only such one.
|
||||
|
||||
(Added in 7.33.0)
|
||||
.IP CURLOPT_DNS_LOCAL_IP6
|
||||
Set the local IPv6 address that the resolver should bind to. The argument
|
||||
should be of type char * and contain a single IPv6 address as a string.
|
||||
Set this option to NULL to use the default setting (don't
|
||||
bind to a specific IP address).
|
||||
|
||||
This option requires that libcurl was built with a resolver backend that
|
||||
supports this operation. The c-ares backend is the only such one.
|
||||
|
||||
(Added in 7.33.0)
|
||||
.IP CURLOPT_ACCEPTTIMEOUT_MS
|
||||
Pass a long telling libcurl the maximum number of milliseconds to wait for a
|
||||
server to connect back to libcurl when an active FTP connection is used. If no
|
||||
@@ -2298,22 +2412,20 @@ timeout is set, the internal default of 60000 will be used. (Added in 7.24.0)
|
||||
.SH SSL and SECURITY OPTIONS
|
||||
.IP CURLOPT_SSLCERT
|
||||
Pass a pointer to a zero terminated string as parameter. The string should be
|
||||
the file name of your certificate. The default format is "PEM" and can be
|
||||
changed with \fICURLOPT_SSLCERTTYPE\fP.
|
||||
the file name of your certificate. The default format is "P12" on Secure
|
||||
Transport and "PEM" on other engines, and can be changed with
|
||||
\fICURLOPT_SSLCERTTYPE\fP.
|
||||
|
||||
With NSS this can also be the nickname of the certificate you wish to
|
||||
authenticate with. If you want to use a file from the current directory, please
|
||||
precede it with "./" prefix, in order to avoid confusion with a nickname.
|
||||
|
||||
(iOS and Mac OS X only) With Secure Transport, this string must match the name
|
||||
of a certificate that's in the system or user keychain. You should encode this
|
||||
string in UTF-8 format in case it contains non-ASCII characters. The private
|
||||
key corresponding to the certificate, and certificate chain (if any), must
|
||||
also be present in the keychain. (Added in 7.31.0)
|
||||
With NSS or Secure Transport, this can also be the nickname of the certificate
|
||||
you wish to authenticate with as it is named in the security database. If you
|
||||
want to use a file from the current directory, please precede it with "./"
|
||||
prefix, in order to avoid confusion with a nickname.
|
||||
.IP CURLOPT_SSLCERTTYPE
|
||||
Pass a pointer to a zero terminated string as parameter. The string should be
|
||||
the format of your certificate. Supported formats are "PEM" and "DER". (Added
|
||||
in 7.9.3)
|
||||
the format of your certificate. Supported formats are "PEM" and "DER", except
|
||||
with Secure Transport. OpenSSL (versions 0.9.3 and later) and Secure Transport
|
||||
(on iOS 5 or later, or OS X 10.7 or later) also support "P12" for
|
||||
PKCS#12-encoded files. (Added in 7.9.3)
|
||||
.IP CURLOPT_SSLKEY
|
||||
Pass a pointer to a zero terminated string as parameter. The string should be
|
||||
the file name of your private key. The default format is "PEM" and can be
|
||||
@@ -2321,7 +2433,7 @@ changed with \fICURLOPT_SSLKEYTYPE\fP.
|
||||
|
||||
(iOS and Mac OS X only) This option is ignored if curl was built against Secure
|
||||
Transport. Secure Transport expects the private key to be already present in
|
||||
the keychain containing the certificate.
|
||||
the keychain or PKCS#12 file containing the certificate.
|
||||
.IP CURLOPT_SSLKEYTYPE
|
||||
Pass a pointer to a zero terminated string as parameter. The string should be
|
||||
the format of your private key. Supported formats are "PEM", "DER" and "ENG".
|
||||
@@ -2358,6 +2470,8 @@ Even though this option doesn't need any parameter, in some configurations
|
||||
arguments. Therefore, it's recommended to pass 1 as parameter to this option.
|
||||
.IP CURLOPT_SSLVERSION
|
||||
Pass a long as parameter to control what version of SSL/TLS to attempt to use.
|
||||
(Added in 7.9.2)
|
||||
|
||||
The available options are:
|
||||
.RS
|
||||
.IP CURL_SSLVERSION_DEFAULT
|
||||
@@ -2365,11 +2479,17 @@ The default action. This will attempt to figure out the remote SSL protocol
|
||||
version, i.e. either SSLv3 or TLSv1 (but not SSLv2, which became disabled
|
||||
by default with 7.18.1).
|
||||
.IP CURL_SSLVERSION_TLSv1
|
||||
Force TLSv1
|
||||
Force TLSv1.x
|
||||
.IP CURL_SSLVERSION_SSLv2
|
||||
Force SSLv2
|
||||
.IP CURL_SSLVERSION_SSLv3
|
||||
Force SSLv3
|
||||
.IP CURL_SSLVERSION_TLSv1_0
|
||||
Force TLSv1.0 (Added in 7.34.0)
|
||||
.IP CURL_SSLVERSION_TLSv1_1
|
||||
Force TLSv1.1 (Added in 7.34.0)
|
||||
.IP CURL_SSLVERSION_TLSv1_2
|
||||
Force TLSv1.2 (Added in 7.34.0)
|
||||
.RE
|
||||
.IP CURLOPT_SSL_VERIFYPEER
|
||||
Pass a long as parameter. By default, curl assumes a value of 1.
|
||||
@@ -2470,9 +2590,10 @@ Curl considers the server the intended one when the Common Name field or a
|
||||
Subject Alternate Name field in the certificate matches the host name in the
|
||||
URL to which you told Curl to connect.
|
||||
|
||||
When the value is 1, libcurl will return a failure. It was previously (in
|
||||
7.28.0 and earlier) a debug option of some sorts, but it is no longer
|
||||
supported due to frequently leading to programmer mistakes.
|
||||
When the value is 1, \fIcurl_easy_setopt\fP will return an error and the option
|
||||
value will not be changed. It was previously (in 7.28.0 and earlier) a debug
|
||||
option of some sorts, but it is no longer supported due to frequently leading
|
||||
to programmer mistakes.
|
||||
|
||||
When the value is 0, the connection succeeds regardless of the names in the
|
||||
certificate.
|
||||
@@ -2482,14 +2603,14 @@ The default value for this option is 2.
|
||||
This option controls checking the server's certificate's claimed identity.
|
||||
The server could be lying. To control lying, see
|
||||
\fICURLOPT_SSL_VERIFYPEER\fP. If libcurl is built against NSS and
|
||||
\fICURLOPT_SSL_VERIFYPEER\fP is zero, \fICURLOPT_SSL_VERIFYHOST\fP
|
||||
is ignored.
|
||||
|
||||
\fICURLOPT_SSL_VERIFYPEER\fP is zero, \fICURLOPT_SSL_VERIFYHOST\fP is also set
|
||||
to zero and cannot be overridden.
|
||||
.IP CURLOPT_CERTINFO
|
||||
Pass a long set to 1 to enable libcurl's certificate chain info gatherer. With
|
||||
this enabled, libcurl (if built with OpenSSL) will extract lots of information
|
||||
this enabled, libcurl (if built with OpenSSL, NSS, GSKit or QsoSSL) will
|
||||
extract lots of information
|
||||
and data about the certificates in the certificate chain used in the SSL
|
||||
connection. This data is then possible to extract after a transfer using
|
||||
connection. This data may then be retrieved after a transfer using
|
||||
\fIcurl_easy_getinfo(3)\fP and its option \fICURLINFO_CERTINFO\fP. (Added in
|
||||
7.19.1)
|
||||
.IP CURLOPT_RANDOM_FILE
|
||||
|
@@ -5,7 +5,7 @@
|
||||
.\" * | (__| |_| | _ <| |___
|
||||
.\" * \___|\___/|_| \_\_____|
|
||||
.\" *
|
||||
.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
.\" *
|
||||
.\" * This software is licensed as described in the file COPYING, which
|
||||
.\" * you should have received as part of this distribution. The terms
|
||||
@@ -21,22 +21,17 @@
|
||||
.\" **************************************************************************
|
||||
.TH curl_getdate 3 "12 Aug 2005" "libcurl 7.0" "libcurl Manual"
|
||||
.SH NAME
|
||||
curl_getdate - Convert a date string to number of seconds since January 1,
|
||||
1970
|
||||
curl_getdate - Convert a date string to number of seconds
|
||||
.SH SYNOPSIS
|
||||
.B #include <curl/curl.h>
|
||||
.sp
|
||||
.BI "time_t curl_getdate(char *" datestring ", time_t *"now " );"
|
||||
.ad
|
||||
.SH DESCRIPTION
|
||||
This function returns the number of seconds since January 1st 1970 in the UTC
|
||||
time zone, for the date and time that the \fIdatestring\fP parameter
|
||||
specifies. The \fInow\fP parameter is not used, pass a NULL there.
|
||||
|
||||
\fBNOTE:\fP This function was rewritten for the 7.12.2 release and this
|
||||
documentation covers the functionality of the new one. The new one is not
|
||||
feature-complete with the old one, but most of the formats supported by the
|
||||
new one was supported by the old too.
|
||||
\fIcurl_getdate(3)\fP returns the number of seconds since the Epoch, January
|
||||
1st 1970 00:00:00 in the UTC time zone, for the date and time that the
|
||||
\fIdatestring\fP parameter specifies. The \fInow\fP parameter is not used,
|
||||
pass a NULL there.
|
||||
.SH PARSING DATES AND TIMES
|
||||
A "date" is a string containing several items separated by whitespace. The
|
||||
order of the items is immaterial. A date string may contain many flavors of
|
||||
@@ -108,10 +103,3 @@ number).
|
||||
Having a 64 bit time_t is not a guarantee that dates beyond 03:14:07 UTC,
|
||||
January 19, 2038 will work fine. On systems with a 64 bit time_t but with a
|
||||
crippled mktime(), \fIcurl_getdate\fP will return -1 in this case.
|
||||
.SH REWRITE
|
||||
The former version of this function was built with yacc and was not only very
|
||||
large, it was also never quite understood and it wasn't possible to build with
|
||||
non-GNU tools since only GNU Bison could make it thread-safe!
|
||||
|
||||
The rewrite was done for 7.12.2. The new one is much smaller and uses simpler
|
||||
code.
|
||||
|
@@ -5,7 +5,7 @@
|
||||
.\" * | (__| |_| | _ <| |___
|
||||
.\" * \___|\___/|_| \_\_____|
|
||||
.\" *
|
||||
.\" * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
.\" * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
.\" *
|
||||
.\" * This software is licensed as described in the file COPYING, which
|
||||
.\" * you should have received as part of this distribution. The terms
|
||||
@@ -273,6 +273,9 @@ The passed-in socket is not a valid one that libcurl already knows about.
|
||||
.IP "CURLM_UNKNOWN_OPTION (6)"
|
||||
curl_multi_setopt() with unsupported option
|
||||
(Added in 7.15.4)
|
||||
.IP "CURLM_ADDED_ALREADY (7)"
|
||||
An easy handle already added to a multi handle was attempted to get added a
|
||||
second time. (Added in 7.32.1)
|
||||
.SH "CURLSHcode"
|
||||
The "share" interface will return a CURLSHcode to indicate when an error has
|
||||
occurred. Also consider \fIcurl_share_strerror(3)\fP.
|
||||
|
@@ -5,7 +5,7 @@
|
||||
.\" * | (__| |_| | _ <| |___
|
||||
.\" * \___|\___/|_| \_\_____|
|
||||
.\" *
|
||||
.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
.\" * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
.\" *
|
||||
.\" * This software is licensed as described in the file COPYING, which
|
||||
.\" * you should have received as part of this distribution. The terms
|
||||
@@ -39,8 +39,15 @@ maintain while using libcurl. This essentially means you call
|
||||
for details.
|
||||
|
||||
To transfer files, you always set up an "easy handle" using
|
||||
\fIcurl_easy_init(3)\fP, but when you want the file(s) transferred you have
|
||||
the option of using the "easy" interface, or the "multi" interface.
|
||||
\fIcurl_easy_init(3)\fP for a single specific transfer (in either
|
||||
direction). You then set your desired set of options in that handle with
|
||||
\fIcurk_easy_setopt(3)\fP. Options you set with \fIcurl_easy_setopt(3)\fP will
|
||||
be used on every repeated use of this handle until you either call the
|
||||
function again and change the option, or you reset them all with
|
||||
\fIcurl_easy_reset(3)\fP.
|
||||
|
||||
To actually transfer data you have the option of using the "easy" interface,
|
||||
or the "multi" interface.
|
||||
|
||||
The easy interface is a synchronous interface with which you call
|
||||
\fIcurl_easy_perform(3)\fP and let it perform the transfer. When it is
|
||||
@@ -51,7 +58,8 @@ The multi interface on the other hand is an asynchronous interface, that you
|
||||
call and that performs only a little piece of the transfer on each invoke. It
|
||||
is perfect if you want to do things while the transfer is in progress, or
|
||||
similar. The multi interface allows you to select() on libcurl action, and
|
||||
even to easily download multiple files simultaneously using a single thread. See further details in the \fIlibcurl-multi(3)\fP man page.
|
||||
even to easily download multiple files simultaneously using a single
|
||||
thread. See further details in the \fIlibcurl-multi(3)\fP man page.
|
||||
|
||||
You can have multiple easy handles share certain data, even if they are used
|
||||
in different threads. This magic is setup using the share interface, as
|
||||
@@ -115,19 +123,21 @@ Persistent connections means that libcurl can re-use the same connection for
|
||||
several transfers, if the conditions are right.
|
||||
|
||||
libcurl will \fBalways\fP attempt to use persistent connections. Whenever you
|
||||
use \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP, libcurl will
|
||||
attempt to use an existing connection to do the transfer, and if none exists
|
||||
it'll open a new one that will be subject for re-use on a possible following
|
||||
call to \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP.
|
||||
use \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP etc, libcurl
|
||||
will attempt to use an existing connection to do the transfer, and if none
|
||||
exists it'll open a new one that will be subject for re-use on a possible
|
||||
following call to \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP.
|
||||
|
||||
To allow libcurl to take full advantage of persistent connections, you should
|
||||
do as many of your file transfers as possible using the same curl handle. When
|
||||
you call \fIcurl_easy_cleanup(3)\fP, all the possibly open connections held by
|
||||
libcurl will be closed and forgotten.
|
||||
do as many of your file transfers as possible using the same handle.
|
||||
|
||||
Note that the options set with \fIcurl_easy_setopt(3)\fP will be used on
|
||||
every repeated \fIcurl_easy_perform(3)\fP call.
|
||||
If you use the easy interface, and you call \fIcurl_easy_cleanup(3)\fP, all
|
||||
the possibly open connections held by libcurl will be closed and forgotten.
|
||||
|
||||
When you've created a multi handle and are using the multi interface, the
|
||||
connection pool is instead kept in the multi handle so closing and creating
|
||||
new easy handles to do transfers will not affect them. Instead all added easy
|
||||
handles can take advantage of the single shared pool.
|
||||
.SH "GLOBAL CONSTANTS"
|
||||
There are a variety of constants that libcurl uses, mainly through its
|
||||
internal use of other libraries, which are too complicated for the
|
||||
|
@@ -85,8 +85,8 @@ CURLE_LDAP_SEARCH_FAILED 7.1
|
||||
CURLE_LIBRARY_NOT_FOUND 7.1 7.17.0
|
||||
CURLE_LOGIN_DENIED 7.13.1
|
||||
CURLE_MALFORMAT_USER 7.1 7.17.0
|
||||
CURLE_NO_CONNECTION_AVAILABLE 7.30.0
|
||||
CURLE_NOT_BUILT_IN 7.21.5
|
||||
CURLE_NO_CONNECTION_AVAILABLE 7.30.0
|
||||
CURLE_OK 7.1
|
||||
CURLE_OPERATION_TIMEDOUT 7.10.2
|
||||
CURLE_OPERATION_TIMEOUTED 7.1 7.17.0
|
||||
@@ -250,6 +250,7 @@ CURLINFO_SSL_VERIFYRESULT 7.5
|
||||
CURLINFO_STARTTRANSFER_TIME 7.9.2
|
||||
CURLINFO_STRING 7.4.1
|
||||
CURLINFO_TEXT 7.9.6
|
||||
CURLINFO_TLS_SESSION 7.34.0
|
||||
CURLINFO_TOTAL_TIME 7.4.1
|
||||
CURLINFO_TYPEMASK 7.4.1
|
||||
CURLIOCMD_NOP 7.12.3
|
||||
@@ -270,10 +271,10 @@ CURLKHTYPE_RSA1 7.19.6
|
||||
CURLKHTYPE_UNKNOWN 7.19.6
|
||||
CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE 7.30.0
|
||||
CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE 7.30.0
|
||||
CURLMOPT_MAXCONNECTS 7.16.3
|
||||
CURLMOPT_MAX_HOST_CONNECTIONS 7.30.0
|
||||
CURLMOPT_MAX_PIPELINE_LENGTH 7.30.0
|
||||
CURLMOPT_MAX_TOTAL_CONNECTIONS 7.30.0
|
||||
CURLMOPT_MAXCONNECTS 7.16.3
|
||||
CURLMOPT_PIPELINING 7.16.0
|
||||
CURLMOPT_PIPELINING_SERVER_BL 7.30.0
|
||||
CURLMOPT_PIPELINING_SITE_BL 7.30.0
|
||||
@@ -283,6 +284,7 @@ CURLMOPT_TIMERDATA 7.16.0
|
||||
CURLMOPT_TIMERFUNCTION 7.16.0
|
||||
CURLMSG_DONE 7.9.6
|
||||
CURLMSG_NONE 7.9.6
|
||||
CURLM_ADDED_ALREADY 7.32.1
|
||||
CURLM_BAD_EASY_HANDLE 7.9.6
|
||||
CURLM_BAD_HANDLE 7.9.6
|
||||
CURLM_BAD_SOCKET 7.15.4
|
||||
@@ -331,6 +333,9 @@ CURLOPT_DEBUGDATA 7.9.6
|
||||
CURLOPT_DEBUGFUNCTION 7.9.6
|
||||
CURLOPT_DIRLISTONLY 7.17.0
|
||||
CURLOPT_DNS_CACHE_TIMEOUT 7.9.3
|
||||
CURLOPT_DNS_INTERFACE 7.33.0
|
||||
CURLOPT_DNS_LOCAL_IP4 7.33.0
|
||||
CURLOPT_DNS_LOCAL_IP6 7.33.0
|
||||
CURLOPT_DNS_SERVERS 7.24.0
|
||||
CURLOPT_DNS_USE_GLOBAL_CACHE 7.9.3 7.11.1
|
||||
CURLOPT_EGDSOCKET 7.7
|
||||
@@ -390,6 +395,7 @@ CURLOPT_KRB4LEVEL 7.3 7.17.0
|
||||
CURLOPT_KRBLEVEL 7.16.4
|
||||
CURLOPT_LOCALPORT 7.15.2
|
||||
CURLOPT_LOCALPORTRANGE 7.15.2
|
||||
CURLOPT_LOGIN_OPTIONS 7.34.0
|
||||
CURLOPT_LOW_SPEED_LIMIT 7.1
|
||||
CURLOPT_LOW_SPEED_TIME 7.1
|
||||
CURLOPT_MAIL_AUTH 7.25.0
|
||||
@@ -527,6 +533,7 @@ CURLOPT_WRITEHEADER 7.1
|
||||
CURLOPT_WRITEINFO 7.1
|
||||
CURLOPT_XFERINFODATA 7.32.0
|
||||
CURLOPT_XFERINFOFUNCTION 7.32.0
|
||||
CURLOPT_XOAUTH2_BEARER 7.33.0
|
||||
CURLPAUSE_ALL 7.18.0
|
||||
CURLPAUSE_CONT 7.18.0
|
||||
CURLPAUSE_RECV 7.18.0
|
||||
@@ -588,6 +595,16 @@ CURLSSH_AUTH_KEYBOARD 7.16.1
|
||||
CURLSSH_AUTH_NONE 7.16.1
|
||||
CURLSSH_AUTH_PASSWORD 7.16.1
|
||||
CURLSSH_AUTH_PUBLICKEY 7.16.1
|
||||
CURLSSLBACKEND_CYASSL 7.34.0
|
||||
CURLSSLBACKEND_DARWINSSL 7.34.0
|
||||
CURLSSLBACKEND_GNUTLS 7.34.0
|
||||
CURLSSLBACKEND_GSKIT 7.34.0
|
||||
CURLSSLBACKEND_NONE 7.34.0
|
||||
CURLSSLBACKEND_NSS 7.34.0
|
||||
CURLSSLBACKEND_OPENSSL 7.34.0
|
||||
CURLSSLBACKEND_POLARSSL 7.34.0
|
||||
CURLSSLBACKEND_QSOSSL 7.34.0
|
||||
CURLSSLBACKEND_SCHANNEL 7.34.0
|
||||
CURLSSLOPT_ALLOW_BEAST 7.25.0
|
||||
CURLUSESSL_ALL 7.17.0
|
||||
CURLUSESSL_CONTROL 7.17.0
|
||||
@@ -620,14 +637,15 @@ CURL_FORMADD_NULL 7.9.8
|
||||
CURL_FORMADD_OK 7.9.8
|
||||
CURL_FORMADD_OPTION_TWICE 7.9.8
|
||||
CURL_FORMADD_UNKNOWN_OPTION 7.9.8
|
||||
CURL_GLOBAL_ACK_EINTR 7.30.0
|
||||
CURL_GLOBAL_ALL 7.8
|
||||
CURL_GLOBAL_DEFAULT 7.8
|
||||
CURL_GLOBAL_NOTHING 7.8
|
||||
CURL_GLOBAL_SSL 7.8
|
||||
CURL_GLOBAL_WIN32 7.8.1
|
||||
CURL_GLOBAL_ACK_EINTR 7.30.0
|
||||
CURL_HTTP_VERSION_1_0 7.9.1
|
||||
CURL_HTTP_VERSION_1_1 7.9.1
|
||||
CURL_HTTP_VERSION_2_0 7.33.0
|
||||
CURL_HTTP_VERSION_NONE 7.9.1
|
||||
CURL_IPRESOLVE_V4 7.10.8
|
||||
CURL_IPRESOLVE_V6 7.10.8
|
||||
@@ -689,6 +707,9 @@ CURL_SSLVERSION_DEFAULT 7.9.2
|
||||
CURL_SSLVERSION_SSLv2 7.9.2
|
||||
CURL_SSLVERSION_SSLv3 7.9.2
|
||||
CURL_SSLVERSION_TLSv1 7.9.2
|
||||
CURL_SSLVERSION_TLSv1_0 7.34.0
|
||||
CURL_SSLVERSION_TLSv1_1 7.34.0
|
||||
CURL_SSLVERSION_TLSv1_2 7.34.0
|
||||
CURL_TIMECOND_IFMODSINCE 7.9.7
|
||||
CURL_TIMECOND_IFUNMODSINCE 7.9.7
|
||||
CURL_TIMECOND_LASTMOD 7.9.7
|
||||
@@ -700,6 +721,7 @@ CURL_VERSION_CONV 7.15.4
|
||||
CURL_VERSION_CURLDEBUG 7.19.6
|
||||
CURL_VERSION_DEBUG 7.10.6
|
||||
CURL_VERSION_GSSNEGOTIATE 7.10.6
|
||||
CURL_VERSION_HTTP2 7.33.0
|
||||
CURL_VERSION_IDN 7.12.0
|
||||
CURL_VERSION_IPV6 7.10
|
||||
CURL_VERSION_KERBEROS4 7.10
|
||||
|
@@ -5,7 +5,7 @@
|
||||
.\" * | (__| |_| | _ <| |___
|
||||
.\" * \___|\___/|_| \_\_____|
|
||||
.\" *
|
||||
.\" * Copyright (C) 2008 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
.\" * Copyright (C) 2008 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
.\" *
|
||||
.\" * This software is licensed as described in the file COPYING, which
|
||||
.\" * you should have received as part of this distribution. The terms
|
||||
@@ -20,7 +20,7 @@
|
||||
.\" *
|
||||
.\" **************************************************************************
|
||||
.\"
|
||||
.TH mk-ca-bundle 1 "5 Jan 2013" "version 1.17" "mk-ca-bundle manual"
|
||||
.TH mk-ca-bundle 1 "5 Jan 2013" "version 1.20" "mk-ca-bundle manual"
|
||||
.SH NAME
|
||||
mk-ca-bundle \- convert mozilla's certdata.txt to PEM format
|
||||
.SH SYNOPSIS
|
||||
@@ -42,6 +42,10 @@ curl, wget and more.
|
||||
The following options are supported:
|
||||
.IP -b
|
||||
backup an existing version of \fIoutputfilename\fP
|
||||
.IP -d [name]
|
||||
specify which Mozilla tree to pull certdata.txt from (or a custom URL). Valid
|
||||
names are: aurora, beta, central, mozilla, nss, release (default). They are
|
||||
shortcuts for which source tree to get the cert data from.
|
||||
.IP -f
|
||||
force rebuild even if certdata.txt is current (Added in version 1.17)
|
||||
.IP -i
|
||||
|
@@ -69,7 +69,7 @@
|
||||
require it! */
|
||||
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
|
||||
defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
|
||||
defined(ANDROID) || defined(__ANDROID__) || \
|
||||
defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \
|
||||
(defined(__FreeBSD_version) && (__FreeBSD_version < 800000))
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
@@ -645,16 +645,18 @@ typedef enum {
|
||||
|
||||
#define CURL_ERROR_SIZE 256
|
||||
|
||||
enum curl_khtype {
|
||||
CURLKHTYPE_UNKNOWN,
|
||||
CURLKHTYPE_RSA1,
|
||||
CURLKHTYPE_RSA,
|
||||
CURLKHTYPE_DSS
|
||||
};
|
||||
|
||||
struct curl_khkey {
|
||||
const char *key; /* points to a zero-terminated string encoded with base64
|
||||
if len is zero, otherwise to the "raw" data */
|
||||
size_t len;
|
||||
enum type {
|
||||
CURLKHTYPE_UNKNOWN,
|
||||
CURLKHTYPE_RSA1,
|
||||
CURLKHTYPE_RSA,
|
||||
CURLKHTYPE_DSS
|
||||
} keytype;
|
||||
enum curl_khtype keytype;
|
||||
};
|
||||
|
||||
/* this is the set of return values expected from the curl_sshkeycallback
|
||||
@@ -825,10 +827,10 @@ typedef enum {
|
||||
/* Name of proxy to use. */
|
||||
CINIT(PROXY, OBJECTPOINT, 4),
|
||||
|
||||
/* "name:password" to use when fetching. */
|
||||
/* "user:password;options" to use when fetching. */
|
||||
CINIT(USERPWD, OBJECTPOINT, 5),
|
||||
|
||||
/* "name:password" to use with proxy. */
|
||||
/* "user:password" to use with proxy. */
|
||||
CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
|
||||
|
||||
/* Range to get, specified as an ASCII string. */
|
||||
@@ -1386,8 +1388,7 @@ typedef enum {
|
||||
CINIT(ADDRESS_SCOPE, LONG, 171),
|
||||
|
||||
/* Collect certificate chain info and allow it to get retrievable with
|
||||
CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only
|
||||
working with OpenSSL-powered builds. */
|
||||
CURLINFO_CERTINFO after the transfer is complete. */
|
||||
CINIT(CERTINFO, LONG, 172),
|
||||
|
||||
/* "name" and "pwd" to use when fetching. */
|
||||
@@ -1551,6 +1552,25 @@ typedef enum {
|
||||
* prototype defines. (Deprecates CURLOPT_PROGRESSFUNCTION) */
|
||||
CINIT(XFERINFOFUNCTION, FUNCTIONPOINT, 219),
|
||||
|
||||
/* The XOAUTH2 bearer token */
|
||||
CINIT(XOAUTH2_BEARER, OBJECTPOINT, 220),
|
||||
|
||||
/* Set the interface string to use as outgoing network
|
||||
* interface for DNS requests.
|
||||
* Only supported by the c-ares DNS backend */
|
||||
CINIT(DNS_INTERFACE, OBJECTPOINT, 221),
|
||||
|
||||
/* Set the local IPv4 address to use for outgoing DNS requests.
|
||||
* Only supported by the c-ares DNS backend */
|
||||
CINIT(DNS_LOCAL_IP4, OBJECTPOINT, 222),
|
||||
|
||||
/* Set the local IPv4 address to use for outgoing DNS requests.
|
||||
* Only supported by the c-ares DNS backend */
|
||||
CINIT(DNS_LOCAL_IP6, OBJECTPOINT, 223),
|
||||
|
||||
/* Set authentication options directly */
|
||||
CINIT(LOGIN_OPTIONS, OBJECTPOINT, 224),
|
||||
|
||||
CURLOPT_LASTENTRY /* the last unused */
|
||||
} CURLoption;
|
||||
|
||||
@@ -1603,6 +1623,7 @@ enum {
|
||||
for us! */
|
||||
CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */
|
||||
CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */
|
||||
CURL_HTTP_VERSION_2_0, /* please use HTTP 2.0 in the request */
|
||||
|
||||
CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
|
||||
};
|
||||
@@ -1640,9 +1661,12 @@ enum CURL_NETRC_OPTION {
|
||||
|
||||
enum {
|
||||
CURL_SSLVERSION_DEFAULT,
|
||||
CURL_SSLVERSION_TLSv1,
|
||||
CURL_SSLVERSION_TLSv1, /* TLS 1.x */
|
||||
CURL_SSLVERSION_SSLv2,
|
||||
CURL_SSLVERSION_SSLv3,
|
||||
CURL_SSLVERSION_TLSv1_0,
|
||||
CURL_SSLVERSION_TLSv1_1,
|
||||
CURL_SSLVERSION_TLSv1_2,
|
||||
|
||||
CURL_SSLVERSION_LAST /* never use, keep last */
|
||||
};
|
||||
@@ -1961,6 +1985,28 @@ struct curl_certinfo {
|
||||
format "name: value" */
|
||||
};
|
||||
|
||||
/* enum for the different supported SSL backends */
|
||||
typedef enum {
|
||||
CURLSSLBACKEND_NONE = 0,
|
||||
CURLSSLBACKEND_OPENSSL = 1,
|
||||
CURLSSLBACKEND_GNUTLS = 2,
|
||||
CURLSSLBACKEND_NSS = 3,
|
||||
CURLSSLBACKEND_QSOSSL = 4,
|
||||
CURLSSLBACKEND_GSKIT = 5,
|
||||
CURLSSLBACKEND_POLARSSL = 6,
|
||||
CURLSSLBACKEND_CYASSL = 7,
|
||||
CURLSSLBACKEND_SCHANNEL = 8,
|
||||
CURLSSLBACKEND_DARWINSSL = 9
|
||||
} curl_sslbackend;
|
||||
|
||||
/* Information about the SSL library used and the respective internal SSL
|
||||
handle, which can be used to obtain further information regarding the
|
||||
connection. Asked for with CURLINFO_TLS_SESSION. */
|
||||
struct curl_tlssessioninfo {
|
||||
curl_sslbackend backend;
|
||||
void *internals;
|
||||
};
|
||||
|
||||
#define CURLINFO_STRING 0x100000
|
||||
#define CURLINFO_LONG 0x200000
|
||||
#define CURLINFO_DOUBLE 0x300000
|
||||
@@ -2012,9 +2058,10 @@ typedef enum {
|
||||
CURLINFO_PRIMARY_PORT = CURLINFO_LONG + 40,
|
||||
CURLINFO_LOCAL_IP = CURLINFO_STRING + 41,
|
||||
CURLINFO_LOCAL_PORT = CURLINFO_LONG + 42,
|
||||
CURLINFO_TLS_SESSION = CURLINFO_SLIST + 43,
|
||||
/* Fill in new entries below here! */
|
||||
|
||||
CURLINFO_LASTONE = 42
|
||||
CURLINFO_LASTONE = 43
|
||||
} CURLINFO;
|
||||
|
||||
/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
|
||||
@@ -2166,6 +2213,7 @@ typedef struct {
|
||||
#define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */
|
||||
#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */
|
||||
#define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegating to winbind helper */
|
||||
#define CURL_VERSION_HTTP2 (1<<16) /* HTTP2 support built-in */
|
||||
|
||||
/*
|
||||
* NAME curl_version_info()
|
||||
|
@@ -58,51 +58,52 @@
|
||||
/* ================================================================ */
|
||||
|
||||
#ifdef CURL_SIZEOF_LONG
|
||||
# error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h"
|
||||
#error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
|
||||
# error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_SIZEOF_CURL_SOCKLEN_T
|
||||
# error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_TYPEOF_CURL_OFF_T
|
||||
# error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_FORMAT_CURL_OFF_T
|
||||
# error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_FORMAT_CURL_OFF_TU
|
||||
# error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h"
|
||||
#error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_FORMAT_OFF_T
|
||||
# error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_SIZEOF_CURL_OFF_T
|
||||
# error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_SUFFIX_CURL_OFF_T
|
||||
# error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_SUFFIX_CURL_OFF_TU
|
||||
# error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h"
|
||||
#error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined
|
||||
#endif
|
||||
|
||||
@@ -110,71 +111,87 @@
|
||||
/* 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. */
|
||||
#cmakedefine CURL_PULL_WS2TCPIP_H
|
||||
#ifdef CURL_PULL_WS2TCPIP_H
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# 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. */
|
||||
#cmakedefine CURL_PULL_SYS_TYPES_H ${CURL_PULL_SYS_TYPES_H}
|
||||
#cmakedefine CURL_PULL_SYS_TYPES_H
|
||||
#ifdef CURL_PULL_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file stdint.h must be included by the external interface. */
|
||||
#cmakedefine CURL_PULL_STDINT_H ${CURL_PULL_STDINT_H}
|
||||
#cmakedefine CURL_PULL_STDINT_H
|
||||
#ifdef CURL_PULL_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file inttypes.h must be included by the external interface. */
|
||||
#cmakedefine CURL_PULL_INTTYPES_H ${CURL_PULL_INTTYPES_H}
|
||||
#cmakedefine CURL_PULL_INTTYPES_H
|
||||
#ifdef CURL_PULL_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#cmakedefine CURL_SIZEOF_LONG ${CURL_SIZEOF_LONG}
|
||||
|
||||
/* Integral data type used for curl_socklen_t. */
|
||||
#cmakedefine CURL_TYPEOF_CURL_SOCKLEN_T ${CURL_TYPEOF_CURL_SOCKLEN_T}
|
||||
|
||||
/* on windows socklen_t is in here */
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file sys/socket.h must be included by the external interface. */
|
||||
#cmakedefine CURL_PULL_SYS_SOCKET_H
|
||||
#ifdef CURL_PULL_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file sys/poll.h must be included by the external interface. */
|
||||
#cmakedefine CURL_PULL_SYS_POLL_H
|
||||
#ifdef CURL_PULL_SYS_POLL_H
|
||||
# include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#define CURL_SIZEOF_LONG ${CURL_SIZEOF_LONG}
|
||||
|
||||
/* Integral data type used for curl_socklen_t. */
|
||||
#define CURL_TYPEOF_CURL_SOCKLEN_T ${CURL_TYPEOF_CURL_SOCKLEN_T}
|
||||
|
||||
/* The size of `curl_socklen_t', as computed by sizeof. */
|
||||
#define CURL_SIZEOF_CURL_SOCKLEN_T ${CURL_SIZEOF_CURL_SOCKLEN_T}
|
||||
|
||||
/* Data type definition of curl_socklen_t. */
|
||||
typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
|
||||
|
||||
/* The size of `curl_socklen_t', as computed by sizeof. */
|
||||
#cmakedefine CURL_SIZEOF_CURL_SOCKLEN_T ${CURL_SIZEOF_CURL_SOCKLEN_T}
|
||||
|
||||
/* Signed integral data type used for curl_off_t. */
|
||||
#cmakedefine CURL_TYPEOF_CURL_OFF_T ${CURL_TYPEOF_CURL_OFF_T}
|
||||
#define CURL_TYPEOF_CURL_OFF_T ${CURL_TYPEOF_CURL_OFF_T}
|
||||
|
||||
/* Data type definition of curl_off_t. */
|
||||
typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
|
||||
|
||||
/* curl_off_t formatting string directive without "%" conversion specifier. */
|
||||
#cmakedefine CURL_FORMAT_CURL_OFF_T "${CURL_FORMAT_CURL_OFF_T}"
|
||||
#define CURL_FORMAT_CURL_OFF_T "${CURL_FORMAT_CURL_OFF_T}"
|
||||
|
||||
/* unsigned curl_off_t formatting string without "%" conversion specifier. */
|
||||
#cmakedefine CURL_FORMAT_CURL_OFF_TU "${CURL_FORMAT_CURL_OFF_TU}"
|
||||
#define CURL_FORMAT_CURL_OFF_TU "${CURL_FORMAT_CURL_OFF_TU}"
|
||||
|
||||
/* curl_off_t formatting string directive with "%" conversion specifier. */
|
||||
#cmakedefine CURL_FORMAT_OFF_T "${CURL_FORMAT_OFF_T}"
|
||||
#define CURL_FORMAT_OFF_T "${CURL_FORMAT_OFF_T}"
|
||||
|
||||
/* The size of `curl_off_t', as computed by sizeof. */
|
||||
#cmakedefine CURL_SIZEOF_CURL_OFF_T ${CURL_SIZEOF_CURL_OFF_T}
|
||||
#define CURL_SIZEOF_CURL_OFF_T ${CURL_SIZEOF_CURL_OFF_T}
|
||||
|
||||
/* curl_off_t constant suffix. */
|
||||
#cmakedefine CURL_SUFFIX_CURL_OFF_T ${CURL_SUFFIX_CURL_OFF_T}
|
||||
#define CURL_SUFFIX_CURL_OFF_T ${CURL_SUFFIX_CURL_OFF_T}
|
||||
|
||||
/* unsigned curl_off_t constant suffix. */
|
||||
#cmakedefine CURL_SUFFIX_CURL_OFF_TU ${CURL_SUFFIX_CURL_OFF_TU}
|
||||
#define CURL_SUFFIX_CURL_OFF_TU ${CURL_SUFFIX_CURL_OFF_TU}
|
||||
|
||||
#endif /* __CURL_CURLBUILD_H */
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -26,17 +26,17 @@
|
||||
a script at release-time. This was made its own header file in 7.11.2 */
|
||||
|
||||
/* This is the global package copyright */
|
||||
#define LIBCURL_COPYRIGHT "1996 - 2013 Daniel Stenberg, <daniel@haxx.se>."
|
||||
#define LIBCURL_COPYRIGHT "1996 - 2014 Daniel Stenberg, <daniel@haxx.se>."
|
||||
|
||||
/* This is the version number of the libcurl package from which this header
|
||||
file origins: */
|
||||
#define LIBCURL_VERSION "7.32.0-DEV"
|
||||
#define LIBCURL_VERSION "7.34.1-DEV"
|
||||
|
||||
/* The numeric version number is also available "in parts" by using these
|
||||
defines: */
|
||||
#define LIBCURL_VERSION_MAJOR 7
|
||||
#define LIBCURL_VERSION_MINOR 32
|
||||
#define LIBCURL_VERSION_PATCH 0
|
||||
#define LIBCURL_VERSION_MINOR 34
|
||||
#define LIBCURL_VERSION_PATCH 1
|
||||
|
||||
/* This is the numeric version of the libcurl version number, meant for easier
|
||||
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
|
||||
@@ -53,7 +53,7 @@
|
||||
and it is always a greater number in a more recent release. It makes
|
||||
comparisons with greater than and less than work.
|
||||
*/
|
||||
#define LIBCURL_VERSION_NUM 0x072000
|
||||
#define LIBCURL_VERSION_NUM 0x072201
|
||||
|
||||
/*
|
||||
* This is the date and time when the full source package was created. The
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -64,6 +64,8 @@ typedef enum {
|
||||
CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
|
||||
CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
|
||||
CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
|
||||
CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was
|
||||
attempted to get added - again */
|
||||
CURLM_LAST
|
||||
} CURLMcode;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -264,6 +264,12 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
|
||||
(option) == CURLOPT_RTSP_SESSION_ID || \
|
||||
(option) == CURLOPT_RTSP_STREAM_URI || \
|
||||
(option) == CURLOPT_RTSP_TRANSPORT || \
|
||||
(option) == CURLOPT_XOAUTH2_BEARER || \
|
||||
(option) == CURLOPT_DNS_SERVERS || \
|
||||
(option) == CURLOPT_DNS_INTERFACE || \
|
||||
(option) == CURLOPT_DNS_LOCAL_IP4 || \
|
||||
(option) == CURLOPT_DNS_LOCAL_IP6 || \
|
||||
(option) == CURLOPT_LOGIN_OPTIONS || \
|
||||
0)
|
||||
|
||||
/* evaluates to true if option takes a curl_write_callback argument */
|
||||
|
@@ -60,20 +60,15 @@ CFLAGS += @CURL_CFLAG_EXTRAS@
|
||||
# $(top_builddir)/ares is for in-tree c-ares's generated ares_build.h file
|
||||
# $(top_srcdir)/ares is for in-tree c-ares's external include files
|
||||
|
||||
if USE_EMBEDDED_ARES
|
||||
AM_CPPFLAGS = -I$(top_builddir)/include/curl \
|
||||
-I$(top_builddir)/include \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_builddir)/lib \
|
||||
-I$(top_srcdir)/lib \
|
||||
-I$(top_builddir)/ares \
|
||||
-I$(top_srcdir)/ares
|
||||
else
|
||||
AM_CPPFLAGS = -I$(top_builddir)/include/curl \
|
||||
-I$(top_builddir)/include \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_builddir)/lib \
|
||||
-I$(top_srcdir)/lib
|
||||
|
||||
if USE_EMBEDDED_ARES
|
||||
AM_CPPFLAGS += -I$(top_builddir)/ares \
|
||||
-I$(top_srcdir)/ares
|
||||
endif
|
||||
|
||||
# Prevent LIBS from being used for all link targets
|
||||
|
103
lib/Makefile.inc
103
lib/Makefile.inc
@@ -1,48 +1,65 @@
|
||||
# ./lib/Makefile.inc
|
||||
# Using the backslash as line continuation character might be problematic
|
||||
# with some make flavours, as Watcom's wmake showed us already. If we
|
||||
# ever want to change this in a portable manner then we should consider
|
||||
# this idea (posted to the libcurl list by Adam Kellas):
|
||||
# CSRC1 = file1.c file2.c file3.c
|
||||
# CSRC2 = file4.c file5.c file6.c
|
||||
# CSOURCES = $(CSRC1) $(CSRC2)
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
VSOURCES=vtls/openssl.c vtls/gtls.c vtls/vtls.c vtls/nss.c vtls/qssl.c \
|
||||
vtls/polarssl.c vtls/polarssl_threadlock.c vtls/axtls.c vtls/cyassl.c \
|
||||
vtls/curl_schannel.c vtls/curl_darwinssl.c vtls/gskit.c
|
||||
VHEADERS= vtls/qssl.h vtls/openssl.h vtls/vtls.h vtls/gtls.h \
|
||||
vtls/nssg.h vtls/polarssl.h vtls/polarssl_threadlock.h vtls/axtls.h \
|
||||
vtls/cyassl.h vtls/curl_schannel.h vtls/curl_darwinssl.h vtls/gskit.h
|
||||
|
||||
CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
|
||||
cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \
|
||||
ldap.c ssluse.c version.c getenv.c escape.c mprintf.c telnet.c \
|
||||
netrc.c getinfo.c transfer.c strequal.c easy.c security.c krb4.c \
|
||||
curl_fnmatch.c fileinfo.c ftplistparser.c wildcard.c krb5.c \
|
||||
memdebug.c http_chunks.c strtok.c connect.c llist.c hash.c multi.c \
|
||||
content_encoding.c share.c http_digest.c md4.c md5.c \
|
||||
http_negotiate.c inet_pton.c strtoofft.c strerror.c amigaos.c \
|
||||
hostasyn.c hostip4.c hostip6.c hostsyn.c inet_ntop.c parsedate.c \
|
||||
select.c gtls.c sslgen.c tftp.c splay.c strdup.c socks.c ssh.c nss.c \
|
||||
qssl.c rawstr.c curl_addrinfo.c socks_gssapi.c socks_sspi.c \
|
||||
ldap.c version.c getenv.c escape.c mprintf.c telnet.c netrc.c \
|
||||
getinfo.c transfer.c strequal.c easy.c security.c curl_fnmatch.c \
|
||||
fileinfo.c ftplistparser.c wildcard.c krb5.c memdebug.c http_chunks.c \
|
||||
strtok.c connect.c llist.c hash.c multi.c content_encoding.c share.c \
|
||||
http_digest.c md4.c md5.c http_negotiate.c inet_pton.c strtoofft.c \
|
||||
strerror.c amigaos.c hostasyn.c hostip4.c hostip6.c hostsyn.c \
|
||||
inet_ntop.c parsedate.c select.c tftp.c splay.c strdup.c socks.c \
|
||||
ssh.c rawstr.c curl_addrinfo.c socks_gssapi.c socks_sspi.c \
|
||||
curl_sspi.c slist.c nonblock.c curl_memrchr.c imap.c pop3.c smtp.c \
|
||||
pingpong.c rtsp.c curl_threads.c warnless.c hmac.c polarssl.c \
|
||||
polarssl_threadlock.c curl_rtmp.c openldap.c curl_gethostname.c \
|
||||
gopher.c axtls.c idn_win32.c http_negotiate_sspi.c cyassl.c \
|
||||
http_proxy.c non-ascii.c asyn-ares.c asyn-thread.c curl_gssapi.c \
|
||||
curl_ntlm.c curl_ntlm_wb.c curl_ntlm_core.c curl_ntlm_msgs.c \
|
||||
curl_sasl.c curl_schannel.c curl_multibyte.c curl_darwinssl.c \
|
||||
hostcheck.c bundles.c conncache.c pipeline.c dotdot.c x509asn1.c \
|
||||
gskit.c
|
||||
pingpong.c rtsp.c curl_threads.c warnless.c hmac.c curl_rtmp.c \
|
||||
openldap.c curl_gethostname.c gopher.c idn_win32.c \
|
||||
http_negotiate_sspi.c http_proxy.c non-ascii.c asyn-ares.c \
|
||||
asyn-thread.c curl_gssapi.c curl_ntlm.c curl_ntlm_wb.c \
|
||||
curl_ntlm_core.c curl_ntlm_msgs.c curl_sasl.c curl_multibyte.c \
|
||||
hostcheck.c bundles.c conncache.c pipeline.c dotdot.c x509asn1.c \
|
||||
http2.c $(VSOURCES)
|
||||
|
||||
HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h \
|
||||
progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h \
|
||||
if2ip.h speedcheck.h urldata.h curl_ldap.h ssluse.h escape.h telnet.h \
|
||||
getinfo.h strequal.h krb4.h memdebug.h http_chunks.h \
|
||||
curl_fnmatch.h wildcard.h fileinfo.h ftplistparser.h strtok.h \
|
||||
connect.h llist.h hash.h content_encoding.h share.h curl_md4.h \
|
||||
curl_md5.h http_digest.h http_negotiate.h inet_pton.h amigaos.h \
|
||||
strtoofft.h strerror.h inet_ntop.h curlx.h curl_memory.h curl_setup.h \
|
||||
transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h gtls.h \
|
||||
tftp.h sockaddr.h splay.h strdup.h socks.h ssh.h nssg.h curl_base64.h \
|
||||
rawstr.h curl_addrinfo.h curl_sspi.h slist.h nonblock.h \
|
||||
curl_memrchr.h imap.h pop3.h smtp.h pingpong.h rtsp.h curl_threads.h \
|
||||
warnless.h curl_hmac.h polarssl.h polarssl_threadlock.h curl_rtmp.h \
|
||||
curl_gethostname.h gopher.h axtls.h cyassl.h http_proxy.h non-ascii.h \
|
||||
asyn.h curl_ntlm.h curl_gssapi.h curl_ntlm_wb.h curl_ntlm_core.h \
|
||||
curl_ntlm_msgs.h curl_sasl.h curl_schannel.h curl_multibyte.h \
|
||||
curl_darwinssl.h hostcheck.h bundles.h conncache.h curl_setup_once.h \
|
||||
multihandle.h setup-vms.h pipeline.h dotdot.h x509asn1.h gskit.h
|
||||
HHEADERS = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
|
||||
formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h \
|
||||
speedcheck.h urldata.h curl_ldap.h escape.h telnet.h getinfo.h \
|
||||
strequal.h curl_sec.h memdebug.h http_chunks.h curl_fnmatch.h \
|
||||
wildcard.h fileinfo.h ftplistparser.h strtok.h connect.h llist.h \
|
||||
hash.h content_encoding.h share.h curl_md4.h curl_md5.h http_digest.h \
|
||||
http_negotiate.h inet_pton.h amigaos.h strtoofft.h strerror.h \
|
||||
inet_ntop.h curlx.h curl_memory.h curl_setup.h transfer.h select.h \
|
||||
easyif.h multiif.h parsedate.h tftp.h sockaddr.h splay.h strdup.h \
|
||||
socks.h ssh.h curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h \
|
||||
slist.h nonblock.h curl_memrchr.h imap.h pop3.h smtp.h pingpong.h \
|
||||
rtsp.h curl_threads.h warnless.h curl_hmac.h curl_rtmp.h \
|
||||
curl_gethostname.h gopher.h http_proxy.h non-ascii.h asyn.h \
|
||||
curl_ntlm.h curl_gssapi.h curl_ntlm_wb.h curl_ntlm_core.h \
|
||||
curl_ntlm_msgs.h curl_sasl.h curl_multibyte.h hostcheck.h bundles.h \
|
||||
conncache.h curl_setup_once.h multihandle.h setup-vms.h pipeline.h \
|
||||
dotdot.h x509asn1.h http2.h sigpipe.h $(VHEADERS)
|
||||
|
@@ -315,10 +315,12 @@ endif
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
include Makefile.inc
|
||||
|
||||
OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CSOURCES))) $(OBJDIR)/nwos.o
|
||||
OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(notdir $(CSOURCES)))) $(OBJDIR)/nwos.o
|
||||
|
||||
OBJL = $(OBJS) $(OBJDIR)/nwlib.o $(LDLIBS)
|
||||
|
||||
vpath %.c . vtls
|
||||
|
||||
all: lib nlm
|
||||
|
||||
nlm: prebuild $(TARGET).nlm
|
||||
|
@@ -5,7 +5,7 @@
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1999 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
# Copyright (C) 1999 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
@@ -165,6 +165,18 @@ CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB)
|
||||
CFGSET = TRUE
|
||||
!ENDIF
|
||||
|
||||
######################
|
||||
# release-winssl
|
||||
|
||||
!IF "$(CFG)" == "release-winssl"
|
||||
TARGET = $(LIBCURL_STA_LIB_REL)
|
||||
DIROBJ = $(CFG)
|
||||
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
|
||||
LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET)
|
||||
CC = $(CCNODBG) $(RTLIB) $(CFLAGSWINSSL) $(CFLAGSLIB)
|
||||
CFGSET = TRUE
|
||||
!ENDIF
|
||||
|
||||
######################
|
||||
# release-zlib
|
||||
|
||||
@@ -566,7 +578,6 @@ X_OBJS= \
|
||||
$(DIROBJ)\imap.obj \
|
||||
$(DIROBJ)\inet_ntop.obj \
|
||||
$(DIROBJ)\inet_pton.obj \
|
||||
$(DIROBJ)\krb4.obj \
|
||||
$(DIROBJ)\krb5.obj \
|
||||
$(DIROBJ)\ldap.obj \
|
||||
$(DIROBJ)\llist.obj \
|
||||
@@ -602,8 +613,8 @@ X_OBJS= \
|
||||
$(DIROBJ)\speedcheck.obj \
|
||||
$(DIROBJ)\splay.obj \
|
||||
$(DIROBJ)\ssh.obj \
|
||||
$(DIROBJ)\sslgen.obj \
|
||||
$(DIROBJ)\ssluse.obj \
|
||||
$(DIROBJ)\vtls.obj \
|
||||
$(DIROBJ)\openssl.obj \
|
||||
$(DIROBJ)\strdup.obj \
|
||||
$(DIROBJ)\strequal.obj \
|
||||
$(DIROBJ)\strerror.obj \
|
||||
@@ -642,6 +653,9 @@ $(DIROBJ):
|
||||
{.\}.c{$(DIROBJ)\}.obj:
|
||||
$(CC) $(CFLAGS) /Fo"$@" $<
|
||||
|
||||
{.\vtls\}.c{$(DIROBJ)\}.obj:
|
||||
$(CC) $(CFLAGS) /Fo"$@" $<
|
||||
|
||||
debug-dll\libcurl.res \
|
||||
debug-dll-ssl-dll\libcurl.res \
|
||||
debug-dll-zlib-dll\libcurl.res \
|
||||
|
31
lib/README.http2
Normal file
31
lib/README.http2
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
HTTP2 with libcurl
|
||||
|
||||
Spec: http://tools.ietf.org/html/draft-ietf-httpbis-http2-06
|
||||
|
||||
nghttp2 (https://github.com/tatsuhiro-t/nghttp2)
|
||||
|
||||
We're depending on this 3rd party library for the actual low level protocol
|
||||
handling parts. The reason for this is that HTTP2 is much more complex at
|
||||
that layer than HTTP1.1 (which we implement on our own) and that nghttp2 is
|
||||
an already existing and well functional library.
|
||||
|
||||
Over an http:// URL
|
||||
|
||||
If CURLOPT_HTTP_VERSION is set to CURL_HTTP_VERSION_2, libcurl will include
|
||||
an upgrade header in the initial request to the host to allow upgrading to
|
||||
http2. Possibly introduce an option that will cause libcurl to fail if not
|
||||
possible to upgrade. Possibly introduce an option that makes libcurl use
|
||||
http2 at once over http://
|
||||
|
||||
Over an https:// URL
|
||||
|
||||
If CURLOPT_HTTP_VERSION is set to CURL_HTTP_VERSION_2, libcurl will use ALPN
|
||||
(or NPN) to negotiate which protocol to continue with. Possibly introduce an
|
||||
option that will cause libcurl to fail if not possible to use http2.
|
||||
|
||||
To consider:
|
||||
|
||||
- How to tell libcurl when using the multi interface that all or some of the
|
||||
handles are allowed to re-use the same physical connection. Can we just
|
||||
re-use existing pipelining logic?
|
@@ -623,4 +623,72 @@ CURLcode Curl_set_dns_servers(struct SessionHandle *data,
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
CURLcode Curl_set_dns_interface(struct SessionHandle *data,
|
||||
const char *interf)
|
||||
{
|
||||
#if (ARES_VERSION >= 0x010704)
|
||||
if(!interf)
|
||||
interf = "";
|
||||
|
||||
ares_set_local_dev((ares_channel)data->state.resolver, interf);
|
||||
|
||||
return CURLE_OK;
|
||||
#else /* c-ares version too old! */
|
||||
(void)data;
|
||||
(void)interf;
|
||||
return CURLE_NOT_BUILT_IN;
|
||||
#endif
|
||||
}
|
||||
|
||||
CURLcode Curl_set_dns_local_ip4(struct SessionHandle *data,
|
||||
const char *local_ip4)
|
||||
{
|
||||
#if (ARES_VERSION >= 0x010704)
|
||||
struct in_addr a4;
|
||||
|
||||
if((!local_ip4) || (local_ip4[0] == 0)) {
|
||||
a4.s_addr = 0; /* disabled: do not bind to a specific address */
|
||||
}
|
||||
else {
|
||||
if(Curl_inet_pton(AF_INET, local_ip4, &a4) != 1) {
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
}
|
||||
}
|
||||
|
||||
ares_set_local_ip4((ares_channel)data->state.resolver, ntohl(a4.s_addr));
|
||||
|
||||
return CURLE_OK;
|
||||
#else /* c-ares version too old! */
|
||||
(void)data;
|
||||
(void)local_ip4;
|
||||
return CURLE_NOT_BUILT_IN;
|
||||
#endif
|
||||
}
|
||||
|
||||
CURLcode Curl_set_dns_local_ip6(struct SessionHandle *data,
|
||||
const char *local_ip6)
|
||||
{
|
||||
#if (ARES_VERSION >= 0x010704)
|
||||
unsigned char a6[INET6_ADDRSTRLEN];
|
||||
|
||||
if((!local_ip6) || (local_ip6[0] == 0)) {
|
||||
/* disabled: do not bind to a specific address */
|
||||
memset(a6, 0, sizeof(a6));
|
||||
}
|
||||
else {
|
||||
if(Curl_inet_pton(AF_INET6, local_ip6, a6) != 1) {
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
}
|
||||
}
|
||||
|
||||
ares_set_local_ip6((ares_channel)data->state.resolver, a6);
|
||||
|
||||
return CURLE_OK;
|
||||
#else /* c-ares version too old! */
|
||||
(void)data;
|
||||
(void)local_ip6;
|
||||
return CURLE_NOT_BUILT_IN;
|
||||
#endif
|
||||
}
|
||||
#endif /* CURLRES_ARES */
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -209,7 +209,7 @@ int init_thread_sync_data(struct thread_sync_data * tsd,
|
||||
memset(tsd, 0, sizeof(*tsd));
|
||||
|
||||
tsd->port = port;
|
||||
#ifdef CURLRES_IPV6
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
DEBUGASSERT(hints);
|
||||
tsd->hints = *hints;
|
||||
#else
|
||||
@@ -265,7 +265,7 @@ static int getaddrinfo_complete(struct connectdata *conn)
|
||||
static unsigned int CURL_STDCALL getaddrinfo_thread (void *arg)
|
||||
{
|
||||
struct thread_sync_data *tsd = (struct thread_sync_data*)arg;
|
||||
char service [NI_MAXSERV];
|
||||
char service[12];
|
||||
int rc;
|
||||
|
||||
snprintf(service, sizeof(service), "%d", tsd->port);
|
||||
@@ -559,7 +559,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
|
||||
struct in_addr in;
|
||||
Curl_addrinfo *res;
|
||||
int error;
|
||||
char sbuf[NI_MAXSERV];
|
||||
char sbuf[12];
|
||||
int pf = PF_INET;
|
||||
#ifdef CURLRES_IPV6
|
||||
struct in6_addr in6;
|
||||
@@ -635,4 +635,28 @@ CURLcode Curl_set_dns_servers(struct SessionHandle *data,
|
||||
|
||||
}
|
||||
|
||||
CURLcode Curl_set_dns_interface(struct SessionHandle *data,
|
||||
const char *interf)
|
||||
{
|
||||
(void)data;
|
||||
(void)interf;
|
||||
return CURLE_NOT_BUILT_IN;
|
||||
}
|
||||
|
||||
CURLcode Curl_set_dns_local_ip4(struct SessionHandle *data,
|
||||
const char *local_ip4)
|
||||
{
|
||||
(void)data;
|
||||
(void)local_ip4;
|
||||
return CURLE_NOT_BUILT_IN;
|
||||
}
|
||||
|
||||
CURLcode Curl_set_dns_local_ip6(struct SessionHandle *data,
|
||||
const char *local_ip6)
|
||||
{
|
||||
(void)data;
|
||||
(void)local_ip6;
|
||||
return CURLE_NOT_BUILT_IN;
|
||||
}
|
||||
|
||||
#endif /* CURLRES_THREADED */
|
||||
|
109
lib/base64.c
109
lib/base64.c
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -40,29 +40,45 @@
|
||||
static const char table64[]=
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
static void decodeQuantum(unsigned char *dest, const char *src)
|
||||
static size_t decodeQuantum(unsigned char *dest, const char *src)
|
||||
{
|
||||
size_t padding = 0;
|
||||
const char *s, *p;
|
||||
unsigned long i, v, x = 0;
|
||||
|
||||
for(i = 0, s = src; i < 4; i++, s++) {
|
||||
v = 0;
|
||||
p = table64;
|
||||
while(*p && (*p != *s)) {
|
||||
v++;
|
||||
p++;
|
||||
}
|
||||
if(*p == *s)
|
||||
x = (x << 6) + v;
|
||||
else if(*s == '=')
|
||||
|
||||
if(*s == '=') {
|
||||
x = (x << 6);
|
||||
padding++;
|
||||
}
|
||||
else {
|
||||
p = table64;
|
||||
|
||||
while(*p && (*p != *s)) {
|
||||
v++;
|
||||
p++;
|
||||
}
|
||||
|
||||
if(*p == *s)
|
||||
x = (x << 6) + v;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
dest[2] = curlx_ultouc(x & 0xFFUL);
|
||||
if(padding < 1)
|
||||
dest[2] = curlx_ultouc(x & 0xFFUL);
|
||||
|
||||
x >>= 8;
|
||||
dest[1] = curlx_ultouc(x & 0xFFUL);
|
||||
if(padding < 2)
|
||||
dest[1] = curlx_ultouc(x & 0xFFUL);
|
||||
|
||||
x >>= 8;
|
||||
dest[0] = curlx_ultouc(x & 0xFFUL);
|
||||
|
||||
return 3 - padding;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -82,58 +98,71 @@ static void decodeQuantum(unsigned char *dest, const char *src)
|
||||
CURLcode Curl_base64_decode(const char *src,
|
||||
unsigned char **outptr, size_t *outlen)
|
||||
{
|
||||
size_t srclen = 0;
|
||||
size_t length = 0;
|
||||
size_t equalsTerm = 0;
|
||||
size_t padding = 0;
|
||||
size_t i;
|
||||
size_t result;
|
||||
size_t numQuantums;
|
||||
unsigned char lastQuantum[3];
|
||||
size_t rawlen = 0;
|
||||
unsigned char *pos;
|
||||
unsigned char *newstr;
|
||||
|
||||
*outptr = NULL;
|
||||
*outlen = 0;
|
||||
srclen = strlen(src);
|
||||
|
||||
/* Check the length of the input string is valid */
|
||||
if(!srclen || srclen % 4)
|
||||
return CURLE_BAD_CONTENT_ENCODING;
|
||||
|
||||
/* Find the position of any = padding characters */
|
||||
while((src[length] != '=') && src[length])
|
||||
length++;
|
||||
|
||||
/* A maximum of two = padding characters is allowed */
|
||||
if(src[length] == '=') {
|
||||
equalsTerm++;
|
||||
if(src[length+equalsTerm] == '=')
|
||||
equalsTerm++;
|
||||
padding++;
|
||||
if(src[length + 1] == '=')
|
||||
padding++;
|
||||
}
|
||||
numQuantums = (length + equalsTerm) / 4;
|
||||
|
||||
/* Don't allocate a buffer if the decoded length is 0 */
|
||||
if(numQuantums == 0)
|
||||
return CURLE_OK;
|
||||
/* Check the = padding characters weren't part way through the input */
|
||||
if(length + padding != srclen)
|
||||
return CURLE_BAD_CONTENT_ENCODING;
|
||||
|
||||
rawlen = (numQuantums * 3) - equalsTerm;
|
||||
/* Calculate the number of quantums */
|
||||
numQuantums = srclen / 4;
|
||||
|
||||
/* The buffer must be large enough to make room for the last quantum
|
||||
(which may be partially thrown out) and the zero terminator. */
|
||||
newstr = malloc(rawlen+4);
|
||||
/* Calculate the size of the decoded string */
|
||||
rawlen = (numQuantums * 3) - padding;
|
||||
|
||||
/* Allocate our buffer including room for a zero terminator */
|
||||
newstr = malloc(rawlen + 1);
|
||||
if(!newstr)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
*outptr = newstr;
|
||||
pos = newstr;
|
||||
|
||||
/* Decode all but the last quantum (which may not decode to a
|
||||
multiple of 3 bytes) */
|
||||
for(i = 0; i < numQuantums - 1; i++) {
|
||||
decodeQuantum(newstr, src);
|
||||
newstr += 3; src += 4;
|
||||
/* Decode the quantums */
|
||||
for(i = 0; i < numQuantums; i++) {
|
||||
result = decodeQuantum(pos, src);
|
||||
if(!result) {
|
||||
Curl_safefree(newstr);
|
||||
|
||||
return CURLE_BAD_CONTENT_ENCODING;
|
||||
}
|
||||
|
||||
pos += result;
|
||||
src += 4;
|
||||
}
|
||||
|
||||
/* This final decode may actually read slightly past the end of the buffer
|
||||
if the input string is missing pad bytes. This will almost always be
|
||||
harmless. */
|
||||
decodeQuantum(lastQuantum, src);
|
||||
for(i = 0; i < 3 - equalsTerm; i++)
|
||||
newstr[i] = lastQuantum[i];
|
||||
/* Zero terminate */
|
||||
*pos = '\0';
|
||||
|
||||
newstr[i] = '\0'; /* zero terminate */
|
||||
|
||||
*outlen = rawlen; /* return size of decoded data */
|
||||
/* Return the decoded data */
|
||||
*outptr = newstr;
|
||||
*outlen = rawlen;
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
@@ -529,10 +529,10 @@
|
||||
#define SEND_TYPE_RETV int
|
||||
|
||||
/* Define to use the QsoSSL package. */
|
||||
#define USE_QSOSSL
|
||||
#undef USE_QSOSSL
|
||||
|
||||
/* Define to use the GSKit package. */
|
||||
#undef USE_GSKIT
|
||||
#define USE_GSKIT
|
||||
|
||||
/* Use the system keyring as the default CA bundle. */
|
||||
#define CURL_CA_BUNDLE "/QIBM/UserData/ICSS/Cert/Server/DEFAULT.KDB"
|
||||
|
@@ -390,21 +390,6 @@
|
||||
# define SIZEOF_SIZE_T 4
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* STRUCT RELATED */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Define if you have struct sockaddr_storage. */
|
||||
#if !defined(__SALFORDC__) && !defined(__BORLANDC__)
|
||||
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
|
||||
#endif
|
||||
|
||||
/* Define if you have struct timeval. */
|
||||
#define HAVE_STRUCT_TIMEVAL 1
|
||||
|
||||
/* Define if struct sockaddr_in6 has the sin6_scope_id member. */
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* BSD-style lwIP TCP/IP stack SPECIFIC */
|
||||
/* ---------------------------------------------------------------- */
|
||||
@@ -572,6 +557,25 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* STRUCT RELATED */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Define if you have struct sockaddr_storage. */
|
||||
#if !defined(__SALFORDC__) && !defined(__BORLANDC__)
|
||||
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
|
||||
#endif
|
||||
|
||||
/* Define if you have struct timeval. */
|
||||
#define HAVE_STRUCT_TIMEVAL 1
|
||||
|
||||
/* Define if struct sockaddr_in6 has the sin6_scope_id member. */
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
|
||||
|
||||
#if HAVE_WINSOCK2_H && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
|
||||
#define HAVE_STRUCT_POLLFD 1
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* LARGE FILE SUPPORT */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
@@ -6,7 +6,7 @@
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 2012, Linus Nielsen Feltzing, <linus@haxx.se>
|
||||
* Copyright (C) 2012 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 2012 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -166,10 +166,13 @@ void Curl_conncache_remove_conn(struct conncache *connc,
|
||||
if(bundle->num_connections == 0) {
|
||||
conncache_remove_bundle(connc, bundle);
|
||||
}
|
||||
connc->num_connections--;
|
||||
|
||||
DEBUGF(infof(conn->data, "The cache now contains %d members\n",
|
||||
connc->num_connections));
|
||||
if(connc) {
|
||||
connc->num_connections--;
|
||||
|
||||
DEBUGF(infof(conn->data, "The cache now contains %d members\n",
|
||||
connc->num_connections));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
403
lib/connect.c
403
lib/connect.c
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -71,7 +71,7 @@
|
||||
#include "sockaddr.h" /* required for Curl_sockaddr_storage */
|
||||
#include "inet_ntop.h"
|
||||
#include "inet_pton.h"
|
||||
#include "sslgen.h" /* for Curl_ssl_check_cxn() */
|
||||
#include "vtls/vtls.h" /* for Curl_ssl_check_cxn() */
|
||||
#include "progress.h"
|
||||
#include "warnless.h"
|
||||
#include "conncache.h"
|
||||
@@ -164,8 +164,7 @@ tcpkeepalive(struct SessionHandle *data,
|
||||
static CURLcode
|
||||
singleipconnect(struct connectdata *conn,
|
||||
const Curl_addrinfo *ai, /* start connecting to this */
|
||||
curl_socket_t *sock,
|
||||
bool *connected);
|
||||
curl_socket_t *sock);
|
||||
|
||||
/*
|
||||
* Curl_timeleft() returns the amount of milliseconds left allowed for the
|
||||
@@ -233,45 +232,6 @@ long Curl_timeleft(struct SessionHandle *data,
|
||||
return timeout_ms;
|
||||
}
|
||||
|
||||
/*
|
||||
* checkconnect() checks for a TCP connect on the given socket.
|
||||
* It returns:
|
||||
*/
|
||||
|
||||
enum chkconn_t {
|
||||
CHKCONN_SELECT_ERROR = -1,
|
||||
CHKCONN_CONNECTED = 0,
|
||||
CHKCONN_IDLE = 1,
|
||||
CHKCONN_FDSET_ERROR = 2
|
||||
};
|
||||
|
||||
static enum chkconn_t
|
||||
checkconnect(curl_socket_t sockfd)
|
||||
{
|
||||
int rc;
|
||||
#ifdef mpeix
|
||||
/* Call this function once now, and ignore the results. We do this to
|
||||
"clear" the error state on the socket so that we can later read it
|
||||
reliably. This is reported necessary on the MPE/iX operating system. */
|
||||
(void)verifyconnect(sockfd, NULL);
|
||||
#endif
|
||||
|
||||
rc = Curl_socket_ready(CURL_SOCKET_BAD, sockfd, 0);
|
||||
|
||||
if(-1 == rc)
|
||||
/* error, no connect here, try next */
|
||||
return CHKCONN_SELECT_ERROR;
|
||||
|
||||
else if(rc & CURL_CSELECT_ERR)
|
||||
/* error condition caught */
|
||||
return CHKCONN_FDSET_ERROR;
|
||||
|
||||
else if(rc)
|
||||
return CHKCONN_CONNECTED;
|
||||
|
||||
return CHKCONN_IDLE;
|
||||
}
|
||||
|
||||
static CURLcode bindlocal(struct connectdata *conn,
|
||||
curl_socket_t sockfd, int af)
|
||||
{
|
||||
@@ -573,42 +533,57 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
|
||||
more address exists or error */
|
||||
static CURLcode trynextip(struct connectdata *conn,
|
||||
int sockindex,
|
||||
bool *connected)
|
||||
int tempindex)
|
||||
{
|
||||
curl_socket_t sockfd;
|
||||
Curl_addrinfo *ai;
|
||||
CURLcode rc = CURLE_COULDNT_CONNECT;
|
||||
|
||||
/* First clean up after the failed socket.
|
||||
Don't close it yet to ensure that the next IP's socket gets a different
|
||||
file descriptor, which can prevent bugs when the curl_multi_socket_action
|
||||
interface is used with certain select() replacements such as kqueue. */
|
||||
curl_socket_t fd_to_close = conn->sock[sockindex];
|
||||
conn->sock[sockindex] = CURL_SOCKET_BAD;
|
||||
*connected = FALSE;
|
||||
curl_socket_t fd_to_close = conn->tempsock[tempindex];
|
||||
conn->tempsock[tempindex] = CURL_SOCKET_BAD;
|
||||
|
||||
if(sockindex != FIRSTSOCKET) {
|
||||
Curl_closesocket(conn, fd_to_close);
|
||||
return CURLE_COULDNT_CONNECT; /* no next */
|
||||
}
|
||||
if(sockindex == FIRSTSOCKET) {
|
||||
Curl_addrinfo *ai;
|
||||
int family;
|
||||
|
||||
/* try the next address */
|
||||
ai = conn->ip_addr->ai_next;
|
||||
|
||||
while(ai) {
|
||||
CURLcode res = singleipconnect(conn, ai, &sockfd, connected);
|
||||
if(res)
|
||||
return res;
|
||||
if(sockfd != CURL_SOCKET_BAD) {
|
||||
/* store the new socket descriptor */
|
||||
conn->sock[sockindex] = sockfd;
|
||||
conn->ip_addr = ai;
|
||||
Curl_closesocket(conn, fd_to_close);
|
||||
return CURLE_OK;
|
||||
if(conn->tempaddr[tempindex]) {
|
||||
/* find next address in the same protocol family */
|
||||
family = conn->tempaddr[tempindex]->ai_family;
|
||||
ai = conn->tempaddr[tempindex]->ai_next;
|
||||
}
|
||||
else {
|
||||
/* happy eyeballs - try the other protocol family */
|
||||
int firstfamily = conn->tempaddr[0]->ai_family;
|
||||
#ifdef ENABLE_IPV6
|
||||
family = (firstfamily == AF_INET) ? AF_INET6 : AF_INET;
|
||||
#else
|
||||
family = firstfamily;
|
||||
#endif
|
||||
ai = conn->tempaddr[0]->ai_next;
|
||||
}
|
||||
|
||||
while(ai) {
|
||||
while(ai && ai->ai_family != family)
|
||||
ai = ai->ai_next;
|
||||
|
||||
if(ai) {
|
||||
rc = singleipconnect(conn, ai, &conn->tempsock[tempindex]);
|
||||
conn->tempaddr[tempindex] = ai;
|
||||
if(rc == CURLE_COULDNT_CONNECT) {
|
||||
ai = ai->ai_next;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
ai = ai->ai_next;
|
||||
}
|
||||
Curl_closesocket(conn, fd_to_close);
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
|
||||
if(fd_to_close != CURL_SOCKET_BAD)
|
||||
Curl_closesocket(conn, fd_to_close);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Copies connection info into the session handle to make it available
|
||||
@@ -682,6 +657,10 @@ void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd)
|
||||
struct Curl_sockaddr_storage ssloc;
|
||||
struct SessionHandle *data = conn->data;
|
||||
|
||||
if(conn->socktype == SOCK_DGRAM)
|
||||
/* there's no connection! */
|
||||
return;
|
||||
|
||||
if(!conn->bits.reuse) {
|
||||
|
||||
len = sizeof(struct Curl_sockaddr_storage);
|
||||
@@ -707,6 +686,7 @@ void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd)
|
||||
error, Curl_strerror(conn, error));
|
||||
return;
|
||||
}
|
||||
memcpy(conn->ip_addr_str, conn->primary_ip, MAX_IPADR_LEN);
|
||||
|
||||
if(!getaddressinfo((struct sockaddr*)&ssloc,
|
||||
conn->local_ip, &conn->local_port)) {
|
||||
@@ -732,11 +712,11 @@ CURLcode Curl_is_connected(struct connectdata *conn,
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
CURLcode code = CURLE_OK;
|
||||
curl_socket_t sockfd = conn->sock[sockindex];
|
||||
long allow = DEFAULT_CONNECT_TIMEOUT;
|
||||
long allow;
|
||||
int error = 0;
|
||||
struct timeval now;
|
||||
enum chkconn_t chk;
|
||||
int result;
|
||||
int i;
|
||||
|
||||
DEBUGASSERT(sockindex >= FIRSTSOCKET && sockindex <= SECONDARYSOCKET);
|
||||
|
||||
@@ -759,69 +739,104 @@ CURLcode Curl_is_connected(struct connectdata *conn,
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
|
||||
/* check socket for connect */
|
||||
chk = checkconnect(sockfd);
|
||||
if(CHKCONN_IDLE == chk) {
|
||||
if(curlx_tvdiff(now, conn->connecttime) >= conn->timeoutms_per_addr) {
|
||||
infof(data, "After %ldms connect time, move on!\n",
|
||||
conn->timeoutms_per_addr);
|
||||
goto next;
|
||||
for(i=0; i<2; i++) {
|
||||
if(conn->tempsock[i] == CURL_SOCKET_BAD)
|
||||
continue;
|
||||
|
||||
#ifdef mpeix
|
||||
/* Call this function once now, and ignore the results. We do this to
|
||||
"clear" the error state on the socket so that we can later read it
|
||||
reliably. This is reported necessary on the MPE/iX operating system. */
|
||||
(void)verifyconnect(conn->tempsock[i], NULL);
|
||||
#endif
|
||||
|
||||
/* check socket for connect */
|
||||
result = Curl_socket_ready(CURL_SOCKET_BAD, conn->tempsock[i], 0);
|
||||
|
||||
if(result == 0) { /* no connection yet */
|
||||
if(curlx_tvdiff(now, conn->connecttime) >= conn->timeoutms_per_addr) {
|
||||
infof(data, "After %ldms connect time, move on!\n",
|
||||
conn->timeoutms_per_addr);
|
||||
error = ETIMEDOUT;
|
||||
}
|
||||
|
||||
/* should we try another protocol family? */
|
||||
if(i == 0 && conn->tempaddr[1] == NULL &&
|
||||
curlx_tvdiff(now, conn->connecttime) >= HAPPY_EYEBALLS_TIMEOUT) {
|
||||
trynextip(conn, sockindex, 1);
|
||||
}
|
||||
}
|
||||
else if(result == CURL_CSELECT_OUT) {
|
||||
if(verifyconnect(conn->tempsock[i], &error)) {
|
||||
/* we are connected with TCP, awesome! */
|
||||
int other = i ^ 1;
|
||||
|
||||
/* not an error, but also no connection yet */
|
||||
return code;
|
||||
}
|
||||
/* use this socket from now on */
|
||||
conn->sock[sockindex] = conn->tempsock[i];
|
||||
conn->ip_addr = conn->tempaddr[i];
|
||||
conn->tempsock[i] = CURL_SOCKET_BAD;
|
||||
|
||||
if(CHKCONN_CONNECTED == chk) {
|
||||
if(verifyconnect(sockfd, &error)) {
|
||||
/* we are connected with TCP, awesome! */
|
||||
/* close the other socket, if open */
|
||||
if(conn->tempsock[other] != CURL_SOCKET_BAD) {
|
||||
Curl_closesocket(conn, conn->tempsock[other]);
|
||||
conn->tempsock[other] = CURL_SOCKET_BAD;
|
||||
}
|
||||
|
||||
/* see if we need to do any proxy magic first once we connected */
|
||||
code = Curl_connected_proxy(conn);
|
||||
if(code)
|
||||
return code;
|
||||
/* see if we need to do any proxy magic first once we connected */
|
||||
code = Curl_connected_proxy(conn, sockindex);
|
||||
if(code)
|
||||
return code;
|
||||
|
||||
conn->bits.tcpconnect[sockindex] = TRUE;
|
||||
conn->bits.tcpconnect[sockindex] = TRUE;
|
||||
|
||||
*connected = TRUE;
|
||||
if(sockindex == FIRSTSOCKET)
|
||||
Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */
|
||||
Curl_verboseconnect(conn);
|
||||
Curl_updateconninfo(conn, sockfd);
|
||||
*connected = TRUE;
|
||||
if(sockindex == FIRSTSOCKET)
|
||||
Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */
|
||||
Curl_updateconninfo(conn, conn->sock[sockindex]);
|
||||
Curl_verboseconnect(conn);
|
||||
|
||||
return CURLE_OK;
|
||||
return CURLE_OK;
|
||||
}
|
||||
else
|
||||
infof(data, "Connection failed\n");
|
||||
}
|
||||
/* nope, not connected for real */
|
||||
}
|
||||
else {
|
||||
/* nope, not connected */
|
||||
if(CHKCONN_FDSET_ERROR == chk) {
|
||||
(void)verifyconnect(sockfd, &error);
|
||||
infof(data, "%s\n",Curl_strerror(conn, error));
|
||||
else if(result & CURL_CSELECT_ERR)
|
||||
(void)verifyconnect(conn->tempsock[i], &error);
|
||||
|
||||
/*
|
||||
* The connection failed here, we should attempt to connect to the "next
|
||||
* address" for the given host. But first remember the latest error.
|
||||
*/
|
||||
if(error) {
|
||||
char ipaddress[MAX_IPADR_LEN];
|
||||
data->state.os_errno = error;
|
||||
SET_SOCKERRNO(error);
|
||||
Curl_printable_address(conn->tempaddr[i], ipaddress, MAX_IPADR_LEN);
|
||||
infof(data, "connect to %s port %ld failed: %s\n",
|
||||
ipaddress, conn->port, Curl_strerror(conn, error));
|
||||
|
||||
conn->timeoutms_per_addr = conn->tempaddr[i]->ai_next == NULL ?
|
||||
allow : allow / 2;
|
||||
|
||||
code = trynextip(conn, sockindex, i);
|
||||
}
|
||||
else
|
||||
infof(data, "Connection failed\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* The connection failed here, we should attempt to connect to the "next
|
||||
* address" for the given host. But first remember the latest error.
|
||||
*/
|
||||
if(error) {
|
||||
data->state.os_errno = error;
|
||||
SET_SOCKERRNO(error);
|
||||
}
|
||||
next:
|
||||
|
||||
conn->timeoutms_per_addr = conn->ip_addr->ai_next == NULL ?
|
||||
allow : allow / 2;
|
||||
code = trynextip(conn, sockindex, connected);
|
||||
|
||||
if(code) {
|
||||
error = SOCKERRNO;
|
||||
data->state.os_errno = error;
|
||||
failf(data, "Failed connect to %s:%ld; %s",
|
||||
conn->host.name, conn->port, Curl_strerror(conn, error));
|
||||
/* no more addresses to try */
|
||||
|
||||
/* if the first address family runs out of addresses to try before
|
||||
the happy eyeball timeout, go ahead and try the next family now */
|
||||
if(conn->tempaddr[1] == NULL) {
|
||||
int rc;
|
||||
rc = trynextip(conn, sockindex, 1);
|
||||
if(rc == CURLE_OK)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
failf(data, "Failed to connect to %s port %ld: %s",
|
||||
conn->bits.proxy?conn->proxy.name:conn->host.name,
|
||||
conn->port, Curl_strerror(conn, error));
|
||||
}
|
||||
|
||||
return code;
|
||||
@@ -901,19 +916,40 @@ void Curl_sndbufset(curl_socket_t sockfd)
|
||||
int val = CURL_MAX_WRITE_SIZE + 32;
|
||||
int curval = 0;
|
||||
int curlen = sizeof(curval);
|
||||
DWORD majorVersion = 6;
|
||||
|
||||
OSVERSIONINFO osver;
|
||||
static int detectOsState = DETECT_OS_NONE;
|
||||
|
||||
if(detectOsState == DETECT_OS_NONE) {
|
||||
#if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_WIN2K) || \
|
||||
(_WIN32_WINNT < _WIN32_WINNT_WIN2K)
|
||||
OSVERSIONINFO osver;
|
||||
|
||||
memset(&osver, 0, sizeof(osver));
|
||||
osver.dwOSVersionInfoSize = sizeof(osver);
|
||||
|
||||
detectOsState = DETECT_OS_PREVISTA;
|
||||
if(GetVersionEx(&osver)) {
|
||||
if(osver.dwMajorVersion >= 6)
|
||||
if(osver.dwMajorVersion >= majorVersion)
|
||||
detectOsState = DETECT_OS_VISTA_OR_LATER;
|
||||
}
|
||||
#else
|
||||
ULONGLONG majorVersionMask;
|
||||
OSVERSIONINFOEX osver;
|
||||
|
||||
memset(&osver, 0, sizeof(osver));
|
||||
osver.dwOSVersionInfoSize = sizeof(osver);
|
||||
osver.dwMajorVersion = majorVersion;
|
||||
majorVersionMask = VerSetConditionMask(0, VER_MAJORVERSION,
|
||||
VER_GREATER_EQUAL);
|
||||
|
||||
if(VerifyVersionInfo(&osver, VER_MAJORVERSION, majorVersionMask))
|
||||
detectOsState = DETECT_OS_VISTA_OR_LATER;
|
||||
else
|
||||
detectOsState = DETECT_OS_PREVISTA;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(detectOsState == DETECT_OS_VISTA_OR_LATER)
|
||||
return;
|
||||
|
||||
@@ -925,7 +961,6 @@ void Curl_sndbufset(curl_socket_t sockfd)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* singleipconnect()
|
||||
*
|
||||
@@ -938,8 +973,7 @@ void Curl_sndbufset(curl_socket_t sockfd)
|
||||
static CURLcode
|
||||
singleipconnect(struct connectdata *conn,
|
||||
const Curl_addrinfo *ai,
|
||||
curl_socket_t *sockp,
|
||||
bool *connected)
|
||||
curl_socket_t *sockp)
|
||||
{
|
||||
struct Curl_sockaddr_ex addr;
|
||||
int rc;
|
||||
@@ -948,9 +982,10 @@ singleipconnect(struct connectdata *conn,
|
||||
struct SessionHandle *data = conn->data;
|
||||
curl_socket_t sockfd;
|
||||
CURLcode res = CURLE_OK;
|
||||
char ipaddress[MAX_IPADR_LEN];
|
||||
long port;
|
||||
|
||||
*sockp = CURL_SOCKET_BAD;
|
||||
*connected = FALSE; /* default is not connected */
|
||||
|
||||
res = Curl_socket(conn, ai, &addr, &sockfd);
|
||||
if(res)
|
||||
@@ -961,7 +996,7 @@ singleipconnect(struct connectdata *conn,
|
||||
|
||||
/* store remote address and port used in this connection attempt */
|
||||
if(!getaddressinfo((struct sockaddr*)&addr.sa_addr,
|
||||
conn->primary_ip, &conn->primary_port)) {
|
||||
ipaddress, &port)) {
|
||||
/* malformed address or bug in inet_ntop, try next address */
|
||||
error = ERRNO;
|
||||
failf(data, "sa_addr inet_ntop() failed with errno %d: %s",
|
||||
@@ -969,10 +1004,7 @@ singleipconnect(struct connectdata *conn,
|
||||
Curl_closesocket(conn, sockfd);
|
||||
return CURLE_OK;
|
||||
}
|
||||
memcpy(conn->ip_addr_str, conn->primary_ip, MAX_IPADR_LEN);
|
||||
infof(data, " Trying %s...\n", conn->ip_addr_str);
|
||||
|
||||
Curl_persistconninfo(conn);
|
||||
infof(data, " Trying %s...\n", ipaddress);
|
||||
|
||||
if(data->set.tcp_nodelay)
|
||||
tcpnodelay(conn, sockfd);
|
||||
@@ -1033,7 +1065,7 @@ singleipconnect(struct connectdata *conn,
|
||||
#endif
|
||||
|
||||
if(-1 == rc) {
|
||||
switch (error) {
|
||||
switch(error) {
|
||||
case EINPROGRESS:
|
||||
case EWOULDBLOCK:
|
||||
#if defined(EAGAIN)
|
||||
@@ -1045,25 +1077,25 @@ singleipconnect(struct connectdata *conn,
|
||||
case EAGAIN:
|
||||
#endif
|
||||
#endif
|
||||
*sockp = sockfd;
|
||||
return CURLE_OK;
|
||||
res = CURLE_OK;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* unknown error, fallthrough and try another address! */
|
||||
failf(data, "Failed to connect to %s: %s",
|
||||
conn->ip_addr_str, Curl_strerror(conn,error));
|
||||
infof(data, "Immediate connect fail for %s: %s\n",
|
||||
ipaddress, Curl_strerror(conn,error));
|
||||
data->state.os_errno = error;
|
||||
|
||||
/* connect failed */
|
||||
Curl_closesocket(conn, sockfd);
|
||||
|
||||
break;
|
||||
res = CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if(!res)
|
||||
*sockp = sockfd;
|
||||
|
||||
return CURLE_OK;
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1073,29 +1105,13 @@ singleipconnect(struct connectdata *conn,
|
||||
*/
|
||||
|
||||
CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
const struct Curl_dns_entry *remotehost,
|
||||
curl_socket_t *sockconn, /* the connected socket */
|
||||
Curl_addrinfo **addr, /* the one we used */
|
||||
bool *connected) /* really connected? */
|
||||
const struct Curl_dns_entry *remotehost)
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
curl_socket_t sockfd = CURL_SOCKET_BAD;
|
||||
Curl_addrinfo *ai;
|
||||
Curl_addrinfo *curr_addr;
|
||||
|
||||
struct timeval after;
|
||||
struct timeval before = Curl_tvnow();
|
||||
CURLcode res = CURLE_COULDNT_CONNECT;
|
||||
|
||||
/*************************************************************
|
||||
* Figure out what maximum time we have left
|
||||
*************************************************************/
|
||||
long timeout_ms;
|
||||
|
||||
DEBUGASSERT(sockconn);
|
||||
*connected = FALSE; /* default to not connected */
|
||||
|
||||
/* get the timeout left */
|
||||
timeout_ms = Curl_timeleft(data, &before, TRUE);
|
||||
long timeout_ms = Curl_timeleft(data, &before, TRUE);
|
||||
|
||||
if(timeout_ms < 0) {
|
||||
/* a precaution, no need to continue if time already is up */
|
||||
@@ -1104,57 +1120,26 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
}
|
||||
|
||||
conn->num_addr = Curl_num_addresses(remotehost->addr);
|
||||
conn->tempaddr[0] = remotehost->addr;
|
||||
conn->tempaddr[1] = NULL;
|
||||
conn->tempsock[0] = CURL_SOCKET_BAD;
|
||||
conn->tempsock[1] = CURL_SOCKET_BAD;
|
||||
Curl_expire(conn->data, HAPPY_EYEBALLS_TIMEOUT);
|
||||
|
||||
ai = remotehost->addr;
|
||||
/* Max time for the next connection attempt */
|
||||
conn->timeoutms_per_addr =
|
||||
conn->tempaddr[0]->ai_next == NULL ? timeout_ms : timeout_ms / 2;
|
||||
|
||||
/* Below is the loop that attempts to connect to all IP-addresses we
|
||||
* know for the given host. One by one until one IP succeeds.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Connecting with a Curl_addrinfo chain
|
||||
*/
|
||||
for(curr_addr = ai; curr_addr; curr_addr = curr_addr->ai_next) {
|
||||
CURLcode res;
|
||||
|
||||
/* Max time for the next address */
|
||||
conn->timeoutms_per_addr = curr_addr->ai_next == NULL ?
|
||||
timeout_ms : timeout_ms / 2;
|
||||
|
||||
/* start connecting to the IP curr_addr points to */
|
||||
res = singleipconnect(conn, curr_addr,
|
||||
&sockfd, connected);
|
||||
if(res)
|
||||
return res;
|
||||
|
||||
if(sockfd != CURL_SOCKET_BAD)
|
||||
break;
|
||||
|
||||
/* get a new timeout for next attempt */
|
||||
after = Curl_tvnow();
|
||||
timeout_ms -= Curl_tvdiff(after, before);
|
||||
if(timeout_ms < 0) {
|
||||
failf(data, "connect() timed out!");
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
before = after;
|
||||
} /* end of connect-to-each-address loop */
|
||||
|
||||
*sockconn = sockfd; /* the socket descriptor we've connected */
|
||||
|
||||
if(sockfd == CURL_SOCKET_BAD) {
|
||||
/* no good connect was made */
|
||||
failf(data, "couldn't connect to %s at %s:%ld",
|
||||
conn->bits.proxy?"proxy":"host",
|
||||
conn->bits.proxy?conn->proxy.name:conn->host.name, conn->port);
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
/* start connecting to first IP */
|
||||
while(conn->tempaddr[0]) {
|
||||
res = singleipconnect(conn, conn->tempaddr[0], &(conn->tempsock[0]));
|
||||
if(res == CURLE_OK)
|
||||
break;
|
||||
conn->tempaddr[0] = conn->tempaddr[0]->ai_next;
|
||||
}
|
||||
|
||||
/* leave the socket in non-blocking mode */
|
||||
|
||||
/* store the address we use */
|
||||
if(addr)
|
||||
*addr = curr_addr;
|
||||
if(conn->tempsock[0] == CURL_SOCKET_BAD)
|
||||
return res;
|
||||
|
||||
data->info.numconnects++; /* to track the number of connections made */
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -31,11 +31,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
|
||||
bool *connected);
|
||||
|
||||
CURLcode Curl_connecthost(struct connectdata *conn,
|
||||
const struct Curl_dns_entry *host, /* connect to
|
||||
this */
|
||||
curl_socket_t *sockconn, /* not set if error */
|
||||
Curl_addrinfo **addr, /* the one we used */
|
||||
bool *connected); /* truly connected? */
|
||||
const struct Curl_dns_entry *host);
|
||||
|
||||
/* generic function that returns how much time there's left to run, according
|
||||
to the timeouts set */
|
||||
@@ -44,6 +40,8 @@ long Curl_timeleft(struct SessionHandle *data,
|
||||
bool duringconnect);
|
||||
|
||||
#define DEFAULT_CONNECT_TIMEOUT 300000 /* milliseconds == five minutes */
|
||||
#define HAPPY_EYEBALLS_TIMEOUT 200 /* milliseconds to wait between
|
||||
ipv4/ipv6 connection attempts */
|
||||
|
||||
/*
|
||||
* Used to extract socket and connectdata struct for the most recent
|
||||
|
81
lib/cookie.c
81
lib/cookie.c
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -290,6 +290,34 @@ static void strstore(char **str, const char *newstr)
|
||||
*str = strdup(newstr);
|
||||
}
|
||||
|
||||
/*
|
||||
* remove_expired() removes expired cookies.
|
||||
*/
|
||||
static void remove_expired(struct CookieInfo *cookies)
|
||||
{
|
||||
struct Cookie *co, *nx, *pv;
|
||||
curl_off_t now = (curl_off_t)time(NULL);
|
||||
|
||||
co = cookies->cookies;
|
||||
pv = NULL;
|
||||
while(co) {
|
||||
nx = co->next;
|
||||
if((co->expirestr || co->maxage) && co->expires < now) {
|
||||
if(co == cookies->cookies) {
|
||||
cookies->cookies = co->next;
|
||||
}
|
||||
else {
|
||||
pv->next = co->next;
|
||||
}
|
||||
cookies->numcookies--;
|
||||
freecookie(co);
|
||||
}
|
||||
else {
|
||||
pv = co;
|
||||
}
|
||||
co = nx;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
@@ -461,9 +489,6 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
badcookie = TRUE;
|
||||
break;
|
||||
}
|
||||
co->expires =
|
||||
strtol((*co->maxage=='\"')?&co->maxage[1]:&co->maxage[0],NULL,10)
|
||||
+ (long)now;
|
||||
}
|
||||
else if(Curl_raw_equal("expires", name)) {
|
||||
strstore(&co->expirestr, whatptr);
|
||||
@@ -471,17 +496,6 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
badcookie = TRUE;
|
||||
break;
|
||||
}
|
||||
/* Note that if the date couldn't get parsed for whatever reason,
|
||||
the cookie will be treated as a session cookie */
|
||||
co->expires = curl_getdate(what, &now);
|
||||
|
||||
/* Session cookies have expires set to 0 so if we get that back
|
||||
from the date parser let's add a second to make it a
|
||||
non-session cookie */
|
||||
if(co->expires == 0)
|
||||
co->expires = 1;
|
||||
else if(co->expires < 0)
|
||||
co->expires = 0;
|
||||
}
|
||||
else if(!co->name) {
|
||||
co->name = strdup(name);
|
||||
@@ -516,6 +530,30 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
semiptr=strchr(ptr, '\0');
|
||||
} while(semiptr);
|
||||
|
||||
if(co->maxage) {
|
||||
co->expires =
|
||||
curlx_strtoofft((*co->maxage=='\"')?
|
||||
&co->maxage[1]:&co->maxage[0], NULL, 10);
|
||||
if(CURL_OFF_T_MAX - now < co->expires)
|
||||
/* avoid overflow */
|
||||
co->expires = CURL_OFF_T_MAX;
|
||||
else
|
||||
co->expires += now;
|
||||
}
|
||||
else if(co->expirestr) {
|
||||
/* Note that if the date couldn't get parsed for whatever reason,
|
||||
the cookie will be treated as a session cookie */
|
||||
co->expires = curl_getdate(co->expirestr, NULL);
|
||||
|
||||
/* Session cookies have expires set to 0 so if we get that back
|
||||
from the date parser let's add a second to make it a
|
||||
non-session cookie */
|
||||
if(co->expires == 0)
|
||||
co->expires = 1;
|
||||
else if(co->expires < 0)
|
||||
co->expires = 0;
|
||||
}
|
||||
|
||||
if(!badcookie && !co->domain) {
|
||||
if(domain) {
|
||||
/* no domain was given in the header line, set the default */
|
||||
@@ -700,6 +738,9 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
superceeds an already existing cookie, which it may if the previous have
|
||||
the same domain and path as this */
|
||||
|
||||
/* at first, remove expired cookies */
|
||||
remove_expired(c);
|
||||
|
||||
clist = c->cookies;
|
||||
replace_old = FALSE;
|
||||
while(clist) {
|
||||
@@ -784,7 +825,7 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
if(c->running)
|
||||
/* Only show this when NOT reading the cookies from a file */
|
||||
infof(data, "%s cookie %s=\"%s\" for domain %s, path %s, "
|
||||
"expire %" FORMAT_OFF_T "\n",
|
||||
"expire %" CURL_FORMAT_CURL_OFF_T "\n",
|
||||
replace_old?"Replaced":"Added", co->name, co->value,
|
||||
co->domain, co->path, co->expires);
|
||||
|
||||
@@ -931,6 +972,9 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
|
||||
if(!c || !c->cookies)
|
||||
return NULL; /* no cookie struct or no cookies in the struct */
|
||||
|
||||
/* at first, remove expired cookies */
|
||||
remove_expired(c);
|
||||
|
||||
co = c->cookies;
|
||||
|
||||
while(co) {
|
||||
@@ -1138,7 +1182,7 @@ static char *get_netscape_format(const struct Cookie *co)
|
||||
"%s\t" /* tailmatch */
|
||||
"%s\t" /* path */
|
||||
"%s\t" /* secure */
|
||||
"%" FORMAT_OFF_T "\t" /* expires */
|
||||
"%" CURL_FORMAT_CURL_OFF_T "\t" /* expires */
|
||||
"%s\t" /* name */
|
||||
"%s", /* value */
|
||||
co->httponly?"#HttpOnly_":"",
|
||||
@@ -1173,6 +1217,9 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere)
|
||||
destination file */
|
||||
return 0;
|
||||
|
||||
/* at first, remove expired cookies */
|
||||
remove_expired(c);
|
||||
|
||||
if(strequal("-", dumphere)) {
|
||||
/* use stdout */
|
||||
out = stdout;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -46,7 +46,7 @@
|
||||
#include <curl/mprintf.h>
|
||||
|
||||
#if defined(USE_NSS)
|
||||
#include "nssg.h"
|
||||
#include "vtls/nssg.h"
|
||||
#elif defined(USE_WINDOWS_SSPI)
|
||||
#include "curl_sspi.h"
|
||||
#endif
|
||||
@@ -77,10 +77,6 @@ CURLcode Curl_input_ntlm(struct connectdata *conn,
|
||||
|
||||
ntlm = proxy ? &conn->proxyntlm : &conn->ntlm;
|
||||
|
||||
/* skip initial whitespaces */
|
||||
while(*header && ISSPACE(*header))
|
||||
header++;
|
||||
|
||||
if(checkprefix("NTLM", header)) {
|
||||
header += strlen("NTLM");
|
||||
|
||||
|
@@ -47,7 +47,7 @@
|
||||
# include "curl_sspi.h"
|
||||
#endif
|
||||
|
||||
#include "sslgen.h"
|
||||
#include "vtls/vtls.h"
|
||||
|
||||
#define BUILDING_CURL_NTLM_MSGS_C
|
||||
#include "curl_ntlm_msgs.h"
|
||||
|
@@ -356,7 +356,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn,
|
||||
conn->response_header = NULL;
|
||||
break;
|
||||
case NTLMSTATE_TYPE2:
|
||||
input = aprintf("TT %s", conn->challenge_header);
|
||||
input = aprintf("TT %s\n", conn->challenge_header);
|
||||
if(!input)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
res = ntlm_wb_response(conn, input, ntlm->state);
|
||||
|
312
lib/curl_sasl.c
312
lib/curl_sasl.c
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 2012 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 2012 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -22,6 +22,8 @@
|
||||
* RFC2831 DIGEST-MD5 authentication
|
||||
* RFC4422 Simple Authentication and Security Layer (SASL)
|
||||
* RFC4616 PLAIN authentication
|
||||
* RFC6749 OAuth 2.0 Authorization Framework
|
||||
* Draft LOGIN SASL Mechanism <draft-murchison-sasl-login-00.txt>
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
@@ -32,13 +34,17 @@
|
||||
|
||||
#include "curl_base64.h"
|
||||
#include "curl_md5.h"
|
||||
#include "sslgen.h"
|
||||
#include "vtls/vtls.h"
|
||||
#include "curl_hmac.h"
|
||||
#include "curl_ntlm_msgs.h"
|
||||
#include "curl_sasl.h"
|
||||
#include "warnless.h"
|
||||
#include "curl_memory.h"
|
||||
|
||||
#ifdef USE_NSS
|
||||
#include "vtls/nssg.h" /* for Curl_nss_force_init() */
|
||||
#endif
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
|
||||
@@ -49,7 +55,7 @@
|
||||
/* Retrieves the value for a corresponding key from the challenge string
|
||||
* returns TRUE if the key could be found, FALSE if it does not exists
|
||||
*/
|
||||
static bool sasl_digest_get_key_value(const unsigned char *chlg,
|
||||
static bool sasl_digest_get_key_value(const char *chlg,
|
||||
const char *key,
|
||||
char *value,
|
||||
size_t max_val_len,
|
||||
@@ -58,7 +64,7 @@ static bool sasl_digest_get_key_value(const unsigned char *chlg,
|
||||
char *find_pos;
|
||||
size_t i;
|
||||
|
||||
find_pos = strstr((const char *) chlg, key);
|
||||
find_pos = strstr(chlg, key);
|
||||
if(!find_pos)
|
||||
return FALSE;
|
||||
|
||||
@@ -94,18 +100,18 @@ CURLcode Curl_sasl_create_plain_message(struct SessionHandle *data,
|
||||
const char *passwdp,
|
||||
char **outptr, size_t *outlen)
|
||||
{
|
||||
char plainauth[2 * MAX_CURL_USER_LENGTH + MAX_CURL_PASSWORD_LENGTH];
|
||||
CURLcode result;
|
||||
char *plainauth;
|
||||
size_t ulen;
|
||||
size_t plen;
|
||||
|
||||
ulen = strlen(userp);
|
||||
plen = strlen(passwdp);
|
||||
|
||||
if(2 * ulen + plen + 2 > sizeof(plainauth)) {
|
||||
plainauth = malloc(2 * ulen + plen + 2);
|
||||
if(!plainauth) {
|
||||
*outlen = 0;
|
||||
*outptr = NULL;
|
||||
|
||||
/* Plainauth too small */
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@@ -117,8 +123,10 @@ CURLcode Curl_sasl_create_plain_message(struct SessionHandle *data,
|
||||
memcpy(plainauth + 2 * ulen + 2, passwdp, plen);
|
||||
|
||||
/* Base64 encode the reply */
|
||||
return Curl_base64_encode(data, plainauth, 2 * ulen + plen + 2, outptr,
|
||||
outlen);
|
||||
result = Curl_base64_encode(data, plainauth, 2 * ulen + plen + 2, outptr,
|
||||
outlen);
|
||||
Curl_safefree(plainauth);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -160,7 +168,37 @@ CURLcode Curl_sasl_create_login_message(struct SessionHandle *data,
|
||||
}
|
||||
|
||||
#ifndef CURL_DISABLE_CRYPTO_AUTH
|
||||
/*
|
||||
/*
|
||||
* Curl_sasl_decode_cram_md5_message()
|
||||
*
|
||||
* This is used to decode an already encoded CRAM-MD5 challenge message.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* chlg64 [in] - Pointer to the base64 encoded challenge message.
|
||||
* outptr [in/out] - The address where a pointer to newly allocated memory
|
||||
* holding the result will be stored upon completion.
|
||||
* outlen [out] - The length of the output message.
|
||||
*
|
||||
* Returns CURLE_OK on success.
|
||||
*/
|
||||
CURLcode Curl_sasl_decode_cram_md5_message(const char *chlg64, char **outptr,
|
||||
size_t *outlen)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
size_t chlg64len = strlen(chlg64);
|
||||
|
||||
*outptr = NULL;
|
||||
*outlen = 0;
|
||||
|
||||
/* Decode the challenge if necessary */
|
||||
if(chlg64len && *chlg64 != '=')
|
||||
result = Curl_base64_decode(chlg64, (unsigned char **) outptr, outlen);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Curl_sasl_create_cram_md5_message()
|
||||
*
|
||||
* This is used to generate an already encoded CRAM-MD5 response message ready
|
||||
@@ -169,7 +207,7 @@ CURLcode Curl_sasl_create_login_message(struct SessionHandle *data,
|
||||
* Parameters:
|
||||
*
|
||||
* data [in] - The session handle.
|
||||
* chlg64 [in] - Pointer to the base64 encoded challenge buffer.
|
||||
* chlg [in] - The challenge.
|
||||
* userp [in] - The user name.
|
||||
* passdwp [in] - The user's password.
|
||||
* outptr [in/out] - The address where a pointer to newly allocated memory
|
||||
@@ -179,55 +217,110 @@ CURLcode Curl_sasl_create_login_message(struct SessionHandle *data,
|
||||
* Returns CURLE_OK on success.
|
||||
*/
|
||||
CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data,
|
||||
const char *chlg64,
|
||||
const char *chlg,
|
||||
const char *userp,
|
||||
const char *passwdp,
|
||||
char **outptr, size_t *outlen)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
size_t chlg64len = strlen(chlg64);
|
||||
unsigned char *chlg = (unsigned char *) NULL;
|
||||
size_t chlglen = 0;
|
||||
HMAC_context *ctxt;
|
||||
unsigned char digest[MD5_DIGEST_LEN];
|
||||
char response[MAX_CURL_USER_LENGTH + 2 * MD5_DIGEST_LEN + 1];
|
||||
char *response;
|
||||
|
||||
/* Decode the challenge if necessary */
|
||||
if(chlg64len && *chlg64 != '=') {
|
||||
result = Curl_base64_decode(chlg64, &chlg, &chlglen);
|
||||
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
if(chlg)
|
||||
chlglen = strlen(chlg);
|
||||
|
||||
/* Compute the digest using the password as the key */
|
||||
ctxt = Curl_HMAC_init(Curl_HMAC_MD5,
|
||||
(const unsigned char *) passwdp,
|
||||
curlx_uztoui(strlen(passwdp)));
|
||||
|
||||
if(!ctxt) {
|
||||
Curl_safefree(chlg);
|
||||
if(!ctxt)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* Update the digest with the given challenge */
|
||||
if(chlglen > 0)
|
||||
Curl_HMAC_update(ctxt, chlg, curlx_uztoui(chlglen));
|
||||
|
||||
Curl_safefree(chlg);
|
||||
Curl_HMAC_update(ctxt, (const unsigned char *) chlg,
|
||||
curlx_uztoui(chlglen));
|
||||
|
||||
/* Finalise the digest */
|
||||
Curl_HMAC_final(ctxt, digest);
|
||||
|
||||
/* Prepare the response */
|
||||
snprintf(response, sizeof(response),
|
||||
/* Generate the response */
|
||||
response = aprintf(
|
||||
"%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
userp, digest[0], digest[1], digest[2], digest[3], digest[4],
|
||||
digest[5], digest[6], digest[7], digest[8], digest[9], digest[10],
|
||||
digest[11], digest[12], digest[13], digest[14], digest[15]);
|
||||
if(!response)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
/* Base64 encode the reply */
|
||||
return Curl_base64_encode(data, response, 0, outptr, outlen);
|
||||
/* Base64 encode the response */
|
||||
result = Curl_base64_encode(data, response, 0, outptr, outlen);
|
||||
|
||||
Curl_safefree(response);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Curl_sasl_decode_digest_md5_message()
|
||||
*
|
||||
* This is used to decode an already encoded DIGEST-MD5 challenge message.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* chlg64 [in] - Pointer to the base64 encoded challenge message.
|
||||
* nonce [in/out] - The buffer where the nonce will be stored.
|
||||
* nlen [in] - The length of the nonce buffer.
|
||||
* realm [in/out] - The buffer where the realm will be stored.
|
||||
* rlen [in] - The length of the realm buffer.
|
||||
* alg [in/out] - The buffer where the algorithm will be stored.
|
||||
* alen [in] - The length of the algorithm buffer.
|
||||
*
|
||||
* Returns CURLE_OK on success.
|
||||
*/
|
||||
CURLcode Curl_sasl_decode_digest_md5_message(const char *chlg64,
|
||||
char *nonce, size_t nlen,
|
||||
char *realm, size_t rlen,
|
||||
char *alg, size_t alen)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
unsigned char *chlg = NULL;
|
||||
size_t chlglen = 0;
|
||||
size_t chlg64len = strlen(chlg64);
|
||||
|
||||
if(chlg64len && *chlg64 != '=') {
|
||||
result = Curl_base64_decode(chlg64, &chlg, &chlglen);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Ensure we have a valid challenge message */
|
||||
if(!chlg)
|
||||
return CURLE_BAD_CONTENT_ENCODING;
|
||||
|
||||
/* Retrieve nonce string from the challenge */
|
||||
if(!sasl_digest_get_key_value((char *)chlg, "nonce=\"", nonce, nlen, '\"')) {
|
||||
Curl_safefree(chlg);
|
||||
return CURLE_BAD_CONTENT_ENCODING;
|
||||
}
|
||||
|
||||
/* Retrieve realm string from the challenge */
|
||||
if(!sasl_digest_get_key_value((char *)chlg, "realm=\"", realm, rlen, '\"')) {
|
||||
/* Challenge does not have a realm, set empty string [RFC2831] page 6 */
|
||||
strcpy(realm, "");
|
||||
}
|
||||
|
||||
/* Retrieve algorithm string from the challenge */
|
||||
if(!sasl_digest_get_key_value((char *)chlg, "algorithm=", alg, alen, ',')) {
|
||||
Curl_safefree(chlg);
|
||||
return CURLE_BAD_CONTENT_ENCODING;
|
||||
}
|
||||
|
||||
Curl_safefree(chlg);
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -239,10 +332,11 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data,
|
||||
* Parameters:
|
||||
*
|
||||
* data [in] - The session handle.
|
||||
* chlg64 [in] - Pointer to the base64 encoded challenge buffer.
|
||||
* nonce [in] - The nonce.
|
||||
* realm [in] - The realm.
|
||||
* userp [in] - The user name.
|
||||
* passdwp [in] - The user's password.
|
||||
* service [in] - The service type such as www, smtp or pop
|
||||
* service [in] - The service type such as www, smtp, pop or imap.
|
||||
* outptr [in/out] - The address where a pointer to newly allocated memory
|
||||
* holding the result will be stored upon completion.
|
||||
* outlen [out] - The length of the output message.
|
||||
@@ -250,71 +344,36 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data,
|
||||
* Returns CURLE_OK on success.
|
||||
*/
|
||||
CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
|
||||
const char *chlg64,
|
||||
const char *nonce,
|
||||
const char *realm,
|
||||
const char *userp,
|
||||
const char *passwdp,
|
||||
const char *service,
|
||||
char **outptr, size_t *outlen)
|
||||
{
|
||||
#ifndef DEBUGBUILD
|
||||
static const char table16[] = "0123456789abcdef";
|
||||
|
||||
#endif
|
||||
CURLcode result = CURLE_OK;
|
||||
unsigned char *chlg = (unsigned char *) NULL;
|
||||
size_t chlglen = 0;
|
||||
size_t i;
|
||||
MD5_context *ctxt;
|
||||
char *response = NULL;
|
||||
unsigned char digest[MD5_DIGEST_LEN];
|
||||
char HA1_hex[2 * MD5_DIGEST_LEN + 1];
|
||||
char HA2_hex[2 * MD5_DIGEST_LEN + 1];
|
||||
char resp_hash_hex[2 * MD5_DIGEST_LEN + 1];
|
||||
|
||||
char nonce[64];
|
||||
char realm[128];
|
||||
char alg[64];
|
||||
char nonceCount[] = "00000001";
|
||||
char cnonce[] = "12345678"; /* will be changed */
|
||||
char method[] = "AUTHENTICATE";
|
||||
char qop[] = "auth";
|
||||
char uri[128];
|
||||
char response[512];
|
||||
|
||||
result = Curl_base64_decode(chlg64, &chlg, &chlglen);
|
||||
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
if(!chlg)
|
||||
return CURLE_LOGIN_DENIED;
|
||||
|
||||
/* Retrieve nonce string from the challenge */
|
||||
if(!sasl_digest_get_key_value(chlg, "nonce=\"", nonce,
|
||||
sizeof(nonce), '\"')) {
|
||||
Curl_safefree(chlg);
|
||||
return CURLE_LOGIN_DENIED;
|
||||
}
|
||||
|
||||
/* Retrieve realm string from the challenge */
|
||||
if(!sasl_digest_get_key_value(chlg, "realm=\"", realm,
|
||||
sizeof(realm), '\"')) {
|
||||
/* Challenge does not have a realm, set empty string [RFC2831] page 6 */
|
||||
strcpy(realm, "");
|
||||
}
|
||||
|
||||
/* Retrieve algorithm string from the challenge */
|
||||
if(!sasl_digest_get_key_value(chlg, "algorithm=", alg, sizeof(alg), ',')) {
|
||||
Curl_safefree(chlg);
|
||||
return CURLE_LOGIN_DENIED;
|
||||
}
|
||||
|
||||
Curl_safefree(chlg);
|
||||
|
||||
/* We do not support other algorithms */
|
||||
if(strcmp(alg, "md5-sess") != 0)
|
||||
return CURLE_LOGIN_DENIED;
|
||||
|
||||
#ifndef DEBUGBUILD
|
||||
/* Generate 64 bits of random data */
|
||||
for(i = 0; i < 8; i++)
|
||||
cnonce[i] = table16[Curl_rand(data)%16];
|
||||
#endif
|
||||
|
||||
/* So far so good, now calculate A1 and H(A1) according to RFC 2831 */
|
||||
ctxt = Curl_MD5_init(Curl_DIGEST_MD5);
|
||||
@@ -393,14 +452,20 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
|
||||
for(i = 0; i < MD5_DIGEST_LEN; i++)
|
||||
snprintf(&resp_hash_hex[2 * i], 3, "%02x", digest[i]);
|
||||
|
||||
snprintf(response, sizeof(response),
|
||||
"username=\"%s\",realm=\"%s\",nonce=\"%s\","
|
||||
"cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\",response=%s",
|
||||
userp, realm, nonce,
|
||||
cnonce, nonceCount, uri, resp_hash_hex);
|
||||
/* Generate the response */
|
||||
response = aprintf("username=\"%s\",realm=\"%s\",nonce=\"%s\","
|
||||
"cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\",response=%s",
|
||||
userp, realm, nonce,
|
||||
cnonce, nonceCount, uri, resp_hash_hex);
|
||||
if(!response)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
/* Base64 encode the reply */
|
||||
return Curl_base64_encode(data, response, 0, outptr, outlen);
|
||||
/* Base64 encode the response */
|
||||
result = Curl_base64_encode(data, response, 0, outptr, outlen);
|
||||
|
||||
Curl_safefree(response);
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -430,8 +495,36 @@ CURLcode Curl_sasl_create_ntlm_type1_message(const char *userp,
|
||||
struct ntlmdata *ntlm,
|
||||
char **outptr, size_t *outlen)
|
||||
{
|
||||
return Curl_ntlm_create_type1_message(userp, passwdp, ntlm, outptr,
|
||||
outlen);
|
||||
return Curl_ntlm_create_type1_message(userp, passwdp, ntlm, outptr, outlen);
|
||||
}
|
||||
|
||||
/*
|
||||
* Curl_sasl_decode_ntlm_type2_message()
|
||||
*
|
||||
* This is used to decode an already encoded NTLM type-2 message.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* data [in] - Pointer to session handle.
|
||||
* type2msg [in] - Pointer to the base64 encoded type-2 message.
|
||||
* ntlm [in/out] - The ntlm data struct being used and modified.
|
||||
*
|
||||
* Returns CURLE_OK on success.
|
||||
*/
|
||||
CURLcode Curl_sasl_decode_ntlm_type2_message(struct SessionHandle *data,
|
||||
const char *type2msg,
|
||||
struct ntlmdata *ntlm)
|
||||
{
|
||||
#ifdef USE_NSS
|
||||
CURLcode result;
|
||||
|
||||
/* make sure the crypto backend is initialized */
|
||||
result = Curl_nss_force_init(data);
|
||||
if(result)
|
||||
return result;
|
||||
#endif
|
||||
|
||||
return Curl_ntlm_decode_type2_message(data, type2msg, ntlm);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -443,7 +536,6 @@ CURLcode Curl_sasl_create_ntlm_type1_message(const char *userp,
|
||||
* Parameters:
|
||||
*
|
||||
* data [in] - Pointer to session handle.
|
||||
* header [in] - Pointer to the base64 encoded type-2 message buffer.
|
||||
* userp [in] - The user name in the format User or Domain\User.
|
||||
* passdwp [in] - The user's password.
|
||||
* ntlm [in/out] - The ntlm data struct being used and modified.
|
||||
@@ -454,21 +546,53 @@ CURLcode Curl_sasl_create_ntlm_type1_message(const char *userp,
|
||||
* Returns CURLE_OK on success.
|
||||
*/
|
||||
CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,
|
||||
const char *header,
|
||||
const char *userp,
|
||||
const char *passwdp,
|
||||
struct ntlmdata *ntlm,
|
||||
char **outptr, size_t *outlen)
|
||||
{
|
||||
CURLcode result = Curl_ntlm_decode_type2_message(data, header, ntlm);
|
||||
return Curl_ntlm_create_type3_message(data, userp, passwdp, ntlm, outptr,
|
||||
outlen);
|
||||
}
|
||||
#endif /* USE_NTLM */
|
||||
|
||||
if(!result)
|
||||
result = Curl_ntlm_create_type3_message(data, userp, passwdp, ntlm,
|
||||
outptr, outlen);
|
||||
/*
|
||||
* Curl_sasl_create_xoauth2_message()
|
||||
*
|
||||
* This is used to generate an already encoded OAuth 2.0 message ready for
|
||||
* sending to the recipient.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* data [in] - The session handle.
|
||||
* user [in] - The user name.
|
||||
* bearer [in] - The bearer token.
|
||||
* outptr [in/out] - The address where a pointer to newly allocated memory
|
||||
* holding the result will be stored upon completion.
|
||||
* outlen [out] - The length of the output message.
|
||||
*
|
||||
* Returns CURLE_OK on success.
|
||||
*/
|
||||
CURLcode Curl_sasl_create_xoauth2_message(struct SessionHandle *data,
|
||||
const char *user,
|
||||
const char *bearer,
|
||||
char **outptr, size_t *outlen)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
char *xoauth = NULL;
|
||||
|
||||
/* Generate the message */
|
||||
xoauth = aprintf("user=%s\1auth=Bearer %s\1\1", user, bearer);
|
||||
if(!xoauth)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
/* Base64 encode the reply */
|
||||
result = Curl_base64_encode(data, xoauth, strlen(xoauth), outptr, outlen);
|
||||
|
||||
Curl_safefree(xoauth);
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif /* USE_NTLM */
|
||||
|
||||
/*
|
||||
* Curl_sasl_cleanup()
|
||||
|
@@ -24,18 +24,34 @@
|
||||
|
||||
#include "pingpong.h"
|
||||
|
||||
/* Authentication mechanism flags */
|
||||
#define SASL_MECH_LOGIN (1 << 0)
|
||||
#define SASL_MECH_PLAIN (1 << 1)
|
||||
#define SASL_MECH_CRAM_MD5 (1 << 2)
|
||||
#define SASL_MECH_DIGEST_MD5 (1 << 3)
|
||||
#define SASL_MECH_GSSAPI (1 << 4)
|
||||
#define SASL_MECH_EXTERNAL (1 << 5)
|
||||
#define SASL_MECH_NTLM (1 << 6)
|
||||
|
||||
/* Authentication mechanism values */
|
||||
#define SASL_AUTH_NONE 0
|
||||
#define SASL_AUTH_ANY ~0
|
||||
#define SASL_AUTH_ANY ~0U
|
||||
|
||||
/* Authentication mechanism flags */
|
||||
#define SASL_MECH_LOGIN (1 << 0)
|
||||
#define SASL_MECH_PLAIN (1 << 1)
|
||||
#define SASL_MECH_CRAM_MD5 (1 << 2)
|
||||
#define SASL_MECH_DIGEST_MD5 (1 << 3)
|
||||
#define SASL_MECH_GSSAPI (1 << 4)
|
||||
#define SASL_MECH_EXTERNAL (1 << 5)
|
||||
#define SASL_MECH_NTLM (1 << 6)
|
||||
#define SASL_MECH_XOAUTH2 (1 << 7)
|
||||
|
||||
/* Authentication mechanism strings */
|
||||
#define SASL_MECH_STRING_LOGIN "LOGIN"
|
||||
#define SASL_MECH_STRING_PLAIN "PLAIN"
|
||||
#define SASL_MECH_STRING_CRAM_MD5 "CRAM-MD5"
|
||||
#define SASL_MECH_STRING_DIGEST_MD5 "DIGEST-MD5"
|
||||
#define SASL_MECH_STRING_GSSAPI "GSSAPI"
|
||||
#define SASL_MECH_STRING_EXTERNAL "EXTERNAL"
|
||||
#define SASL_MECH_STRING_NTLM "NTLM"
|
||||
#define SASL_MECH_STRING_XOAUTH2 "XOAUTH2"
|
||||
|
||||
/* This is used to test whether the line starts with the given mechanism */
|
||||
#define sasl_mech_equal(line, wordlen, mech) \
|
||||
(wordlen == (sizeof(mech) - 1) / sizeof(char) && \
|
||||
!memcmp(line, mech, wordlen))
|
||||
|
||||
/* This is used to generate a base64 encoded PLAIN authentication message */
|
||||
CURLcode Curl_sasl_create_plain_message(struct SessionHandle *data,
|
||||
@@ -50,16 +66,27 @@ CURLcode Curl_sasl_create_login_message(struct SessionHandle *data,
|
||||
size_t *outlen);
|
||||
|
||||
#ifndef CURL_DISABLE_CRYPTO_AUTH
|
||||
/* This is used to decode a base64 encoded CRAM-MD5 challange message */
|
||||
CURLcode Curl_sasl_decode_cram_md5_message(const char *chlg64, char **outptr,
|
||||
size_t *outlen);
|
||||
|
||||
/* This is used to generate a base64 encoded CRAM-MD5 response message */
|
||||
CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data,
|
||||
const char *chlg64,
|
||||
const char *chlg,
|
||||
const char *user,
|
||||
const char *passwdp,
|
||||
char **outptr, size_t *outlen);
|
||||
|
||||
/* This is used to decode a base64 encoded DIGEST-MD5 challange message */
|
||||
CURLcode Curl_sasl_decode_digest_md5_message(const char *chlg64,
|
||||
char *nonce, size_t nlen,
|
||||
char *realm, size_t rlen,
|
||||
char *alg, size_t alen);
|
||||
|
||||
/* This is used to generate a base64 encoded DIGEST-MD5 response message */
|
||||
CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
|
||||
const char *chlg64,
|
||||
const char *nonce,
|
||||
const char *realm,
|
||||
const char *user,
|
||||
const char *passwdp,
|
||||
const char *service,
|
||||
@@ -74,10 +101,13 @@ CURLcode Curl_sasl_create_ntlm_type1_message(const char *userp,
|
||||
char **outptr,
|
||||
size_t *outlen);
|
||||
|
||||
/* This is used to decode an incoming NTLM type-2 message and generate a
|
||||
base64 encoded type-3 response */
|
||||
/* This is used to decode a base64 encoded NTLM type-2 message */
|
||||
CURLcode Curl_sasl_decode_ntlm_type2_message(struct SessionHandle *data,
|
||||
const char *type2msg,
|
||||
struct ntlmdata *ntlm);
|
||||
|
||||
/* This is used to generate a base64 encoded NTLM type-3 message */
|
||||
CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,
|
||||
const char *header,
|
||||
const char *userp,
|
||||
const char *passwdp,
|
||||
struct ntlmdata *ntlm,
|
||||
@@ -85,6 +115,13 @@ CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,
|
||||
|
||||
#endif /* USE_NTLM */
|
||||
|
||||
/* This is used to generate a base64 encoded XOAUTH2 authentication message
|
||||
containing the user name and bearer token */
|
||||
CURLcode Curl_sasl_create_xoauth2_message(struct SessionHandle *data,
|
||||
const char *user,
|
||||
const char *bearer,
|
||||
char **outptr, size_t *outlen);
|
||||
|
||||
/* This is used to cleanup any libraries or curl modules used by the sasl
|
||||
functions */
|
||||
void Curl_sasl_cleanup(struct connectdata *conn, unsigned int authused);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#ifndef HEADER_CURL_KRB4_H
|
||||
#define HEADER_CURL_KRB4_H
|
||||
#ifndef HEADER_CURL_SECURITY_H
|
||||
#define HEADER_CURL_SECURITY_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
@@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -34,24 +34,18 @@ struct Curl_sec_client_mech {
|
||||
int (*decode)(void *, void*, int, int, struct connectdata *);
|
||||
};
|
||||
|
||||
|
||||
#define AUTH_OK 0
|
||||
#define AUTH_CONTINUE 1
|
||||
#define AUTH_ERROR 2
|
||||
|
||||
#ifdef HAVE_KRB4
|
||||
extern struct Curl_sec_client_mech Curl_krb4_client_mech;
|
||||
#endif
|
||||
#ifdef HAVE_GSSAPI
|
||||
extern struct Curl_sec_client_mech Curl_krb5_client_mech;
|
||||
#endif
|
||||
|
||||
CURLcode Curl_krb_kauth(struct connectdata *conn);
|
||||
int Curl_sec_read_msg (struct connectdata *conn, char *,
|
||||
enum protection_level);
|
||||
void Curl_sec_end (struct connectdata *);
|
||||
CURLcode Curl_sec_login (struct connectdata *);
|
||||
int Curl_sec_request_prot (struct connectdata *conn, const char *level);
|
||||
|
||||
#endif /* HEADER_CURL_KRB4_H */
|
||||
extern struct Curl_sec_client_mech Curl_krb5_client_mech;
|
||||
#endif
|
||||
|
||||
#endif /* HEADER_CURL_SECURITY_H */
|
@@ -139,29 +139,6 @@
|
||||
Error Compilation_aborted_SIZEOF_CURL_OFF_T_shall_not_be_defined
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set up internal curl_off_t formatting string directives for
|
||||
* exclusive use with libcurl's internal *printf functions.
|
||||
*/
|
||||
|
||||
#ifdef FORMAT_OFF_T
|
||||
# error "FORMAT_OFF_T shall not be defined before this point!"
|
||||
Error Compilation_aborted_FORMAT_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_OFF_TU
|
||||
# error "FORMAT_OFF_TU shall not be defined before this point!"
|
||||
Error Compilation_aborted_FORMAT_OFF_TU_already_defined
|
||||
#endif
|
||||
|
||||
#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)
|
||||
# define FORMAT_OFF_T "lld"
|
||||
# define FORMAT_OFF_TU "llu"
|
||||
#else
|
||||
# define FORMAT_OFF_T "ld"
|
||||
# define FORMAT_OFF_TU "lu"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Disable other protocols when http is the only one desired.
|
||||
*/
|
||||
|
@@ -440,7 +440,7 @@ typedef int sig_atomic_t;
|
||||
* (or equivalent) on this platform to hide platform details to code using it.
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(USE_LWIPSOCK)
|
||||
#define ERRNO ((int)GetLastError())
|
||||
#define SET_ERRNO(x) (SetLastError((DWORD)(x)))
|
||||
#else
|
||||
|
@@ -68,25 +68,52 @@ PSecurityFunctionTable s_pSecFn = NULL;
|
||||
*/
|
||||
CURLcode Curl_sspi_global_init(void)
|
||||
{
|
||||
OSVERSIONINFO osver;
|
||||
bool securityDll = FALSE;
|
||||
INITSECURITYINTERFACE_FN pInitSecurityInterface;
|
||||
|
||||
/* If security interface is not yet initialized try to do this */
|
||||
if(!s_hSecDll) {
|
||||
|
||||
/* Find out Windows version */
|
||||
memset(&osver, 0, sizeof(osver));
|
||||
osver.dwOSVersionInfoSize = sizeof(osver);
|
||||
if(!GetVersionEx(&osver))
|
||||
return CURLE_FAILED_INIT;
|
||||
|
||||
/* Security Service Provider Interface (SSPI) functions are located in
|
||||
* security.dll on WinNT 4.0 and in secur32.dll on Win9x. Win2K and XP
|
||||
* have both these DLLs (security.dll forwards calls to secur32.dll) */
|
||||
DWORD majorVersion = 4;
|
||||
DWORD platformId = VER_PLATFORM_WIN32_NT;
|
||||
|
||||
#if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_WIN2K) || \
|
||||
(_WIN32_WINNT < _WIN32_WINNT_WIN2K)
|
||||
OSVERSIONINFO osver;
|
||||
|
||||
memset(&osver, 0, sizeof(osver));
|
||||
osver.dwOSVersionInfoSize = sizeof(osver);
|
||||
|
||||
/* Find out Windows version */
|
||||
if(!GetVersionEx(&osver))
|
||||
return CURLE_FAILED_INIT;
|
||||
|
||||
/* Verify the major version number == 4 and platform id == WIN_NT */
|
||||
if(osver.dwMajorVersion == majorVersion &&
|
||||
osver.dwPlatformId == platformId)
|
||||
securityDll = TRUE;
|
||||
#else
|
||||
ULONGLONG majorVersionMask;
|
||||
ULONGLONG platformIdMask;
|
||||
OSVERSIONINFOEX osver;
|
||||
|
||||
memset(&osver, 0, sizeof(osver));
|
||||
osver.dwOSVersionInfoSize = sizeof(osver);
|
||||
osver.dwMajorVersion = majorVersion;
|
||||
osver.dwPlatformId = platformId;
|
||||
majorVersionMask = VerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL);
|
||||
platformIdMask = VerSetConditionMask(0, VER_PLATFORMID, VER_EQUAL);
|
||||
|
||||
/* Verify the major version number == 4 and platform id == WIN_NT */
|
||||
if(VerifyVersionInfo(&osver, VER_MAJORVERSION, majorVersionMask) &&
|
||||
VerifyVersionInfo(&osver, VER_PLATFORMID, platformIdMask))
|
||||
securityDll = TRUE;
|
||||
#endif
|
||||
|
||||
/* Load SSPI dll into the address space of the calling process */
|
||||
if(osver.dwPlatformId == VER_PLATFORM_WIN32_NT
|
||||
&& osver.dwMajorVersion == 4)
|
||||
if(securityDll)
|
||||
s_hSecDll = LoadLibrary(TEXT("security.dll"));
|
||||
else
|
||||
s_hSecDll = LoadLibrary(TEXT("secur32.dll"));
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -63,32 +63,38 @@ static void *curl_thread_create_thunk(void *arg)
|
||||
|
||||
curl_thread_t Curl_thread_create(unsigned int (*func) (void*), void *arg)
|
||||
{
|
||||
curl_thread_t t;
|
||||
curl_thread_t t = malloc(sizeof(pthread_t));
|
||||
struct curl_actual_call *ac = malloc(sizeof(struct curl_actual_call));
|
||||
if(!ac)
|
||||
return curl_thread_t_null;
|
||||
if(!(ac && t))
|
||||
goto err;
|
||||
|
||||
ac->func = func;
|
||||
ac->arg = arg;
|
||||
|
||||
if(pthread_create(&t, NULL, curl_thread_create_thunk, ac) != 0) {
|
||||
free(ac);
|
||||
return curl_thread_t_null;
|
||||
}
|
||||
if(pthread_create(t, NULL, curl_thread_create_thunk, ac) != 0)
|
||||
goto err;
|
||||
|
||||
return t;
|
||||
|
||||
err:
|
||||
Curl_safefree(t);
|
||||
Curl_safefree(ac);
|
||||
return curl_thread_t_null;
|
||||
}
|
||||
|
||||
void Curl_thread_destroy(curl_thread_t hnd)
|
||||
{
|
||||
if(hnd != curl_thread_t_null)
|
||||
pthread_detach(hnd);
|
||||
if(hnd != curl_thread_t_null) {
|
||||
pthread_detach(*hnd);
|
||||
free(hnd);
|
||||
}
|
||||
}
|
||||
|
||||
int Curl_thread_join(curl_thread_t *hnd)
|
||||
{
|
||||
int ret = (pthread_join(*hnd, NULL) == 0);
|
||||
int ret = (pthread_join(**hnd, NULL) == 0);
|
||||
|
||||
free(*hnd);
|
||||
*hnd = curl_thread_t_null;
|
||||
|
||||
return ret;
|
||||
|
@@ -26,8 +26,8 @@
|
||||
#if defined(USE_THREADS_POSIX)
|
||||
# define CURL_STDCALL
|
||||
# define curl_mutex_t pthread_mutex_t
|
||||
# define curl_thread_t pthread_t
|
||||
# define curl_thread_t_null (pthread_t)0
|
||||
# define curl_thread_t pthread_t *
|
||||
# define curl_thread_t_null (pthread_t *)0
|
||||
# define Curl_mutex_init(m) pthread_mutex_init(m, NULL)
|
||||
# define Curl_mutex_acquire(m) pthread_mutex_lock(m)
|
||||
# define Curl_mutex_release(m) pthread_mutex_unlock(m)
|
||||
|
496
lib/easy.c
496
lib/easy.c
@@ -50,16 +50,11 @@
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SIGNAL_H) && defined(HAVE_SIGACTION) && defined(USE_OPENSSL)
|
||||
#define SIGPIPE_IGNORE 1
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "strequal.h"
|
||||
#include "urldata.h"
|
||||
#include <curl/curl.h>
|
||||
#include "transfer.h"
|
||||
#include "sslgen.h"
|
||||
#include "vtls/vtls.h"
|
||||
#include "url.h"
|
||||
#include "getinfo.h"
|
||||
#include "hostip.h"
|
||||
@@ -78,6 +73,7 @@
|
||||
#include "warnless.h"
|
||||
#include "conncache.h"
|
||||
#include "multiif.h"
|
||||
#include "sigpipe.h"
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
@@ -85,56 +81,6 @@
|
||||
/* The last #include file should be: */
|
||||
#include "memdebug.h"
|
||||
|
||||
#ifdef SIGPIPE_IGNORE
|
||||
struct sigpipe_ignore {
|
||||
struct sigaction old_pipe_act;
|
||||
bool no_signal;
|
||||
};
|
||||
|
||||
#define SIGPIPE_VARIABLE(x) struct sigpipe_ignore x
|
||||
|
||||
/*
|
||||
* sigpipe_ignore() makes sure we ignore SIGPIPE while running libcurl
|
||||
* internals, and then sigpipe_restore() will restore the situation when we
|
||||
* return from libcurl again.
|
||||
*/
|
||||
static void sigpipe_ignore(struct SessionHandle *data,
|
||||
struct sigpipe_ignore *ig)
|
||||
{
|
||||
/* get a local copy of no_signal because the SessionHandle might not be
|
||||
around when we restore */
|
||||
ig->no_signal = data->set.no_signal;
|
||||
if(!data->set.no_signal) {
|
||||
struct sigaction action;
|
||||
/* first, extract the existing situation */
|
||||
memset(&ig->old_pipe_act, 0, sizeof(struct sigaction));
|
||||
sigaction(SIGPIPE, NULL, &ig->old_pipe_act);
|
||||
action = ig->old_pipe_act;
|
||||
/* ignore this signal */
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &action, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* sigpipe_restore() puts back the outside world's opinion of signal handler
|
||||
* and SIGPIPE handling. It MUST only be called after a corresponding
|
||||
* sigpipe_ignore() was used.
|
||||
*/
|
||||
static void sigpipe_restore(struct sigpipe_ignore *ig)
|
||||
{
|
||||
if(!ig->no_signal)
|
||||
/* restore the outside state */
|
||||
sigaction(SIGPIPE, &ig->old_pipe_act, NULL);
|
||||
}
|
||||
|
||||
#else
|
||||
/* for systems without sigaction */
|
||||
#define sigpipe_ignore(x,y) Curl_nop_stmt
|
||||
#define sigpipe_restore(x) Curl_nop_stmt
|
||||
#define SIGPIPE_VARIABLE(x)
|
||||
#endif
|
||||
|
||||
/* win32_cleanup() is for win32 socket cleanup functionality, the opposite
|
||||
of win32_init() */
|
||||
static void win32_cleanup(void)
|
||||
@@ -453,70 +399,275 @@ CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* curl_easy_perform() is the external interface that performs a blocking
|
||||
* transfer as previously setup.
|
||||
#ifdef CURLDEBUG
|
||||
|
||||
struct socketmonitor {
|
||||
struct socketmonitor *next; /* the next node in the list or NULL */
|
||||
struct pollfd socket; /* socket info of what to monitor */
|
||||
};
|
||||
|
||||
struct events {
|
||||
long ms; /* timeout, run the timeout function when reached */
|
||||
bool msbump; /* set TRUE when timeout is set by callback */
|
||||
int num_sockets; /* number of nodes in the monitor list */
|
||||
struct socketmonitor *list; /* list of sockets to monitor */
|
||||
int running_handles; /* store the returned number */
|
||||
};
|
||||
|
||||
/* events_timer
|
||||
*
|
||||
* CONCEPT: This function creates a multi handle, adds the easy handle to it,
|
||||
* runs curl_multi_perform() until the transfer is done, then detaches the
|
||||
* easy handle, destroys the multi handle and returns the easy handle's return
|
||||
* code.
|
||||
*
|
||||
* REALITY: it can't just create and destroy the multi handle that easily. It
|
||||
* needs to keep it around since if this easy handle is used again by this
|
||||
* function, the same multi handle must be re-used so that the same pools and
|
||||
* caches can be used.
|
||||
* Callback that gets called with a new value when the timeout should be
|
||||
* updated.
|
||||
*/
|
||||
CURLcode curl_easy_perform(CURL *easy)
|
||||
|
||||
static int events_timer(CURLM *multi, /* multi handle */
|
||||
long timeout_ms, /* see above */
|
||||
void *userp) /* private callback pointer */
|
||||
{
|
||||
struct events *ev = userp;
|
||||
(void)multi;
|
||||
if(timeout_ms == -1)
|
||||
/* timeout removed */
|
||||
timeout_ms = 0;
|
||||
else if(timeout_ms == 0)
|
||||
/* timeout is already reached! */
|
||||
timeout_ms = 1; /* trigger asap */
|
||||
|
||||
ev->ms = timeout_ms;
|
||||
ev->msbump = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* poll2cselect
|
||||
*
|
||||
* convert from poll() bit definitions to libcurl's CURL_CSELECT_* ones
|
||||
*/
|
||||
static int poll2cselect(int pollmask)
|
||||
{
|
||||
int omask=0;
|
||||
if(pollmask & POLLIN)
|
||||
omask |= CURL_CSELECT_IN;
|
||||
if(pollmask & POLLOUT)
|
||||
omask |= CURL_CSELECT_OUT;
|
||||
if(pollmask & POLLERR)
|
||||
omask |= CURL_CSELECT_ERR;
|
||||
return omask;
|
||||
}
|
||||
|
||||
|
||||
/* socketcb2poll
|
||||
*
|
||||
* convert from libcurl' CURL_POLL_* bit definitions to poll()'s
|
||||
*/
|
||||
static short socketcb2poll(int pollmask)
|
||||
{
|
||||
short omask=0;
|
||||
if(pollmask & CURL_POLL_IN)
|
||||
omask |= POLLIN;
|
||||
if(pollmask & CURL_POLL_OUT)
|
||||
omask |= POLLOUT;
|
||||
return omask;
|
||||
}
|
||||
|
||||
/* events_socket
|
||||
*
|
||||
* Callback that gets called with information about socket activity to
|
||||
* monitor.
|
||||
*/
|
||||
static int events_socket(CURL *easy, /* easy handle */
|
||||
curl_socket_t s, /* socket */
|
||||
int what, /* see above */
|
||||
void *userp, /* private callback
|
||||
pointer */
|
||||
void *socketp) /* private socket
|
||||
pointer */
|
||||
{
|
||||
struct events *ev = userp;
|
||||
struct socketmonitor *m;
|
||||
struct socketmonitor *prev=NULL;
|
||||
(void)socketp;
|
||||
|
||||
m = ev->list;
|
||||
while(m) {
|
||||
if(m->socket.fd == s) {
|
||||
|
||||
if(what == CURL_POLL_REMOVE) {
|
||||
struct socketmonitor *nxt = m->next;
|
||||
/* remove this node from the list of monitored sockets */
|
||||
if(prev)
|
||||
prev->next = nxt;
|
||||
else
|
||||
ev->list = nxt;
|
||||
free(m);
|
||||
m = nxt;
|
||||
infof(easy, "socket cb: socket %d REMOVED\n", s);
|
||||
}
|
||||
else {
|
||||
/* The socket 's' is already being monitored, update the activity
|
||||
mask. Convert from libcurl bitmask to the poll one. */
|
||||
m->socket.events = socketcb2poll(what);
|
||||
infof(easy, "socket cb: socket %d UPDATED as %s%s\n", s,
|
||||
what&CURL_POLL_IN?"IN":"",
|
||||
what&CURL_POLL_OUT?"OUT":"");
|
||||
}
|
||||
break;
|
||||
}
|
||||
prev = m;
|
||||
m = m->next; /* move to next node */
|
||||
}
|
||||
if(!m) {
|
||||
if(what == CURL_POLL_REMOVE) {
|
||||
/* this happens a bit too often, libcurl fix perhaps? */
|
||||
/* fprintf(stderr,
|
||||
"%s: socket %d asked to be REMOVED but not present!\n",
|
||||
__func__, s); */
|
||||
}
|
||||
else {
|
||||
m = malloc(sizeof(struct socketmonitor));
|
||||
m->next = ev->list;
|
||||
m->socket.fd = s;
|
||||
m->socket.events = socketcb2poll(what);
|
||||
m->socket.revents = 0;
|
||||
ev->list = m;
|
||||
infof(easy, "socket cb: socket %d ADDED as %s%s\n", s,
|
||||
what&CURL_POLL_IN?"IN":"",
|
||||
what&CURL_POLL_OUT?"OUT":"");
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* events_setup()
|
||||
*
|
||||
* Do the multi handle setups that only event-based transfers need.
|
||||
*/
|
||||
static void events_setup(CURLM *multi, struct events *ev)
|
||||
{
|
||||
/* timer callback */
|
||||
curl_multi_setopt(multi, CURLMOPT_TIMERFUNCTION, events_timer);
|
||||
curl_multi_setopt(multi, CURLMOPT_TIMERDATA, ev);
|
||||
|
||||
/* socket callback */
|
||||
curl_multi_setopt(multi, CURLMOPT_SOCKETFUNCTION, events_socket);
|
||||
curl_multi_setopt(multi, CURLMOPT_SOCKETDATA, ev);
|
||||
}
|
||||
|
||||
|
||||
/* wait_or_timeout()
|
||||
*
|
||||
* waits for activity on any of the given sockets, or the timeout to trigger.
|
||||
*/
|
||||
|
||||
static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
|
||||
{
|
||||
CURLM *multi;
|
||||
CURLMcode mcode;
|
||||
CURLcode code = CURLE_OK;
|
||||
CURLMsg *msg;
|
||||
bool done = FALSE;
|
||||
int rc;
|
||||
struct SessionHandle *data = easy;
|
||||
CURLMcode mcode;
|
||||
CURLcode rc = CURLE_OK;
|
||||
|
||||
while(!done) {
|
||||
CURLMsg *msg;
|
||||
struct socketmonitor *m;
|
||||
struct pollfd *f;
|
||||
struct pollfd fds[4];
|
||||
int numfds=0;
|
||||
int pollrc;
|
||||
int i;
|
||||
struct timeval before;
|
||||
struct timeval after;
|
||||
|
||||
/* populate the fds[] array */
|
||||
for(m = ev->list, f=&fds[0]; m; m = m->next) {
|
||||
f->fd = m->socket.fd;
|
||||
f->events = m->socket.events;
|
||||
f->revents = 0;
|
||||
/* fprintf(stderr, "poll() %d check socket %d\n", numfds, f->fd); */
|
||||
f++;
|
||||
numfds++;
|
||||
}
|
||||
|
||||
/* get the time stamp to use to figure out how long poll takes */
|
||||
before = curlx_tvnow();
|
||||
|
||||
/* wait for activity or timeout */
|
||||
pollrc = Curl_poll(fds, numfds, (int)ev->ms);
|
||||
|
||||
after = curlx_tvnow();
|
||||
|
||||
ev->msbump = FALSE; /* reset here */
|
||||
|
||||
if(0 == pollrc) {
|
||||
/* timeout! */
|
||||
ev->ms = 0;
|
||||
/* fprintf(stderr, "call curl_multi_socket_action( TIMEOUT )\n"); */
|
||||
mcode = curl_multi_socket_action(multi, CURL_SOCKET_TIMEOUT, 0,
|
||||
&ev->running_handles);
|
||||
}
|
||||
else if(pollrc > 0) {
|
||||
/* loop over the monitored sockets to see which ones had activity */
|
||||
for(i = 0; i< numfds; i++) {
|
||||
if(fds[i].revents) {
|
||||
/* socket activity, tell libcurl */
|
||||
int act = poll2cselect(fds[i].revents); /* convert */
|
||||
infof(multi->easyp, "call curl_multi_socket_action( socket %d )\n",
|
||||
fds[i].fd);
|
||||
mcode = curl_multi_socket_action(multi, fds[i].fd, act,
|
||||
&ev->running_handles);
|
||||
}
|
||||
}
|
||||
|
||||
if(!ev->msbump)
|
||||
/* If nothing updated the timeout, we decrease it by the spent time.
|
||||
* If it was updated, it has the new timeout time stored already.
|
||||
*/
|
||||
ev->ms += curlx_tvdiff(after, before);
|
||||
|
||||
}
|
||||
if(mcode)
|
||||
return CURLE_URL_MALFORMAT; /* TODO: return a proper error! */
|
||||
|
||||
/* we don't really care about the "msgs_in_queue" value returned in the
|
||||
second argument */
|
||||
msg = curl_multi_info_read(multi, &pollrc);
|
||||
if(msg) {
|
||||
rc = msg->data.result;
|
||||
done = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/* easy_events()
|
||||
*
|
||||
* Runs a transfer in a blocking manner using the events-based API
|
||||
*/
|
||||
static CURLcode easy_events(CURLM *multi)
|
||||
{
|
||||
struct events evs= {2, FALSE, 0, NULL, 0};
|
||||
|
||||
/* if running event-based, do some further multi inits */
|
||||
events_setup(multi, &evs);
|
||||
|
||||
return wait_or_timeout(multi, &evs);
|
||||
}
|
||||
#else /* CURLDEBUG */
|
||||
/* when not built with debug, this function doesn't exist */
|
||||
#define easy_events(x) CURLE_NOT_BUILT_IN
|
||||
#endif
|
||||
|
||||
static CURLcode easy_transfer(CURLM *multi)
|
||||
{
|
||||
bool done = FALSE;
|
||||
CURLMcode mcode = CURLM_OK;
|
||||
CURLcode code = CURLE_OK;
|
||||
struct timeval before;
|
||||
int without_fds = 0; /* count number of consecutive returns from
|
||||
curl_multi_wait() without any filedescriptors */
|
||||
struct timeval before;
|
||||
SIGPIPE_VARIABLE(pipe_st);
|
||||
|
||||
if(!easy)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
||||
if(data->multi) {
|
||||
failf(data, "easy handled already used in multi handle");
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
if(data->multi_easy)
|
||||
multi = data->multi_easy;
|
||||
else {
|
||||
/* this multi handle will only ever have a single easy handled attached
|
||||
to it, so make it use minimal hashes */
|
||||
multi = Curl_multi_handle(1, 3);
|
||||
if(!multi)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
data->multi_easy = multi;
|
||||
}
|
||||
|
||||
/* Copy the MAXCONNECTS option to the multi handle */
|
||||
curl_multi_setopt(multi, CURLMOPT_MAXCONNECTS, data->set.maxconnects);
|
||||
|
||||
mcode = curl_multi_add_handle(multi, easy);
|
||||
if(mcode) {
|
||||
curl_multi_cleanup(multi);
|
||||
if(mcode == CURLM_OUT_OF_MEMORY)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
else
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
sigpipe_ignore(data, &pipe_st);
|
||||
|
||||
/* assign this after curl_multi_add_handle() since that function checks for
|
||||
it and rejects this handle otherwise */
|
||||
data->multi = multi;
|
||||
|
||||
while(!done && !mcode) {
|
||||
int still_running;
|
||||
@@ -556,17 +707,85 @@ CURLcode curl_easy_perform(CURL *easy)
|
||||
|
||||
/* only read 'still_running' if curl_multi_perform() return OK */
|
||||
if((mcode == CURLM_OK) && !still_running) {
|
||||
msg = curl_multi_info_read(multi, &rc);
|
||||
int rc;
|
||||
CURLMsg *msg = curl_multi_info_read(multi, &rc);
|
||||
if(msg) {
|
||||
code = msg->data.result;
|
||||
done = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* easy_perform() is the external interface that performs a blocking
|
||||
* transfer as previously setup.
|
||||
*
|
||||
* CONCEPT: This function creates a multi handle, adds the easy handle to it,
|
||||
* runs curl_multi_perform() until the transfer is done, then detaches the
|
||||
* easy handle, destroys the multi handle and returns the easy handle's return
|
||||
* code.
|
||||
*
|
||||
* REALITY: it can't just create and destroy the multi handle that easily. It
|
||||
* needs to keep it around since if this easy handle is used again by this
|
||||
* function, the same multi handle must be re-used so that the same pools and
|
||||
* caches can be used.
|
||||
*
|
||||
* DEBUG: if 'events' is set TRUE, this function will use a replacement engine
|
||||
* instead of curl_multi_perform() and use curl_multi_socket_action().
|
||||
*/
|
||||
static CURLcode easy_perform(struct SessionHandle *data, bool events)
|
||||
{
|
||||
CURLM *multi;
|
||||
CURLMcode mcode;
|
||||
CURLcode code = CURLE_OK;
|
||||
SIGPIPE_VARIABLE(pipe_st);
|
||||
|
||||
if(!data)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
||||
if(data->multi) {
|
||||
failf(data, "easy handled already used in multi handle");
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
if(data->multi_easy)
|
||||
multi = data->multi_easy;
|
||||
else {
|
||||
/* this multi handle will only ever have a single easy handled attached
|
||||
to it, so make it use minimal hashes */
|
||||
multi = Curl_multi_handle(1, 3);
|
||||
if(!multi)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
data->multi_easy = multi;
|
||||
}
|
||||
|
||||
/* Copy the MAXCONNECTS option to the multi handle */
|
||||
curl_multi_setopt(multi, CURLMOPT_MAXCONNECTS, data->set.maxconnects);
|
||||
|
||||
mcode = curl_multi_add_handle(multi, data);
|
||||
if(mcode) {
|
||||
curl_multi_cleanup(multi);
|
||||
if(mcode == CURLM_OUT_OF_MEMORY)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
else
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
sigpipe_ignore(data, &pipe_st);
|
||||
|
||||
/* assign this after curl_multi_add_handle() since that function checks for
|
||||
it and rejects this handle otherwise */
|
||||
data->multi = multi;
|
||||
|
||||
/* run the transfer */
|
||||
code = events ? easy_events(multi) : easy_transfer(multi);
|
||||
|
||||
/* ignoring the return code isn't nice, but atm we can't really handle
|
||||
a failure here, room for future improvement! */
|
||||
(void)curl_multi_remove_handle(multi, easy);
|
||||
(void)curl_multi_remove_handle(multi, data);
|
||||
|
||||
sigpipe_restore(&pipe_st);
|
||||
|
||||
@@ -574,6 +793,28 @@ CURLcode curl_easy_perform(CURL *easy)
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* curl_easy_perform() is the external interface that performs a blocking
|
||||
* transfer as previously setup.
|
||||
*/
|
||||
CURLcode curl_easy_perform(CURL *easy)
|
||||
{
|
||||
return easy_perform(easy, FALSE);
|
||||
}
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
/*
|
||||
* curl_easy_perform_ev() is the external interface that performs a blocking
|
||||
* transfer using the event-based API internally.
|
||||
*/
|
||||
CURLcode curl_easy_perform_ev(CURL *easy)
|
||||
{
|
||||
return easy_perform(easy, TRUE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* curl_easy_cleanup() is the external interface to cleaning/freeing the given
|
||||
* easy handle.
|
||||
@@ -591,22 +832,6 @@ void curl_easy_cleanup(CURL *curl)
|
||||
sigpipe_restore(&pipe_st);
|
||||
}
|
||||
|
||||
/*
|
||||
* Store a pointed to the multi handle within the easy handle's data struct.
|
||||
*/
|
||||
void Curl_easy_addmulti(struct SessionHandle *data,
|
||||
void *multi)
|
||||
{
|
||||
data->multi = multi;
|
||||
}
|
||||
|
||||
void Curl_easy_initHandleData(struct SessionHandle *data)
|
||||
{
|
||||
memset(&data->req, 0, sizeof(struct SingleRequest));
|
||||
|
||||
data->req.maxdownload = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* curl_easy_getinfo() is an external interface that allows an app to retrieve
|
||||
* information from a performed transfer and similar.
|
||||
@@ -703,8 +928,6 @@ CURL *curl_easy_duphandle(CURL *incurl)
|
||||
|
||||
Curl_convert_setup(outcurl);
|
||||
|
||||
Curl_easy_initHandleData(outcurl);
|
||||
|
||||
outcurl->magic = CURLEASY_MAGIC_NUMBER;
|
||||
|
||||
/* we reach this point and thus we are OK */
|
||||
@@ -738,7 +961,7 @@ void curl_easy_reset(CURL *curl)
|
||||
|
||||
data->state.path = NULL;
|
||||
|
||||
Curl_safefree(data->state.proto.generic);
|
||||
Curl_free_request_state(data);
|
||||
|
||||
/* zero out UserDefined data: */
|
||||
Curl_freeset(data);
|
||||
@@ -748,9 +971,6 @@ void curl_easy_reset(CURL *curl)
|
||||
/* zero out Progress data: */
|
||||
memset(&data->progress, 0, sizeof(struct Progress));
|
||||
|
||||
/* init Handle data */
|
||||
Curl_easy_initHandleData(data);
|
||||
|
||||
data->progress.flags |= PGRS_HIDE;
|
||||
data->state.current_speed = -1; /* init to negative == impossible */
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -25,9 +25,9 @@
|
||||
/*
|
||||
* Prototypes for library-wide functions provided by easy.c
|
||||
*/
|
||||
void Curl_easy_addmulti(struct SessionHandle *data, void *multi);
|
||||
|
||||
void Curl_easy_initHandleData(struct SessionHandle *data);
|
||||
#ifdef CURLDEBUG
|
||||
CURL_EXTERN CURLcode curl_easy_perform_ev(CURL *easy);
|
||||
#endif
|
||||
|
||||
#endif /* HEADER_CURL_EASYIF_H */
|
||||
|
||||
|
66
lib/file.c
66
lib/file.c
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -90,7 +90,7 @@ static CURLcode file_done(struct connectdata *conn,
|
||||
static CURLcode file_connect(struct connectdata *conn, bool *done);
|
||||
static CURLcode file_disconnect(struct connectdata *conn,
|
||||
bool dead_connection);
|
||||
|
||||
static CURLcode file_setup_connection(struct connectdata *conn);
|
||||
|
||||
/*
|
||||
* FILE scheme handler.
|
||||
@@ -98,7 +98,7 @@ static CURLcode file_disconnect(struct connectdata *conn,
|
||||
|
||||
const struct Curl_handler Curl_handler_file = {
|
||||
"FILE", /* scheme */
|
||||
ZERO_NULL, /* setup_connection */
|
||||
file_setup_connection, /* setup_connection */
|
||||
file_do, /* do_it */
|
||||
file_done, /* done */
|
||||
ZERO_NULL, /* do_more */
|
||||
@@ -117,6 +117,16 @@ const struct Curl_handler Curl_handler_file = {
|
||||
};
|
||||
|
||||
|
||||
static CURLcode file_setup_connection(struct connectdata *conn)
|
||||
{
|
||||
/* allocate the FILE specific struct */
|
||||
conn->data->req.protop = calloc(1, sizeof(struct FILEPROTO));
|
||||
if(!conn->data->req.protop)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
Check if this is a range download, and if so, set the internal variables
|
||||
properly. This code is copied from the FTP implementation and might as
|
||||
@@ -142,14 +152,14 @@ static CURLcode file_range(struct connectdata *conn)
|
||||
if((-1 == to) && (from>=0)) {
|
||||
/* X - */
|
||||
data->state.resume_from = from;
|
||||
DEBUGF(infof(data, "RANGE %" FORMAT_OFF_T " to end of file\n",
|
||||
DEBUGF(infof(data, "RANGE %" CURL_FORMAT_CURL_OFF_T " to end of file\n",
|
||||
from));
|
||||
}
|
||||
else if(from < 0) {
|
||||
/* -Y */
|
||||
data->req.maxdownload = -from;
|
||||
data->state.resume_from = from;
|
||||
DEBUGF(infof(data, "RANGE the last %" FORMAT_OFF_T " bytes\n",
|
||||
DEBUGF(infof(data, "RANGE the last %" CURL_FORMAT_CURL_OFF_T " bytes\n",
|
||||
-from));
|
||||
}
|
||||
else {
|
||||
@@ -157,12 +167,13 @@ static CURLcode file_range(struct connectdata *conn)
|
||||
totalsize = to-from;
|
||||
data->req.maxdownload = totalsize+1; /* include last byte */
|
||||
data->state.resume_from = from;
|
||||
DEBUGF(infof(data, "RANGE from %" FORMAT_OFF_T
|
||||
" getting %" FORMAT_OFF_T " bytes\n",
|
||||
DEBUGF(infof(data, "RANGE from %" CURL_FORMAT_CURL_OFF_T
|
||||
" getting %" CURL_FORMAT_CURL_OFF_T " bytes\n",
|
||||
from, data->req.maxdownload));
|
||||
}
|
||||
DEBUGF(infof(data, "range-download from %" FORMAT_OFF_T
|
||||
" to %" FORMAT_OFF_T ", totally %" FORMAT_OFF_T " bytes\n",
|
||||
DEBUGF(infof(data, "range-download from %" CURL_FORMAT_CURL_OFF_T
|
||||
" to %" CURL_FORMAT_CURL_OFF_T ", totally %"
|
||||
CURL_FORMAT_CURL_OFF_T " bytes\n",
|
||||
from, to, data->req.maxdownload));
|
||||
}
|
||||
else
|
||||
@@ -179,39 +190,17 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
char *real_path;
|
||||
struct FILEPROTO *file;
|
||||
struct FILEPROTO *file = data->req.protop;
|
||||
int fd;
|
||||
#ifdef DOS_FILESYSTEM
|
||||
int i;
|
||||
char *actual_path;
|
||||
#endif
|
||||
|
||||
/* If there already is a protocol-specific struct allocated for this
|
||||
sessionhandle, deal with it */
|
||||
Curl_reset_reqproto(conn);
|
||||
|
||||
real_path = curl_easy_unescape(data, data->state.path, 0, NULL);
|
||||
if(!real_path)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
if(!data->state.proto.file) {
|
||||
file = calloc(1, sizeof(struct FILEPROTO));
|
||||
if(!file) {
|
||||
free(real_path);
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
data->state.proto.file = file;
|
||||
}
|
||||
else {
|
||||
/* file is not a protocol that can deal with "persistancy" */
|
||||
file = data->state.proto.file;
|
||||
Curl_safefree(file->freepath);
|
||||
file->path = NULL;
|
||||
if(file->fd != -1)
|
||||
close(file->fd);
|
||||
file->fd = -1;
|
||||
}
|
||||
|
||||
#ifdef DOS_FILESYSTEM
|
||||
/* If the first character is a slash, and there's
|
||||
something that looks like a drive at the beginning of
|
||||
@@ -262,7 +251,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
|
||||
static CURLcode file_done(struct connectdata *conn,
|
||||
CURLcode status, bool premature)
|
||||
{
|
||||
struct FILEPROTO *file = conn->data->state.proto.file;
|
||||
struct FILEPROTO *file = conn->data->req.protop;
|
||||
(void)status; /* not used */
|
||||
(void)premature; /* not used */
|
||||
|
||||
@@ -280,7 +269,7 @@ static CURLcode file_done(struct connectdata *conn,
|
||||
static CURLcode file_disconnect(struct connectdata *conn,
|
||||
bool dead_connection)
|
||||
{
|
||||
struct FILEPROTO *file = conn->data->state.proto.file;
|
||||
struct FILEPROTO *file = conn->data->req.protop;
|
||||
(void)dead_connection; /* not used */
|
||||
|
||||
if(file) {
|
||||
@@ -302,7 +291,7 @@ static CURLcode file_disconnect(struct connectdata *conn,
|
||||
|
||||
static CURLcode file_upload(struct connectdata *conn)
|
||||
{
|
||||
struct FILEPROTO *file = conn->data->state.proto.file;
|
||||
struct FILEPROTO *file = conn->data->req.protop;
|
||||
const char *dir = strchr(file->path, DIRSEP);
|
||||
int fd;
|
||||
int mode;
|
||||
@@ -440,6 +429,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
|
||||
curl_off_t bytecount = 0;
|
||||
int fd;
|
||||
struct timeval now = Curl_tvnow();
|
||||
struct FILEPROTO *file;
|
||||
|
||||
*done = TRUE; /* unconditionally */
|
||||
|
||||
@@ -449,8 +439,10 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
|
||||
if(data->set.upload)
|
||||
return file_upload(conn);
|
||||
|
||||
file = conn->data->req.protop;
|
||||
|
||||
/* get the fd from the connection phase */
|
||||
fd = conn->data->state.proto.file->fd;
|
||||
fd = file->fd;
|
||||
|
||||
/* VMS: This only works reliable for STREAMLF files */
|
||||
if(-1 != fstat(fd, &statbuf)) {
|
||||
@@ -474,7 +466,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
|
||||
if(data->set.opt_no_body && data->set.include_header && fstated) {
|
||||
CURLcode result;
|
||||
snprintf(buf, sizeof(data->state.buffer),
|
||||
"Content-Length: %" FORMAT_OFF_T "\r\n", expected_size);
|
||||
"Content-Length: %" CURL_FORMAT_CURL_OFF_T "\r\n", expected_size);
|
||||
result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user