Compare commits
499 Commits
curl-7_2
...
curl-7_6_1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f585b66af7 | ||
|
|
1b77c18430 | ||
|
|
bd0bd35771 | ||
|
|
368e3526ea | ||
|
|
1bbe407a4d | ||
|
|
513bc44421 | ||
|
|
4cc76d1576 | ||
|
|
6dc5c6ffc7 | ||
|
|
c69c79dd04 | ||
|
|
7fca24b14b | ||
|
|
2fa0d3dd5f | ||
|
|
3a8210c975 | ||
|
|
d69302202d | ||
|
|
227662d2ed | ||
|
|
3cb3d43913 | ||
|
|
c8a546c941 | ||
|
|
62fec1d28d | ||
|
|
ac98c73b04 | ||
|
|
a145654394 | ||
|
|
e8382ba290 | ||
|
|
fcb347d124 | ||
|
|
c331ef02f9 | ||
|
|
3a3f632bf0 | ||
|
|
68d7b6f871 | ||
|
|
c43a9d9068 | ||
|
|
64e80091db | ||
|
|
4f255ffbeb | ||
|
|
80d75b0eaf | ||
|
|
808c4020e6 | ||
|
|
149d6363b3 | ||
|
|
30eab8ca51 | ||
|
|
e49a82b06c | ||
|
|
45fdb48189 | ||
|
|
3fcc9677c4 | ||
|
|
1552bd9c8c | ||
|
|
939c0c5521 | ||
|
|
f0b9aefd2e | ||
|
|
11f3c51e8f | ||
|
|
1a329b98a3 | ||
|
|
29bcba9a90 | ||
|
|
1716dbb68a | ||
|
|
16ecfcf62c | ||
|
|
8bafc3692d | ||
|
|
8a75120568 | ||
|
|
3d96ee7423 | ||
|
|
b3dbdfa306 | ||
|
|
25bad589ba | ||
|
|
0b6cd75004 | ||
|
|
7872cc131a | ||
|
|
210aa4371c | ||
|
|
6f438bc8fb | ||
|
|
65840f1fd1 | ||
|
|
5fc492e5c6 | ||
|
|
abcd1e7d5a | ||
|
|
6429c378a2 | ||
|
|
d830f10417 | ||
|
|
3d6fcbf97b | ||
|
|
609be218c2 | ||
|
|
41084e57ca | ||
|
|
9afab85105 | ||
|
|
7822233964 | ||
|
|
022315089b | ||
|
|
faa5c14aee | ||
|
|
3dd886955b | ||
|
|
c2dbf21459 | ||
|
|
133eb220b9 | ||
|
|
c5796d9e39 | ||
|
|
d80f87554c | ||
|
|
c1d37470f6 | ||
|
|
9c695393b2 | ||
|
|
444024ea14 | ||
|
|
afcd933b4c | ||
|
|
ae0a6835bd | ||
|
|
f2f11be8ba | ||
|
|
e09eda9c7c | ||
|
|
c6877a414e | ||
|
|
a3eb91ffb1 | ||
|
|
12708473a6 | ||
|
|
9012f8cdb3 | ||
|
|
e26ee09586 | ||
|
|
7d09e51162 | ||
|
|
18ebde6960 | ||
|
|
b0c0e8d815 | ||
|
|
16502d7d15 | ||
|
|
ce05deece8 | ||
|
|
b77e2528e7 | ||
|
|
27f8cf6dfc | ||
|
|
f5aa7f64bd | ||
|
|
44254c4945 | ||
|
|
a9ea507c6a | ||
|
|
b137d5ec23 | ||
|
|
4792eee5d0 | ||
|
|
a84625eca6 | ||
|
|
19d3fd1185 | ||
|
|
a9be9bc7f5 | ||
|
|
e8b99d21e5 | ||
|
|
f6c57990ee | ||
|
|
370d7f7527 | ||
|
|
7d38692c4f | ||
|
|
a997d60304 | ||
|
|
ff8fb8cdb0 | ||
|
|
b915ca68f9 | ||
|
|
703fc264f0 | ||
|
|
19d92834ed | ||
|
|
9ade752fa7 | ||
|
|
e8a5f3026f | ||
|
|
2cac4a9c72 | ||
|
|
39e939a507 | ||
|
|
803005892c | ||
|
|
08cfdf909e | ||
|
|
434ce48016 | ||
|
|
10051e6916 | ||
|
|
d54cdf294b | ||
|
|
2e342d5d9b | ||
|
|
fe84071e80 | ||
|
|
044ca343ad | ||
|
|
f59ea9adb3 | ||
|
|
0cec4ba6bf | ||
|
|
14ca732a8f | ||
|
|
53c27c7722 | ||
|
|
c2f5b71dc9 | ||
|
|
6403257886 | ||
|
|
4031104404 | ||
|
|
9f9cac7402 | ||
|
|
06730bc905 | ||
|
|
0d181b596b | ||
|
|
b60f1b1d17 | ||
|
|
4d1706798f | ||
|
|
4ac48317cf | ||
|
|
ed8dbf4ac2 | ||
|
|
97f43e98e7 | ||
|
|
f76ef1fb67 | ||
|
|
3bcdfd5cb4 | ||
|
|
7ce518701b | ||
|
|
10272550b6 | ||
|
|
784f57f9eb | ||
|
|
24dee483e9 | ||
|
|
887e728b7d | ||
|
|
c03e0074c6 | ||
|
|
0d12c56738 | ||
|
|
880208c5b2 | ||
|
|
f4acbed214 | ||
|
|
910fc8522a | ||
|
|
6d90be0757 | ||
|
|
3d8bb1c27a | ||
|
|
1c8121a89e | ||
|
|
0db48a8109 | ||
|
|
5594741acb | ||
|
|
cbaeed7232 | ||
|
|
6d7587d327 | ||
|
|
9ee94b3d84 | ||
|
|
2c100371d2 | ||
|
|
184ad46a27 | ||
|
|
74d35416a2 | ||
|
|
2fff6a4b0e | ||
|
|
bf43b49a20 | ||
|
|
6ad9bd8022 | ||
|
|
ec5ac82cfe | ||
|
|
76ac228e44 | ||
|
|
b0828267bc | ||
|
|
9c10cb4684 | ||
|
|
3d8c4ce526 | ||
|
|
ec420c62d9 | ||
|
|
5d44f00201 | ||
|
|
cddeb939ed | ||
|
|
45cf0cf3ec | ||
|
|
ff7729e2bc | ||
|
|
7dcda6a370 | ||
|
|
dde277d86a | ||
|
|
a5146c7297 | ||
|
|
69abefc936 | ||
|
|
dad2317e6e | ||
|
|
22d8aa37e0 | ||
|
|
160d2a30db | ||
|
|
cb1842cb52 | ||
|
|
6ced1ba615 | ||
|
|
54e46e199c | ||
|
|
ca8196a4dc | ||
|
|
52707f9590 | ||
|
|
be2369ed14 | ||
|
|
76af68e8ab | ||
|
|
421fccb12a | ||
|
|
173f12db68 | ||
|
|
983e3ae8c5 | ||
|
|
62213e529c | ||
|
|
ea3b6914cc | ||
|
|
c8cd35e640 | ||
|
|
706f5e1a5d | ||
|
|
db7d772d3e | ||
|
|
64761bc786 | ||
|
|
9980568f42 | ||
|
|
05a1910968 | ||
|
|
a5217dd10e | ||
|
|
0d7ba0ec61 | ||
|
|
b2f0ca8a43 | ||
|
|
a00bb13766 | ||
|
|
7c7923761d | ||
|
|
e9b69bc757 | ||
|
|
2aaae10fe8 | ||
|
|
6bd75ab840 | ||
|
|
b8f7d94ef1 | ||
|
|
d4cd079b9c | ||
|
|
013770a7e2 | ||
|
|
f4c26ddb6a | ||
|
|
9f77434c3a | ||
|
|
989ff585b1 | ||
|
|
f589c1c024 | ||
|
|
e86f3b9144 | ||
|
|
79a84d20f2 | ||
|
|
20801181b2 | ||
|
|
3723c52057 | ||
|
|
0e78911ce3 | ||
|
|
b7a5fb1794 | ||
|
|
6f4f3c79b6 | ||
|
|
593df2f18a | ||
|
|
fde82cd4e0 | ||
|
|
801626de19 | ||
|
|
92f53b0e4d | ||
|
|
d419d975b3 | ||
|
|
b5739b3a97 | ||
|
|
86d4488cc7 | ||
|
|
ce1cb29d20 | ||
|
|
526eca191a | ||
|
|
79beebdabe | ||
|
|
39abde5db5 | ||
|
|
fb962a281e | ||
|
|
2f6e61d5fb | ||
|
|
ea9ede15e3 | ||
|
|
4768c9cdbb | ||
|
|
d6b1162a63 | ||
|
|
486591f9d1 | ||
|
|
458ec524e1 | ||
|
|
a40b55d5c8 | ||
|
|
5aa5ecb29b | ||
|
|
20dd0670ba | ||
|
|
43e1e1cd1a | ||
|
|
55b7c1c364 | ||
|
|
190ecd652a | ||
|
|
2677c27b08 | ||
|
|
c938166520 | ||
|
|
50d564b4d4 | ||
|
|
29d21bea18 | ||
|
|
b734bc37eb | ||
|
|
2c123051bb | ||
|
|
b82fa8d959 | ||
|
|
c84aa663a1 | ||
|
|
7db43ae0ed | ||
|
|
ae58d84429 | ||
|
|
eb993c28ca | ||
|
|
2830504f4f | ||
|
|
2a5e68ea89 | ||
|
|
c06f726614 | ||
|
|
52909688cf | ||
|
|
c1474b9507 | ||
|
|
708e9cf294 | ||
|
|
70778f2cb6 | ||
|
|
bdb411c6ca | ||
|
|
56ac132401 | ||
|
|
44137c7932 | ||
|
|
19a754dc8c | ||
|
|
641351ee16 | ||
|
|
7b49d40bb0 | ||
|
|
3e5ba33e2d | ||
|
|
9a9013ac25 | ||
|
|
59693250c4 | ||
|
|
336b0b7d82 | ||
|
|
f22c690b1f | ||
|
|
05ec503eac | ||
|
|
4b8fd86f04 | ||
|
|
16cf5ee1c9 | ||
|
|
a7937ed49c | ||
|
|
4c0bae3649 | ||
|
|
4a7d62c8c3 | ||
|
|
d4a4b564ec | ||
|
|
5d4bceda20 | ||
|
|
42280e95bf | ||
|
|
b2ad1f68cc | ||
|
|
13e9a4d8f4 | ||
|
|
9c0d9784f6 | ||
|
|
91c879461e | ||
|
|
bda9fde4d8 | ||
|
|
0def60bf9d | ||
|
|
1665435040 | ||
|
|
aa86f697f6 | ||
|
|
e48747d95d | ||
|
|
0a72154cd2 | ||
|
|
3e6a354c4c | ||
|
|
f0b8aac325 | ||
|
|
ec3054e1f2 | ||
|
|
7c6414ebbd | ||
|
|
85705e105c | ||
|
|
874f6024e6 | ||
|
|
a03cdd7e83 | ||
|
|
f9155568c6 | ||
|
|
c0936824d4 | ||
|
|
57ddd7e928 | ||
|
|
868488b518 | ||
|
|
7f77a061dd | ||
|
|
2d16e1a777 | ||
|
|
2297bc4791 | ||
|
|
34a2d446e0 | ||
|
|
fdd91b2209 | ||
|
|
7ea4551b1b | ||
|
|
77bbbd868b | ||
|
|
3b91db110b | ||
|
|
ab9dfac24e | ||
|
|
5a07305dc8 | ||
|
|
56c0c67dff | ||
|
|
885184aa14 | ||
|
|
e0e67812de | ||
|
|
eb72e001a7 | ||
|
|
cdfa5f5d7b | ||
|
|
0c19d2518c | ||
|
|
e64b8a8f86 | ||
|
|
e2641a394d | ||
|
|
bd3dca96f6 | ||
|
|
3cd77a19ca | ||
|
|
e02affb5d0 | ||
|
|
24f9ae1f72 | ||
|
|
2bd70e1351 | ||
|
|
336124c3dc | ||
|
|
8e735d1eea | ||
|
|
aa9a60287d | ||
|
|
6736c1610c | ||
|
|
1cc8af2779 | ||
|
|
bfb118e42a | ||
|
|
3f0aa0648f | ||
|
|
a58e336d85 | ||
|
|
27435f0648 | ||
|
|
69e82e7383 | ||
|
|
b2daec2477 | ||
|
|
c605f81a09 | ||
|
|
d5b06bcf3b | ||
|
|
d5e6404b8b | ||
|
|
bc84fe1cf3 | ||
|
|
460aa295e0 | ||
|
|
143ff23c4f | ||
|
|
6195412005 | ||
|
|
4e120f34a5 | ||
|
|
14bcdcfcdd | ||
|
|
3c0194bb72 | ||
|
|
172f0ba12d | ||
|
|
4035543763 | ||
|
|
920579ba11 | ||
|
|
1ff573c649 | ||
|
|
7b5c551835 | ||
|
|
a5b2eb7962 | ||
|
|
78423c5899 | ||
|
|
2bcb8abf40 | ||
|
|
b32bf42763 | ||
|
|
61fb8fea10 | ||
|
|
c0a44b4b9b | ||
|
|
ef8741d23c | ||
|
|
56548f9a13 | ||
|
|
36000e5287 | ||
|
|
8cb15395d0 | ||
|
|
4ccda6d692 | ||
|
|
7390c3a8af | ||
|
|
e5e259030f | ||
|
|
9f4f16b55d | ||
|
|
e05922c428 | ||
|
|
71fb701168 | ||
|
|
b6bb734215 | ||
|
|
e7736324b4 | ||
|
|
e0e01e5a59 | ||
|
|
852b664e45 | ||
|
|
e6cdb68a88 | ||
|
|
349811f3da | ||
|
|
823785c53e | ||
|
|
1c0fd24a36 | ||
|
|
5c0b2f29b9 | ||
|
|
e446edc288 | ||
|
|
b5d152caf7 | ||
|
|
6f7dcf3f22 | ||
|
|
0cff279063 | ||
|
|
09ba856e39 | ||
|
|
1df033a1c5 | ||
|
|
3264ce04ee | ||
|
|
3b0d49e1c9 | ||
|
|
f6daff475f | ||
|
|
9d0d8280e9 | ||
|
|
cdfb83e0e3 | ||
|
|
02037971ed | ||
|
|
a5b01cf4e8 | ||
|
|
68c231e1b0 | ||
|
|
949eaf8ad4 | ||
|
|
950110ecb1 | ||
|
|
5f8e93d3b0 | ||
|
|
e4a7e18a0c | ||
|
|
8f5ffd94a2 | ||
|
|
c44b10de41 | ||
|
|
135cc036aa | ||
|
|
f6163b375f | ||
|
|
b2d73c50d3 | ||
|
|
834b7de33c | ||
|
|
debdd93e1b | ||
|
|
4e8ddedc8f | ||
|
|
751d503f54 | ||
|
|
b2e47dfde4 | ||
|
|
0af8201cc2 | ||
|
|
7717212912 | ||
|
|
ccb2b5d22c | ||
|
|
85174ed358 | ||
|
|
111d1d09d3 | ||
|
|
4f5a4c9bd5 | ||
|
|
8c62e337b0 | ||
|
|
51bcdb472b | ||
|
|
5ee185f420 | ||
|
|
fb739ac130 | ||
|
|
cdd91bed46 | ||
|
|
9defb83930 | ||
|
|
0f8facb49b | ||
|
|
d49d05bce6 | ||
|
|
1e2e6a4e33 | ||
|
|
5b39a48e22 | ||
|
|
2918836cef | ||
|
|
b900318d8d | ||
|
|
c58dc8f82f | ||
|
|
0ddacf929a | ||
|
|
a513e97464 | ||
|
|
03a56b3e56 | ||
|
|
18f67852be | ||
|
|
693aab0e95 | ||
|
|
ccd0f07c41 | ||
|
|
5865860ad6 | ||
|
|
bf56377865 | ||
|
|
e012d32e66 | ||
|
|
763797ab3c | ||
|
|
2cdd150723 | ||
|
|
d46b006f22 | ||
|
|
033263e696 | ||
|
|
eee5c71aff | ||
|
|
f1b8566ea2 | ||
|
|
d3f9b2a490 | ||
|
|
398d21696f | ||
|
|
99fbcac6b9 | ||
|
|
c23e387928 | ||
|
|
ef77d484f0 | ||
|
|
df7b9e7af6 | ||
|
|
f612f194be | ||
|
|
dfec172157 | ||
|
|
888182c16d | ||
|
|
d5ad450db6 | ||
|
|
b0274a553b | ||
|
|
e372a440c0 | ||
|
|
91bda5650c | ||
|
|
13962adcb5 | ||
|
|
221f1c2ca2 | ||
|
|
0e0b72714c | ||
|
|
3396d97399 | ||
|
|
c4fc231934 | ||
|
|
bac96e9f49 | ||
|
|
00505c9247 | ||
|
|
60ee571bd6 | ||
|
|
bdfe654aee | ||
|
|
32e013eb87 | ||
|
|
d03db1cd11 | ||
|
|
1dac7f4d05 | ||
|
|
ad01481b28 | ||
|
|
28ad7dc4a1 | ||
|
|
e40f0be7e3 | ||
|
|
f353258ff6 | ||
|
|
1754d6166c | ||
|
|
481871768b | ||
|
|
43d75c5f3b | ||
|
|
35e901a21e | ||
|
|
c62cc76fdb | ||
|
|
7bac857fdd | ||
|
|
ce406a732f | ||
|
|
a82eb0fc6d | ||
|
|
6f6dfa97a8 | ||
|
|
aa8a2fbde3 | ||
|
|
3471e2c59d | ||
|
|
37249c3a41 | ||
|
|
def69c3087 | ||
|
|
35aa363587 | ||
|
|
7eafb0f325 | ||
|
|
c9c7fcf411 | ||
|
|
4dba5750d4 | ||
|
|
398e3f423f | ||
|
|
281d4cedc7 | ||
|
|
c23f35ce2a | ||
|
|
0f4444e90b | ||
|
|
a98648bd8c | ||
|
|
4ee420f23e | ||
|
|
31dc1f4247 | ||
|
|
ec109b3540 | ||
|
|
5019fe75a7 | ||
|
|
00eaf20298 | ||
|
|
96009453e8 | ||
|
|
0da7057591 | ||
|
|
23f22bd53e | ||
|
|
86ff2c46b7 | ||
|
|
be8b2a1e30 | ||
|
|
0a2f677374 | ||
|
|
74be53a577 | ||
|
|
5e7cd528b0 | ||
|
|
60eab89f10 | ||
|
|
1cedcce3e9 |
22
CVS-INFO
Normal file
22
CVS-INFO
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
This file is only present in the CVS - never in release archives.
|
||||||
|
|
||||||
|
This contains information about other files and things that the CVS repository
|
||||||
|
keeps in its inner sanctum.
|
||||||
|
|
||||||
|
CHANGES.0 contains ancient changes.
|
||||||
|
|
||||||
|
memanalyze.pl is for analyzing the output generated by curl if -DMALLOCDEBUG
|
||||||
|
is used when compiling
|
||||||
|
|
||||||
|
Makefile.dist is included as the root Makefile in distribution archives
|
||||||
|
|
||||||
|
perl/ is a subdirectory with various perl scripts
|
||||||
|
|
||||||
|
To build after having extracted everything from CVS, do this:
|
||||||
|
|
||||||
|
automake
|
||||||
|
aclocal
|
||||||
|
autoheader
|
||||||
|
autoconf
|
||||||
|
./configure
|
||||||
|
make
|
||||||
61
FILES
61
FILES
@@ -1,61 +0,0 @@
|
|||||||
CHANGES
|
|
||||||
FILES
|
|
||||||
LEGAL
|
|
||||||
MPL-1.0.txt
|
|
||||||
README
|
|
||||||
*spec
|
|
||||||
*spec.in
|
|
||||||
docs/BUGS
|
|
||||||
docs/CONTRIBUTE
|
|
||||||
docs/FAQ
|
|
||||||
docs/FEATURES
|
|
||||||
docs/INSTALL
|
|
||||||
docs/INTERNALS
|
|
||||||
docs/README.curl
|
|
||||||
docs/README.win32
|
|
||||||
docs/README.libcurl
|
|
||||||
docs/RESOURCES
|
|
||||||
docs/TODO
|
|
||||||
docs/curl.1
|
|
||||||
docs/Makefile.in
|
|
||||||
docs/Makefile.am
|
|
||||||
docs/TheArtOfHttpScripting
|
|
||||||
docs/*.3
|
|
||||||
maketgz
|
|
||||||
Makefile.in
|
|
||||||
Makefile.am
|
|
||||||
acconfig.h
|
|
||||||
acinclude.m4
|
|
||||||
aclocal.m4
|
|
||||||
config.guess
|
|
||||||
config.h.in
|
|
||||||
config-win32.h
|
|
||||||
config.sub
|
|
||||||
configure
|
|
||||||
configure.in
|
|
||||||
install-sh
|
|
||||||
missing
|
|
||||||
mkinstalldirs
|
|
||||||
reconf
|
|
||||||
stamp-h.in
|
|
||||||
ltconfig
|
|
||||||
ltmain.sh
|
|
||||||
src/*.[ch]
|
|
||||||
src/*in
|
|
||||||
src/*am
|
|
||||||
src/mkhelp.pl
|
|
||||||
src/Makefile.vc6
|
|
||||||
src/*m32
|
|
||||||
lib/getdate.y
|
|
||||||
lib/*.[ch]
|
|
||||||
lib/*in
|
|
||||||
lib/*am
|
|
||||||
lib/Makefile.vc6
|
|
||||||
lib/*m32
|
|
||||||
include/README
|
|
||||||
include/Makefile.in
|
|
||||||
include/Makefile.am
|
|
||||||
include/curl/*.h
|
|
||||||
include/curl/Makefile.in
|
|
||||||
include/curl/Makefile.am
|
|
||||||
|
|
||||||
34
LEGAL
34
LEGAL
@@ -1,21 +1,25 @@
|
|||||||
Part of this software is distributed under the Mozilla Public License
|
Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
version 1.0, which is part of this distribution (MPL-1.0.txt) and
|
|
||||||
available on-line at http://www.mozilla.org/MPL/
|
|
||||||
|
|
||||||
The terminology used here is described in the Mozilla Public License.
|
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||||
|
document, but changing it is not allowed.
|
||||||
|
|
||||||
In accordance with section "4. Inability to Comply Due to Statute or
|
In order to be useful for every potential user, the curl and libcurl are
|
||||||
Regulation" the following exemptions apply to this software:
|
dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
|
|
||||||
* The Initial Developer has the right, regardless of the citizenship
|
You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
of any involved party, to choose the location for settling disputes
|
copies of the Software, and permit persons to whom the Software is furnished
|
||||||
as refered to under section "11. Miscellaneous" of the Mozilla Public
|
to do so, under the terms of the MPL or the MIT/X-derivate licenses. You may
|
||||||
License.
|
pick one of these licenses. The files MITX.txt and MPL-1.1.txt contain the
|
||||||
|
license texts.
|
||||||
|
|
||||||
Initial Developers of this software are:
|
As a courtesy to the open-source and free software community, we ask you to
|
||||||
|
dual-license any modifications that you make as well, under the terms of this
|
||||||
Daniel Stenberg <daniel@haxx.se>
|
document.
|
||||||
|
|
||||||
Curl is Copyright (C) 1996-2000 Daniel Stenberg
|
|
||||||
|
|
||||||
|
Please remember to always keep the licensing information included in
|
||||||
|
individual source files up-to-date, so as to avoid misleading anyone as to
|
||||||
|
the status of these files.
|
||||||
|
|
||||||
|
I will use a submission policy according to which I will only enter
|
||||||
|
contributions into the CVS tree if the contributor agrees to both licenses
|
||||||
|
and this dual-license approach.
|
||||||
|
|||||||
28
MITX.txt
Normal file
28
MITX.txt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
COPYRIGHT AND PERMISSION NOTICE
|
||||||
|
|
||||||
|
Copyright (c) 2000, Daniel Stenberg, <daniel@haxx.se>.
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, and/or sell copies of the
|
||||||
|
Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
provided that the above copyright notice(s) and this permission notice appear
|
||||||
|
in all copies of the Software and that both the above copyright notice(s) and
|
||||||
|
this permission notice appear in supporting documentation.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
|
||||||
|
NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
|
||||||
|
LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
|
||||||
|
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
|
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
Except as contained in this notice, the name of a copyright holder shall not
|
||||||
|
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||||
|
in this Software without prior written authorization of the copyright holder.
|
||||||
|
|
||||||
360
MPL-1.0.txt
360
MPL-1.0.txt
@@ -1,360 +0,0 @@
|
|||||||
MOZILLA PUBLIC LICENSE
|
|
||||||
Version 1.0
|
|
||||||
|
|
||||||
----------------
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
1.1. ``Contributor'' means each entity that creates or contributes to
|
|
||||||
the creation of Modifications.
|
|
||||||
|
|
||||||
1.2. ``Contributor Version'' means the combination of the Original
|
|
||||||
Code, prior Modifications used by a Contributor, and the Modifications
|
|
||||||
made by that particular Contributor.
|
|
||||||
|
|
||||||
1.3. ``Covered Code'' means the Original Code or Modifications or the
|
|
||||||
combination of the Original Code and Modifications, in each case
|
|
||||||
including portions thereof.
|
|
||||||
|
|
||||||
1.4. ``Electronic Distribution Mechanism'' means a mechanism generally
|
|
||||||
accepted in the software development community for the electronic
|
|
||||||
transfer of data.
|
|
||||||
|
|
||||||
1.5. ``Executable'' means Covered Code in any form other than Source
|
|
||||||
Code.
|
|
||||||
|
|
||||||
1.6. ``Initial Developer'' means the individual or entity identified as
|
|
||||||
the Initial Developer in the Source Code notice required by Exhibit A.
|
|
||||||
|
|
||||||
1.7. ``Larger Work'' means a work which combines Covered Code or
|
|
||||||
portions thereof with code not governed by the terms of this License.
|
|
||||||
|
|
||||||
1.8. ``License'' means this document.
|
|
||||||
|
|
||||||
1.9. ``Modifications'' means any addition to or deletion from the
|
|
||||||
substance or structure of either the Original Code or any previous
|
|
||||||
Modifications. When Covered Code is released as a series of files, a
|
|
||||||
Modification is:
|
|
||||||
|
|
||||||
A. Any addition to or deletion from the contents of a file
|
|
||||||
containing Original Code or previous Modifications.
|
|
||||||
|
|
||||||
B. Any new file that contains any part of the Original Code or
|
|
||||||
previous Modifications.
|
|
||||||
|
|
||||||
1.10. ``Original Code'' means Source Code of computer software code
|
|
||||||
which is described in the Source Code notice required by Exhibit A as
|
|
||||||
Original Code, and which, at the time of its release under this License
|
|
||||||
is not already Covered Code governed by this License.
|
|
||||||
|
|
||||||
1.11. ``Source Code'' means the preferred form of the Covered Code for
|
|
||||||
making modifications to it, including all modules it contains, plus any
|
|
||||||
associated interface definition files, scripts used to control
|
|
||||||
compilation and installation of an Executable, or a list of source code
|
|
||||||
differential comparisons against either the Original Code or another
|
|
||||||
well known, available Covered Code of the Contributor's choice. The
|
|
||||||
Source Code can be in a compressed or archival form, provided the
|
|
||||||
appropriate decompression or de-archiving software is widely available
|
|
||||||
for no charge.
|
|
||||||
|
|
||||||
1.12. ``You'' means an individual or a legal entity exercising rights
|
|
||||||
under, and complying with all of the terms of, this License or a future
|
|
||||||
version of this License issued under Section 6.1. For legal entities,
|
|
||||||
``You'' includes any entity which controls, is controlled by, or is
|
|
||||||
under common control with You. For purposes of this definition,
|
|
||||||
``control'' means (a) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (b) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares or beneficial ownership of such entity.
|
|
||||||
|
|
||||||
2. Source Code License.
|
|
||||||
|
|
||||||
2.1. The Initial Developer Grant.
|
|
||||||
The Initial Developer hereby grants You a world-wide, royalty-free,
|
|
||||||
non-exclusive license, subject to third party intellectual property
|
|
||||||
claims:
|
|
||||||
|
|
||||||
(a) to use, reproduce, modify, display, perform, sublicense and
|
|
||||||
distribute the Original Code (or portions thereof) with or without
|
|
||||||
Modifications, or as part of a Larger Work; and
|
|
||||||
|
|
||||||
(b) under patents now or hereafter owned or controlled by Initial
|
|
||||||
Developer, to make, have made, use and sell (``Utilize'') the
|
|
||||||
Original Code (or portions thereof), but solely to the extent that
|
|
||||||
any such patent is reasonably necessary to enable You to Utilize
|
|
||||||
the Original Code (or portions thereof) and not to any greater
|
|
||||||
extent that may be necessary to Utilize further Modifications or
|
|
||||||
combinations.
|
|
||||||
|
|
||||||
2.2. Contributor Grant.
|
|
||||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
|
||||||
non-exclusive license, subject to third party intellectual property
|
|
||||||
claims:
|
|
||||||
|
|
||||||
(a) to use, reproduce, modify, display, perform, sublicense and
|
|
||||||
distribute the Modifications created by such Contributor (or
|
|
||||||
portions thereof) either on an unmodified basis, with other
|
|
||||||
Modifications, as Covered Code or as part of a Larger Work; and
|
|
||||||
|
|
||||||
(b) under patents now or hereafter owned or controlled by
|
|
||||||
Contributor, to Utilize the Contributor Version (or portions
|
|
||||||
thereof), but solely to the extent that any such patent is
|
|
||||||
reasonably necessary to enable You to Utilize the Contributor
|
|
||||||
Version (or portions thereof), and not to any greater extent that
|
|
||||||
may be necessary to Utilize further Modifications or combinations.
|
|
||||||
|
|
||||||
3. Distribution Obligations.
|
|
||||||
|
|
||||||
3.1. Application of License.
|
|
||||||
The Modifications which You create or to which You contribute are
|
|
||||||
governed by the terms of this License, including without limitation
|
|
||||||
Section 2.2. The Source Code version of Covered Code may be distributed
|
|
||||||
only under the terms of this License or a future version of this
|
|
||||||
License released under Section 6.1, and You must include a copy of this
|
|
||||||
License with every copy of the Source Code You distribute. You may not
|
|
||||||
offer or impose any terms on any Source Code version that alters or
|
|
||||||
restricts the applicable version of this License or the recipients'
|
|
||||||
rights hereunder. However, You may include an additional document
|
|
||||||
offering the additional rights described in Section 3.5.
|
|
||||||
|
|
||||||
3.2. Availability of Source Code.
|
|
||||||
Any Modification which You create or to which You contribute must be
|
|
||||||
made available in Source Code form under the terms of this License
|
|
||||||
either on the same media as an Executable version or via an accepted
|
|
||||||
Electronic Distribution Mechanism to anyone to whom you made an
|
|
||||||
Executable version available; and if made available via Electronic
|
|
||||||
Distribution Mechanism, must remain available for at least twelve (12)
|
|
||||||
months after the date it initially became available, or at least six
|
|
||||||
(6) months after a subsequent version of that particular Modification
|
|
||||||
has been made available to such recipients. You are responsible for
|
|
||||||
ensuring that the Source Code version remains available even if the
|
|
||||||
Electronic Distribution Mechanism is maintained by a third party.
|
|
||||||
|
|
||||||
3.3. Description of Modifications.
|
|
||||||
You must cause all Covered Code to which you contribute to contain a
|
|
||||||
file documenting the changes You made to create that Covered Code and
|
|
||||||
the date of any change. You must include a prominent statement that the
|
|
||||||
Modification is derived, directly or indirectly, from Original Code
|
|
||||||
provided by the Initial Developer and including the name of the Initial
|
|
||||||
Developer in (a) the Source Code, and (b) in any notice in an
|
|
||||||
Executable version or related documentation in which You describe the
|
|
||||||
origin or ownership of the Covered Code.
|
|
||||||
|
|
||||||
3.4. Intellectual Property Matters
|
|
||||||
|
|
||||||
(a) Third Party Claims.
|
|
||||||
If You have knowledge that a party claims an intellectual property
|
|
||||||
right in particular functionality or code (or its utilization
|
|
||||||
under this License), you must include a text file with the source
|
|
||||||
code distribution titled ``LEGAL'' which describes the claim and
|
|
||||||
the party making the claim in sufficient detail that a recipient
|
|
||||||
will know whom to contact. If you obtain such knowledge after You
|
|
||||||
make Your Modification available as described in Section 3.2, You
|
|
||||||
shall promptly modify the LEGAL file in all copies You make
|
|
||||||
available thereafter and shall take other steps (such as notifying
|
|
||||||
appropriate mailing lists or newsgroups) reasonably calculated to
|
|
||||||
inform those who received the Covered Code that new knowledge has
|
|
||||||
been obtained.
|
|
||||||
|
|
||||||
(b) Contributor APIs.
|
|
||||||
If Your Modification is an application programming interface and
|
|
||||||
You own or control patents which are reasonably necessary to
|
|
||||||
implement that API, you must also include this information in the
|
|
||||||
LEGAL file.
|
|
||||||
|
|
||||||
3.5. Required Notices.
|
|
||||||
You must duplicate the notice in Exhibit A in each file of the Source
|
|
||||||
Code, and this License in any documentation for the Source Code, where
|
|
||||||
You describe recipients' rights relating to Covered Code. If You
|
|
||||||
created one or more Modification(s), You may add your name as a
|
|
||||||
Contributor to the notice described in Exhibit A. If it is not possible
|
|
||||||
to put such notice in a particular Source Code file due to its
|
|
||||||
structure, then you must include such notice in a location (such as a
|
|
||||||
relevant directory file) where a user would be likely to look for such
|
|
||||||
a notice. You may choose to offer, and to charge a fee for, warranty,
|
|
||||||
support, indemnity or liability obligations to one or more recipients
|
|
||||||
of Covered Code. However, You may do so only on Your own behalf, and
|
|
||||||
not on behalf of the Initial Developer or any Contributor. You must
|
|
||||||
make it absolutely clear than any such warranty, support, indemnity or
|
|
||||||
liability obligation is offered by You alone, and You hereby agree to
|
|
||||||
indemnify the Initial Developer and every Contributor for any liability
|
|
||||||
incurred by the Initial Developer or such Contributor as a result of
|
|
||||||
warranty, support, indemnity or liability terms You offer.
|
|
||||||
|
|
||||||
3.6. Distribution of Executable Versions.
|
|
||||||
You may distribute Covered Code in Executable form only if the
|
|
||||||
requirements of Section 3.1-3.5 have been met for that Covered Code,
|
|
||||||
and if You include a notice stating that the Source Code version of the
|
|
||||||
Covered Code is available under the terms of this License, including a
|
|
||||||
description of how and where You have fulfilled the obligations of
|
|
||||||
Section 3.2. The notice must be conspicuously included in any notice in
|
|
||||||
an Executable version, related documentation or collateral in which You
|
|
||||||
describe recipients' rights relating to the Covered Code. You may
|
|
||||||
distribute the Executable version of Covered Code under a license of
|
|
||||||
Your choice, which may contain terms different from this License,
|
|
||||||
provided that You are in compliance with the terms of this License and
|
|
||||||
that the license for the Executable version does not attempt to limit
|
|
||||||
or alter the recipient's rights in the Source Code version from the
|
|
||||||
rights set forth in this License. If You distribute the Executable
|
|
||||||
version under a different license You must make it absolutely clear
|
|
||||||
that any terms which differ from this License are offered by You alone,
|
|
||||||
not by the Initial Developer or any Contributor. You hereby agree to
|
|
||||||
indemnify the Initial Developer and every Contributor for any liability
|
|
||||||
incurred by the Initial Developer or such Contributor as a result of
|
|
||||||
any such terms You offer.
|
|
||||||
|
|
||||||
3.7. Larger Works.
|
|
||||||
You may create a Larger Work by combining Covered Code with other code
|
|
||||||
not governed by the terms of this License and distribute the Larger
|
|
||||||
Work as a single product. In such a case, You must make sure the
|
|
||||||
requirements of this License are fulfilled for the Covered Code.
|
|
||||||
|
|
||||||
4. Inability to Comply Due to Statute or Regulation.
|
|
||||||
|
|
||||||
If it is impossible for You to comply with any of the terms of this
|
|
||||||
License with respect to some or all of the Covered Code due to statute
|
|
||||||
or regulation then You must: (a) comply with the terms of this License
|
|
||||||
to the maximum extent possible; and (b) describe the limitations and
|
|
||||||
the code they affect. Such description must be included in the LEGAL
|
|
||||||
file described in Section 3.4 and must be included with all
|
|
||||||
distributions of the Source Code. Except to the extent prohibited by
|
|
||||||
statute or regulation, such description must be sufficiently detailed
|
|
||||||
for a recipient of ordinary skill to be able to understand it.
|
|
||||||
|
|
||||||
5. Application of this License.
|
|
||||||
|
|
||||||
This License applies to code to which the Initial Developer has
|
|
||||||
attached the notice in Exhibit A, and to related Covered Code.
|
|
||||||
|
|
||||||
6. Versions of the License.
|
|
||||||
|
|
||||||
6.1. New Versions.
|
|
||||||
Netscape Communications Corporation (``Netscape'') may publish revised
|
|
||||||
and/or new versions of the License from time to time. Each version will
|
|
||||||
be given a distinguishing version number.
|
|
||||||
|
|
||||||
6.2. Effect of New Versions.
|
|
||||||
Once Covered Code has been published under a particular version of the
|
|
||||||
License, You may always continue to use it under the terms of that
|
|
||||||
version. You may also choose to use such Covered Code under the terms
|
|
||||||
of any subsequent version of the License published by Netscape. No one
|
|
||||||
other than Netscape has the right to modify the terms applicable to
|
|
||||||
Covered Code created under this License.
|
|
||||||
|
|
||||||
6.3. Derivative Works.
|
|
||||||
If you create or use a modified version of this License (which you may
|
|
||||||
only do in order to apply it to code which is not already Covered Code
|
|
||||||
governed by this License), you must (a) rename Your license so that the
|
|
||||||
phrases ``Mozilla'', ``MOZILLAPL'', ``MOZPL'', ``Netscape'', ``NPL'' or
|
|
||||||
any confusingly similar phrase do not appear anywhere in your license
|
|
||||||
and (b) otherwise make it clear that your version of the license
|
|
||||||
contains terms which differ from the Mozilla Public License and
|
|
||||||
Netscape Public License. (Filling in the name of the Initial Developer,
|
|
||||||
Original Code or Contributor in the notice described in Exhibit A shall
|
|
||||||
not of themselves be deemed to be modifications of this License.)
|
|
||||||
|
|
||||||
7. DISCLAIMER OF WARRANTY.
|
|
||||||
|
|
||||||
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN ``AS IS'' BASIS,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
||||||
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
|
|
||||||
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
|
|
||||||
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
|
|
||||||
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
|
|
||||||
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
|
|
||||||
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
|
|
||||||
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
|
|
||||||
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
|
|
||||||
|
|
||||||
8. TERMINATION.
|
|
||||||
|
|
||||||
This License and the rights granted hereunder will terminate
|
|
||||||
automatically if You fail to comply with terms herein and fail to cure
|
|
||||||
such breach within 30 days of becoming aware of the breach. All
|
|
||||||
sublicenses to the Covered Code which are properly granted shall
|
|
||||||
survive any termination of this License. Provisions which, by their
|
|
||||||
nature, must remain in effect beyond the termination of this License
|
|
||||||
shall survive.
|
|
||||||
|
|
||||||
9. LIMITATION OF LIABILITY.
|
|
||||||
|
|
||||||
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
|
|
||||||
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL
|
|
||||||
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
|
|
||||||
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER
|
|
||||||
PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
|
||||||
OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
|
|
||||||
GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND
|
|
||||||
ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE
|
|
||||||
BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
|
|
||||||
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
|
|
||||||
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
|
|
||||||
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
|
|
||||||
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT
|
|
||||||
EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
|
|
||||||
|
|
||||||
10. U.S. GOVERNMENT END USERS.
|
|
||||||
|
|
||||||
The Covered Code is a ``commercial item,'' as that term is defined in
|
|
||||||
48 C.F.R. 2.101 (Oct. 1995), consisting of ``commercial computer
|
|
||||||
software'' and ``commercial computer software documentation,'' as such
|
|
||||||
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
|
|
||||||
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
|
|
||||||
all U.S. Government End Users acquire Covered Code with only those
|
|
||||||
rights set forth herein.
|
|
||||||
|
|
||||||
11. MISCELLANEOUS.
|
|
||||||
|
|
||||||
This License represents the complete agreement concerning subject
|
|
||||||
matter hereof. If any provision of this License is held to be
|
|
||||||
unenforceable, such provision shall be reformed only to the extent
|
|
||||||
necessary to make it enforceable. This License shall be governed by
|
|
||||||
California law provisions (except to the extent applicable law, if any,
|
|
||||||
provides otherwise), excluding its conflict-of-law provisions. With
|
|
||||||
respect to disputes in which at least one party is a citizen of, or an
|
|
||||||
entity chartered or registered to do business in, the United States of
|
|
||||||
America: (a) unless otherwise agreed in writing, all disputes relating
|
|
||||||
to this License (excepting any dispute relating to intellectual
|
|
||||||
property rights) shall be subject to final and binding arbitration,
|
|
||||||
with the losing party paying all costs of arbitration; (b) any
|
|
||||||
arbitration relating to this Agreement shall be held in Santa Clara
|
|
||||||
County, California, under the auspices of JAMS/EndDispute; and (c) any
|
|
||||||
litigation relating to this Agreement shall be subject to the
|
|
||||||
jurisdiction of the Federal Courts of the Northern District of
|
|
||||||
California, with venue lying in Santa Clara County, California, with
|
|
||||||
the losing party responsible for costs, including without limitation,
|
|
||||||
court costs and reasonable attorneys fees and expenses. The application
|
|
||||||
of the United Nations Convention on Contracts for the International
|
|
||||||
Sale of Goods is expressly excluded. Any law or regulation which
|
|
||||||
provides that the language of a contract shall be construed against the
|
|
||||||
drafter shall not apply to this License.
|
|
||||||
|
|
||||||
12. RESPONSIBILITY FOR CLAIMS.
|
|
||||||
|
|
||||||
Except in cases where another Contributor has failed to comply with
|
|
||||||
Section 3.4, You are responsible for damages arising, directly or
|
|
||||||
indirectly, out of Your utilization of rights under this License, based
|
|
||||||
on the number of copies of Covered Code you made available, the
|
|
||||||
revenues you received from utilizing such rights, and other relevant
|
|
||||||
factors. You agree to work with affected parties to distribute
|
|
||||||
responsibility on an equitable basis.
|
|
||||||
|
|
||||||
EXHIBIT A.
|
|
||||||
|
|
||||||
``The contents of this file are subject to the Mozilla Public License
|
|
||||||
Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
compliance with the License. You may obtain a copy of the License at
|
|
||||||
http://www.mozilla.org/MPL/
|
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS"
|
|
||||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
||||||
License for the specific language governing rights and limitations
|
|
||||||
under the License.
|
|
||||||
|
|
||||||
The Original Code is ______________________________________.
|
|
||||||
|
|
||||||
The Initial Developer of the Original Code is ________________________.
|
|
||||||
Portions created by ______________________ are Copyright (C) ______
|
|
||||||
_______________________. All Rights Reserved.
|
|
||||||
|
|
||||||
Contributor(s): ______________________________________.''
|
|
||||||
470
MPL-1.1.txt
Normal file
470
MPL-1.1.txt
Normal file
@@ -0,0 +1,470 @@
|
|||||||
|
MOZILLA PUBLIC LICENSE
|
||||||
|
Version 1.1
|
||||||
|
|
||||||
|
---------------
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
1.0.1. "Commercial Use" means distribution or otherwise making the
|
||||||
|
Covered Code available to a third party.
|
||||||
|
|
||||||
|
1.1. "Contributor" means each entity that creates or contributes to
|
||||||
|
the creation of Modifications.
|
||||||
|
|
||||||
|
1.2. "Contributor Version" means the combination of the Original
|
||||||
|
Code, prior Modifications used by a Contributor, and the Modifications
|
||||||
|
made by that particular Contributor.
|
||||||
|
|
||||||
|
1.3. "Covered Code" means the Original Code or Modifications or the
|
||||||
|
combination of the Original Code and Modifications, in each case
|
||||||
|
including portions thereof.
|
||||||
|
|
||||||
|
1.4. "Electronic Distribution Mechanism" means a mechanism generally
|
||||||
|
accepted in the software development community for the electronic
|
||||||
|
transfer of data.
|
||||||
|
|
||||||
|
1.5. "Executable" means Covered Code in any form other than Source
|
||||||
|
Code.
|
||||||
|
|
||||||
|
1.6. "Initial Developer" means the individual or entity identified
|
||||||
|
as the Initial Developer in the Source Code notice required by Exhibit
|
||||||
|
A.
|
||||||
|
|
||||||
|
1.7. "Larger Work" means a work which combines Covered Code or
|
||||||
|
portions thereof with code not governed by the terms of this License.
|
||||||
|
|
||||||
|
1.8. "License" means this document.
|
||||||
|
|
||||||
|
1.8.1. "Licensable" means having the right to grant, to the maximum
|
||||||
|
extent possible, whether at the time of the initial grant or
|
||||||
|
subsequently acquired, any and all of the rights conveyed herein.
|
||||||
|
|
||||||
|
1.9. "Modifications" means any addition to or deletion from the
|
||||||
|
substance or structure of either the Original Code or any previous
|
||||||
|
Modifications. When Covered Code is released as a series of files, a
|
||||||
|
Modification is:
|
||||||
|
A. Any addition to or deletion from the contents of a file
|
||||||
|
containing Original Code or previous Modifications.
|
||||||
|
|
||||||
|
B. Any new file that contains any part of the Original Code or
|
||||||
|
previous Modifications.
|
||||||
|
|
||||||
|
1.10. "Original Code" means Source Code of computer software code
|
||||||
|
which is described in the Source Code notice required by Exhibit A as
|
||||||
|
Original Code, and which, at the time of its release under this
|
||||||
|
License is not already Covered Code governed by this License.
|
||||||
|
|
||||||
|
1.10.1. "Patent Claims" means any patent claim(s), now owned or
|
||||||
|
hereafter acquired, including without limitation, method, process,
|
||||||
|
and apparatus claims, in any patent Licensable by grantor.
|
||||||
|
|
||||||
|
1.11. "Source Code" means the preferred form of the Covered Code for
|
||||||
|
making modifications to it, including all modules it contains, plus
|
||||||
|
any associated interface definition files, scripts used to control
|
||||||
|
compilation and installation of an Executable, or source code
|
||||||
|
differential comparisons against either the Original Code or another
|
||||||
|
well known, available Covered Code of the Contributor's choice. The
|
||||||
|
Source Code can be in a compressed or archival form, provided the
|
||||||
|
appropriate decompression or de-archiving software is widely available
|
||||||
|
for no charge.
|
||||||
|
|
||||||
|
1.12. "You" (or "Your") means an individual or a legal entity
|
||||||
|
exercising rights under, and complying with all of the terms of, this
|
||||||
|
License or a future version of this License issued under Section 6.1.
|
||||||
|
For legal entities, "You" includes any entity which controls, is
|
||||||
|
controlled by, or is under common control with You. For purposes of
|
||||||
|
this definition, "control" means (a) the power, direct or indirect,
|
||||||
|
to cause the direction or management of such entity, whether by
|
||||||
|
contract or otherwise, or (b) ownership of more than fifty percent
|
||||||
|
(50%) of the outstanding shares or beneficial ownership of such
|
||||||
|
entity.
|
||||||
|
|
||||||
|
2. Source Code License.
|
||||||
|
|
||||||
|
2.1. The Initial Developer Grant.
|
||||||
|
The Initial Developer hereby grants You a world-wide, royalty-free,
|
||||||
|
non-exclusive license, subject to third party intellectual property
|
||||||
|
claims:
|
||||||
|
(a) under intellectual property rights (other than patent or
|
||||||
|
trademark) Licensable by Initial Developer to use, reproduce,
|
||||||
|
modify, display, perform, sublicense and distribute the Original
|
||||||
|
Code (or portions thereof) with or without Modifications, and/or
|
||||||
|
as part of a Larger Work; and
|
||||||
|
|
||||||
|
(b) under Patents Claims infringed by the making, using or
|
||||||
|
selling of Original Code, to make, have made, use, practice,
|
||||||
|
sell, and offer for sale, and/or otherwise dispose of the
|
||||||
|
Original Code (or portions thereof).
|
||||||
|
|
||||||
|
(c) the licenses granted in this Section 2.1(a) and (b) are
|
||||||
|
effective on the date Initial Developer first distributes
|
||||||
|
Original Code under the terms of this License.
|
||||||
|
|
||||||
|
(d) Notwithstanding Section 2.1(b) above, no patent license is
|
||||||
|
granted: 1) for code that You delete from the Original Code; 2)
|
||||||
|
separate from the Original Code; or 3) for infringements caused
|
||||||
|
by: i) the modification of the Original Code or ii) the
|
||||||
|
combination of the Original Code with other software or devices.
|
||||||
|
|
||||||
|
2.2. Contributor Grant.
|
||||||
|
Subject to third party intellectual property claims, each Contributor
|
||||||
|
hereby grants You a world-wide, royalty-free, non-exclusive license
|
||||||
|
|
||||||
|
(a) under intellectual property rights (other than patent or
|
||||||
|
trademark) Licensable by Contributor, to use, reproduce, modify,
|
||||||
|
display, perform, sublicense and distribute the Modifications
|
||||||
|
created by such Contributor (or portions thereof) either on an
|
||||||
|
unmodified basis, with other Modifications, as Covered Code
|
||||||
|
and/or as part of a Larger Work; and
|
||||||
|
|
||||||
|
(b) under Patent Claims infringed by the making, using, or
|
||||||
|
selling of Modifications made by that Contributor either alone
|
||||||
|
and/or in combination with its Contributor Version (or portions
|
||||||
|
of such combination), to make, use, sell, offer for sale, have
|
||||||
|
made, and/or otherwise dispose of: 1) Modifications made by that
|
||||||
|
Contributor (or portions thereof); and 2) the combination of
|
||||||
|
Modifications made by that Contributor with its Contributor
|
||||||
|
Version (or portions of such combination).
|
||||||
|
|
||||||
|
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
|
||||||
|
effective on the date Contributor first makes Commercial Use of
|
||||||
|
the Covered Code.
|
||||||
|
|
||||||
|
(d) Notwithstanding Section 2.2(b) above, no patent license is
|
||||||
|
granted: 1) for any code that Contributor has deleted from the
|
||||||
|
Contributor Version; 2) separate from the Contributor Version;
|
||||||
|
3) for infringements caused by: i) third party modifications of
|
||||||
|
Contributor Version or ii) the combination of Modifications made
|
||||||
|
by that Contributor with other software (except as part of the
|
||||||
|
Contributor Version) or other devices; or 4) under Patent Claims
|
||||||
|
infringed by Covered Code in the absence of Modifications made by
|
||||||
|
that Contributor.
|
||||||
|
|
||||||
|
3. Distribution Obligations.
|
||||||
|
|
||||||
|
3.1. Application of License.
|
||||||
|
The Modifications which You create or to which You contribute are
|
||||||
|
governed by the terms of this License, including without limitation
|
||||||
|
Section 2.2. The Source Code version of Covered Code may be
|
||||||
|
distributed only under the terms of this License or a future version
|
||||||
|
of this License released under Section 6.1, and You must include a
|
||||||
|
copy of this License with every copy of the Source Code You
|
||||||
|
distribute. You may not offer or impose any terms on any Source Code
|
||||||
|
version that alters or restricts the applicable version of this
|
||||||
|
License or the recipients' rights hereunder. However, You may include
|
||||||
|
an additional document offering the additional rights described in
|
||||||
|
Section 3.5.
|
||||||
|
|
||||||
|
3.2. Availability of Source Code.
|
||||||
|
Any Modification which You create or to which You contribute must be
|
||||||
|
made available in Source Code form under the terms of this License
|
||||||
|
either on the same media as an Executable version or via an accepted
|
||||||
|
Electronic Distribution Mechanism to anyone to whom you made an
|
||||||
|
Executable version available; and if made available via Electronic
|
||||||
|
Distribution Mechanism, must remain available for at least twelve (12)
|
||||||
|
months after the date it initially became available, or at least six
|
||||||
|
(6) months after a subsequent version of that particular Modification
|
||||||
|
has been made available to such recipients. You are responsible for
|
||||||
|
ensuring that the Source Code version remains available even if the
|
||||||
|
Electronic Distribution Mechanism is maintained by a third party.
|
||||||
|
|
||||||
|
3.3. Description of Modifications.
|
||||||
|
You must cause all Covered Code to which You contribute to contain a
|
||||||
|
file documenting the changes You made to create that Covered Code and
|
||||||
|
the date of any change. You must include a prominent statement that
|
||||||
|
the Modification is derived, directly or indirectly, from Original
|
||||||
|
Code provided by the Initial Developer and including the name of the
|
||||||
|
Initial Developer in (a) the Source Code, and (b) in any notice in an
|
||||||
|
Executable version or related documentation in which You describe the
|
||||||
|
origin or ownership of the Covered Code.
|
||||||
|
|
||||||
|
3.4. Intellectual Property Matters
|
||||||
|
(a) Third Party Claims.
|
||||||
|
If Contributor has knowledge that a license under a third party's
|
||||||
|
intellectual property rights is required to exercise the rights
|
||||||
|
granted by such Contributor under Sections 2.1 or 2.2,
|
||||||
|
Contributor must include a text file with the Source Code
|
||||||
|
distribution titled "LEGAL" which describes the claim and the
|
||||||
|
party making the claim in sufficient detail that a recipient will
|
||||||
|
know whom to contact. If Contributor obtains such knowledge after
|
||||||
|
the Modification is made available as described in Section 3.2,
|
||||||
|
Contributor shall promptly modify the LEGAL file in all copies
|
||||||
|
Contributor makes available thereafter and shall take other steps
|
||||||
|
(such as notifying appropriate mailing lists or newsgroups)
|
||||||
|
reasonably calculated to inform those who received the Covered
|
||||||
|
Code that new knowledge has been obtained.
|
||||||
|
|
||||||
|
(b) Contributor APIs.
|
||||||
|
If Contributor's Modifications include an application programming
|
||||||
|
interface and Contributor has knowledge of patent licenses which
|
||||||
|
are reasonably necessary to implement that API, Contributor must
|
||||||
|
also include this information in the LEGAL file.
|
||||||
|
|
||||||
|
(c) Representations.
|
||||||
|
Contributor represents that, except as disclosed pursuant to
|
||||||
|
Section 3.4(a) above, Contributor believes that Contributor's
|
||||||
|
Modifications are Contributor's original creation(s) and/or
|
||||||
|
Contributor has sufficient rights to grant the rights conveyed by
|
||||||
|
this License.
|
||||||
|
|
||||||
|
3.5. Required Notices.
|
||||||
|
You must duplicate the notice in Exhibit A in each file of the Source
|
||||||
|
Code. If it is not possible to put such notice in a particular Source
|
||||||
|
Code file due to its structure, then You must include such notice in a
|
||||||
|
location (such as a relevant directory) where a user would be likely
|
||||||
|
to look for such a notice. If You created one or more Modification(s)
|
||||||
|
You may add your name as a Contributor to the notice described in
|
||||||
|
Exhibit A. You must also duplicate this License in any documentation
|
||||||
|
for the Source Code where You describe recipients' rights or ownership
|
||||||
|
rights relating to Covered Code. You may choose to offer, and to
|
||||||
|
charge a fee for, warranty, support, indemnity or liability
|
||||||
|
obligations to one or more recipients of Covered Code. However, You
|
||||||
|
may do so only on Your own behalf, and not on behalf of the Initial
|
||||||
|
Developer or any Contributor. You must make it absolutely clear than
|
||||||
|
any such warranty, support, indemnity or liability obligation is
|
||||||
|
offered by You alone, and You hereby agree to indemnify the Initial
|
||||||
|
Developer and every Contributor for any liability incurred by the
|
||||||
|
Initial Developer or such Contributor as a result of warranty,
|
||||||
|
support, indemnity or liability terms You offer.
|
||||||
|
|
||||||
|
3.6. Distribution of Executable Versions.
|
||||||
|
You may distribute Covered Code in Executable form only if the
|
||||||
|
requirements of Section 3.1-3.5 have been met for that Covered Code,
|
||||||
|
and if You include a notice stating that the Source Code version of
|
||||||
|
the Covered Code is available under the terms of this License,
|
||||||
|
including a description of how and where You have fulfilled the
|
||||||
|
obligations of Section 3.2. The notice must be conspicuously included
|
||||||
|
in any notice in an Executable version, related documentation or
|
||||||
|
collateral in which You describe recipients' rights relating to the
|
||||||
|
Covered Code. You may distribute the Executable version of Covered
|
||||||
|
Code or ownership rights under a license of Your choice, which may
|
||||||
|
contain terms different from this License, provided that You are in
|
||||||
|
compliance with the terms of this License and that the license for the
|
||||||
|
Executable version does not attempt to limit or alter the recipient's
|
||||||
|
rights in the Source Code version from the rights set forth in this
|
||||||
|
License. If You distribute the Executable version under a different
|
||||||
|
license You must make it absolutely clear that any terms which differ
|
||||||
|
from this License are offered by You alone, not by the Initial
|
||||||
|
Developer or any Contributor. You hereby agree to indemnify the
|
||||||
|
Initial Developer and every Contributor for any liability incurred by
|
||||||
|
the Initial Developer or such Contributor as a result of any such
|
||||||
|
terms You offer.
|
||||||
|
|
||||||
|
3.7. Larger Works.
|
||||||
|
You may create a Larger Work by combining Covered Code with other code
|
||||||
|
not governed by the terms of this License and distribute the Larger
|
||||||
|
Work as a single product. In such a case, You must make sure the
|
||||||
|
requirements of this License are fulfilled for the Covered Code.
|
||||||
|
|
||||||
|
4. Inability to Comply Due to Statute or Regulation.
|
||||||
|
|
||||||
|
If it is impossible for You to comply with any of the terms of this
|
||||||
|
License with respect to some or all of the Covered Code due to
|
||||||
|
statute, judicial order, or regulation then You must: (a) comply with
|
||||||
|
the terms of this License to the maximum extent possible; and (b)
|
||||||
|
describe the limitations and the code they affect. Such description
|
||||||
|
must be included in the LEGAL file described in Section 3.4 and must
|
||||||
|
be included with all distributions of the Source Code. Except to the
|
||||||
|
extent prohibited by statute or regulation, such description must be
|
||||||
|
sufficiently detailed for a recipient of ordinary skill to be able to
|
||||||
|
understand it.
|
||||||
|
|
||||||
|
5. Application of this License.
|
||||||
|
|
||||||
|
This License applies to code to which the Initial Developer has
|
||||||
|
attached the notice in Exhibit A and to related Covered Code.
|
||||||
|
|
||||||
|
6. Versions of the License.
|
||||||
|
|
||||||
|
6.1. New Versions.
|
||||||
|
Netscape Communications Corporation ("Netscape") may publish revised
|
||||||
|
and/or new versions of the License from time to time. Each version
|
||||||
|
will be given a distinguishing version number.
|
||||||
|
|
||||||
|
6.2. Effect of New Versions.
|
||||||
|
Once Covered Code has been published under a particular version of the
|
||||||
|
License, You may always continue to use it under the terms of that
|
||||||
|
version. You may also choose to use such Covered Code under the terms
|
||||||
|
of any subsequent version of the License published by Netscape. No one
|
||||||
|
other than Netscape has the right to modify the terms applicable to
|
||||||
|
Covered Code created under this License.
|
||||||
|
|
||||||
|
6.3. Derivative Works.
|
||||||
|
If You create or use a modified version of this License (which you may
|
||||||
|
only do in order to apply it to code which is not already Covered Code
|
||||||
|
governed by this License), You must (a) rename Your license so that
|
||||||
|
the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
|
||||||
|
"MPL", "NPL" or any confusingly similar phrase do not appear in your
|
||||||
|
license (except to note that your license differs from this License)
|
||||||
|
and (b) otherwise make it clear that Your version of the license
|
||||||
|
contains terms which differ from the Mozilla Public License and
|
||||||
|
Netscape Public License. (Filling in the name of the Initial
|
||||||
|
Developer, Original Code or Contributor in the notice described in
|
||||||
|
Exhibit A shall not of themselves be deemed to be modifications of
|
||||||
|
this License.)
|
||||||
|
|
||||||
|
7. DISCLAIMER OF WARRANTY.
|
||||||
|
|
||||||
|
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||||
|
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
|
||||||
|
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
|
||||||
|
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
|
||||||
|
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
|
||||||
|
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
|
||||||
|
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
|
||||||
|
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
|
||||||
|
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
|
||||||
|
|
||||||
|
8. TERMINATION.
|
||||||
|
|
||||||
|
8.1. This License and the rights granted hereunder will terminate
|
||||||
|
automatically if You fail to comply with terms herein and fail to cure
|
||||||
|
such breach within 30 days of becoming aware of the breach. All
|
||||||
|
sublicenses to the Covered Code which are properly granted shall
|
||||||
|
survive any termination of this License. Provisions which, by their
|
||||||
|
nature, must remain in effect beyond the termination of this License
|
||||||
|
shall survive.
|
||||||
|
|
||||||
|
8.2. If You initiate litigation by asserting a patent infringement
|
||||||
|
claim (excluding declatory judgment actions) against Initial Developer
|
||||||
|
or a Contributor (the Initial Developer or Contributor against whom
|
||||||
|
You file such action is referred to as "Participant") alleging that:
|
||||||
|
|
||||||
|
(a) such Participant's Contributor Version directly or indirectly
|
||||||
|
infringes any patent, then any and all rights granted by such
|
||||||
|
Participant to You under Sections 2.1 and/or 2.2 of this License
|
||||||
|
shall, upon 60 days notice from Participant terminate prospectively,
|
||||||
|
unless if within 60 days after receipt of notice You either: (i)
|
||||||
|
agree in writing to pay Participant a mutually agreeable reasonable
|
||||||
|
royalty for Your past and future use of Modifications made by such
|
||||||
|
Participant, or (ii) withdraw Your litigation claim with respect to
|
||||||
|
the Contributor Version against such Participant. If within 60 days
|
||||||
|
of notice, a reasonable royalty and payment arrangement are not
|
||||||
|
mutually agreed upon in writing by the parties or the litigation claim
|
||||||
|
is not withdrawn, the rights granted by Participant to You under
|
||||||
|
Sections 2.1 and/or 2.2 automatically terminate at the expiration of
|
||||||
|
the 60 day notice period specified above.
|
||||||
|
|
||||||
|
(b) any software, hardware, or device, other than such Participant's
|
||||||
|
Contributor Version, directly or indirectly infringes any patent, then
|
||||||
|
any rights granted to You by such Participant under Sections 2.1(b)
|
||||||
|
and 2.2(b) are revoked effective as of the date You first made, used,
|
||||||
|
sold, distributed, or had made, Modifications made by that
|
||||||
|
Participant.
|
||||||
|
|
||||||
|
8.3. If You assert a patent infringement claim against Participant
|
||||||
|
alleging that such Participant's Contributor Version directly or
|
||||||
|
indirectly infringes any patent where such claim is resolved (such as
|
||||||
|
by license or settlement) prior to the initiation of patent
|
||||||
|
infringement litigation, then the reasonable value of the licenses
|
||||||
|
granted by such Participant under Sections 2.1 or 2.2 shall be taken
|
||||||
|
into account in determining the amount or value of any payment or
|
||||||
|
license.
|
||||||
|
|
||||||
|
8.4. In the event of termination under Sections 8.1 or 8.2 above,
|
||||||
|
all end user license agreements (excluding distributors and resellers)
|
||||||
|
which have been validly granted by You or any distributor hereunder
|
||||||
|
prior to termination shall survive termination.
|
||||||
|
|
||||||
|
9. LIMITATION OF LIABILITY.
|
||||||
|
|
||||||
|
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
|
||||||
|
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
|
||||||
|
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
|
||||||
|
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
|
||||||
|
ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
|
||||||
|
CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
|
||||||
|
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
|
||||||
|
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
|
||||||
|
INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
|
||||||
|
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
|
||||||
|
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
|
||||||
|
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
|
||||||
|
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
|
||||||
|
THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
|
||||||
|
|
||||||
|
10. U.S. GOVERNMENT END USERS.
|
||||||
|
|
||||||
|
The Covered Code is a "commercial item," as that term is defined in
|
||||||
|
48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
|
||||||
|
software" and "commercial computer software documentation," as such
|
||||||
|
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
|
||||||
|
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
|
||||||
|
all U.S. Government End Users acquire Covered Code with only those
|
||||||
|
rights set forth herein.
|
||||||
|
|
||||||
|
11. MISCELLANEOUS.
|
||||||
|
|
||||||
|
This License represents the complete agreement concerning subject
|
||||||
|
matter hereof. If any provision of this License is held to be
|
||||||
|
unenforceable, such provision shall be reformed only to the extent
|
||||||
|
necessary to make it enforceable. This License shall be governed by
|
||||||
|
California law provisions (except to the extent applicable law, if
|
||||||
|
any, provides otherwise), excluding its conflict-of-law provisions.
|
||||||
|
With respect to disputes in which at least one party is a citizen of,
|
||||||
|
or an entity chartered or registered to do business in the United
|
||||||
|
States of America, any litigation relating to this License shall be
|
||||||
|
subject to the jurisdiction of the Federal Courts of the Northern
|
||||||
|
District of California, with venue lying in Santa Clara County,
|
||||||
|
California, with the losing party responsible for costs, including
|
||||||
|
without limitation, court costs and reasonable attorneys' fees and
|
||||||
|
expenses. The application of the United Nations Convention on
|
||||||
|
Contracts for the International Sale of Goods is expressly excluded.
|
||||||
|
Any law or regulation which provides that the language of a contract
|
||||||
|
shall be construed against the drafter shall not apply to this
|
||||||
|
License.
|
||||||
|
|
||||||
|
12. RESPONSIBILITY FOR CLAIMS.
|
||||||
|
|
||||||
|
As between Initial Developer and the Contributors, each party is
|
||||||
|
responsible for claims and damages arising, directly or indirectly,
|
||||||
|
out of its utilization of rights under this License and You agree to
|
||||||
|
work with Initial Developer and Contributors to distribute such
|
||||||
|
responsibility on an equitable basis. Nothing herein is intended or
|
||||||
|
shall be deemed to constitute any admission of liability.
|
||||||
|
|
||||||
|
13. MULTIPLE-LICENSED CODE.
|
||||||
|
|
||||||
|
Initial Developer may designate portions of the Covered Code as
|
||||||
|
"Multiple-Licensed". "Multiple-Licensed" means that the Initial
|
||||||
|
Developer permits you to utilize portions of the Covered Code under
|
||||||
|
Your choice of the NPL or the alternative licenses, if any, specified
|
||||||
|
by the Initial Developer in the file described in Exhibit A.
|
||||||
|
|
||||||
|
EXHIBIT A -Mozilla Public License.
|
||||||
|
|
||||||
|
``The contents of this file are subject to the Mozilla Public License
|
||||||
|
Version 1.1 (the "License"); you may not use this file except in
|
||||||
|
compliance with the License. You may obtain a copy of the License at
|
||||||
|
http://www.mozilla.org/MPL/
|
||||||
|
|
||||||
|
Software distributed under the License is distributed on an "AS IS"
|
||||||
|
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||||
|
License for the specific language governing rights and limitations
|
||||||
|
under the License.
|
||||||
|
|
||||||
|
The Original Code is ______________________________________.
|
||||||
|
|
||||||
|
The Initial Developer of the Original Code is ________________________.
|
||||||
|
Portions created by ______________________ are Copyright (C) ______
|
||||||
|
_______________________. All Rights Reserved.
|
||||||
|
|
||||||
|
Contributor(s): ______________________________________.
|
||||||
|
|
||||||
|
Alternatively, the contents of this file may be used under the terms
|
||||||
|
of the _____ license (the "[___] License"), in which case the
|
||||||
|
provisions of [______] License are applicable instead of those
|
||||||
|
above. If you wish to allow use of your version of this file only
|
||||||
|
under the terms of the [____] License and not to allow others to use
|
||||||
|
your version of this file under the MPL, indicate your decision by
|
||||||
|
deleting the provisions above and replace them with the notice and
|
||||||
|
other provisions required by the [___] License. If you do not delete
|
||||||
|
the provisions above, a recipient may use your version of this file
|
||||||
|
under either the MPL or the [___] License."
|
||||||
|
|
||||||
|
[NOTE: The text of this Exhibit A may differ slightly from the text of
|
||||||
|
the notices in the Source Code files of the Original Code. You should
|
||||||
|
use the text of this Exhibit A rather than the text found in the
|
||||||
|
Original Code Source Code for Your Modifications.]
|
||||||
|
|
||||||
41
Makefile.am
41
Makefile.am
@@ -4,7 +4,44 @@
|
|||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||||
|
|
||||||
EXTRA_DIST = curl.spec curl-ssl.spec
|
EXTRA_DIST = \
|
||||||
|
CHANGES LEGAL maketgz MITX.txt MPL-1.1.txt \
|
||||||
|
config-win32.h reconf packages/README Makefile.dist
|
||||||
|
|
||||||
SUBDIRS = docs lib src include
|
SUBDIRS = docs lib src include tests packages
|
||||||
|
|
||||||
|
# create a root makefile in the distribution:
|
||||||
|
dist-hook:
|
||||||
|
cp $(srcdir)/Makefile.dist $(distdir)/Makefile
|
||||||
|
|
||||||
|
check: test
|
||||||
|
|
||||||
|
test:
|
||||||
|
@(cd tests; make quiet-test)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros
|
||||||
|
# must contain the following line:
|
||||||
|
# %_topdir /home/loic/local/rpm
|
||||||
|
# and that /home/loic/local/rpm contains the directory SOURCES, BUILD etc.
|
||||||
|
#
|
||||||
|
# cd /home/loic/local/rpm ; mkdir -p SOURCES BUILD RPMS/i386 SPECS SRPMS
|
||||||
|
#
|
||||||
|
# If additional configure flags are needed to build the package, add the
|
||||||
|
# following in ~/.rpmmacros
|
||||||
|
# %configure CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} ${AM_CONFIGFLAGS}
|
||||||
|
# and run make rpm in the following way:
|
||||||
|
# AM_CONFIGFLAGS='--with-uri=/home/users/loic/local/RedHat-6.2' make rpm
|
||||||
|
#
|
||||||
|
|
||||||
|
rpms:
|
||||||
|
$(MAKE) RPMDIST=curl rpm
|
||||||
|
$(MAKE) RPMDIST=curl-ssl rpm
|
||||||
|
|
||||||
|
rpm:
|
||||||
|
RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \
|
||||||
|
cp $(srcdir)/packages/Linux/RPM/$(RPMDIST).spec $$RPM_TOPDIR/SPECS ; \
|
||||||
|
cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \
|
||||||
|
rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(RPMDIST).spec ; \
|
||||||
|
mv $$RPM_TOPDIR/RPMS/i386/$(RPMDIST)-*.rpm . ; \
|
||||||
|
mv $$RPM_TOPDIR/SRPMS/$(RPMDIST)-*.src.rpm .
|
||||||
|
|||||||
@@ -1,45 +1,25 @@
|
|||||||
############################################################################
|
#############################################################################
|
||||||
# _ _ ____ _
|
# _ _ ____ _
|
||||||
# Project ___| | | | _ \| |
|
# Project ___| | | | _ \| |
|
||||||
# / __| | | | |_) | |
|
# / __| | | | |_) | |
|
||||||
# | (__| |_| | _ <| |___
|
# | (__| |_| | _ <| |___
|
||||||
# \___|\___/|_| \_\_____|
|
# \___|\___/|_| \_\_____|
|
||||||
#
|
#
|
||||||
# The contents of this file are subject to the Mozilla Public License
|
# Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
# Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
# compliance with the License. You may obtain a copy of the License at
|
|
||||||
# http://www.mozilla.org/MPL/
|
|
||||||
#
|
#
|
||||||
# Software distributed under the License is distributed on an "AS IS"
|
# In order to be useful for every potential user, curl and libcurl are
|
||||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
# dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
# License for the specific language governing rights and limitations
|
|
||||||
# under the License.
|
|
||||||
#
|
#
|
||||||
# The Original Code is Curl.
|
# 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 MPL or the MIT/X-derivate
|
||||||
|
# licenses. You may pick one of these licenses.
|
||||||
#
|
#
|
||||||
# The Initial Developer of the Original Code is Daniel Stenberg.
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
# KIND, either express or implied.
|
||||||
#
|
#
|
||||||
# Portions created by the Initial Developer are Copyright (C) 1999.
|
# $Id$
|
||||||
# All Rights Reserved.
|
#############################################################################
|
||||||
#
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Main author:
|
|
||||||
# - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
#
|
|
||||||
# http://curl.haxx.se
|
|
||||||
#
|
|
||||||
# $Source$
|
|
||||||
# $Revision$
|
|
||||||
# $Date$
|
|
||||||
# $Author$
|
|
||||||
# $State$
|
|
||||||
# $Locker$
|
|
||||||
#
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# In a normal unix-setup, this file will become overwritten.
|
|
||||||
#
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
all:
|
all:
|
||||||
./configure
|
./configure
|
||||||
@@ -49,6 +29,10 @@ ssl:
|
|||||||
./configure --with-ssl
|
./configure --with-ssl
|
||||||
make
|
make
|
||||||
|
|
||||||
|
borland:
|
||||||
|
cd lib; make -f Makefile.b32
|
||||||
|
cd src; make -f Makefile.b32
|
||||||
|
|
||||||
mingw32:
|
mingw32:
|
||||||
cd lib; make -f Makefile.m32
|
cd lib; make -f Makefile.m32
|
||||||
cd src; make -f Makefile.m32
|
cd src; make -f Makefile.m32
|
||||||
@@ -58,8 +42,16 @@ mingw32-ssl:
|
|||||||
cd src; make -f Makefile.m32 SSL=1
|
cd src; make -f Makefile.m32 SSL=1
|
||||||
|
|
||||||
vc:
|
vc:
|
||||||
cd lib; nmake -f Makefile.vc6
|
cd lib
|
||||||
cd src; nmake -f Makefile.vc6
|
nmake -f Makefile.vc6
|
||||||
|
cd ..\src
|
||||||
|
nmake -f Makefile.vc6
|
||||||
|
|
||||||
|
vc-ssl:
|
||||||
|
cd lib
|
||||||
|
nmake -f Makefile.vc6 release-ssl
|
||||||
|
cd ..\src
|
||||||
|
nmake -f Makefile.vc6
|
||||||
|
|
||||||
cygwin:
|
cygwin:
|
||||||
./configure
|
./configure
|
||||||
|
|||||||
10
README
10
README
@@ -8,15 +8,17 @@ README
|
|||||||
|
|
||||||
Curl is a command line tool for transfering data specified with URL
|
Curl is a command line tool for transfering data specified with URL
|
||||||
syntax. Find out how to use Curl by reading the curl.1 man page or the
|
syntax. Find out how to use Curl by reading the curl.1 man page or the
|
||||||
README.curl document. Find out how to install Curl by reading the INSTALL
|
MANUAL document. Find out how to install Curl by reading the INSTALL
|
||||||
document.
|
document.
|
||||||
|
|
||||||
libcurl is a library that Curl is using to do its job. It is readily
|
libcurl is a library that Curl is using to do its job. It is readily
|
||||||
available to be used by your software. Read the README.libcurl document to
|
available to be used by your software. Read the LIBCURL document to
|
||||||
find out how!
|
find out how!
|
||||||
|
|
||||||
You find answers to the most frequent questions we get in the FAQ document.
|
You find answers to the most frequent questions we get in the FAQ document.
|
||||||
|
|
||||||
|
Study the LEGAL file for distribution terms and similar.
|
||||||
|
|
||||||
Always try the Curl web site for the latest news:
|
Always try the Curl web site for the latest news:
|
||||||
|
|
||||||
http://curl.haxx.se
|
http://curl.haxx.se
|
||||||
@@ -41,3 +43,7 @@ README
|
|||||||
cvs -d :pserver:anonymous@cvs.curl.sourceforge.net:/cvsroot/curl logout
|
cvs -d :pserver:anonymous@cvs.curl.sourceforge.net:/cvsroot/curl logout
|
||||||
|
|
||||||
(you're off the hook!)
|
(you're off the hook!)
|
||||||
|
|
||||||
|
Curl contains pieces of source code that is Copyright (c) 1998, 1999
|
||||||
|
Kungliga Tekniska H<>gskolan. This notice is included here to comply with the
|
||||||
|
distribution terms.
|
||||||
|
|||||||
@@ -33,3 +33,9 @@
|
|||||||
|
|
||||||
/* Define if you need the _REENTRANT define for some functions */
|
/* Define if you need the _REENTRANT define for some functions */
|
||||||
#undef NEED_REENTRANT
|
#undef NEED_REENTRANT
|
||||||
|
|
||||||
|
/* Define if you have the Kerberos4 libraries (including -ldes) */
|
||||||
|
#undef KRB4
|
||||||
|
|
||||||
|
/* Define if you want to enable IPv6 support */
|
||||||
|
#undef ENABLE_IPV6
|
||||||
|
|||||||
616
aclocal.m4
vendored
616
aclocal.m4
vendored
@@ -1,616 +0,0 @@
|
|||||||
dnl aclocal.m4 generated automatically by aclocal 1.4
|
|
||||||
|
|
||||||
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
|
||||||
dnl This file is free software; the Free Software Foundation
|
|
||||||
dnl gives unlimited permission to copy and/or distribute it,
|
|
||||||
dnl with or without modifications, as long as this notice is preserved.
|
|
||||||
|
|
||||||
dnl This program is distributed in the hope that it will be useful,
|
|
||||||
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
|
||||||
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
||||||
dnl PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
#serial 12
|
|
||||||
|
|
||||||
dnl By default, many hosts won't let programs access large files;
|
|
||||||
dnl one must use special compiler options to get large-file access to work.
|
|
||||||
dnl For more details about this brain damage please see:
|
|
||||||
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
|
|
||||||
|
|
||||||
dnl Written by Paul Eggert <eggert@twinsun.com>.
|
|
||||||
|
|
||||||
dnl Internal subroutine of AC_SYS_LARGEFILE.
|
|
||||||
dnl AC_SYS_LARGEFILE_TEST_INCLUDES
|
|
||||||
AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
|
|
||||||
[[#include <sys/types.h>
|
|
||||||
int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
|
|
||||||
]])
|
|
||||||
|
|
||||||
dnl Internal subroutine of AC_SYS_LARGEFILE.
|
|
||||||
dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY)
|
|
||||||
AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
|
|
||||||
[AC_CACHE_CHECK([for $1 value needed for large files], $3,
|
|
||||||
[$3=no
|
|
||||||
AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES
|
|
||||||
$5
|
|
||||||
,
|
|
||||||
[$6],
|
|
||||||
,
|
|
||||||
[AC_TRY_COMPILE([#define $1 $2]
|
|
||||||
AC_SYS_LARGEFILE_TEST_INCLUDES
|
|
||||||
$5
|
|
||||||
,
|
|
||||||
[$6],
|
|
||||||
[$3=$2])])])
|
|
||||||
if test "[$]$3" != no; then
|
|
||||||
AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
|
|
||||||
fi])
|
|
||||||
|
|
||||||
AC_DEFUN(AC_SYS_LARGEFILE,
|
|
||||||
[AC_ARG_ENABLE(largefile,
|
|
||||||
[ --disable-largefile omit support for large files])
|
|
||||||
if test "$enable_largefile" != no; then
|
|
||||||
|
|
||||||
AC_CACHE_CHECK([for special C compiler options needed for large files],
|
|
||||||
ac_cv_sys_largefile_CC,
|
|
||||||
[ac_cv_sys_largefile_CC=no
|
|
||||||
if test "$GCC" != yes; then
|
|
||||||
# IRIX 6.2 and later do not support large files by default,
|
|
||||||
# so use the C compiler's -n32 option if that helps.
|
|
||||||
AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , ,
|
|
||||||
[ac_save_CC="$CC"
|
|
||||||
CC="$CC -n32"
|
|
||||||
AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, ,
|
|
||||||
ac_cv_sys_largefile_CC=' -n32')
|
|
||||||
CC="$ac_save_CC"])
|
|
||||||
fi])
|
|
||||||
if test "$ac_cv_sys_largefile_CC" != no; then
|
|
||||||
CC="$CC$ac_cv_sys_largefile_CC"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
|
|
||||||
ac_cv_sys_file_offset_bits,
|
|
||||||
[Number of bits in a file offset, on hosts where this is settable.])
|
|
||||||
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
|
|
||||||
ac_cv_sys_largefile_source,
|
|
||||||
[Define to make ftello visible on some hosts (e.g. HP-UX 10.20).],
|
|
||||||
[#include <stdio.h>], [return !ftello;])
|
|
||||||
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
|
|
||||||
ac_cv_sys_large_files,
|
|
||||||
[Define for large files, on AIX-style hosts.])
|
|
||||||
dnl lftp does not need ftello, and _XOPEN_SOURCE=500 makes resolv.h fail.
|
|
||||||
dnl AC_SYS_LARGEFILE_MACRO_VALUE(_XOPEN_SOURCE, 500,
|
|
||||||
dnl ac_cv_sys_xopen_source,
|
|
||||||
dnl [Define to make ftello visible on some hosts (e.g. glibc 2.1.3).],
|
|
||||||
dnl [#include <stdio.h>], [return !ftello;])
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
# Like AC_CONFIG_HEADER, but automatically create stamp file.
|
|
||||||
|
|
||||||
AC_DEFUN(AM_CONFIG_HEADER,
|
|
||||||
[AC_PREREQ([2.12])
|
|
||||||
AC_CONFIG_HEADER([$1])
|
|
||||||
dnl When config.status generates a header, we must update the stamp-h file.
|
|
||||||
dnl This file resides in the same directory as the config header
|
|
||||||
dnl that is generated. We must strip everything past the first ":",
|
|
||||||
dnl and everything past the last "/".
|
|
||||||
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
|
|
||||||
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
|
|
||||||
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
|
|
||||||
<<am_indx=1
|
|
||||||
for am_file in <<$1>>; do
|
|
||||||
case " <<$>>CONFIG_HEADERS " in
|
|
||||||
*" <<$>>am_file "*<<)>>
|
|
||||||
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
am_indx=`expr "<<$>>am_indx" + 1`
|
|
||||||
done<<>>dnl>>)
|
|
||||||
changequote([,]))])
|
|
||||||
|
|
||||||
# Do all the work for Automake. This macro actually does too much --
|
|
||||||
# some checks are only needed if your package does certain things.
|
|
||||||
# But this isn't really a big deal.
|
|
||||||
|
|
||||||
# serial 1
|
|
||||||
|
|
||||||
dnl Usage:
|
|
||||||
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
|
||||||
|
|
||||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
|
||||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
|
||||||
PACKAGE=[$1]
|
|
||||||
AC_SUBST(PACKAGE)
|
|
||||||
VERSION=[$2]
|
|
||||||
AC_SUBST(VERSION)
|
|
||||||
dnl test to see if srcdir already configured
|
|
||||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
|
||||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
|
||||||
fi
|
|
||||||
ifelse([$3],,
|
|
||||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
|
||||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
|
|
||||||
AC_REQUIRE([AM_SANITY_CHECK])
|
|
||||||
AC_REQUIRE([AC_ARG_PROGRAM])
|
|
||||||
dnl FIXME This is truly gross.
|
|
||||||
missing_dir=`cd $ac_aux_dir && pwd`
|
|
||||||
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
|
|
||||||
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
|
|
||||||
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
|
|
||||||
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
|
|
||||||
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
|
|
||||||
AC_REQUIRE([AC_PROG_MAKE_SET])])
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check to make sure that the build environment is sane.
|
|
||||||
#
|
|
||||||
|
|
||||||
AC_DEFUN(AM_SANITY_CHECK,
|
|
||||||
[AC_MSG_CHECKING([whether build environment is sane])
|
|
||||||
# Just in case
|
|
||||||
sleep 1
|
|
||||||
echo timestamp > conftestfile
|
|
||||||
# Do `set' in a subshell so we don't clobber the current shell's
|
|
||||||
# arguments. Must try -L first in case configure is actually a
|
|
||||||
# symlink; some systems play weird games with the mod time of symlinks
|
|
||||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
|
||||||
# directory).
|
|
||||||
if (
|
|
||||||
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
|
|
||||||
if test "[$]*" = "X"; then
|
|
||||||
# -L didn't work.
|
|
||||||
set X `ls -t $srcdir/configure conftestfile`
|
|
||||||
fi
|
|
||||||
if test "[$]*" != "X $srcdir/configure conftestfile" \
|
|
||||||
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
|
|
||||||
|
|
||||||
# If neither matched, then we have a broken ls. This can happen
|
|
||||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
|
||||||
# broken ls alias from the environment. This has actually
|
|
||||||
# happened. Such a system could not be considered "sane".
|
|
||||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
|
||||||
alias in your environment])
|
|
||||||
fi
|
|
||||||
|
|
||||||
test "[$]2" = conftestfile
|
|
||||||
)
|
|
||||||
then
|
|
||||||
# Ok.
|
|
||||||
:
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
|
||||||
Check your system clock])
|
|
||||||
fi
|
|
||||||
rm -f conftest*
|
|
||||||
AC_MSG_RESULT(yes)])
|
|
||||||
|
|
||||||
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
|
|
||||||
dnl The program must properly implement --version.
|
|
||||||
AC_DEFUN(AM_MISSING_PROG,
|
|
||||||
[AC_MSG_CHECKING(for working $2)
|
|
||||||
# Run test in a subshell; some versions of sh will print an error if
|
|
||||||
# an executable is not found, even if stderr is redirected.
|
|
||||||
# Redirect stdin to placate older versions of autoconf. Sigh.
|
|
||||||
if ($2 --version) < /dev/null > /dev/null 2>&1; then
|
|
||||||
$1=$2
|
|
||||||
AC_MSG_RESULT(found)
|
|
||||||
else
|
|
||||||
$1="$3/missing $2"
|
|
||||||
AC_MSG_RESULT(missing)
|
|
||||||
fi
|
|
||||||
AC_SUBST($1)])
|
|
||||||
|
|
||||||
|
|
||||||
# serial 40 AC_PROG_LIBTOOL
|
|
||||||
AC_DEFUN(AC_PROG_LIBTOOL,
|
|
||||||
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
|
|
||||||
|
|
||||||
# Save cache, so that ltconfig can load it
|
|
||||||
AC_CACHE_SAVE
|
|
||||||
|
|
||||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
|
||||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
|
||||||
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
|
|
||||||
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
|
|
||||||
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
|
|
||||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
|
||||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|
|
||||||
|| AC_MSG_ERROR([libtool configure failed])
|
|
||||||
|
|
||||||
# Reload cache, that may have been modified by ltconfig
|
|
||||||
AC_CACHE_LOAD
|
|
||||||
|
|
||||||
# This can be used to rebuild libtool when needed
|
|
||||||
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
|
|
||||||
|
|
||||||
# Always use our own libtool.
|
|
||||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
|
||||||
AC_SUBST(LIBTOOL)dnl
|
|
||||||
|
|
||||||
# Redirect the config.log output again, so that the ltconfig log is not
|
|
||||||
# clobbered by the next message.
|
|
||||||
exec 5>>./config.log
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN(AC_LIBTOOL_SETUP,
|
|
||||||
[AC_PREREQ(2.13)dnl
|
|
||||||
AC_REQUIRE([AC_ENABLE_SHARED])dnl
|
|
||||||
AC_REQUIRE([AC_ENABLE_STATIC])dnl
|
|
||||||
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
|
|
||||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
|
||||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
|
||||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
|
||||||
AC_REQUIRE([AC_PROG_CC])dnl
|
|
||||||
AC_REQUIRE([AC_PROG_LD])dnl
|
|
||||||
AC_REQUIRE([AC_PROG_NM])dnl
|
|
||||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
|
||||||
dnl
|
|
||||||
|
|
||||||
case "$target" in
|
|
||||||
NONE) lt_target="$host" ;;
|
|
||||||
*) lt_target="$target" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Check for any special flags to pass to ltconfig.
|
|
||||||
libtool_flags="--cache-file=$cache_file"
|
|
||||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
|
||||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
|
||||||
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
|
|
||||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
|
||||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
|
||||||
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
|
|
||||||
[libtool_flags="$libtool_flags --enable-dlopen"])
|
|
||||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
|
||||||
[libtool_flags="$libtool_flags --enable-win32-dll"])
|
|
||||||
AC_ARG_ENABLE(libtool-lock,
|
|
||||||
[ --disable-libtool-lock avoid locking (might break parallel builds)])
|
|
||||||
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
|
|
||||||
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
|
|
||||||
|
|
||||||
# Some flags need to be propagated to the compiler or linker for good
|
|
||||||
# libtool support.
|
|
||||||
case "$lt_target" in
|
|
||||||
*-*-irix6*)
|
|
||||||
# Find out which ABI we are using.
|
|
||||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
|
||||||
if AC_TRY_EVAL(ac_compile); then
|
|
||||||
case "`/usr/bin/file conftest.o`" in
|
|
||||||
*32-bit*)
|
|
||||||
LD="${LD-ld} -32"
|
|
||||||
;;
|
|
||||||
*N32*)
|
|
||||||
LD="${LD-ld} -n32"
|
|
||||||
;;
|
|
||||||
*64-bit*)
|
|
||||||
LD="${LD-ld} -64"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
rm -rf conftest*
|
|
||||||
;;
|
|
||||||
|
|
||||||
*-*-sco3.2v5*)
|
|
||||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
|
||||||
SAVE_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CFLAGS -belf"
|
|
||||||
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
|
|
||||||
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
|
|
||||||
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
|
|
||||||
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
|
|
||||||
CFLAGS="$SAVE_CFLAGS"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
|
||||||
[*-*-cygwin* | *-*-mingw*)
|
|
||||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
|
||||||
AC_CHECK_TOOL(AS, as, false)
|
|
||||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
|
||||||
;;
|
|
||||||
])
|
|
||||||
esac
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
|
|
||||||
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
|
|
||||||
|
|
||||||
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
|
|
||||||
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
|
|
||||||
|
|
||||||
# AC_ENABLE_SHARED - implement the --enable-shared flag
|
|
||||||
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
|
|
||||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
|
||||||
# `yes'.
|
|
||||||
AC_DEFUN(AC_ENABLE_SHARED, [dnl
|
|
||||||
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
|
||||||
AC_ARG_ENABLE(shared,
|
|
||||||
changequote(<<, >>)dnl
|
|
||||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
|
||||||
changequote([, ])dnl
|
|
||||||
[p=${PACKAGE-default}
|
|
||||||
case "$enableval" in
|
|
||||||
yes) enable_shared=yes ;;
|
|
||||||
no) enable_shared=no ;;
|
|
||||||
*)
|
|
||||||
enable_shared=no
|
|
||||||
# Look at the argument we got. We use all the common list separators.
|
|
||||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
|
||||||
for pkg in $enableval; do
|
|
||||||
if test "X$pkg" = "X$p"; then
|
|
||||||
enable_shared=yes
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS="$ac_save_ifs"
|
|
||||||
;;
|
|
||||||
esac],
|
|
||||||
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
|
|
||||||
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
|
||||||
AC_ENABLE_SHARED(no)])
|
|
||||||
|
|
||||||
# AC_ENABLE_STATIC - implement the --enable-static flag
|
|
||||||
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
|
|
||||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
|
||||||
# `yes'.
|
|
||||||
AC_DEFUN(AC_ENABLE_STATIC, [dnl
|
|
||||||
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
|
||||||
AC_ARG_ENABLE(static,
|
|
||||||
changequote(<<, >>)dnl
|
|
||||||
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
|
||||||
changequote([, ])dnl
|
|
||||||
[p=${PACKAGE-default}
|
|
||||||
case "$enableval" in
|
|
||||||
yes) enable_static=yes ;;
|
|
||||||
no) enable_static=no ;;
|
|
||||||
*)
|
|
||||||
enable_static=no
|
|
||||||
# Look at the argument we got. We use all the common list separators.
|
|
||||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
|
||||||
for pkg in $enableval; do
|
|
||||||
if test "X$pkg" = "X$p"; then
|
|
||||||
enable_static=yes
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS="$ac_save_ifs"
|
|
||||||
;;
|
|
||||||
esac],
|
|
||||||
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_DISABLE_STATIC - set the default static flag to --disable-static
|
|
||||||
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
|
||||||
AC_ENABLE_STATIC(no)])
|
|
||||||
|
|
||||||
|
|
||||||
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
|
|
||||||
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
|
|
||||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
|
||||||
# `yes'.
|
|
||||||
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
|
|
||||||
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
|
|
||||||
AC_ARG_ENABLE(fast-install,
|
|
||||||
changequote(<<, >>)dnl
|
|
||||||
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
|
|
||||||
changequote([, ])dnl
|
|
||||||
[p=${PACKAGE-default}
|
|
||||||
case "$enableval" in
|
|
||||||
yes) enable_fast_install=yes ;;
|
|
||||||
no) enable_fast_install=no ;;
|
|
||||||
*)
|
|
||||||
enable_fast_install=no
|
|
||||||
# Look at the argument we got. We use all the common list separators.
|
|
||||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
|
||||||
for pkg in $enableval; do
|
|
||||||
if test "X$pkg" = "X$p"; then
|
|
||||||
enable_fast_install=yes
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS="$ac_save_ifs"
|
|
||||||
;;
|
|
||||||
esac],
|
|
||||||
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
|
|
||||||
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
|
||||||
AC_ENABLE_FAST_INSTALL(no)])
|
|
||||||
|
|
||||||
# AC_PROG_LD - find the path to the GNU or non-GNU linker
|
|
||||||
AC_DEFUN(AC_PROG_LD,
|
|
||||||
[AC_ARG_WITH(gnu-ld,
|
|
||||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
|
||||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
|
||||||
AC_REQUIRE([AC_PROG_CC])dnl
|
|
||||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
|
||||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
|
||||||
ac_prog=ld
|
|
||||||
if test "$ac_cv_prog_gcc" = yes; then
|
|
||||||
# Check if gcc -print-prog-name=ld gives a path.
|
|
||||||
AC_MSG_CHECKING([for ld used by GCC])
|
|
||||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
|
||||||
case "$ac_prog" in
|
|
||||||
# Accept absolute paths.
|
|
||||||
changequote(,)dnl
|
|
||||||
[\\/]* | [A-Za-z]:[\\/]*)
|
|
||||||
re_direlt='/[^/][^/]*/\.\./'
|
|
||||||
changequote([,])dnl
|
|
||||||
# Canonicalize the path of ld
|
|
||||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
|
||||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
|
||||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
|
||||||
done
|
|
||||||
test -z "$LD" && LD="$ac_prog"
|
|
||||||
;;
|
|
||||||
"")
|
|
||||||
# If it fails, then pretend we aren't using GCC.
|
|
||||||
ac_prog=ld
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# If it is relative, then search for the first ld in PATH.
|
|
||||||
with_gnu_ld=unknown
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
elif test "$with_gnu_ld" = yes; then
|
|
||||||
AC_MSG_CHECKING([for GNU ld])
|
|
||||||
else
|
|
||||||
AC_MSG_CHECKING([for non-GNU ld])
|
|
||||||
fi
|
|
||||||
AC_CACHE_VAL(ac_cv_path_LD,
|
|
||||||
[if test -z "$LD"; then
|
|
||||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
|
||||||
for ac_dir in $PATH; do
|
|
||||||
test -z "$ac_dir" && ac_dir=.
|
|
||||||
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
|
||||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
|
||||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
|
||||||
# but apparently some GNU ld's only accept -v.
|
|
||||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
|
||||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
|
||||||
test "$with_gnu_ld" != no && break
|
|
||||||
else
|
|
||||||
test "$with_gnu_ld" != yes && break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS="$ac_save_ifs"
|
|
||||||
else
|
|
||||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
|
||||||
fi])
|
|
||||||
LD="$ac_cv_path_LD"
|
|
||||||
if test -n "$LD"; then
|
|
||||||
AC_MSG_RESULT($LD)
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
fi
|
|
||||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
|
||||||
AC_PROG_LD_GNU
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN(AC_PROG_LD_GNU,
|
|
||||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
|
||||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
|
||||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
|
||||||
ac_cv_prog_gnu_ld=yes
|
|
||||||
else
|
|
||||||
ac_cv_prog_gnu_ld=no
|
|
||||||
fi])
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_PROG_NM - find the path to a BSD-compatible name lister
|
|
||||||
AC_DEFUN(AC_PROG_NM,
|
|
||||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
|
||||||
AC_CACHE_VAL(ac_cv_path_NM,
|
|
||||||
[if test -n "$NM"; then
|
|
||||||
# Let the user override the test.
|
|
||||||
ac_cv_path_NM="$NM"
|
|
||||||
else
|
|
||||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
|
||||||
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
|
|
||||||
test -z "$ac_dir" && ac_dir=.
|
|
||||||
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
|
|
||||||
# Check to see if the nm accepts a BSD-compat flag.
|
|
||||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
|
||||||
# nm: unknown option "B" ignored
|
|
||||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
|
||||||
ac_cv_path_NM="$ac_dir/nm -B"
|
|
||||||
break
|
|
||||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
|
||||||
ac_cv_path_NM="$ac_dir/nm -p"
|
|
||||||
break
|
|
||||||
else
|
|
||||||
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
|
|
||||||
continue # so that we can try to find one that supports BSD flags
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS="$ac_save_ifs"
|
|
||||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
|
||||||
fi])
|
|
||||||
NM="$ac_cv_path_NM"
|
|
||||||
AC_MSG_RESULT([$NM])
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_CHECK_LIBM - check for math library
|
|
||||||
AC_DEFUN(AC_CHECK_LIBM,
|
|
||||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
|
||||||
LIBM=
|
|
||||||
case "$lt_target" in
|
|
||||||
*-*-beos* | *-*-cygwin*)
|
|
||||||
# These system don't have libm
|
|
||||||
;;
|
|
||||||
*-ncr-sysv4.3*)
|
|
||||||
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
|
|
||||||
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AC_CHECK_LIB(m, main, LIBM="-lm")
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
|
|
||||||
# the libltdl convenience library and INCLTDL to the include flags for
|
|
||||||
# the libltdl header and adds --enable-ltdl-convenience to the
|
|
||||||
# configure arguments. Note that LIBLTDL and INCLTDL are not
|
|
||||||
# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
|
|
||||||
# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
|
|
||||||
# with '${top_builddir}/' and INCLTDL will be prefixed with
|
|
||||||
# '${top_srcdir}/' (note the single quotes!). If your package is not
|
|
||||||
# flat and you're not using automake, define top_builddir and
|
|
||||||
# top_srcdir appropriately in the Makefiles.
|
|
||||||
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
|
||||||
case "$enable_ltdl_convenience" in
|
|
||||||
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
|
|
||||||
"") enable_ltdl_convenience=yes
|
|
||||||
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
|
|
||||||
esac
|
|
||||||
LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
|
|
||||||
INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
|
|
||||||
])
|
|
||||||
|
|
||||||
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
|
|
||||||
# the libltdl installable library and INCLTDL to the include flags for
|
|
||||||
# the libltdl header and adds --enable-ltdl-install to the configure
|
|
||||||
# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
|
|
||||||
# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
|
|
||||||
# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
|
|
||||||
# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
|
|
||||||
# with '${top_srcdir}/' (note the single quotes!). If your package is
|
|
||||||
# not flat and you're not using automake, define top_builddir and
|
|
||||||
# top_srcdir appropriately in the Makefiles.
|
|
||||||
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
|
|
||||||
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
|
||||||
AC_CHECK_LIB(ltdl, main,
|
|
||||||
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
|
|
||||||
[if test x"$enable_ltdl_install" = xno; then
|
|
||||||
AC_MSG_WARN([libltdl not installed, but installation disabled])
|
|
||||||
else
|
|
||||||
enable_ltdl_install=yes
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
if test x"$enable_ltdl_install" = x"yes"; then
|
|
||||||
ac_configure_args="$ac_configure_args --enable-ltdl-install"
|
|
||||||
LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
|
|
||||||
INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
|
|
||||||
else
|
|
||||||
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
|
|
||||||
LIBLTDL="-lltdl"
|
|
||||||
INCLTDL=
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl old names
|
|
||||||
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
|
|
||||||
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
|
|
||||||
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
|
|
||||||
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
|
|
||||||
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
|
|
||||||
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
|
|
||||||
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
|
|
||||||
|
|
||||||
dnl This is just to silence aclocal about the macro not being used
|
|
||||||
ifelse([AC_DISABLE_FAST_INSTALL])dnl
|
|
||||||
|
|
||||||
288
config.h.in
288
config.h.in
@@ -1,288 +0,0 @@
|
|||||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
|
||||||
|
|
||||||
/* Define if on AIX 3.
|
|
||||||
System headers sometimes define this.
|
|
||||||
We just want to avoid a redefinition error message. */
|
|
||||||
#ifndef _ALL_SOURCE
|
|
||||||
#undef _ALL_SOURCE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define to empty if the keyword does not work. */
|
|
||||||
#undef const
|
|
||||||
|
|
||||||
/* Define as the return type of signal handlers (int or void). */
|
|
||||||
#undef RETSIGTYPE
|
|
||||||
|
|
||||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
|
||||||
#undef size_t
|
|
||||||
|
|
||||||
/* Define if you have the ANSI C header files. */
|
|
||||||
#undef STDC_HEADERS
|
|
||||||
|
|
||||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
|
||||||
#undef TIME_WITH_SYS_TIME
|
|
||||||
|
|
||||||
/* Define cpu-machine-OS */
|
|
||||||
#undef OS
|
|
||||||
|
|
||||||
/* Define if you have the gethostbyaddr_r() function with 5 arguments */
|
|
||||||
#undef HAVE_GETHOSTBYADDR_R_5
|
|
||||||
|
|
||||||
/* Define if you have the gethostbyaddr_r() function with 7 arguments */
|
|
||||||
#undef HAVE_GETHOSTBYADDR_R_7
|
|
||||||
|
|
||||||
/* Define if you have the gethostbyaddr_r() function with 8 arguments */
|
|
||||||
#undef HAVE_GETHOSTBYADDR_R_8
|
|
||||||
|
|
||||||
/* Define if you have the gethostbyname_r() function with 3 arguments */
|
|
||||||
#undef HAVE_GETHOSTBYNAME_R_3
|
|
||||||
|
|
||||||
/* Define if you have the gethostbyname_r() function with 5 arguments */
|
|
||||||
#undef HAVE_GETHOSTBYNAME_R_5
|
|
||||||
|
|
||||||
/* Define if you have the gethostbyname_r() function with 6 arguments */
|
|
||||||
#undef HAVE_GETHOSTBYNAME_R_6
|
|
||||||
|
|
||||||
/* Define if you have the inet_ntoa_r function declared. */
|
|
||||||
#undef HAVE_INET_NTOA_R_DECL
|
|
||||||
|
|
||||||
/* Define if you need the _REENTRANT define for some functions */
|
|
||||||
#undef NEED_REENTRANT
|
|
||||||
|
|
||||||
/* The number of bytes in a long double. */
|
|
||||||
#undef SIZEOF_LONG_DOUBLE
|
|
||||||
|
|
||||||
/* The number of bytes in a long long. */
|
|
||||||
#undef SIZEOF_LONG_LONG
|
|
||||||
|
|
||||||
/* Define if you have the RAND_screen function. */
|
|
||||||
#undef HAVE_RAND_SCREEN
|
|
||||||
|
|
||||||
/* Define if you have the RAND_status function. */
|
|
||||||
#undef HAVE_RAND_STATUS
|
|
||||||
|
|
||||||
/* Define if you have the closesocket function. */
|
|
||||||
#undef HAVE_CLOSESOCKET
|
|
||||||
|
|
||||||
/* Define if you have the gethostbyaddr function. */
|
|
||||||
#undef HAVE_GETHOSTBYADDR
|
|
||||||
|
|
||||||
/* Define if you have the gethostbyaddr_r function. */
|
|
||||||
#undef HAVE_GETHOSTBYADDR_R
|
|
||||||
|
|
||||||
/* Define if you have the gethostbyname_r function. */
|
|
||||||
#undef HAVE_GETHOSTBYNAME_R
|
|
||||||
|
|
||||||
/* Define if you have the gethostname function. */
|
|
||||||
#undef HAVE_GETHOSTNAME
|
|
||||||
|
|
||||||
/* Define if you have the getpass function. */
|
|
||||||
#undef HAVE_GETPASS
|
|
||||||
|
|
||||||
/* Define if you have the getservbyname function. */
|
|
||||||
#undef HAVE_GETSERVBYNAME
|
|
||||||
|
|
||||||
/* Define if you have the gettimeofday function. */
|
|
||||||
#undef HAVE_GETTIMEOFDAY
|
|
||||||
|
|
||||||
/* Define if you have the inet_addr function. */
|
|
||||||
#undef HAVE_INET_ADDR
|
|
||||||
|
|
||||||
/* Define if you have the inet_ntoa function. */
|
|
||||||
#undef HAVE_INET_NTOA
|
|
||||||
|
|
||||||
/* Define if you have the inet_ntoa_r function. */
|
|
||||||
#undef HAVE_INET_NTOA_R
|
|
||||||
|
|
||||||
/* Define if you have the localtime_r function. */
|
|
||||||
#undef HAVE_LOCALTIME_R
|
|
||||||
|
|
||||||
/* Define if you have the perror function. */
|
|
||||||
#undef HAVE_PERROR
|
|
||||||
|
|
||||||
/* Define if you have the select function. */
|
|
||||||
#undef HAVE_SELECT
|
|
||||||
|
|
||||||
/* Define if you have the setvbuf function. */
|
|
||||||
#undef HAVE_SETVBUF
|
|
||||||
|
|
||||||
/* Define if you have the socket function. */
|
|
||||||
#undef HAVE_SOCKET
|
|
||||||
|
|
||||||
/* Define if you have the strcasecmp function. */
|
|
||||||
#undef HAVE_STRCASECMP
|
|
||||||
|
|
||||||
/* Define if you have the strcmpi function. */
|
|
||||||
#undef HAVE_STRCMPI
|
|
||||||
|
|
||||||
/* Define if you have the strdup function. */
|
|
||||||
#undef HAVE_STRDUP
|
|
||||||
|
|
||||||
/* Define if you have the strftime function. */
|
|
||||||
#undef HAVE_STRFTIME
|
|
||||||
|
|
||||||
/* Define if you have the stricmp function. */
|
|
||||||
#undef HAVE_STRICMP
|
|
||||||
|
|
||||||
/* Define if you have the strstr function. */
|
|
||||||
#undef HAVE_STRSTR
|
|
||||||
|
|
||||||
/* Define if you have the tcgetattr function. */
|
|
||||||
#undef HAVE_TCGETATTR
|
|
||||||
|
|
||||||
/* Define if you have the tcsetattr function. */
|
|
||||||
#undef HAVE_TCSETATTR
|
|
||||||
|
|
||||||
/* Define if you have the uname function. */
|
|
||||||
#undef HAVE_UNAME
|
|
||||||
|
|
||||||
/* Define if you have the <alloca.h> header file. */
|
|
||||||
#undef HAVE_ALLOCA_H
|
|
||||||
|
|
||||||
/* Define if you have the <arpa/inet.h> header file. */
|
|
||||||
#undef HAVE_ARPA_INET_H
|
|
||||||
|
|
||||||
/* Define if you have the <crypto.h> header file. */
|
|
||||||
#undef HAVE_CRYPTO_H
|
|
||||||
|
|
||||||
/* Define if you have the <dlfcn.h> header file. */
|
|
||||||
#undef HAVE_DLFCN_H
|
|
||||||
|
|
||||||
/* Define if you have the <err.h> header file. */
|
|
||||||
#undef HAVE_ERR_H
|
|
||||||
|
|
||||||
/* Define if you have the <fcntl.h> header file. */
|
|
||||||
#undef HAVE_FCNTL_H
|
|
||||||
|
|
||||||
/* Define if you have the <getopt.h> header file. */
|
|
||||||
#undef HAVE_GETOPT_H
|
|
||||||
|
|
||||||
/* Define if you have the <io.h> header file. */
|
|
||||||
#undef HAVE_IO_H
|
|
||||||
|
|
||||||
/* Define if you have the <malloc.h> header file. */
|
|
||||||
#undef HAVE_MALLOC_H
|
|
||||||
|
|
||||||
/* Define if you have the <net/if.h> header file. */
|
|
||||||
#undef HAVE_NET_IF_H
|
|
||||||
|
|
||||||
/* Define if you have the <netdb.h> header file. */
|
|
||||||
#undef HAVE_NETDB_H
|
|
||||||
|
|
||||||
/* Define if you have the <netinet/if_ether.h> header file. */
|
|
||||||
#undef HAVE_NETINET_IF_ETHER_H
|
|
||||||
|
|
||||||
/* Define if you have the <netinet/in.h> header file. */
|
|
||||||
#undef HAVE_NETINET_IN_H
|
|
||||||
|
|
||||||
/* Define if you have the <openssl/crypto.h> header file. */
|
|
||||||
#undef HAVE_OPENSSL_CRYPTO_H
|
|
||||||
|
|
||||||
/* Define if you have the <openssl/err.h> header file. */
|
|
||||||
#undef HAVE_OPENSSL_ERR_H
|
|
||||||
|
|
||||||
/* Define if you have the <openssl/pem.h> header file. */
|
|
||||||
#undef HAVE_OPENSSL_PEM_H
|
|
||||||
|
|
||||||
/* Define if you have the <openssl/rsa.h> header file. */
|
|
||||||
#undef HAVE_OPENSSL_RSA_H
|
|
||||||
|
|
||||||
/* Define if you have the <openssl/ssl.h> header file. */
|
|
||||||
#undef HAVE_OPENSSL_SSL_H
|
|
||||||
|
|
||||||
/* Define if you have the <openssl/x509.h> header file. */
|
|
||||||
#undef HAVE_OPENSSL_X509_H
|
|
||||||
|
|
||||||
/* Define if you have the <pem.h> header file. */
|
|
||||||
#undef HAVE_PEM_H
|
|
||||||
|
|
||||||
/* Define if you have the <rsa.h> header file. */
|
|
||||||
#undef HAVE_RSA_H
|
|
||||||
|
|
||||||
/* Define if you have the <sgtty.h> header file. */
|
|
||||||
#undef HAVE_SGTTY_H
|
|
||||||
|
|
||||||
/* Define if you have the <ssl.h> header file. */
|
|
||||||
#undef HAVE_SSL_H
|
|
||||||
|
|
||||||
/* Define if you have the <stdlib.h> header file. */
|
|
||||||
#undef HAVE_STDLIB_H
|
|
||||||
|
|
||||||
/* Define if you have the <sys/param.h> header file. */
|
|
||||||
#undef HAVE_SYS_PARAM_H
|
|
||||||
|
|
||||||
/* Define if you have the <sys/select.h> header file. */
|
|
||||||
#undef HAVE_SYS_SELECT_H
|
|
||||||
|
|
||||||
/* Define if you have the <sys/socket.h> header file. */
|
|
||||||
#undef HAVE_SYS_SOCKET_H
|
|
||||||
|
|
||||||
/* Define if you have the <sys/sockio.h> header file. */
|
|
||||||
#undef HAVE_SYS_SOCKIO_H
|
|
||||||
|
|
||||||
/* Define if you have the <sys/stat.h> header file. */
|
|
||||||
#undef HAVE_SYS_STAT_H
|
|
||||||
|
|
||||||
/* Define if you have the <sys/time.h> header file. */
|
|
||||||
#undef HAVE_SYS_TIME_H
|
|
||||||
|
|
||||||
/* Define if you have the <sys/types.h> header file. */
|
|
||||||
#undef HAVE_SYS_TYPES_H
|
|
||||||
|
|
||||||
/* Define if you have the <termio.h> header file. */
|
|
||||||
#undef HAVE_TERMIO_H
|
|
||||||
|
|
||||||
/* Define if you have the <termios.h> header file. */
|
|
||||||
#undef HAVE_TERMIOS_H
|
|
||||||
|
|
||||||
/* Define if you have the <time.h> header file. */
|
|
||||||
#undef HAVE_TIME_H
|
|
||||||
|
|
||||||
/* Define if you have the <unistd.h> header file. */
|
|
||||||
#undef HAVE_UNISTD_H
|
|
||||||
|
|
||||||
/* Define if you have the <winsock.h> header file. */
|
|
||||||
#undef HAVE_WINSOCK_H
|
|
||||||
|
|
||||||
/* Define if you have the <x509.h> header file. */
|
|
||||||
#undef HAVE_X509_H
|
|
||||||
|
|
||||||
/* Define if you have the crypto library (-lcrypto). */
|
|
||||||
#undef HAVE_LIBCRYPTO
|
|
||||||
|
|
||||||
/* Define if you have the dl library (-ldl). */
|
|
||||||
#undef HAVE_LIBDL
|
|
||||||
|
|
||||||
/* Define if you have the nsl library (-lnsl). */
|
|
||||||
#undef HAVE_LIBNSL
|
|
||||||
|
|
||||||
/* Define if you have the resolve library (-lresolve). */
|
|
||||||
#undef HAVE_LIBRESOLVE
|
|
||||||
|
|
||||||
/* Define if you have the socket library (-lsocket). */
|
|
||||||
#undef HAVE_LIBSOCKET
|
|
||||||
|
|
||||||
/* Define if you have the ssl library (-lssl). */
|
|
||||||
#undef HAVE_LIBSSL
|
|
||||||
|
|
||||||
/* Define if you have the ucb library (-lucb). */
|
|
||||||
#undef HAVE_LIBUCB
|
|
||||||
|
|
||||||
/* Name of package */
|
|
||||||
#undef PACKAGE
|
|
||||||
|
|
||||||
/* Version number of package */
|
|
||||||
#undef VERSION
|
|
||||||
|
|
||||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
|
||||||
#undef _FILE_OFFSET_BITS
|
|
||||||
|
|
||||||
/* Define to make ftello visible on some hosts (e.g. HP-UX 10.20). */
|
|
||||||
#undef _LARGEFILE_SOURCE
|
|
||||||
|
|
||||||
/* Define for large files, on AIX-style hosts. */
|
|
||||||
#undef _LARGE_FILES
|
|
||||||
|
|
||||||
/* Set to explicitly specify we don't want to use thread-safe functions */
|
|
||||||
#undef DISABLED_THREADSAFE
|
|
||||||
|
|
||||||
676
configure.in
676
configure.in
@@ -2,7 +2,9 @@ dnl $Id$
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_INIT(lib/urldata.h)
|
AC_INIT(lib/urldata.h)
|
||||||
AM_CONFIG_HEADER(config.h src/config.h)
|
AM_CONFIG_HEADER(config.h src/config.h)
|
||||||
AM_INIT_AUTOMAKE(curl,"7.2")
|
|
||||||
|
VERSION=`sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curl.h`
|
||||||
|
AM_INIT_AUTOMAKE(curl,$VERSION)
|
||||||
AM_PROG_LIBTOOL
|
AM_PROG_LIBTOOL
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
@@ -24,148 +26,126 @@ dnl The install stuff has already been taken care of by the automake stuff
|
|||||||
dnl AC_PROG_INSTALL
|
dnl AC_PROG_INSTALL
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
|
|
||||||
|
AC_DEFUN(CURL_CHECK_LOCALTIME_R,
|
||||||
|
[
|
||||||
|
dnl check for a few thread-safe functions
|
||||||
|
AC_CHECK_FUNCS(localtime_r,[
|
||||||
|
AC_MSG_CHECKING(whether localtime_r is declared)
|
||||||
|
AC_EGREP_CPP(localtime_r,[
|
||||||
|
#include <time.h>],[
|
||||||
|
AC_MSG_RESULT(yes)],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
|
||||||
|
AC_EGREP_CPP(localtime_r,[
|
||||||
|
#define _REENTRANT
|
||||||
|
#include <time.h>],[
|
||||||
|
AC_DEFINE(NEED_REENTRANT)
|
||||||
|
AC_MSG_RESULT(yes)],
|
||||||
|
AC_MSG_RESULT(no))])])
|
||||||
|
])
|
||||||
|
|
||||||
dnl **********************************************************************
|
AC_DEFUN(CURL_CHECK_INET_NTOA_R,
|
||||||
dnl Checks for libraries.
|
[
|
||||||
dnl **********************************************************************
|
dnl determine if function definition for inet_ntoa_r exists.
|
||||||
|
AC_CHECK_FUNCS(inet_ntoa_r,[
|
||||||
|
AC_MSG_CHECKING(whether inet_ntoa_r is declared)
|
||||||
|
AC_EGREP_CPP(inet_ntoa_r,[
|
||||||
|
#include <arpa/inet.h>],[
|
||||||
|
AC_DEFINE(HAVE_INET_NTOA_R_DECL)
|
||||||
|
AC_MSG_RESULT(yes)],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared)
|
||||||
|
AC_EGREP_CPP(inet_ntoa_r,[
|
||||||
|
#define _REENTRANT
|
||||||
|
#include <arpa/inet.h>],[
|
||||||
|
AC_DEFINE(HAVE_INET_NTOA_R_DECL)
|
||||||
|
AC_DEFINE(NEED_REENTRANT)
|
||||||
|
AC_MSG_RESULT(yes)],
|
||||||
|
AC_MSG_RESULT(no))])])
|
||||||
|
|
||||||
dnl nsl lib?
|
])
|
||||||
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
|
|
||||||
|
|
||||||
dnl At least one system has been identified to require BOTH nsl and
|
AC_DEFUN(CURL_CHECK_GETHOSTBYADDR_R,
|
||||||
dnl socket libs to link properly.
|
[
|
||||||
if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname"; then
|
dnl check for number of arguments to gethostbyaddr_r. it might take
|
||||||
AC_MSG_CHECKING([trying both nsl and socket libs])
|
dnl either 5, 7, or 8 arguments.
|
||||||
my_ac_save_LIBS=$LIBS
|
AC_CHECK_FUNCS(gethostbyaddr_r,[
|
||||||
LIBS="-lnsl -lsocket $LIBS"
|
AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments)
|
||||||
AC_TRY_LINK( ,
|
AC_TRY_COMPILE([
|
||||||
[gethostbyname();],
|
#include <sys/types.h>
|
||||||
my_ac_link_result=success,
|
#include <netdb.h>],[
|
||||||
my_ac_link_result=failure )
|
char * address;
|
||||||
|
int length;
|
||||||
|
int type;
|
||||||
|
struct hostent h;
|
||||||
|
struct hostent_data hdata;
|
||||||
|
int rc;
|
||||||
|
rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
|
||||||
|
ac_cv_gethostbyaddr_args=5],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments)
|
||||||
|
AC_TRY_COMPILE([
|
||||||
|
#define _REENTRANT
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <netdb.h>],[
|
||||||
|
char * address;
|
||||||
|
int length;
|
||||||
|
int type;
|
||||||
|
struct hostent h;
|
||||||
|
struct hostent_data hdata;
|
||||||
|
int rc;
|
||||||
|
rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
|
||||||
|
AC_DEFINE(NEED_REENTRANT)
|
||||||
|
ac_cv_gethostbyaddr_args=5],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments)
|
||||||
|
AC_TRY_COMPILE([
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <netdb.h>],[
|
||||||
|
char * address;
|
||||||
|
int length;
|
||||||
|
int type;
|
||||||
|
struct hostent h;
|
||||||
|
char buffer[8192];
|
||||||
|
int h_errnop;
|
||||||
|
struct hostent * hp;
|
||||||
|
|
||||||
if test "$my_ac_link_result" = "failure"; then
|
hp = gethostbyaddr_r(address, length, type, &h,
|
||||||
AC_MSG_RESULT([no])
|
buffer, 8192, &h_errnop);],[
|
||||||
AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
|
AC_MSG_RESULT(yes)
|
||||||
dnl restore LIBS
|
AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
|
||||||
LIBS=$my_ac_save_LIBS
|
ac_cv_gethostbyaddr_args=7],[
|
||||||
else
|
AC_MSG_RESULT(no)
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments)
|
||||||
fi
|
AC_TRY_COMPILE([
|
||||||
fi
|
#include <sys/types.h>
|
||||||
|
#include <netdb.h>],[
|
||||||
|
char * address;
|
||||||
|
int length;
|
||||||
|
int type;
|
||||||
|
struct hostent h;
|
||||||
|
char buffer[8192];
|
||||||
|
int h_errnop;
|
||||||
|
struct hostent * hp;
|
||||||
|
int rc;
|
||||||
|
|
||||||
dnl resolve lib?
|
rc = gethostbyaddr_r(address, length, type, &h,
|
||||||
AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp))
|
buffer, 8192, &hp, &h_errnop);],[
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
|
AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
|
||||||
AC_CHECK_LIB(resolve, strcasecmp,
|
ac_cv_gethostbyaddr_args=8],[
|
||||||
[LIBS="-lresolve $LIBS"],
|
AC_MSG_RESULT(no)
|
||||||
,
|
have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])])
|
||||||
-lnsl)
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl socket lib?
|
|
||||||
AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
|
|
||||||
|
|
||||||
dnl ucb lib?
|
|
||||||
AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
|
|
||||||
|
|
||||||
dnl dl lib?
|
|
||||||
AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen))
|
|
||||||
|
|
||||||
dnl **********************************************************************
|
|
||||||
dnl Check for the presence of SSL libraries and headers
|
|
||||||
dnl **********************************************************************
|
|
||||||
|
|
||||||
dnl Default to compiler & linker defaults for SSL files & libraries.
|
|
||||||
OPT_SSL=off
|
|
||||||
AC_ARG_WITH(ssl,dnl
|
|
||||||
[ --with-ssl[=DIR] where to look for SSL [compiler/linker default paths]
|
|
||||||
DIR points to the SSL installation [/usr/local/ssl]],
|
|
||||||
OPT_SSL=$withval
|
|
||||||
)
|
|
||||||
|
|
||||||
if test X"$OPT_SSL" = Xno
|
|
||||||
then
|
|
||||||
AC_MSG_WARN(SSL/https support disabled)
|
|
||||||
else
|
|
||||||
|
|
||||||
dnl Check for & handle argument to --with-ssl.
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(where to look for SSL)
|
|
||||||
if test X"$OPT_SSL" = Xoff
|
|
||||||
then
|
|
||||||
AC_MSG_RESULT([defaults (or given in environment)])
|
|
||||||
else
|
|
||||||
test X"$OPT_SSL" = Xyes && OPT_SSL=/usr/local/ssl
|
|
||||||
LIBS="$LIBS -L$OPT_SSL/lib"
|
|
||||||
CPPFLAGS="$CPPFLAGS -I$OPT_SSL/include/openssl -I$OPT_SSL/include"
|
|
||||||
AC_MSG_RESULT([$OPT_SSL])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl check for crypto libs (part of SSLeay)
|
|
||||||
AC_CHECK_LIB(crypto, CRYPTO_lock)
|
|
||||||
|
|
||||||
if test $ac_cv_lib_crypto_CRYPTO_lock = yes; then
|
|
||||||
dnl This is only reasonable to do if crypto actually is there: check for
|
|
||||||
dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
|
|
||||||
AC_CHECK_LIB(ssl, SSL_connect)
|
|
||||||
|
|
||||||
dnl Check for SSLeay headers
|
|
||||||
AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h openssl/pem.h openssl/ssl.h openssl/err.h)
|
|
||||||
|
|
||||||
if test $ac_cv_header_openssl_x509_h = no; then
|
|
||||||
AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl **********************************************************************
|
|
||||||
dnl Check for the presence of ZLIB libraries and headers
|
|
||||||
dnl **********************************************************************
|
|
||||||
|
|
||||||
dnl Default to compiler & linker defaults for files & libraries.
|
|
||||||
dnl OPT_ZLIB=no
|
|
||||||
dnl AC_ARG_WITH(zlib,dnl
|
|
||||||
dnl [ --with-zlib[=DIR] where to look for ZLIB [compiler/linker default paths]
|
|
||||||
dnl DIR points to the ZLIB installation prefix [/usr/local]],
|
|
||||||
dnl OPT_ZLIB=$withval,
|
|
||||||
dnl )
|
|
||||||
|
|
||||||
dnl Check for & handle argument to --with-zlib.
|
|
||||||
dnl
|
|
||||||
dnl NOTE: We *always* look for ZLIB headers & libraries, all this option
|
|
||||||
dnl does is change where we look (by adjusting LIBS and CPPFLAGS.)
|
|
||||||
dnl
|
|
||||||
|
|
||||||
dnl AC_MSG_CHECKING(where to look for ZLIB)
|
|
||||||
dnl if test X"$OPT_ZLIB" = Xno
|
|
||||||
dnl then
|
|
||||||
dnl AC_MSG_RESULT([defaults (or given in environment)])
|
|
||||||
dnl else
|
|
||||||
dnl test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
|
|
||||||
dnl LIBS="$LIBS -L$OPT_ZLIB/lib"
|
|
||||||
dnl CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
|
|
||||||
dnl AC_MSG_RESULT([$OPT_ZLIB])
|
|
||||||
dnl fi
|
|
||||||
|
|
||||||
dnl z lib?
|
|
||||||
dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
|
|
||||||
|
|
||||||
|
|
||||||
dnl Default is to try the thread-safe versions of a few functions
|
])
|
||||||
OPT_THREAD=on
|
|
||||||
AC_ARG_ENABLE(thread,dnl
|
|
||||||
[ --disable-thread tell configure to not look for thread-safe functions],
|
|
||||||
OPT_THREAD=off
|
|
||||||
)
|
|
||||||
|
|
||||||
if test X"$OPT_THREAD" = Xoff
|
AC_DEFUN(CURL_CHECK_GETHOSTBYNAME_R,
|
||||||
then
|
[
|
||||||
AC_MSG_WARN(libcurl will not get built using thread-safe functions)
|
|
||||||
AC_DEFINE(DISABLED_THREADSAFE, 1, \
|
|
||||||
Set to explicitly specify we don't want to use thread-safe functions)
|
|
||||||
else
|
|
||||||
dnl check for number of arguments to gethostbyname_r. it might take
|
dnl check for number of arguments to gethostbyname_r. it might take
|
||||||
dnl either 3, 5, or 6 arguments.
|
dnl either 3, 5, or 6 arguments.
|
||||||
AC_CHECK_FUNCS(gethostbyname_r,[
|
AC_CHECK_FUNCS(gethostbyname_r,[
|
||||||
@@ -255,113 +235,312 @@ exit (rc != 0 ? 1 : 0); }],[
|
|||||||
[ac_cv_gethostbyname_args=0])],
|
[ac_cv_gethostbyname_args=0])],
|
||||||
[ac_cv_gethostbyname_args=0])])
|
[ac_cv_gethostbyname_args=0])])
|
||||||
|
|
||||||
dnl check for number of arguments to gethostbyaddr_r. it might take
|
])
|
||||||
dnl either 5, 7, or 8 arguments.
|
|
||||||
AC_CHECK_FUNCS(gethostbyaddr_r,[
|
|
||||||
AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments)
|
|
||||||
AC_TRY_COMPILE([
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <netdb.h>],[
|
|
||||||
char * address;
|
|
||||||
int length;
|
|
||||||
int type;
|
|
||||||
struct hostent h;
|
|
||||||
struct hostent_data hdata;
|
|
||||||
int rc;
|
|
||||||
rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
|
|
||||||
ac_cv_gethostbyaddr_args=5],[
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments)
|
|
||||||
AC_TRY_COMPILE([
|
|
||||||
#define _REENTRANT
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <netdb.h>],[
|
|
||||||
char * address;
|
|
||||||
int length;
|
|
||||||
int type;
|
|
||||||
struct hostent h;
|
|
||||||
struct hostent_data hdata;
|
|
||||||
int rc;
|
|
||||||
rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
|
|
||||||
AC_DEFINE(NEED_REENTRANT)
|
|
||||||
ac_cv_gethostbyaddr_args=5],[
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments)
|
|
||||||
AC_TRY_COMPILE([
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <netdb.h>],[
|
|
||||||
char * address;
|
|
||||||
int length;
|
|
||||||
int type;
|
|
||||||
struct hostent h;
|
|
||||||
char buffer[10];
|
|
||||||
int buflen;
|
|
||||||
int h_errnop;
|
|
||||||
struct hostent * hp;
|
|
||||||
|
|
||||||
hp = gethostbyaddr_r(address, length, type, &h,
|
dnl **********************************************************************
|
||||||
buffer, buflen, &h_errnop);],[
|
dnl Checks for IPv6
|
||||||
AC_MSG_RESULT(yes)
|
dnl **********************************************************************
|
||||||
AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
|
|
||||||
ac_cv_gethostbyaddr_args=7],[
|
AC_MSG_CHECKING([whether to enable ipv6])
|
||||||
|
AC_ARG_ENABLE(ipv6,
|
||||||
|
[ --enable-ipv6 Enable ipv6 (with ipv4) support
|
||||||
|
--disable-ipv6 Disable ipv6 support],
|
||||||
|
[ case "$enableval" in
|
||||||
|
no)
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments)
|
ipv6=no
|
||||||
AC_TRY_COMPILE([
|
;;
|
||||||
|
*) AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(ENABLE_IPV6)
|
||||||
|
ipv6=yes
|
||||||
|
;;
|
||||||
|
esac ],
|
||||||
|
|
||||||
|
AC_TRY_RUN([ /* is AF_INET6 available? */
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <netdb.h>],[
|
#include <sys/socket.h>
|
||||||
char * address;
|
main()
|
||||||
int length;
|
{
|
||||||
int type;
|
if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
|
||||||
struct hostent h;
|
exit(1);
|
||||||
char buffer[10];
|
else
|
||||||
int buflen;
|
exit(0);
|
||||||
int h_errnop;
|
}
|
||||||
struct hostent * hp;
|
],
|
||||||
int rc;
|
|
||||||
|
|
||||||
rc = gethostbyaddr_r(address, length, type, &h,
|
|
||||||
buffer, buflen, &hp, &h_errnop);],[
|
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
|
AC_DEFINE(ENABLE_IPV6)
|
||||||
ac_cv_gethostbyaddr_args=8],[
|
ipv6=yes,
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])])
|
ipv6=no,
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
ipv6=no
|
||||||
|
))
|
||||||
|
|
||||||
dnl determine if function definition for inet_ntoa_r exists.
|
dnl **********************************************************************
|
||||||
AC_CHECK_FUNCS(inet_ntoa_r,[
|
dnl Checks for libraries.
|
||||||
AC_MSG_CHECKING(whether inet_ntoa_r is declared)
|
dnl **********************************************************************
|
||||||
AC_EGREP_CPP(inet_ntoa_r,[
|
|
||||||
#include <arpa/inet.h>],[
|
|
||||||
AC_DEFINE(HAVE_INET_NTOA_R_DECL)
|
|
||||||
AC_MSG_RESULT(yes)],[
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared)
|
|
||||||
AC_EGREP_CPP(inet_ntoa_r,[
|
|
||||||
#define _REENTRANT
|
|
||||||
#include <arpa/inet.h>],[
|
|
||||||
AC_DEFINE(HAVE_INET_NTOA_R_DECL)
|
|
||||||
AC_DEFINE(NEED_REENTRANT)
|
|
||||||
AC_MSG_RESULT(yes)],
|
|
||||||
AC_MSG_RESULT(no))])])
|
|
||||||
|
|
||||||
dnl check for a few thread-safe functions
|
dnl gethostbyname in the nsl lib?
|
||||||
AC_CHECK_FUNCS(localtime_r,[
|
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
|
||||||
AC_MSG_CHECKING(whether localtime_r is declared)
|
|
||||||
AC_EGREP_CPP(localtime_r,[
|
if test "$ac_cv_lib_nsl_gethostbyname" != "yes" -a "$ac_cv_func_gethostbyname" != "yes"; then
|
||||||
#include <time.h>],[
|
dnl gethostbyname in the socket lib?
|
||||||
AC_MSG_RESULT(yes)],[
|
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(socket, gethostbyname))
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl At least one system has been identified to require BOTH nsl and
|
||||||
|
dnl socket libs to link properly.
|
||||||
|
if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname"; then
|
||||||
|
AC_MSG_CHECKING([trying both nsl and socket libs])
|
||||||
|
my_ac_save_LIBS=$LIBS
|
||||||
|
LIBS="-lnsl -lsocket $LIBS"
|
||||||
|
AC_TRY_LINK( ,
|
||||||
|
[gethostbyname();],
|
||||||
|
my_ac_link_result=success,
|
||||||
|
my_ac_link_result=failure )
|
||||||
|
|
||||||
|
if test "$my_ac_link_result" = "failure"; then
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
|
||||||
|
dnl restore LIBS
|
||||||
|
LIBS=$my_ac_save_LIBS
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl resolve lib?
|
||||||
|
AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp))
|
||||||
|
|
||||||
|
if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
|
||||||
|
AC_CHECK_LIB(resolve, strcasecmp,
|
||||||
|
[LIBS="-lresolve $LIBS"],
|
||||||
|
,
|
||||||
|
-lnsl)
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl socket lib?
|
||||||
|
AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
|
||||||
|
|
||||||
|
dnl ucb lib?
|
||||||
|
AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
|
||||||
|
|
||||||
|
dnl dl lib?
|
||||||
|
AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen))
|
||||||
|
|
||||||
|
dnl **********************************************************************
|
||||||
|
dnl Check for the presence of Kerberos4 libraries and headers
|
||||||
|
dnl **********************************************************************
|
||||||
|
|
||||||
|
AC_ARG_WITH(krb4-includes,
|
||||||
|
[ --with-krb4-includes[=DIR] Specify location of kerberos4 headers],[
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval"
|
||||||
|
KRB4INC="$withval"
|
||||||
|
want_krb4=yes
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_ARG_WITH(krb4-libs,
|
||||||
|
[ --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
|
||||||
|
[ --with-krb4[=DIR] where to look for Kerberos4],[
|
||||||
|
OPT_KRB4="$withval"
|
||||||
|
if test X"$OPT_KRB4" != Xyes
|
||||||
|
then
|
||||||
|
LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib"
|
||||||
|
KRB4LIB="$OPT_KRB4/lib"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
|
||||||
|
KRB4INC="$OPT_KRB4/include"
|
||||||
|
fi
|
||||||
|
want_krb4="yes"
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([if Kerberos4 support is requested])
|
||||||
|
|
||||||
|
if test "$want_krb4" = yes
|
||||||
|
then
|
||||||
|
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 -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(KRB4)
|
||||||
|
|
||||||
|
dnl the krb4 stuff needs a strlcpy()
|
||||||
|
AC_CHECK_FUNCS(strlcpy)
|
||||||
|
|
||||||
|
])
|
||||||
|
])
|
||||||
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
|
fi
|
||||||
AC_EGREP_CPP(localtime_r,[
|
|
||||||
#define _REENTRANT
|
dnl **********************************************************************
|
||||||
#include <time.h>],[
|
dnl Check for the presence of SSL libraries and headers
|
||||||
AC_DEFINE(NEED_REENTRANT)
|
dnl **********************************************************************
|
||||||
AC_MSG_RESULT(yes)],
|
|
||||||
AC_MSG_RESULT(no))])])
|
dnl Default to compiler & linker defaults for SSL files & libraries.
|
||||||
|
OPT_SSL=off
|
||||||
|
AC_ARG_WITH(ssl,dnl
|
||||||
|
[ --with-ssl[=DIR] where to look for SSL [compiler/linker default paths]
|
||||||
|
DIR points to the SSL installation [/usr/local/ssl]],
|
||||||
|
OPT_SSL=$withval
|
||||||
|
)
|
||||||
|
|
||||||
|
if test X"$OPT_SSL" = Xno
|
||||||
|
then
|
||||||
|
AC_MSG_WARN(SSL/https support disabled)
|
||||||
|
else
|
||||||
|
|
||||||
|
dnl Check for & handle argument to --with-ssl.
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(where to look for SSL)
|
||||||
|
if test X"$OPT_SSL" = Xoff
|
||||||
|
then
|
||||||
|
AC_MSG_RESULT([defaults (or given in environment)])
|
||||||
|
else
|
||||||
|
test X"$OPT_SSL" = Xyes && OPT_SSL=/usr/local/ssl
|
||||||
|
dnl LIBS="$LIBS -L$OPT_SSL/lib"
|
||||||
|
LDFLAGS="$LDFLAGS -L$OPT_SSL/lib"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$OPT_SSL/include/openssl -I$OPT_SSL/include"
|
||||||
|
AC_MSG_RESULT([$OPT_SSL])
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl check for crypto libs (part of SSLeay)
|
||||||
|
AC_CHECK_LIB(crypto, CRYPTO_lock)
|
||||||
|
|
||||||
|
if test $ac_cv_lib_crypto_CRYPTO_lock = yes; then
|
||||||
|
dnl This is only reasonable to do if crypto actually is there: check for
|
||||||
|
dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
|
||||||
|
AC_CHECK_LIB(ssl, SSL_connect)
|
||||||
|
|
||||||
|
if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
|
||||||
|
dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
|
||||||
|
AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
|
||||||
|
OLIBS=$LIBS
|
||||||
|
LIBS="$LIBS -lRSAglue -lrsaref"
|
||||||
|
AC_CHECK_LIB(ssl, SSL_connect)
|
||||||
|
if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
|
||||||
|
dnl still no SSL_connect
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
LIBS=$OLIBS
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dnl Check for SSLeay headers
|
||||||
|
AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h openssl/pem.h openssl/ssl.h openssl/err.h)
|
||||||
|
|
||||||
|
if test $ac_cv_header_openssl_x509_h = no; then
|
||||||
|
AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl these can only exist if openssl exists
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS( RAND_status \
|
||||||
|
RAND_screen )
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl **********************************************************************
|
||||||
|
dnl Check for the presence of ZLIB libraries and headers
|
||||||
|
dnl **********************************************************************
|
||||||
|
|
||||||
|
dnl Default to compiler & linker defaults for files & libraries.
|
||||||
|
dnl OPT_ZLIB=no
|
||||||
|
dnl AC_ARG_WITH(zlib,dnl
|
||||||
|
dnl [ --with-zlib[=DIR] where to look for ZLIB [compiler/linker default paths]
|
||||||
|
dnl DIR points to the ZLIB installation prefix [/usr/local]],
|
||||||
|
dnl OPT_ZLIB=$withval,
|
||||||
|
dnl )
|
||||||
|
|
||||||
|
dnl Check for & handle argument to --with-zlib.
|
||||||
|
dnl
|
||||||
|
dnl NOTE: We *always* look for ZLIB headers & libraries, all this option
|
||||||
|
dnl does is change where we look (by adjusting LIBS and CPPFLAGS.)
|
||||||
|
dnl
|
||||||
|
|
||||||
|
dnl AC_MSG_CHECKING(where to look for ZLIB)
|
||||||
|
dnl if test X"$OPT_ZLIB" = Xno
|
||||||
|
dnl then
|
||||||
|
dnl AC_MSG_RESULT([defaults (or given in environment)])
|
||||||
|
dnl else
|
||||||
|
dnl test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
|
||||||
|
dnl LIBS="$LIBS -L$OPT_ZLIB/lib"
|
||||||
|
dnl CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
|
||||||
|
dnl AC_MSG_RESULT([$OPT_ZLIB])
|
||||||
|
dnl fi
|
||||||
|
|
||||||
|
dnl z lib?
|
||||||
|
dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
|
||||||
|
|
||||||
|
|
||||||
|
dnl Default is to try the thread-safe versions of a few functions
|
||||||
|
OPT_THREAD=on
|
||||||
|
AC_ARG_ENABLE(thread,dnl
|
||||||
|
[ --disable-thread tell configure to not look for thread-safe functions],
|
||||||
|
OPT_THREAD=off
|
||||||
|
)
|
||||||
|
|
||||||
|
if test X"$OPT_THREAD" = Xoff
|
||||||
|
then
|
||||||
|
AC_MSG_WARN(libcurl will not get built using thread-safe functions)
|
||||||
|
AC_DEFINE(DISABLED_THREADSAFE, 1, \
|
||||||
|
Set to explicitly specify we don't want to use thread-safe functions)
|
||||||
|
else
|
||||||
|
|
||||||
|
dnl dig around for gethostbyname_r()
|
||||||
|
CURL_CHECK_GETHOSTBYNAME_R()
|
||||||
|
|
||||||
|
dnl dig around for gethostbyaddr_r()
|
||||||
|
CURL_CHECK_GETHOSTBYADDR_R()
|
||||||
|
|
||||||
|
dnl poke around for inet_ntoa_r()
|
||||||
|
CURL_CHECK_INET_NTOA_R()
|
||||||
|
|
||||||
|
dnl is there a localtime_r()
|
||||||
|
CURL_CHECK_LOCALTIME_R()
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl **********************************************************************
|
dnl **********************************************************************
|
||||||
@@ -439,14 +618,19 @@ AC_CHECK_FUNCS( socket \
|
|||||||
tcsetattr \
|
tcsetattr \
|
||||||
tcgetattr \
|
tcgetattr \
|
||||||
perror \
|
perror \
|
||||||
getpass \
|
|
||||||
closesocket \
|
closesocket \
|
||||||
setvbuf \
|
setvbuf \
|
||||||
RAND_status \
|
sigaction \
|
||||||
RAND_screen
|
signal \
|
||||||
|
getpass_r
|
||||||
)
|
)
|
||||||
|
|
||||||
|
dnl removed 'getpass' check on October 26, 2000
|
||||||
|
|
||||||
if test "$ac_cv_func_select" != "yes"; then
|
if test "$ac_cv_func_select" != "yes"; then
|
||||||
|
AC_MSG_ERROR(Can't work without an existing select() function)
|
||||||
|
fi
|
||||||
|
if test "$ac_cv_func_socket" != "yes"; then
|
||||||
AC_MSG_ERROR(Can't work without an existing socket() function)
|
AC_MSG_ERROR(Can't work without an existing socket() function)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -465,14 +649,18 @@ dnl $PATH:/usr/bin/:/usr/local/bin )
|
|||||||
dnl AC_SUBST(RANLIB)
|
dnl AC_SUBST(RANLIB)
|
||||||
|
|
||||||
AC_OUTPUT( Makefile \
|
AC_OUTPUT( Makefile \
|
||||||
curl.spec \
|
|
||||||
curl-ssl.spec \
|
|
||||||
docs/Makefile \
|
docs/Makefile \
|
||||||
|
docs/examples/Makefile \
|
||||||
include/Makefile \
|
include/Makefile \
|
||||||
include/curl/Makefile \
|
include/curl/Makefile \
|
||||||
src/Makefile \
|
src/Makefile \
|
||||||
lib/Makefile )
|
lib/Makefile \
|
||||||
dnl perl/checklinks.pl \
|
tests/Makefile \
|
||||||
dnl perl/getlinks.pl \
|
tests/data/Makefile \
|
||||||
dnl perl/formfind.pl \
|
packages/Makefile \
|
||||||
dnl perl/recursiveftpget.pl )
|
packages/Win32/Makefile \
|
||||||
|
packages/Linux/Makefile \
|
||||||
|
packages/Linux/RPM/Makefile \
|
||||||
|
packages/Linux/RPM/curl.spec \
|
||||||
|
packages/Linux/RPM/curl-ssl.spec )
|
||||||
|
|
||||||
|
|||||||
@@ -1,98 +0,0 @@
|
|||||||
%define ver @VERSION@
|
|
||||||
%define rel 1
|
|
||||||
%define prefix /usr
|
|
||||||
|
|
||||||
Summary: get a file from a FTP, GOPHER or HTTP server.
|
|
||||||
Name: @PACKAGE@-ssl
|
|
||||||
Version: %ver
|
|
||||||
Release: %rel
|
|
||||||
Copyright: MPL
|
|
||||||
Group: Utilities/Console
|
|
||||||
Source: @PACKAGE@-%{version}.tar.gz
|
|
||||||
URL: http://@PACKAGE@.haxx.se
|
|
||||||
BuildPrereq: openssl
|
|
||||||
BuildRoot: /tmp/%{name}-%{version}-%{rel}-root
|
|
||||||
Packager: Fill In As You Wish
|
|
||||||
Docdir: %{prefix}/doc
|
|
||||||
|
|
||||||
%description
|
|
||||||
@PACKAGE@-ssl is a client to get documents/files from servers, using
|
|
||||||
any of the supported protocols. The command is designed to
|
|
||||||
work without user interaction or any kind of interactivity.
|
|
||||||
|
|
||||||
@PACKAGE@-ssl offers a busload of useful tricks like proxy support,
|
|
||||||
user authentication, ftp upload, HTTP post, file transfer
|
|
||||||
resume and more.
|
|
||||||
|
|
||||||
Note: this version is compiled with SSL (https:) support.
|
|
||||||
|
|
||||||
Authors:
|
|
||||||
Daniel Stenberg <daniel@haxx.se>
|
|
||||||
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -n @PACKAGE@-@VERSION@
|
|
||||||
|
|
||||||
|
|
||||||
%build
|
|
||||||
# Needed for snapshot releases.
|
|
||||||
if [ ! -f configure ]; then
|
|
||||||
CONF="./autogen.sh"
|
|
||||||
else
|
|
||||||
CONF="./configure"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Configuring the package
|
|
||||||
#
|
|
||||||
CFLAGS="${RPM_OPT_FLAGS}" ${CONF} \
|
|
||||||
--prefix=%{prefix} \
|
|
||||||
--with-ssl
|
|
||||||
|
|
||||||
|
|
||||||
[ "$SMP" != "" ] && JSMP = '"MAKE=make -k -j $SMP"'
|
|
||||||
|
|
||||||
make ${JSMP} CFLAGS="-DUSE_SSLEAY -I/usr/include/openssl";
|
|
||||||
|
|
||||||
|
|
||||||
%install
|
|
||||||
[ -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
|
|
||||||
|
|
||||||
make prefix=${RPM_BUILD_ROOT}%{prefix} install-strip
|
|
||||||
|
|
||||||
#
|
|
||||||
# Generating file lists and store them in file-lists
|
|
||||||
# Starting with the directory listings
|
|
||||||
#
|
|
||||||
find ${RPM_BUILD_ROOT}%{prefix}/{bin,lib,man} -type d | sed "s#^${RPM_BUILD_ROOT}#\%attr (-\,root\,root) \%dir #" > file-lists
|
|
||||||
|
|
||||||
#
|
|
||||||
# Then, the file listings
|
|
||||||
#
|
|
||||||
echo "%defattr (-, root, root)" >> file-lists
|
|
||||||
find ${RPM_BUILD_ROOT}%{prefix} -type f | sed -e "s#^${RPM_BUILD_ROOT}##g" >> file-lists
|
|
||||||
|
|
||||||
|
|
||||||
%clean
|
|
||||||
(cd ..; rm -rf @PACKAGE@-@VERSION@ ${RPM_BUILD_ROOT})
|
|
||||||
|
|
||||||
|
|
||||||
%files -f file-lists
|
|
||||||
%defattr (-, root, root)
|
|
||||||
%doc BUGS
|
|
||||||
%doc CHANGES
|
|
||||||
%doc CONTRIBUTE
|
|
||||||
%doc FAQ
|
|
||||||
%doc FEATURES
|
|
||||||
%doc FILES
|
|
||||||
%doc INSTALL
|
|
||||||
%doc LEGAL
|
|
||||||
%doc MPL-1.0.txt
|
|
||||||
%doc README
|
|
||||||
%doc README.curl
|
|
||||||
%doc README.lib@PACKAGE@
|
|
||||||
%doc RESOURCES
|
|
||||||
%doc TODO
|
|
||||||
%doc %{name}-ssl.spec.in
|
|
||||||
%doc %{name}.spec.in
|
|
||||||
|
|
||||||
96
curl.spec.in
96
curl.spec.in
@@ -1,96 +0,0 @@
|
|||||||
%define ver @VERSION@
|
|
||||||
%define rel 1
|
|
||||||
%define prefix /usr
|
|
||||||
|
|
||||||
Summary: get a file from a FTP, GOPHER or HTTP server.
|
|
||||||
Name: @PACKAGE@
|
|
||||||
Version: %ver
|
|
||||||
Release: %rel
|
|
||||||
Copyright: MPL
|
|
||||||
Group: Utilities/Console
|
|
||||||
Source: %{name}-%{version}.tar.gz
|
|
||||||
URL: http://@PACKAGE@.haxx.se
|
|
||||||
BuildRoot: /tmp/%{name}-%{version}-%{rel}-root
|
|
||||||
Packager: Fill In As You Wish
|
|
||||||
Docdir: %{prefix}/doc
|
|
||||||
|
|
||||||
%description
|
|
||||||
@PACKAGE@ is a client to get documents/files from servers, using
|
|
||||||
any of the supported protocols. The command is designed to
|
|
||||||
work without user interaction or any kind of interactivity.
|
|
||||||
|
|
||||||
@PACKAGE@ offers a busload of useful tricks like proxy support,
|
|
||||||
user authentication, ftp upload, HTTP post, file transfer
|
|
||||||
resume and more.
|
|
||||||
|
|
||||||
Note: this version is compiled without SSL (https:) support.
|
|
||||||
|
|
||||||
Authors:
|
|
||||||
Daniel Stenberg <daniel@haxx.se>
|
|
||||||
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -n %{name}-%{version}
|
|
||||||
|
|
||||||
|
|
||||||
%build
|
|
||||||
# Needed for snapshot releases.
|
|
||||||
if [ ! -f configure ]; then
|
|
||||||
CONF="./autogen.sh"
|
|
||||||
else
|
|
||||||
CONF="./configure"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Configuring the package
|
|
||||||
#
|
|
||||||
CFLAGS="${RPM_OPT_FLAGS}" ${CONF} \
|
|
||||||
--prefix=%{prefix}
|
|
||||||
|
|
||||||
|
|
||||||
[ "$SMP" != "" ] && JSMP = '"MAKE=make -k -j $SMP"'
|
|
||||||
|
|
||||||
make ${JSMP};
|
|
||||||
|
|
||||||
|
|
||||||
%install
|
|
||||||
[ -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
|
|
||||||
|
|
||||||
make prefix=${RPM_BUILD_ROOT}%{prefix} install-strip
|
|
||||||
|
|
||||||
#
|
|
||||||
# Generating file lists and store them in file-lists
|
|
||||||
# Starting with the directory listings
|
|
||||||
#
|
|
||||||
find ${RPM_BUILD_ROOT}%{prefix}/{bin,lib,man} -type d | sed "s#^${RPM_BUILD_ROOT}#\%attr (-\,root\,root) \%dir #" > file-lists
|
|
||||||
|
|
||||||
#
|
|
||||||
# Then, the file listings
|
|
||||||
#
|
|
||||||
echo "%defattr (-, root, root)" >> file-lists
|
|
||||||
find ${RPM_BUILD_ROOT}%{prefix} -type f | sed -e "s#^${RPM_BUILD_ROOT}##g" >> file-lists
|
|
||||||
|
|
||||||
|
|
||||||
%clean
|
|
||||||
(cd ..; rm -rf %{name}-%{version} ${RPM_BUILD_ROOT})
|
|
||||||
|
|
||||||
|
|
||||||
%files -f file-lists
|
|
||||||
%defattr (-, root, root)
|
|
||||||
%doc BUGS
|
|
||||||
%doc CHANGES
|
|
||||||
%doc CONTRIBUTE
|
|
||||||
%doc FAQ
|
|
||||||
%doc FEATURES
|
|
||||||
%doc FILES
|
|
||||||
%doc INSTALL
|
|
||||||
%doc LEGAL
|
|
||||||
%doc MPL-1.0.txt
|
|
||||||
%doc README
|
|
||||||
%doc README.curl
|
|
||||||
%doc README.lib@PACKAGE@
|
|
||||||
%doc RESOURCES
|
|
||||||
%doc TODO
|
|
||||||
%doc %{name}-ssl.spec.in
|
|
||||||
%doc %{name}.spec.in
|
|
||||||
|
|
||||||
@@ -4,8 +4,6 @@
|
|||||||
| (__| |_| | _ <| |___
|
| (__| |_| | _ <| |___
|
||||||
\___|\___/|_| \_\_____|
|
\___|\___/|_| \_\_____|
|
||||||
|
|
||||||
CONTRIBUTE
|
|
||||||
|
|
||||||
To Think About When Contributing Source Code
|
To Think About When Contributing Source Code
|
||||||
|
|
||||||
This document is intended to offer some guidelines that can be useful to keep
|
This document is intended to offer some guidelines that can be useful to keep
|
||||||
@@ -15,12 +13,13 @@ To Think About When Contributing Source Code
|
|||||||
The License Issue
|
The License Issue
|
||||||
|
|
||||||
When contributing with code, you agree to put your changes and new code under
|
When contributing with code, you agree to put your changes and new code under
|
||||||
the same license curl and libcurl is already using. Curl uses the MozPL, the
|
the same license curl and libcurl is already using.
|
||||||
Mozilla Public License, which is *NOT* compatible with the well known GPL,
|
|
||||||
GNU Public License. We can never re-use sources from a GPL program in curl.
|
|
||||||
If you add a larger piece of code, you can opt to make that file or set of
|
If you add a larger piece of code, you can opt to make that file or set of
|
||||||
files to use a different license as long as they don't enfore any changes to
|
files to use a different license as long as they don't enfore any changes to
|
||||||
the rest of the package. Such "separate parts" can not be GPL either.
|
the rest of the package and they make sense. Such "separate parts" can not be
|
||||||
|
GPL (as we don't want the GPL virus to attack users of libcurl) but they must
|
||||||
|
use "GPL compatible" licenses.
|
||||||
|
|
||||||
Naming
|
Naming
|
||||||
|
|
||||||
@@ -69,6 +68,13 @@ Separate Patches Doing Different Things
|
|||||||
description exactly what they correct so that all patches can be selectively
|
description exactly what they correct so that all patches can be selectively
|
||||||
applied by the maintainer or other interested parties.
|
applied by the maintainer or other interested parties.
|
||||||
|
|
||||||
|
Patch Against Recent Sources
|
||||||
|
|
||||||
|
Please try to get the latest available sources to make your patches
|
||||||
|
against. It makes my life so much easier. The very best is if you get the
|
||||||
|
most up-to-date sources from the CVS repository, but the latest release
|
||||||
|
archive is quite OK as well!
|
||||||
|
|
||||||
Document
|
Document
|
||||||
|
|
||||||
Writing docs is dead boring and one of the big problems with many open source
|
Writing docs is dead boring and one of the big problems with many open source
|
||||||
@@ -82,3 +88,12 @@ Write Access to CVS Repository
|
|||||||
course get write access to the CVS repository and then you'll be able to
|
course get write access to the CVS repository and then you'll be able to
|
||||||
check-in all your changes straight into the CVS tree instead of sending all
|
check-in all your changes straight into the CVS tree instead of sending all
|
||||||
changes by mail as patches. Just ask if this is what you'd want.
|
changes by mail as patches. Just ask if this is what you'd want.
|
||||||
|
|
||||||
|
Test Cases
|
||||||
|
|
||||||
|
Since the introduction of the test suite, we will get the possibility to
|
||||||
|
quickly verify that the main features are working as supposed to. To maintain
|
||||||
|
this situation and improve it, all new features and functions that are added
|
||||||
|
need tro be tested. Every feature that is added should get at least one valid
|
||||||
|
test case that verifies that it works as documented. If every submitter also
|
||||||
|
post a few test cases, it won't end up as a heavy burden on a single person!
|
||||||
|
|||||||
253
docs/FAQ
253
docs/FAQ
@@ -1,4 +1,4 @@
|
|||||||
Updated: August 22, 2000 (http://curl.haxx.se/docs/faq.shtml)
|
Updated: January 29, 2001 (http://curl.haxx.se/docs/faq.shtml)
|
||||||
_ _ ____ _
|
_ _ ____ _
|
||||||
___| | | | _ \| |
|
___| | | | _ \| |
|
||||||
/ __| | | | |_) | |
|
/ __| | | | |_) | |
|
||||||
@@ -30,10 +30,11 @@ FAQ
|
|||||||
3.6 Does curl support javascript, ASP, XML, XHTML or HTML version Y?
|
3.6 Does curl support javascript, ASP, XML, XHTML or HTML version Y?
|
||||||
3.7 Can I use curl to delete/rename a file through FTP?
|
3.7 Can I use curl to delete/rename a file through FTP?
|
||||||
3.8 How do I tell curl to follow HTTP redirects?
|
3.8 How do I tell curl to follow HTTP redirects?
|
||||||
|
3.9 How do I use curl in PHP?
|
||||||
|
|
||||||
4. Running Problems
|
4. Running Problems
|
||||||
4.1 Problems connecting to SSL servers.
|
4.1 Problems connecting to SSL servers.
|
||||||
4.2 Why do I get problems when I use & in the URL?
|
4.2 Why do I get problems when I use & or % in the URL?
|
||||||
4.3 How can I use {, }, [ or ] to specify multiple URLs?
|
4.3 How can I use {, }, [ or ] to specify multiple URLs?
|
||||||
4.4 Why do I get downloaded data even though the web page doesn't exist?
|
4.4 Why do I get downloaded data even though the web page doesn't exist?
|
||||||
4.5 Why do I get return code XXX from a HTTP server?
|
4.5 Why do I get return code XXX from a HTTP server?
|
||||||
@@ -43,9 +44,17 @@ FAQ
|
|||||||
4.5.4 "404 Not Found"
|
4.5.4 "404 Not Found"
|
||||||
4.5.5 "405 Method Not Allowed"
|
4.5.5 "405 Method Not Allowed"
|
||||||
4.6 Can you tell me what error code 142 means?
|
4.6 Can you tell me what error code 142 means?
|
||||||
|
4.7 How do I keep usernames and passwords secret in Curl command lines?
|
||||||
|
4.8 I found a bug!
|
||||||
|
4.9 Curl can't authenticate to the server that requires NTLM?
|
||||||
|
|
||||||
5. libcurl Issues
|
5. libcurl Issues
|
||||||
5.1 Is libcurl thread safe?
|
5.1 Is libcurl thread-safe?
|
||||||
|
5.2 How can I receive all data into a large memory chunk?
|
||||||
|
5.3 How do I fetch multiple files with libcurl?
|
||||||
|
5.4 Does libcurl do Winsock initing on win32 systems?
|
||||||
|
5.5 Does CURLOPT_FILE work on win32 ?
|
||||||
|
5.6 What about Keep-Alive or persistant connections?
|
||||||
|
|
||||||
6. License Issues
|
6. License Issues
|
||||||
6.1 I have a GPL program, can I use the libcurl library?
|
6.1 I have a GPL program, can I use the libcurl library?
|
||||||
@@ -63,20 +72,20 @@ FAQ
|
|||||||
|
|
||||||
cURL (or simply just 'curl') is a command line tool for getting or sending
|
cURL (or simply just 'curl') is a command line tool for getting or sending
|
||||||
files using URL syntax. The name is a play on 'Client for URLs', originally
|
files using URL syntax. The name is a play on 'Client for URLs', originally
|
||||||
with URL spelled in uppercase to make it obvious it deals with URLs.
|
with URL spelled in uppercase to make it obvious it deals with URLs. The
|
||||||
|
fact it can also be pronounced 'see URL' also helped.
|
||||||
|
|
||||||
Curl supports a range of common internet protocols, currently including
|
Curl supports a range of common internet protocols, currently including
|
||||||
HTTP, HTTPS, FTP, GOPHER, LDAP, DICT and FILE.
|
HTTP, HTTPS, FTP, GOPHER, LDAP, DICT, TELNET and FILE.
|
||||||
|
|
||||||
|
We spell it cURL or just curl.
|
||||||
|
|
||||||
1.2 What is libcurl?
|
1.2 What is libcurl?
|
||||||
|
|
||||||
libcurl is the engine inside curl that does all the work. curl is more or
|
libcurl is a reliable, higly portable multiprotocol file transfer library.
|
||||||
less the command line interface that converts the given options into libcurl
|
|
||||||
function invokes. libcurl is a reliable, higly portable multiprotocol file
|
|
||||||
transfer library.
|
|
||||||
|
|
||||||
Any application is free to use libcurl, even commercial or closed-source
|
Any application is free to use libcurl, even commercial or closed-source
|
||||||
ones. Just make sure changes to the lib itself is made public.
|
ones.
|
||||||
|
|
||||||
1.3 What is cURL not?
|
1.3 What is cURL not?
|
||||||
|
|
||||||
@@ -97,7 +106,7 @@ FAQ
|
|||||||
or with PHP.
|
or with PHP.
|
||||||
|
|
||||||
Curl is not a single-OS program. Curl exists, compiles, builds and runs
|
Curl is not a single-OS program. Curl exists, compiles, builds and runs
|
||||||
under a long range of operating systems, including all modern Unixes,
|
under a wide range of operating systems, including all modern Unixes,
|
||||||
Windows, Amiga, BeOS, OS/2, OS X, QNX etc.
|
Windows, Amiga, BeOS, OS/2, OS X, QNX etc.
|
||||||
|
|
||||||
1.4 When will you make curl do XXXX ?
|
1.4 When will you make curl do XXXX ?
|
||||||
@@ -117,7 +126,7 @@ FAQ
|
|||||||
program or redirect to another file for the next program to interpret.
|
program or redirect to another file for the next program to interpret.
|
||||||
|
|
||||||
* I focus on protocol related issues and improvements. If you wanna do more
|
* I focus on protocol related issues and improvements. If you wanna do more
|
||||||
magic with the supported protocols than curl currently does, changes are
|
magic with the supported protocols than curl currently does, chances are
|
||||||
big I will agree. If you wanna add more protocols, I may very well
|
big I will agree. If you wanna add more protocols, I may very well
|
||||||
agree.
|
agree.
|
||||||
|
|
||||||
@@ -141,6 +150,7 @@ FAQ
|
|||||||
Solaris (native cc compiler)
|
Solaris (native cc compiler)
|
||||||
HPUX (native cc compiler)
|
HPUX (native cc compiler)
|
||||||
SGI IRIX (native cc compiler)
|
SGI IRIX (native cc compiler)
|
||||||
|
SCO UNIX (native cc compiler)
|
||||||
|
|
||||||
When configuring curl, I specify --with-ssl. OpenSSL is installed in
|
When configuring curl, I specify --with-ssl. OpenSSL is installed in
|
||||||
/usr/local/ssl Configure reports SSL in /usr/local/ssl, but fails to find
|
/usr/local/ssl Configure reports SSL in /usr/local/ssl, but fails to find
|
||||||
@@ -193,7 +203,6 @@ FAQ
|
|||||||
brings this functionality.
|
brings this functionality.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
3. Usage problems
|
3. Usage problems
|
||||||
|
|
||||||
3.1. curl: (1) SSL is disabled, https: not supported
|
3.1. curl: (1) SSL is disabled, https: not supported
|
||||||
@@ -215,7 +224,7 @@ FAQ
|
|||||||
|
|
||||||
Curl supports resume both ways on FTP, download ways on HTTP.
|
Curl supports resume both ways on FTP, download ways on HTTP.
|
||||||
|
|
||||||
Try the -c and -C options.
|
Try the -C option.
|
||||||
|
|
||||||
3.3. Why doesn't my posting using -F work?
|
3.3. Why doesn't my posting using -F work?
|
||||||
|
|
||||||
@@ -272,6 +281,19 @@ FAQ
|
|||||||
|
|
||||||
curl -L http://redirector.com
|
curl -L http://redirector.com
|
||||||
|
|
||||||
|
3.9 How do I use curl in PHP?
|
||||||
|
|
||||||
|
PHP4 has the ability to use libcurl as an internal module if built with that
|
||||||
|
option enabled. You then get a set of extra functions that can be used
|
||||||
|
within your PHP programs. You find all details about those functions in the
|
||||||
|
curl section in the PHP manual, see the online version at:
|
||||||
|
|
||||||
|
http://www.php.net/manual/ref.curl.php
|
||||||
|
|
||||||
|
PHP also offers the option to run a command line, and then you can of course
|
||||||
|
invoke the curl tool using a command line. This is the way to use curl if
|
||||||
|
you're using PHP3 or PHP4 built without curl module support.
|
||||||
|
|
||||||
4. Running Problems
|
4. Running Problems
|
||||||
|
|
||||||
4.1. Problems connecting to SSL servers.
|
4.1. Problems connecting to SSL servers.
|
||||||
@@ -289,7 +311,7 @@ FAQ
|
|||||||
I have also seen examples where the remote server didn't like the SSLv2
|
I have also seen examples where the remote server didn't like the SSLv2
|
||||||
request and instead you had to force curl to use SSLv3 with -3/--sslv3.
|
request and instead you had to force curl to use SSLv3 with -3/--sslv3.
|
||||||
|
|
||||||
4.2. Why do I get problems when I use & in the URL?
|
4.2. Why do I get problems when I use & or % in the URL?
|
||||||
|
|
||||||
In general unix shells, the & letter is treated special and when used it
|
In general unix shells, the & letter is treated special and when used it
|
||||||
runs the specified command in the background. To safely send the & as a part
|
runs the specified command in the background. To safely send the & as a part
|
||||||
@@ -300,6 +322,12 @@ FAQ
|
|||||||
|
|
||||||
curl 'http://www.altavista.com/cgi-bin/query?text=yes&q=curl'
|
curl 'http://www.altavista.com/cgi-bin/query?text=yes&q=curl'
|
||||||
|
|
||||||
|
In win32, the standard DOS shell treats the %-letter specially and you may
|
||||||
|
need to quote the string properly when % is used in it.
|
||||||
|
|
||||||
|
Also note that if you want the literal %-letter to be part of the data you
|
||||||
|
pass in a POST using -d/--data you must encode it as '%25'.
|
||||||
|
|
||||||
4.3. How can I use {, }, [ or ] to specify multiple URLs?
|
4.3. How can I use {, }, [ or ] to specify multiple URLs?
|
||||||
|
|
||||||
Because those letters have a special meaning to the shell, and to be used in
|
Because those letters have a special meaning to the shell, and to be used in
|
||||||
@@ -309,6 +337,12 @@ FAQ
|
|||||||
|
|
||||||
curl '{curl,www}.haxx.se'
|
curl '{curl,www}.haxx.se'
|
||||||
|
|
||||||
|
To be able to use those letters as actual parts of the URL (without using
|
||||||
|
them for the curl URL "globbing" system), use the -g/--globoff option
|
||||||
|
(included in curl 7.6 and later):
|
||||||
|
|
||||||
|
curl -g 'www.site.com/weirdname[].html'
|
||||||
|
|
||||||
4.4. Why do I get downloaded data even though the web page doesn't exist?
|
4.4. Why do I get downloaded data even though the web page doesn't exist?
|
||||||
|
|
||||||
Curl asks remote servers for the page you specify. If the page doesn't exist
|
Curl asks remote servers for the page you specify. If the page doesn't exist
|
||||||
@@ -352,9 +386,9 @@ FAQ
|
|||||||
4.6. Can you tell me what error code 142 means?
|
4.6. Can you tell me what error code 142 means?
|
||||||
|
|
||||||
All error codes that are larger than the highest documented error code means
|
All error codes that are larger than the highest documented error code means
|
||||||
that curl has existed due to a timeout. There is currentl no nice way for
|
that curl has existed due to a timeout. There was no nice way for curl to
|
||||||
curl to abort from such a condition and that's why it gets this undocumented
|
abort from such a condition and that's why it got this undocumented
|
||||||
error. This is planned to change in a future release.
|
error. This should not occur in releases after 7.4.1.
|
||||||
|
|
||||||
4.7. How do I keep usernames and passwords secret in Curl command lines?
|
4.7. How do I keep usernames and passwords secret in Curl command lines?
|
||||||
|
|
||||||
@@ -370,89 +404,162 @@ FAQ
|
|||||||
at least hide them from being read by human eyes, but that is not what
|
at least hide them from being read by human eyes, but that is not what
|
||||||
anyone would call security.
|
anyone would call security.
|
||||||
|
|
||||||
|
Also note that regular HTTP and FTP passwords are sent in clear across the
|
||||||
|
network. All it takes for anyone to fetch them is to listen on the network.
|
||||||
|
Evesdropping is very easy.
|
||||||
|
|
||||||
|
4.8 I found a bug!
|
||||||
|
|
||||||
|
It is not a bug if the behaviour is documented. Read the docs first.
|
||||||
|
|
||||||
|
If it is a problem with a binary you've downloaded or a package for your
|
||||||
|
particular platform, try contacting the person who built the package/archive
|
||||||
|
you have.
|
||||||
|
|
||||||
|
If there is a bug, post a bug report in the Curl Bug Track System over at
|
||||||
|
http://sourceforge.net/bugs/?group_id=976
|
||||||
|
|
||||||
|
Always include as many details you can think of, including curl version,
|
||||||
|
operating system name and version and complete instructions how to repeat
|
||||||
|
the bug.
|
||||||
|
|
||||||
|
4.9. Curl can't authenticate to the server that requires NTLM?
|
||||||
|
|
||||||
|
NTLM is a Microsoft proprietary protocol. Unfortunately, curl does not
|
||||||
|
currently support that.
|
||||||
|
|
||||||
5. libcurl Issues
|
5. libcurl Issues
|
||||||
|
|
||||||
5.1. Is libcurl thread safe?
|
5.1. Is libcurl thread-safe?
|
||||||
|
|
||||||
As version seven is slowly marching in as the libcurl version to use, we
|
Yes.
|
||||||
have made a serious attempt to address all places in the code where we could
|
|
||||||
forsee problems for multi-threaded programs. If your system has them, curl
|
We have written the libcurl code specificly adjusted for multi-threaded
|
||||||
will attempt to use threadsafe functions instead of non-safe ones.
|
programs. libcurl will use thread-safe functions instead of non-safe ones if
|
||||||
|
your system has such.
|
||||||
|
|
||||||
I am very interested in once and for all getting some kind of report or
|
I am very interested in once and for all getting some kind of report or
|
||||||
README file from those who have used libcurl in a threaded environment,
|
README file from those who have used libcurl in a threaded environment,
|
||||||
since I haven't and I get this question more and more frequently!
|
since I haven't and I get this question more and more frequently!
|
||||||
|
|
||||||
|
5.2 How can I receive all data into a large memory chunk?
|
||||||
|
|
||||||
|
You are in full control of the callback function that gets called every time
|
||||||
|
there is data received from the remote server. You can make that callback do
|
||||||
|
whatever you want. You do not have to write the receivied data to a file.
|
||||||
|
|
||||||
|
One solution to this problem could be to have a pointer to a struct that you
|
||||||
|
pass to the callback function. You set the pointer using the
|
||||||
|
curl_easy_setopt(CURLOPT_FILE) function. Then that pointer will be passed to
|
||||||
|
the callback instead of a FILE * to a file:
|
||||||
|
|
||||||
|
/* imaginary struct */
|
||||||
|
struct MemoryStruct {
|
||||||
|
char *memory;
|
||||||
|
size_t size;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* imaginary callback function */
|
||||||
|
size_t
|
||||||
|
WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
|
||||||
|
{
|
||||||
|
register int realsize = size * nmemb;
|
||||||
|
struct MemoryStruct *mem = (struct MemoryStruct *)data;
|
||||||
|
|
||||||
|
mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1);
|
||||||
|
if (mem->memory) {
|
||||||
|
memcpy(&(mem->memory[mem->size]), ptr, realsize);
|
||||||
|
mem->size += realsize;
|
||||||
|
mem->memory[mem->size] = 0;
|
||||||
|
}
|
||||||
|
return realsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
5.3 How do I fetch multiple files with libcurl?
|
||||||
|
|
||||||
|
The easy interface of libcurl does not support multiple requests using the
|
||||||
|
same connection. The only available way to do multiple requests is to
|
||||||
|
init/perform/cleanup for each request.
|
||||||
|
|
||||||
|
5.4 Does libcurl do Winsock initing on win32 systems?
|
||||||
|
|
||||||
|
No.
|
||||||
|
|
||||||
|
On win32 systems, you need to init the winsock stuff manually, libcurl will
|
||||||
|
not do that for you. WSAStartup() and WSACleanup() should be used
|
||||||
|
accordingly. The reason for this is of course that a single application may
|
||||||
|
use several different libraries and parts, and there's no reason for every
|
||||||
|
single library to do this.
|
||||||
|
|
||||||
|
5.5 Does CURLOPT_FILE work on win32 ?
|
||||||
|
|
||||||
|
Yes, but you cannot open a FILE * and pass the pointer to a DLL and have
|
||||||
|
that DLL use the FILE *. You must use CURLOPT_WRITEFUNCTION as well to set a
|
||||||
|
function that writes the file, even if that simply writes the data to the
|
||||||
|
specified FILE*.
|
||||||
|
|
||||||
|
(provided by Joel DeYoung)
|
||||||
|
|
||||||
|
5.6 What about Keep-Alive or persistant connections?
|
||||||
|
|
||||||
|
This is closely related to issue 5.3. Since libcurl has no real support
|
||||||
|
for doing multiple file transfers, there's no support for Keep-Alive or
|
||||||
|
persistant connections either.
|
||||||
|
|
||||||
|
This is of course subject to change as soon as libcurl gets support for
|
||||||
|
multiple files. Feel free to join in and make this change happen sooner!
|
||||||
|
|
||||||
6. License Issues
|
6. License Issues
|
||||||
|
|
||||||
Curl and libcurl are released under the MPL, the Mozilla Public License. To
|
NOTE: This section is now updated to concern curl 7.5.2 or later!
|
||||||
get a really good answer to this or other licensing questions, you should
|
|
||||||
study the MPL license and the license you are about to use and check for
|
Curl and libcurl are released under a MIT/X derivate license *or* the MPL,
|
||||||
clashes yourself. This is a brief summary for the cases we get the most
|
the Mozilla Public License. To get a really good answer to your license
|
||||||
questions. (Parts of this section was enhanced by Bjorn Reese.)
|
conflict questions, you should study the MPL and MIT/X licenses and the
|
||||||
|
license you are about to use and check for clashes yourself. This section is
|
||||||
|
just a brief summary for the cases we get the most questions. (Parts of this
|
||||||
|
section was much enhanced by Bjorn Reese.)
|
||||||
|
|
||||||
6.1. I have a GPL program, can I use the libcurl library?
|
6.1. I have a GPL program, can I use the libcurl library?
|
||||||
|
|
||||||
No, unfortunately you cannot distribute the (lib)curl code with your code.
|
Yes!
|
||||||
According to both the Free Software Foundation and the Mozilla
|
|
||||||
Organization, MPL and GPL are not compatible, because GPL requires of
|
|
||||||
other licenses that they do "not impose any further restrictions on the
|
|
||||||
recipients' exercise of the rights granted herein" [GPL paragraph 6] (One
|
|
||||||
could argue about which license that actually imposes restrictions, but
|
|
||||||
that'll be left for you to ponder about.)
|
|
||||||
|
|
||||||
However, you have two alternative options:
|
Since libcurl may be distributed under the MIT/X derivate license, it can be
|
||||||
|
used together with GPL in any software.
|
||||||
1) Nothing prevents you from distributing your program separately from
|
|
||||||
curl and libcurl, and request that the user receives it separately.
|
|
||||||
The incompability issues between MPL and GPL only applies to the
|
|
||||||
distribution.
|
|
||||||
|
|
||||||
2) Add the following exception to your distribution (you must have the
|
|
||||||
consent of all the copyright holders of the source code in your
|
|
||||||
project in order to do this)
|
|
||||||
|
|
||||||
As a special exception, you have permission to link this program
|
|
||||||
with the curl library and distribute executables, as long as you
|
|
||||||
follow the requirements of the GNU GPL in regard to all of the
|
|
||||||
software in the executable aside from curl.
|
|
||||||
|
|
||||||
This exception must be added to your GPL covered source code files
|
|
||||||
immediately after the notification mentioned in the appendix of GPL.
|
|
||||||
The wording was originally suggested by the Free Software Foundation
|
|
||||||
in relationship with the Qt library. We have changed the wording to
|
|
||||||
apply to curl.
|
|
||||||
|
|
||||||
6.2. I have a closed-source program, can I use the libcurl library?
|
6.2. I have a closed-source program, can I use the libcurl library?
|
||||||
|
|
||||||
Yes, libcurl does not put any restrictions on the program that uses the
|
Yes.
|
||||||
library. If you end up doing changes to the library, only those changes
|
|
||||||
must be made available, not the ones to your program.
|
libcurl does not put any restrictions on the program that uses the
|
||||||
|
library.
|
||||||
|
|
||||||
6.3. I have a BSD licensed program, can I use the libcurl library?
|
6.3. I have a BSD licensed program, can I use the libcurl library?
|
||||||
|
|
||||||
Yes, libcurl does not put any restrictions on the program that uses the
|
Yes.
|
||||||
library. If you end up doing changes to the library, only those changes
|
|
||||||
must be made available, not the ones to your program.
|
libcurl does not put any restrictions on the program that uses the
|
||||||
|
library.
|
||||||
|
|
||||||
6.4. I have a program that uses LGPL libraries, can I use libcurl?
|
6.4. I have a program that uses LGPL libraries, can I use libcurl?
|
||||||
|
|
||||||
Yes you can. LGPL libraries don't spread to other libraries the same way
|
Yes.
|
||||||
GPL ones do.
|
|
||||||
|
|
||||||
However, when you read paragraph (3) of the LGPL license, you'll see that
|
The LGPL license don't clash with other licenses.
|
||||||
anyone - at will - may at any time convert that LGPL program into GPL. And
|
|
||||||
GPL programs can't be distributed together with MPL programs, neither with
|
|
||||||
(lib)curl source code and not as a binary.
|
|
||||||
|
|
||||||
6.5. Can I modify curl/libcurl for my program and keep the changes secret?
|
6.5. Can I modify curl/libcurl for my program and keep the changes secret?
|
||||||
|
|
||||||
No, you're not allowed to do that.
|
Yes.
|
||||||
|
|
||||||
|
The MIT/X derivate license practically allows you to do almost anything with
|
||||||
|
the sources, on the condition that the copyright texts in the sources are
|
||||||
|
left intact.
|
||||||
|
|
||||||
6.6. Can you please change the curl/libcurl license to XXXX?
|
6.6. Can you please change the curl/libcurl license to XXXX?
|
||||||
|
|
||||||
No. We carefully picked this license years ago and a large amount of
|
No. We carefully picked this license years ago and a large amount of people
|
||||||
people have contributed with source code knowing that this is the license
|
have contributed with source code knowing that this is the license we
|
||||||
we use. This license puts the restrictions we want on curl/libcurl and it
|
use. This license puts the restrictions we want on curl/libcurl and it does
|
||||||
does not spread to other programs or libraries that use it.
|
not spread to other programs or libraries that use it. The recent dual
|
||||||
|
license modification should make it possible for everyone to use libcurl or
|
||||||
|
curl in their projects, no matter what license they already have in use.
|
||||||
|
|||||||
@@ -15,9 +15,11 @@ Misc
|
|||||||
- guesses protocol from host name unless specified
|
- guesses protocol from host name unless specified
|
||||||
- uses .netrc
|
- uses .netrc
|
||||||
- progress bar/time specs while downloading
|
- progress bar/time specs while downloading
|
||||||
- PROXY environment variables support
|
- "standard" proxy environment variables support
|
||||||
- config file support
|
- config file support
|
||||||
- compiles on win32
|
- compiles on win32
|
||||||
|
- redirectable stderr
|
||||||
|
- use selected network interface for outgoing traffic
|
||||||
|
|
||||||
HTTP
|
HTTP
|
||||||
- GET
|
- GET
|
||||||
@@ -28,9 +30,10 @@ HTTP
|
|||||||
- authentication
|
- authentication
|
||||||
- resume
|
- resume
|
||||||
- follow redirects
|
- follow redirects
|
||||||
|
- maximum amount of redirects to follow
|
||||||
- custom HTTP request
|
- custom HTTP request
|
||||||
- cookie get/send
|
- cookie get/send fully parsed
|
||||||
- understands the netscape cookie file
|
- understands the netscape cookie file format
|
||||||
- custom headers (that can replace/remove internally generated headers)
|
- custom headers (that can replace/remove internally generated headers)
|
||||||
- custom user-agent string
|
- custom user-agent string
|
||||||
- custom referer string
|
- custom referer string
|
||||||
@@ -38,15 +41,18 @@ HTTP
|
|||||||
- proxy authentication
|
- proxy authentication
|
||||||
- time conditions
|
- time conditions
|
||||||
- via http-proxy
|
- via http-proxy
|
||||||
|
- retrieve file modification date
|
||||||
|
|
||||||
HTTPS (*1)
|
HTTPS (*1)
|
||||||
- (all the HTTP features)
|
- (all the HTTP features)
|
||||||
- using certificates
|
- using certificates
|
||||||
|
- verify server certificate
|
||||||
- via http-proxy
|
- via http-proxy
|
||||||
|
|
||||||
FTP
|
FTP
|
||||||
- download
|
- download
|
||||||
- authentication
|
- authentication
|
||||||
|
- kerberos security
|
||||||
- PORT or PASV
|
- PORT or PASV
|
||||||
- single file size information (compare to HTTP HEAD)
|
- single file size information (compare to HTTP HEAD)
|
||||||
- 'type=' URL support
|
- 'type=' URL support
|
||||||
@@ -60,6 +66,8 @@ FTP
|
|||||||
- custom ftp commands (before and/or after the transfer)
|
- custom ftp commands (before and/or after the transfer)
|
||||||
- simple "range" support
|
- simple "range" support
|
||||||
- via http-proxy
|
- via http-proxy
|
||||||
|
- all operations can be tunneled through a http-proxy
|
||||||
|
- customizable to retrieve file modification date
|
||||||
|
|
||||||
TELNET
|
TELNET
|
||||||
- connection negotiation
|
- connection negotiation
|
||||||
|
|||||||
128
docs/INSTALL
128
docs/INSTALL
@@ -11,35 +11,8 @@ way to proceed is mainly divided in two different ways: the unix way or the
|
|||||||
windows way.
|
windows way.
|
||||||
|
|
||||||
If you're using Windows (95, 98, NT) or OS/2, you should continue reading from
|
If you're using Windows (95, 98, NT) or OS/2, you should continue reading from
|
||||||
the Win32 header below. All other systems should be capable of being installed
|
the Win32 or OS/2 headers further down. All other systems should be capable of
|
||||||
as described in the the UNIX header.
|
being installed as described below.
|
||||||
|
|
||||||
PORTS
|
|
||||||
=====
|
|
||||||
Just to show off, this is a probably incomplete list of known hardware and
|
|
||||||
operating systems that curl has been compiled for:
|
|
||||||
|
|
||||||
- Ultrix
|
|
||||||
- SINIX-Z v5
|
|
||||||
Alpha DEC OSF 4
|
|
||||||
Alpha Digital UNIX V3.2D-1 (rev 41)
|
|
||||||
HP-PA HP-UX 10.X 11.X
|
|
||||||
MIPS IRIX 6.2, 6.5
|
|
||||||
Power AIX 4.2, 4.3.1, 4.3.2
|
|
||||||
PowerPC Darwin 1.0
|
|
||||||
PowerPC Mac OS X
|
|
||||||
Sparc Solaris 2.4, 2.5, 2.5.1, 2.6, 7
|
|
||||||
Sparc SunOS 4.1.*
|
|
||||||
i386 BeOS
|
|
||||||
i386 FreeBSD
|
|
||||||
i386 Linux 1.3, 2.0, 2.2
|
|
||||||
i386 NetBSD
|
|
||||||
i386 OS/2
|
|
||||||
i386 OpenBSD
|
|
||||||
i386 Solaris 2.7
|
|
||||||
i386 Windows 95, 98, NT
|
|
||||||
m68k AmigaOS 3
|
|
||||||
m68k OpenBSD
|
|
||||||
|
|
||||||
UNIX
|
UNIX
|
||||||
====
|
====
|
||||||
@@ -47,7 +20,9 @@ UNIX
|
|||||||
The configure script *always* tries to find a working SSL library unless
|
The configure script *always* tries to find a working SSL library unless
|
||||||
explicitly told not to. If you have OpenSSL installed in the default
|
explicitly told not to. If you have OpenSSL installed in the default
|
||||||
search path for your compiler/linker, you don't need to do anything
|
search path for your compiler/linker, you don't need to do anything
|
||||||
special.
|
special:
|
||||||
|
|
||||||
|
./configure
|
||||||
|
|
||||||
If you have OpenSSL installed in /usr/local/ssl, you can run configure
|
If you have OpenSSL installed in /usr/local/ssl, you can run configure
|
||||||
like:
|
like:
|
||||||
@@ -95,21 +70,44 @@ UNIX
|
|||||||
|
|
||||||
Use the executable `curl` in src/ directory.
|
Use the executable `curl` in src/ directory.
|
||||||
|
|
||||||
'make install' copies the curl file to /usr/local/bin/ (or $prefix/bin
|
To install curl on your system, run
|
||||||
if you used the --prefix option to configure) and copies the curl.1
|
|
||||||
man page to a suitable place too.
|
make install
|
||||||
|
|
||||||
|
This will copy curl to /usr/local/bin/ (or $prefix/bin if you used the
|
||||||
|
--prefix option to configure) and it copies the man pages, the lib and the
|
||||||
|
include files to suitable places.
|
||||||
|
|
||||||
|
To make sure everything runs as supposed, run the test suite:
|
||||||
|
|
||||||
|
make test
|
||||||
|
|
||||||
KNOWN PROBLEMS
|
KNOWN PROBLEMS
|
||||||
|
|
||||||
If you happen to have autoconf installed, but a version older than
|
If you happen to have autoconf installed, but a version older than
|
||||||
2.12 you will get into trouble. Then you can still build curl by
|
2.12 you will get into trouble. Then you can still build curl by
|
||||||
issuing these commands: (from Ralph Beckmann <rabe@uni-paderborn.de>)
|
issuing these commands: (from Ralph Beckmann)
|
||||||
|
|
||||||
./configure [...]
|
./configure [...]
|
||||||
cd lib; make; cd ..
|
cd lib; make; cd ..
|
||||||
cd src; make; cd ..
|
cd src; make; cd ..
|
||||||
cp src/curl elsewhere/bin/
|
cp src/curl elsewhere/bin/
|
||||||
|
|
||||||
|
As suggested by David West, you can make a faked version of autoconf and
|
||||||
|
autoheader:
|
||||||
|
|
||||||
|
----start of autoconf----
|
||||||
|
#!/bin/bash
|
||||||
|
#fake autoconf for building curl
|
||||||
|
if [ "$1" = "--version" ] then
|
||||||
|
echo "Autoconf version 2.13"
|
||||||
|
fi
|
||||||
|
----end of autoconf----
|
||||||
|
|
||||||
|
Then make autoheader a symbolic link to the same script and make sure
|
||||||
|
they're executable and set to appear in the path *BEFORE* the actual (but
|
||||||
|
obsolete) autoconf and autoheader scripts.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
|
|
||||||
Remember, to force configure to use the standard cc compiler if both
|
Remember, to force configure to use the standard cc compiler if both
|
||||||
@@ -119,6 +117,27 @@ UNIX
|
|||||||
or
|
or
|
||||||
env Cc=cc ./configure
|
env Cc=cc ./configure
|
||||||
|
|
||||||
|
To force a static library compile, disable the shared library creation
|
||||||
|
by running configure like:
|
||||||
|
|
||||||
|
./configure --disable-shared
|
||||||
|
|
||||||
|
To tell the configure script to skip searching for thread-safe functions,
|
||||||
|
add an option like:
|
||||||
|
|
||||||
|
./configure --disable-thread
|
||||||
|
|
||||||
|
To build curl with kerberos4 support enabled, curl requires the krb4 libs
|
||||||
|
and headers installed. You can then use a set of options to tell
|
||||||
|
configure where those are:
|
||||||
|
|
||||||
|
--with-krb4-includes[=DIR] Specify location of kerberos4 headers
|
||||||
|
--with-krb4-libs[=DIR] Specify location of kerberos4 libs
|
||||||
|
--with-krb4[=DIR] where to look for Kerberos4
|
||||||
|
|
||||||
|
In most cases, /usr/athena is the install prefix and then it works with
|
||||||
|
|
||||||
|
./configure --with-krb4=/usr/athena
|
||||||
|
|
||||||
Win32
|
Win32
|
||||||
=====
|
=====
|
||||||
@@ -150,6 +169,8 @@ Win32
|
|||||||
set, then run 'nmake -f Makefile.vc6' in the lib/ dir and then
|
set, then run 'nmake -f Makefile.vc6' in the lib/ dir and then
|
||||||
'nmake -f Makefile.vc6' in the src/ dir.
|
'nmake -f Makefile.vc6' in the src/ dir.
|
||||||
|
|
||||||
|
The vcvars32.bat file is part of the Microsoft development environment.
|
||||||
|
|
||||||
IDE-style
|
IDE-style
|
||||||
-------------------------
|
-------------------------
|
||||||
If you use VC++, Borland or similar compilers. Include all lib source
|
If you use VC++, Borland or similar compilers. Include all lib source
|
||||||
@@ -195,6 +216,8 @@ Win32
|
|||||||
set, then run 'nmake -f Makefile.vc6 release-ssl' in the lib/ dir and
|
set, then run 'nmake -f Makefile.vc6 release-ssl' in the lib/ dir and
|
||||||
then 'nmake -f Makefile.vc6' in the src/ dir.
|
then 'nmake -f Makefile.vc6' in the src/ dir.
|
||||||
|
|
||||||
|
The vcvars32.bat file is part of the Microsoft development environment.
|
||||||
|
|
||||||
Microsoft / Borland style
|
Microsoft / Borland style
|
||||||
-------------------------
|
-------------------------
|
||||||
If you have OpenSSL, and want curl to take advantage of it, edit your
|
If you have OpenSSL, and want curl to take advantage of it, edit your
|
||||||
@@ -232,6 +255,41 @@ IBM OS/2
|
|||||||
If you're getting huge binaries, probably your makefiles have the -g in
|
If you're getting huge binaries, probably your makefiles have the -g in
|
||||||
CFLAGS.
|
CFLAGS.
|
||||||
|
|
||||||
|
PORTS
|
||||||
|
=====
|
||||||
|
Just to show off, this is a probably incomplete list of known hardware and
|
||||||
|
operating systems that curl has been compiled for:
|
||||||
|
|
||||||
|
- Ultrix
|
||||||
|
- SINIX-Z v5
|
||||||
|
- Alpha DEC OSF 4
|
||||||
|
- Alpha Digital UNIX v3.2
|
||||||
|
- Alpha FreeBSD 4.1
|
||||||
|
- Alpha Linux 2.2.16
|
||||||
|
- Alpha Tru64 v5.0 5.1
|
||||||
|
- HP-PA HP-UX 9.X 10.X 11.X
|
||||||
|
- MIPS IRIX 6.2, 6.5
|
||||||
|
- Power AIX 4.2, 4.3.1, 4.3.2
|
||||||
|
- PowerPC Darwin 1.0
|
||||||
|
- PowerPC Linux
|
||||||
|
- PowerPC Mac OS X
|
||||||
|
- Sparc Linux
|
||||||
|
- Sparc Solaris 2.4, 2.5, 2.5.1, 2.6, 7, 8
|
||||||
|
- Sparc SunOS 4.1.X
|
||||||
|
- i386 BeOS
|
||||||
|
- i386 FreeBSD
|
||||||
|
- i386 Linux 1.3, 2.0, 2.2, 2.3, 2.4
|
||||||
|
- i386 NetBSD
|
||||||
|
- i386 OS/2
|
||||||
|
- i386 OpenBSD
|
||||||
|
- i386 SCO unix
|
||||||
|
- i386 Solaris 2.7
|
||||||
|
- i386 Windows 95, 98, ME, NT, 2000
|
||||||
|
- ia64 Linux 2.3.99
|
||||||
|
- m68k AmigaOS 3
|
||||||
|
- m68k OpenBSD
|
||||||
|
- StrongARM NetBSD 1.4.1
|
||||||
|
|
||||||
OpenSSL
|
OpenSSL
|
||||||
=======
|
=======
|
||||||
|
|
||||||
@@ -245,7 +303,7 @@ MingW32/Cygwin
|
|||||||
|
|
||||||
You'll find MingW32 and Cygwin information at:
|
You'll find MingW32 and Cygwin information at:
|
||||||
|
|
||||||
http://www.xraylith.wisc.edu/~khan/software/gnu-win32/index.html
|
http://www.mingw.org
|
||||||
|
|
||||||
OpenLDAP
|
OpenLDAP
|
||||||
========
|
========
|
||||||
|
|||||||
212
docs/INTERNALS
212
docs/INTERNALS
@@ -1,3 +1,4 @@
|
|||||||
|
Updated for curl 7.6 on January 26, 2001
|
||||||
_ _ ____ _
|
_ _ ____ _
|
||||||
___| | | | _ \| |
|
___| | | | _ \| |
|
||||||
/ __| | | | |_) | |
|
/ __| | | | |_) | |
|
||||||
@@ -12,30 +13,43 @@ INTERNALS
|
|||||||
|
|
||||||
Thus, the largest amount of code and complexity is in the library part.
|
Thus, the largest amount of code and complexity is in the library part.
|
||||||
|
|
||||||
|
CVS
|
||||||
|
===
|
||||||
|
All changes to the sources are committed to the CVS repository as soon as
|
||||||
|
they're somewhat verified to work. Changes shall be commited as independently
|
||||||
|
as possible so that individual changes can be easier spotted and tracked
|
||||||
|
afterwards.
|
||||||
|
|
||||||
|
Tagging shall be used extensively, and by the time we release new archives we
|
||||||
|
should tag the sources with a name similar to the released version number.
|
||||||
|
|
||||||
Windows vs Unix
|
Windows vs Unix
|
||||||
===============
|
===============
|
||||||
|
|
||||||
There are a few differences in how to program curl the unix way compared to
|
There are a few differences in how to program curl the unix way compared to
|
||||||
the Windows way. The four most notable details are:
|
the Windows way. The four perhaps most notable details are:
|
||||||
|
|
||||||
|
1. Different function names for socket operations.
|
||||||
|
|
||||||
|
In curl, this is solved with defines and macros, so that the source looks
|
||||||
|
the same at all places except for the header file that defines them. The
|
||||||
|
macros in use are sclose(), sread() and swrite().
|
||||||
|
|
||||||
1. Different function names for close(), read(), write()
|
|
||||||
2. Windows requires a couple of init calls for the socket stuff
|
2. Windows requires a couple of init calls for the socket stuff
|
||||||
|
|
||||||
|
Those must be made by the application that uses libcurl, in curl that means
|
||||||
|
src/main.c has some code #ifdef'ed to do just that.
|
||||||
|
|
||||||
3. The file descriptors for network communication and file operations are
|
3. The file descriptors for network communication and file operations are
|
||||||
not easily interchangable as in unix
|
not easily interchangable as in unix
|
||||||
|
|
||||||
|
We avoid this by not trying any funny tricks on file descriptors.
|
||||||
|
|
||||||
4. When writing data to stdout, Windows makes end-of-lines the DOS way, thus
|
4. When writing data to stdout, Windows makes end-of-lines the DOS way, thus
|
||||||
destroying binary data, although you do want that conversion if it is
|
destroying binary data, although you do want that conversion if it is
|
||||||
text coming through... (sigh)
|
text coming through... (sigh)
|
||||||
|
|
||||||
In curl, (1) is made with defines and macros, so that the source looks the
|
We set stdout to binary under windows
|
||||||
same at all places except for the header file that defines them.
|
|
||||||
|
|
||||||
(2) must be made by the application that uses libcurl, in curl that means
|
|
||||||
src/main.c has some code #ifdef'ed to do just that.
|
|
||||||
|
|
||||||
(3) is simply avoided by not trying any funny tricks on file descriptors.
|
|
||||||
|
|
||||||
(4) is left alone, giving windows users problems when they pipe binary data
|
|
||||||
through stdout...
|
|
||||||
|
|
||||||
Inside the source code, I do make an effort to avoid '#ifdef WIN32'. All
|
Inside the source code, I do make an effort to avoid '#ifdef WIN32'. All
|
||||||
conditionals that deal with features *should* instead be in the format
|
conditionals that deal with features *should* instead be in the format
|
||||||
@@ -44,13 +58,16 @@ Windows vs Unix
|
|||||||
supposed to look exactly as a config.h file would have looked like on a
|
supposed to look exactly as a config.h file would have looked like on a
|
||||||
Windows machine!
|
Windows machine!
|
||||||
|
|
||||||
|
Generally speaking: always remember that this will be compiled on dozens of
|
||||||
|
operating systems. Don't walk on the edge.
|
||||||
|
|
||||||
Library
|
Library
|
||||||
=======
|
=======
|
||||||
|
|
||||||
As described elsewhere, libcurl is meant to get two different "layers" of
|
As described elsewhere, libcurl is meant to get two different "layers" of
|
||||||
interface. At the present point only the high-level, the "easy", interface
|
interfaces. At the present point only the high-level, the "easy", interface
|
||||||
has been fully implemented and thus documented. We assume the easy-interface
|
has been fully implemented and documented. We assume the easy-interface in
|
||||||
in this description, the low-level interface will be documented when fully
|
this description, the low-level interface will be documented when fully
|
||||||
implemented.
|
implemented.
|
||||||
|
|
||||||
There are plenty of entry points to the library, namely each publicly defined
|
There are plenty of entry points to the library, namely each publicly defined
|
||||||
@@ -58,37 +75,43 @@ Library
|
|||||||
rather small and easy-to-follow. All the ones prefixed with 'curl_easy' are
|
rather small and easy-to-follow. All the ones prefixed with 'curl_easy' are
|
||||||
put in the lib/easy.c file.
|
put in the lib/easy.c file.
|
||||||
|
|
||||||
|
All printf()-style functions use the supplied clones in lib/mprintf.c. This
|
||||||
|
makes sure we stay absolutely platform independent.
|
||||||
|
|
||||||
|
curl_easy_init() allocates an internal struct and makes some initializations.
|
||||||
|
The returned handle does not revail internals.
|
||||||
|
|
||||||
curl_easy_setopt() takes a three arguments, where the option stuff must be
|
curl_easy_setopt() takes a three arguments, where the option stuff must be
|
||||||
passed in pairs, the parameter-ID and the parameter-value. The list of
|
passed in pairs, the parameter-ID and the parameter-value. The list of
|
||||||
options is documented in the man page.
|
options is documented in the man page.
|
||||||
|
|
||||||
curl_easy_perform() does a whole lot of things.
|
curl_easy_perform() does a whole lot of things:
|
||||||
|
|
||||||
The function analyzes the URL, get the different components and connects to
|
It starts off in the lib/easy.c file by calling curl_transfer(), but the main
|
||||||
the remote host. This may involve using a proxy and/or using SSL. The
|
work is lib/url.c. The function first analyzes the URL, it separates the
|
||||||
GetHost() function in lib/hostip.c is used for looking up host names.
|
different components and connects to the remote host. This may involve using
|
||||||
|
a proxy and/or using SSL. The Curl_gethost() function in lib/hostip.c is used
|
||||||
|
for looking up host names.
|
||||||
|
|
||||||
When connected, the proper function is called. The functions are named after
|
When connected, the proper protocol-specific function is called. The
|
||||||
the protocols they handle. ftp(), http(), dict(), etc. They all reside in
|
functions are named after the protocols they handle. Curl_ftp(), Curl_http(),
|
||||||
their respective files (ftp.c, http.c and dict.c).
|
Curl_dict(), etc. They all reside in their respective files (ftp.c, http.c
|
||||||
|
and dict.c).
|
||||||
|
|
||||||
The protocol-specific functions deal with protocol-specific negotiations and
|
The protocol-specific functions of course deal with protocol-specific
|
||||||
setup. They have access to the sendf() (from lib/sendf.c) function to send
|
negotiations and setup. They have access to the Curl_sendf() (from
|
||||||
printf-style formatted data to the remote host and when they're ready to make
|
lib/sendf.c) function to send printf-style formatted data to the remote host
|
||||||
the actual file transfer they call the Transfer() function (in
|
and when they're ready to make the actual file transfer they call the
|
||||||
lib/download.c) to do the transfer. All printf()-style functions use the
|
Curl_Transfer() function (in lib/transfer.c) to setup the transfer and
|
||||||
supplied clones in lib/mprintf.c.
|
returns. curl_transfer() then calls _Tranfer() in lib/transfer.c that
|
||||||
|
performs the entire file transfer.
|
||||||
|
|
||||||
While transfering, the progress functions in lib/progress.c are called at a
|
During transfer, the progress functions in lib/progress.c are called at a
|
||||||
frequent interval (or at the user's choice, a specified callback might get
|
frequent interval (or at the user's choice, a specified callback might get
|
||||||
called). The speedcheck functions in lib/speedcheck.c are also used to verify
|
called). The speedcheck functions in lib/speedcheck.c are also used to verify
|
||||||
that the transfer is as fast as required.
|
that the transfer is as fast as required.
|
||||||
|
|
||||||
When the operation is done, the writeout() function in lib/writeout.c may be
|
When completed, the curl_easy_cleanup() should be called to free up used
|
||||||
called to report about the operation as specified previously in the arguments
|
|
||||||
to curl_easy_setopt().
|
|
||||||
|
|
||||||
When completed curl_easy_cleanup() should be called to free up used
|
|
||||||
resources.
|
resources.
|
||||||
|
|
||||||
HTTP(S)
|
HTTP(S)
|
||||||
@@ -97,9 +120,8 @@ Library
|
|||||||
code. There is a special file (lib/formdata.c) that offers all the multipart
|
code. There is a special file (lib/formdata.c) that offers all the multipart
|
||||||
post functions.
|
post functions.
|
||||||
|
|
||||||
base64-functions for user+password stuff is in (lib/base64.c) and all
|
base64-functions for user+password stuff (and more) is in (lib/base64.c) and
|
||||||
functions for parsing and sending cookies are found in
|
all functions for parsing and sending cookies are found in (lib/cookie.c).
|
||||||
(lib/cookie.c).
|
|
||||||
|
|
||||||
HTTPS uses in almost every means the same procedure as HTTP, with only two
|
HTTPS uses in almost every means the same procedure as HTTP, with only two
|
||||||
exceptions: the connect procedure is different and the function used to read
|
exceptions: the connect procedure is different and the function used to read
|
||||||
@@ -109,9 +131,17 @@ Library
|
|||||||
|
|
||||||
FTP
|
FTP
|
||||||
|
|
||||||
The if2ip() function can be used for getting the IP number of a specified
|
The Curl_if2ip() function can be used for getting the IP number of a
|
||||||
network interface, and it resides in lib/if2ip.c. It is only used for the FTP
|
specified network interface, and it resides in lib/if2ip.c.
|
||||||
PORT command.
|
|
||||||
|
Curl_ftpsendf() is used for sending FTP commands to the remote server. It was
|
||||||
|
made a separate function to prevent us programmers from forgetting that they
|
||||||
|
must be CRLF terminated. They must also be sent in one single write() to make
|
||||||
|
firewalls and similar happy.
|
||||||
|
|
||||||
|
Kerberos
|
||||||
|
|
||||||
|
The kerberos support is mainly in lib/krb4.c and lib/security.c.
|
||||||
|
|
||||||
TELNET
|
TELNET
|
||||||
|
|
||||||
@@ -130,31 +160,115 @@ Library
|
|||||||
URL encoding and decoding, called escaping and unescaping in the source code,
|
URL encoding and decoding, called escaping and unescaping in the source code,
|
||||||
is found in lib/escape.c.
|
is found in lib/escape.c.
|
||||||
|
|
||||||
While transfering data in Transfer() a few functions might get
|
While transfering data in _Transfer() a few functions might get
|
||||||
used. curl_getdate() in lib/getdate.c is for HTTP date comparisons (and
|
used. curl_getdate() in lib/getdate.c is for HTTP date comparisons (and
|
||||||
more).
|
more).
|
||||||
|
|
||||||
lib/getenv.c offers curl_getenv() which is for reading environment variables
|
lib/getenv.c offers curl_getenv() which is for reading environment variables
|
||||||
in a neat platform independent way. That's used in the client, but also in
|
in a neat platform independent way. That's used in the client, but also in
|
||||||
lib/url.c when checking the PROXY variables.
|
lib/url.c when checking the proxy environment variables. Note that contrary
|
||||||
|
to the normal unix getenv(), this returns an allocated buffer that must be
|
||||||
|
free()ed after use.
|
||||||
|
|
||||||
lib/netrc.c keeps the .netrc parser
|
lib/netrc.c holds the .netrc parser
|
||||||
|
|
||||||
lib/timeval.c features replacement functions for systems that don't have
|
lib/timeval.c features replacement functions for systems that don't have
|
||||||
|
gettimeofday() and a few support functions for timeval convertions.
|
||||||
|
|
||||||
A function named curl_version() that returns the full curl version string is
|
A function named curl_version() that returns the full curl version string is
|
||||||
found in lib/version.c.
|
found in lib/version.c.
|
||||||
|
|
||||||
|
If authentication is requested but no password is given, a getpass_r() clone
|
||||||
|
exists in lib/getpass.c. libcurl offers a custom callback that can be used
|
||||||
|
instead of this, but it doesn't change much to us.
|
||||||
|
|
||||||
|
Library Symbols
|
||||||
|
===============
|
||||||
|
|
||||||
|
All symbols used internally in libcurl must use a 'Curl_' prefix if they're
|
||||||
|
used in more than a single file. Single-file symbols must be made
|
||||||
|
static. Public (exported) symbols must use a 'curl_' prefix. (There are
|
||||||
|
exceptions, but they are destined to be changed to follow this pattern in the
|
||||||
|
future.)
|
||||||
|
|
||||||
|
Return Codes and Informationals
|
||||||
|
===============================
|
||||||
|
|
||||||
|
I've made things simple. Almost every function in libcurl returns a CURLcode,
|
||||||
|
that must be CURLE_OK if everything is OK or otherwise a suitable error code
|
||||||
|
as the curl/curl.h include file defines. The very spot that detects an error
|
||||||
|
must use the Curl_failf() function to set the human-readable error
|
||||||
|
description.
|
||||||
|
|
||||||
|
In aiding the user to understand what's happening and to debug curl usage, we
|
||||||
|
must supply a fair amount of informational messages by using the Curl_infof()
|
||||||
|
function. Those messages are only displayed when the user explicitly asks for
|
||||||
|
them. They are best used when revealing information that isn't otherwise
|
||||||
|
obvious.
|
||||||
|
|
||||||
Client
|
Client
|
||||||
======
|
======
|
||||||
|
|
||||||
main() resides in src/main.c together with most of the client
|
main() resides in src/main.c together with most of the client code.
|
||||||
code. src/hugehelp.c is automatically generated by the mkhelp.pl perl script
|
src/hugehelp.c is automatically generated by the mkhelp.pl perl script to
|
||||||
to display the complete "manual" and the src/urlglob.c file holds the
|
display the complete "manual" and the src/urlglob.c file holds the functions
|
||||||
functions used for the multiple-URL support.
|
used for the URL-"globbing" support. Globbing in the sense that the {} and []
|
||||||
|
expansion stuff is there.
|
||||||
|
|
||||||
The client mostly mess around to setup its config struct properly, then it
|
The client mostly messes around to setup its 'config' struct properly, then
|
||||||
calls the curl_easy_*() functions of the library and when it gets back
|
it calls the curl_easy_*() functions of the library and when it gets back
|
||||||
control after the curl_easy_perform() it cleans up the library, checks status
|
control after the curl_easy_perform() it cleans up the library, checks status
|
||||||
and exits.
|
and exits.
|
||||||
|
|
||||||
|
When the operation is done, the ourWriteOut() function in src/writeout.c may
|
||||||
|
be called to report about the operation. That function is using the
|
||||||
|
curl_easy_getinfo() function to extract useful information from the curl
|
||||||
|
session.
|
||||||
|
|
||||||
|
Recent versions may loop and do all that several times if many URLs were
|
||||||
|
specified on the command line or config file.
|
||||||
|
|
||||||
|
Memory Debugging
|
||||||
|
================
|
||||||
|
|
||||||
|
The file named lib/memdebug.c contains debug-versions of a few
|
||||||
|
functions. Functions such as malloc, free, fopen, fclose, etc that somehow
|
||||||
|
deal with resources that might give us problems if we "leak" them. The
|
||||||
|
functions in the memdebug system do nothing fancy, they do their normal
|
||||||
|
function and then log information about what they just did. The logged data
|
||||||
|
is then analyzed after a complete session,
|
||||||
|
|
||||||
|
memanalyze.pl is a perl script present only in CVS (not part of the release
|
||||||
|
archives) that analyzes a log file generated by the memdebug system. It
|
||||||
|
detects if resources are allocated but never freed and other kinds of errors
|
||||||
|
related to resource management.
|
||||||
|
|
||||||
|
Use -DMALLOCDEBUG when compiling to enable memory debugging.
|
||||||
|
|
||||||
|
Test Suite
|
||||||
|
==========
|
||||||
|
|
||||||
|
Since November 2000, a test suite has evolved. It is placed in its own
|
||||||
|
subdirectory directly off the root in the curl archive tree, and it contains
|
||||||
|
a bunch of scripts and a lot of test case data.
|
||||||
|
|
||||||
|
The main test script is runtests.pl that will invoke the two servers
|
||||||
|
httpserver.pl and ftpserver.pl before all the test cases are performed. The
|
||||||
|
test suite currently only runs on unix-like platforms.
|
||||||
|
|
||||||
|
You'll find a complete description of the test case data files in the README
|
||||||
|
file in the test directory.
|
||||||
|
|
||||||
|
The test suite automatically detects if curl was built with the memory
|
||||||
|
debugging enabled, and if it was it will detect memory leaks too.
|
||||||
|
|
||||||
|
Building Releases
|
||||||
|
=================
|
||||||
|
|
||||||
|
There's no magic to this. When you consider everything stable enough to be
|
||||||
|
released, run the 'maketgz' script (using 'make distcheck' will give you a
|
||||||
|
pretty good view on the status of the current sources). maketgz prompts for
|
||||||
|
version number of the client and the library before it creates a release
|
||||||
|
archive.
|
||||||
|
|
||||||
|
You must have autoconf installed to build release archives.
|
||||||
|
|||||||
@@ -139,9 +139,11 @@ UPLOADING
|
|||||||
|
|
||||||
curl -T localfile -a ftp://ftp.upload.com/remotefile
|
curl -T localfile -a ftp://ftp.upload.com/remotefile
|
||||||
|
|
||||||
NOTE: Curl does not support ftp upload through a proxy! The reason for this
|
Curl also supports ftp upload through a proxy, but only if the proxy is
|
||||||
is simply that proxies are seldomly configured to allow this and that no
|
configured to allow that kind of tunneling. If it does, you can run curl in
|
||||||
author has supplied code that makes it possible!
|
a fashion similar to:
|
||||||
|
|
||||||
|
curl --proxytunnel -x proxy:port -T localfile ftp.upload.com
|
||||||
|
|
||||||
HTTP
|
HTTP
|
||||||
|
|
||||||
@@ -280,6 +282,8 @@ REFERER
|
|||||||
|
|
||||||
curl -e www.coolsite.com http://www.showme.com/
|
curl -e www.coolsite.com http://www.showme.com/
|
||||||
|
|
||||||
|
NOTE: The referer field is defined in the HTTP spec to be a full URL.
|
||||||
|
|
||||||
USER AGENT
|
USER AGENT
|
||||||
|
|
||||||
A HTTP request has the option to include information about the browser
|
A HTTP request has the option to include information about the browser
|
||||||
@@ -398,17 +402,26 @@ SPEED LIMIT
|
|||||||
CONFIG FILE
|
CONFIG FILE
|
||||||
|
|
||||||
Curl automatically tries to read the .curlrc file (or _curlrc file on win32
|
Curl automatically tries to read the .curlrc file (or _curlrc file on win32
|
||||||
systems) from the user's home dir on startup. The config file should be
|
systems) from the user's home dir on startup.
|
||||||
made up with normal command line switches. Comments can be used within the
|
|
||||||
file. If the first letter on a line is a '#'-letter the rest of the line
|
The config file could be made up with normal command line switches, but you
|
||||||
is treated as a comment.
|
can also specify the long options without the dashes to make it more
|
||||||
|
readable. You can separate the options and the parameter with spaces, or
|
||||||
|
with = or :. Comments can be used within the file. If the first letter on a
|
||||||
|
line is a '#'-letter the rest of the line is treated as a comment.
|
||||||
|
|
||||||
|
If you want the parameter to contain spaces, you must inclose the entire
|
||||||
|
parameter within double quotes ("). Within those quotes, you specify a
|
||||||
|
quote as \".
|
||||||
|
|
||||||
|
NOTE: You must specify options and their arguments on the same line.
|
||||||
|
|
||||||
Example, set default time out and proxy in a config file:
|
Example, set default time out and proxy in a config file:
|
||||||
|
|
||||||
# We want a 30 minute timeout:
|
# We want a 30 minute timeout:
|
||||||
-m 1800
|
-m 1800
|
||||||
# ... and we use a proxy for all accesses:
|
# ... and we use a proxy for all accesses:
|
||||||
-x proxy.our.domain.com:8080
|
proxy = proxy.our.domain.com:8080
|
||||||
|
|
||||||
White spaces ARE significant at the end of lines, but all white spaces
|
White spaces ARE significant at the end of lines, but all white spaces
|
||||||
leading up to the first characters of each line are ignored.
|
leading up to the first characters of each line are ignored.
|
||||||
@@ -422,14 +435,14 @@ CONFIG FILE
|
|||||||
without URL by making a config file similar to:
|
without URL by making a config file similar to:
|
||||||
|
|
||||||
# default url to get
|
# default url to get
|
||||||
http://help.with.curl.com/curlhelp.html
|
url = "http://help.with.curl.com/curlhelp.html"
|
||||||
|
|
||||||
You can specify another config file to be read by using the -K/--config
|
You can specify another config file to be read by using the -K/--config
|
||||||
flag. If you set config file name to "-" it'll read the config from stdin,
|
flag. If you set config file name to "-" it'll read the config from stdin,
|
||||||
which can be handy if you want to hide options from being visible in process
|
which can be handy if you want to hide options from being visible in process
|
||||||
tables etc:
|
tables etc:
|
||||||
|
|
||||||
echo "-u user:passwd" | curl -K - http://that.secret.site.com
|
echo "user = user:passwd" | curl -K - http://that.secret.site.com
|
||||||
|
|
||||||
EXTRA HEADERS
|
EXTRA HEADERS
|
||||||
|
|
||||||
@@ -480,13 +493,14 @@ FTP and firewalls
|
|||||||
connect to the client on the given (as parameters to the PORT command) IP
|
connect to the client on the given (as parameters to the PORT command) IP
|
||||||
number and port.
|
number and port.
|
||||||
|
|
||||||
The -P flag to curl allows for different options. Your machine may have
|
The -P flag to curl supports a few different options. Your machine may have
|
||||||
several IP-addresses and/or network interfaces and curl allows you to select
|
several IP-addresses and/or network interfaces and curl allows you to select
|
||||||
which of them to use. Default address can also be used:
|
which of them to use. Default address can also be used:
|
||||||
|
|
||||||
curl -P - ftp.download.com
|
curl -P - ftp.download.com
|
||||||
|
|
||||||
Download with PORT but use the IP address of our 'le0' interface:
|
Download with PORT but use the IP address of our 'le0' interface (this does
|
||||||
|
not work on windows):
|
||||||
|
|
||||||
curl -P le0 ftp.download.com
|
curl -P le0 ftp.download.com
|
||||||
|
|
||||||
@@ -494,6 +508,16 @@ FTP and firewalls
|
|||||||
|
|
||||||
curl -P 192.168.0.10 ftp.download.com
|
curl -P 192.168.0.10 ftp.download.com
|
||||||
|
|
||||||
|
NETWORK INTERFACE
|
||||||
|
|
||||||
|
Get a web page from a server using a specified port for the interface:
|
||||||
|
|
||||||
|
curl --interface eth0:1 http://www.netscape.com/
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
curl --interface 192.168.1.10 http://www.netscape.com/
|
||||||
|
|
||||||
HTTPS
|
HTTPS
|
||||||
|
|
||||||
Secure HTTP requires SSL libraries to be installed and used when curl is
|
Secure HTTP requires SSL libraries to be installed and used when curl is
|
||||||
@@ -689,13 +713,26 @@ CUSTOM OUTPUT
|
|||||||
|
|
||||||
curl -w 'We downloaded %{size_download} bytes\n' www.download.com
|
curl -w 'We downloaded %{size_download} bytes\n' www.download.com
|
||||||
|
|
||||||
|
KERBEROS4 FTP TRANSFER
|
||||||
|
|
||||||
|
Curl supports kerberos4 for FTP transfers. You need the kerberos package
|
||||||
|
installed and used at curl build time for it to be used.
|
||||||
|
|
||||||
|
First, get the krb-ticket the normal way, like with the kauth tool. Then use
|
||||||
|
curl in way similar to:
|
||||||
|
|
||||||
|
curl --krb4 private ftp://krb4site.com -u username:fakepwd
|
||||||
|
|
||||||
|
There's no use for a password on the -u switch, but a blank one will make
|
||||||
|
curl ask for one and you already entered the real password to kauth.
|
||||||
|
|
||||||
MAILING LIST
|
MAILING LIST
|
||||||
|
|
||||||
We have an open mailing list to discuss curl, its development and things
|
We have an open mailing list to discuss curl, its development and things
|
||||||
relevant to this.
|
relevant to this.
|
||||||
|
|
||||||
To subscribe, mail curl-request@contactor.se with "subscribe <your email
|
To subscribe, mail curl-request@contactor.se with "subscribe <fill in your
|
||||||
address>" in the body.
|
email address>" in the body.
|
||||||
|
|
||||||
To post to the list, mail curl@contactor.se.
|
To post to the list, mail curl@contactor.se.
|
||||||
|
|
||||||
@@ -7,15 +7,20 @@ AUTOMAKE_OPTIONS = foreign no-dependencies
|
|||||||
man_MANS = \
|
man_MANS = \
|
||||||
curl.1 \
|
curl.1 \
|
||||||
curl_easy_cleanup.3 \
|
curl_easy_cleanup.3 \
|
||||||
|
curl_easy_getinfo.3 \
|
||||||
curl_easy_init.3 \
|
curl_easy_init.3 \
|
||||||
curl_easy_perform.3 \
|
curl_easy_perform.3 \
|
||||||
curl_easy_setopt.3 \
|
curl_easy_setopt.3 \
|
||||||
curl_formparse.3 \
|
curl_formparse.3 \
|
||||||
|
curl_formfree.3 \
|
||||||
curl_getdate.3 \
|
curl_getdate.3 \
|
||||||
curl_getenv.3 \
|
curl_getenv.3 \
|
||||||
curl_slist_append.3 \
|
curl_slist_append.3 \
|
||||||
curl_slist_free_all.3 \
|
curl_slist_free_all.3 \
|
||||||
curl_version.3
|
curl_version.3
|
||||||
|
|
||||||
EXTRA_DIST = $(man_MANS)
|
EXTRA_DIST = $(man_MANS) \
|
||||||
|
MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS \
|
||||||
|
LIBCURL README.win32 RESOURCES TODO TheArtOfHttpScripting
|
||||||
|
|
||||||
|
SUBDIRS = examples
|
||||||
|
|||||||
@@ -17,3 +17,8 @@ README.win32
|
|||||||
freely available nroff binary for win32 (*pointers appriciated*), convert
|
freely available nroff binary for win32 (*pointers appriciated*), convert
|
||||||
the files into plain-text on your neighbor's unix machine or run over to the
|
the files into plain-text on your neighbor's unix machine or run over to the
|
||||||
curl web site and view them as plain HTML.
|
curl web site and view them as plain HTML.
|
||||||
|
|
||||||
|
The main curl.1 man page is "built-in". Use a command line similar to this
|
||||||
|
in order to extract a separate text file:
|
||||||
|
|
||||||
|
curl -M >manual.txt
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ Standards
|
|||||||
|
|
||||||
RFC 959 - Defines how FTP works
|
RFC 959 - Defines how FTP works
|
||||||
|
|
||||||
|
RFC 1635 - How to Use Anonymous FTP
|
||||||
|
|
||||||
RFC 1738 - Uniform Resource Locators
|
RFC 1738 - Uniform Resource Locators
|
||||||
|
|
||||||
RFC 1777 - defines the LDAP protocol
|
RFC 1777 - defines the LDAP protocol
|
||||||
@@ -38,51 +40,59 @@ Standards
|
|||||||
|
|
||||||
RFC 2109 - HTTP State Management Mechanism (cookie stuff)
|
RFC 2109 - HTTP State Management Mechanism (cookie stuff)
|
||||||
- Also, read Netscape's specification at
|
- Also, read Netscape's specification at
|
||||||
http://www.netscape.com/newsref/std/cookie_spec.html
|
http://curl.haxx.se/rfc/cookie_spec.html
|
||||||
|
|
||||||
RFC 2183 - "The Content-Disposition Header Field"
|
RFC 2183 - The Content-Disposition Header Field
|
||||||
|
|
||||||
RFC 2229 - "A Dictionary Server Protocol"
|
RFC 2229 - A Dictionary Server Protocol
|
||||||
|
|
||||||
RFC 2255 - Newer LDAP URL syntax document.
|
RFC 2255 - Newer LDAP URL syntax document.
|
||||||
|
|
||||||
RFC 2231 - "MIME Parameter Value and Encoded Word Extensions:
|
RFC 2231 - MIME Parameter Value and Encoded Word Extensions:
|
||||||
Character Sets, Languages, and Continuations"
|
Character Sets, Languages, and Continuations
|
||||||
|
|
||||||
RFC 2388 - "Returning Values from Forms: multipart/form-data"
|
RFC 2388 - "Returning Values from Forms: multipart/form-data"
|
||||||
Use this as an addition to the 1867
|
Use this as an addition to the RFC1867
|
||||||
|
|
||||||
RFC 2396 - "Uniform Resource Identifiers: Generic Syntax and Semantics" This
|
RFC 2396 - "Uniform Resource Identifiers: Generic Syntax and Semantics" This
|
||||||
one obsoletes 1738, but since 1738 is often mentioned I've left
|
one obsoletes RFC 1738, but since RFC 1738 is often mentioned
|
||||||
it in this list.
|
I've left it in this list.
|
||||||
|
|
||||||
RFC 2428 - "FTP Extensions for IPv6 and NATs"
|
RFC 2428 - FTP Extensions for IPv6 and NATs
|
||||||
|
|
||||||
|
RFC 2577 - FTP Security Considerations
|
||||||
|
|
||||||
RFC 2616 - HTTP 1.1, the latest
|
RFC 2616 - HTTP 1.1, the latest
|
||||||
|
|
||||||
RFC 2617 - HTTP Authentication
|
RFC 2617 - HTTP Authentication
|
||||||
|
|
||||||
RFC 2718 - "Guidelines for new URL Schemes"
|
RFC 2718 - Guidelines for new URL Schemes
|
||||||
|
|
||||||
RFC 2732 - "Format for Literal IPv6 Addresses in URL's"
|
RFC 2732 - Format for Literal IPv6 Addresses in URL's
|
||||||
|
|
||||||
|
RFC 2818 - HTTP Over TLS (TLS is the successor to SSL)
|
||||||
|
|
||||||
|
RFC 2964 - Use of HTTP State Management
|
||||||
|
|
||||||
|
RFC 2965 - HTTP State Management Mechanism. Cookies. Obsoletes RFC2109
|
||||||
|
|
||||||
Compilers
|
Compilers
|
||||||
---------
|
---------
|
||||||
MingW32 - http://www.mingw.org
|
MingW32 - http://www.mingw.org/
|
||||||
|
|
||||||
gcc - http://www.gnu.org/software/gcc/gcc.html
|
gcc - http://www.gnu.org/software/gcc/gcc.html
|
||||||
|
|
||||||
Software
|
Software
|
||||||
--------
|
--------
|
||||||
OpenSSL - http://www.openssl.org
|
OpenSSL - http://www.openssl.org/
|
||||||
|
|
||||||
OpenLDAP - http://www.openldap.org
|
OpenLDAP - http://www.openldap.org/
|
||||||
|
|
||||||
zlib - http://www.cdrom.com/pub/infozip/zlib/
|
zlib - http://www.cdrom.com/pub/infozip/zlib/
|
||||||
|
|
||||||
Similar Tools
|
Similar Tools
|
||||||
-------------
|
-------------
|
||||||
wget - http://www.gnu.org/software/wget/wget.html
|
wget - http://sunsite.dk/wget/
|
||||||
|
|
||||||
snarf - http://www.xach.com/snarf/
|
snarf - http://www.xach.com/snarf/
|
||||||
|
|
||||||
@@ -90,6 +100,14 @@ Similar Tools
|
|||||||
|
|
||||||
swebget - http://www.uni-hildesheim.de/~smol0075/swebget/
|
swebget - http://www.uni-hildesheim.de/~smol0075/swebget/
|
||||||
|
|
||||||
|
Kermit - http://www.columbia.edu/kermit/ftpclient
|
||||||
|
|
||||||
|
Pavuk - http://www.idata.sk/~ondrej/pavuk/
|
||||||
|
|
||||||
|
httpr - http://zwolak.dhs.org/httpr/
|
||||||
|
|
||||||
|
puf - http://www.inf.tu-dresden.de/~ob6/sw/puf.html
|
||||||
|
|
||||||
Related Software
|
Related Software
|
||||||
----------------
|
----------------
|
||||||
ftpparse - http://cr.yp.to/ftpparse.html parses FTP LIST responses
|
ftpparse - http://cr.yp.to/ftpparse.html parses FTP LIST responses
|
||||||
|
|||||||
76
docs/TODO
76
docs/TODO
@@ -13,20 +13,43 @@ For the future
|
|||||||
product! (Yes, you may add things not mentioned here, these are just a
|
product! (Yes, you may add things not mentioned here, these are just a
|
||||||
few teasers...)
|
few teasers...)
|
||||||
|
|
||||||
|
* Make SSL session ids get used if multiple HTTPS documents from the same
|
||||||
|
host is requested.
|
||||||
|
|
||||||
|
* Make the curl tool support URLs that start with @ that would then mean that
|
||||||
|
the following is a plain list with URLs to download. Thus @filename.txt
|
||||||
|
reads a list of URLs from a local file. A fancy option would then be to
|
||||||
|
support @http://whatever.com that would first load a list and then get the
|
||||||
|
URLs mentioned in the list. I figure -O or something would have to be
|
||||||
|
implied by such an action.
|
||||||
|
|
||||||
|
* Improve the regular progress meter with --continue is used. It should be
|
||||||
|
noticable when there's a resume going on.
|
||||||
|
|
||||||
|
* Add a command line option that allows the output file to get the same time
|
||||||
|
stamp as the remote file. We already are capable of fetching the remote
|
||||||
|
file's date.
|
||||||
|
|
||||||
|
* Make the SSL layer option capable of using the Mozilla Security Services as
|
||||||
|
an alternative to OpenSSL:
|
||||||
|
http://www.mozilla.org/projects/security/pki/nss/
|
||||||
|
|
||||||
* Make sure the low-level interface works. highlevel.c should basically be
|
* Make sure the low-level interface works. highlevel.c should basically be
|
||||||
possible to write using that interface. Document the low-level interface
|
possible to write using that interface. Document the low-level interface
|
||||||
|
|
||||||
|
* Make the easy-interface support multiple file transfers. If they're done
|
||||||
|
to the same host, they should use persistant connections or similar.
|
||||||
|
Figure out a nice design for this.
|
||||||
|
|
||||||
* Add asynchronous name resolving, as this enables full timeout support for
|
* Add asynchronous name resolving, as this enables full timeout support for
|
||||||
fork() systems.
|
fork() systems.
|
||||||
|
|
||||||
* Move non-URL related functions that are used by both the lib and the curl
|
* Move non-URL related functions that are used by both the lib and the curl
|
||||||
application to a separate "portability lib".
|
application to a separate "portability lib".
|
||||||
|
|
||||||
* Add support for other languages than C (not important)
|
* Add support for other languages than C. C++ (rumours have been heard about
|
||||||
|
something being worked on in this area) and perl (we have seen the first
|
||||||
* Improve the -K config file parser.
|
versions of this!) comes to mind. Python anyone?
|
||||||
|
|
||||||
* rtsp:// support -- "Real Time Streaming Protocol" (RFC 2326)
|
|
||||||
|
|
||||||
* "Content-Encoding: compress/gzip/zlib"
|
* "Content-Encoding: compress/gzip/zlib"
|
||||||
|
|
||||||
@@ -35,28 +58,13 @@ For the future
|
|||||||
started in October 1999 but halted again since it proved more work than we
|
started in October 1999 but halted again since it proved more work than we
|
||||||
thought. It is still a good idea to implement though.
|
thought. It is still a good idea to implement though.
|
||||||
|
|
||||||
* HTTP Pipelining/persistant connections
|
* Authentication: NTLM. It would be cool to support that MS crap called NTLM
|
||||||
|
authentication. MS proxies and servers sometime require that. Since that
|
||||||
- We should introduce HTTP "pipelining". Curl could be able to request for
|
protocol is a proprietary one, it involves reverse engineering and network
|
||||||
several HTTP documents in one connect. It would be the beginning for
|
sniffing. This should however be a library-based functionality. There are a
|
||||||
supporing more advanced functions in the future, like web site
|
few different efforts "out there" to make open source HTTP clients support
|
||||||
mirroring. This will require that the urlget() function supports several
|
this and it should be possible to take advantage of other people's hard
|
||||||
documents from a single HTTP server, which it doesn't today.
|
work. http://modntlm.sourceforge.net/ is one.
|
||||||
|
|
||||||
- When curl supports fetching several documents from the same server using
|
|
||||||
pipelining, I'd like to offer that function to the command line. Anyone has
|
|
||||||
a good idea how? The current way of specifying one URL with the output sent
|
|
||||||
to the stdout or a file gets in the way. Imagine a syntax that supports
|
|
||||||
"additional documents from the same server" in a way similar to:
|
|
||||||
|
|
||||||
curl <main URL> --more-doc <path> --more-doc <path>
|
|
||||||
|
|
||||||
where --more-doc specifies another document on the same server. Where are
|
|
||||||
the output files gonna be put and how should they be named? Should each
|
|
||||||
"--more-doc" parameter require a local file name to store the result in?
|
|
||||||
Like "--more-file" as in:
|
|
||||||
|
|
||||||
curl <URL> --more-doc <path> --more-file <file>
|
|
||||||
|
|
||||||
* RFC2617 compliance, "Digest Access Authentication"
|
* RFC2617 compliance, "Digest Access Authentication"
|
||||||
A valid test page seem to exist at:
|
A valid test page seem to exist at:
|
||||||
@@ -70,12 +78,6 @@ For the future
|
|||||||
sends the password in cleartext over the network, this "Digest" method uses
|
sends the password in cleartext over the network, this "Digest" method uses
|
||||||
a challange-response protocol which increases security quite a lot.
|
a challange-response protocol which increases security quite a lot.
|
||||||
|
|
||||||
* Different FTP Upload Through Web Proxy
|
|
||||||
I don't know any web proxies that allow CONNECT through on port 21, but
|
|
||||||
that would be the best way to do ftp upload. All we would need to do would
|
|
||||||
be to 'CONNECT <host>:<port> HTTP/1.0\r\n\r\n' and then do business as
|
|
||||||
usual. I least I think so. It would be fun if someone tried this...
|
|
||||||
|
|
||||||
* Multiple Proxies?
|
* Multiple Proxies?
|
||||||
Is there anyone that actually uses serial-proxies? I mean, send CONNECT to
|
Is there anyone that actually uses serial-proxies? I mean, send CONNECT to
|
||||||
the first proxy to connect to the second proxy to which you send CONNECT to
|
the first proxy to connect to the second proxy to which you send CONNECT to
|
||||||
@@ -86,8 +88,7 @@ For the future
|
|||||||
Ftp-kind proxy, Socks5, whatever kind of proxies are there?
|
Ftp-kind proxy, Socks5, whatever kind of proxies are there?
|
||||||
|
|
||||||
* IPv6 Awareness and support
|
* IPv6 Awareness and support
|
||||||
Where ever it would fit. I am not that into v6 yet to fully grasp what we
|
Where ever it would fit. configure search for v6-versions of a few
|
||||||
would need to do, but letting the autoconf search for v6-versions of a few
|
|
||||||
functions and then use them instead is of course the first thing to do...
|
functions and then use them instead is of course the first thing to do...
|
||||||
RFC 2428 "FTP Extensions for IPv6 and NATs" will be interesting. PORT
|
RFC 2428 "FTP Extensions for IPv6 and NATs" will be interesting. PORT
|
||||||
should be replaced with EPRT for IPv6, and EPSV instead of PASV.
|
should be replaced with EPRT for IPv6, and EPSV instead of PASV.
|
||||||
@@ -97,8 +98,3 @@ For the future
|
|||||||
|
|
||||||
* HTTP POST resume using Range:
|
* HTTP POST resume using Range:
|
||||||
|
|
||||||
* Make curl capable of verifying the server's certificate when connecting
|
|
||||||
with HTTPS://.
|
|
||||||
|
|
||||||
* Kerberos-FTP
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Author: Daniel Stenberg <daniel@haxx.se>
|
Author: Daniel Stenberg <daniel@haxx.se>
|
||||||
Date: August 7, 2000
|
Date: September 15, 2000
|
||||||
Version: 0.2
|
Version: 0.3
|
||||||
|
|
||||||
The Art Of Scripting HTTP Requests Using Curl
|
The Art Of Scripting HTTP Requests Using Curl
|
||||||
=============================================
|
=============================================
|
||||||
@@ -31,7 +31,7 @@ Version: 0.2
|
|||||||
1. The HTTP Protocol
|
1. The HTTP Protocol
|
||||||
|
|
||||||
HTTP is the protocol used to fetch data from web servers. It is a very simple
|
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 allow information to
|
protocol that is built upon TCP/IP. The protocol also allows information to
|
||||||
get sent to the server from the client using a few different methods, as will
|
get sent to the server from the client using a few different methods, as will
|
||||||
be shown here.
|
be shown here.
|
||||||
|
|
||||||
@@ -130,12 +130,12 @@ Version: 0.2
|
|||||||
curl -d "birthyear=1905&press=OK" www.hotmail.com/when/junk.cgi
|
curl -d "birthyear=1905&press=OK" www.hotmail.com/when/junk.cgi
|
||||||
|
|
||||||
This kind of POST will use the Content-Type
|
This kind of POST will use the Content-Type
|
||||||
application/x-www-form-urlencoded and is the most widly used POST kind.
|
application/x-www-form-urlencoded and is the most widely used POST kind.
|
||||||
|
|
||||||
4.3 FILE UPLOAD POST
|
4.3 FILE UPLOAD POST
|
||||||
|
|
||||||
Back in late 1995 they defined a new to post data over HTTP. It was
|
Back in late 1995 they defined a new way to post data over HTTP. It was
|
||||||
documented in the RFC 1867, why this method sometimes are refered to as
|
documented in the RFC 1867, why this method sometimes is refered to as
|
||||||
a rfc1867-posting.
|
a rfc1867-posting.
|
||||||
|
|
||||||
This method is mainly designed to better support file uploads. A form that
|
This method is mainly designed to better support file uploads. A form that
|
||||||
@@ -165,7 +165,7 @@ Version: 0.2
|
|||||||
|
|
||||||
<form method="POST" action="foobar.cgi">
|
<form method="POST" action="foobar.cgi">
|
||||||
<input type=text name="birthyear">
|
<input type=text name="birthyear">
|
||||||
<input type=text name="person" value="daniel">
|
<input type=hidden name="person" value="daniel">
|
||||||
<input type=submit name="press" value="OK">
|
<input type=submit name="press" value="OK">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@@ -209,17 +209,18 @@ Version: 0.2
|
|||||||
|
|
||||||
Do note that when a program is run, its parameters are possible to see when
|
Do note that when a program is run, its parameters are possible to see when
|
||||||
listing the running processes of the system. Thus, other users may be able to
|
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 options.
|
watch your passwords if you pass them as plain command line options. There
|
||||||
|
are ways to circumvent this.
|
||||||
|
|
||||||
7. REFERER
|
7. REFERER
|
||||||
|
|
||||||
A HTTP request has the ability to feature a 'referer' field, which can be
|
A HTTP request may include a 'referer' field, which can be used to tell from
|
||||||
used to tell which URL that causes the client to get this particular
|
which URL the client got to this particular resource. Some programs/scripts
|
||||||
resource. Some programs/scripts check the referer field of requests to verify
|
check the referer field of requests to verify that this wasn't arriving from
|
||||||
that this wasn't arriving from an external site or unknown page. While this
|
an external site or an unknown page. While this is a stupid way to check
|
||||||
is a stupid way to check something so easily forged, many scripts still do
|
something so easily forged, many scripts still do it. Using curl, you can put
|
||||||
it. Using curl, you can put anything you want in the referer-field and thus
|
anything you want in the referer-field and thus more easily be able to fool
|
||||||
more easily being able to fool the server into serving your request.
|
the server into serving your request.
|
||||||
|
|
||||||
Use curl to set the referer field with:
|
Use curl to set the referer field with:
|
||||||
|
|
||||||
@@ -278,10 +279,10 @@ Version: 0.2
|
|||||||
specified in a received cookie, the client sends back the cookies and their
|
specified in a received cookie, the client sends back the cookies and their
|
||||||
contents to the server, unless of course they are expired.
|
contents to the server, unless of course they are expired.
|
||||||
|
|
||||||
Many applications and server use this method to connect a series of request
|
Many applications and servers use this method to connect a series of requests
|
||||||
into a single logical session. To be able to use curl in such occations, we
|
into a single logical session. To be able to use curl in such occations, we
|
||||||
must be able to record and send back cookies in the way that the web
|
must be able to record and send back cookies the way the web application
|
||||||
application expects them. The same way browsers deal with them.
|
expects them. The same way browsers deal with them.
|
||||||
|
|
||||||
The simplest way to send a few cookies to the server when getting a page with
|
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:
|
curl is to add them on the command line like:
|
||||||
@@ -307,15 +308,15 @@ Version: 0.2
|
|||||||
|
|
||||||
There are a few ways to do secure HTTP transfers. The by far most common
|
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
|
protocol for doing this is what is generally known as HTTPS, HTTP over
|
||||||
SSL. SSL encrypts all the data that is send and received over the network and
|
SSL. SSL encrypts all the data that is sent and received over the network and
|
||||||
thus makes it harder for attackers to spy on sensitive information.
|
thus makes it harder for attackers to spy on sensitive information.
|
||||||
|
|
||||||
SSL (or TLS as the latest version of the standard is called) offers a
|
SSL (or TLS as the latest version of the standard is called) offers a
|
||||||
truckload of advanced features to allow all those encryptions and key
|
truckload of advanced features to allow all those encryptions and key
|
||||||
infrastructure mechanisms ecnrypted HTTP requires.
|
infrastructure mechanisms encrypted HTTP requires.
|
||||||
|
|
||||||
Curl supports enscrypted fetches thanks to the freely available OpenSSL
|
Curl supports encrypted fetches thanks to the freely available OpenSSL
|
||||||
libraries. To get a pafe from a https server, simply run curl like:
|
libraries. To get a page from a HTTPS server, simply run curl like:
|
||||||
|
|
||||||
curl https://that.secure.server.com
|
curl https://that.secure.server.com
|
||||||
|
|
||||||
|
|||||||
206
docs/curl.1
206
docs/curl.1
@@ -2,18 +2,19 @@
|
|||||||
.\" nroff -man curl.1
|
.\" nroff -man curl.1
|
||||||
.\" Written by Daniel Stenberg
|
.\" Written by Daniel Stenberg
|
||||||
.\"
|
.\"
|
||||||
.TH curl 1 "24 August 2000" "Curl 7.2" "Curl Manual"
|
.TH curl 1 "19 January 2001" "Curl 7.6" "Curl Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
curl \- get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE, HTTP or
|
curl \- get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE, HTTP or
|
||||||
HTTPS syntax.
|
HTTPS syntax.
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B curl [options]
|
.B curl [options]
|
||||||
.I url
|
.I [URL...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B curl
|
.B curl
|
||||||
is a client to get documents/files from servers, using any of the
|
is a client to get documents/files from or send documents to a server, using
|
||||||
supported protocols. The command is designed to work without user
|
any of the supported protocols (HTTP, HTTPS, FTP, GOPHER, DICT, TELNET, LDAP
|
||||||
interaction or any kind of interactivity.
|
or FILE). The command is designed to work without user interaction or any kind
|
||||||
|
of interactivity.
|
||||||
|
|
||||||
curl offers a busload of useful tricks like proxy support, user
|
curl offers a busload of useful tricks like proxy support, user
|
||||||
authentication, ftp upload, HTTP post, SSL (https:) connections, cookies, file
|
authentication, ftp upload, HTTP post, SSL (https:) connections, cookies, file
|
||||||
@@ -37,18 +38,26 @@ It is possible to specify up to 9 sets or series for a URL, but no nesting is
|
|||||||
supported at the moment:
|
supported at the moment:
|
||||||
|
|
||||||
http://www.any.org/archive[1996-1999]/volume[1-4]part{a,b,c,index}.html
|
http://www.any.org/archive[1996-1999]/volume[1-4]part{a,b,c,index}.html
|
||||||
|
|
||||||
|
Starting with curl 7.6, you can specify any amount of URLs on the command
|
||||||
|
line. They will be fetched in a sequential manner in the specified order.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.IP "-a/--append"
|
.IP "-a/--append"
|
||||||
(FTP)
|
(FTP)
|
||||||
When used in a ftp upload, this will tell curl to append to the target
|
When used in a ftp upload, this will tell curl to append to the target
|
||||||
file instead of overwriting it. If the file doesn't exist, it will
|
file instead of overwriting it. If the file doesn't exist, it will
|
||||||
be created.
|
be created.
|
||||||
|
|
||||||
|
If this option is used twice, the second one will disable append mode again.
|
||||||
.IP "-A/--user-agent <agent string>"
|
.IP "-A/--user-agent <agent string>"
|
||||||
(HTTP)
|
(HTTP)
|
||||||
Specify the User-Agent string to send to the HTTP server. Some badly done CGIs
|
Specify the User-Agent string to send to the HTTP server. Some badly done CGIs
|
||||||
fail if its not set to "Mozilla/4.0". To encode blanks in the string,
|
fail if its not set to "Mozilla/4.0". To encode blanks in the string,
|
||||||
surround the string with single quote marks. This can also be set with the
|
surround the string with single quote marks. This can also be set with the
|
||||||
-H/--header flag of course.
|
-H/--header flag of course.
|
||||||
|
|
||||||
|
If this option is used more than once, the last one will be the one to be
|
||||||
|
used.
|
||||||
.IP "-b/--cookie <name=data>"
|
.IP "-b/--cookie <name=data>"
|
||||||
(HTTP)
|
(HTTP)
|
||||||
Pass the data to the HTTP server as a cookie. It is supposedly the
|
Pass the data to the HTTP server as a cookie. It is supposedly the
|
||||||
@@ -67,11 +76,17 @@ format.
|
|||||||
that the file specified with -b/--cookie is only used as input. No cookies
|
that the file specified with -b/--cookie is only used as input. No cookies
|
||||||
will be stored in the file. To store cookies, save the HTTP headers to a file
|
will be stored in the file. To store cookies, save the HTTP headers to a file
|
||||||
using -D/--dump-header!
|
using -D/--dump-header!
|
||||||
|
|
||||||
|
If this option is used more than once, the last one will be the one to be
|
||||||
|
used.
|
||||||
.IP "-B/--use-ascii"
|
.IP "-B/--use-ascii"
|
||||||
Use ASCII transfer when getting an FTP file or LDAP info. For FTP, this can
|
Use ASCII transfer when getting an FTP file or LDAP info. For FTP, this can
|
||||||
also be enforced by using an URL that ends with ";type=A". This option causes
|
also be enforced by using an URL that ends with ";type=A". This option causes
|
||||||
data sent to stdout to be in text mode for win32 systems.
|
data sent to stdout to be in text mode for win32 systems.
|
||||||
|
|
||||||
|
If this option is used twice, the second one will disable ASCII usage.
|
||||||
.IP "-c/--continue"
|
.IP "-c/--continue"
|
||||||
|
.B Deprecated. Use '-C -' instead.
|
||||||
Continue/Resume a previous file transfer. This instructs curl to
|
Continue/Resume a previous file transfer. This instructs curl to
|
||||||
continue appending data on the file where it was previously left,
|
continue appending data on the file where it was previously left,
|
||||||
possibly because of a broken connection to the server. There must be
|
possibly because of a broken connection to the server. There must be
|
||||||
@@ -87,27 +102,45 @@ to the destination.
|
|||||||
If used with uploads, the ftp server command SIZE will not be used by
|
If used with uploads, the ftp server command SIZE will not be used by
|
||||||
curl. Upload resume is for FTP only.
|
curl. Upload resume is for FTP only.
|
||||||
HTTP resume is only possible with HTTP/1.1 or later servers.
|
HTTP resume is only possible with HTTP/1.1 or later servers.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-d/--data <data>"
|
.IP "-d/--data <data>"
|
||||||
(HTTP) Sends the specified data in a POST request to the HTTP server. Note
|
(HTTP) Sends the specified data in a POST request to the HTTP server. Note
|
||||||
that the data is sent exactly as specified with no extra processing (with all
|
that the data is sent exactly as specified with no extra processing (with all
|
||||||
newlines cut off). The data is expected to be "url-encoded". This will cause
|
newlines cut off). The data is expected to be "url-encoded". This will cause
|
||||||
curl to pass the data to the server using the content-type
|
curl to pass the data to the server using the content-type
|
||||||
application/x-www-form-urlencoded. Compare to -F.
|
application/x-www-form-urlencoded. Compare to -F. If more than one -d/--data
|
||||||
|
option is used on the same command line, the data pieces specified will be
|
||||||
|
merged together with a separating &-letter. Thus, using '-d name=daniel -d
|
||||||
|
skill=lousy' would generate a post chunk that looks like
|
||||||
|
'name=daniel&skill=lousy'.
|
||||||
|
|
||||||
If you start the data with the letter @, the rest should be a file name to
|
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.
|
read the data from, or - if you want curl to read the data from stdin. The
|
||||||
The contents of the file must already be url-encoded.
|
contents of the file must already be url-encoded. Multiple files can also be
|
||||||
|
specified.
|
||||||
|
|
||||||
To post data purely binary, you should instead use the --data-binary option.
|
To post data purely binary, you should instead use the --data-binary option.
|
||||||
|
|
||||||
-d/--data is the same as --data-ascii.
|
-d/--data is the same as --data-ascii.
|
||||||
|
|
||||||
|
If this option is used serveral times, the ones following the first will
|
||||||
|
append data.
|
||||||
.IP "--data-ascii <data>"
|
.IP "--data-ascii <data>"
|
||||||
(HTTP) This is an alias for the -d/--data option.
|
(HTTP) This is an alias for the -d/--data option.
|
||||||
|
|
||||||
|
If this option is used serveral times, the ones following the first will
|
||||||
|
append data.
|
||||||
.IP "--data-binary <data>"
|
.IP "--data-binary <data>"
|
||||||
(HTTP) This posts data in a similar manner as --data-ascii does, although when
|
(HTTP) This posts data in a similar manner as --data-ascii does, although when
|
||||||
using this option the entire context of the posted data is kept as-is. If you
|
using this option the entire context of the posted data is kept as-is. If you
|
||||||
want to post a binary file without the strip-newlines feature of the
|
want to post a binary file without the strip-newlines feature of the
|
||||||
--data-ascii option, this is for you.
|
--data-ascii option, this is for you.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
|
|
||||||
|
If this option is used serveral times, the ones following the first will
|
||||||
|
append data.
|
||||||
.IP "-D/--dump-header <file>"
|
.IP "-D/--dump-header <file>"
|
||||||
(HTTP/FTP)
|
(HTTP/FTP)
|
||||||
Write the HTTP headers to this file. Write the FTP file info to this
|
Write the HTTP headers to this file. Write the FTP file info to this
|
||||||
@@ -116,6 +149,8 @@ file if -I/--head is used.
|
|||||||
This option is handy to use when you want to store the cookies that a HTTP
|
This option is handy to use when you want to store the cookies that a HTTP
|
||||||
site sends to you. The cookies could then be read in a second curl invoke by
|
site sends to you. The cookies could then be read in a second curl invoke by
|
||||||
using the -b/--cookie option!
|
using the -b/--cookie option!
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-e/--referer <URL>"
|
.IP "-e/--referer <URL>"
|
||||||
(HTTP) Sends the "Referer Page" information to the HTTP server. This can also
|
(HTTP) Sends the "Referer Page" information to the HTTP server. This can also
|
||||||
be set with the -H/--header flag of course. When used with
|
be set with the -H/--header flag of course. When used with
|
||||||
@@ -123,6 +158,8 @@ be set with the -H/--header flag of course. When used with
|
|||||||
you can append ";auto" to the referer URL to make curl automatically set the
|
you can append ";auto" to the referer URL to make curl automatically set the
|
||||||
previous URL when it follows a Location: header. The ";auto" string can be
|
previous URL when it follows a Location: header. The ";auto" string can be
|
||||||
used alone, even if you don't set an initial referer.
|
used alone, even if you don't set an initial referer.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-E/--cert <certificate[:password]>"
|
.IP "-E/--cert <certificate[:password]>"
|
||||||
(HTTPS)
|
(HTTPS)
|
||||||
Tells curl to use the specified certificate file when getting a file
|
Tells curl to use the specified certificate file when getting a file
|
||||||
@@ -130,6 +167,13 @@ with HTTPS. The certificate must be in PEM format.
|
|||||||
If the optional password isn't specified, it will be queried for on
|
If the optional password isn't specified, it will be queried for on
|
||||||
the terminal. Note that this certificate is the private key and the private
|
the terminal. Note that this certificate is the private key and the private
|
||||||
certificate concatenated!
|
certificate concatenated!
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
|
.IP "--cacert <CA certificate>"
|
||||||
|
(HTTPS) Tells curl to use the specified certificate file to verify the
|
||||||
|
peer. The certificate must be in PEM format.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-f/--fail"
|
.IP "-f/--fail"
|
||||||
(HTTP)
|
(HTTP)
|
||||||
Fail silently (no output at all) on server errors. This is mostly done
|
Fail silently (no output at all) on server errors. This is mostly done
|
||||||
@@ -138,6 +182,8 @@ attempts. In normal cases when a HTTP server fails to deliver a
|
|||||||
document, it returns a HTML document stating so (which often also
|
document, it returns a HTML document stating so (which often also
|
||||||
describes why and more). This flag will prevent curl from
|
describes why and more). This flag will prevent curl from
|
||||||
outputting that and fail silently instead.
|
outputting that and fail silently instead.
|
||||||
|
|
||||||
|
If this option is used twice, the second will again disable silent failure.
|
||||||
.IP "-F/--form <name=content>"
|
.IP "-F/--form <name=content>"
|
||||||
(HTTP) This lets curl emulate a filled in form in which a user has pressed the
|
(HTTP) This lets curl emulate a filled in form in which a user has pressed the
|
||||||
submit button. This causes curl to POST data using the content-type
|
submit button. This causes curl to POST data using the content-type
|
||||||
@@ -157,6 +203,14 @@ input:
|
|||||||
|
|
||||||
To read the file's content from stdin insted of a file, use - where the file
|
To read the file's content from stdin insted of a file, use - where the file
|
||||||
name should've been. This goes for both @ and < constructs.
|
name should've been. This goes for both @ and < constructs.
|
||||||
|
|
||||||
|
This option can be used multiple times.
|
||||||
|
.IP "-g/--globoff"
|
||||||
|
This option switches off the "URL globbing parser". When you set this option,
|
||||||
|
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. (Option
|
||||||
|
added in curl 7.6)
|
||||||
.IP "-h/--help"
|
.IP "-h/--help"
|
||||||
Usage help.
|
Usage help.
|
||||||
.IP "-H/--header <header>"
|
.IP "-H/--header <header>"
|
||||||
@@ -168,29 +222,54 @@ trickier stuff than curl would normally do. You should not replace internally
|
|||||||
set headers without knowing perfectly well what you're doing. Replacing an
|
set headers without knowing perfectly well what you're doing. Replacing an
|
||||||
internal header with one without content on the right side of the colon will
|
internal header with one without content on the right side of the colon will
|
||||||
prevent that header from appearing.
|
prevent that header from appearing.
|
||||||
|
|
||||||
|
This option can be used multiple times.
|
||||||
.IP "-i/--include"
|
.IP "-i/--include"
|
||||||
(HTTP)
|
(HTTP)
|
||||||
Include the HTTP-header in the output. The HTTP-header includes things
|
Include the HTTP-header in the output. The HTTP-header includes things
|
||||||
like server-name, date of the document, HTTP-version and more...
|
like server-name, date of the document, HTTP-version and more...
|
||||||
|
|
||||||
|
If this option is used twice, the second will again disable header include.
|
||||||
|
.IP "--interface <name>"
|
||||||
|
Perform an operation using a specified interface. You can enter interface
|
||||||
|
name, IP address or host name. An example could look like:
|
||||||
|
|
||||||
|
.B "curl --interface eth0:1 http://www.netscape.com/"
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-I/--head"
|
.IP "-I/--head"
|
||||||
(HTTP/FTP)
|
(HTTP/FTP)
|
||||||
Fetch the HTTP-header only! HTTP-servers feature the command HEAD
|
Fetch the HTTP-header only! HTTP-servers feature the command HEAD
|
||||||
which this uses to get nothing but the header of a document. When used
|
which this uses to get nothing but the header of a document. When used
|
||||||
on a FTP file, curl displays the file size only.
|
on a FTP file, curl displays the file size only.
|
||||||
|
|
||||||
|
If this option is used twice, the second will again disable header only.
|
||||||
|
.IP "--krb4 <level>"
|
||||||
|
(FTP) Enable kerberos4 authentication and use. The level must be entered and
|
||||||
|
should be one of 'clear', 'safe', 'confidential' or 'private'. Should you use
|
||||||
|
a level that is not one of these, 'private' will instead be used.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-K/--config <config file>"
|
.IP "-K/--config <config file>"
|
||||||
Specify which config file to read curl arguments from. The config
|
Specify which config file to read curl arguments from. The config file is a
|
||||||
file is a text file in which command line arguments can be written
|
text file in which command line arguments can be written which then will be
|
||||||
which then will be used as if they were written on the actual command
|
used as if they were written on the actual command line. Options and their
|
||||||
line. If the first column of a config line is a '#' character, the
|
parameters must be specified on the same config file line. If the parameter is
|
||||||
rest of the line will be treated as a comment.
|
to contain white spaces, the parameter must be inclosed within quotes. If the
|
||||||
|
first column of a config line is a '#' character, the rest of the line will be
|
||||||
|
treated as a comment.
|
||||||
|
|
||||||
Specify the filename as '-' to make curl read the file from stdin.
|
Specify the filename as '-' to make curl read the file from stdin.
|
||||||
|
|
||||||
|
This option can be used multiple times.
|
||||||
.IP "-l/--list-only"
|
.IP "-l/--list-only"
|
||||||
(FTP)
|
(FTP)
|
||||||
When listing an FTP directory, this switch forces a name-only view.
|
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
|
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
|
directory since the normal directory view doesn't use a standard look
|
||||||
or format.
|
or format.
|
||||||
|
|
||||||
|
If this option is used twice, the second will again disable list only.
|
||||||
.IP "-L/--location"
|
.IP "-L/--location"
|
||||||
(HTTP/HTTPS) If the server reports that the requested page has a different
|
(HTTP/HTTPS) If the server reports that the requested page has a different
|
||||||
location (indicated with the header line Location:) this flag will let curl
|
location (indicated with the header line Location:) this flag will let curl
|
||||||
@@ -198,10 +277,14 @@ attempt to reattempt the get on the new place. If used together with -i or -I,
|
|||||||
headers from all requested pages will be shown. If this flag is used when
|
headers from all requested pages will be shown. If this flag is used when
|
||||||
making a HTTP POST, curl will automatically switch to GET after the initial
|
making a HTTP POST, curl will automatically switch to GET after the initial
|
||||||
POST has been done.
|
POST has been done.
|
||||||
|
|
||||||
|
If this option is used twice, the second will again disable location following.
|
||||||
.IP "-m/--max-time <seconds>"
|
.IP "-m/--max-time <seconds>"
|
||||||
Maximum time in seconds that you allow the whole operation to take. This is
|
Maximum time in seconds that you allow the whole operation to take. This is
|
||||||
useful for preventing your batch jobs from hanging for hours due to slow
|
useful for preventing your batch jobs from hanging for hours due to slow
|
||||||
networks or links going down. This doesn't work fully in win32 systems.
|
networks or links going down. This doesn't work fully in win32 systems.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-M/--manual"
|
.IP "-M/--manual"
|
||||||
Manual. Display the huge help text.
|
Manual. Display the huge help text.
|
||||||
.IP "-n/--netrc"
|
.IP "-n/--netrc"
|
||||||
@@ -222,11 +305,15 @@ to allow curl to ftp to the machine host.domain.com with user name
|
|||||||
'myself' and password 'secret' should look similar to:
|
'myself' and password 'secret' should look similar to:
|
||||||
|
|
||||||
.B "machine host.domain.com login myself password secret"
|
.B "machine host.domain.com login myself password secret"
|
||||||
|
|
||||||
|
If this option is used twice, the second will again disable netrc usage.
|
||||||
.IP "-N/--no-buffer"
|
.IP "-N/--no-buffer"
|
||||||
Disables the buffering of the output stream. In normal work situations, curl
|
Disables the buffering of the output stream. In normal work situations, curl
|
||||||
will use a standard buffered output stream that will have the effect that it
|
will use a standard buffered output stream that will have the effect that it
|
||||||
will output the data in chunks, not necessarily exactly when the data arrives.
|
will output the data in chunks, not necessarily exactly when the data arrives.
|
||||||
Using this option will disable that buffering.
|
Using this option will disable that buffering.
|
||||||
|
|
||||||
|
If this option is used twice, the second will again switch on buffering.
|
||||||
.IP "-o/--output <file>"
|
.IP "-o/--output <file>"
|
||||||
Write output to <file> instead of stdout. If you are using {} or [] to fetch
|
Write output to <file> instead of stdout. If you are using {} or [] to fetch
|
||||||
multiple documents, you can use '#' followed by a number in the <file>
|
multiple documents, you can use '#' followed by a number in the <file>
|
||||||
@@ -238,9 +325,21 @@ being fetched. Like in:
|
|||||||
or use several variables like:
|
or use several variables like:
|
||||||
|
|
||||||
curl http://{site,host}.host[1-5].com -o "#1_#2"
|
curl http://{site,host}.host[1-5].com -o "#1_#2"
|
||||||
|
|
||||||
|
You may use this option as many times as you have number of URLs.
|
||||||
.IP "-O/--remote-name"
|
.IP "-O/--remote-name"
|
||||||
Write output to a local file named like the remote file we get. (Only
|
Write output to a local file named like the remote file we get. (Only
|
||||||
the file part of the remote file is used, the path is cut off.)
|
the file part of the remote file is used, the path is cut off.)
|
||||||
|
|
||||||
|
You may use this option as many times as you have number of URLs.
|
||||||
|
.IP "-p/--proxytunnel"
|
||||||
|
When an HTTP proxy is used, this option will cause non-HTTP protocols to
|
||||||
|
attempt to tunnel through the proxy instead of merely using it to do HTTP-like
|
||||||
|
operations. The tunnel approach is made with the HTTP proxy CONNECT request
|
||||||
|
and requires that the proxy allows direct connect to the remote port number
|
||||||
|
curl wants to tunnel through to.
|
||||||
|
|
||||||
|
If this option is used twice, the second will again disable proxy tunnel.
|
||||||
.IP "-P/--ftpport <address>"
|
.IP "-P/--ftpport <address>"
|
||||||
(FTP)
|
(FTP)
|
||||||
Reverses the initiator/listener roles when connecting with ftp. This
|
Reverses the initiator/listener roles when connecting with ftp. This
|
||||||
@@ -262,6 +361,8 @@ i.e "my.host.domain" to specify machine
|
|||||||
.B "-"
|
.B "-"
|
||||||
(any single-letter string) to make it pick the machine's default
|
(any single-letter string) to make it pick the machine's default
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-q"
|
.IP "-q"
|
||||||
If used as the first parameter on the command line, the
|
If used as the first parameter on the command line, the
|
||||||
.I $HOME/.curlrc
|
.I $HOME/.curlrc
|
||||||
@@ -274,6 +375,8 @@ transfer is taking place. To make commands take place after a successful
|
|||||||
transfer, prefix them with a dash '-'. You may specify any amount of commands
|
transfer, prefix them with a dash '-'. You may specify any amount of commands
|
||||||
to be run before and after the transfer. If the server returns failure for one
|
to be run before and after the transfer. If the server returns failure for one
|
||||||
of the commands, the entire operation will be aborted.
|
of the commands, the entire operation will be aborted.
|
||||||
|
|
||||||
|
This option can be used multiple times.
|
||||||
.IP "-r/--range <range>"
|
.IP "-r/--range <range>"
|
||||||
(HTTP/FTP)
|
(HTTP/FTP)
|
||||||
Retrieve a byte range (i.e a partial document) from a HTTP/1.1 or FTP
|
Retrieve a byte range (i.e a partial document) from a HTTP/1.1 or FTP
|
||||||
@@ -311,12 +414,19 @@ document.
|
|||||||
|
|
||||||
FTP range downloads only support the simple syntax 'start-stop' (optionally
|
FTP range downloads only support the simple syntax 'start-stop' (optionally
|
||||||
with one of the numbers omitted). It depends on the non-RFC command SIZE.
|
with one of the numbers omitted). It depends on the non-RFC command SIZE.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-s/--silent"
|
.IP "-s/--silent"
|
||||||
Silent mode. Don't show progress meter or error messages. Makes
|
Silent mode. Don't show progress meter or error messages. Makes
|
||||||
Curl mute.
|
Curl mute.
|
||||||
|
|
||||||
|
If this option is used twice, the second will again disable mute.
|
||||||
.IP "-S/--show-error"
|
.IP "-S/--show-error"
|
||||||
When used with -s it makes curl show error message if it fails.
|
When used with -s it makes curl show error message if it fails.
|
||||||
|
|
||||||
|
If this option is used twice, the second will again disable show error.
|
||||||
.IP "-t/--upload"
|
.IP "-t/--upload"
|
||||||
|
.B Deprecated. Use '-T -' instead.
|
||||||
Transfer the stdin data to the specified file. Curl will read
|
Transfer the stdin data to the specified file. Curl will read
|
||||||
everything from stdin until EOF and store with the supplied name. If
|
everything from stdin until EOF and store with the supplied name. If
|
||||||
this is used on a http(s) server, the PUT command will be used.
|
this is used on a http(s) server, the PUT command will be used.
|
||||||
@@ -328,18 +438,35 @@ really prove to Curl that there is no file name or curl will
|
|||||||
think that your last directory name is the remote file name to
|
think that your last directory name is the remote file name to
|
||||||
use. That will most likely cause the upload operation to fail. If
|
use. That will most likely cause the upload operation to fail. If
|
||||||
this is used on a http(s) server, the PUT command will be used.
|
this is used on a http(s) server, the PUT command will be used.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-u/--user <user:password>"
|
.IP "-u/--user <user:password>"
|
||||||
Specify user and password to use when fetching. See README.curl for detailed
|
Specify user and password to use when fetching. See README.curl for detailed
|
||||||
examples of how to use this. If no password is specified, curl will
|
examples of how to use this. If no password is specified, curl will
|
||||||
ask for it interactively.
|
ask for it interactively.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-U/--proxy-user <user:password>"
|
.IP "-U/--proxy-user <user:password>"
|
||||||
Specify user and password to use for Proxy authentication. If no
|
Specify user and password to use for Proxy authentication. If no
|
||||||
password is specified, curl will ask for it interactively.
|
password is specified, curl will ask for it interactively.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
|
.IP "--url <URL>"
|
||||||
|
Specify a URL to fetch. This option is mostly handy when you wanna specify
|
||||||
|
URL(s) in a config file.
|
||||||
|
|
||||||
|
This option may be used any number of times. To control where this URL is written, use the
|
||||||
|
.I -o
|
||||||
|
or the
|
||||||
|
.I -O
|
||||||
|
options.
|
||||||
.IP "-v/--verbose"
|
.IP "-v/--verbose"
|
||||||
Makes the fetching more verbose/talkative. Mostly usable for
|
Makes the fetching more verbose/talkative. Mostly usable for
|
||||||
debugging. Lines starting with '>' means data sent by curl, '<'
|
debugging. Lines starting with '>' means data sent by curl, '<'
|
||||||
means data received by curl that is hidden in normal cases and lines
|
means data received by curl that is hidden in normal cases and lines
|
||||||
starting with '*' means additional info provided by curl.
|
starting with '*' means additional info provided by curl.
|
||||||
|
|
||||||
|
If this option is used twice, the second will again disable verbose.
|
||||||
.IP "-V/--version"
|
.IP "-V/--version"
|
||||||
Displays the full version of curl, libcurl and other 3rd party libraries
|
Displays the full version of curl, libcurl and other 3rd party libraries
|
||||||
linked with the executable.
|
linked with the executable.
|
||||||
@@ -393,15 +520,25 @@ The total amount of bytes that were downloaded.
|
|||||||
.B size_upload
|
.B size_upload
|
||||||
The total amount of bytes that were uploaded.
|
The total amount of bytes that were uploaded.
|
||||||
.TP
|
.TP
|
||||||
|
.B size_header
|
||||||
|
The total amount of bytes of the downloaded headers.
|
||||||
|
.TP
|
||||||
|
.B size_request
|
||||||
|
The total amount of bytes that were sent in the HTTP request.
|
||||||
|
.TP
|
||||||
.B speed_download
|
.B speed_download
|
||||||
The average download speed that curl measured for the complete download.
|
The average download speed that curl measured for the complete download.
|
||||||
.TP
|
.TP
|
||||||
.B speed_upload
|
.B speed_upload
|
||||||
The average upload speed that curl measured for the complete download.
|
The average upload speed that curl measured for the complete upload.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-x/--proxy <proxyhost[:port]>"
|
.IP "-x/--proxy <proxyhost[:port]>"
|
||||||
Use specified proxy. If the port number is not specified, it is assumed at
|
Use specified proxy. If the port number is not specified, it is assumed at
|
||||||
port 1080.
|
port 1080.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-X/--request <command>"
|
.IP "-X/--request <command>"
|
||||||
(HTTP)
|
(HTTP)
|
||||||
Specifies a custom request to use when communicating with the HTTP server.
|
Specifies a custom request to use when communicating with the HTTP server.
|
||||||
@@ -411,14 +548,20 @@ HTTP 1.1 specification for details and explanations.
|
|||||||
(FTP)
|
(FTP)
|
||||||
Specifies a custom FTP command to use instead of LIST when doing file lists
|
Specifies a custom FTP command to use instead of LIST when doing file lists
|
||||||
with ftp.
|
with ftp.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-y/--speed-time <time>"
|
.IP "-y/--speed-time <time>"
|
||||||
If a download is slower than speed-limit bytes per second during a speed-time
|
If a download is slower than speed-limit bytes per second during a speed-time
|
||||||
period, the download gets aborted. If speed-time is used, the default
|
period, the download gets aborted. If speed-time is used, the default
|
||||||
speed-limit will be 1 unless set with -y.
|
speed-limit will be 1 unless set with -y.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-Y/--speed-limit <speed>"
|
.IP "-Y/--speed-limit <speed>"
|
||||||
If a download is slower than this given speed, in bytes per second, for
|
If a download is slower than this given speed, in bytes per second, for
|
||||||
speed-time seconds it gets aborted. speed-time is set with -Y and is 30 if
|
speed-time seconds it gets aborted. speed-time is set with -Y and is 30 if
|
||||||
not set.
|
not set.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-z/--time-cond <date expression>"
|
.IP "-z/--time-cond <date expression>"
|
||||||
(HTTP)
|
(HTTP)
|
||||||
Request to get a file that has been modified later than the given time and
|
Request to get a file that has been modified later than the given time and
|
||||||
@@ -433,6 +576,8 @@ man pages for date expression details.
|
|||||||
Start the date expression with a dash (-) to make it request for a document
|
Start the date expression with a dash (-) to make it request for a document
|
||||||
that is older than the given date/time, default is a document that is newer
|
that is older than the given date/time, default is a document that is newer
|
||||||
than the specified date/time.
|
than the specified date/time.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.IP "-3/--sslv3"
|
.IP "-3/--sslv3"
|
||||||
(HTTPS)
|
(HTTPS)
|
||||||
Forces curl to use SSL version 3 when negotiating with a remote SSL server.
|
Forces curl to use SSL version 3 when negotiating with a remote SSL server.
|
||||||
@@ -442,12 +587,18 @@ Forces curl to use SSL version 2 when negotiating with a remote SSL server.
|
|||||||
.IP "-#/--progress-bar"
|
.IP "-#/--progress-bar"
|
||||||
Make curl display progress information as a progress bar instead of the
|
Make curl display progress information as a progress bar instead of the
|
||||||
default statistics.
|
default statistics.
|
||||||
|
|
||||||
|
If this option is used twice, the second will again disable the progress bar.
|
||||||
.IP "--crlf"
|
.IP "--crlf"
|
||||||
(FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390).
|
(FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390).
|
||||||
|
|
||||||
|
If this option is used twice, the second will again disable crlf converting.
|
||||||
.IP "--stderr <file>"
|
.IP "--stderr <file>"
|
||||||
Redirect all writes to stderr to the specified file instead. If the file name
|
Redirect all writes to stderr to the specified file instead. If the file name
|
||||||
is a plain '-', it is instead written to stdout. This option has no point when
|
is a plain '-', it is instead written to stdout. This option has no point when
|
||||||
you're using a shell with decent redirecting capabilities.
|
you're using a shell with decent redirecting capabilities.
|
||||||
|
|
||||||
|
If this option is used serveral times, the last one will be used.
|
||||||
.SH FILES
|
.SH FILES
|
||||||
.I ~/.curlrc
|
.I ~/.curlrc
|
||||||
.RS
|
.RS
|
||||||
@@ -502,7 +653,7 @@ FTP weird USER reply. Curl couldn't parse the reply sent to the USER request.
|
|||||||
.IP 13
|
.IP 13
|
||||||
FTP weird PASV reply, Curl couldn't parse the reply sent to the PASV request.
|
FTP weird PASV reply, Curl couldn't parse the reply sent to the PASV request.
|
||||||
.IP 14
|
.IP 14
|
||||||
FTP weird 227 formay. Curl couldn't parse the 227-line the server sent.
|
FTP weird 227 format. Curl couldn't parse the 227-line the server sent.
|
||||||
.IP 15
|
.IP 15
|
||||||
FTP can't get host. Couldn't resolve the host IP we got in the 227-line.
|
FTP can't get host. Couldn't resolve the host IP we got in the 227-line.
|
||||||
.IP 16
|
.IP 16
|
||||||
@@ -560,12 +711,23 @@ LDAP search failed.
|
|||||||
Library not found. The LDAP library was not found.
|
Library not found. The LDAP library was not found.
|
||||||
.IP 41
|
.IP 41
|
||||||
Function not found. A required LDAP function was not found.
|
Function not found. A required LDAP function was not found.
|
||||||
|
.IP 42
|
||||||
|
Aborted by callback. An application told curl to abort the operation.
|
||||||
|
.IP 43
|
||||||
|
Internal error. A function was called with a bad parameter.
|
||||||
|
.IP 44
|
||||||
|
Internal error. A function was called in a bad order.
|
||||||
|
.IP 45
|
||||||
|
Interface error. A specified outgoing interface could not be used.
|
||||||
|
.IP 46
|
||||||
|
Bad password entered. An error was signalled when the password was entered.
|
||||||
|
.IP 47
|
||||||
|
Too many redirects. When following redirects, curl hit the maximum amount.
|
||||||
.IP XX
|
.IP XX
|
||||||
There will appear more error codes here in future releases. The existing ones
|
There will appear more error codes here in future releases. The existing ones
|
||||||
are meant to never change.
|
are meant to never change.
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
If you do find any (or have other suggestions), mail Daniel Stenberg
|
If you do find bugs, mail them to curl-bug@haxx.se.
|
||||||
<Daniel.Stenberg@haxx.se>.
|
|
||||||
.SH AUTHORS / CONTRIBUTORS
|
.SH AUTHORS / CONTRIBUTORS
|
||||||
- Daniel Stenberg <Daniel.Stenberg@haxx.se>
|
- Daniel Stenberg <Daniel.Stenberg@haxx.se>
|
||||||
- Rafael Sagula <sagula@inf.ufrgs.br>
|
- Rafael Sagula <sagula@inf.ufrgs.br>
|
||||||
@@ -616,6 +778,16 @@ If you do find any (or have other suggestions), mail Daniel Stenberg
|
|||||||
- Fred Noz <FNoz@siac.com>
|
- Fred Noz <FNoz@siac.com>
|
||||||
- Caolan McNamara <caolan@csn.ul.ie>
|
- Caolan McNamara <caolan@csn.ul.ie>
|
||||||
- Albert Chin-A-Young <china@thewrittenword.com>
|
- Albert Chin-A-Young <china@thewrittenword.com>
|
||||||
|
- Stephen Kick <skick@epicrealm.com>
|
||||||
|
- Martin Hedenfalk <mhe@stacken.kth.se>
|
||||||
|
- Richard Prescott
|
||||||
|
- Jason S. Priebe <priebe@wral-tv.com>
|
||||||
|
- T. Bharath <TBharath@responsenetworks.com>
|
||||||
|
- Alexander Kourakos <awk@users.sourceforge.net>
|
||||||
|
- James Griffiths <griffiths_james@yahoo.com>
|
||||||
|
- Loic Dachary <loic@senga.org>
|
||||||
|
- Robert Weaver <robert.weaver@sabre.com>
|
||||||
|
- Ingo Ralf Blum <ingoralfblum@ingoralfblum.com>
|
||||||
|
|
||||||
.SH WWW
|
.SH WWW
|
||||||
http://curl.haxx.se
|
http://curl.haxx.se
|
||||||
|
|||||||
92
docs/curl_easy_getinfo.3
Normal file
92
docs/curl_easy_getinfo.3
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
.\" You can view this file with:
|
||||||
|
.\" nroff -man [file]
|
||||||
|
.\" Written by daniel@haxx.se
|
||||||
|
.\"
|
||||||
|
.TH curl_easy_init 3 "22 November 2000" "Curl 7.5" "libcurl Manual"
|
||||||
|
.SH NAME
|
||||||
|
curl_easy_getinfo - Extract information from a curl session (added in 7.4)
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B #include <curl/easy.h>
|
||||||
|
.sp
|
||||||
|
.BI "CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );"
|
||||||
|
.ad
|
||||||
|
.SH DESCRIPTION
|
||||||
|
Request internal information from the curl session with this function. The
|
||||||
|
third argument
|
||||||
|
.B MUST
|
||||||
|
be a pointer to a long, a pointer to a char * or a pointer to a double (as
|
||||||
|
this documentation describes further down). The data pointed-to will be
|
||||||
|
filled in accordingly and can be relied upon only if the function returns
|
||||||
|
CURLE_OK. This function is intended to get used *AFTER* a performed transfer,
|
||||||
|
all results from this function are undefined until the transfer is completed.
|
||||||
|
.SH AVAILABLE INFORMATION
|
||||||
|
These are informations that can be extracted:
|
||||||
|
.TP 0.8i
|
||||||
|
.B CURLINFO_EFFECTIVE_URL
|
||||||
|
Pass a pointer to a 'char *' to receive the last used effective URL.
|
||||||
|
.TP
|
||||||
|
.B CURLINFO_HTTP_CODE
|
||||||
|
Pass a pointer to a long to receive the last received HTTP code.
|
||||||
|
.TP
|
||||||
|
.B CURLINFO_FILETIME
|
||||||
|
Pass a pointer to a long to receive the remote time of the retrieved
|
||||||
|
document. If you get 0, it can be because of many reasons (unknown, the server
|
||||||
|
hides it or the server doesn't support the command that tells document time
|
||||||
|
etc) and the time of the document is unknown. (Added in 7.5)
|
||||||
|
.TP
|
||||||
|
.B CURLINFO_TOTAL_TIME
|
||||||
|
Pass a pointer to a double to receive the total transaction time in seconds
|
||||||
|
for the previous transfer.
|
||||||
|
.TP
|
||||||
|
.B CURLINFO_NAMELOOKUP_TIME
|
||||||
|
Pass a pointer to a double to receive the time, in seconds, it took from the
|
||||||
|
start until the name resolving was completed.
|
||||||
|
.TP
|
||||||
|
.B CURLINFO_CONNECT_TIME
|
||||||
|
Pass a pointer to a double to receive the time, in seconds, it took from the
|
||||||
|
start until the connect to the remote host (or proxy) was completed.
|
||||||
|
.TP
|
||||||
|
.B CURLINFO_PRETRANSFER_TIME
|
||||||
|
Pass a pointer to a double to receive the time, in seconds, it took from the
|
||||||
|
start until the file transfer is just about to begin. This includes all
|
||||||
|
pre-transfer commands and negotiations that are specific to the particular
|
||||||
|
protocol(s) involved.
|
||||||
|
.TP
|
||||||
|
.B CURLINFO_SIZE_UPLOAD
|
||||||
|
Pass a pointer to a double to receive the total amount of bytes that were
|
||||||
|
uploaded.
|
||||||
|
.TP
|
||||||
|
.B CURLINFO_SIZE_DOWNLOAD
|
||||||
|
Pass a pointer to a double to receive the total amount of bytes that were
|
||||||
|
downloaded.
|
||||||
|
.TP
|
||||||
|
.B CURLINFO_SPEED_DOWNLOAD
|
||||||
|
Pass a pointer to a double to receive the average download speed that curl
|
||||||
|
measured for the complete download.
|
||||||
|
.TP
|
||||||
|
.B CURLINFO_SPEED_UPLOAD
|
||||||
|
Pass a pointer to a double to receive the average upload speed that curl
|
||||||
|
measured for the complete upload.
|
||||||
|
.TP
|
||||||
|
.B CURLINFO_HEADER_SIZE
|
||||||
|
Pass a pointer to a long to receive the total size of all the headers
|
||||||
|
received.
|
||||||
|
.TP
|
||||||
|
.B CURLINFO_REQUEST_SIZE
|
||||||
|
Pass a pointer to a long to receive the total size of the issued
|
||||||
|
requests. This is so far only for HTTP requests. Note that this may be more
|
||||||
|
than one request if FOLLOWLOCATION is true.
|
||||||
|
.TP
|
||||||
|
.B CURLINFO_SSL_VERIFYRESULT
|
||||||
|
Pass a pointer to a long to receive the result of the certification
|
||||||
|
verification that was requested (using the CURLOPT_SSL_VERIFYPEER option to
|
||||||
|
curl_easy_setopt). (Added in 7.4.2)
|
||||||
|
.PP
|
||||||
|
|
||||||
|
.SH RETURN VALUE
|
||||||
|
If the operation was successful, CURLE_OK is returned. Otherwise an
|
||||||
|
appropriate error code will be returned.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR curl_easy_setopt "(3)"
|
||||||
|
.SH BUGS
|
||||||
|
Surely there are some, you tell me!
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
.\" nroff -man [file]
|
.\" nroff -man [file]
|
||||||
.\" Written by daniel@haxx.se
|
.\" Written by daniel@haxx.se
|
||||||
.\"
|
.\"
|
||||||
.TH curl_easy_init 3 "22 May 2000" "Curl 7.0" "libcurl Manual"
|
.TH curl_easy_init 3 "26 September 2000" "Curl 7.0" "libcurl Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
curl_easy_init - Start a libcurl "easy" session
|
curl_easy_init - Start a libcurl "easy" session
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -16,6 +16,9 @@ that you shall use as input to the other easy-functions. The init calls
|
|||||||
intializes curl and this call MUST have a corresponding call to
|
intializes curl and this call MUST have a corresponding call to
|
||||||
.I curl_easy_cleanup
|
.I curl_easy_cleanup
|
||||||
when the operation is complete.
|
when the operation is complete.
|
||||||
|
|
||||||
|
On win32 systems, you need to init the winsock stuff manually, libcurl will
|
||||||
|
not do that for you. WSAStartup() and WSACleanup() should be used accordingly.
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
If this function returns NULL, something went wrong and you cannot use the
|
If this function returns NULL, something went wrong and you cannot use the
|
||||||
other curl functions.
|
other curl functions.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
.\" nroff -man [file]
|
.\" nroff -man [file]
|
||||||
.\" Written by daniel@haxx.se
|
.\" Written by daniel@haxx.se
|
||||||
.\"
|
.\"
|
||||||
.TH curl_easy_perform 3 "26 May 2000" "Curl 7.0" "libcurl Manual"
|
.TH curl_easy_perform 3 "25 Jan 2001" "Curl 7.0" "libcurl Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
curl_easy_perform - Do the actual transfer in a "easy" session
|
curl_easy_perform - Do the actual transfer in a "easy" session
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -16,6 +16,10 @@ are made, and will perform the transfer as described in the options.
|
|||||||
It must be called with the same
|
It must be called with the same
|
||||||
.I handle
|
.I handle
|
||||||
as input as the curl_easy_init call returned.
|
as input as the curl_easy_init call returned.
|
||||||
|
|
||||||
|
You are only allowed to call this function once using the same handle. If you
|
||||||
|
want to do repeated calls, you must call curl_easy_cleanup and curl_easy_init
|
||||||
|
again first.
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
0 means everything was ok, non-zero means an error occurred as
|
0 means everything was ok, non-zero means an error occurred as
|
||||||
.I <curl/curl.h>
|
.I <curl/curl.h>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
.\" nroff -man [file]
|
.\" nroff -man [file]
|
||||||
.\" Written by daniel@haxx.se
|
.\" Written by daniel@haxx.se
|
||||||
.\"
|
.\"
|
||||||
.TH curl_easy_setopt 3 "24 August 2000" "Curl 7.2" "libcurl Manual"
|
.TH curl_easy_setopt 3 "28 November 2000" "Curl 7.5" "libcurl Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
curl_easy_setopt - Set curl easy-session options
|
curl_easy_setopt - Set curl easy-session options
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -87,6 +87,12 @@ the end of the host name. The proxy string may be prefixed with
|
|||||||
Set this long with this option to set the proxy port to use unless it is
|
Set this long with this option to set the proxy port to use unless it is
|
||||||
specified in the proxy string CURLOPT_PROXY.
|
specified in the proxy string CURLOPT_PROXY.
|
||||||
.TP
|
.TP
|
||||||
|
.B CURLOPT_HTTPPROXYTUNNEL
|
||||||
|
Set the parameter to non-zero to get the library to tunnel all non-HTTP
|
||||||
|
operations through the given HTTP proxy. Do note that there is a big
|
||||||
|
difference to use a proxy and to tunnel through it. If you don't know what
|
||||||
|
this means, you probably don't want this tunnel option. (Added in libcurl 7.3)
|
||||||
|
.TP
|
||||||
.B CURLOPT_VERBOSE
|
.B CURLOPT_VERBOSE
|
||||||
Set the parameter to non-zero to get the library to display a lot of verbose
|
Set the parameter to non-zero to get the library to display a lot of verbose
|
||||||
information about its operations.
|
information about its operations.
|
||||||
@@ -194,7 +200,8 @@ post operation. See also the CURLOPT_POST.
|
|||||||
If you want to post data to the server without letting libcurl do a strlen()
|
If you want to post data to the server without letting libcurl do a strlen()
|
||||||
to measure the data size, this option must be used. Also, when this option is
|
to measure the data size, this option must be used. Also, when this option is
|
||||||
used, you can post fully binary data which otherwise is likely to fail. If
|
used, you can post fully binary data which otherwise is likely to fail. If
|
||||||
this size is set to zero, the library will use strlen() to get the data size.
|
this size is set to zero, the library will use strlen() to get the data
|
||||||
|
size. (Added in libcurl 7.2)
|
||||||
.TP
|
.TP
|
||||||
.B CURLOPT_REFERER
|
.B CURLOPT_REFERER
|
||||||
Pass a pointer to a zero terminated string as parameter. It will be used to
|
Pass a pointer to a zero terminated string as parameter. It will be used to
|
||||||
@@ -230,7 +237,7 @@ want the transfer to start from.
|
|||||||
.B CURLOPT_COOKIE
|
.B CURLOPT_COOKIE
|
||||||
Pass a pointer to a zero terminated string as parameter. It will be used to
|
Pass a pointer to a zero terminated string as parameter. It will be used to
|
||||||
set a cookie in the http request. The format of the string should be
|
set a cookie in the http request. The format of the string should be
|
||||||
'[NAME]=[CONTENTS];' Where NAME is the cookie name.
|
[NAME]=[CONTENTS]; Where NAME is the cookie name.
|
||||||
.TP
|
.TP
|
||||||
.B CURLOPT_HTTPHEADER
|
.B CURLOPT_HTTPHEADER
|
||||||
Pass a pointer to a linked list of HTTP headers to pass to the server in your
|
Pass a pointer to a linked list of HTTP headers to pass to the server in your
|
||||||
@@ -260,7 +267,7 @@ the password required to use the CURLOPT_SSLCERT certificate. If the password
|
|||||||
is not supplied, you will be prompted for it.
|
is not supplied, you will be prompted for it.
|
||||||
.TP
|
.TP
|
||||||
.B CURLOPT_CRLF
|
.B CURLOPT_CRLF
|
||||||
TBD.
|
Convert unix newlines to CRLF newlines on FTP uploads.
|
||||||
.TP
|
.TP
|
||||||
.B CURLOPT_QUOTE
|
.B CURLOPT_QUOTE
|
||||||
Pass a pointer to a linked list of FTP commands to pass to the server prior to
|
Pass a pointer to a linked list of FTP commands to pass to the server prior to
|
||||||
@@ -310,7 +317,20 @@ your server supports the command first.
|
|||||||
Pass a FILE * as parameter. This is the stream to use instead of stderr
|
Pass a FILE * as parameter. This is the stream to use instead of stderr
|
||||||
internally when reporting errors.
|
internally when reporting errors.
|
||||||
.TP
|
.TP
|
||||||
|
.B CURLOPT_INTERFACE
|
||||||
|
Pass a char * as parameter. This set the interface name to use as outgoing
|
||||||
|
network interface. The name can be an interface name, an IP address or a host
|
||||||
|
name. (Added in libcurl 7.3)
|
||||||
|
.TP
|
||||||
|
.B CURLOPT_KRB4LEVEL
|
||||||
|
Pass a char * as parameter. Set the krb4 security level, this also enables
|
||||||
|
krb4 awareness. This is a string, 'clear', 'safe', 'confidential' or
|
||||||
|
'private'. If the string is set but doesn't match one of these, 'private'
|
||||||
|
will be used. Set the string to NULL to disable kerberos4. The kerberos
|
||||||
|
support only works for FTP. (Added in libcurl 7.3)
|
||||||
|
.TP
|
||||||
.B CURLOPT_WRITEINFO
|
.B CURLOPT_WRITEINFO
|
||||||
|
(NOT PRESENT IN 7.4 or later!)
|
||||||
Pass a pointer to a zero terminated string as parameter. It will be used to
|
Pass a pointer to a zero terminated string as parameter. It will be used to
|
||||||
report information after a successful request. This string may contain
|
report information after a successful request. This string may contain
|
||||||
variables that will be substituted by their contents when output. Described
|
variables that will be substituted by their contents when output. Described
|
||||||
@@ -332,6 +352,52 @@ Pass a pointer that will be untouched by libcurl and passed as the first
|
|||||||
argument in the progress callback set with
|
argument in the progress callback set with
|
||||||
.I CURLOPT_PROGRESSFUNCTION
|
.I CURLOPT_PROGRESSFUNCTION
|
||||||
.
|
.
|
||||||
|
.TP
|
||||||
|
.B CURLOPT_SSL_VERIFYPEER
|
||||||
|
Pass a long that is set to a non-zero value to make curl verify the peer's
|
||||||
|
certificate. The certificate to verify against must be specified with the
|
||||||
|
CURLOPT_CAINFO option. (Added in 7.4.2)
|
||||||
|
.TP
|
||||||
|
.B CURLOPT_CAINFO
|
||||||
|
Pass a char * to a zero terminated file naming holding the certificate to
|
||||||
|
verify the peer with. This only makes sense when used in combination with the
|
||||||
|
CURLOPT_SSL_VERIFYPEER option. (Added in 7.4.2)
|
||||||
|
.TP
|
||||||
|
.B CURLOPT_PASSWDFUNCTION
|
||||||
|
Pass a pointer to a curl_passwd_callback function that will then be called
|
||||||
|
instead of the internal one if libcurl requests a password. The function must
|
||||||
|
match this prototype:
|
||||||
|
.BI "int my_getpass(void *client, char *prompt, char* buffer, int buflen );"
|
||||||
|
If set to NULL, it equals to making the function always fail. If the function
|
||||||
|
returns a non-zero value, it will abort the operation and an error
|
||||||
|
(CURLE_BAD_PASSWORD_ENTERED) will be returned.
|
||||||
|
.I client
|
||||||
|
is a generic pointer, see CURLOPT_PASSWDDATA.
|
||||||
|
.I prompt
|
||||||
|
is a zero-terminated string that is text that prefixes the input request.
|
||||||
|
.I buffer
|
||||||
|
is a pointer to data where the entered password should be stored and
|
||||||
|
.I buflen
|
||||||
|
is the maximum number of bytes that may be written in the buffer.
|
||||||
|
(Added in 7.4.2)
|
||||||
|
.TP
|
||||||
|
.B CURLOPT_PASSWDDATA
|
||||||
|
Pass a void * to whatever data you want. The passed pointer will be the first
|
||||||
|
argument sent to the specifed CURLOPT_PASSWDFUNCTION function. (Added in
|
||||||
|
7.4.2)
|
||||||
|
.TP
|
||||||
|
.B CURLOPT_FILETIME
|
||||||
|
Pass a long. If it is a non-zero value, libcurl will attempt to get the
|
||||||
|
modification date of the remote document in this operation. This requires that
|
||||||
|
the remote server sends the time or replies to a time querying command. The
|
||||||
|
curl_easy_getinfo() function with the CURLINFO_FILETIME argument can be used
|
||||||
|
after a transfer to extract the received time (if any). (Added in 7.5)
|
||||||
|
.TP
|
||||||
|
.B CURLOPT_MAXREDIRS
|
||||||
|
Pass a long. The set number will be the redirection limit. If that many
|
||||||
|
redirections have been followed, the next redirect will cause an error. This
|
||||||
|
option only makes sense if the CURLOPT_FOLLOWLOCATION is used at the same
|
||||||
|
time. (Added in 7.5)
|
||||||
.PP
|
.PP
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
0 means the option was set properly, non-zero means an error as
|
0 means the option was set properly, non-zero means an error as
|
||||||
|
|||||||
23
docs/curl_formfree.3
Normal file
23
docs/curl_formfree.3
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
.\" You can view this file with:
|
||||||
|
.\" nroff -man [file]
|
||||||
|
.\" Written by daniel@haxx.se
|
||||||
|
.\"
|
||||||
|
.TH curl_formfree 3 "17 November 2000" "Curl 7.5" "libcurl Manual"
|
||||||
|
.SH NAME
|
||||||
|
curl_formfree - free a previously build multipart/formdata HTTP POST chain
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B #include <curl/curl.h>
|
||||||
|
.sp
|
||||||
|
.BI "void curl_formfree(struct HttpPost *" form);
|
||||||
|
.ad
|
||||||
|
.SH DESCRIPTION
|
||||||
|
curl_formfree() is used to clean up data previously built/appended with
|
||||||
|
curl_formparse(). This must be called when the data has been used, which
|
||||||
|
typically means after the curl_easy_perform() has been called.
|
||||||
|
.SH RETURN VALUE
|
||||||
|
None
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR curl_formparse "(3) "
|
||||||
|
.SH BUGS
|
||||||
|
Surely there are some, you tell me!
|
||||||
|
|
||||||
11
docs/examples/Makefile.am
Normal file
11
docs/examples/Makefile.am
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
|
||||||
|
AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||||
|
|
||||||
|
EXTRA_DIST =
|
||||||
|
README curlgtk.c sepheaders.c simple.c
|
||||||
|
|
||||||
|
all:
|
||||||
|
@echo "done"
|
||||||
8
docs/examples/README
Normal file
8
docs/examples/README
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
EXAMPLES
|
||||||
|
|
||||||
|
This directory is for tiny libcurl programming examples. They are meant to
|
||||||
|
show some simple steps on how you can build your own application to take full
|
||||||
|
advantage of libcurl.
|
||||||
|
|
||||||
|
If you end up with other small but still useful example sources, please mail
|
||||||
|
them for submission in future packages and on the web site.
|
||||||
87
docs/examples/curlgtk.c
Normal file
87
docs/examples/curlgtk.c
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/* curlgtk.c */
|
||||||
|
/* Copyright (c) 2000 David Odin (aka DindinX) for MandrakeSoft */
|
||||||
|
/* an attempt to use the curl library in concert with a gtk-threaded application */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#include <curl/curl.h>
|
||||||
|
#include <curl/types.h> /* new for v7 */
|
||||||
|
#include <curl/easy.h> /* new for v7 */
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
GtkWidget *Bar;
|
||||||
|
|
||||||
|
size_t my_read_func(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||||
|
{
|
||||||
|
return fread(ptr, size, nmemb, stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
int my_progress_func(GtkWidget *Bar, int t, int d)
|
||||||
|
{
|
||||||
|
/* printf("%d / %d (%g %%)\n", d, t, d*100.0/t);*/
|
||||||
|
gdk_threads_enter();
|
||||||
|
gtk_progress_set_value(GTK_PROGRESS(Bar), d*100.0/t);
|
||||||
|
gdk_threads_leave();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *curl_thread(void *ptr)
|
||||||
|
{
|
||||||
|
CURL *curl;
|
||||||
|
CURLcode res;
|
||||||
|
FILE *outfile;
|
||||||
|
gchar *url = ptr;
|
||||||
|
|
||||||
|
curl = curl_easy_init();
|
||||||
|
if(curl)
|
||||||
|
{
|
||||||
|
outfile = fopen("/tmp/test.curl", "w");
|
||||||
|
|
||||||
|
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_FILE, outfile);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_READFUNCTION, my_read_func);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, my_progress_func);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, Bar);
|
||||||
|
|
||||||
|
res = curl_easy_perform(curl);
|
||||||
|
|
||||||
|
fclose(outfile);
|
||||||
|
/* always cleanup */
|
||||||
|
curl_easy_cleanup(curl);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GtkWidget *Window, *Frame, *Frame2;
|
||||||
|
GtkAdjustment *adj;
|
||||||
|
pthread_t curl_tid;
|
||||||
|
|
||||||
|
/* Init thread */
|
||||||
|
g_thread_init(NULL);
|
||||||
|
|
||||||
|
gtk_init(&argc, &argv);
|
||||||
|
Window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
|
Frame = gtk_frame_new(NULL);
|
||||||
|
gtk_frame_set_shadow_type(GTK_FRAME(Frame), GTK_SHADOW_OUT);
|
||||||
|
gtk_container_add(GTK_CONTAINER(Window), Frame);
|
||||||
|
Frame2 = gtk_frame_new(NULL);
|
||||||
|
gtk_frame_set_shadow_type(GTK_FRAME(Frame2), GTK_SHADOW_IN);
|
||||||
|
gtk_container_add(GTK_CONTAINER(Frame), Frame2);
|
||||||
|
gtk_container_set_border_width(GTK_CONTAINER(Frame2), 5);
|
||||||
|
adj = (GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0);
|
||||||
|
Bar = gtk_progress_bar_new_with_adjustment(adj);
|
||||||
|
gtk_container_add(GTK_CONTAINER(Frame2), Bar);
|
||||||
|
gtk_widget_show_all(Window);
|
||||||
|
|
||||||
|
pthread_create(&curl_tid, NULL, curl_thread, argv[1]);
|
||||||
|
|
||||||
|
gdk_threads_enter();
|
||||||
|
gtk_main();
|
||||||
|
gdk_threads_leave();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
63
docs/examples/sepheaders.c
Normal file
63
docs/examples/sepheaders.c
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <curl/curl.h>
|
||||||
|
#include <curl/types.h>
|
||||||
|
#include <curl/easy.h>
|
||||||
|
|
||||||
|
size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||||
|
{
|
||||||
|
written = fwrite(ptr,size,nmemb,outfile);
|
||||||
|
return written;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
CURL *curl_handle;
|
||||||
|
char *headerfilename = "head.out";
|
||||||
|
FILE *headerfile;
|
||||||
|
char *bodyfilename = "body.out";
|
||||||
|
FILE *bodyfile;
|
||||||
|
|
||||||
|
/* init the curl session */
|
||||||
|
curl_handle = curl_easy_init();
|
||||||
|
|
||||||
|
/* set URL to get */
|
||||||
|
curl_easy_setopt(curl_handle, CURLOPT_URL, "http://curl.haxx.se");
|
||||||
|
|
||||||
|
/* no progress meter please */
|
||||||
|
curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1);
|
||||||
|
|
||||||
|
/* shut up completely */
|
||||||
|
curl_easy_setopt(curl_handle, CURLOPT_MUTE, 1);
|
||||||
|
|
||||||
|
/* send all data to this function */
|
||||||
|
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_data);
|
||||||
|
|
||||||
|
/* open the files */
|
||||||
|
headerfile = fopen(headerfilename,"w");
|
||||||
|
if (headerfile == NULL) {
|
||||||
|
curl_easy_cleanup(curl_handle);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
bodyfile = fopen(bodyfilename,"w");
|
||||||
|
if (bodyfile == NULL) {
|
||||||
|
curl_easy_cleanup(curl_handle);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* we want the headers to this file handle */
|
||||||
|
curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER ,headerfile);
|
||||||
|
|
||||||
|
/* get it! */
|
||||||
|
curl_easy_perform(curl_handle);
|
||||||
|
|
||||||
|
/* close the header file */
|
||||||
|
fclose(headerfile);
|
||||||
|
|
||||||
|
/* cleanup curl stuff */
|
||||||
|
curl_easy_cleanup(curl_handle);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
26
docs/examples/simple.c
Normal file
26
docs/examples/simple.c
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <curl/curl.h>
|
||||||
|
#include <curl/types.h>
|
||||||
|
#include <curl/easy.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
CURL *curl;
|
||||||
|
CURLcode res;
|
||||||
|
FILE *headerfile;
|
||||||
|
|
||||||
|
headerfile = fopen("dumpit", "w");
|
||||||
|
|
||||||
|
curl = curl_easy_init();
|
||||||
|
if(curl) {
|
||||||
|
/* what call to write: */
|
||||||
|
curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEHEADER, headerfile);
|
||||||
|
res = curl_easy_perform(curl);
|
||||||
|
|
||||||
|
/* always cleanup */
|
||||||
|
curl_easy_cleanup(curl);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -7,39 +7,23 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.nu
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
/* The include stuff here is mainly for time_t! */
|
/* The include stuff here is mainly for time_t! */
|
||||||
#ifdef vms
|
#ifdef vms
|
||||||
# include <types.h>
|
# include <types.h>
|
||||||
@@ -67,6 +51,10 @@
|
|||||||
|
|
||||||
#include <curl/types.h>
|
#include <curl/types.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
struct HttpPost {
|
struct HttpPost {
|
||||||
struct HttpPost *next; /* next entry in the list */
|
struct HttpPost *next; /* next entry in the list */
|
||||||
char *name; /* pointer to allocated name */
|
char *name; /* pointer to allocated name */
|
||||||
@@ -95,8 +83,17 @@ typedef size_t (*curl_read_callback)(char *buffer,
|
|||||||
size_t nitems,
|
size_t nitems,
|
||||||
FILE *instream);
|
FILE *instream);
|
||||||
|
|
||||||
/* All possible error codes from this version of urlget(). Future versions
|
typedef int (*curl_passwd_callback)(void *clientp,
|
||||||
may return other values, stay prepared. */
|
char *prompt,
|
||||||
|
char *buffer,
|
||||||
|
int buflen);
|
||||||
|
|
||||||
|
/* All possible error codes from all sorts of curl functions. Future versions
|
||||||
|
may return other values, stay prepared.
|
||||||
|
|
||||||
|
Always add new return codes last. Never *EVER* remove any. The return
|
||||||
|
codes must remain the same!
|
||||||
|
*/
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CURLE_OK = 0,
|
CURLE_OK = 0,
|
||||||
@@ -153,10 +150,14 @@ typedef enum {
|
|||||||
CURLE_FUNCTION_NOT_FOUND,
|
CURLE_FUNCTION_NOT_FOUND,
|
||||||
|
|
||||||
CURLE_ABORTED_BY_CALLBACK,
|
CURLE_ABORTED_BY_CALLBACK,
|
||||||
|
|
||||||
CURLE_BAD_FUNCTION_ARGUMENT,
|
CURLE_BAD_FUNCTION_ARGUMENT,
|
||||||
CURLE_BAD_CALLING_ORDER,
|
CURLE_BAD_CALLING_ORDER,
|
||||||
|
|
||||||
|
CURLE_HTTP_PORT_FAILED, /* HTTP Interface operation failed */
|
||||||
|
|
||||||
|
CURLE_BAD_PASSWORD_ENTERED, /* when the my_getpass() returns fail */
|
||||||
|
CURLE_TOO_MANY_REDIRECTS , /* catch endless re-direct loops */
|
||||||
|
|
||||||
CURL_LAST
|
CURL_LAST
|
||||||
} CURLcode;
|
} CURLcode;
|
||||||
|
|
||||||
@@ -165,14 +166,13 @@ typedef enum {
|
|||||||
|
|
||||||
#define CURL_ERROR_SIZE 256
|
#define CURL_ERROR_SIZE 256
|
||||||
|
|
||||||
/* maximum URL length we deal with */
|
|
||||||
#define URL_MAX_LENGTH 4096
|
|
||||||
#define URL_MAX_LENGTH_TXT "4095"
|
|
||||||
|
|
||||||
/* name is uppercase CURLOPT_<name>,
|
/* name is uppercase CURLOPT_<name>,
|
||||||
type is one of the defined CURLOPTTYPE_<type>
|
type is one of the defined CURLOPTTYPE_<type>
|
||||||
number is unique identifier */
|
number is unique identifier */
|
||||||
#define T(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
|
#ifdef CINIT
|
||||||
|
#undef CINIT
|
||||||
|
#endif
|
||||||
|
#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
|
||||||
|
|
||||||
/* long may be 32 or 64 bits, but we should never depend on anything else
|
/* long may be 32 or 64 bits, but we should never depend on anything else
|
||||||
but 32 */
|
but 32 */
|
||||||
@@ -181,74 +181,74 @@ typedef enum {
|
|||||||
#define CURLOPTTYPE_FUNCTIONPOINT 20000
|
#define CURLOPTTYPE_FUNCTIONPOINT 20000
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
T(NOTHING, LONG, 0), /********* the first one is unused ************/
|
CINIT(NOTHING, LONG, 0), /********* the first one is unused ************/
|
||||||
|
|
||||||
/* This is the FILE * the regular output should be written to. */
|
/* This is the FILE * the regular output should be written to. */
|
||||||
T(FILE, OBJECTPOINT, 1),
|
CINIT(FILE, OBJECTPOINT, 1),
|
||||||
|
|
||||||
/* The full URL to get/put */
|
/* The full URL to get/put */
|
||||||
T(URL, OBJECTPOINT, 2),
|
CINIT(URL, OBJECTPOINT, 2),
|
||||||
|
|
||||||
/* Port number to connect to, if other than default. Specify the CONF_PORT
|
/* Port number to connect to, if other than default. Specify the CONF_PORT
|
||||||
flag in the CURLOPT_FLAGS to activate this */
|
flag in the CURLOPT_FLAGS to activate this */
|
||||||
T(PORT, LONG, 3),
|
CINIT(PORT, LONG, 3),
|
||||||
|
|
||||||
/* Name of proxy to use. Specify the CONF_PROXY flag in the CURLOPT_FLAGS to
|
/* Name of proxy to use. Specify the CONF_PROXY flag in the CURLOPT_FLAGS to
|
||||||
activate this */
|
activate this */
|
||||||
T(PROXY, OBJECTPOINT, 4),
|
CINIT(PROXY, OBJECTPOINT, 4),
|
||||||
|
|
||||||
/* Name and password to use when fetching. Specify the CONF_USERPWD flag in
|
/* Name and password to use when fetching. Specify the CONF_USERPWD flag in
|
||||||
the CURLOPT_FLAGS to activate this */
|
the CURLOPT_FLAGS to activate this */
|
||||||
T(USERPWD, OBJECTPOINT, 5),
|
CINIT(USERPWD, OBJECTPOINT, 5),
|
||||||
|
|
||||||
/* Name and password to use with Proxy. Specify the CONF_PROXYUSERPWD
|
/* Name and password to use with Proxy. Specify the CONF_PROXYUSERPWD
|
||||||
flag in the CURLOPT_FLAGS to activate this */
|
flag in the CURLOPT_FLAGS to activate this */
|
||||||
T(PROXYUSERPWD, OBJECTPOINT, 6),
|
CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
|
||||||
|
|
||||||
/* Range to get, specified as an ASCII string. Specify the CONF_RANGE flag
|
/* Range to get, specified as an ASCII string. Specify the CONF_RANGE flag
|
||||||
in the CURLOPT_FLAGS to activate this */
|
in the CURLOPT_FLAGS to activate this */
|
||||||
T(RANGE, OBJECTPOINT, 7),
|
CINIT(RANGE, OBJECTPOINT, 7),
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Configuration flags */
|
/* Configuration flags */
|
||||||
T(FLAGS, LONG, 8),
|
CINIT(FLAGS, LONG, 8),
|
||||||
#endif
|
#endif
|
||||||
/* Specified file stream to upload from (use as input): */
|
/* Specified file stream to upload from (use as input): */
|
||||||
T(INFILE, OBJECTPOINT, 9),
|
CINIT(INFILE, OBJECTPOINT, 9),
|
||||||
|
|
||||||
/* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
|
/* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
|
||||||
* bytes big. If this is not used, error messages go to stderr instead: */
|
* bytes big. If this is not used, error messages go to stderr instead: */
|
||||||
T(ERRORBUFFER, OBJECTPOINT, 10),
|
CINIT(ERRORBUFFER, OBJECTPOINT, 10),
|
||||||
|
|
||||||
/* Function that will be called to store the output (instead of fwrite). The
|
/* Function that will be called to store the output (instead of fwrite). The
|
||||||
* parameters will use fwrite() syntax, make sure to follow them. */
|
* parameters will use fwrite() syntax, make sure to follow them. */
|
||||||
T(WRITEFUNCTION, FUNCTIONPOINT, 11),
|
CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
|
||||||
|
|
||||||
/* Function that will be called to read the input (instead of fread). The
|
/* Function that will be called to read the input (instead of fread). The
|
||||||
* parameters will use fread() syntax, make sure to follow them. */
|
* parameters will use fread() syntax, make sure to follow them. */
|
||||||
T(READFUNCTION, FUNCTIONPOINT, 12),
|
CINIT(READFUNCTION, FUNCTIONPOINT, 12),
|
||||||
|
|
||||||
/* Time-out the read operation after this amount of seconds */
|
/* Time-out the read operation after this amount of seconds */
|
||||||
T(TIMEOUT, LONG, 13),
|
CINIT(TIMEOUT, LONG, 13),
|
||||||
|
|
||||||
/* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
|
/* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
|
||||||
* how large the file being sent really is. That allows better error
|
* how large the file being sent really is. That allows better error
|
||||||
* checking and better verifies that the upload was succcessful. -1 means
|
* checking and better verifies that the upload was succcessful. -1 means
|
||||||
* unknown size. */
|
* unknown size. */
|
||||||
T(INFILESIZE, LONG, 14),
|
CINIT(INFILESIZE, LONG, 14),
|
||||||
|
|
||||||
/* POST input fields. */
|
/* POST input fields. */
|
||||||
T(POSTFIELDS, OBJECTPOINT, 15),
|
CINIT(POSTFIELDS, OBJECTPOINT, 15),
|
||||||
|
|
||||||
/* Set the referer page (needed by some CGIs) */
|
/* Set the referer page (needed by some CGIs) */
|
||||||
T(REFERER, OBJECTPOINT, 16),
|
CINIT(REFERER, OBJECTPOINT, 16),
|
||||||
|
|
||||||
/* Set the FTP PORT string (interface name, named or numerical IP address)
|
/* Set the FTP PORT string (interface name, named or numerical IP address)
|
||||||
Use i.e '-' to use default address. */
|
Use i.e '-' to use default address. */
|
||||||
T(FTPPORT, OBJECTPOINT, 17),
|
CINIT(FTPPORT, OBJECTPOINT, 17),
|
||||||
|
|
||||||
/* Set the User-Agent string (examined by some CGIs) */
|
/* Set the User-Agent string (examined by some CGIs) */
|
||||||
T(USERAGENT, OBJECTPOINT, 18),
|
CINIT(USERAGENT, OBJECTPOINT, 18),
|
||||||
|
|
||||||
/* If the download receives less than "low speed limit" bytes/second
|
/* If the download receives less than "low speed limit" bytes/second
|
||||||
* during "low speed time" seconds, the operations is aborted.
|
* during "low speed time" seconds, the operations is aborted.
|
||||||
@@ -257,129 +257,158 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Set the "low speed limit" */
|
/* Set the "low speed limit" */
|
||||||
T(LOW_SPEED_LIMIT, LONG , 19),
|
CINIT(LOW_SPEED_LIMIT, LONG , 19),
|
||||||
|
|
||||||
/* Set the "low speed time" */
|
/* Set the "low speed time" */
|
||||||
T(LOW_SPEED_TIME, LONG, 20),
|
CINIT(LOW_SPEED_TIME, LONG, 20),
|
||||||
|
|
||||||
/* Set the continuation offset */
|
/* Set the continuation offset */
|
||||||
T(RESUME_FROM, LONG, 21),
|
CINIT(RESUME_FROM, LONG, 21),
|
||||||
|
|
||||||
/* Set cookie in request: */
|
/* Set cookie in request: */
|
||||||
T(COOKIE, OBJECTPOINT, 22),
|
CINIT(COOKIE, OBJECTPOINT, 22),
|
||||||
|
|
||||||
/* This points to a linked list of headers, struct HttpHeader kind */
|
/* This points to a linked list of headers, struct HttpHeader kind */
|
||||||
T(HTTPHEADER, OBJECTPOINT, 23),
|
CINIT(HTTPHEADER, OBJECTPOINT, 23),
|
||||||
|
|
||||||
/* This points to a linked list of post entries, struct HttpPost */
|
/* This points to a linked list of post entries, struct HttpPost */
|
||||||
T(HTTPPOST, OBJECTPOINT, 24),
|
CINIT(HTTPPOST, OBJECTPOINT, 24),
|
||||||
|
|
||||||
/* name of the file keeping your private SSL-certificate */
|
/* name of the file keeping your private SSL-certificate */
|
||||||
T(SSLCERT, OBJECTPOINT, 25),
|
CINIT(SSLCERT, OBJECTPOINT, 25),
|
||||||
|
|
||||||
/* password for the SSL-certificate */
|
/* password for the SSL-certificate */
|
||||||
T(SSLCERTPASSWD, OBJECTPOINT, 26),
|
CINIT(SSLCERTPASSWD, OBJECTPOINT, 26),
|
||||||
|
|
||||||
/* send TYPE parameter? */
|
/* send TYPE parameter? */
|
||||||
T(CRLF, LONG, 27),
|
CINIT(CRLF, LONG, 27),
|
||||||
|
|
||||||
/* send linked-list of QUOTE commands */
|
/* send linked-list of QUOTE commands */
|
||||||
T(QUOTE, OBJECTPOINT, 28),
|
CINIT(QUOTE, OBJECTPOINT, 28),
|
||||||
|
|
||||||
/* send FILE * to store headers to */
|
/* send FILE * to store headers to */
|
||||||
T(WRITEHEADER, OBJECTPOINT, 29),
|
CINIT(WRITEHEADER, OBJECTPOINT, 29),
|
||||||
|
|
||||||
#ifdef MULTIDOC
|
#ifdef MULTIDOC
|
||||||
/* send linked list of MoreDoc structs */
|
/* send linked list of MoreDoc structs */
|
||||||
T(MOREDOCS, OBJECTPOINT, 30),
|
CINIT(MOREDOCS, OBJECTPOINT, 30),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* point to a file to read the initial cookies from, also enables
|
/* point to a file to read the initial cookies from, also enables
|
||||||
"cookie awareness" */
|
"cookie awareness" */
|
||||||
T(COOKIEFILE, OBJECTPOINT, 31),
|
CINIT(COOKIEFILE, OBJECTPOINT, 31),
|
||||||
|
|
||||||
/* What version to specifly try to use.
|
/* What version to specifly try to use.
|
||||||
3 = SSLv3, 2 = SSLv2, all else makes it try v3 first then v2 */
|
3 = SSLv3, 2 = SSLv2, all else makes it try v3 first then v2 */
|
||||||
T(SSLVERSION, LONG, 32),
|
CINIT(SSLVERSION, LONG, 32),
|
||||||
|
|
||||||
/* What kind of HTTP time condition to use, see defines */
|
/* What kind of HTTP time condition to use, see defines */
|
||||||
T(TIMECONDITION, LONG, 33),
|
CINIT(TIMECONDITION, LONG, 33),
|
||||||
|
|
||||||
/* Time to use with the above condition. Specified in number of seconds
|
/* Time to use with the above condition. Specified in number of seconds
|
||||||
since 1 Jan 1970 */
|
since 1 Jan 1970 */
|
||||||
T(TIMEVALUE, LONG, 34),
|
CINIT(TIMEVALUE, LONG, 34),
|
||||||
|
|
||||||
/* HTTP request, for odd commands like DELETE, TRACE and others */
|
/* HTTP request, for odd commands like DELETE, TRACE and others */
|
||||||
/* OBSOLETE DEFINE, left for tradition only */
|
/* OBSOLETE DEFINE, left for tradition only */
|
||||||
T(HTTPREQUEST, OBJECTPOINT, 35),
|
CINIT(HTTPREQUEST, OBJECTPOINT, 35),
|
||||||
|
|
||||||
/* Custom request, for customizing the get command like
|
/* Custom request, for customizing the get command like
|
||||||
HTTP: DELETE, TRACE and others
|
HTTP: DELETE, TRACE and others
|
||||||
FTP: to use a different list command
|
FTP: to use a different list command
|
||||||
*/
|
*/
|
||||||
T(CUSTOMREQUEST, OBJECTPOINT, 36),
|
CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
|
||||||
|
|
||||||
/* HTTP request, for odd commands like DELETE, TRACE and others */
|
/* HTTP request, for odd commands like DELETE, TRACE and others */
|
||||||
T(STDERR, OBJECTPOINT, 37),
|
CINIT(STDERR, OBJECTPOINT, 37),
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Progress mode set alternative progress mode displays. Alternative
|
/* Progress mode set alternative progress mode displays. Alternative
|
||||||
ones should now be made by the client, not the lib! */
|
ones should now be made by the client, not the lib! */
|
||||||
T(PROGRESSMODE, LONG, 38),
|
CINIT(PROGRESSMODE, LONG, 38),
|
||||||
#endif
|
#endif
|
||||||
/* send linked-list of post-transfer QUOTE commands */
|
/* send linked-list of post-transfer QUOTE commands */
|
||||||
T(POSTQUOTE, OBJECTPOINT, 39),
|
CINIT(POSTQUOTE, OBJECTPOINT, 39),
|
||||||
|
|
||||||
/* Pass a pointer to string of the output using full variable-replacement
|
/* Pass a pointer to string of the output using full variable-replacement
|
||||||
as described elsewhere. */
|
as described elsewhere. */
|
||||||
T(WRITEINFO, OBJECTPOINT, 40),
|
CINIT(WRITEINFO, OBJECTPOINT, 40),
|
||||||
|
|
||||||
/* Previous FLAG bits */
|
/* Previous FLAG bits */
|
||||||
T(VERBOSE, LONG, 41), /* talk a lot */
|
CINIT(VERBOSE, LONG, 41), /* talk a lot */
|
||||||
T(HEADER, LONG, 42), /* throw the header out too */
|
CINIT(HEADER, LONG, 42), /* throw the header out too */
|
||||||
T(NOPROGRESS, LONG, 43), /* shut off the progress meter */
|
CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */
|
||||||
T(NOBODY, LONG, 44), /* use HEAD to get http document */
|
CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */
|
||||||
T(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */
|
CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */
|
||||||
T(UPLOAD, LONG, 46), /* this is an upload */
|
CINIT(UPLOAD, LONG, 46), /* this is an upload */
|
||||||
T(POST, LONG, 47), /* HTTP POST method */
|
CINIT(POST, LONG, 47), /* HTTP POST method */
|
||||||
T(FTPLISTONLY, LONG, 48), /* Use NLST when listing ftp dir */
|
CINIT(FTPLISTONLY, LONG, 48), /* Use NLST when listing ftp dir */
|
||||||
|
|
||||||
T(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */
|
CINIT(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */
|
||||||
T(NETRC, LONG, 51), /* read user+password from .netrc */
|
CINIT(NETRC, LONG, 51), /* read user+password from .netrc */
|
||||||
T(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
|
CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
|
||||||
|
|
||||||
/* This FTPASCII name is now obsolete, to be removed, use the TRANSFERTEXT
|
/* This FTPASCII name is now obsolete, to be removed, use the TRANSFERTEXT
|
||||||
instead. It goes for more protocols than just ftp... */
|
instead. It goes for more protocols than just ftp... */
|
||||||
T(FTPASCII, LONG, 53), /* use TYPE A for transfer */
|
CINIT(FTPASCII, LONG, 53), /* use TYPE A for transfer */
|
||||||
|
|
||||||
T(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
|
CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
|
||||||
T(PUT, LONG, 54), /* PUT the input file */
|
CINIT(PUT, LONG, 54), /* PUT the input file */
|
||||||
T(MUTE, LONG, 55), /* force NOPROGRESS */
|
CINIT(MUTE, LONG, 55), /* force NOPROGRESS */
|
||||||
|
|
||||||
/* Function that will be called instead of the internal progress display
|
/* Function that will be called instead of the internal progress display
|
||||||
* function. This function should be defined as the curl_progress_callback
|
* function. This function should be defined as the curl_progress_callback
|
||||||
* prototype defines. */
|
* prototype defines. */
|
||||||
T(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
|
CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
|
||||||
|
|
||||||
/* Data passed to the progress callback */
|
/* Data passed to the progress callback */
|
||||||
T(PROGRESSDATA, OBJECTPOINT, 57),
|
CINIT(PROGRESSDATA, OBJECTPOINT, 57),
|
||||||
|
|
||||||
/* We want the referer field set automatically when following locations */
|
/* We want the referer field set automatically when following locations */
|
||||||
T(AUTOREFERER, LONG, 58),
|
CINIT(AUTOREFERER, LONG, 58),
|
||||||
|
|
||||||
/* Port of the proxy, can be set in the proxy string as well with:
|
/* Port of the proxy, can be set in the proxy string as well with:
|
||||||
"[host]:[port]" */
|
"[host]:[port]" */
|
||||||
T(PROXYPORT, LONG, 59),
|
CINIT(PROXYPORT, LONG, 59),
|
||||||
|
|
||||||
/* size of the POST input data, if strlen() is not good to use */
|
/* size of the POST input data, if strlen() is not good to use */
|
||||||
T(POSTFIELDSIZE, LONG, 60),
|
CINIT(POSTFIELDSIZE, LONG, 60),
|
||||||
|
|
||||||
|
/* tunnel non-http operations through a HTTP proxy */
|
||||||
|
CINIT(HTTPPROXYTUNNEL, LONG, 61),
|
||||||
|
|
||||||
|
/* Set the interface string to use as outgoing network interface */
|
||||||
|
CINIT(INTERFACE, OBJECTPOINT, 62),
|
||||||
|
|
||||||
|
/* Set the krb4 security level, this also enables krb4 awareness. This is a
|
||||||
|
* string, 'clear', 'safe', 'confidential' or 'private'. If the string is
|
||||||
|
* set but doesn't match one of these, 'private' will be used. */
|
||||||
|
CINIT(KRB4LEVEL, OBJECTPOINT, 63),
|
||||||
|
|
||||||
|
/* Set if we should verify the peer in ssl handshake, set 1 to verify. */
|
||||||
|
CINIT(SSL_VERIFYPEER, LONG, 64),
|
||||||
|
|
||||||
|
/* The CApath or CAfile used to validate the peer certificate
|
||||||
|
this option is used only if SSL_VERIFYPEER is true */
|
||||||
|
CINIT(CAINFO, OBJECTPOINT, 65),
|
||||||
|
|
||||||
|
/* Function pointer to replace the internal password prompt */
|
||||||
|
CINIT(PASSWDFUNCTION, FUNCTIONPOINT, 66),
|
||||||
|
|
||||||
|
/* Custom pointer that gets passed as first argument to the password
|
||||||
|
function */
|
||||||
|
CINIT(PASSWDDATA, OBJECTPOINT, 67),
|
||||||
|
|
||||||
|
/* Maximum number of http redirects to follow */
|
||||||
|
CINIT(MAXREDIRS, LONG, 68),
|
||||||
|
|
||||||
|
/* Pass a pointer to a time_t to get a possible date of the requested
|
||||||
|
document! Pass a NULL to shut it off. */
|
||||||
|
CINIT(FILETIME, OBJECTPOINT, 69),
|
||||||
|
|
||||||
CURLOPT_LASTENTRY /* the last unusued */
|
CURLOPT_LASTENTRY /* the last unusued */
|
||||||
} CURLoption;
|
} CURLoption;
|
||||||
|
|
||||||
#define CURL_PROGRESS_STATS 0 /* default progress display */
|
|
||||||
#define CURL_PROGRESS_BAR 1
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TIMECOND_NONE,
|
TIMECOND_NONE,
|
||||||
|
|
||||||
@@ -392,10 +421,6 @@ typedef enum {
|
|||||||
|
|
||||||
#ifdef __BEOS__
|
#ifdef __BEOS__
|
||||||
#include <support/SupportDefs.h>
|
#include <support/SupportDefs.h>
|
||||||
#else
|
|
||||||
#ifndef __cplusplus /* (rabe) */
|
|
||||||
typedef char bool;
|
|
||||||
#endif /* (rabe) */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -406,26 +431,31 @@ typedef char bool;
|
|||||||
|
|
||||||
NOTE: they return TRUE if the strings match *case insensitively*.
|
NOTE: they return TRUE if the strings match *case insensitively*.
|
||||||
*/
|
*/
|
||||||
extern int (strequal)(const char *s1, const char *s2);
|
extern int (Curl_strequal)(const char *s1, const char *s2);
|
||||||
extern int (strnequal)(const char *s1, const char *s2, size_t n);
|
extern int (Curl_strnequal)(const char *s1, const char *s2, size_t n);
|
||||||
|
#define strequal(a,b) Curl_strequal(a,b)
|
||||||
|
#define strnequal(a,b,c) Curl_strnequal(a,b,c)
|
||||||
|
|
||||||
/* external form function */
|
/* external form function */
|
||||||
int curl_formparse(char *string,
|
int curl_formparse(char *string,
|
||||||
struct HttpPost **httppost,
|
struct HttpPost **httppost,
|
||||||
struct HttpPost **last_post);
|
struct HttpPost **last_post);
|
||||||
|
|
||||||
|
/* cleanup a form: */
|
||||||
|
void curl_formfree(struct HttpPost *form);
|
||||||
|
|
||||||
/* Unix and Win32 getenv function call, this returns a malloc()'ed string that
|
/* Unix and Win32 getenv function call, this returns a malloc()'ed string that
|
||||||
MUST be free()ed after usage is complete. */
|
MUST be free()ed after usage is complete. */
|
||||||
char *curl_getenv(char *variable);
|
char *curl_getenv(char *variable);
|
||||||
|
|
||||||
/* returns ascii string of the libcurl version */
|
/* Returns a static ascii string of the libcurl version. */
|
||||||
char *curl_version(void);
|
char *curl_version(void);
|
||||||
|
|
||||||
/* This is the version number */
|
/* This is the version number */
|
||||||
#define LIBCURL_VERSION "7.2"
|
#define LIBCURL_VERSION "7.6.1-pre1"
|
||||||
#define LIBCURL_VERSION_NUM 0x070200
|
#define LIBCURL_VERSION_NUM 0x070601
|
||||||
|
|
||||||
/* linked-list structure for the CURLOPT_QUOTE option */
|
/* linked-list structure for the CURLOPT_QUOTE option (and other) */
|
||||||
struct curl_slist {
|
struct curl_slist {
|
||||||
char *data;
|
char *data;
|
||||||
struct curl_slist *next;
|
struct curl_slist *next;
|
||||||
@@ -622,4 +652,49 @@ CURLcode curl_disconnect(CURLconnect *connect);
|
|||||||
*/
|
*/
|
||||||
time_t curl_getdate(const char *p, const time_t *now);
|
time_t curl_getdate(const char *p, const time_t *now);
|
||||||
|
|
||||||
|
|
||||||
|
#define CURLINFO_STRING 0x100000
|
||||||
|
#define CURLINFO_LONG 0x200000
|
||||||
|
#define CURLINFO_DOUBLE 0x300000
|
||||||
|
#define CURLINFO_MASK 0x0fffff
|
||||||
|
#define CURLINFO_TYPEMASK 0xf00000
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CURLINFO_NONE, /* first, never use this */
|
||||||
|
CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1,
|
||||||
|
CURLINFO_HTTP_CODE = CURLINFO_LONG + 2,
|
||||||
|
CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3,
|
||||||
|
CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4,
|
||||||
|
CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5,
|
||||||
|
CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
|
||||||
|
CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7,
|
||||||
|
CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8,
|
||||||
|
CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9,
|
||||||
|
CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10,
|
||||||
|
CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11,
|
||||||
|
CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12,
|
||||||
|
CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13,
|
||||||
|
CURLINFO_FILETIME = CURLINFO_LONG + 14,
|
||||||
|
|
||||||
|
CURLINFO_LASTONE = 15
|
||||||
|
} CURLINFO;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NAME curl_getinfo()
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
*
|
||||||
|
* Request internal information from the curl session with this function.
|
||||||
|
* The third argument MUST be a pointer to a long or a pointer to a char *.
|
||||||
|
* The data pointed to will be filled in accordingly and can be relied upon
|
||||||
|
* only if the function returns CURLE_OK.
|
||||||
|
* This function is intended to get used *AFTER* a performed transfer, all
|
||||||
|
* results are undefined before the transfer is completed.
|
||||||
|
*/
|
||||||
|
CURLcode curl_getinfo(CURL *curl, CURLINFO info, ...);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __CURL_CURL_H */
|
#endif /* __CURL_CURL_H */
|
||||||
|
|||||||
@@ -7,40 +7,47 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
#ifdef __cplusplus
|
||||||
* ------------------------------------------------------------
|
extern "C" {
|
||||||
* Main author:
|
#endif
|
||||||
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.nu
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
CURL *curl_easy_init(void);
|
CURL *curl_easy_init(void);
|
||||||
CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
|
CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
|
||||||
CURLcode curl_easy_perform(CURL *curl);
|
CURLcode curl_easy_perform(CURL *curl);
|
||||||
void curl_easy_cleanup(CURL *curl);
|
void curl_easy_cleanup(CURL *curl);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NAME curl_easy_getinfo()
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
*
|
||||||
|
* Request internal information from the curl session with this function. The
|
||||||
|
* third argument MUST be a pointer to a long, a pointer to a char * or a
|
||||||
|
* pointer to a double (as the documentation describes elsewhere). The data
|
||||||
|
* pointed to will be filled in accordingly and can be relied upon only if the
|
||||||
|
* function returns CURLE_OK. This function is intended to get used *AFTER* a
|
||||||
|
* performed transfer, all results from this function are undefined until the
|
||||||
|
* transfer is completed.
|
||||||
|
*/
|
||||||
|
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,27 +2,14 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
* copyright notice and this permission notice appear in all copies.
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* the License for the specific language governing rights and limitations
|
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
|
||||||
* under the License.
|
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
|
||||||
*
|
|
||||||
* The Original Code is Triacle.
|
|
||||||
*
|
|
||||||
* The Initial Developers of the Original Code are Bjorn Reese and
|
|
||||||
* Daniel Stenberg.
|
|
||||||
*
|
|
||||||
* Portions created by Initial Developers are
|
|
||||||
*
|
|
||||||
* Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
*
|
||||||
*************************************************************************
|
*************************************************************************
|
||||||
*
|
*
|
||||||
@@ -68,26 +55,28 @@
|
|||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
int mprintf(const char *format, ...);
|
int curl_mprintf(const char *format, ...);
|
||||||
int mfprintf(FILE *fd, const char *format, ...);
|
int curl_mfprintf(FILE *fd, const char *format, ...);
|
||||||
int msprintf(char *buffer, const char *format, ...);
|
int curl_msprintf(char *buffer, const char *format, ...);
|
||||||
int msnprintf(char *buffer, size_t maxlength, const char *format, ...);
|
int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...);
|
||||||
int mvprintf(const char *format, va_list args);
|
int curl_mvprintf(const char *format, va_list args);
|
||||||
int mvfprintf(FILE *fd, const char *format, va_list args);
|
int curl_mvfprintf(FILE *fd, const char *format, va_list args);
|
||||||
int mvsprintf(char *buffer, const char *format, va_list args);
|
int curl_mvsprintf(char *buffer, const char *format, va_list args);
|
||||||
int mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args);
|
int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args);
|
||||||
char *maprintf(const char *format, ...);
|
char *curl_maprintf(const char *format, ...);
|
||||||
char *mvaprintf(const char *format, va_list args);
|
char *curl_mvaprintf(const char *format, va_list args);
|
||||||
|
|
||||||
#ifdef _MPRINTF_REPLACE
|
#ifdef _MPRINTF_REPLACE
|
||||||
# define printf mprintf
|
# define printf curl_mprintf
|
||||||
# define fprintf mfprintf
|
# define fprintf curl_mfprintf
|
||||||
# define sprintf msprintf
|
# define sprintf curl_msprintf
|
||||||
# define snprintf msnprintf
|
# define snprintf curl_msnprintf
|
||||||
# define vprintf mvprintf
|
# define vprintf curl_mvprintf
|
||||||
# define vfprintf mvfprintf
|
# define vfprintf curl_mvfprintf
|
||||||
# define vsprintf mvsprintf
|
# define vsprintf curl_mvsprintf
|
||||||
# define vsnprintf mvsnprintf
|
# define vsnprintf curl_mvsnprintf
|
||||||
|
# define aprintf curl_maprintf
|
||||||
|
# define vaprintf curl_mvaprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* H_MPRINTF */
|
#endif /* H_MPRINTF */
|
||||||
|
|||||||
@@ -7,38 +7,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.nu
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|||||||
@@ -7,38 +7,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.nu
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
typedef void CURL;
|
typedef void CURL;
|
||||||
typedef void CURLconnect;
|
typedef void CURLconnect;
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,49 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
|
EXTRA_DIST = getdate.y \
|
||||||
|
Makefile.b32 Makefile.b32.resp Makefile.m32 Makefile.vc6 \
|
||||||
|
libcurl.def dllinit.c
|
||||||
|
|
||||||
lib_LTLIBRARIES = libcurl.la
|
lib_LTLIBRARIES = libcurl.la
|
||||||
|
|
||||||
# Some flags needed when trying to cause warnings ;-)
|
# Some flags needed when trying to cause warnings ;-)
|
||||||
# CFLAGS = -g -Wall #-pedantic
|
# CFLAGS = -DMALLOCDEBUG -g # -Wall #-pedantic
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/include
|
INCLUDES = -I$(top_srcdir)/include
|
||||||
|
|
||||||
|
|
||||||
|
libcurl_la_LDFLAGS = -version-info 1:0:0
|
||||||
|
# This flag accepts an argument of the form current[:revision[:age]]. So,
|
||||||
|
# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
|
||||||
|
# 1.
|
||||||
|
#
|
||||||
|
# If either revision or age are omitted, they default to 0. Also note that age
|
||||||
|
# must be less than or equal to the current interface number.
|
||||||
|
#
|
||||||
|
# Here are a set of rules to help you update your library version information:
|
||||||
|
#
|
||||||
|
# 1.Start with version information of 0:0:0 for each libtool library.
|
||||||
|
#
|
||||||
|
# 2.Update the version information only immediately before a public release of
|
||||||
|
# your software. More frequent updates are unnecessary, and only guarantee
|
||||||
|
# that the current interface number gets larger faster.
|
||||||
|
#
|
||||||
|
# 3.If the library source code has changed at all since the last update, then
|
||||||
|
# increment revision (c:r:a becomes c:r+1:a).
|
||||||
|
#
|
||||||
|
# 4.If any interfaces have been added, removed, or changed since the last
|
||||||
|
# update, increment current, and set revision to 0.
|
||||||
|
#
|
||||||
|
# 5.If any interfaces have been added since the last public release, then
|
||||||
|
# increment age.
|
||||||
|
#
|
||||||
|
# 6.If any interfaces have been removed since the last public release, then
|
||||||
|
# set age to 0.
|
||||||
|
#
|
||||||
|
|
||||||
libcurl_la_SOURCES = \
|
libcurl_la_SOURCES = \
|
||||||
arpa_telnet.h file.c getpass.h netrc.h timeval.c \
|
arpa_telnet.h file.c getpass.h netrc.h timeval.c \
|
||||||
base64.c file.h hostip.c progress.c timeval.h \
|
base64.c file.h hostip.c progress.c timeval.h \
|
||||||
@@ -19,11 +53,14 @@ cookie.c formdata.h http.c sendf.c \
|
|||||||
cookie.h ftp.c http.h sendf.h url.c \
|
cookie.h ftp.c http.h sendf.h url.c \
|
||||||
dict.c ftp.h if2ip.c speedcheck.c url.h \
|
dict.c ftp.h if2ip.c speedcheck.c url.h \
|
||||||
dict.h getdate.c if2ip.h speedcheck.h urldata.h \
|
dict.h getdate.c if2ip.h speedcheck.h urldata.h \
|
||||||
download.c getdate.h ldap.c ssluse.c version.c \
|
getdate.h ldap.c ssluse.c version.c \
|
||||||
download.h getenv.c ldap.h ssluse.h \
|
getenv.c ldap.h ssluse.h \
|
||||||
escape.c getenv.h mprintf.c telnet.c \
|
escape.c getenv.h mprintf.c telnet.c \
|
||||||
escape.h getpass.c netrc.c telnet.h \
|
escape.h getpass.c netrc.c telnet.h \
|
||||||
writeout.c writeout.h highlevel.c strequal.c strequal.h easy.c
|
getinfo.c transfer.c strequal.c strequal.h easy.c \
|
||||||
|
security.h security.c krb4.c krb4.h memdebug.c memdebug.h inet_ntoa_r.h
|
||||||
|
|
||||||
|
noinst_HEADERS = setup.h transfer.h
|
||||||
|
|
||||||
# Say $(srcdir), so GNU make does not report an ambiguity with the .y.c rule.
|
# Say $(srcdir), so GNU make does not report an ambiguity with the .y.c rule.
|
||||||
$(srcdir)/getdate.c: getdate.y
|
$(srcdir)/getdate.c: getdate.y
|
||||||
|
|||||||
74
lib/Makefile.b32
Normal file
74
lib/Makefile.b32
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
############################################################
|
||||||
|
# Makefile.b32 - Borland's C++ Compiler 5.X
|
||||||
|
#
|
||||||
|
# 'lib' directory
|
||||||
|
#
|
||||||
|
# Requires 'Makefile.b32.resp'
|
||||||
|
#
|
||||||
|
# Written by Jaepil Kim, pit@paradise.net.nz
|
||||||
|
############################################################
|
||||||
|
|
||||||
|
# Setup environment
|
||||||
|
CXX = bcc32
|
||||||
|
RM = del
|
||||||
|
LIB = tlib
|
||||||
|
TOPDIR = ..
|
||||||
|
CURNTDIR = .
|
||||||
|
CXXFLAGS = -5 -O2 -w-aus -w-ccc -w-csu -w-par -w-pia -w-rch -w-inl -w-ngu -w-pro
|
||||||
|
DEFINES = -DLIBCURL_BIGENDIAN=0 -DNDEBUG -DWIN32 -DCONSOLE -DMBCS
|
||||||
|
INCDIRS = -I$(CURNTDIR);$(TOPDIR)/include/
|
||||||
|
|
||||||
|
# 'BCCDIR' has to be set up in your c:\autoexec.bat
|
||||||
|
# i.e. SET BCCDIR = c:\Borland\BCC55
|
||||||
|
# where c:\Borland\BCC55 is the compiler is installed
|
||||||
|
LINKLIB = $(BCCDIR)/lib/psdk/wsock32.lib
|
||||||
|
LIBCURLLIB = libcurl.lib
|
||||||
|
|
||||||
|
.SUFFIXES: .c
|
||||||
|
|
||||||
|
SOURCES = \
|
||||||
|
base64.c \
|
||||||
|
cookie.c \
|
||||||
|
transfer.c \
|
||||||
|
escape.c \
|
||||||
|
formdata.c \
|
||||||
|
ftp.c \
|
||||||
|
http.c \
|
||||||
|
ldap.c \
|
||||||
|
dict.c \
|
||||||
|
telnet.c \
|
||||||
|
getdate.c \
|
||||||
|
getenv.c \
|
||||||
|
getpass.c \
|
||||||
|
hostip.c \
|
||||||
|
if2ip.c \
|
||||||
|
mprintf.c \
|
||||||
|
netrc.c \
|
||||||
|
progress.c \
|
||||||
|
sendf.c \
|
||||||
|
speedcheck.c \
|
||||||
|
ssluse.c \
|
||||||
|
timeval.c \
|
||||||
|
url.c \
|
||||||
|
file.c \
|
||||||
|
getinfo.c \
|
||||||
|
version.c \
|
||||||
|
easy.c \
|
||||||
|
strequal.c
|
||||||
|
|
||||||
|
OBJECTS = $(SOURCES:.c=.obj)
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
$(CXX) -c $(INCDIRS) $(CXXFLAGS) $(DEFINES) $<
|
||||||
|
|
||||||
|
all: $(LIBCURLLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(LIBCURLLIB)
|
||||||
|
$(RM) *.obj
|
||||||
|
|
||||||
|
$(LIBCURLLIB): $(LINKLIB) $(OBJECTS) Makefile.b32.resp
|
||||||
|
$(RM) $(LIBCURLLIB)
|
||||||
|
$(LIB) $(LIBCURLLIB) @Makefile.b32.resp
|
||||||
|
|
||||||
|
|
||||||
28
lib/Makefile.b32.resp
Normal file
28
lib/Makefile.b32.resp
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
+base64.obj &
|
||||||
|
+cookie.obj &
|
||||||
|
+transfer.obj &
|
||||||
|
+escape.obj &
|
||||||
|
+formdata.obj &
|
||||||
|
+ftp.obj &
|
||||||
|
+http.obj &
|
||||||
|
+ldap.obj &
|
||||||
|
+dict.obj &
|
||||||
|
+telnet.obj &
|
||||||
|
+getdate.obj &
|
||||||
|
+getenv.obj &
|
||||||
|
+getpass.obj &
|
||||||
|
+hostip.obj &
|
||||||
|
+if2ip.obj &
|
||||||
|
+mprintf.obj &
|
||||||
|
+netrc.obj &
|
||||||
|
+progress.obj &
|
||||||
|
+sendf.obj &
|
||||||
|
+speedcheck.obj &
|
||||||
|
+ssluse.obj &
|
||||||
|
+timeval.obj &
|
||||||
|
+url.obj &
|
||||||
|
+file.obj &
|
||||||
|
+getinfo.obj &
|
||||||
|
+version.obj &
|
||||||
|
+easy.obj &
|
||||||
|
+strequal.obj
|
||||||
329
lib/Makefile.in
329
lib/Makefile.in
@@ -1,329 +0,0 @@
|
|||||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
|
||||||
|
|
||||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
|
||||||
# with or without modifications, as long as this notice is preserved.
|
|
||||||
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
|
||||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
||||||
# PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
#
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
SHELL = @SHELL@
|
|
||||||
|
|
||||||
srcdir = @srcdir@
|
|
||||||
top_srcdir = @top_srcdir@
|
|
||||||
VPATH = @srcdir@
|
|
||||||
prefix = @prefix@
|
|
||||||
exec_prefix = @exec_prefix@
|
|
||||||
|
|
||||||
bindir = @bindir@
|
|
||||||
sbindir = @sbindir@
|
|
||||||
libexecdir = @libexecdir@
|
|
||||||
datadir = @datadir@
|
|
||||||
sysconfdir = @sysconfdir@
|
|
||||||
sharedstatedir = @sharedstatedir@
|
|
||||||
localstatedir = @localstatedir@
|
|
||||||
libdir = @libdir@
|
|
||||||
infodir = @infodir@
|
|
||||||
mandir = @mandir@
|
|
||||||
includedir = @includedir@
|
|
||||||
oldincludedir = /usr/include
|
|
||||||
|
|
||||||
DESTDIR =
|
|
||||||
|
|
||||||
pkgdatadir = $(datadir)/@PACKAGE@
|
|
||||||
pkglibdir = $(libdir)/@PACKAGE@
|
|
||||||
pkgincludedir = $(includedir)/@PACKAGE@
|
|
||||||
|
|
||||||
top_builddir = ..
|
|
||||||
|
|
||||||
ACLOCAL = @ACLOCAL@
|
|
||||||
AUTOCONF = @AUTOCONF@
|
|
||||||
AUTOMAKE = @AUTOMAKE@
|
|
||||||
AUTOHEADER = @AUTOHEADER@
|
|
||||||
|
|
||||||
INSTALL = @INSTALL@
|
|
||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
|
||||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
|
||||||
transform = @program_transform_name@
|
|
||||||
|
|
||||||
NORMAL_INSTALL = :
|
|
||||||
PRE_INSTALL = :
|
|
||||||
POST_INSTALL = :
|
|
||||||
NORMAL_UNINSTALL = :
|
|
||||||
PRE_UNINSTALL = :
|
|
||||||
POST_UNINSTALL = :
|
|
||||||
host_alias = @host_alias@
|
|
||||||
host_triplet = @host@
|
|
||||||
AS = @AS@
|
|
||||||
CC = @CC@
|
|
||||||
DLLTOOL = @DLLTOOL@
|
|
||||||
LIBTOOL = @LIBTOOL@
|
|
||||||
LN_S = @LN_S@
|
|
||||||
MAKEINFO = @MAKEINFO@
|
|
||||||
NROFF = @NROFF@
|
|
||||||
OBJDUMP = @OBJDUMP@
|
|
||||||
PACKAGE = @PACKAGE@
|
|
||||||
PERL = @PERL@
|
|
||||||
RANLIB = @RANLIB@
|
|
||||||
VERSION = @VERSION@
|
|
||||||
YACC = @YACC@
|
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libcurl.la
|
|
||||||
|
|
||||||
# Some flags needed when trying to cause warnings ;-)
|
|
||||||
# CFLAGS = -g -Wall #-pedantic
|
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/include
|
|
||||||
|
|
||||||
libcurl_la_SOURCES = arpa_telnet.h file.c getpass.h netrc.h timeval.c base64.c file.h hostip.c progress.c timeval.h base64.h formdata.c hostip.h progress.h cookie.c formdata.h http.c sendf.c cookie.h ftp.c http.h sendf.h url.c dict.c ftp.h if2ip.c speedcheck.c url.h dict.h getdate.c if2ip.h speedcheck.h urldata.h download.c getdate.h ldap.c ssluse.c version.c download.h getenv.c ldap.h ssluse.h escape.c getenv.h mprintf.c telnet.c escape.h getpass.c netrc.c telnet.h writeout.c writeout.h highlevel.c strequal.c strequal.h easy.c
|
|
||||||
|
|
||||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
|
||||||
CONFIG_HEADER = ../config.h ../src/config.h
|
|
||||||
CONFIG_CLEAN_FILES =
|
|
||||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
|
||||||
|
|
||||||
|
|
||||||
DEFS = @DEFS@ -I. -I$(srcdir) -I.. -I../src
|
|
||||||
CPPFLAGS = @CPPFLAGS@
|
|
||||||
LDFLAGS = @LDFLAGS@
|
|
||||||
LIBS = @LIBS@
|
|
||||||
libcurl_la_LDFLAGS =
|
|
||||||
libcurl_la_LIBADD =
|
|
||||||
libcurl_la_OBJECTS = file.lo timeval.lo base64.lo hostip.lo progress.lo \
|
|
||||||
formdata.lo cookie.lo http.lo sendf.lo ftp.lo url.lo dict.lo if2ip.lo \
|
|
||||||
speedcheck.lo getdate.lo download.lo ldap.lo ssluse.lo version.lo \
|
|
||||||
getenv.lo escape.lo mprintf.lo telnet.lo getpass.lo netrc.lo \
|
|
||||||
writeout.lo highlevel.lo strequal.lo easy.lo
|
|
||||||
CFLAGS = @CFLAGS@
|
|
||||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
|
||||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
|
||||||
CCLD = $(CC)
|
|
||||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
|
||||||
DIST_COMMON = Makefile.am Makefile.in
|
|
||||||
|
|
||||||
|
|
||||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
|
||||||
|
|
||||||
TAR = gtar
|
|
||||||
GZIP_ENV = --best
|
|
||||||
SOURCES = $(libcurl_la_SOURCES)
|
|
||||||
OBJECTS = $(libcurl_la_OBJECTS)
|
|
||||||
|
|
||||||
all: all-redirect
|
|
||||||
.SUFFIXES:
|
|
||||||
.SUFFIXES: .S .c .lo .o .s
|
|
||||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
|
||||||
cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps lib/Makefile
|
|
||||||
|
|
||||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
|
||||||
cd $(top_builddir) \
|
|
||||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
|
||||||
|
|
||||||
|
|
||||||
mostlyclean-libLTLIBRARIES:
|
|
||||||
|
|
||||||
clean-libLTLIBRARIES:
|
|
||||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
|
||||||
|
|
||||||
distclean-libLTLIBRARIES:
|
|
||||||
|
|
||||||
maintainer-clean-libLTLIBRARIES:
|
|
||||||
|
|
||||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
|
||||||
@$(NORMAL_INSTALL)
|
|
||||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
|
||||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
|
||||||
if test -f $$p; then \
|
|
||||||
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
|
|
||||||
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
|
|
||||||
else :; fi; \
|
|
||||||
done
|
|
||||||
|
|
||||||
uninstall-libLTLIBRARIES:
|
|
||||||
@$(NORMAL_UNINSTALL)
|
|
||||||
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
|
||||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
|
|
||||||
done
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(COMPILE) -c $<
|
|
||||||
|
|
||||||
.s.o:
|
|
||||||
$(COMPILE) -c $<
|
|
||||||
|
|
||||||
.S.o:
|
|
||||||
$(COMPILE) -c $<
|
|
||||||
|
|
||||||
mostlyclean-compile:
|
|
||||||
-rm -f *.o core *.core
|
|
||||||
|
|
||||||
clean-compile:
|
|
||||||
|
|
||||||
distclean-compile:
|
|
||||||
-rm -f *.tab.c
|
|
||||||
|
|
||||||
maintainer-clean-compile:
|
|
||||||
|
|
||||||
.c.lo:
|
|
||||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
|
||||||
|
|
||||||
.s.lo:
|
|
||||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
|
||||||
|
|
||||||
.S.lo:
|
|
||||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
|
||||||
|
|
||||||
mostlyclean-libtool:
|
|
||||||
-rm -f *.lo
|
|
||||||
|
|
||||||
clean-libtool:
|
|
||||||
-rm -rf .libs _libs
|
|
||||||
|
|
||||||
distclean-libtool:
|
|
||||||
|
|
||||||
maintainer-clean-libtool:
|
|
||||||
|
|
||||||
libcurl.la: $(libcurl_la_OBJECTS) $(libcurl_la_DEPENDENCIES)
|
|
||||||
$(LINK) -rpath $(libdir) $(libcurl_la_LDFLAGS) $(libcurl_la_OBJECTS) $(libcurl_la_LIBADD) $(LIBS)
|
|
||||||
|
|
||||||
tags: TAGS
|
|
||||||
|
|
||||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
|
||||||
list='$(SOURCES) $(HEADERS)'; \
|
|
||||||
unique=`for i in $$list; do echo $$i; done | \
|
|
||||||
awk ' { files[$$0] = 1; } \
|
|
||||||
END { for (i in files) print i; }'`; \
|
|
||||||
here=`pwd` && cd $(srcdir) \
|
|
||||||
&& mkid -f$$here/ID $$unique $(LISP)
|
|
||||||
|
|
||||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
|
||||||
tags=; \
|
|
||||||
here=`pwd`; \
|
|
||||||
list='$(SOURCES) $(HEADERS)'; \
|
|
||||||
unique=`for i in $$list; do echo $$i; done | \
|
|
||||||
awk ' { files[$$0] = 1; } \
|
|
||||||
END { for (i in files) print i; }'`; \
|
|
||||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
|
||||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
|
||||||
|
|
||||||
mostlyclean-tags:
|
|
||||||
|
|
||||||
clean-tags:
|
|
||||||
|
|
||||||
distclean-tags:
|
|
||||||
-rm -f TAGS ID
|
|
||||||
|
|
||||||
maintainer-clean-tags:
|
|
||||||
|
|
||||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
|
||||||
|
|
||||||
subdir = lib
|
|
||||||
|
|
||||||
distdir: $(DISTFILES)
|
|
||||||
@for file in $(DISTFILES); do \
|
|
||||||
d=$(srcdir); \
|
|
||||||
if test -d $$d/$$file; then \
|
|
||||||
cp -pr $$/$$file $(distdir)/$$file; \
|
|
||||||
else \
|
|
||||||
test -f $(distdir)/$$file \
|
|
||||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
|
||||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
info-am:
|
|
||||||
info: info-am
|
|
||||||
dvi-am:
|
|
||||||
dvi: dvi-am
|
|
||||||
check-am: all-am
|
|
||||||
check: check-am
|
|
||||||
installcheck-am:
|
|
||||||
installcheck: installcheck-am
|
|
||||||
install-exec-am: install-libLTLIBRARIES
|
|
||||||
install-exec: install-exec-am
|
|
||||||
|
|
||||||
install-data-am:
|
|
||||||
install-data: install-data-am
|
|
||||||
|
|
||||||
install-am: all-am
|
|
||||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
|
||||||
install: install-am
|
|
||||||
uninstall-am: uninstall-libLTLIBRARIES
|
|
||||||
uninstall: uninstall-am
|
|
||||||
all-am: Makefile $(LTLIBRARIES)
|
|
||||||
all-redirect: all-am
|
|
||||||
install-strip:
|
|
||||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
|
||||||
installdirs:
|
|
||||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
|
||||||
|
|
||||||
|
|
||||||
mostlyclean-generic:
|
|
||||||
|
|
||||||
clean-generic:
|
|
||||||
|
|
||||||
distclean-generic:
|
|
||||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
|
||||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
|
||||||
|
|
||||||
maintainer-clean-generic:
|
|
||||||
mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
|
|
||||||
mostlyclean-libtool mostlyclean-tags \
|
|
||||||
mostlyclean-generic
|
|
||||||
|
|
||||||
mostlyclean: mostlyclean-am
|
|
||||||
|
|
||||||
clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \
|
|
||||||
clean-generic mostlyclean-am
|
|
||||||
|
|
||||||
clean: clean-am
|
|
||||||
|
|
||||||
distclean-am: distclean-libLTLIBRARIES distclean-compile \
|
|
||||||
distclean-libtool distclean-tags distclean-generic \
|
|
||||||
clean-am
|
|
||||||
-rm -f libtool
|
|
||||||
|
|
||||||
distclean: distclean-am
|
|
||||||
|
|
||||||
maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
|
|
||||||
maintainer-clean-compile maintainer-clean-libtool \
|
|
||||||
maintainer-clean-tags maintainer-clean-generic \
|
|
||||||
distclean-am
|
|
||||||
@echo "This command is intended for maintainers to use;"
|
|
||||||
@echo "it deletes files that may require special tools to rebuild."
|
|
||||||
|
|
||||||
maintainer-clean: maintainer-clean-am
|
|
||||||
|
|
||||||
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
|
|
||||||
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
|
|
||||||
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
|
|
||||||
distclean-compile clean-compile maintainer-clean-compile \
|
|
||||||
mostlyclean-libtool distclean-libtool clean-libtool \
|
|
||||||
maintainer-clean-libtool tags mostlyclean-tags distclean-tags \
|
|
||||||
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
|
|
||||||
check-am installcheck-am installcheck install-exec-am install-exec \
|
|
||||||
install-data-am install-data install-am install uninstall-am uninstall \
|
|
||||||
all-redirect all-am all installdirs mostlyclean-generic \
|
|
||||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
|
||||||
mostlyclean distclean maintainer-clean
|
|
||||||
|
|
||||||
|
|
||||||
# Say $(srcdir), so GNU make does not report an ambiguity with the .y.c rule.
|
|
||||||
$(srcdir)/getdate.c: getdate.y
|
|
||||||
cd $(srcdir) && \
|
|
||||||
$(YACC) $(YFLAGS) getdate.y; \
|
|
||||||
mv -f y.tab.c getdate.c
|
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
|
||||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
|
||||||
.NOEXPORT:
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#############################################################
|
#############################################################
|
||||||
## Makefile for building libcurl.a with MingW32 (GCC-2.95) and
|
## Makefile for building libcurl.a with MingW32 (GCC-2.95) and
|
||||||
## optionally OpenSSL (0.9.4)
|
## optionally OpenSSL (0.9.6)
|
||||||
## Use: make -f Makefile.m32
|
## Use: make -f Makefile.m32
|
||||||
##
|
##
|
||||||
## Comments to: Troy Engel <tengel@sonic.net> or
|
## Comments to: Troy Engel <tengel@sonic.net> or
|
||||||
@@ -9,48 +9,59 @@
|
|||||||
CC = gcc
|
CC = gcc
|
||||||
AR = ar
|
AR = ar
|
||||||
RANLIB = ranlib
|
RANLIB = ranlib
|
||||||
OPENSSL_PATH = ../../openssl-0.9.5a
|
STRIP = strip -g
|
||||||
|
OPENSSL_PATH = ../../openssl-0.9.6
|
||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
## Nothing more to do below this line!
|
## Nothing more to do below this line!
|
||||||
|
|
||||||
INCLUDES = -I. -I.. -I../include
|
INCLUDES = -I. -I.. -I../include -I../src
|
||||||
CFLAGS = -g -O2 -DMINGW32
|
CFLAGS = -g -O2 -DMINGW32
|
||||||
ifdef SSL
|
ifdef SSL
|
||||||
INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl"
|
INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl"
|
||||||
CFLAGS += -DUSE_SSLEAY
|
CFLAGS += -DUSE_SSLEAY
|
||||||
|
DLL_LIBS = -leay32 -lssl32 -lRSAglue
|
||||||
endif
|
endif
|
||||||
COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
|
COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
|
||||||
|
|
||||||
libcurl_a_LIBRARIES = libcurl.a
|
libcurl_a_LIBRARIES = libcurl.a
|
||||||
|
|
||||||
libcurl_a_SOURCES = base64.c getenv.c if2ip.h progress.h \
|
libcurl_a_SOURCES = arpa_telnet.h file.c getpass.h netrc.h timeval.c base64.c \
|
||||||
base64.h getenv.h mprintf.c setup.h url.c download.c getpass.c \
|
file.h hostip.c progress.c timeval.h base64.h formdata.c hostip.h progress.h \
|
||||||
mprintf.h ssluse.c url.h download.h hostip.c netrc.c ssluse.h \
|
cookie.c formdata.h http.c sendf.c cookie.h ftp.c http.h sendf.h url.c dict.c \
|
||||||
urldata.h formdata.c hostip.h netrc.h stdcheaders.h formdata.h \
|
ftp.h if2ip.c speedcheck.c url.h dict.h getdate.c if2ip.h speedcheck.h \
|
||||||
if2ip.c progress.c sendf.c sendf.h speedcheck.c speedcheck.h \
|
urldata.h transfer.c getdate.h ldap.c ssluse.c version.c transfer.h getenv.c \
|
||||||
ftp.c ftp.h getpass.h version.c timeval.c timeval.h cookie.c \
|
ldap.h ssluse.h escape.c getenv.h mprintf.c telnet.c escape.h getpass.c netrc.c \
|
||||||
cookie.h escape.c escape.h getdate.c getdate.h dict.h dict.c http.c \
|
telnet.h getinfo.c strequal.c strequal.h easy.c security.h \
|
||||||
http.h telnet.c telnet.h file.c file.h ldap.c ldap.h writeout.c writeout.h \
|
security.c krb4.c
|
||||||
highlevel.c strequal.c strequal.h easy.c
|
|
||||||
|
|
||||||
libcurl_a_OBJECTS = base64.o getenv.o mprintf.o url.o download.o \
|
libcurl_a_OBJECTS = file.o timeval.o base64.o hostip.o progress.o \
|
||||||
getpass.o ssluse.o hostip.o netrc.o formdata.o if2ip.o progress.o \
|
formdata.o cookie.o http.o sendf.o ftp.o url.o dict.o if2ip.o \
|
||||||
sendf.o speedcheck.o ftp.o version.o timeval.o \
|
speedcheck.o getdate.o transfer.o ldap.o ssluse.o version.o \
|
||||||
cookie.o escape.o getdate.o dict.o http.o telnet.o file.o ldap.o writeout.o \
|
getenv.o escape.o mprintf.o telnet.o getpass.o netrc.o getinfo.o \
|
||||||
highlevel.o strequal.o easy.o
|
strequal.o easy.o security.o krb4.o
|
||||||
|
|
||||||
LIBRARIES = $(libcurl_a_LIBRARIES)
|
LIBRARIES = $(libcurl_a_LIBRARIES)
|
||||||
SOURCES = $(libcurl_a_SOURCES)
|
SOURCES = $(libcurl_a_SOURCES)
|
||||||
OBJECTS = $(libcurl_a_OBJECTS)
|
OBJECTS = $(libcurl_a_OBJECTS)
|
||||||
|
|
||||||
|
|
||||||
all: libcurl.a
|
all: libcurl.a libcurl.dll libcurldll.a
|
||||||
|
|
||||||
libcurl.a: $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
|
libcurl.a: $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
|
||||||
-@erase libcurl.a
|
-@erase libcurl.a
|
||||||
$(AR) cru libcurl.a $(libcurl_a_OBJECTS)
|
$(AR) cru libcurl.a $(libcurl_a_OBJECTS)
|
||||||
$(RANLIB) libcurl.a
|
$(RANLIB) libcurl.a
|
||||||
|
$(STRIP) $@
|
||||||
|
|
||||||
|
# remove the last line above to keep debug info
|
||||||
|
|
||||||
|
libcurl.dll libcurldll.a: libcurl.a libcurl.def dllinit.o
|
||||||
|
-@erase $@
|
||||||
|
dllwrap --dllname $@ --output-lib libcurldll.a --export-all --def libcurl.def $(libcurl_a_LIBRARIES) dllinit.o -L$(OPENSSL_PATH)/out $(DLL_LIBS) -lwsock32
|
||||||
|
$(STRIP) $@
|
||||||
|
|
||||||
|
# remove the last line above to keep debug info
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(COMPILE) -c $<
|
$(COMPILE) -c $<
|
||||||
|
|||||||
@@ -4,34 +4,36 @@
|
|||||||
## (default is release)
|
## (default is release)
|
||||||
##
|
##
|
||||||
## Comments to: Troy Engel <tengel@sonic.net>
|
## Comments to: Troy Engel <tengel@sonic.net>
|
||||||
|
## Updated by: Craig Davison <cd@securityfocus.com>
|
||||||
|
|
||||||
PROGRAM_NAME = libcurl.lib
|
PROGRAM_NAME = libcurl.lib
|
||||||
OPENSSL_PATH = ../../openssl-0.9.3a
|
PROGRAM_NAME_DEBUG = libcurld.lib
|
||||||
|
OPENSSL_PATH = ../../openssl-0.9.6
|
||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
## Nothing more to do below this line!
|
## Nothing more to do below this line!
|
||||||
|
|
||||||
## Release
|
## Release
|
||||||
CCR = cl.exe /ML /O2 /D "NDEBUG"
|
CCR = cl.exe /MD /O2 /D "NDEBUG"
|
||||||
LINKR = link.exe -lib
|
LINKR = link.exe -lib /out:$(PROGRAM_NAME)
|
||||||
|
|
||||||
## Debug
|
## Debug
|
||||||
CCD = cl.exe /MLd /Gm /ZI /Od /D "_DEBUG" /GZ
|
CCD = cl.exe /MDd /Gm /ZI /Od /D "_DEBUG" /GZ
|
||||||
LINKD = link.exe -lib
|
LINKD = link.exe -lib /out:$(PROGRAM_NAME_DEBUG)
|
||||||
|
|
||||||
## SSL Release
|
## SSL Release
|
||||||
CCRS = cl.exe /ML /O2 /D "NDEBUG" /D "USE_SSLEAY" /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
|
CCRS = cl.exe /MD /O2 /D "NDEBUG" /D "USE_SSLEAY" /I "$(OPENSSL_PATH)/include" /I "$(OPENSSL_PATH)/include/openssl"
|
||||||
LINKRS = link.exe -lib /LIBPATH:$(OPENSSL_PATH)/out32dll
|
LINKRS = link.exe -lib /out:$(PROGRAM_NAME) /LIBPATH:$(OPENSSL_PATH)/out32dll
|
||||||
|
|
||||||
CFLAGS = /I "../include" /nologo /W3 /GX /D "WIN32" /D "VC6" /D "_MBCS" /D "_LIB" /YX /FD /c /D "MSDOS"
|
CFLAGS = /I "../include" /nologo /W3 /GX /D "WIN32" /D "VC6" /D "_MBCS" /D "_LIB" /YX /FD /c /D "MSDOS"
|
||||||
LFLAGS = /nologo /out:$(PROGRAM_NAME)
|
LFLAGS = /nologo
|
||||||
LINKLIBS = kernel32.lib wsock32.lib
|
LINKLIBS = wsock32.lib
|
||||||
LINKSLIBS = libeay32.lib ssleay32.lib RSAglue.lib
|
LINKSLIBS = libeay32.lib ssleay32.lib RSAglue.lib
|
||||||
|
|
||||||
RELEASE_OBJS= \
|
RELEASE_OBJS= \
|
||||||
base64r.obj \
|
base64r.obj \
|
||||||
cookier.obj \
|
cookier.obj \
|
||||||
downloadr.obj \
|
transferr.obj \
|
||||||
escaper.obj \
|
escaper.obj \
|
||||||
formdatar.obj \
|
formdatar.obj \
|
||||||
ftpr.obj \
|
ftpr.obj \
|
||||||
@@ -53,16 +55,15 @@ RELEASE_OBJS= \
|
|||||||
timevalr.obj \
|
timevalr.obj \
|
||||||
urlr.obj \
|
urlr.obj \
|
||||||
filer.obj \
|
filer.obj \
|
||||||
writeoutr.obj \
|
getinfor.obj \
|
||||||
versionr.obj \
|
versionr.obj \
|
||||||
easyr.obj \
|
easyr.obj \
|
||||||
highlevelr.obj \
|
|
||||||
strequalr.obj
|
strequalr.obj
|
||||||
|
|
||||||
DEBUG_OBJS= \
|
DEBUG_OBJS= \
|
||||||
base64d.obj \
|
base64d.obj \
|
||||||
cookied.obj \
|
cookied.obj \
|
||||||
downloadd.obj \
|
transferd.obj \
|
||||||
escaped.obj \
|
escaped.obj \
|
||||||
formdatad.obj \
|
formdatad.obj \
|
||||||
ftpd.obj \
|
ftpd.obj \
|
||||||
@@ -84,16 +85,15 @@ DEBUG_OBJS= \
|
|||||||
timevald.obj \
|
timevald.obj \
|
||||||
urld.obj \
|
urld.obj \
|
||||||
filed.obj \
|
filed.obj \
|
||||||
writeoutd.obj \
|
getinfod.obj \
|
||||||
versiond.obj \
|
versiond.obj \
|
||||||
easyd.obj \
|
easyd.obj \
|
||||||
highleveld.obj \
|
|
||||||
strequald.obj
|
strequald.obj
|
||||||
|
|
||||||
RELEASE_SSL_OBJS= \
|
RELEASE_SSL_OBJS= \
|
||||||
base64rs.obj \
|
base64rs.obj \
|
||||||
cookiers.obj \
|
cookiers.obj \
|
||||||
downloadrs.obj \
|
transferrs.obj \
|
||||||
escapers.obj \
|
escapers.obj \
|
||||||
formdatars.obj \
|
formdatars.obj \
|
||||||
ftprs.obj \
|
ftprs.obj \
|
||||||
@@ -115,16 +115,15 @@ RELEASE_SSL_OBJS= \
|
|||||||
timevalrs.obj \
|
timevalrs.obj \
|
||||||
urlrs.obj \
|
urlrs.obj \
|
||||||
filers.obj \
|
filers.obj \
|
||||||
writeouts.obj \
|
getinfors.obj \
|
||||||
versionrs.obj \
|
versionrs.obj \
|
||||||
easyrs.obj \
|
easyrs.obj \
|
||||||
highlevelrs.obj \
|
|
||||||
strequalrs.obj
|
strequalrs.obj
|
||||||
|
|
||||||
LINK_OBJS= \
|
LINK_OBJS= \
|
||||||
base64.obj \
|
base64.obj \
|
||||||
cookie.obj \
|
cookie.obj \
|
||||||
download.obj \
|
transfer.obj \
|
||||||
escape.obj \
|
escape.obj \
|
||||||
formdata.obj \
|
formdata.obj \
|
||||||
ftp.obj \
|
ftp.obj \
|
||||||
@@ -146,10 +145,9 @@ LINK_OBJS= \
|
|||||||
timeval.obj \
|
timeval.obj \
|
||||||
url.obj \
|
url.obj \
|
||||||
file.obj \
|
file.obj \
|
||||||
writeout.obj \
|
getinfo.obj \
|
||||||
version.obj \
|
version.obj \
|
||||||
easy.obj \
|
easy.obj \
|
||||||
highlevel.obj \
|
|
||||||
strequal.obj
|
strequal.obj
|
||||||
|
|
||||||
all : release
|
all : release
|
||||||
@@ -163,14 +161,13 @@ debug: $(DEBUG_OBJS)
|
|||||||
release-ssl: $(RELEASE_SSL_OBJS)
|
release-ssl: $(RELEASE_SSL_OBJS)
|
||||||
$(LINKRS) $(LFLAGS) $(LINKLIBS) $(LINKSLIBS) $(LINK_OBJS)
|
$(LINKRS) $(LFLAGS) $(LINKLIBS) $(LINKSLIBS) $(LINK_OBJS)
|
||||||
|
|
||||||
|
|
||||||
## Release
|
## Release
|
||||||
base64r.obj: base64.c
|
base64r.obj: base64.c
|
||||||
$(CCR) $(CFLAGS) base64.c
|
$(CCR) $(CFLAGS) base64.c
|
||||||
cookier.obj: cookie.c
|
cookier.obj: cookie.c
|
||||||
$(CCR) $(CFLAGS) cookie.c
|
$(CCR) $(CFLAGS) cookie.c
|
||||||
downloadr.obj: download.c
|
transferr.obj: transfer.c
|
||||||
$(CCR) $(CFLAGS) download.c
|
$(CCR) $(CFLAGS) transfer.c
|
||||||
escaper.obj: escape.c
|
escaper.obj: escape.c
|
||||||
$(CCR) $(CFLAGS) escape.c
|
$(CCR) $(CFLAGS) escape.c
|
||||||
formdatar.obj: formdata.c
|
formdatar.obj: formdata.c
|
||||||
@@ -213,14 +210,12 @@ urlr.obj: url.c
|
|||||||
$(CCR) $(CFLAGS) url.c
|
$(CCR) $(CFLAGS) url.c
|
||||||
filer.obj: file.c
|
filer.obj: file.c
|
||||||
$(CCR) $(CFLAGS) file.c
|
$(CCR) $(CFLAGS) file.c
|
||||||
writeoutr.obj: writeout.c
|
getinfor.obj: getinfo.c
|
||||||
$(CCR) $(CFLAGS) writeout.c
|
$(CCR) $(CFLAGS) getinfo.c
|
||||||
versionr.obj: version.c
|
versionr.obj: version.c
|
||||||
$(CCR) $(CFLAGS) version.c
|
$(CCR) $(CFLAGS) version.c
|
||||||
easyr.obj: easy.c
|
easyr.obj: easy.c
|
||||||
$(CCR) $(CFLAGS) easy.c
|
$(CCR) $(CFLAGS) easy.c
|
||||||
highlevelr.obj: highlevel.c
|
|
||||||
$(CCR) $(CFLAGS) highlevel.c
|
|
||||||
strequalr.obj: strequal.c
|
strequalr.obj: strequal.c
|
||||||
$(CCR) $(CFLAGS) strequal.c
|
$(CCR) $(CFLAGS) strequal.c
|
||||||
|
|
||||||
@@ -229,8 +224,8 @@ base64d.obj: base64.c
|
|||||||
$(CCD) $(CFLAGS) base64.c
|
$(CCD) $(CFLAGS) base64.c
|
||||||
cookied.obj: cookie.c
|
cookied.obj: cookie.c
|
||||||
$(CCD) $(CFLAGS) cookie.c
|
$(CCD) $(CFLAGS) cookie.c
|
||||||
downloadd.obj: download.c
|
transferd.obj: transfer.c
|
||||||
$(CCD) $(CFLAGS) download.c
|
$(CCD) $(CFLAGS) transfer.c
|
||||||
escaped.obj: escape.c
|
escaped.obj: escape.c
|
||||||
$(CCD) $(CFLAGS) escape.c
|
$(CCD) $(CFLAGS) escape.c
|
||||||
formdatad.obj: formdata.c
|
formdatad.obj: formdata.c
|
||||||
@@ -240,7 +235,7 @@ ftpd.obj: ftp.c
|
|||||||
httpd.obj: http.c
|
httpd.obj: http.c
|
||||||
$(CCD) $(CFLAGS) http.c
|
$(CCD) $(CFLAGS) http.c
|
||||||
ldapd.obj: ldap.c
|
ldapd.obj: ldap.c
|
||||||
$(CCR) $(CFLAGS) ldap.c
|
$(CCD) $(CFLAGS) ldap.c
|
||||||
dictd.obj: dict.c
|
dictd.obj: dict.c
|
||||||
$(CCD) $(CFLAGS) dict.c
|
$(CCD) $(CFLAGS) dict.c
|
||||||
telnetd.obj: telnet.c
|
telnetd.obj: telnet.c
|
||||||
@@ -273,16 +268,14 @@ urld.obj: url.c
|
|||||||
$(CCD) $(CFLAGS) url.c
|
$(CCD) $(CFLAGS) url.c
|
||||||
filed.obj: file.c
|
filed.obj: file.c
|
||||||
$(CCD) $(CFLAGS) file.c
|
$(CCD) $(CFLAGS) file.c
|
||||||
writeoutd.obj: writeout.c
|
getinfod.obj: getinfo.c
|
||||||
$(CCR) $(CFLAGS) writeout.c
|
$(CCD) $(CFLAGS) getinfo.c
|
||||||
versiond.obj: version.c
|
versiond.obj: version.c
|
||||||
$(CCD) $(CFLAGS) version.c
|
$(CCD) $(CFLAGS) version.c
|
||||||
easyd.obj: easy.c
|
easyd.obj: easy.c
|
||||||
$(CCR) $(CFLAGS) easy.c
|
$(CCD) $(CFLAGS) easy.c
|
||||||
highleveld.obj: highlevel.c
|
|
||||||
$(CCR) $(CFLAGS) highlevel.c
|
|
||||||
strequald.obj: strequal.c
|
strequald.obj: strequal.c
|
||||||
$(CCR) $(CFLAGS) strequal.c
|
$(CCD) $(CFLAGS) strequal.c
|
||||||
|
|
||||||
|
|
||||||
## Release SSL
|
## Release SSL
|
||||||
@@ -290,8 +283,8 @@ base64rs.obj: base64.c
|
|||||||
$(CCRS) $(CFLAGS) base64.c
|
$(CCRS) $(CFLAGS) base64.c
|
||||||
cookiers.obj: cookie.c
|
cookiers.obj: cookie.c
|
||||||
$(CCRS) $(CFLAGS) cookie.c
|
$(CCRS) $(CFLAGS) cookie.c
|
||||||
downloadrs.obj: download.c
|
transferrs.obj: transfer.c
|
||||||
$(CCRS) $(CFLAGS) download.c
|
$(CCRS) $(CFLAGS) transfer.c
|
||||||
escapers.obj: escape.c
|
escapers.obj: escape.c
|
||||||
$(CCRS) $(CFLAGS) escape.c
|
$(CCRS) $(CFLAGS) escape.c
|
||||||
formdatars.obj: formdata.c
|
formdatars.obj: formdata.c
|
||||||
@@ -301,7 +294,7 @@ ftprs.obj: ftp.c
|
|||||||
httprs.obj: http.c
|
httprs.obj: http.c
|
||||||
$(CCRS) $(CFLAGS) http.c
|
$(CCRS) $(CFLAGS) http.c
|
||||||
ldaprs.obj: ldap.c
|
ldaprs.obj: ldap.c
|
||||||
$(CCR) $(CFLAGS) ldap.c
|
$(CCRS) $(CFLAGS) ldap.c
|
||||||
dictrs.obj: dict.c
|
dictrs.obj: dict.c
|
||||||
$(CCRS) $(CFLAGS) dict.c
|
$(CCRS) $(CFLAGS) dict.c
|
||||||
telnetrs.obj: telnet.c
|
telnetrs.obj: telnet.c
|
||||||
@@ -334,16 +327,15 @@ urlrs.obj: url.c
|
|||||||
$(CCRS) $(CFLAGS) url.c
|
$(CCRS) $(CFLAGS) url.c
|
||||||
filers.obj: file.c
|
filers.obj: file.c
|
||||||
$(CCRS) $(CFLAGS) file.c
|
$(CCRS) $(CFLAGS) file.c
|
||||||
writeoutrs.obj: writeout.c
|
getinfors.obj: getinfo.c
|
||||||
$(CCR) $(CFLAGS) writeout.c
|
$(CCRS) $(CFLAGS) getinfo.c
|
||||||
versionrs.obj: version.c
|
versionrs.obj: version.c
|
||||||
$(CCRS) $(CFLAGS) version.c
|
$(CCRS) $(CFLAGS) version.c
|
||||||
easyrs.obj: easy.c
|
easyrs.obj: easy.c
|
||||||
$(CCR) $(CFLAGS) easy.c
|
$(CCRS) $(CFLAGS) easy.c
|
||||||
highlevelrs.obj: highlevel.c
|
|
||||||
$(CCR) $(CFLAGS) highlevel.c
|
|
||||||
strequalrs.obj: strequal.c
|
strequalrs.obj: strequal.c
|
||||||
$(CCR) $(CFLAGS) strequal.c
|
$(CCRS) $(CFLAGS) strequal.c
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-@erase *.obj
|
-@erase *.obj
|
||||||
|
|||||||
@@ -63,6 +63,7 @@
|
|||||||
#define SYNCH 242 /* for telfunc calls */
|
#define SYNCH 242 /* for telfunc calls */
|
||||||
|
|
||||||
#ifdef TELCMDS
|
#ifdef TELCMDS
|
||||||
|
static
|
||||||
char *telcmds[] = {
|
char *telcmds[] = {
|
||||||
"EOF", "SUSP", "ABORT", "EOR",
|
"EOF", "SUSP", "ABORT", "EOR",
|
||||||
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
|
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
|
||||||
@@ -124,6 +125,7 @@ extern char *telcmds[];
|
|||||||
|
|
||||||
#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
|
#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
|
||||||
#ifdef TELOPTS
|
#ifdef TELOPTS
|
||||||
|
static
|
||||||
char *telopts[NTELOPTS+1] = {
|
char *telopts[NTELOPTS+1] = {
|
||||||
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
|
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
|
||||||
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
|
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
|
||||||
|
|||||||
210
lib/base64.c
210
lib/base64.c
@@ -1,94 +1,152 @@
|
|||||||
/*****************************************************************************
|
/*
|
||||||
* _ _ ____ _
|
* Copyright (c) 1995 - 1999 Kungliga Tekniska H<>gskolan
|
||||||
* Project ___| | | | _ \| |
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* / __| | | | |_) | |
|
* All rights reserved.
|
||||||
* | (__| |_| | _ <| |___
|
|
||||||
* \___|\___/|_| \_\_____|
|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
* modification, are permitted provided that the following conditions
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
* are met:
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* All Rights Reserved.
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
*
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* ------------------------------------------------------------
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* Main author:
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
*
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* http://curl.haxx.se
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
*
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* $Source$
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* $Revision$
|
* SUCH DAMAGE.
|
||||||
* $Date$
|
*/
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "base64.h"
|
||||||
|
|
||||||
/* ---- Base64 Encoding --- */
|
/* The last #include file should be: */
|
||||||
static char table64[]=
|
#ifdef MALLOCDEBUG
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
#include "memdebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
void base64Encode(char *intext, char *output)
|
static char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
|
|
||||||
|
static int pos(char c)
|
||||||
{
|
{
|
||||||
unsigned char ibuf[3];
|
char *p;
|
||||||
unsigned char obuf[4];
|
for(p = base64; *p; p++)
|
||||||
|
if(*p == c)
|
||||||
|
return p - base64;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
int Curl_base64_encode(const void *data, int size, char **str)
|
||||||
|
{
|
||||||
|
char *s, *p;
|
||||||
int i;
|
int i;
|
||||||
int inputparts;
|
int c;
|
||||||
|
const unsigned char *q;
|
||||||
|
|
||||||
while(*intext) {
|
p = s = (char*)malloc(size*4/3+4);
|
||||||
for (i = inputparts = 0; i < 3; i++) {
|
if (p == NULL)
|
||||||
if(*intext) {
|
return -1;
|
||||||
inputparts++;
|
q = (const unsigned char*)data;
|
||||||
ibuf[i] = *intext;
|
i=0;
|
||||||
intext++;
|
for(i = 0; i < size;){
|
||||||
|
c=q[i++];
|
||||||
|
c*=256;
|
||||||
|
if(i < size)
|
||||||
|
c+=q[i];
|
||||||
|
i++;
|
||||||
|
c*=256;
|
||||||
|
if(i < size)
|
||||||
|
c+=q[i];
|
||||||
|
i++;
|
||||||
|
p[0]=base64[(c&0x00fc0000) >> 18];
|
||||||
|
p[1]=base64[(c&0x0003f000) >> 12];
|
||||||
|
p[2]=base64[(c&0x00000fc0) >> 6];
|
||||||
|
p[3]=base64[(c&0x0000003f) >> 0];
|
||||||
|
if(i > size)
|
||||||
|
p[3]='=';
|
||||||
|
if(i > size+1)
|
||||||
|
p[2]='=';
|
||||||
|
p+=4;
|
||||||
}
|
}
|
||||||
|
*p=0;
|
||||||
|
*str = s;
|
||||||
|
return strlen(s);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int Curl_base64_decode(const char *str, void *data)
|
||||||
|
{
|
||||||
|
const char *p;
|
||||||
|
unsigned char *q;
|
||||||
|
int c;
|
||||||
|
int x;
|
||||||
|
int done = 0;
|
||||||
|
q=(unsigned char*)data;
|
||||||
|
for(p=str; *p && !done; p+=4){
|
||||||
|
x = pos(p[0]);
|
||||||
|
if(x >= 0)
|
||||||
|
c = x;
|
||||||
|
else{
|
||||||
|
done = 3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
c*=64;
|
||||||
|
|
||||||
|
x = pos(p[1]);
|
||||||
|
if(x >= 0)
|
||||||
|
c += x;
|
||||||
else
|
else
|
||||||
ibuf[i] = 0;
|
return -1;
|
||||||
}
|
c*=64;
|
||||||
|
|
||||||
obuf [0] = (ibuf [0] & 0xFC) >> 2;
|
if(p[2] == '=')
|
||||||
obuf [1] = ((ibuf [0] & 0x03) << 4) | ((ibuf [1] & 0xF0) >> 4);
|
done++;
|
||||||
obuf [2] = ((ibuf [1] & 0x0F) << 2) | ((ibuf [2] & 0xC0) >> 6);
|
else{
|
||||||
obuf [3] = ibuf [2] & 0x3F;
|
x = pos(p[2]);
|
||||||
|
if(x >= 0)
|
||||||
|
c += x;
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
c*=64;
|
||||||
|
|
||||||
switch(inputparts) {
|
if(p[3] == '=')
|
||||||
case 1: /* only one byte read */
|
done++;
|
||||||
sprintf(output, "%c%c==",
|
else{
|
||||||
table64[obuf[0]],
|
if(done)
|
||||||
table64[obuf[1]]);
|
return -1;
|
||||||
break;
|
x = pos(p[3]);
|
||||||
case 2: /* two bytes read */
|
if(x >= 0)
|
||||||
sprintf(output, "%c%c%c=",
|
c += x;
|
||||||
table64[obuf[0]],
|
else
|
||||||
table64[obuf[1]],
|
return -1;
|
||||||
table64[obuf[2]]);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
sprintf(output, "%c%c%c%c",
|
|
||||||
table64[obuf[0]],
|
|
||||||
table64[obuf[1]],
|
|
||||||
table64[obuf[2]],
|
|
||||||
table64[obuf[3]] );
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
output += 4;
|
if(done < 3)
|
||||||
|
*q++=(c&0x00ff0000)>>16;
|
||||||
|
|
||||||
|
if(done < 2)
|
||||||
|
*q++=(c&0x0000ff00)>>8;
|
||||||
|
if(done < 1)
|
||||||
|
*q++=(c&0x000000ff)>>0;
|
||||||
}
|
}
|
||||||
*output=0;
|
return q - (unsigned char*)data;
|
||||||
}
|
}
|
||||||
/* ---- End of Base64 Encoding ---- */
|
|
||||||
|
|||||||
76
lib/base64.h
76
lib/base64.h
@@ -1,44 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska H<>gskolan
|
||||||
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef __BASE64_H
|
#ifndef __BASE64_H
|
||||||
#define __BASE64_H
|
#define __BASE64_H
|
||||||
/*****************************************************************************
|
|
||||||
* _ _ ____ _
|
|
||||||
* Project ___| | | | _ \| |
|
|
||||||
* / __| | | | |_) | |
|
|
||||||
* | (__| |_| | _ <| |___
|
|
||||||
* \___|\___/|_| \_\_____|
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
|
||||||
* The Original Code is Curl.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
|
||||||
*
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
void base64Encode(char *intext, char *output);
|
int Curl_base64_encode(const void *data, int size, char **str);
|
||||||
|
int Curl_base64_decode(const char *str, void *data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
53
lib/cookie.c
53
lib/cookie.c
@@ -1,3 +1,25 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
|
*
|
||||||
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
|
||||||
@@ -65,6 +87,11 @@ Example set of cookies:
|
|||||||
#include "getdate.h"
|
#include "getdate.h"
|
||||||
#include "strequal.h"
|
#include "strequal.h"
|
||||||
|
|
||||||
|
/* The last #include file should be: */
|
||||||
|
#ifdef MALLOCDEBUG
|
||||||
|
#include "memdebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* cookie_add()
|
* cookie_add()
|
||||||
@@ -73,7 +100,8 @@ Example set of cookies:
|
|||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
struct Cookie *cookie_add(struct CookieInfo *c,
|
struct Cookie *
|
||||||
|
Curl_cookie_add(struct CookieInfo *c,
|
||||||
bool httpheader, /* TRUE if HTTP header-style line */
|
bool httpheader, /* TRUE if HTTP header-style line */
|
||||||
char *lineptr) /* first non-space of the line */
|
char *lineptr) /* first non-space of the line */
|
||||||
{
|
{
|
||||||
@@ -99,7 +127,8 @@ struct Cookie *cookie_add(struct CookieInfo *c,
|
|||||||
|
|
||||||
semiptr=strchr(lineptr, ';'); /* first, find a semicolon */
|
semiptr=strchr(lineptr, ';'); /* first, find a semicolon */
|
||||||
ptr = lineptr;
|
ptr = lineptr;
|
||||||
while(semiptr) {
|
do {
|
||||||
|
if(semiptr)
|
||||||
*semiptr='\0'; /* zero terminate for a while */
|
*semiptr='\0'; /* zero terminate for a while */
|
||||||
/* we have a <what>=<this> pair or a 'secure' word here */
|
/* we have a <what>=<this> pair or a 'secure' word here */
|
||||||
if(strchr(ptr, '=')) {
|
if(strchr(ptr, '=')) {
|
||||||
@@ -156,12 +185,15 @@ struct Cookie *cookie_add(struct CookieInfo *c,
|
|||||||
; /* unsupported keyword without assign! */
|
; /* unsupported keyword without assign! */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!semiptr)
|
||||||
|
continue; /* we already know there are no more cookies */
|
||||||
|
|
||||||
*semiptr=';'; /* put the semicolon back */
|
*semiptr=';'; /* put the semicolon back */
|
||||||
ptr=semiptr+1;
|
ptr=semiptr+1;
|
||||||
while(ptr && *ptr && isspace((int)*ptr))
|
while(ptr && *ptr && isspace((int)*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
semiptr=strchr(ptr, ';'); /* now, find the next semicolon */
|
semiptr=strchr(ptr, ';'); /* now, find the next semicolon */
|
||||||
}
|
} while(semiptr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* This line is NOT a HTTP header style line, we do offer support for
|
/* This line is NOT a HTTP header style line, we do offer support for
|
||||||
@@ -316,7 +348,7 @@ struct Cookie *cookie_add(struct CookieInfo *c,
|
|||||||
* called before any cookies are set. File may be NULL.
|
* called before any cookies are set. File may be NULL.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
struct CookieInfo *cookie_init(char *file)
|
struct CookieInfo *Curl_cookie_init(char *file)
|
||||||
{
|
{
|
||||||
char line[MAX_COOKIE_LINE];
|
char line[MAX_COOKIE_LINE];
|
||||||
struct CookieInfo *c;
|
struct CookieInfo *c;
|
||||||
@@ -344,7 +376,7 @@ struct CookieInfo *cookie_init(char *file)
|
|||||||
while(*lineptr && isspace((int)*lineptr))
|
while(*lineptr && isspace((int)*lineptr))
|
||||||
lineptr++;
|
lineptr++;
|
||||||
|
|
||||||
cookie_add(c, TRUE, lineptr);
|
Curl_cookie_add(c, TRUE, lineptr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* This might be a netscape cookie-file line, get it! */
|
/* This might be a netscape cookie-file line, get it! */
|
||||||
@@ -352,7 +384,7 @@ struct CookieInfo *cookie_init(char *file)
|
|||||||
while(*lineptr && isspace((int)*lineptr))
|
while(*lineptr && isspace((int)*lineptr))
|
||||||
lineptr++;
|
lineptr++;
|
||||||
|
|
||||||
cookie_add(c, FALSE, lineptr);
|
Curl_cookie_add(c, FALSE, lineptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(fromfile)
|
if(fromfile)
|
||||||
@@ -374,7 +406,7 @@ struct CookieInfo *cookie_init(char *file)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct Cookie *cookie_getlist(struct CookieInfo *c,
|
struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
|
||||||
char *host, char *path, bool secure)
|
char *host, char *path, bool secure)
|
||||||
{
|
{
|
||||||
struct Cookie *newco;
|
struct Cookie *newco;
|
||||||
@@ -400,7 +432,7 @@ struct Cookie *cookie_getlist(struct CookieInfo *c,
|
|||||||
/* now check if the domain is correct */
|
/* now check if the domain is correct */
|
||||||
domlen=co->domain?strlen(co->domain):0;
|
domlen=co->domain?strlen(co->domain):0;
|
||||||
if(!co->domain ||
|
if(!co->domain ||
|
||||||
((domlen<hostlen) &&
|
((domlen<=hostlen) &&
|
||||||
strequal(host+(hostlen-domlen), co->domain)) ) {
|
strequal(host+(hostlen-domlen), co->domain)) ) {
|
||||||
/* the right part of the host matches the domain stuff in the
|
/* the right part of the host matches the domain stuff in the
|
||||||
cookie data */
|
cookie data */
|
||||||
@@ -442,7 +474,7 @@ struct Cookie *cookie_getlist(struct CookieInfo *c,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void cookie_freelist(struct Cookie *co)
|
void Curl_cookie_freelist(struct Cookie *co)
|
||||||
{
|
{
|
||||||
struct Cookie *next;
|
struct Cookie *next;
|
||||||
if(co) {
|
if(co) {
|
||||||
@@ -462,7 +494,7 @@ void cookie_freelist(struct Cookie *co)
|
|||||||
* Free a "cookie object" previous created with cookie_init().
|
* Free a "cookie object" previous created with cookie_init().
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void cookie_cleanup(struct CookieInfo *c)
|
void Curl_cookie_cleanup(struct CookieInfo *c)
|
||||||
{
|
{
|
||||||
struct Cookie *co;
|
struct Cookie *co;
|
||||||
struct Cookie *next;
|
struct Cookie *next;
|
||||||
@@ -492,6 +524,7 @@ void cookie_cleanup(struct CookieInfo *c)
|
|||||||
free(co);
|
free(co);
|
||||||
co = next;
|
co = next;
|
||||||
}
|
}
|
||||||
|
free(c); /* free the base struct as well */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
32
lib/cookie.h
32
lib/cookie.h
@@ -1,5 +1,27 @@
|
|||||||
#ifndef __COOKIE_H
|
#ifndef __COOKIE_H
|
||||||
#define __COOKIE_H
|
#define __COOKIE_H
|
||||||
|
/*****************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
|
*
|
||||||
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -41,10 +63,10 @@ struct CookieInfo {
|
|||||||
#define MAX_NAME 256
|
#define MAX_NAME 256
|
||||||
#define MAX_NAME_TXT "255"
|
#define MAX_NAME_TXT "255"
|
||||||
|
|
||||||
struct Cookie *cookie_add(struct CookieInfo *, bool, char *);
|
struct Cookie *Curl_cookie_add(struct CookieInfo *, bool, char *);
|
||||||
struct CookieInfo *cookie_init(char *);
|
struct CookieInfo *Curl_cookie_init(char *);
|
||||||
struct Cookie *cookie_getlist(struct CookieInfo *, char *, char *, bool);
|
struct Cookie *Curl_cookie_getlist(struct CookieInfo *, char *, char *, bool);
|
||||||
void cookie_freelist(struct Cookie *);
|
void Curl_cookie_freelist(struct Cookie *);
|
||||||
void cookie_cleanup(struct CookieInfo *);
|
void Curl_cookie_cleanup(struct CookieInfo *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
59
lib/dict.c
59
lib/dict.c
@@ -5,38 +5,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
@@ -88,7 +71,7 @@
|
|||||||
|
|
||||||
#include "urldata.h"
|
#include "urldata.h"
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include "download.h"
|
#include "transfer.h"
|
||||||
#include "sendf.h"
|
#include "sendf.h"
|
||||||
|
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
@@ -97,12 +80,12 @@
|
|||||||
#define _MPRINTF_REPLACE /* use our functions only */
|
#define _MPRINTF_REPLACE /* use our functions only */
|
||||||
#include <curl/mprintf.h>
|
#include <curl/mprintf.h>
|
||||||
|
|
||||||
CURLcode dict_done(struct connectdata *conn)
|
CURLcode Curl_dict_done(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
CURLcode dict(struct connectdata *conn)
|
CURLcode Curl_dict(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
int nth;
|
int nth;
|
||||||
char *word;
|
char *word;
|
||||||
@@ -158,7 +141,7 @@ CURLcode dict(struct connectdata *conn)
|
|||||||
nth = atoi(nthdef);
|
nth = atoi(nthdef);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendf(data->firstsocket, data,
|
Curl_sendf(data->firstsocket, conn,
|
||||||
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
||||||
"MATCH "
|
"MATCH "
|
||||||
"%s " /* database */
|
"%s " /* database */
|
||||||
@@ -171,7 +154,7 @@ CURLcode dict(struct connectdata *conn)
|
|||||||
word
|
word
|
||||||
);
|
);
|
||||||
|
|
||||||
result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
|
result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
|
||||||
-1, NULL); /* no upload */
|
-1, NULL); /* no upload */
|
||||||
|
|
||||||
if(result)
|
if(result)
|
||||||
@@ -208,7 +191,7 @@ CURLcode dict(struct connectdata *conn)
|
|||||||
nth = atoi(nthdef);
|
nth = atoi(nthdef);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendf(data->firstsocket, data,
|
Curl_sendf(data->firstsocket, conn,
|
||||||
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
||||||
"DEFINE "
|
"DEFINE "
|
||||||
"%s " /* database */
|
"%s " /* database */
|
||||||
@@ -219,7 +202,7 @@ CURLcode dict(struct connectdata *conn)
|
|||||||
word
|
word
|
||||||
);
|
);
|
||||||
|
|
||||||
result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
|
result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
|
||||||
-1, NULL); /* no upload */
|
-1, NULL); /* no upload */
|
||||||
|
|
||||||
if(result)
|
if(result)
|
||||||
@@ -233,17 +216,17 @@ CURLcode dict(struct connectdata *conn)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
ppath++;
|
ppath++;
|
||||||
for (i = 0; (i < URL_MAX_LENGTH) && (ppath[i]); i++) {
|
for (i = 0; ppath[i]; i++) {
|
||||||
if (ppath[i] == ':')
|
if (ppath[i] == ':')
|
||||||
ppath[i] = ' ';
|
ppath[i] = ' ';
|
||||||
}
|
}
|
||||||
sendf(data->firstsocket, data,
|
Curl_sendf(data->firstsocket, conn,
|
||||||
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
||||||
"%s\n"
|
"%s\n"
|
||||||
"QUIT\n",
|
"QUIT\n",
|
||||||
ppath);
|
ppath);
|
||||||
|
|
||||||
result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
|
result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
|
||||||
-1, NULL);
|
-1, NULL);
|
||||||
|
|
||||||
if(result)
|
if(result)
|
||||||
|
|||||||
43
lib/dict.h
43
lib/dict.h
@@ -8,39 +8,22 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
CURLcode Curl_dict(struct connectdata *conn);
|
||||||
* ------------------------------------------------------------
|
CURLcode Curl_dict_done(struct connectdata *conn);
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
CURLcode dict(struct connectdata *conn);
|
|
||||||
CURLcode dict_done(struct connectdata *conn);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
82
lib/dllinit.c
Normal file
82
lib/dllinit.c
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
/* dllinit.c -- Portable DLL initialization.
|
||||||
|
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||||
|
Contributed by Mumit Khan (khan@xraylith.wisc.edu).
|
||||||
|
|
||||||
|
I've used DllMain as the DLL "main" since that's the most common
|
||||||
|
usage. MSVC and Mingw32 both default to DllMain as the standard
|
||||||
|
callback from the linker entry point. Cygwin, as of b20.1, also
|
||||||
|
uses DllMain as the default callback from the entry point.
|
||||||
|
|
||||||
|
The real entry point is typically always defined by the runtime
|
||||||
|
library, and usually never overridden by (casual) user. What you can
|
||||||
|
override however is the callback routine that the entry point calls,
|
||||||
|
and this file provides such a callback function, DllMain.
|
||||||
|
|
||||||
|
Mingw32: The default entry point for mingw32 is DllMainCRTStartup
|
||||||
|
which is defined in libmingw32.a This in turn calls DllMain which is
|
||||||
|
defined here. If not defined, there is a stub in libmingw32.a which
|
||||||
|
does nothing.
|
||||||
|
|
||||||
|
Cygwin: The default entry point for Cygwin b20.1 or newer is
|
||||||
|
__cygwin_dll_entry which is defined in libcygwin.a. This in turn
|
||||||
|
calls the routine DllMain. If not defined, there is a stub in
|
||||||
|
libcygwin.a which does nothing.
|
||||||
|
|
||||||
|
MSVC: MSVC runtime calls DllMain, just like Mingw32.
|
||||||
|
|
||||||
|
Summary: If you need to do anything special in DllMain, just add it
|
||||||
|
here. Otherwise, the default setup should be just fine for 99%+ of
|
||||||
|
the time. I strongly suggest that you *not* change the entry point,
|
||||||
|
but rather change DllMain as appropriate.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason,
|
||||||
|
LPVOID reserved /* Not used. */ );
|
||||||
|
|
||||||
|
/*
|
||||||
|
*----------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* DllMain --
|
||||||
|
*
|
||||||
|
* This routine is called by the Mingw32, Cygwin32 or VC++ C run
|
||||||
|
* time library init code, or the Borland DllEntryPoint routine. It
|
||||||
|
* is responsible for initializing various dynamically loaded
|
||||||
|
* libraries.
|
||||||
|
*
|
||||||
|
* Results:
|
||||||
|
* TRUE on sucess, FALSE on failure.
|
||||||
|
*
|
||||||
|
* Side effects:
|
||||||
|
*
|
||||||
|
*----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
BOOL APIENTRY
|
||||||
|
DllMain (
|
||||||
|
HINSTANCE hInst /* Library instance handle. */ ,
|
||||||
|
DWORD reason /* Reason this function is being called. */ ,
|
||||||
|
LPVOID reserved /* Not used. */ )
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (reason)
|
||||||
|
{
|
||||||
|
case DLL_PROCESS_ATTACH:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DLL_PROCESS_DETACH:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DLL_THREAD_ATTACH:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DLL_THREAD_DETACH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
117
lib/download.c
117
lib/download.c
@@ -1,117 +0,0 @@
|
|||||||
/*****************************************************************************
|
|
||||||
* _ _ ____ _
|
|
||||||
* Project ___| | | | _ \| |
|
|
||||||
* / __| | | | |_) | |
|
|
||||||
* | (__| |_| | _ <| |___
|
|
||||||
* \___|\___/|_| \_\_____|
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
|
||||||
* The Original Code is Curl.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
|
||||||
*
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_SELECT_H
|
|
||||||
#include <sys/select.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "urldata.h"
|
|
||||||
#include <curl/curl.h>
|
|
||||||
|
|
||||||
#ifdef __BEOS__
|
|
||||||
#include <net/socket.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#if !defined( __GNUC__) || defined(__MINGW32__)
|
|
||||||
#include <winsock.h>
|
|
||||||
#endif
|
|
||||||
#include <time.h> /* for the time_t typedef! */
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(TIME_WITH_SYS_TIME)
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "progress.h"
|
|
||||||
#include "speedcheck.h"
|
|
||||||
#include "sendf.h"
|
|
||||||
|
|
||||||
#include <curl/types.h>
|
|
||||||
|
|
||||||
/* --- download and upload a stream from/to a socket --- */
|
|
||||||
|
|
||||||
/* Parts of this function was brought to us by the friendly Mark Butler
|
|
||||||
<butlerm@xmission.com>. */
|
|
||||||
|
|
||||||
CURLcode
|
|
||||||
Transfer(CURLconnect *c_conn,
|
|
||||||
/* READ stuff */
|
|
||||||
int sockfd, /* socket to read from or -1 */
|
|
||||||
int size, /* -1 if unknown at this point */
|
|
||||||
bool getheader, /* TRUE if header parsing is wanted */
|
|
||||||
long *bytecountp, /* return number of bytes read or NULL */
|
|
||||||
|
|
||||||
/* WRITE stuff */
|
|
||||||
int writesockfd, /* socket to write to, it may very well be
|
|
||||||
the same we read from. -1 disables */
|
|
||||||
long *writebytecountp /* return number of bytes written or NULL */
|
|
||||||
)
|
|
||||||
{
|
|
||||||
struct connectdata *conn = (struct connectdata *)c_conn;
|
|
||||||
if(!conn)
|
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
|
||||||
|
|
||||||
/* now copy all input parameters */
|
|
||||||
conn->sockfd = sockfd;
|
|
||||||
conn->size = size;
|
|
||||||
conn->getheader = getheader;
|
|
||||||
conn->bytecountp = bytecountp;
|
|
||||||
conn->writesockfd = writesockfd;
|
|
||||||
conn->writebytecountp = writebytecountp;
|
|
||||||
|
|
||||||
return CURLE_OK;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#ifndef __DOWNLOAD_H
|
|
||||||
#define __DOWNLOAD_H
|
|
||||||
/*****************************************************************************
|
|
||||||
* _ _ ____ _
|
|
||||||
* Project ___| | | | _ \| |
|
|
||||||
* / __| | | | |_) | |
|
|
||||||
* | (__| |_| | _ <| |___
|
|
||||||
* \___|\___/|_| \_\_____|
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
|
||||||
* The Original Code is Curl.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
|
||||||
*
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
CURLcode
|
|
||||||
Transfer (struct connectdata *data,
|
|
||||||
int sockfd, /* socket to read from or -1 */
|
|
||||||
int size, /* -1 if unknown at this point */
|
|
||||||
bool getheader, /* TRUE if header parsing is wanted */
|
|
||||||
long *bytecountp, /* return number of bytes read */
|
|
||||||
int writesockfd, /* socket to write to, it may very well be
|
|
||||||
the same we read from. -1 disables */
|
|
||||||
long *writebytecountp /* return number of bytes written */
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
54
lib/easy.c
54
lib/easy.c
@@ -5,38 +5,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
@@ -89,7 +72,7 @@
|
|||||||
|
|
||||||
#include "urldata.h"
|
#include "urldata.h"
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include "highlevel.h"
|
#include "transfer.h"
|
||||||
#include <curl/types.h>
|
#include <curl/types.h>
|
||||||
|
|
||||||
#define _MPRINTF_REPLACE /* use our functions only */
|
#define _MPRINTF_REPLACE /* use our functions only */
|
||||||
@@ -109,6 +92,9 @@ CURL *curl_easy_init(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
data->interf = CURLI_EASY; /* mark it as an easy one */
|
data->interf = CURLI_EASY; /* mark it as an easy one */
|
||||||
|
/* SAC */
|
||||||
|
data->device = NULL;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,3 +145,13 @@ void curl_easy_cleanup(CURL *curl)
|
|||||||
curl_close(curl);
|
curl_close(curl);
|
||||||
curl_free();
|
curl_free();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)
|
||||||
|
{
|
||||||
|
va_list arg;
|
||||||
|
void *paramp;
|
||||||
|
va_start(arg, info);
|
||||||
|
paramp = va_arg(arg, void *);
|
||||||
|
|
||||||
|
return curl_getinfo(curl, info, paramp);
|
||||||
|
}
|
||||||
|
|||||||
59
lib/escape.c
59
lib/escape.c
@@ -5,46 +5,37 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* Escape and unescape URL encoding in strings. The functions return a new
|
/* Escape and unescape URL encoding in strings. The functions return a new
|
||||||
* allocated string or NULL if an error occurred. */
|
* allocated string or NULL if an error occurred. */
|
||||||
|
|
||||||
|
#include "setup.h"
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
/* The last #include file should be: */
|
||||||
|
#ifdef MALLOCDEBUG
|
||||||
|
#include "memdebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
char *curl_escape(char *string)
|
char *curl_escape(char *string)
|
||||||
{
|
{
|
||||||
int alloc=strlen(string)+1;
|
int alloc=strlen(string)+1;
|
||||||
@@ -88,16 +79,24 @@ char *curl_unescape(char *string, int length)
|
|||||||
unsigned char in;
|
unsigned char in;
|
||||||
int index=0;
|
int index=0;
|
||||||
int hex;
|
int hex;
|
||||||
|
char querypart=FALSE; /* everything to the right of a '?' letter is
|
||||||
|
the "query part" where '+' should become ' '.
|
||||||
|
RFC 2316, section 3.10 */
|
||||||
|
|
||||||
while(--alloc) {
|
while(--alloc > 0) {
|
||||||
in = *string;
|
in = *string;
|
||||||
if('+' == in)
|
if(querypart && ('+' == in))
|
||||||
in = ' ';
|
in = ' ';
|
||||||
|
else if(!querypart && ('?' == in)) {
|
||||||
|
/* we have "walked in" to the query part */
|
||||||
|
querypart=TRUE;
|
||||||
|
}
|
||||||
else if('%' == in) {
|
else if('%' == in) {
|
||||||
/* encoded part */
|
/* encoded part */
|
||||||
if(sscanf(string+1, "%02X", &hex)) {
|
if(sscanf(string+1, "%02X", &hex)) {
|
||||||
in = hex;
|
in = hex;
|
||||||
string+=2;
|
string+=2;
|
||||||
|
alloc-=2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
39
lib/escape.h
39
lib/escape.h
@@ -8,38 +8,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
/* Escape and unescape URL encoding in strings. The functions return a new
|
/* Escape and unescape URL encoding in strings. The functions return a new
|
||||||
* allocated string or NULL if an error occurred. */
|
* allocated string or NULL if an error occurred. */
|
||||||
|
|
||||||
|
|||||||
69
lib/file.c
69
lib/file.c
@@ -5,38 +5,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1999.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
@@ -103,6 +86,10 @@
|
|||||||
#define _MPRINTF_REPLACE /* use our functions only */
|
#define _MPRINTF_REPLACE /* use our functions only */
|
||||||
#include <curl/mprintf.h>
|
#include <curl/mprintf.h>
|
||||||
|
|
||||||
|
/* The last #include file should be: */
|
||||||
|
#ifdef MALLOCDEBUG
|
||||||
|
#include "memdebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
CURLcode file(struct connectdata *conn)
|
CURLcode file(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
@@ -119,7 +106,7 @@ CURLcode file(struct connectdata *conn)
|
|||||||
struct UrlData *data = conn->data;
|
struct UrlData *data = conn->data;
|
||||||
char *buf = data->buffer;
|
char *buf = data->buffer;
|
||||||
int bytecount = 0;
|
int bytecount = 0;
|
||||||
struct timeval start = tvnow();
|
struct timeval start = Curl_tvnow();
|
||||||
struct timeval now = start;
|
struct timeval now = start;
|
||||||
int fd;
|
int fd;
|
||||||
char *actual_path = curl_unescape(path, 0);
|
char *actual_path = curl_unescape(path, 0);
|
||||||
@@ -151,11 +138,8 @@ CURLcode file(struct connectdata *conn)
|
|||||||
this is both more efficient than the former call to download() and
|
this is both more efficient than the former call to download() and
|
||||||
it avoids problems with select() and recv() on file descriptors
|
it avoids problems with select() and recv() on file descriptors
|
||||||
in Winsock */
|
in Winsock */
|
||||||
#if 0
|
|
||||||
ProgressInit (data, expected_size);
|
|
||||||
#endif
|
|
||||||
if(expected_size != -1)
|
if(expected_size != -1)
|
||||||
pgrsSetDownloadSize(data, expected_size);
|
Curl_pgrsSetDownloadSize(data, expected_size);
|
||||||
|
|
||||||
while (res == CURLE_OK) {
|
while (res == CURLE_OK) {
|
||||||
nread = read(fd, buf, BUFSIZE-1);
|
nread = read(fd, buf, BUFSIZE-1);
|
||||||
@@ -170,21 +154,20 @@ CURLcode file(struct connectdata *conn)
|
|||||||
Windows systems if the target is stdout. Use -O or -o parameters
|
Windows systems if the target is stdout. Use -O or -o parameters
|
||||||
to prevent CR/LF translation (this then goes to a binary mode
|
to prevent CR/LF translation (this then goes to a binary mode
|
||||||
file descriptor). */
|
file descriptor). */
|
||||||
if(nread != data->fwrite (buf, 1, nread, data->out)) {
|
|
||||||
failf (data, "Failed writing output");
|
res = Curl_client_write(data, CLIENTWRITE_BODY, buf, nread);
|
||||||
return CURLE_WRITE_ERROR;
|
if(res)
|
||||||
}
|
return res;
|
||||||
now = tvnow();
|
|
||||||
if(pgrsUpdate(data))
|
now = Curl_tvnow();
|
||||||
|
if(Curl_pgrsUpdate(data))
|
||||||
res = CURLE_ABORTED_BY_CALLBACK;
|
res = CURLE_ABORTED_BY_CALLBACK;
|
||||||
}
|
}
|
||||||
now = tvnow();
|
now = Curl_tvnow();
|
||||||
if(pgrsUpdate(data))
|
if(Curl_pgrsUpdate(data))
|
||||||
res = CURLE_ABORTED_BY_CALLBACK;
|
res = CURLE_ABORTED_BY_CALLBACK;
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
free(actual_path);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
39
lib/file.h
39
lib/file.h
@@ -8,38 +8,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
CURLcode file(struct connectdata *conn);
|
CURLcode file(struct connectdata *conn);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
122
lib/formdata.c
122
lib/formdata.c
@@ -5,38 +5,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Debug the form generator stand-alone by compiling this source file with:
|
Debug the form generator stand-alone by compiling this source file with:
|
||||||
@@ -63,6 +46,11 @@
|
|||||||
|
|
||||||
#include "strequal.h"
|
#include "strequal.h"
|
||||||
|
|
||||||
|
/* The last #include file should be: */
|
||||||
|
#ifdef MALLOCDEBUG
|
||||||
|
#include "memdebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Length of the random boundary string. The risk of this being used
|
/* Length of the random boundary string. The risk of this being used
|
||||||
in binary data is very close to zero, 64^32 makes
|
in binary data is very close to zero, 64^32 makes
|
||||||
6277101735386680763835789423207666416102355444464034512896
|
6277101735386680763835789423207666416102355444464034512896
|
||||||
@@ -103,16 +91,10 @@ static void GetStr(char **string,
|
|||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
int curl_formparse(char *input,
|
|
||||||
struct HttpPost **httppost,
|
|
||||||
struct HttpPost **last_post)
|
|
||||||
{
|
|
||||||
return FormParse(input, httppost, last_post);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define FORM_FILE_SEPARATOR ','
|
#define FORM_FILE_SEPARATOR ','
|
||||||
#define FORM_TYPE_SEPARATOR ';'
|
#define FORM_TYPE_SEPARATOR ';'
|
||||||
|
|
||||||
|
static
|
||||||
int FormParse(char *input,
|
int FormParse(char *input,
|
||||||
struct HttpPost **httppost,
|
struct HttpPost **httppost,
|
||||||
struct HttpPost **last_post)
|
struct HttpPost **last_post)
|
||||||
@@ -310,6 +292,13 @@ int FormParse(char *input,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int curl_formparse(char *input,
|
||||||
|
struct HttpPost **httppost,
|
||||||
|
struct HttpPost **last_post)
|
||||||
|
{
|
||||||
|
return FormParse(input, httppost, last_post);
|
||||||
|
}
|
||||||
|
|
||||||
static int AddFormData(struct FormData **formp,
|
static int AddFormData(struct FormData **formp,
|
||||||
void *line,
|
void *line,
|
||||||
long length)
|
long length)
|
||||||
@@ -351,7 +340,7 @@ static int AddFormDataf(struct FormData **formp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *MakeFormBoundary(void)
|
char *Curl_FormBoundary(void)
|
||||||
{
|
{
|
||||||
char *retstring;
|
char *retstring;
|
||||||
static int randomizer=0; /* this is just so that two boundaries within
|
static int randomizer=0; /* this is just so that two boundaries within
|
||||||
@@ -378,8 +367,8 @@ char *MakeFormBoundary(void)
|
|||||||
return retstring;
|
return retstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Used from http.c */
|
||||||
void FormFree(struct FormData *form)
|
void Curl_FormFree(struct FormData *form)
|
||||||
{
|
{
|
||||||
struct FormData *next;
|
struct FormData *next;
|
||||||
do {
|
do {
|
||||||
@@ -390,7 +379,29 @@ void FormFree(struct FormData *form)
|
|||||||
} while((form=next)); /* continue */
|
} while((form=next)); /* continue */
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FormData *getFormData(struct HttpPost *post,
|
/* external function to free up a whole form post chain */
|
||||||
|
void curl_formfree(struct HttpPost *form)
|
||||||
|
{
|
||||||
|
struct HttpPost *next;
|
||||||
|
do {
|
||||||
|
next=form->next; /* the following form line */
|
||||||
|
|
||||||
|
/* recurse to sub-contents */
|
||||||
|
if(form->more)
|
||||||
|
curl_formfree(form->more);
|
||||||
|
|
||||||
|
if(form->name)
|
||||||
|
free(form->name); /* free the name */
|
||||||
|
if(form->contents)
|
||||||
|
free(form->contents); /* free the contents */
|
||||||
|
if(form->contenttype)
|
||||||
|
free(form->contenttype); /* free the content type */
|
||||||
|
free(form); /* free the struct */
|
||||||
|
|
||||||
|
} while((form=next)); /* continue */
|
||||||
|
}
|
||||||
|
|
||||||
|
struct FormData *Curl_getFormData(struct HttpPost *post,
|
||||||
int *sizep)
|
int *sizep)
|
||||||
{
|
{
|
||||||
struct FormData *form = NULL;
|
struct FormData *form = NULL;
|
||||||
@@ -405,7 +416,7 @@ struct FormData *getFormData(struct HttpPost *post,
|
|||||||
if(!post)
|
if(!post)
|
||||||
return NULL; /* no input => no output! */
|
return NULL; /* no input => no output! */
|
||||||
|
|
||||||
boundary = MakeFormBoundary();
|
boundary = Curl_FormBoundary();
|
||||||
|
|
||||||
/* Make the first line of the output */
|
/* Make the first line of the output */
|
||||||
AddFormDataf(&form,
|
AddFormDataf(&form,
|
||||||
@@ -429,7 +440,7 @@ struct FormData *getFormData(struct HttpPost *post,
|
|||||||
/* If used, this is a link to more file names, we must then do
|
/* If used, this is a link to more file names, we must then do
|
||||||
the magic to include several files with the same field name */
|
the magic to include several files with the same field name */
|
||||||
|
|
||||||
fileboundary = MakeFormBoundary();
|
fileboundary = Curl_FormBoundary();
|
||||||
|
|
||||||
size += AddFormDataf(&form,
|
size += AddFormDataf(&form,
|
||||||
"\r\nContent-Type: multipart/mixed,"
|
"\r\nContent-Type: multipart/mixed,"
|
||||||
@@ -458,12 +469,20 @@ struct FormData *getFormData(struct HttpPost *post,
|
|||||||
"\r\nContent-Type: %s",
|
"\r\nContent-Type: %s",
|
||||||
file->contenttype);
|
file->contenttype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* The header Content-Transfer-Encoding: seems to confuse some receivers
|
||||||
|
* (like the built-in PHP engine). While I can't see any reason why it
|
||||||
|
* should, I can just as well skip this to the benefit of the users who
|
||||||
|
* are using such confused receivers.
|
||||||
|
*/
|
||||||
|
|
||||||
if(file->contenttype &&
|
if(file->contenttype &&
|
||||||
!strnequal("text/", file->contenttype, 5)) {
|
!strnequal("text/", file->contenttype, 5)) {
|
||||||
/* this is not a text content, mention our binary encoding */
|
/* this is not a text content, mention our binary encoding */
|
||||||
size += AddFormData(&form, "\r\nContent-Transfer-Encoding: binary", 0);
|
size += AddFormData(&form, "\r\nContent-Transfer-Encoding: binary", 0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
size += AddFormData(&form, "\r\n\r\n", 0);
|
size += AddFormData(&form, "\r\n\r\n", 0);
|
||||||
|
|
||||||
@@ -517,24 +536,11 @@ struct FormData *getFormData(struct HttpPost *post,
|
|||||||
return firstform;
|
return firstform;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FormInit(struct Form *form, struct FormData *formdata )
|
int Curl_FormInit(struct Form *form, struct FormData *formdata )
|
||||||
{
|
{
|
||||||
if(!formdata)
|
if(!formdata)
|
||||||
return 1; /* error */
|
return 1; /* error */
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct FormData *lastnode=formdata;
|
|
||||||
|
|
||||||
/* find the last node in the list */
|
|
||||||
while(lastnode->next) {
|
|
||||||
lastnode = lastnode->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now, make sure that we'll send a nice terminating sequence at the end
|
|
||||||
* of the post. We *DONT* add this string to the size of the data since this
|
|
||||||
* is actually AFTER the data. */
|
|
||||||
AddFormDataf(&lastnode, "\r\n\r\n");
|
|
||||||
#endif
|
|
||||||
form->data = formdata;
|
form->data = formdata;
|
||||||
form->sent = 0;
|
form->sent = 0;
|
||||||
|
|
||||||
@@ -542,7 +548,7 @@ int FormInit(struct Form *form, struct FormData *formdata )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* fread() emulation */
|
/* fread() emulation */
|
||||||
int FormReader(char *buffer,
|
int Curl_FormReader(char *buffer,
|
||||||
size_t size,
|
size_t size,
|
||||||
size_t nitems,
|
size_t nitems,
|
||||||
FILE *mydata)
|
FILE *mydata)
|
||||||
@@ -620,7 +626,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
form=getFormData(httppost, &size);
|
form=Curl_getFormData(httppost, &size);
|
||||||
|
|
||||||
FormInit(&formread, form);
|
FormInit(&formread, form);
|
||||||
|
|
||||||
|
|||||||
@@ -8,69 +8,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Rafael Sagula <sagula@inf.ufrgs.br>
|
|
||||||
* Sampo Kellomaki <sampo@iki.fi>
|
|
||||||
* Linas Vepstas <linas@linas.org>
|
|
||||||
* Bjorn Reese <breese@imada.ou.dk>
|
|
||||||
* Johan Anderson <johan@homemail.com>
|
|
||||||
* Kjell Ericson <Kjell.Ericson@haxx.se>
|
|
||||||
* Troy Engel <tengel@palladium.net>
|
|
||||||
* Ryan Nelson <ryan@inch.com>
|
|
||||||
* Bjorn Stenberg <Bjorn.Stenberg@haxx.se>
|
|
||||||
* Angus Mackay <amackay@gus.ml.org>
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* $Log$
|
|
||||||
* Revision 1.3 2000-06-20 15:31:26 bagder
|
|
||||||
* haxx.nu => haxx.se
|
|
||||||
*
|
|
||||||
* Revision 1.2 2000/01/10 23:36:14 bagder
|
|
||||||
* syncing with local edit
|
|
||||||
*
|
|
||||||
* Revision 1.4 1999/09/06 06:59:40 dast
|
|
||||||
* Changed email info
|
|
||||||
*
|
|
||||||
* Revision 1.3 1999/08/13 07:34:47 dast
|
|
||||||
* Changed the URL in the header
|
|
||||||
*
|
|
||||||
* Revision 1.2 1999/07/30 12:59:47 dast
|
|
||||||
* FormFree() was added to properly cleanup after a form was posted.
|
|
||||||
*
|
|
||||||
* Revision 1.1.1.1 1999/03/11 22:23:34 dast
|
|
||||||
* Imported sources
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
/* plain and simple linked list with lines to send */
|
/* plain and simple linked list with lines to send */
|
||||||
struct FormData {
|
struct FormData {
|
||||||
struct FormData *next;
|
struct FormData *next;
|
||||||
@@ -84,23 +36,19 @@ struct Form {
|
|||||||
been sent in a previous invoke */
|
been sent in a previous invoke */
|
||||||
};
|
};
|
||||||
|
|
||||||
int FormParse(char *string,
|
int Curl_FormInit(struct Form *form, struct FormData *formdata );
|
||||||
struct HttpPost **httppost,
|
|
||||||
struct HttpPost **last_post);
|
|
||||||
|
|
||||||
int FormInit(struct Form *form, struct FormData *formdata );
|
struct FormData *Curl_getFormData(struct HttpPost *post,
|
||||||
|
|
||||||
struct FormData *getFormData(struct HttpPost *post,
|
|
||||||
int *size);
|
int *size);
|
||||||
|
|
||||||
/* fread() emulation */
|
/* fread() emulation */
|
||||||
int FormReader(char *buffer,
|
int Curl_FormReader(char *buffer,
|
||||||
size_t size,
|
size_t size,
|
||||||
size_t nitems,
|
size_t nitems,
|
||||||
FILE *mydata);
|
FILE *mydata);
|
||||||
|
|
||||||
char *MakeFormBoundary(void);
|
char *Curl_FormBoundary(void);
|
||||||
|
|
||||||
void FormFree(struct FormData *);
|
void Curl_FormFree(struct FormData *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
52
lib/ftp.h
52
lib/ftp.h
@@ -8,43 +8,33 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
CURLcode Curl_ftp(struct connectdata *conn);
|
||||||
* ------------------------------------------------------------
|
CURLcode Curl_ftp_done(struct connectdata *conn);
|
||||||
* Main author:
|
CURLcode Curl_ftp_connect(struct connectdata *conn);
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
size_t Curl_ftpsendf(int fd, struct connectdata *, char *fmt, ...);
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
CURLcode ftp(struct connectdata *conn);
|
|
||||||
CURLcode ftp_done(struct connectdata *conn);
|
|
||||||
CURLcode ftp_connect(struct connectdata *conn);
|
|
||||||
|
|
||||||
struct curl_slist *curl_slist_append(struct curl_slist *list, char *data);
|
struct curl_slist *curl_slist_append(struct curl_slist *list, char *data);
|
||||||
void curl_slist_free_all(struct curl_slist *list);
|
void curl_slist_free_all(struct curl_slist *list);
|
||||||
|
|
||||||
|
/* The kerberos stuff needs this: */
|
||||||
|
int Curl_GetFTPResponse(int sockfd, char *buf,
|
||||||
|
struct connectdata *conn,
|
||||||
|
int *ftpcode);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ static const short yycheck[] = { 0,
|
|||||||
56
|
56
|
||||||
};
|
};
|
||||||
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
||||||
#line 3 "/opt/TWWfsw/bison/share/bison.simple"
|
#line 3 "/usr/local/share/bison.simple"
|
||||||
/* This file comes from bison-1.28. */
|
/* This file comes from bison-1.28. */
|
||||||
|
|
||||||
/* Skeleton output parser for bison,
|
/* Skeleton output parser for bison,
|
||||||
@@ -604,7 +604,7 @@ __yy_memcpy (char *to, char *from, unsigned int count)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#line 217 "/opt/TWWfsw/bison/share/bison.simple"
|
#line 217 "/usr/local/share/bison.simple"
|
||||||
|
|
||||||
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
||||||
into yyparse. The argument should have type void *.
|
into yyparse. The argument should have type void *.
|
||||||
@@ -1295,7 +1295,7 @@ case 50:
|
|||||||
break;}
|
break;}
|
||||||
}
|
}
|
||||||
/* the action file gets copied in in place of this dollarsign */
|
/* the action file gets copied in in place of this dollarsign */
|
||||||
#line 543 "/opt/TWWfsw/bison/share/bison.simple"
|
#line 543 "/usr/local/share/bison.simple"
|
||||||
|
|
||||||
yyvsp -= yylen;
|
yyvsp -= yylen;
|
||||||
yyssp -= yylen;
|
yyssp -= yylen;
|
||||||
@@ -1981,7 +1981,7 @@ curl_getdate (const char *p, const time_t *now)
|
|||||||
yyInput = p;
|
yyInput = p;
|
||||||
Start = now ? *now : time ((time_t *) NULL);
|
Start = now ? *now : time ((time_t *) NULL);
|
||||||
#ifdef HAVE_LOCALTIME_R
|
#ifdef HAVE_LOCALTIME_R
|
||||||
tmp = localtime_r(&Start, &keeptime);
|
tmp = (struct tm *)localtime_r(&Start, &keeptime);
|
||||||
#else
|
#else
|
||||||
tmp = localtime (&Start);
|
tmp = localtime (&Start);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -934,7 +934,7 @@ curl_getdate (const char *p, const time_t *now)
|
|||||||
yyInput = p;
|
yyInput = p;
|
||||||
Start = now ? *now : time ((time_t *) NULL);
|
Start = now ? *now : time ((time_t *) NULL);
|
||||||
#ifdef HAVE_LOCALTIME_R
|
#ifdef HAVE_LOCALTIME_R
|
||||||
tmp = localtime_r(&Start, &keeptime);
|
tmp = (struct tm *)localtime_r(&Start, &keeptime);
|
||||||
#else
|
#else
|
||||||
tmp = localtime (&Start);
|
tmp = localtime (&Start);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
46
lib/getenv.c
46
lib/getenv.c
@@ -5,37 +5,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -45,6 +29,11 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MALLOCDEBUG
|
||||||
|
#include "memdebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static
|
||||||
char *GetEnv(char *variable)
|
char *GetEnv(char *variable)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -52,12 +41,13 @@ char *GetEnv(char *variable)
|
|||||||
char env[MAX_PATH]; /* MAX_PATH is from windef.h */
|
char env[MAX_PATH]; /* MAX_PATH is from windef.h */
|
||||||
char *temp = getenv(variable);
|
char *temp = getenv(variable);
|
||||||
env[0] = '\0';
|
env[0] = '\0';
|
||||||
|
if (temp != NULL)
|
||||||
ExpandEnvironmentStrings(temp, env, sizeof(env));
|
ExpandEnvironmentStrings(temp, env, sizeof(env));
|
||||||
#else
|
#else
|
||||||
/* no length control */
|
/* no length control */
|
||||||
char *env = getenv(variable);
|
char *env = getenv(variable);
|
||||||
#endif
|
#endif
|
||||||
return env?strdup(env):NULL;
|
return (env && env[0])?strdup(env):NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *curl_getenv(char *v)
|
char *curl_getenv(char *v)
|
||||||
|
|||||||
70
lib/getenv.h
70
lib/getenv.h
@@ -7,68 +7,22 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Rafael Sagula <sagula@inf.ufrgs.br>
|
|
||||||
* Sampo Kellomaki <sampo@iki.fi>
|
|
||||||
* Linas Vepstas <linas@linas.org>
|
|
||||||
* Bjorn Reese <breese@imada.ou.dk>
|
|
||||||
* Johan Anderson <johan@homemail.com>
|
|
||||||
* Kjell Ericson <Kjell.Ericson@haxx.se>
|
|
||||||
* Troy Engel <tengel@palladium.net>
|
|
||||||
* Ryan Nelson <ryan@inch.com>
|
|
||||||
* Bjorn Stenberg <Bjorn.Stenberg@haxx.se>
|
|
||||||
* Angus Mackay <amackay@gus.ml.org>
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* $Log$
|
|
||||||
* Revision 1.3 2000-06-20 15:31:26 bagder
|
|
||||||
* haxx.nu => haxx.se
|
|
||||||
*
|
|
||||||
* Revision 1.2 2000/01/10 23:36:14 bagder
|
|
||||||
* syncing with local edit
|
|
||||||
*
|
|
||||||
* Revision 1.3 1999/09/06 06:59:40 dast
|
|
||||||
* Changed email info
|
|
||||||
*
|
|
||||||
* Revision 1.2 1999/08/13 07:34:48 dast
|
|
||||||
* Changed the URL in the header
|
|
||||||
*
|
|
||||||
* Revision 1.1.1.1 1999/03/11 22:23:34 dast
|
|
||||||
* Imported sources
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* Unix and Win32 getenv function call */
|
#include <curl/curl.h>
|
||||||
char *GetEnv(char *variable);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
110
lib/getinfo.c
Normal file
110
lib/getinfo.c
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
|
*
|
||||||
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "setup.h"
|
||||||
|
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
#include "urldata.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
CURLcode curl_getinfo(CURL *curl, CURLINFO info, ...)
|
||||||
|
{
|
||||||
|
va_list arg;
|
||||||
|
long *param_longp;
|
||||||
|
double *param_doublep;
|
||||||
|
char **param_charp;
|
||||||
|
struct UrlData *data = (struct UrlData *)curl;
|
||||||
|
va_start(arg, info);
|
||||||
|
|
||||||
|
switch(info&CURLINFO_TYPEMASK) {
|
||||||
|
default:
|
||||||
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
|
case CURLINFO_STRING:
|
||||||
|
param_charp = va_arg(arg, char **);
|
||||||
|
if(NULL == param_charp)
|
||||||
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
|
break;
|
||||||
|
case CURLINFO_LONG:
|
||||||
|
param_longp = va_arg(arg, long *);
|
||||||
|
if(NULL == param_longp)
|
||||||
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
|
break;
|
||||||
|
case CURLINFO_DOUBLE:
|
||||||
|
param_doublep = va_arg(arg, double *);
|
||||||
|
if(NULL == param_doublep)
|
||||||
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(info) {
|
||||||
|
case CURLINFO_EFFECTIVE_URL:
|
||||||
|
*param_charp = data->url?data->url:"";
|
||||||
|
break;
|
||||||
|
case CURLINFO_HTTP_CODE:
|
||||||
|
*param_longp = data->progress.httpcode;
|
||||||
|
break;
|
||||||
|
case CURLINFO_FILETIME:
|
||||||
|
*param_longp = data->progress.filetime;
|
||||||
|
break;
|
||||||
|
case CURLINFO_HEADER_SIZE:
|
||||||
|
*param_longp = data->header_size;
|
||||||
|
break;
|
||||||
|
case CURLINFO_REQUEST_SIZE:
|
||||||
|
*param_longp = data->request_size;
|
||||||
|
break;
|
||||||
|
case CURLINFO_TOTAL_TIME:
|
||||||
|
*param_doublep = data->progress.timespent;
|
||||||
|
break;
|
||||||
|
case CURLINFO_NAMELOOKUP_TIME:
|
||||||
|
*param_doublep = data->progress.t_nslookup;
|
||||||
|
break;
|
||||||
|
case CURLINFO_CONNECT_TIME:
|
||||||
|
*param_doublep = data->progress.t_connect;
|
||||||
|
break;
|
||||||
|
case CURLINFO_PRETRANSFER_TIME:
|
||||||
|
*param_doublep = data->progress.t_pretransfer;
|
||||||
|
break;
|
||||||
|
case CURLINFO_SIZE_UPLOAD:
|
||||||
|
*param_doublep = data->progress.uploaded;
|
||||||
|
break;
|
||||||
|
case CURLINFO_SIZE_DOWNLOAD:
|
||||||
|
*param_doublep = data->progress.downloaded;
|
||||||
|
break;
|
||||||
|
case CURLINFO_SPEED_DOWNLOAD:
|
||||||
|
*param_doublep = data->progress.dlspeed;
|
||||||
|
break;
|
||||||
|
case CURLINFO_SPEED_UPLOAD:
|
||||||
|
*param_doublep = data->progress.ulspeed;
|
||||||
|
break;
|
||||||
|
case CURLINFO_SSL_VERIFYRESULT:
|
||||||
|
*param_longp = data->ssl.certverifyresult;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
|
}
|
||||||
|
return CURLE_OK;
|
||||||
|
}
|
||||||
@@ -4,10 +4,11 @@
|
|||||||
* Redistribution and use are freely permitted provided that:
|
* Redistribution and use are freely permitted provided that:
|
||||||
*
|
*
|
||||||
* 1) This header remain in tact.
|
* 1) This header remain in tact.
|
||||||
* 2) The prototype for getpass is not changed from:
|
* 2) The prototypes for getpass and getpass_r are not changed from:
|
||||||
* char *getpass(const char *prompt)
|
* char *getpass(const char *prompt)
|
||||||
|
* char *getpass_r(const char *prompt, char* buffer, int buflen)
|
||||||
* 3) This source code is not used outside of this(getpass.c) file.
|
* 3) This source code is not used outside of this(getpass.c) file.
|
||||||
* 3) Any changes to this(getpass.c) source code are made publicly available.
|
* 4) Any changes to this(getpass.c) source code are made publicly available.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
||||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
@@ -34,19 +35,19 @@
|
|||||||
* Daniel Stenberg <daniel@haxx.se>
|
* Daniel Stenberg <daniel@haxx.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_GETPASS_R
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
#ifdef HAVE_TERMIOS_H
|
#ifdef HAVE_TERMIOS_H
|
||||||
# if !defined(HAVE_TCGETATTR) && !defined(HAVE_TCSETATTR)
|
# if !defined(HAVE_TCGETATTR) && !defined(HAVE_TCSETATTR)
|
||||||
# undef HAVE_TERMIOS_H
|
# undef HAVE_TERMIOS_H
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define INPUT_BUFFER 128
|
|
||||||
|
|
||||||
#ifndef RETSIGTYPE
|
#ifndef RETSIGTYPE
|
||||||
# define RETSIGTYPE void
|
# define RETSIGTYPE void
|
||||||
#endif
|
#endif
|
||||||
@@ -70,11 +71,10 @@
|
|||||||
# define perror(x) fprintf(stderr, "Error in: %s\n", x)
|
# define perror(x) fprintf(stderr, "Error in: %s\n", x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *getpass(const char *prompt)
|
char *getpass_r(const char *prompt, char *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
FILE *infp;
|
FILE *infp;
|
||||||
FILE *outfp;
|
FILE *outfp;
|
||||||
static char buf[INPUT_BUFFER];
|
|
||||||
RETSIGTYPE (*sigint)();
|
RETSIGTYPE (*sigint)();
|
||||||
#ifndef __EMX__
|
#ifndef __EMX__
|
||||||
RETSIGTYPE (*sigtstp)();
|
RETSIGTYPE (*sigtstp)();
|
||||||
@@ -115,25 +115,25 @@ char *getpass(const char *prompt)
|
|||||||
#ifdef HAVE_TERMIOS_H
|
#ifdef HAVE_TERMIOS_H
|
||||||
if(tcgetattr(outfd, &orig) != 0)
|
if(tcgetattr(outfd, &orig) != 0)
|
||||||
{
|
{
|
||||||
perror("tcgetattr");
|
; /*perror("tcgetattr");*/
|
||||||
}
|
}
|
||||||
noecho = orig;
|
noecho = orig;
|
||||||
noecho.c_lflag &= ~ECHO;
|
noecho.c_lflag &= ~ECHO;
|
||||||
if(tcsetattr(outfd, TCSANOW, &noecho) != 0)
|
if(tcsetattr(outfd, TCSANOW, &noecho) != 0)
|
||||||
{
|
{
|
||||||
perror("tcgetattr");
|
; /*perror("tcgetattr");*/
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# ifdef HAVE_TERMIO_H
|
# ifdef HAVE_TERMIO_H
|
||||||
if(ioctl(outfd, TCGETA, &orig) != 0)
|
if(ioctl(outfd, TCGETA, &orig) != 0)
|
||||||
{
|
{
|
||||||
perror("ioctl");
|
; /*perror("ioctl");*/
|
||||||
}
|
}
|
||||||
noecho = orig;
|
noecho = orig;
|
||||||
noecho.c_lflag &= ~ECHO;
|
noecho.c_lflag &= ~ECHO;
|
||||||
if(ioctl(outfd, TCSETA, &noecho) != 0)
|
if(ioctl(outfd, TCSETA, &noecho) != 0)
|
||||||
{
|
{
|
||||||
perror("ioctl");
|
; /*perror("ioctl");*/
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
# endif
|
# endif
|
||||||
@@ -142,8 +142,8 @@ char *getpass(const char *prompt)
|
|||||||
fputs(prompt, outfp);
|
fputs(prompt, outfp);
|
||||||
fflush(outfp);
|
fflush(outfp);
|
||||||
|
|
||||||
bytes_read=read(infd, buf, INPUT_BUFFER);
|
bytes_read=read(infd, buffer, buflen);
|
||||||
buf[bytes_read > 0 ? (bytes_read -1) : 0] = '\0';
|
buffer[bytes_read > 0 ? (bytes_read -1) : 0] = '\0';
|
||||||
|
|
||||||
/* print a new line if needed */
|
/* print a new line if needed */
|
||||||
#ifdef HAVE_TERMIOS_H
|
#ifdef HAVE_TERMIOS_H
|
||||||
@@ -157,18 +157,18 @@ char *getpass(const char *prompt)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* reset term charectaristics, use TCSAFLUSH incase the
|
* reset term charectaristics, use TCSAFLUSH incase the
|
||||||
* user types more than INPUT_BUFFER
|
* user types more than buflen
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_TERMIOS_H
|
#ifdef HAVE_TERMIOS_H
|
||||||
if(tcsetattr(outfd, TCSAFLUSH, &orig) != 0)
|
if(tcsetattr(outfd, TCSAFLUSH, &orig) != 0)
|
||||||
{
|
{
|
||||||
perror("tcgetattr");
|
; /*perror("tcgetattr");*/
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# ifdef HAVE_TERMIO_H
|
# ifdef HAVE_TERMIO_H
|
||||||
if(ioctl(outfd, TCSETA, &orig) != 0)
|
if(ioctl(outfd, TCSETA, &orig) != 0)
|
||||||
{
|
{
|
||||||
perror("ioctl");
|
; /*perror("ioctl");*/
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
# endif
|
# endif
|
||||||
@@ -179,15 +179,38 @@ char *getpass(const char *prompt)
|
|||||||
signal(SIGTSTP, sigtstp);
|
signal(SIGTSTP, sigtstp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return(buf);
|
return buffer; /* we always return success */
|
||||||
}
|
}
|
||||||
#else
|
#else /* WIN32 */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <conio.h>
|
||||||
|
char *getpass_r(const char *prompt, char *buffer, int buflen)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
printf("%s", prompt);
|
||||||
|
|
||||||
|
for(i=0; i<buflen; i++) {
|
||||||
|
buffer[i] = getch();
|
||||||
|
if ( buffer[i] == '\r' ) {
|
||||||
|
buffer[i] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* if user didn't hit ENTER, terminate buffer */
|
||||||
|
if (i==buflen)
|
||||||
|
buffer[buflen-1]=0;
|
||||||
|
|
||||||
|
return buffer; /* we always return success */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* ifndef HAVE_GETPASS_R */
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* for consistensy, here's the old-style function: */
|
||||||
char *getpass(const char *prompt)
|
char *getpass(const char *prompt)
|
||||||
{
|
{
|
||||||
static char password[80];
|
static char buf[256];
|
||||||
printf(prompt);
|
return getpass_r(prompt, buf, sizeof(buf));
|
||||||
gets(password);
|
|
||||||
return password;
|
|
||||||
}
|
}
|
||||||
#endif /* don't do anything if WIN32 */
|
#endif
|
||||||
|
|||||||
@@ -1 +1,35 @@
|
|||||||
char *getpass(const char *prompt);
|
#ifndef __GETPASS_H
|
||||||
|
#define __GETPASS_H
|
||||||
|
/*****************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
|
*
|
||||||
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*****************************************************************************/
|
||||||
|
#ifndef HAVE_GETPASS_R
|
||||||
|
/* If there's a system-provided function named like this, we trust it is
|
||||||
|
also found in one of the standard headers. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returning NULL will abort the continued operation!
|
||||||
|
*/
|
||||||
|
char* getpass_r(char *prompt, char* buffer, size_t buflen );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
#ifndef __HIGHLEVEL_H
|
|
||||||
#define __HIGHLEVEL_H
|
|
||||||
/*****************************************************************************
|
|
||||||
* _ _ ____ _
|
|
||||||
* Project ___| | | | _ \| |
|
|
||||||
* / __| | | | |_) | |
|
|
||||||
* | (__| |_| | _ <| |___
|
|
||||||
* \___|\___/|_| \_\_____|
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
|
||||||
* The Original Code is Curl.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
|
||||||
*
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
CURLcode curl_transfer(CURL *curl);
|
|
||||||
#endif
|
|
||||||
99
lib/hostip.c
99
lib/hostip.c
@@ -5,43 +5,25 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#define _REENTRANT
|
#define _REENTRANT
|
||||||
@@ -73,9 +55,14 @@
|
|||||||
#include "inet_ntoa_r.h"
|
#include "inet_ntoa_r.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* The last #include file should be: */
|
||||||
|
#ifdef MALLOCDEBUG
|
||||||
|
#include "memdebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* --- resolve name or IP-number --- */
|
/* --- resolve name or IP-number --- */
|
||||||
|
|
||||||
char *MakeIP(unsigned long num,char *addr, int addr_len)
|
static char *MakeIP(unsigned long num,char *addr, int addr_len)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_INET_NTOA) || defined(HAVE_INET_NTOA_R)
|
#if defined(HAVE_INET_NTOA) || defined(HAVE_INET_NTOA_R)
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
@@ -96,19 +83,32 @@ char *MakeIP(unsigned long num,char *addr, int addr_len)
|
|||||||
return (addr);
|
return (addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The original code to this function was stolen from the Dancer source code,
|
/* The original code to this function was once stolen from the Dancer source
|
||||||
written by Bjorn Reese, it has since been patched and modified. */
|
code, written by Bjorn Reese, it has since been patched and modified
|
||||||
|
considerably. */
|
||||||
|
|
||||||
#ifndef INADDR_NONE
|
#ifndef INADDR_NONE
|
||||||
#define INADDR_NONE (unsigned long) ~0
|
#define INADDR_NONE (unsigned long) ~0
|
||||||
#endif
|
#endif
|
||||||
struct hostent *GetHost(struct UrlData *data,
|
|
||||||
|
struct hostent *Curl_gethost(struct UrlData *data,
|
||||||
char *hostname,
|
char *hostname,
|
||||||
char *buf,
|
char **bufp)
|
||||||
int buf_size )
|
|
||||||
{
|
{
|
||||||
struct hostent *h = NULL;
|
struct hostent *h = NULL;
|
||||||
unsigned long in;
|
unsigned long in;
|
||||||
int ret;
|
int ret; /* this variable is unused on several platforms but used on some */
|
||||||
|
|
||||||
|
#define CURL_NAMELOOKUP_SIZE 9000
|
||||||
|
|
||||||
|
/* Allocate enough memory to hold the full name information structs and
|
||||||
|
* everything. OSF1 is known to require at least 8872 bytes. The buffer
|
||||||
|
* required for storing all possible aliases and IP numbers is according to
|
||||||
|
* Stevens' Unix Network Programming 2nd editor, p. 304: 8192 bytes! */
|
||||||
|
char *buf = (char *)malloc(CURL_NAMELOOKUP_SIZE);
|
||||||
|
if(!buf)
|
||||||
|
return NULL; /* major failure */
|
||||||
|
*bufp = buf;
|
||||||
|
|
||||||
if ( (in=inet_addr(hostname)) != INADDR_NONE ) {
|
if ( (in=inet_addr(hostname)) != INADDR_NONE ) {
|
||||||
struct in_addr *addrentry;
|
struct in_addr *addrentry;
|
||||||
@@ -123,18 +123,20 @@ struct hostent *GetHost(struct UrlData *data,
|
|||||||
h->h_length = sizeof(*addrentry);
|
h->h_length = sizeof(*addrentry);
|
||||||
h->h_name = *(h->h_addr_list) + h->h_length;
|
h->h_name = *(h->h_addr_list) + h->h_length;
|
||||||
/* bad one h->h_name = (char*)(h->h_addr_list + h->h_length); */
|
/* bad one h->h_name = (char*)(h->h_addr_list + h->h_length); */
|
||||||
MakeIP(ntohl(in),h->h_name,buf_size - (long)(h->h_name) + (long)buf);
|
MakeIP(ntohl(in),h->h_name, CURL_NAMELOOKUP_SIZE - (long)(h->h_name) + (long)buf);
|
||||||
}
|
}
|
||||||
#if defined(HAVE_GETHOSTBYNAME_R)
|
#if defined(HAVE_GETHOSTBYNAME_R)
|
||||||
else {
|
else {
|
||||||
int h_errnop;
|
int h_errnop;
|
||||||
memset(buf,0,buf_size); /* workaround for gethostbyname_r bug in qnx nto */
|
/* Workaround for gethostbyname_r bug in qnx nto. It is also _required_
|
||||||
|
for some of these functions. */
|
||||||
|
memset(buf, 0, CURL_NAMELOOKUP_SIZE);
|
||||||
#ifdef HAVE_GETHOSTBYNAME_R_5
|
#ifdef HAVE_GETHOSTBYNAME_R_5
|
||||||
/* Solaris, IRIX and more */
|
/* Solaris, IRIX and more */
|
||||||
if ((h = gethostbyname_r(hostname,
|
if ((h = gethostbyname_r(hostname,
|
||||||
(struct hostent *)buf,
|
(struct hostent *)buf,
|
||||||
buf + sizeof(struct hostent),
|
buf + sizeof(struct hostent),
|
||||||
buf_size - sizeof(struct hostent),
|
CURL_NAMELOOKUP_SIZE - sizeof(struct hostent),
|
||||||
&h_errnop)) == NULL )
|
&h_errnop)) == NULL )
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_GETHOSTBYNAME_R_6
|
#ifdef HAVE_GETHOSTBYNAME_R_6
|
||||||
@@ -142,21 +144,25 @@ struct hostent *GetHost(struct UrlData *data,
|
|||||||
if( gethostbyname_r(hostname,
|
if( gethostbyname_r(hostname,
|
||||||
(struct hostent *)buf,
|
(struct hostent *)buf,
|
||||||
buf + sizeof(struct hostent),
|
buf + sizeof(struct hostent),
|
||||||
buf_size - sizeof(struct hostent),
|
CURL_NAMELOOKUP_SIZE - sizeof(struct hostent),
|
||||||
&h, /* DIFFERENCE */
|
&h, /* DIFFERENCE */
|
||||||
&h_errnop))
|
&h_errnop))
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_GETHOSTBYNAME_R_3
|
#ifdef HAVE_GETHOSTBYNAME_R_3
|
||||||
/* AIX, Digital Unix, HPUX 10, more? */
|
/* AIX, Digital Unix, HPUX 10, more? */
|
||||||
|
|
||||||
/* August 4th, 2000. I don't have any such system around so I write this
|
if(CURL_NAMELOOKUP_SIZE >=
|
||||||
blindly in hope it might work or that someone else will help me fix
|
(sizeof(struct hostent)+sizeof(struct hostent_data)))
|
||||||
this. August 22nd, 2000: Albert Chin-A-Young brought an updated version
|
|
||||||
that should work! */
|
/* August 22nd, 2000: Albert Chin-A-Young brought an updated version
|
||||||
|
* that should work! September 20: Richard Prescott worked on the buffer
|
||||||
|
* size dilemma. */
|
||||||
|
|
||||||
ret = gethostbyname_r(hostname,
|
ret = gethostbyname_r(hostname,
|
||||||
(struct hostent *)buf,
|
(struct hostent *)buf,
|
||||||
(struct hostent_data *)(buf + sizeof(struct hostent)));
|
(struct hostent_data *)(buf + sizeof(struct hostent)));
|
||||||
|
else
|
||||||
|
ret = -1; /* failure, too smallish buffer size */
|
||||||
|
|
||||||
/* result expected in h */
|
/* result expected in h */
|
||||||
h = (struct hostent*)buf;
|
h = (struct hostent*)buf;
|
||||||
@@ -165,11 +171,16 @@ struct hostent *GetHost(struct UrlData *data,
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
infof(data, "gethostbyname_r(2) failed for %s\n", hostname);
|
infof(data, "gethostbyname_r(2) failed for %s\n", hostname);
|
||||||
|
h = NULL; /* set return code to NULL */
|
||||||
|
free(buf);
|
||||||
|
*bufp=NULL;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
else {
|
else {
|
||||||
if ((h = gethostbyname(hostname)) == NULL ) {
|
if ((h = gethostbyname(hostname)) == NULL ) {
|
||||||
infof(data, "gethostbyname(2) failed for %s\n", hostname);
|
infof(data, "gethostbyname(2) failed for %s\n", hostname);
|
||||||
|
free(buf);
|
||||||
|
*bufp=NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
44
lib/hostip.h
44
lib/hostip.h
@@ -7,40 +7,24 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
extern struct hostent *GetHost(struct UrlData *data, char *hostname, char *buf, int buf_size );
|
struct hostent *Curl_gethost(struct UrlData *data,
|
||||||
extern char *MakeIP(unsigned long num,char *addr, int addr_len);
|
char *hostname,
|
||||||
|
char **bufp);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
466
lib/http.c
466
lib/http.c
@@ -5,38 +5,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
@@ -104,19 +87,160 @@
|
|||||||
|
|
||||||
#include "urldata.h"
|
#include "urldata.h"
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include "download.h"
|
#include "transfer.h"
|
||||||
#include "sendf.h"
|
#include "sendf.h"
|
||||||
#include "formdata.h"
|
#include "formdata.h"
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
#include "base64.h"
|
#include "base64.h"
|
||||||
#include "cookie.h"
|
#include "cookie.h"
|
||||||
#include "strequal.h"
|
#include "strequal.h"
|
||||||
#include "url.h"
|
|
||||||
#include "ssluse.h"
|
#include "ssluse.h"
|
||||||
|
|
||||||
#define _MPRINTF_REPLACE /* use our functions only */
|
#define _MPRINTF_REPLACE /* use our functions only */
|
||||||
#include <curl/mprintf.h>
|
#include <curl/mprintf.h>
|
||||||
|
|
||||||
|
/* The last #include file should be: */
|
||||||
|
#ifdef MALLOCDEBUG
|
||||||
|
#include "memdebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The add_buffer series of functions are used to build one large memory chunk
|
||||||
|
* from repeated function invokes. Used so that the entire HTTP request can
|
||||||
|
* be sent in one go.
|
||||||
|
*/
|
||||||
|
static CURLcode
|
||||||
|
add_buffer(send_buffer *in, void *inptr, size_t size);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* add_buffer_init() returns a fine buffer struct
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
send_buffer *add_buffer_init(void)
|
||||||
|
{
|
||||||
|
send_buffer *blonk;
|
||||||
|
blonk=(send_buffer *)malloc(sizeof(send_buffer));
|
||||||
|
if(blonk) {
|
||||||
|
memset(blonk, 0, sizeof(send_buffer));
|
||||||
|
return blonk;
|
||||||
|
}
|
||||||
|
return NULL; /* failed, go home */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* add_buffer_send() sends a buffer and frees all associated memory.
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
size_t add_buffer_send(int sockfd, struct connectdata *conn, send_buffer *in)
|
||||||
|
{
|
||||||
|
size_t amount;
|
||||||
|
if(conn->data->bits.verbose) {
|
||||||
|
fputs("> ", conn->data->err);
|
||||||
|
/* this data _may_ contain binary stuff */
|
||||||
|
fwrite(in->buffer, in->size_used, 1, conn->data->err);
|
||||||
|
}
|
||||||
|
|
||||||
|
Curl_write(conn, sockfd, in->buffer, in->size_used, &amount);
|
||||||
|
|
||||||
|
if(in->buffer)
|
||||||
|
free(in->buffer);
|
||||||
|
free(in);
|
||||||
|
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* add_bufferf() builds a buffer from the formatted input
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
CURLcode add_bufferf(send_buffer *in, char *fmt, ...)
|
||||||
|
{
|
||||||
|
CURLcode result = CURLE_OUT_OF_MEMORY;
|
||||||
|
char *s;
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
s = vaprintf(fmt, ap); /* this allocs a new string to append */
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
if(s) {
|
||||||
|
result = add_buffer(in, s, strlen(s));
|
||||||
|
free(s);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* add_buffer() appends a memory chunk to the existing one
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
CURLcode add_buffer(send_buffer *in, void *inptr, size_t size)
|
||||||
|
{
|
||||||
|
char *new_rb;
|
||||||
|
int new_size;
|
||||||
|
|
||||||
|
if(size > 0) {
|
||||||
|
if(!in->buffer ||
|
||||||
|
((in->size_used + size) > (in->size_max - 1))) {
|
||||||
|
new_size = (in->size_used+size)*2;
|
||||||
|
if(in->buffer)
|
||||||
|
/* we have a buffer, enlarge the existing one */
|
||||||
|
new_rb = (char *)realloc(in->buffer, new_size);
|
||||||
|
else
|
||||||
|
/* create a new buffer */
|
||||||
|
new_rb = (char *)malloc(new_size);
|
||||||
|
|
||||||
|
if(!new_rb)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
in->buffer = new_rb;
|
||||||
|
in->size_max = new_size;
|
||||||
|
}
|
||||||
|
memcpy(&in->buffer[in->size_used], inptr, size);
|
||||||
|
|
||||||
|
in->size_used += size;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CURLE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end of the add_buffer functions */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read everything until a newline.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static
|
||||||
|
int GetLine(int sockfd, char *buf, struct connectdata *conn)
|
||||||
|
{
|
||||||
|
size_t nread;
|
||||||
|
int read_rc=1;
|
||||||
|
char *ptr;
|
||||||
|
struct UrlData *data=conn->data;
|
||||||
|
|
||||||
|
ptr=buf;
|
||||||
|
|
||||||
|
/* get us a full line, terminated with a newline */
|
||||||
|
for(nread=0;
|
||||||
|
(nread<BUFSIZE) && read_rc;
|
||||||
|
nread++, ptr++) {
|
||||||
|
if((CURLE_OK != Curl_read(conn, sockfd, ptr, 1, &nread)) ||
|
||||||
|
(*ptr == '\n'))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*ptr=0; /* zero terminate */
|
||||||
|
|
||||||
|
if(data->bits.verbose) {
|
||||||
|
fputs("< ", data->err);
|
||||||
|
fwrite(buf, 1, nread, data->err);
|
||||||
|
fputs("\n", data->err);
|
||||||
|
}
|
||||||
|
return nread;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function checks the linked list of custom HTTP headers for a particular
|
* This function checks the linked list of custom HTTP headers for a particular
|
||||||
* header (prefix).
|
* header (prefix).
|
||||||
@@ -134,38 +258,35 @@ bool static checkheaders(struct UrlData *data, char *thisheader)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
CURLcode http_connect(struct connectdata *conn)
|
/*
|
||||||
{
|
* ConnectHTTPProxyTunnel() requires that we're connected to a HTTP proxy. This
|
||||||
struct UrlData *data;
|
* function will issue the necessary commands to get a seamless tunnel through
|
||||||
|
* this proxy. After that, the socket can be used just as a normal socket.
|
||||||
data=conn->data;
|
|
||||||
|
|
||||||
/* If we are not using a proxy and we want a secure connection,
|
|
||||||
* perform SSL initialization & connection now.
|
|
||||||
* If using a proxy with https, then we must tell the proxy to CONNECT
|
|
||||||
* us to the host we want to talk to. Only after the connect
|
|
||||||
* has occured, can we start talking SSL
|
|
||||||
*/
|
*/
|
||||||
if (conn->protocol & PROT_HTTPS) {
|
|
||||||
if (data->bits.httpproxy) {
|
|
||||||
|
|
||||||
/* OK, now send the connect statment */
|
CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
|
||||||
sendf(data->firstsocket, data,
|
int tunnelsocket,
|
||||||
|
char *hostname, int remote_port)
|
||||||
|
{
|
||||||
|
int httperror=0;
|
||||||
|
int subversion=0;
|
||||||
|
struct UrlData *data=conn->data;
|
||||||
|
|
||||||
|
infof(data, "Establish HTTP proxy tunnel to %s:%d\n", hostname, remote_port);
|
||||||
|
|
||||||
|
/* OK, now send the connect request to the proxy */
|
||||||
|
Curl_sendf(tunnelsocket, conn,
|
||||||
"CONNECT %s:%d HTTP/1.0\015\012"
|
"CONNECT %s:%d HTTP/1.0\015\012"
|
||||||
"%s"
|
"%s"
|
||||||
"%s"
|
"%s"
|
||||||
"\r\n",
|
"\r\n",
|
||||||
data->hostname, data->remote_port,
|
hostname, remote_port,
|
||||||
(data->bits.proxy_user_passwd)?data->ptr_proxyuserpwd:"",
|
(data->bits.proxy_user_passwd)?data->ptr_proxyuserpwd:"",
|
||||||
(data->useragent?data->ptr_uagent:"")
|
(data->useragent?data->ptr_uagent:"")
|
||||||
);
|
);
|
||||||
|
|
||||||
/* wait for the proxy to send us a HTTP/1.0 200 OK header */
|
/* wait for the proxy to send us a HTTP/1.0 200 OK header */
|
||||||
/* Daniel rewrote this part Nov 5 1998 to make it more obvious */
|
while(GetLine(tunnelsocket, data->buffer, conn)) {
|
||||||
{
|
|
||||||
int httperror=0;
|
|
||||||
int subversion=0;
|
|
||||||
while(GetLine(data->firstsocket, data->buffer, data)) {
|
|
||||||
if('\r' == data->buffer[0])
|
if('\r' == data->buffer[0])
|
||||||
break; /* end of headers */
|
break; /* end of headers */
|
||||||
if(2 == sscanf(data->buffer, "HTTP/1.%d %d",
|
if(2 == sscanf(data->buffer, "HTTP/1.%d %d",
|
||||||
@@ -182,15 +303,37 @@ CURLcode http_connect(struct connectdata *conn)
|
|||||||
failf(data, "Received error code %d from proxy", httperror);
|
failf(data, "Received error code %d from proxy", httperror);
|
||||||
return CURLE_READ_ERROR;
|
return CURLE_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
infof (data, "Proxy replied to CONNECT request\n");
|
||||||
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
infof (data, "Proxy has replied to CONNECT request\n");
|
|
||||||
|
CURLcode Curl_http_connect(struct connectdata *conn)
|
||||||
|
{
|
||||||
|
struct UrlData *data;
|
||||||
|
CURLcode result;
|
||||||
|
|
||||||
|
data=conn->data;
|
||||||
|
|
||||||
|
/* If we are not using a proxy and we want a secure connection,
|
||||||
|
* perform SSL initialization & connection now.
|
||||||
|
* If using a proxy with https, then we must tell the proxy to CONNECT
|
||||||
|
* us to the host we want to talk to. Only after the connect
|
||||||
|
* has occured, can we start talking SSL
|
||||||
|
*/
|
||||||
|
if (conn->protocol & PROT_HTTPS) {
|
||||||
|
if (data->bits.httpproxy) {
|
||||||
|
/* HTTPS through a proxy can only be done with a tunnel */
|
||||||
|
result = Curl_ConnectHTTPProxyTunnel(conn, data->firstsocket,
|
||||||
|
data->hostname, data->remote_port);
|
||||||
|
if(CURLE_OK != result)
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now, perform the SSL initialization for this socket */
|
/* now, perform the SSL initialization for this socket */
|
||||||
if(UrgSSLConnect (data)) {
|
if(Curl_SSLConnect(data))
|
||||||
return CURLE_SSL_CONNECT_ERROR;
|
return CURLE_SSL_CONNECT_ERROR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(data->bits.user_passwd && !data->bits.this_is_a_follow) {
|
if(data->bits.user_passwd && !data->bits.this_is_a_follow) {
|
||||||
/* Authorization: is requested, this is not a followed location, get the
|
/* Authorization: is requested, this is not a followed location, get the
|
||||||
@@ -203,14 +346,14 @@ CURLcode http_connect(struct connectdata *conn)
|
|||||||
|
|
||||||
/* called from curl_close() when this struct is about to get wasted, free
|
/* called from curl_close() when this struct is about to get wasted, free
|
||||||
protocol-specific resources */
|
protocol-specific resources */
|
||||||
CURLcode http_close(struct connectdata *conn)
|
CURLcode Curl_http_close(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
if(conn->data->auth_host)
|
if(conn->data->auth_host)
|
||||||
free(conn->data->auth_host);
|
free(conn->data->auth_host);
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
CURLcode http_done(struct connectdata *conn)
|
CURLcode Curl_http_done(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
struct UrlData *data;
|
struct UrlData *data;
|
||||||
long *bytecount = &conn->bytecount;
|
long *bytecount = &conn->bytecount;
|
||||||
@@ -222,7 +365,7 @@ CURLcode http_done(struct connectdata *conn)
|
|||||||
if(data->bits.http_formpost) {
|
if(data->bits.http_formpost) {
|
||||||
*bytecount = http->readbytecount + http->writebytecount;
|
*bytecount = http->readbytecount + http->writebytecount;
|
||||||
|
|
||||||
FormFree(http->sendit); /* Now free that whole lot */
|
Curl_FormFree(http->sendit); /* Now free that whole lot */
|
||||||
|
|
||||||
data->fread = http->storefread; /* restore */
|
data->fread = http->storefread; /* restore */
|
||||||
data->in = http->in; /* restore */
|
data->in = http->in; /* restore */
|
||||||
@@ -231,13 +374,14 @@ CURLcode http_done(struct connectdata *conn)
|
|||||||
*bytecount = http->readbytecount + http->writebytecount;
|
*bytecount = http->readbytecount + http->writebytecount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TBD: the HTTP struct remains allocated here */
|
free(http);
|
||||||
|
data->proto.http=NULL; /* it is gone */
|
||||||
|
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CURLcode http(struct connectdata *conn)
|
CURLcode Curl_http(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
struct UrlData *data=conn->data;
|
struct UrlData *data=conn->data;
|
||||||
char *buf = data->buffer; /* this is a short cut to the buffer */
|
char *buf = data->buffer; /* this is a short cut to the buffer */
|
||||||
@@ -269,7 +413,7 @@ CURLcode http(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if((data->bits.user_passwd) && !checkheaders(data, "Authorization:")) {
|
if((data->bits.user_passwd) && !checkheaders(data, "Authorization:")) {
|
||||||
char authorization[512];
|
char *authorization;
|
||||||
|
|
||||||
/* To prevent the user+password to get sent to other than the original
|
/* To prevent the user+password to get sent to other than the original
|
||||||
host due to a location-follow, we do some weirdo checks here */
|
host due to a location-follow, we do some weirdo checks here */
|
||||||
@@ -277,39 +421,45 @@ CURLcode http(struct connectdata *conn)
|
|||||||
!data->auth_host ||
|
!data->auth_host ||
|
||||||
strequal(data->auth_host, data->hostname)) {
|
strequal(data->auth_host, data->hostname)) {
|
||||||
sprintf(data->buffer, "%s:%s", data->user, data->passwd);
|
sprintf(data->buffer, "%s:%s", data->user, data->passwd);
|
||||||
base64Encode(data->buffer, authorization);
|
if(Curl_base64_encode(data->buffer, strlen(data->buffer),
|
||||||
data->ptr_userpwd = maprintf( "Authorization: Basic %s\015\012",
|
&authorization) >= 0) {
|
||||||
|
data->ptr_userpwd = aprintf( "Authorization: Basic %s\015\012",
|
||||||
authorization);
|
authorization);
|
||||||
|
free(authorization);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((data->bits.set_range) && !checkheaders(data, "Range:")) {
|
|
||||||
data->ptr_rangeline = maprintf("Range: bytes=%s\015\012", data->range);
|
|
||||||
}
|
}
|
||||||
if((data->bits.http_set_referer) && !checkheaders(data, "Referer:")) {
|
if((data->bits.http_set_referer) && !checkheaders(data, "Referer:")) {
|
||||||
data->ptr_ref = maprintf("Referer: %s\015\012", data->referer);
|
data->ptr_ref = aprintf("Referer: %s\015\012", data->referer);
|
||||||
}
|
}
|
||||||
if(data->cookie && !checkheaders(data, "Cookie:")) {
|
if(data->cookie && !checkheaders(data, "Cookie:")) {
|
||||||
data->ptr_cookie = maprintf("Cookie: %s\015\012", data->cookie);
|
data->ptr_cookie = aprintf("Cookie: %s\015\012", data->cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data->cookies) {
|
if(data->cookies) {
|
||||||
co = cookie_getlist(data->cookies,
|
co = Curl_cookie_getlist(data->cookies,
|
||||||
host,
|
host,
|
||||||
ppath,
|
ppath,
|
||||||
conn->protocol&PROT_HTTPS?TRUE:FALSE);
|
conn->protocol&PROT_HTTPS?TRUE:FALSE);
|
||||||
}
|
}
|
||||||
if ((data->bits.httpproxy) && !(conn->protocol&PROT_HTTPS)) {
|
if ((data->bits.httpproxy) && !(conn->protocol&PROT_HTTPS)) {
|
||||||
/* The path sent to the proxy is in fact the entire URL */
|
/* The path sent to the proxy is in fact the entire URL */
|
||||||
strncpy(ppath, data->url, URL_MAX_LENGTH-1);
|
ppath = data->url;
|
||||||
}
|
}
|
||||||
if(data->bits.http_formpost) {
|
if(data->bits.http_formpost) {
|
||||||
/* we must build the whole darned post sequence first, so that we have
|
/* we must build the whole darned post sequence first, so that we have
|
||||||
a size of the whole shebang before we start to send it */
|
a size of the whole shebang before we start to send it */
|
||||||
http->sendit = getFormData(data->httppost, &http->postsize);
|
http->sendit = Curl_getFormData(data->httppost, &http->postsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!checkheaders(data, "Host:")) {
|
if(!checkheaders(data, "Host:")) {
|
||||||
data->ptr_host = maprintf("Host: %s:%d\r\n", host, data->remote_port);
|
if(((conn->protocol&PROT_HTTPS) && (data->remote_port == PORT_HTTPS)) ||
|
||||||
|
(!(conn->protocol&PROT_HTTPS) && (data->remote_port == PORT_HTTP)) )
|
||||||
|
/* If (HTTPS on port 443) OR (non-HTTPS on port 80) then don't include
|
||||||
|
the port number in the host string */
|
||||||
|
data->ptr_host = aprintf("Host: %s\r\n", host);
|
||||||
|
else
|
||||||
|
data->ptr_host = aprintf("Host: %s:%d\r\n", host, data->remote_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!checkheaders(data, "Pragma:"))
|
if(!checkheaders(data, "Pragma:"))
|
||||||
@@ -318,9 +468,101 @@ CURLcode http(struct connectdata *conn)
|
|||||||
if(!checkheaders(data, "Accept:"))
|
if(!checkheaders(data, "Accept:"))
|
||||||
http->p_accept = "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*\r\n";
|
http->p_accept = "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*\r\n";
|
||||||
|
|
||||||
|
if((data->bits.http_post ||
|
||||||
|
data->bits.http_formpost ||
|
||||||
|
data->bits.http_put) &&
|
||||||
|
data->resume_from) {
|
||||||
|
/**********************************************************************
|
||||||
|
* Resuming upload in HTTP means that we PUT or POST and that we have
|
||||||
|
* got a resume_from value set. The resume value has already created
|
||||||
|
* a Range: header that will be passed along. We need to "fast forward"
|
||||||
|
* the file the given number of bytes and decrease the assume upload
|
||||||
|
* file size before we continue this venture in the dark lands of HTTP.
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
|
if(data->resume_from < 0 ) {
|
||||||
|
/*
|
||||||
|
* This is meant to get the size of the present remote-file by itself.
|
||||||
|
* We don't support this now. Bail out!
|
||||||
|
*/
|
||||||
|
data->resume_from = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data->resume_from) {
|
||||||
|
/* do we still game? */
|
||||||
|
int passed=0;
|
||||||
|
|
||||||
|
/* Now, let's read off the proper amount of bytes from the
|
||||||
|
input. If we knew it was a proper file we could've just
|
||||||
|
fseek()ed but we only have a stream here */
|
||||||
do {
|
do {
|
||||||
|
int readthisamountnow = (data->resume_from - passed);
|
||||||
|
int actuallyread;
|
||||||
|
|
||||||
|
if(readthisamountnow > BUFSIZE)
|
||||||
|
readthisamountnow = BUFSIZE;
|
||||||
|
|
||||||
|
actuallyread =
|
||||||
|
data->fread(data->buffer, 1, readthisamountnow, data->in);
|
||||||
|
|
||||||
|
passed += actuallyread;
|
||||||
|
if(actuallyread != readthisamountnow) {
|
||||||
|
failf(data, "Could only read %d bytes from the input\n",
|
||||||
|
passed);
|
||||||
|
return CURLE_READ_ERROR;
|
||||||
|
}
|
||||||
|
} while(passed != data->resume_from); /* loop until done */
|
||||||
|
|
||||||
|
/* now, decrease the size of the read */
|
||||||
|
if(data->infilesize>0) {
|
||||||
|
data->infilesize -= data->resume_from;
|
||||||
|
|
||||||
|
if(data->infilesize <= 0) {
|
||||||
|
failf(data, "File already completely uploaded\n");
|
||||||
|
return CURLE_PARTIAL_FILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* we've passed, proceed as normal */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(data->bits.set_range) {
|
||||||
|
/*
|
||||||
|
* A range is selected. We use different headers whether we're downloading
|
||||||
|
* or uploading and we always let customized headers override our internal
|
||||||
|
* ones if any such are specified.
|
||||||
|
*/
|
||||||
|
if((data->httpreq == HTTPREQ_GET) &&
|
||||||
|
!checkheaders(data, "Range:")) {
|
||||||
|
data->ptr_rangeline = aprintf("Range: bytes=%s\r\n", data->range);
|
||||||
|
}
|
||||||
|
else if((data->httpreq != HTTPREQ_GET) &&
|
||||||
|
!checkheaders(data, "Content-Range:")) {
|
||||||
|
|
||||||
|
if(data->resume_from) {
|
||||||
|
/* This is because "resume" was selected */
|
||||||
|
long total_expected_size= data->resume_from + data->infilesize;
|
||||||
|
data->ptr_rangeline = aprintf("Content-Range: bytes %s%ld/%ld\r\n",
|
||||||
|
data->range, total_expected_size-1,
|
||||||
|
total_expected_size);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* Range was selected and then we just pass the incoming range and
|
||||||
|
append total size */
|
||||||
|
data->ptr_rangeline = aprintf("Content-Range: bytes %s/%d\r\n",
|
||||||
|
data->range, data->infilesize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
send_buffer *req_buffer;
|
||||||
struct curl_slist *headers=data->headers;
|
struct curl_slist *headers=data->headers;
|
||||||
sendf(data->firstsocket, data,
|
|
||||||
|
/* initialize a dynamic send-buffer */
|
||||||
|
req_buffer = add_buffer_init();
|
||||||
|
|
||||||
|
/* add the main request stuff */
|
||||||
|
add_bufferf(req_buffer,
|
||||||
"%s " /* GET/HEAD/POST/PUT */
|
"%s " /* GET/HEAD/POST/PUT */
|
||||||
"%s HTTP/1.0\r\n" /* path */
|
"%s HTTP/1.0\r\n" /* path */
|
||||||
"%s" /* proxyuserpwd */
|
"%s" /* proxyuserpwd */
|
||||||
@@ -351,25 +593,23 @@ CURLcode http(struct connectdata *conn)
|
|||||||
|
|
||||||
if(co) {
|
if(co) {
|
||||||
int count=0;
|
int count=0;
|
||||||
|
struct Cookie *store=co;
|
||||||
/* now loop through all cookies that matched */
|
/* now loop through all cookies that matched */
|
||||||
while(co) {
|
while(co) {
|
||||||
if(co->value && strlen(co->value)) {
|
if(co->value && strlen(co->value)) {
|
||||||
if(0 == count) {
|
if(0 == count) {
|
||||||
sendf(data->firstsocket, data,
|
add_bufferf(req_buffer, "Cookie: ");
|
||||||
"Cookie:");
|
|
||||||
}
|
}
|
||||||
sendf(data->firstsocket, data,
|
add_bufferf(req_buffer,
|
||||||
"%s%s=%s", count?"; ":"", co->name,
|
"%s%s=%s", count?"; ":"", co->name, co->value);
|
||||||
co->value);
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
co = co->next; /* next cookie please */
|
co = co->next; /* next cookie please */
|
||||||
}
|
}
|
||||||
if(count) {
|
if(count) {
|
||||||
sendf(data->firstsocket, data,
|
add_buffer(req_buffer, "\r\n", 2);
|
||||||
"\r\n");
|
|
||||||
}
|
}
|
||||||
cookie_freelist(co); /* free the cookie list */
|
Curl_cookie_freelist(store); /* free the cookie list */
|
||||||
co=NULL;
|
co=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,15 +638,15 @@ CURLcode http(struct connectdata *conn)
|
|||||||
switch(data->timecondition) {
|
switch(data->timecondition) {
|
||||||
case TIMECOND_IFMODSINCE:
|
case TIMECOND_IFMODSINCE:
|
||||||
default:
|
default:
|
||||||
sendf(data->firstsocket, data,
|
add_bufferf(req_buffer,
|
||||||
"If-Modified-Since: %s\r\n", buf);
|
"If-Modified-Since: %s\r\n", buf);
|
||||||
break;
|
break;
|
||||||
case TIMECOND_IFUNMODSINCE:
|
case TIMECOND_IFUNMODSINCE:
|
||||||
sendf(data->firstsocket, data,
|
add_bufferf(req_buffer,
|
||||||
"If-Unmodified-Since: %s\r\n", buf);
|
"If-Unmodified-Since: %s\r\n", buf);
|
||||||
break;
|
break;
|
||||||
case TIMECOND_LASTMOD:
|
case TIMECOND_LASTMOD:
|
||||||
sendf(data->firstsocket, data,
|
add_bufferf(req_buffer,
|
||||||
"Last-Modified: %s\r\n", buf);
|
"Last-Modified: %s\r\n", buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -418,22 +658,20 @@ CURLcode http(struct connectdata *conn)
|
|||||||
/* we require a colon for this to be a true header */
|
/* we require a colon for this to be a true header */
|
||||||
|
|
||||||
ptr++; /* pass the colon */
|
ptr++; /* pass the colon */
|
||||||
while(*ptr && isspace(*ptr))
|
while(*ptr && isspace((int)*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
if(*ptr) {
|
if(*ptr) {
|
||||||
/* only send this if the contents was non-blank */
|
/* only send this if the contents was non-blank */
|
||||||
|
|
||||||
sendf(data->firstsocket, data,
|
add_bufferf(req_buffer, "%s\r\n", headers->data);
|
||||||
"%s\015\012",
|
|
||||||
headers->data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
headers = headers->next;
|
headers = headers->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data->bits.http_formpost) {
|
if(data->bits.http_formpost) {
|
||||||
if(FormInit(&http->form, http->sendit)) {
|
if(Curl_FormInit(&http->form, http->sendit)) {
|
||||||
failf(data, "Internal HTTP POST error!\n");
|
failf(data, "Internal HTTP POST error!\n");
|
||||||
return CURLE_HTTP_POST_ERROR;
|
return CURLE_HTTP_POST_ERROR;
|
||||||
}
|
}
|
||||||
@@ -443,22 +681,24 @@ CURLcode http(struct connectdata *conn)
|
|||||||
|
|
||||||
data->fread =
|
data->fread =
|
||||||
(size_t (*)(char *, size_t, size_t, FILE *))
|
(size_t (*)(char *, size_t, size_t, FILE *))
|
||||||
FormReader; /* set the read function to read from the
|
Curl_FormReader; /* set the read function to read from the
|
||||||
generated form data */
|
generated form data */
|
||||||
data->in = (FILE *)&http->form;
|
data->in = (FILE *)&http->form;
|
||||||
|
|
||||||
sendf(data->firstsocket, data,
|
add_bufferf(req_buffer,
|
||||||
"Content-Length: %d\r\n",
|
"Content-Length: %d\r\n", http->postsize-2);
|
||||||
http->postsize-2);
|
|
||||||
|
|
||||||
pgrsSetUploadSize(data, http->postsize);
|
/* set upload size to the progress meter */
|
||||||
|
Curl_pgrsSetUploadSize(data, http->postsize);
|
||||||
|
|
||||||
result = Transfer(conn, data->firstsocket, -1, TRUE,
|
data->request_size =
|
||||||
|
add_buffer_send(data->firstsocket, conn, req_buffer);
|
||||||
|
result = Curl_Transfer(conn, data->firstsocket, -1, TRUE,
|
||||||
&http->readbytecount,
|
&http->readbytecount,
|
||||||
data->firstsocket,
|
data->firstsocket,
|
||||||
&http->writebytecount);
|
&http->writebytecount);
|
||||||
if(result) {
|
if(result) {
|
||||||
FormFree(http->sendit); /* free that whole lot */
|
Curl_FormFree(http->sendit); /* free that whole lot */
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -466,17 +706,22 @@ CURLcode http(struct connectdata *conn)
|
|||||||
/* Let's PUT the data to the server! */
|
/* Let's PUT the data to the server! */
|
||||||
|
|
||||||
if(data->infilesize>0) {
|
if(data->infilesize>0) {
|
||||||
sendf(data->firstsocket, data,
|
add_bufferf(req_buffer,
|
||||||
"Content-Length: %d\r\n\r\n", /* file size */
|
"Content-Length: %d\r\n\r\n", /* file size */
|
||||||
data->infilesize );
|
data->infilesize );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sendf(data->firstsocket, data,
|
add_bufferf(req_buffer, "\015\012");
|
||||||
"\015\012");
|
|
||||||
|
|
||||||
pgrsSetUploadSize(data, data->infilesize);
|
/* set the upload size to the progress meter */
|
||||||
|
Curl_pgrsSetUploadSize(data, data->infilesize);
|
||||||
|
|
||||||
result = Transfer(conn, data->firstsocket, -1, TRUE,
|
/* this sends the buffer and frees all the buffer resources */
|
||||||
|
data->request_size =
|
||||||
|
add_buffer_send(data->firstsocket, conn, req_buffer);
|
||||||
|
|
||||||
|
/* prepare for transfer */
|
||||||
|
result = Curl_Transfer(conn, data->firstsocket, -1, TRUE,
|
||||||
&http->readbytecount,
|
&http->readbytecount,
|
||||||
data->firstsocket,
|
data->firstsocket,
|
||||||
&http->writebytecount);
|
&http->writebytecount);
|
||||||
@@ -491,31 +736,38 @@ CURLcode http(struct connectdata *conn)
|
|||||||
if(!checkheaders(data, "Content-Length:"))
|
if(!checkheaders(data, "Content-Length:"))
|
||||||
/* we allow replacing this header, although it isn't very wise to
|
/* we allow replacing this header, although it isn't very wise to
|
||||||
actually set your own */
|
actually set your own */
|
||||||
sendf(data->firstsocket, data,
|
add_bufferf(req_buffer,
|
||||||
"Content-Length: %d\r\n",
|
"Content-Length: %d\r\n",
|
||||||
(data->postfieldsize?data->postfieldsize:
|
(data->postfieldsize?data->postfieldsize:
|
||||||
strlen(data->postfields)) );
|
strlen(data->postfields)) );
|
||||||
|
|
||||||
if(!checkheaders(data, "Content-Type:"))
|
if(!checkheaders(data, "Content-Type:"))
|
||||||
sendf(data->firstsocket, data,
|
add_bufferf(req_buffer,
|
||||||
"Content-Type: application/x-www-form-urlencoded\r\n");
|
"Content-Type: application/x-www-form-urlencoded\r\n");
|
||||||
|
|
||||||
/* and here comes the actual data */
|
/* and here comes the actual data */
|
||||||
if(data->postfieldsize) {
|
if(data->postfieldsize) {
|
||||||
ssend(data->firstsocket, data, "\r\n", 2);
|
add_buffer(req_buffer, "\r\n", 2);
|
||||||
ssend(data->firstsocket, data, data->postfields, data->postfieldsize);
|
add_buffer(req_buffer, data->postfields,
|
||||||
ssend(data->firstsocket, data, "\r\n", 2);
|
data->postfieldsize);
|
||||||
|
add_buffer(req_buffer, "\r\n", 2);
|
||||||
}
|
}
|
||||||
sendf(data->firstsocket, data,
|
else {
|
||||||
|
add_bufferf(req_buffer,
|
||||||
"\r\n"
|
"\r\n"
|
||||||
"%s\r\n",
|
"%s\r\n",
|
||||||
data->postfields );
|
data->postfields );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sendf(data->firstsocket, data, "\r\n");
|
add_buffer(req_buffer, "\r\n", 2);
|
||||||
|
|
||||||
|
/* issue the request */
|
||||||
|
data->request_size =
|
||||||
|
add_buffer_send(data->firstsocket, conn, req_buffer);
|
||||||
|
|
||||||
/* HTTP GET/HEAD download: */
|
/* HTTP GET/HEAD download: */
|
||||||
result = Transfer(conn, data->firstsocket, -1, TRUE, bytecount,
|
result = Curl_Transfer(conn, data->firstsocket, -1, TRUE, bytecount,
|
||||||
-1, NULL); /* nothing to upload */
|
-1, NULL); /* nothing to upload */
|
||||||
}
|
}
|
||||||
if(result)
|
if(result)
|
||||||
|
|||||||
53
lib/http.h
53
lib/http.h
@@ -8,44 +8,31 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
/* ftp can use this as well */
|
||||||
* Main author:
|
CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
int tunnelsocket,
|
||||||
*
|
char *hostname, int remote_port);
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* protocol-specific functions set up to be called by the main engine */
|
/* protocol-specific functions set up to be called by the main engine */
|
||||||
|
CURLcode Curl_http(struct connectdata *conn);
|
||||||
CURLcode http(struct connectdata *conn);
|
CURLcode Curl_http_done(struct connectdata *conn);
|
||||||
CURLcode http_done(struct connectdata *conn);
|
CURLcode Curl_http_connect(struct connectdata *conn);
|
||||||
CURLcode http_connect(struct connectdata *conn);
|
CURLcode Curl_http_close(struct connectdata *conn);
|
||||||
CURLcode http_close(struct connectdata *conn);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
43
lib/if2ip.c
43
lib/if2ip.c
@@ -5,38 +5,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
@@ -49,7 +32,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ! defined(WIN32) && ! defined(__BEOS__)
|
#if ! defined(WIN32) && ! defined(__BEOS__) && !defined(__CYGWIN32__)
|
||||||
|
|
||||||
#ifdef NEED_REENTRANT
|
#ifdef NEED_REENTRANT
|
||||||
#define _REENTRANT
|
#define _REENTRANT
|
||||||
@@ -89,7 +72,7 @@
|
|||||||
|
|
||||||
#define SYS_ERROR -1
|
#define SYS_ERROR -1
|
||||||
|
|
||||||
char *if2ip(char *interface, char *buf, int buf_size)
|
char *Curl_if2ip(char *interface, char *buf, int buf_size)
|
||||||
{
|
{
|
||||||
int dummy;
|
int dummy;
|
||||||
char *ip=NULL;
|
char *ip=NULL;
|
||||||
|
|||||||
43
lib/if2ip.h
43
lib/if2ip.h
@@ -7,44 +7,27 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
#if ! defined(WIN32) && ! defined(__BEOS__)
|
#if ! defined(WIN32) && ! defined(__BEOS__)
|
||||||
extern char *if2ip(char *interface, char *buf, int buf_size);
|
extern char *Curl_if2ip(char *interface, char *buf, int buf_size);
|
||||||
#else
|
#else
|
||||||
#define if2ip(a,b,c) NULL
|
#define Curl_if2ip(a,b,c) NULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
500
lib/krb4.c
Normal file
500
lib/krb4.c
Normal file
@@ -0,0 +1,500 @@
|
|||||||
|
/* modified by Martin Hedenfalk <mhe@stacken.kth.se> for use in Curl
|
||||||
|
* last modified 2000-09-18
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska H<>gskolan
|
||||||
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "setup.h"
|
||||||
|
|
||||||
|
#ifdef KRB4
|
||||||
|
|
||||||
|
#include "security.h"
|
||||||
|
#include "base64.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <krb.h>
|
||||||
|
|
||||||
|
#include "ftp.h"
|
||||||
|
#include "sendf.h"
|
||||||
|
|
||||||
|
/* The last #include file should be: */
|
||||||
|
#ifdef MALLOCDEBUG
|
||||||
|
#include "memdebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef FTP_SERVER
|
||||||
|
#define LOCAL_ADDR ctrl_addr
|
||||||
|
#define REMOTE_ADDR his_addr
|
||||||
|
#else
|
||||||
|
/*#define LOCAL_ADDR myctladdr***/
|
||||||
|
/*#define REMOTE_ADDR hisctladdr***/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*extern struct sockaddr *LOCAL_ADDR, *REMOTE_ADDR;***/
|
||||||
|
|
||||||
|
#define LOCAL_ADDR (&local_addr)
|
||||||
|
#define REMOTE_ADDR (&conn->serv_addr)
|
||||||
|
#define myctladdr LOCAL_ADDR
|
||||||
|
#define hisctladdr REMOTE_ADDR
|
||||||
|
|
||||||
|
static struct sockaddr_in local_addr;
|
||||||
|
|
||||||
|
struct krb4_data {
|
||||||
|
des_cblock key;
|
||||||
|
des_key_schedule schedule;
|
||||||
|
char name[ANAME_SZ];
|
||||||
|
char instance[INST_SZ];
|
||||||
|
char realm[REALM_SZ];
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef HAVE_STRLCPY
|
||||||
|
|
||||||
|
size_t
|
||||||
|
strlcpy (char *dst, const char *src, size_t dst_sz)
|
||||||
|
{
|
||||||
|
size_t n;
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
for (p = dst, n = 0;
|
||||||
|
n + 1 < dst_sz && *src != '\0';
|
||||||
|
++p, ++src, ++n)
|
||||||
|
*p = *src;
|
||||||
|
*p = '\0';
|
||||||
|
if (*src == '\0')
|
||||||
|
return n;
|
||||||
|
else
|
||||||
|
return n + strlen (src);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
size_t strlcpy (char *dst, const char *src, size_t dst_sz);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int
|
||||||
|
krb4_check_prot(void *app_data, int level)
|
||||||
|
{
|
||||||
|
if(level == prot_confidential)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
krb4_decode(void *app_data, void *buf, int len, int level,
|
||||||
|
struct connectdata *conn)
|
||||||
|
{
|
||||||
|
MSG_DAT m;
|
||||||
|
int e;
|
||||||
|
struct krb4_data *d = app_data;
|
||||||
|
|
||||||
|
if(level == prot_safe)
|
||||||
|
e = krb_rd_safe(buf, len, &d->key,
|
||||||
|
(struct sockaddr_in *)REMOTE_ADDR,
|
||||||
|
(struct sockaddr_in *)LOCAL_ADDR, &m);
|
||||||
|
else
|
||||||
|
e = krb_rd_priv(buf, len, d->schedule, &d->key,
|
||||||
|
(struct sockaddr_in *)REMOTE_ADDR,
|
||||||
|
(struct sockaddr_in *)LOCAL_ADDR, &m);
|
||||||
|
if(e){
|
||||||
|
syslog(LOG_ERR, "krb4_decode: %s", krb_get_err_text(e));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
memmove(buf, m.app_data, m.app_length);
|
||||||
|
return m.app_length;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
krb4_overhead(void *app_data, int level, int len)
|
||||||
|
{
|
||||||
|
return 31;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
krb4_encode(void *app_data, void *from, int length, int level, void **to,
|
||||||
|
struct connectdata *conn)
|
||||||
|
{
|
||||||
|
struct krb4_data *d = app_data;
|
||||||
|
*to = malloc(length + 31);
|
||||||
|
if(level == prot_safe)
|
||||||
|
return krb_mk_safe(from, *to, length, &d->key,
|
||||||
|
(struct sockaddr_in *)LOCAL_ADDR,
|
||||||
|
(struct sockaddr_in *)REMOTE_ADDR);
|
||||||
|
else if(level == prot_private)
|
||||||
|
return krb_mk_priv(from, *to, length, d->schedule, &d->key,
|
||||||
|
(struct sockaddr_in *)LOCAL_ADDR,
|
||||||
|
(struct sockaddr_in *)REMOTE_ADDR);
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef FTP_SERVER
|
||||||
|
|
||||||
|
static int
|
||||||
|
krb4_adat(void *app_data, void *buf, size_t len)
|
||||||
|
{
|
||||||
|
KTEXT_ST tkt;
|
||||||
|
AUTH_DAT auth_dat;
|
||||||
|
char *p;
|
||||||
|
int kerror;
|
||||||
|
u_int32_t cs;
|
||||||
|
char msg[35]; /* size of encrypted block */
|
||||||
|
int tmp_len;
|
||||||
|
struct krb4_data *d = app_data;
|
||||||
|
char inst[INST_SZ];
|
||||||
|
struct sockaddr_in *his_addr_sin = (struct sockaddr_in *)his_addr;
|
||||||
|
|
||||||
|
memcpy(tkt.dat, buf, len);
|
||||||
|
tkt.length = len;
|
||||||
|
|
||||||
|
k_getsockinst(0, inst, sizeof(inst));
|
||||||
|
kerror = krb_rd_req(&tkt, "ftp", inst,
|
||||||
|
his_addr_sin->sin_addr.s_addr, &auth_dat, "");
|
||||||
|
if(kerror == RD_AP_UNDEC){
|
||||||
|
k_getsockinst(0, inst, sizeof(inst));
|
||||||
|
kerror = krb_rd_req(&tkt, "rcmd", inst,
|
||||||
|
his_addr_sin->sin_addr.s_addr, &auth_dat, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(kerror){
|
||||||
|
reply(535, "Error reading request: %s.", krb_get_err_text(kerror));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(d->key, auth_dat.session, sizeof(d->key));
|
||||||
|
des_set_key(&d->key, d->schedule);
|
||||||
|
|
||||||
|
strlcpy(d->name, auth_dat.pname, sizeof(d->name));
|
||||||
|
strlcpy(d->instance, auth_dat.pinst, sizeof(d->instance));
|
||||||
|
strlcpy(d->realm, auth_dat.prealm, sizeof(d->instance));
|
||||||
|
|
||||||
|
cs = auth_dat.checksum + 1;
|
||||||
|
{
|
||||||
|
unsigned char tmp[4];
|
||||||
|
KRB_PUT_INT(cs, tmp, 4, sizeof(tmp));
|
||||||
|
tmp_len = krb_mk_safe(tmp, msg, 4, &d->key,
|
||||||
|
(struct sockaddr_in *)LOCAL_ADDR,
|
||||||
|
(struct sockaddr_in *)REMOTE_ADDR);
|
||||||
|
}
|
||||||
|
if(tmp_len < 0){
|
||||||
|
reply(535, "Error creating reply: %s.", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
len = tmp_len;
|
||||||
|
if(base64_encode(msg, len, &p) < 0) {
|
||||||
|
reply(535, "Out of memory base64-encoding.");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
reply(235, "ADAT=%s", p);
|
||||||
|
sec_complete = 1;
|
||||||
|
free(p);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
krb4_userok(void *app_data, char *user)
|
||||||
|
{
|
||||||
|
struct krb4_data *d = app_data;
|
||||||
|
return krb_kuserok(d->name, d->instance, d->realm, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct sec_server_mech krb4_server_mech = {
|
||||||
|
"KERBEROS_V4",
|
||||||
|
sizeof(struct krb4_data),
|
||||||
|
NULL, /* init */
|
||||||
|
NULL, /* end */
|
||||||
|
krb4_check_prot,
|
||||||
|
krb4_overhead,
|
||||||
|
krb4_encode,
|
||||||
|
krb4_decode,
|
||||||
|
/* */
|
||||||
|
NULL,
|
||||||
|
krb4_adat,
|
||||||
|
NULL, /* pbsz */
|
||||||
|
NULL, /* ccc */
|
||||||
|
krb4_userok
|
||||||
|
};
|
||||||
|
|
||||||
|
#else /* FTP_SERVER */
|
||||||
|
|
||||||
|
static int
|
||||||
|
mk_auth(struct krb4_data *d, KTEXT adat,
|
||||||
|
char *service, char *host, int checksum)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
CREDENTIALS cred;
|
||||||
|
char sname[SNAME_SZ], inst[INST_SZ], realm[REALM_SZ];
|
||||||
|
|
||||||
|
strlcpy(sname, service, sizeof(sname));
|
||||||
|
strlcpy(inst, krb_get_phost(host), sizeof(inst));
|
||||||
|
strlcpy(realm, krb_realmofhost(host), sizeof(realm));
|
||||||
|
ret = krb_mk_req(adat, sname, inst, realm, checksum);
|
||||||
|
if(ret)
|
||||||
|
return ret;
|
||||||
|
strlcpy(sname, service, sizeof(sname));
|
||||||
|
strlcpy(inst, krb_get_phost(host), sizeof(inst));
|
||||||
|
strlcpy(realm, krb_realmofhost(host), sizeof(realm));
|
||||||
|
ret = krb_get_cred(sname, inst, realm, &cred);
|
||||||
|
memmove(&d->key, &cred.session, sizeof(des_cblock));
|
||||||
|
des_key_sched(&d->key, d->schedule);
|
||||||
|
memset(&cred, 0, sizeof(cred));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
krb4_auth(void *app_data, struct connectdata *conn)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
char *p;
|
||||||
|
int len;
|
||||||
|
KTEXT_ST adat;
|
||||||
|
MSG_DAT msg_data;
|
||||||
|
int checksum;
|
||||||
|
u_int32_t cs;
|
||||||
|
struct krb4_data *d = app_data;
|
||||||
|
struct sockaddr_in *localaddr = (struct sockaddr_in *)LOCAL_ADDR;
|
||||||
|
#if 0
|
||||||
|
struct sockaddr_in *remoteaddr = (struct sockaddr_in *)REMOTE_ADDR;
|
||||||
|
#endif
|
||||||
|
char *host = conn->hp->h_name;
|
||||||
|
size_t nread;
|
||||||
|
int l = sizeof(local_addr);
|
||||||
|
|
||||||
|
if(getsockname(conn->data->firstsocket,
|
||||||
|
(struct sockaddr *)LOCAL_ADDR, &l) < 0)
|
||||||
|
perror("getsockname()");
|
||||||
|
|
||||||
|
checksum = getpid();
|
||||||
|
ret = mk_auth(d, &adat, "ftp", host, checksum);
|
||||||
|
if(ret == KDC_PR_UNKNOWN)
|
||||||
|
ret = mk_auth(d, &adat, "rcmd", host, checksum);
|
||||||
|
if(ret){
|
||||||
|
printf("%s\n", krb_get_err_text(ret));
|
||||||
|
return AUTH_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_KRB_GET_OUR_IP_FOR_REALM
|
||||||
|
if (krb_get_config_bool("nat_in_use")) {
|
||||||
|
struct in_addr natAddr;
|
||||||
|
|
||||||
|
if (krb_get_our_ip_for_realm(krb_realmofhost(host),
|
||||||
|
&natAddr) != KSUCCESS
|
||||||
|
&& krb_get_our_ip_for_realm(NULL, &natAddr) != KSUCCESS)
|
||||||
|
printf("Can't get address for realm %s\n",
|
||||||
|
krb_realmofhost(host));
|
||||||
|
else {
|
||||||
|
if (natAddr.s_addr != localaddr->sin_addr.s_addr) {
|
||||||
|
printf("Using NAT IP address (%s) for kerberos 4\n",
|
||||||
|
(char *)inet_ntoa(natAddr));
|
||||||
|
localaddr->sin_addr = natAddr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This not the best place to do this, but it
|
||||||
|
* is here we know that (probably) NAT is in
|
||||||
|
* use!
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*passivemode = 1;***/
|
||||||
|
/*printf("Setting: Passive mode on.\n");***/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*printf("Local address is %s\n", inet_ntoa(localaddr->sin_addr));***/
|
||||||
|
/*printf("Remote address is %s\n", inet_ntoa(remoteaddr->sin_addr));***/
|
||||||
|
|
||||||
|
if(Curl_base64_encode(adat.dat, adat.length, &p) < 0) {
|
||||||
|
printf("Out of memory base64-encoding.\n");
|
||||||
|
return AUTH_CONTINUE;
|
||||||
|
}
|
||||||
|
/*ret = command("ADAT %s", p)*/
|
||||||
|
Curl_ftpsendf(conn->data->firstsocket, conn, "ADAT %s", p);
|
||||||
|
/* wait for feedback */
|
||||||
|
nread = Curl_GetFTPResponse(conn->data->firstsocket,
|
||||||
|
conn->data->buffer, conn, NULL);
|
||||||
|
if(nread < 0)
|
||||||
|
return /*CURLE_OPERATION_TIMEOUTED*/-1;
|
||||||
|
free(p);
|
||||||
|
|
||||||
|
if(/*ret != COMPLETE*/conn->data->buffer[0] != '2'){
|
||||||
|
printf("Server didn't accept auth data.\n");
|
||||||
|
return AUTH_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = strstr(/*reply_string*/conn->data->buffer, "ADAT=");
|
||||||
|
if(!p){
|
||||||
|
printf("Remote host didn't send adat reply.\n");
|
||||||
|
return AUTH_ERROR;
|
||||||
|
}
|
||||||
|
p += 5;
|
||||||
|
len = Curl_base64_decode(p, adat.dat);
|
||||||
|
if(len < 0){
|
||||||
|
printf("Failed to decode base64 from server.\n");
|
||||||
|
return AUTH_ERROR;
|
||||||
|
}
|
||||||
|
adat.length = len;
|
||||||
|
ret = krb_rd_safe(adat.dat, adat.length, &d->key,
|
||||||
|
(struct sockaddr_in *)hisctladdr,
|
||||||
|
(struct sockaddr_in *)myctladdr, &msg_data);
|
||||||
|
if(ret){
|
||||||
|
printf("Error reading reply from server: %s.\n",
|
||||||
|
krb_get_err_text(ret));
|
||||||
|
return AUTH_ERROR;
|
||||||
|
}
|
||||||
|
krb_get_int(msg_data.app_data, &cs, 4, 0);
|
||||||
|
if(cs - checksum != 1){
|
||||||
|
printf("Bad checksum returned from server.\n");
|
||||||
|
return AUTH_ERROR;
|
||||||
|
}
|
||||||
|
return AUTH_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct sec_client_mech krb4_client_mech = {
|
||||||
|
"KERBEROS_V4",
|
||||||
|
sizeof(struct krb4_data),
|
||||||
|
NULL, /* init */
|
||||||
|
krb4_auth,
|
||||||
|
NULL, /* end */
|
||||||
|
krb4_check_prot,
|
||||||
|
krb4_overhead,
|
||||||
|
krb4_encode,
|
||||||
|
krb4_decode
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* FTP_SERVER */
|
||||||
|
|
||||||
|
void krb_kauth(struct connectdata *conn)
|
||||||
|
{
|
||||||
|
des_cblock key;
|
||||||
|
des_key_schedule schedule;
|
||||||
|
KTEXT_ST tkt, tktcopy;
|
||||||
|
char *name;
|
||||||
|
char *p;
|
||||||
|
char passwd[100];
|
||||||
|
int tmp;
|
||||||
|
size_t nread;
|
||||||
|
|
||||||
|
int save;
|
||||||
|
|
||||||
|
save = set_command_prot(conn, prot_private);
|
||||||
|
/*ret = command("SITE KAUTH %s", name);***/
|
||||||
|
Curl_ftpsendf(conn->data->firstsocket, conn,
|
||||||
|
"SITE KAUTH %s", conn->data->user);
|
||||||
|
/* wait for feedback */
|
||||||
|
nread = Curl_GetFTPResponse(conn->data->firstsocket, conn->data->buffer,
|
||||||
|
conn, NULL);
|
||||||
|
if(nread < 0)
|
||||||
|
return /*CURLE_OPERATION_TIMEOUTED*/;
|
||||||
|
|
||||||
|
if(/*ret != CONTINUE*/conn->data->buffer[0] != '3'){
|
||||||
|
set_command_prot(conn, save);
|
||||||
|
/*code = -1;***/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p = strstr(/*reply_string***/conn->data->buffer, "T=");
|
||||||
|
if(!p){
|
||||||
|
printf("Bad reply from server.\n");
|
||||||
|
set_command_prot(conn, save);
|
||||||
|
/*code = -1;***/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p += 2;
|
||||||
|
tmp = Curl_base64_decode(p, &tkt.dat);
|
||||||
|
if(tmp < 0){
|
||||||
|
printf("Failed to decode base64 in reply.\n");
|
||||||
|
set_command_prot(conn, save);
|
||||||
|
/*code = -1;***/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tkt.length = tmp;
|
||||||
|
tktcopy.length = tkt.length;
|
||||||
|
|
||||||
|
p = strstr(/*reply_string***/conn->data->buffer, "P=");
|
||||||
|
if(!p){
|
||||||
|
printf("Bad reply from server.\n");
|
||||||
|
set_command_prot(conn, save);
|
||||||
|
/*code = -1;***/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
name = p + 2;
|
||||||
|
for(; *p && *p != ' ' && *p != '\r' && *p != '\n'; p++);
|
||||||
|
*p = 0;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
snprintf(buf, sizeof(buf), "Password for %s:", name);
|
||||||
|
if (des_read_pw_string (passwd, sizeof(passwd)-1, buf, 0))
|
||||||
|
*passwd = '\0';
|
||||||
|
des_string_to_key (passwd, &key);
|
||||||
|
#else
|
||||||
|
des_string_to_key (conn->data->passwd, &key);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
des_key_sched(&key, schedule);
|
||||||
|
|
||||||
|
des_pcbc_encrypt((des_cblock*)tkt.dat, (des_cblock*)tktcopy.dat,
|
||||||
|
tkt.length,
|
||||||
|
schedule, &key, DES_DECRYPT);
|
||||||
|
if (strcmp ((char*)tktcopy.dat + 8,
|
||||||
|
KRB_TICKET_GRANTING_TICKET) != 0) {
|
||||||
|
afs_string_to_key (passwd,
|
||||||
|
krb_realmofhost(/*hostname***/conn->hp->h_name),
|
||||||
|
&key);
|
||||||
|
des_key_sched (&key, schedule);
|
||||||
|
des_pcbc_encrypt((des_cblock*)tkt.dat, (des_cblock*)tktcopy.dat,
|
||||||
|
tkt.length,
|
||||||
|
schedule, &key, DES_DECRYPT);
|
||||||
|
}
|
||||||
|
memset(key, 0, sizeof(key));
|
||||||
|
memset(schedule, 0, sizeof(schedule));
|
||||||
|
memset(passwd, 0, sizeof(passwd));
|
||||||
|
if(Curl_base64_encode(tktcopy.dat, tktcopy.length, &p) < 0) {
|
||||||
|
failf(conn->data, "Out of memory base64-encoding.\n");
|
||||||
|
set_command_prot(conn, save);
|
||||||
|
/*code = -1;***/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memset (tktcopy.dat, 0, tktcopy.length);
|
||||||
|
/*ret = command("SITE KAUTH %s %s", name, p);***/
|
||||||
|
Curl_ftpsendf(conn->data->firstsocket, conn,
|
||||||
|
"SITE KAUTH %s %s", name, p);
|
||||||
|
/* wait for feedback */
|
||||||
|
nread = Curl_GetFTPResponse(conn->data->firstsocket, conn->data->buffer,
|
||||||
|
conn, NULL);
|
||||||
|
if(nread < 0)
|
||||||
|
return /*CURLE_OPERATION_TIMEOUTED*/;
|
||||||
|
free(p);
|
||||||
|
set_command_prot(conn, save);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* KRB4 */
|
||||||
27
lib/krb4.h
Normal file
27
lib/krb4.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#ifndef __KRB4_H
|
||||||
|
#define __KRB4_H
|
||||||
|
/*****************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
|
*
|
||||||
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*****************************************************************************/
|
||||||
|
void krb_kauth(struct connectdata *conn);
|
||||||
|
|
||||||
|
#endif
|
||||||
46
lib/ldap.c
46
lib/ldap.c
@@ -5,38 +5,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Contributor(s):
|
|
||||||
* Bj<42>rn Reese <breese@mail1.stofanet.dk>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
@@ -134,19 +117,18 @@ static void * DynaGetFunction(char *name)
|
|||||||
static int WriteProc(void *param, char *text, int len)
|
static int WriteProc(void *param, char *text, int len)
|
||||||
{
|
{
|
||||||
struct UrlData *data = (struct UrlData *)param;
|
struct UrlData *data = (struct UrlData *)param;
|
||||||
|
Curl_client_write(data, CLIENTWRITE_BODY, text, 0);
|
||||||
data->fwrite(text, 1, strlen(text), data->out);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CURLcode ldap_done(struct connectdata *conn)
|
CURLcode Curl_ldap_done(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*/
|
*/
|
||||||
CURLcode ldap(struct connectdata *conn)
|
CURLcode Curl_ldap(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode status = CURLE_OK;
|
CURLcode status = CURLE_OK;
|
||||||
int rc;
|
int rc;
|
||||||
|
|||||||
43
lib/ldap.h
43
lib/ldap.h
@@ -8,39 +8,22 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
CURLcode Curl_ldap(struct connectdata *conn);
|
||||||
* ------------------------------------------------------------
|
CURLcode Curl_ldap_done(struct connectdata *conn);
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://www.fts.frontec.se/~dast/curl/
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
CURLcode ldap(struct connectdata *conn);
|
|
||||||
CURLcode ldap_done(struct connectdata *conn);
|
|
||||||
|
|
||||||
#endif /* __LDAP_H */
|
#endif /* __LDAP_H */
|
||||||
|
|||||||
42
lib/libcurl.def
Normal file
42
lib/libcurl.def
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
;
|
||||||
|
; Definition file for the DLL version of the LIBCURL library from curl
|
||||||
|
;
|
||||||
|
|
||||||
|
LIBRARY LIBCURL
|
||||||
|
|
||||||
|
DESCRIPTION 'curl libcurl - http://curl.haxx.se'
|
||||||
|
|
||||||
|
EXPORTS
|
||||||
|
curl_close @ 1 ;
|
||||||
|
curl_connect @ 2 ;
|
||||||
|
curl_disconnect @ 3 ;
|
||||||
|
curl_do @ 4 ;
|
||||||
|
curl_done @ 5 ;
|
||||||
|
curl_easy_cleanup @ 6 ;
|
||||||
|
curl_easy_getinfo @ 7 ;
|
||||||
|
curl_easy_init @ 8 ;
|
||||||
|
curl_easy_perform @ 9 ;
|
||||||
|
curl_easy_setopt @ 10 ;
|
||||||
|
curl_escape @ 11 ;
|
||||||
|
curl_formparse @ 12 ;
|
||||||
|
curl_free @ 13 ;
|
||||||
|
curl_getdate @ 14 ;
|
||||||
|
curl_getenv @ 15 ;
|
||||||
|
curl_init @ 16 ;
|
||||||
|
curl_open @ 17 ;
|
||||||
|
curl_read @ 18 ;
|
||||||
|
curl_setopt @ 19 ;
|
||||||
|
curl_slist_append @ 20 ;
|
||||||
|
curl_slist_free_all @ 21 ;
|
||||||
|
curl_transfer @ 22 ;
|
||||||
|
curl_unescape @ 23 ;
|
||||||
|
curl_version @ 24 ;
|
||||||
|
curl_write @ 25 ;
|
||||||
|
maprintf @ 26 ;
|
||||||
|
mfprintf @ 27 ;
|
||||||
|
mprintf @ 28 ;
|
||||||
|
msprintf @ 29 ;
|
||||||
|
msnprintf @ 30 ;
|
||||||
|
mvfprintf @ 31 ;
|
||||||
|
strequal @ 32 ;
|
||||||
|
strnequal @ 33 ;
|
||||||
157
lib/memdebug.c
Normal file
157
lib/memdebug.c
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
#ifdef MALLOCDEBUG
|
||||||
|
/*****************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
|
*
|
||||||
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "setup.h"
|
||||||
|
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
|
||||||
|
#include <winsock.h>
|
||||||
|
#else /* some kind of unix */
|
||||||
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _MPRINTF_REPLACE
|
||||||
|
#include <curl/mprintf.h>
|
||||||
|
#include "urldata.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* DONT include memdebug.h here! */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note that these debug functions are very simple and they are meant to
|
||||||
|
* remain so. For advanced analysis, record a log file and write perl scripts
|
||||||
|
* to analyze them!
|
||||||
|
*
|
||||||
|
* Don't use these with multithreaded test programs!
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE *logfile;
|
||||||
|
|
||||||
|
/* this sets the log file name */
|
||||||
|
void curl_memdebug(char *logname)
|
||||||
|
{
|
||||||
|
logfile = fopen(logname, "w");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *curl_domalloc(size_t size, int line, char *source)
|
||||||
|
{
|
||||||
|
void *mem=(malloc)(size);
|
||||||
|
fprintf(logfile?logfile:stderr, "MEM %s:%d malloc(%d) = %p\n",
|
||||||
|
source, line, size, mem);
|
||||||
|
return mem;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *curl_dostrdup(char *str, int line, char *source)
|
||||||
|
{
|
||||||
|
char *mem;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
if(NULL ==str) {
|
||||||
|
fprintf(stderr, "ILLEGAL strdup() on NULL at %s:%d\n",
|
||||||
|
source, line);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
mem=(strdup)(str);
|
||||||
|
len=strlen(str)+1;
|
||||||
|
fprintf(logfile?logfile:stderr, "MEM %s:%d strdup(%p) (%d) = %p\n",
|
||||||
|
source, line, str, len, mem);
|
||||||
|
return mem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *curl_dorealloc(void *ptr, size_t size, int line, char *source)
|
||||||
|
{
|
||||||
|
void *mem=(realloc)(ptr, size);
|
||||||
|
fprintf(logfile?logfile:stderr, "MEM %s:%d realloc(%p, %d) = %p\n",
|
||||||
|
source, line, ptr, size, mem);
|
||||||
|
return mem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void curl_dofree(void *ptr, int line, char *source)
|
||||||
|
{
|
||||||
|
if(NULL == ptr) {
|
||||||
|
fprintf(stderr, "ILLEGAL free() on NULL at %s:%d\n",
|
||||||
|
source, line);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
(free)(ptr);
|
||||||
|
|
||||||
|
fprintf(logfile?logfile:stderr, "MEM %s:%d free(%p)\n",
|
||||||
|
source, line, ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int curl_socket(int domain, int type, int protocol, int line, char *source)
|
||||||
|
{
|
||||||
|
int sockfd=(socket)(domain, type, protocol);
|
||||||
|
fprintf(logfile?logfile:stderr, "FD %s:%d socket() = %d\n",
|
||||||
|
source, line, sockfd);
|
||||||
|
return sockfd;
|
||||||
|
}
|
||||||
|
|
||||||
|
int curl_accept(int s, struct sockaddr *addr, int *addrlen,
|
||||||
|
int line, char *source)
|
||||||
|
{
|
||||||
|
int sockfd=(accept)(s, addr, addrlen);
|
||||||
|
fprintf(logfile?logfile:stderr, "FD %s:%d accept() = %d\n",
|
||||||
|
source, line, sockfd);
|
||||||
|
return sockfd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this is our own defined way to close sockets on *ALL* platforms */
|
||||||
|
int curl_sclose(int sockfd, int line, char *source)
|
||||||
|
{
|
||||||
|
int res=sclose(sockfd);
|
||||||
|
fprintf(logfile?logfile:stderr, "FD %s:%d sclose(%d)\n",
|
||||||
|
source, line, sockfd);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE *curl_fopen(char *file, char *mode, int line, char *source)
|
||||||
|
{
|
||||||
|
FILE *res=(fopen)(file, mode);
|
||||||
|
fprintf(logfile?logfile:stderr, "FILE %s:%d fopen(\"%s\") = %p\n",
|
||||||
|
source, line, file, res);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
int curl_fclose(FILE *file, int line, char *source)
|
||||||
|
{
|
||||||
|
int res=(fclose)(file);
|
||||||
|
fprintf(logfile?logfile:stderr, "FILE %s:%d fclose(%p)\n",
|
||||||
|
source, line, file);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* MALLOCDEBUG */
|
||||||
42
lib/memdebug.h
Normal file
42
lib/memdebug.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#ifdef MALLOCDEBUG
|
||||||
|
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/* memory functions */
|
||||||
|
void *curl_domalloc(size_t size, int line, char *source);
|
||||||
|
void *curl_dorealloc(void *ptr, size_t size, int line, char *source);
|
||||||
|
void curl_dofree(void *ptr, int line, char *source);
|
||||||
|
char *curl_dostrdup(char *str, int line, char *source);
|
||||||
|
void curl_memdebug(char *logname);
|
||||||
|
|
||||||
|
/* file descriptor manipulators */
|
||||||
|
int curl_socket(int domain, int type, int protocol, int, char *);
|
||||||
|
int curl_sclose(int sockfd, int, char *);
|
||||||
|
int curl_accept(int s, struct sockaddr *addr, int *addrlen,
|
||||||
|
int line, char *source);
|
||||||
|
|
||||||
|
/* FILE functions */
|
||||||
|
FILE *curl_fopen(char *file, char *mode, int line, char *source);
|
||||||
|
int curl_fclose(FILE *file, int line, char *source);
|
||||||
|
|
||||||
|
/* Set this symbol on the command-line, recompile all lib-sources */
|
||||||
|
#define strdup(ptr) curl_dostrdup(ptr, __LINE__, __FILE__)
|
||||||
|
#define malloc(size) curl_domalloc(size, __LINE__, __FILE__)
|
||||||
|
#define realloc(ptr,size) curl_dorealloc(ptr, size, __LINE__, __FILE__)
|
||||||
|
#define free(ptr) curl_dofree(ptr, __LINE__, __FILE__)
|
||||||
|
|
||||||
|
#define socket(domain,type,protocol)\
|
||||||
|
curl_socket(domain,type,protocol,__LINE__,__FILE__)
|
||||||
|
#define accept(sock,addr,len)\
|
||||||
|
curl_accept(sock,addr,len,__LINE__,__FILE__)
|
||||||
|
|
||||||
|
/* sclose is probably already defined, redefine it! */
|
||||||
|
#undef sclose
|
||||||
|
#define sclose(sockfd) curl_sclose(sockfd,__LINE__,__FILE__)
|
||||||
|
|
||||||
|
#undef fopen
|
||||||
|
#define fopen(file,mode) curl_fopen(file,mode,__LINE__,__FILE__)
|
||||||
|
#define fclose(file) curl_fclose(file,__LINE__,__FILE__)
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -4,6 +4,15 @@
|
|||||||
*
|
*
|
||||||
*************************************************************************
|
*************************************************************************
|
||||||
*
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
|
||||||
|
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
|
||||||
|
*
|
||||||
* Purpose:
|
* Purpose:
|
||||||
* A merge of Bjorn Reese's format() function and Daniel's dsprintf()
|
* A merge of Bjorn Reese's format() function and Daniel's dsprintf()
|
||||||
* 1.0. A full blooded printf() clone with full support for <num>$
|
* 1.0. A full blooded printf() clone with full support for <num>$
|
||||||
@@ -98,6 +107,10 @@ static const char rcsid[] = "@(#)$Id$";
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
/* The last #include file should be: */
|
||||||
|
#ifdef MALLOCDEBUG
|
||||||
|
#include "memdebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define BUFFSIZE 256 /* buffer for long-to-str and float-to-str calcs */
|
#define BUFFSIZE 256 /* buffer for long-to-str and float-to-str calcs */
|
||||||
#define MAX_PARAMETERS 128 /* lame static limit */
|
#define MAX_PARAMETERS 128 /* lame static limit */
|
||||||
@@ -194,7 +207,7 @@ struct asprintf {
|
|||||||
size_t alloc; /* length of alloc */
|
size_t alloc; /* length of alloc */
|
||||||
};
|
};
|
||||||
|
|
||||||
int msprintf(char *buffer, const char *format, ...);
|
int curl_msprintf(char *buffer, const char *format, ...);
|
||||||
|
|
||||||
static int dprintf_DollarString(char *input, char **end)
|
static int dprintf_DollarString(char *input, char **end)
|
||||||
{
|
{
|
||||||
@@ -942,11 +955,11 @@ static int dprintf_formatf(
|
|||||||
|
|
||||||
if(width >= 0) {
|
if(width >= 0) {
|
||||||
/* RECURSIVE USAGE */
|
/* RECURSIVE USAGE */
|
||||||
fptr += msprintf(fptr, "%d", width);
|
fptr += curl_msprintf(fptr, "%d", width);
|
||||||
}
|
}
|
||||||
if(prec >= 0) {
|
if(prec >= 0) {
|
||||||
/* RECURSIVE USAGE */
|
/* RECURSIVE USAGE */
|
||||||
fptr += msprintf(fptr, ".%d", prec);
|
fptr += curl_msprintf(fptr, ".%d", prec);
|
||||||
}
|
}
|
||||||
if (p->flags & FLAGS_LONG)
|
if (p->flags & FLAGS_LONG)
|
||||||
strcat(fptr, "l");
|
strcat(fptr, "l");
|
||||||
@@ -997,33 +1010,6 @@ static int dprintf_formatf(
|
|||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int StoreNonPrintable(int output, struct nsprintf *infop)
|
|
||||||
{
|
|
||||||
/* If the character isn't printable then we convert it */
|
|
||||||
char work[64], *w;
|
|
||||||
int num = output;
|
|
||||||
|
|
||||||
w = &work[sizeof(work)];
|
|
||||||
*(--w) = (char)0;
|
|
||||||
for(; num > 0; num /= 10) {
|
|
||||||
*(--w) = lower_digits[num % 10];
|
|
||||||
}
|
|
||||||
if (infop->length + strlen(w) + 1 < infop->max)
|
|
||||||
{
|
|
||||||
infop->buffer[0] = '\\';
|
|
||||||
infop->buffer++;
|
|
||||||
infop->length++;
|
|
||||||
for (; *w; w++)
|
|
||||||
{
|
|
||||||
infop->buffer[0] = *w;
|
|
||||||
infop->buffer++;
|
|
||||||
infop->length++;
|
|
||||||
}
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fputc() look-alike */
|
/* fputc() look-alike */
|
||||||
static int addbyter(int output, FILE *data)
|
static int addbyter(int output, FILE *data)
|
||||||
{
|
{
|
||||||
@@ -1031,22 +1017,15 @@ static int addbyter(int output, FILE *data)
|
|||||||
|
|
||||||
if(infop->length < infop->max) {
|
if(infop->length < infop->max) {
|
||||||
/* only do this if we haven't reached max length yet */
|
/* only do this if we haven't reached max length yet */
|
||||||
if (isprint(output) || isspace(output))
|
|
||||||
{
|
|
||||||
infop->buffer[0] = (char)output; /* store */
|
infop->buffer[0] = (char)output; /* store */
|
||||||
infop->buffer++; /* increase pointer */
|
infop->buffer++; /* increase pointer */
|
||||||
infop->length++; /* we are now one byte larger */
|
infop->length++; /* we are now one byte larger */
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return StoreNonPrintable(output, infop);
|
|
||||||
}
|
|
||||||
return output; /* fputc() returns like this on success */
|
return output; /* fputc() returns like this on success */
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msnprintf(char *buffer, size_t maxlength, const char *format, ...)
|
int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap_save; /* argument pointer */
|
va_list ap_save; /* argument pointer */
|
||||||
int retcode;
|
int retcode;
|
||||||
@@ -1066,7 +1045,7 @@ int msnprintf(char *buffer, size_t maxlength, const char *format, ...)
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list ap_save)
|
int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list ap_save)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
struct nsprintf info;
|
struct nsprintf info;
|
||||||
@@ -1113,7 +1092,7 @@ static int alloc_addbyter(int output, FILE *data)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *maprintf(const char *format, ...)
|
char *curl_maprintf(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap_save; /* argument pointer */
|
va_list ap_save; /* argument pointer */
|
||||||
int retcode;
|
int retcode;
|
||||||
@@ -1134,7 +1113,7 @@ char *maprintf(const char *format, ...)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *mvaprintf(const char *format, va_list ap_save)
|
char *curl_mvaprintf(const char *format, va_list ap_save)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
struct asprintf info;
|
struct asprintf info;
|
||||||
@@ -1161,7 +1140,7 @@ static int storebuffer(int output, FILE *data)
|
|||||||
return output; /* act like fputc() ! */
|
return output; /* act like fputc() ! */
|
||||||
}
|
}
|
||||||
|
|
||||||
int msprintf(char *buffer, const char *format, ...)
|
int curl_msprintf(char *buffer, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap_save; /* argument pointer */
|
va_list ap_save; /* argument pointer */
|
||||||
int retcode;
|
int retcode;
|
||||||
@@ -1174,7 +1153,7 @@ int msprintf(char *buffer, const char *format, ...)
|
|||||||
|
|
||||||
extern int fputc(int, FILE *);
|
extern int fputc(int, FILE *);
|
||||||
|
|
||||||
int mprintf(const char *format, ...)
|
int curl_mprintf(const char *format, ...)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
va_list ap_save; /* argument pointer */
|
va_list ap_save; /* argument pointer */
|
||||||
@@ -1184,7 +1163,7 @@ int mprintf(const char *format, ...)
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mfprintf(FILE *whereto, const char *format, ...)
|
int curl_mfprintf(FILE *whereto, const char *format, ...)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
va_list ap_save; /* argument pointer */
|
va_list ap_save; /* argument pointer */
|
||||||
@@ -1194,7 +1173,7 @@ int mfprintf(FILE *whereto, const char *format, ...)
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mvsprintf(char *buffer, const char *format, va_list ap_save)
|
int curl_mvsprintf(char *buffer, const char *format, va_list ap_save)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save);
|
retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save);
|
||||||
@@ -1202,12 +1181,12 @@ int mvsprintf(char *buffer, const char *format, va_list ap_save)
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mvprintf(const char *format, va_list ap_save)
|
int curl_mvprintf(const char *format, va_list ap_save)
|
||||||
{
|
{
|
||||||
return dprintf_formatf(stdout, fputc, format, ap_save);
|
return dprintf_formatf(stdout, fputc, format, ap_save);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mvfprintf(FILE *whereto, const char *format, va_list ap_save)
|
int curl_mvfprintf(FILE *whereto, const char *format, va_list ap_save)
|
||||||
{
|
{
|
||||||
return dprintf_formatf(whereto, fputc, format, ap_save);
|
return dprintf_formatf(whereto, fputc, format, ap_save);
|
||||||
}
|
}
|
||||||
|
|||||||
55
lib/netrc.c
55
lib/netrc.c
@@ -5,50 +5,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Rafael Sagula <sagula@inf.ufrgs.br>
|
|
||||||
* Sampo Kellomaki <sampo@iki.fi>
|
|
||||||
* Linas Vepstas <linas@linas.org>
|
|
||||||
* Bjorn Reese <breese@imada.ou.dk>
|
|
||||||
* Johan Anderson <johan@homemail.com>
|
|
||||||
* Kjell Ericson <Kjell.Ericson@haxx.se>
|
|
||||||
* Troy Engel <tengel@palladium.net>
|
|
||||||
* Ryan Nelson <ryan@inch.com>
|
|
||||||
* Bjorn Stenberg <Bjorn.Stenberg@haxx.se>
|
|
||||||
* Angus Mackay <amackay@gus.ml.org>
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
@@ -80,7 +51,7 @@ enum {
|
|||||||
#define LOGINSIZE 64
|
#define LOGINSIZE 64
|
||||||
#define PASSWORDSIZE 64
|
#define PASSWORDSIZE 64
|
||||||
|
|
||||||
int ParseNetrc(char *host,
|
int Curl_parsenetrc(char *host,
|
||||||
char *login,
|
char *login,
|
||||||
char *password)
|
char *password)
|
||||||
{
|
{
|
||||||
@@ -88,7 +59,7 @@ int ParseNetrc(char *host,
|
|||||||
char netrcbuffer[256];
|
char netrcbuffer[256];
|
||||||
int retcode=1;
|
int retcode=1;
|
||||||
|
|
||||||
char *home = GetEnv("HOME"); /* portable environment reader */
|
char *home = curl_getenv("HOME"); /* portable environment reader */
|
||||||
int state=NOTHING;
|
int state=NOTHING;
|
||||||
|
|
||||||
char state_login=0;
|
char state_login=0;
|
||||||
|
|||||||
69
lib/netrc.h
69
lib/netrc.h
@@ -7,67 +7,22 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
int Curl_parsenetrc(char *host,
|
||||||
* Contributor(s):
|
|
||||||
* Rafael Sagula <sagula@inf.ufrgs.br>
|
|
||||||
* Sampo Kellomaki <sampo@iki.fi>
|
|
||||||
* Linas Vepstas <linas@linas.org>
|
|
||||||
* Bjorn Reese <breese@imada.ou.dk>
|
|
||||||
* Johan Anderson <johan@homemail.com>
|
|
||||||
* Kjell Ericson <Kjell.Ericson@haxx.se>
|
|
||||||
* Troy Engel <tengel@palladium.net>
|
|
||||||
* Ryan Nelson <ryan@inch.com>
|
|
||||||
* Bjorn Stenberg <Bjorn.Stenberg@haxx.se>
|
|
||||||
* Angus Mackay <amackay@gus.ml.org>
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* $Log$
|
|
||||||
* Revision 1.3 2000-06-20 15:31:26 bagder
|
|
||||||
* haxx.nu => haxx.se
|
|
||||||
*
|
|
||||||
* Revision 1.2 2000/01/10 23:36:15 bagder
|
|
||||||
* syncing with local edit
|
|
||||||
*
|
|
||||||
* Revision 1.3 1999/09/06 06:59:41 dast
|
|
||||||
* Changed email info
|
|
||||||
*
|
|
||||||
* Revision 1.2 1999/08/13 07:34:48 dast
|
|
||||||
* Changed the URL in the header
|
|
||||||
*
|
|
||||||
* Revision 1.1.1.1 1999/03/11 22:23:34 dast
|
|
||||||
* Imported sources
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
int ParseNetrc(char *host,
|
|
||||||
char *login,
|
char *login,
|
||||||
char *password);
|
char *password);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
128
lib/progress.c
128
lib/progress.c
@@ -5,38 +5,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
@@ -62,7 +45,7 @@
|
|||||||
|
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
|
|
||||||
void time2str(char *r, int t)
|
static void time2str(char *r, int t)
|
||||||
{
|
{
|
||||||
int h = (t/3600);
|
int h = (t/3600);
|
||||||
int m = (t-(h*3600))/60;
|
int m = (t-(h*3600))/60;
|
||||||
@@ -72,7 +55,7 @@ void time2str(char *r, int t)
|
|||||||
|
|
||||||
/* The point of this function would be to return a string of the input data,
|
/* The point of this function would be to return a string of the input data,
|
||||||
but never longer than 5 columns. Add suffix k, M, G when suitable... */
|
but never longer than 5 columns. Add suffix k, M, G when suitable... */
|
||||||
char *max5data(double bytes, char *max5)
|
static char *max5data(double bytes, char *max5)
|
||||||
{
|
{
|
||||||
#define ONE_KILOBYTE 1024
|
#define ONE_KILOBYTE 1024
|
||||||
#define ONE_MEGABYTE (1024*1024)
|
#define ONE_MEGABYTE (1024*1024)
|
||||||
@@ -108,30 +91,40 @@ char *max5data(double bytes, char *max5)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void pgrsDone(struct UrlData *data)
|
void Curl_pgrsDone(struct UrlData *data)
|
||||||
{
|
{
|
||||||
if(!(data->progress.flags & PGRS_HIDE)) {
|
if(!(data->progress.flags & PGRS_HIDE)) {
|
||||||
data->progress.lastshow=0;
|
data->progress.lastshow=0;
|
||||||
pgrsUpdate(data); /* the final (forced) update */
|
Curl_pgrsUpdate(data); /* the final (forced) update */
|
||||||
fprintf(stderr, "\n");
|
fprintf(data->err, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pgrsTime(struct UrlData *data, timerid timer)
|
void Curl_pgrsTime(struct UrlData *data, timerid timer)
|
||||||
{
|
{
|
||||||
switch(timer) {
|
switch(timer) {
|
||||||
default:
|
default:
|
||||||
case TIMER_NONE:
|
case TIMER_NONE:
|
||||||
/* mistake filter */
|
/* mistake filter */
|
||||||
break;
|
break;
|
||||||
|
case TIMER_STARTSINGLE:
|
||||||
|
/* This is set at the start of a single fetch, there may be several
|
||||||
|
fetches within an operation, why we add all other times relative
|
||||||
|
to this one */
|
||||||
|
data->progress.t_startsingle = Curl_tvnow();
|
||||||
|
break;
|
||||||
|
|
||||||
case TIMER_NAMELOOKUP:
|
case TIMER_NAMELOOKUP:
|
||||||
data->progress.t_nslookup = tvnow();
|
data->progress.t_nslookup += Curl_tvdiff(Curl_tvnow(),
|
||||||
|
data->progress.t_startsingle);
|
||||||
break;
|
break;
|
||||||
case TIMER_CONNECT:
|
case TIMER_CONNECT:
|
||||||
data->progress.t_connect = tvnow();
|
data->progress.t_connect += Curl_tvdiff(Curl_tvnow(),
|
||||||
|
data->progress.t_startsingle);
|
||||||
break;
|
break;
|
||||||
case TIMER_PRETRANSFER:
|
case TIMER_PRETRANSFER:
|
||||||
data->progress.t_pretransfer = tvnow();
|
data->progress.t_pretransfer += Curl_tvdiff(Curl_tvnow(),
|
||||||
|
data->progress.t_startsingle);
|
||||||
break;
|
break;
|
||||||
case TIMER_POSTRANSFER:
|
case TIMER_POSTRANSFER:
|
||||||
/* this is the normal end-of-transfer thing */
|
/* this is the normal end-of-transfer thing */
|
||||||
@@ -139,22 +132,22 @@ void pgrsTime(struct UrlData *data, timerid timer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pgrsStartNow(struct UrlData *data)
|
void Curl_pgrsStartNow(struct UrlData *data)
|
||||||
{
|
{
|
||||||
data->progress.start = tvnow();
|
data->progress.start = Curl_tvnow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pgrsSetDownloadCounter(struct UrlData *data, double size)
|
void Curl_pgrsSetDownloadCounter(struct UrlData *data, double size)
|
||||||
{
|
{
|
||||||
data->progress.downloaded = size;
|
data->progress.downloaded = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pgrsSetUploadCounter(struct UrlData *data, double size)
|
void Curl_pgrsSetUploadCounter(struct UrlData *data, double size)
|
||||||
{
|
{
|
||||||
data->progress.uploaded = size;
|
data->progress.uploaded = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pgrsSetDownloadSize(struct UrlData *data, double size)
|
void Curl_pgrsSetDownloadSize(struct UrlData *data, double size)
|
||||||
{
|
{
|
||||||
if(size > 0) {
|
if(size > 0) {
|
||||||
data->progress.size_dl = size;
|
data->progress.size_dl = size;
|
||||||
@@ -162,7 +155,7 @@ void pgrsSetDownloadSize(struct UrlData *data, double size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pgrsSetUploadSize(struct UrlData *data, double size)
|
void Curl_pgrsSetUploadSize(struct UrlData *data, double size)
|
||||||
{
|
{
|
||||||
if(size > 0) {
|
if(size > 0) {
|
||||||
data->progress.size_ul = size;
|
data->progress.size_ul = size;
|
||||||
@@ -178,12 +171,12 @@ void pgrsSetUploadSize(struct UrlData *data, double size)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int pgrsUpdate(struct UrlData *data)
|
int Curl_pgrsUpdate(struct UrlData *data)
|
||||||
{
|
{
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
char max5[6][6];
|
char max5[6][10];
|
||||||
double dlpercen=0;
|
double dlpercen=0;
|
||||||
double ulpercen=0;
|
double ulpercen=0;
|
||||||
double total_percen=0;
|
double total_percen=0;
|
||||||
@@ -191,12 +184,7 @@ int pgrsUpdate(struct UrlData *data)
|
|||||||
double total_transfer;
|
double total_transfer;
|
||||||
double total_expected_transfer;
|
double total_expected_transfer;
|
||||||
|
|
||||||
#define CURR_TIME 5
|
int nowindex = data->progress.speeder_c% CURR_TIME;
|
||||||
|
|
||||||
static double speeder[ CURR_TIME ];
|
|
||||||
static int speeder_c=0;
|
|
||||||
|
|
||||||
int nowindex = speeder_c% CURR_TIME;
|
|
||||||
int checkindex;
|
int checkindex;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
@@ -215,6 +203,9 @@ int pgrsUpdate(struct UrlData *data)
|
|||||||
even when not displayed! */
|
even when not displayed! */
|
||||||
else if(!(data->progress.flags & PGRS_HEADERS_OUT)) {
|
else if(!(data->progress.flags & PGRS_HEADERS_OUT)) {
|
||||||
if (!data->progress.callback) {
|
if (!data->progress.callback) {
|
||||||
|
if(data->resume_from)
|
||||||
|
fprintf(data->err, "** Resuming transfer from byte position %d\n",
|
||||||
|
data->resume_from);
|
||||||
fprintf(data->err,
|
fprintf(data->err,
|
||||||
" %% Total %% Received %% Xferd Average Speed Time Curr.\n"
|
" %% Total %% Received %% Xferd Average Speed Time Curr.\n"
|
||||||
" Dload Upload Total Current Left Speed\n");
|
" Dload Upload Total Current Left Speed\n");
|
||||||
@@ -222,16 +213,16 @@ int pgrsUpdate(struct UrlData *data)
|
|||||||
data->progress.flags |= PGRS_HEADERS_OUT; /* headers are shown */
|
data->progress.flags |= PGRS_HEADERS_OUT; /* headers are shown */
|
||||||
}
|
}
|
||||||
|
|
||||||
now = tvnow(); /* what time is it */
|
now = Curl_tvnow(); /* what time is it */
|
||||||
|
|
||||||
if(data->progress.lastshow == tvlong(now))
|
/* The exact time spent so far */
|
||||||
|
data->progress.timespent = Curl_tvdiff (now, data->progress.start);
|
||||||
|
|
||||||
|
if(data->progress.lastshow == Curl_tvlong(now))
|
||||||
return 0; /* never update this more than once a second if the end isn't
|
return 0; /* never update this more than once a second if the end isn't
|
||||||
reached */
|
reached */
|
||||||
data->progress.lastshow = now.tv_sec;
|
data->progress.lastshow = now.tv_sec;
|
||||||
|
|
||||||
/* The exact time spent so far */
|
|
||||||
data->progress.timespent = tvdiff (now, data->progress.start);
|
|
||||||
|
|
||||||
/* The average download speed this far */
|
/* The average download speed this far */
|
||||||
data->progress.dlspeed = data->progress.downloaded/(data->progress.timespent!=0.0?data->progress.timespent:1.0);
|
data->progress.dlspeed = data->progress.downloaded/(data->progress.timespent!=0.0?data->progress.timespent:1.0);
|
||||||
|
|
||||||
@@ -241,15 +232,19 @@ int pgrsUpdate(struct UrlData *data)
|
|||||||
/* Let's do the "current speed" thing, which should use the fastest
|
/* Let's do the "current speed" thing, which should use the fastest
|
||||||
of the dl/ul speeds */
|
of the dl/ul speeds */
|
||||||
|
|
||||||
speeder[ nowindex ] = data->progress.downloaded>data->progress.uploaded?
|
data->progress.speeder[ nowindex ] =
|
||||||
|
data->progress.downloaded>data->progress.uploaded?
|
||||||
data->progress.downloaded:data->progress.uploaded;
|
data->progress.downloaded:data->progress.uploaded;
|
||||||
speeder_c++; /* increase */
|
data->progress.speeder_c++; /* increase */
|
||||||
count = ((speeder_c>=CURR_TIME)?CURR_TIME:speeder_c) - 1;
|
count = ((data->progress.speeder_c>=CURR_TIME)?
|
||||||
checkindex = (speeder_c>=CURR_TIME)?speeder_c%CURR_TIME:0;
|
CURR_TIME:data->progress.speeder_c) - 1;
|
||||||
|
checkindex = (data->progress.speeder_c>=CURR_TIME)?
|
||||||
|
data->progress.speeder_c%CURR_TIME:0;
|
||||||
|
|
||||||
/* find out the average speed the last CURR_TIME seconds */
|
/* find out the average speed the last CURR_TIME seconds */
|
||||||
data->progress.current_speed =
|
data->progress.current_speed =
|
||||||
(speeder[nowindex]-speeder[checkindex])/(count?count:1);
|
(data->progress.speeder[nowindex]-
|
||||||
|
data->progress.speeder[checkindex])/(count?count:1);
|
||||||
|
|
||||||
if(data->progress.flags & PGRS_HIDE)
|
if(data->progress.flags & PGRS_HIDE)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -265,17 +260,13 @@ int pgrsUpdate(struct UrlData *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out the estimated time of arrival for the upload */
|
/* Figure out the estimated time of arrival for the upload */
|
||||||
if(data->progress.flags & PGRS_UL_SIZE_KNOWN) {
|
if((data->progress.flags & PGRS_UL_SIZE_KNOWN) && data->progress.ulspeed){
|
||||||
if(!data->progress.ulspeed)
|
|
||||||
data->progress.ulspeed=1;
|
|
||||||
ulestimate = data->progress.size_ul / data->progress.ulspeed;
|
ulestimate = data->progress.size_ul / data->progress.ulspeed;
|
||||||
ulpercen = (data->progress.uploaded / data->progress.size_ul)*100;
|
ulpercen = (data->progress.uploaded / data->progress.size_ul)*100;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ... and the download */
|
/* ... and the download */
|
||||||
if(data->progress.flags & PGRS_DL_SIZE_KNOWN) {
|
if((data->progress.flags & PGRS_DL_SIZE_KNOWN) && data->progress.dlspeed) {
|
||||||
if(!data->progress.dlspeed)
|
|
||||||
data->progress.dlspeed=1;
|
|
||||||
dlestimate = data->progress.size_dl / data->progress.dlspeed;
|
dlestimate = data->progress.size_dl / data->progress.dlspeed;
|
||||||
dlpercen = (data->progress.downloaded / data->progress.size_dl)*100;
|
dlpercen = (data->progress.downloaded / data->progress.size_dl)*100;
|
||||||
}
|
}
|
||||||
@@ -284,6 +275,7 @@ int pgrsUpdate(struct UrlData *data)
|
|||||||
total estimate! */
|
total estimate! */
|
||||||
total_estimate = ulestimate>dlestimate?ulestimate:dlestimate;
|
total_estimate = ulestimate>dlestimate?ulestimate:dlestimate;
|
||||||
|
|
||||||
|
|
||||||
/* If we have a total estimate, we can display that and the expected
|
/* If we have a total estimate, we can display that and the expected
|
||||||
time left */
|
time left */
|
||||||
if(total_estimate) {
|
if(total_estimate) {
|
||||||
@@ -312,7 +304,7 @@ int pgrsUpdate(struct UrlData *data)
|
|||||||
if(total_expected_transfer)
|
if(total_expected_transfer)
|
||||||
total_percen=(double)(total_transfer/total_expected_transfer)*100;
|
total_percen=(double)(total_transfer/total_expected_transfer)*100;
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(data->err,
|
||||||
"\r%3d %s %3d %s %3d %s %s %s %s %s %s %s",
|
"\r%3d %s %3d %s %3d %s %s %s %s %s %s %s",
|
||||||
(int)total_percen, /* total % */
|
(int)total_percen, /* total % */
|
||||||
max5data(total_expected_transfer, max5[2]), /* total size */
|
max5data(total_expected_transfer, max5[2]), /* total size */
|
||||||
|
|||||||
@@ -7,38 +7,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "timeval.h"
|
#include "timeval.h"
|
||||||
|
|
||||||
@@ -49,17 +32,18 @@ typedef enum {
|
|||||||
TIMER_CONNECT,
|
TIMER_CONNECT,
|
||||||
TIMER_PRETRANSFER,
|
TIMER_PRETRANSFER,
|
||||||
TIMER_POSTRANSFER,
|
TIMER_POSTRANSFER,
|
||||||
|
TIMER_STARTSINGLE,
|
||||||
TIMER_LAST /* must be last */
|
TIMER_LAST /* must be last */
|
||||||
} timerid;
|
} timerid;
|
||||||
|
|
||||||
void pgrsDone(struct UrlData *data);
|
void Curl_pgrsDone(struct UrlData *data);
|
||||||
void pgrsStartNow(struct UrlData *data);
|
void Curl_pgrsStartNow(struct UrlData *data);
|
||||||
void pgrsSetDownloadSize(struct UrlData *data, double size);
|
void Curl_pgrsSetDownloadSize(struct UrlData *data, double size);
|
||||||
void pgrsSetUploadSize(struct UrlData *data, double size);
|
void Curl_pgrsSetUploadSize(struct UrlData *data, double size);
|
||||||
void pgrsSetDownloadCounter(struct UrlData *data, double size);
|
void Curl_pgrsSetDownloadCounter(struct UrlData *data, double size);
|
||||||
void pgrsSetUploadCounter(struct UrlData *data, double size);
|
void Curl_pgrsSetUploadCounter(struct UrlData *data, double size);
|
||||||
int pgrsUpdate(struct UrlData *data);
|
int Curl_pgrsUpdate(struct UrlData *data);
|
||||||
void pgrsTime(struct UrlData *data, timerid timer);
|
void Curl_pgrsTime(struct UrlData *data, timerid timer);
|
||||||
|
|
||||||
|
|
||||||
/* Don't show progress for sizes smaller than: */
|
/* Don't show progress for sizes smaller than: */
|
||||||
|
|||||||
669
lib/security.c
Normal file
669
lib/security.c
Normal file
@@ -0,0 +1,669 @@
|
|||||||
|
/* modified by Martin Hedenfalk <mhe@stacken.kth.se> for use in Curl
|
||||||
|
* last modified 2000-09-18
|
||||||
|
* Even more obscurified to merge better into libcurl by Daniel Stenberg.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1998, 1999 Kungliga Tekniska H<>gskolan
|
||||||
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "setup.h"
|
||||||
|
|
||||||
|
#ifdef KRB4
|
||||||
|
|
||||||
|
#define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */
|
||||||
|
#include <curl/mprintf.h>
|
||||||
|
|
||||||
|
#include "security.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "base64.h"
|
||||||
|
#include "sendf.h"
|
||||||
|
#include "ftp.h"
|
||||||
|
|
||||||
|
/* The last #include file should be: */
|
||||||
|
#ifdef MALLOCDEBUG
|
||||||
|
#include "memdebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||||
|
|
||||||
|
static struct {
|
||||||
|
enum protection_level level;
|
||||||
|
const char *name;
|
||||||
|
} level_names[] = {
|
||||||
|
{ prot_clear, "clear" },
|
||||||
|
{ prot_safe, "safe" },
|
||||||
|
{ prot_confidential, "confidential" },
|
||||||
|
{ prot_private, "private" }
|
||||||
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static const char *
|
||||||
|
level_to_name(enum protection_level level)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++)
|
||||||
|
if(level_names[i].level == level)
|
||||||
|
return level_names[i].name;
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FTP_SERVER /* not used in server */
|
||||||
|
static enum protection_level
|
||||||
|
name_to_level(const char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++)
|
||||||
|
if(!strncasecmp(level_names[i].name, name, strlen(name)))
|
||||||
|
return level_names[i].level;
|
||||||
|
return (enum protection_level)-1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef FTP_SERVER
|
||||||
|
|
||||||
|
static struct sec_server_mech *mechs[] = {
|
||||||
|
#ifdef KRB5
|
||||||
|
&gss_server_mech,
|
||||||
|
#endif
|
||||||
|
#ifdef KRB4
|
||||||
|
&krb4_server_mech,
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct sec_server_mech *mech;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static struct sec_client_mech *mechs[] = {
|
||||||
|
#ifdef KRB5
|
||||||
|
&gss_client_mech,
|
||||||
|
#endif
|
||||||
|
#ifdef KRB4
|
||||||
|
&krb4_client_mech,
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct sec_client_mech *mech;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int
|
||||||
|
sec_getc(struct connectdata *conn, FILE *F)
|
||||||
|
{
|
||||||
|
if(conn->sec_complete && conn->data_prot) {
|
||||||
|
char c;
|
||||||
|
if(sec_read(conn, fileno(F), &c, 1) <= 0)
|
||||||
|
return EOF;
|
||||||
|
return c;
|
||||||
|
} else
|
||||||
|
return getc(F);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
block_read(int fd, void *buf, size_t len)
|
||||||
|
{
|
||||||
|
unsigned char *p = buf;
|
||||||
|
int b;
|
||||||
|
while(len) {
|
||||||
|
b = read(fd, p, len);
|
||||||
|
if (b == 0)
|
||||||
|
return 0;
|
||||||
|
else if (b < 0)
|
||||||
|
return -1;
|
||||||
|
len -= b;
|
||||||
|
p += b;
|
||||||
|
}
|
||||||
|
return p - (unsigned char*)buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
block_write(int fd, void *buf, size_t len)
|
||||||
|
{
|
||||||
|
unsigned char *p = buf;
|
||||||
|
int b;
|
||||||
|
while(len) {
|
||||||
|
b = write(fd, p, len);
|
||||||
|
if(b < 0)
|
||||||
|
return -1;
|
||||||
|
len -= b;
|
||||||
|
p += b;
|
||||||
|
}
|
||||||
|
return p - (unsigned char*)buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
sec_get_data(struct connectdata *conn,
|
||||||
|
int fd, struct krb4buffer *buf, int level)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
int b;
|
||||||
|
|
||||||
|
b = block_read(fd, &len, sizeof(len));
|
||||||
|
if (b == 0)
|
||||||
|
return 0;
|
||||||
|
else if (b < 0)
|
||||||
|
return -1;
|
||||||
|
len = ntohl(len);
|
||||||
|
buf->data = realloc(buf->data, len);
|
||||||
|
b = block_read(fd, buf->data, len);
|
||||||
|
if (b == 0)
|
||||||
|
return 0;
|
||||||
|
else if (b < 0)
|
||||||
|
return -1;
|
||||||
|
buf->size = (*mech->decode)(conn->app_data, buf->data, len,
|
||||||
|
conn->data_prot, conn);
|
||||||
|
buf->index = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t
|
||||||
|
buffer_read(struct krb4buffer *buf, void *data, size_t len)
|
||||||
|
{
|
||||||
|
len = min(len, buf->size - buf->index);
|
||||||
|
memcpy(data, (char*)buf->data + buf->index, len);
|
||||||
|
buf->index += len;
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t
|
||||||
|
buffer_write(struct krb4buffer *buf, void *data, size_t len)
|
||||||
|
{
|
||||||
|
if(buf->index + len > buf->size) {
|
||||||
|
void *tmp;
|
||||||
|
if(buf->data == NULL)
|
||||||
|
tmp = malloc(1024);
|
||||||
|
else
|
||||||
|
tmp = realloc(buf->data, buf->index + len);
|
||||||
|
if(tmp == NULL)
|
||||||
|
return -1;
|
||||||
|
buf->data = tmp;
|
||||||
|
buf->size = buf->index + len;
|
||||||
|
}
|
||||||
|
memcpy((char*)buf->data + buf->index, data, len);
|
||||||
|
buf->index += len;
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
sec_read(struct connectdata *conn, int fd, void *buffer, int length)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
int rx = 0;
|
||||||
|
|
||||||
|
if(conn->sec_complete == 0 || conn->data_prot == 0)
|
||||||
|
return read(fd, buffer, length);
|
||||||
|
|
||||||
|
if(conn->in_buffer.eof_flag){
|
||||||
|
conn->in_buffer.eof_flag = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = buffer_read(&conn->in_buffer, buffer, length);
|
||||||
|
length -= len;
|
||||||
|
rx += len;
|
||||||
|
buffer = (char*)buffer + len;
|
||||||
|
|
||||||
|
while(length) {
|
||||||
|
if(sec_get_data(conn, fd, &conn->in_buffer, conn->data_prot) < 0)
|
||||||
|
return -1;
|
||||||
|
if(conn->in_buffer.size == 0) {
|
||||||
|
if(rx)
|
||||||
|
conn->in_buffer.eof_flag = 1;
|
||||||
|
return rx;
|
||||||
|
}
|
||||||
|
len = buffer_read(&conn->in_buffer, buffer, length);
|
||||||
|
length -= len;
|
||||||
|
rx += len;
|
||||||
|
buffer = (char*)buffer + len;
|
||||||
|
}
|
||||||
|
return rx;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
sec_send(struct connectdata *conn, int fd, char *from, int length)
|
||||||
|
{
|
||||||
|
int bytes;
|
||||||
|
void *buf;
|
||||||
|
bytes = (*mech->encode)(conn->app_data, from, length, conn->data_prot, &buf, conn);
|
||||||
|
bytes = htonl(bytes);
|
||||||
|
block_write(fd, &bytes, sizeof(bytes));
|
||||||
|
block_write(fd, buf, ntohl(bytes));
|
||||||
|
free(buf);
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
sec_fflush(struct connectdata *conn, FILE *F)
|
||||||
|
{
|
||||||
|
if(conn->data_prot != prot_clear) {
|
||||||
|
if(conn->out_buffer.index > 0){
|
||||||
|
sec_write(conn, fileno(F),
|
||||||
|
conn->out_buffer.data, conn->out_buffer.index);
|
||||||
|
conn->out_buffer.index = 0;
|
||||||
|
}
|
||||||
|
sec_send(conn, fileno(F), NULL, 0);
|
||||||
|
}
|
||||||
|
fflush(F);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
sec_fflush_fd(struct connectdata *conn, int fd)
|
||||||
|
{
|
||||||
|
if(conn->data_prot != prot_clear) {
|
||||||
|
if(conn->out_buffer.index > 0){
|
||||||
|
sec_write(conn, fd,
|
||||||
|
conn->out_buffer.data, conn->out_buffer.index);
|
||||||
|
conn->out_buffer.index = 0;
|
||||||
|
}
|
||||||
|
sec_send(conn, fd, NULL, 0);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
sec_write(struct connectdata *conn, int fd, char *buffer, int length)
|
||||||
|
{
|
||||||
|
int len = conn->buffer_size;
|
||||||
|
int tx = 0;
|
||||||
|
|
||||||
|
if(conn->data_prot == prot_clear)
|
||||||
|
return write(fd, buffer, length);
|
||||||
|
|
||||||
|
len -= (*mech->overhead)(conn->app_data, conn->data_prot, len);
|
||||||
|
while(length){
|
||||||
|
if(length < len)
|
||||||
|
len = length;
|
||||||
|
sec_send(conn, fd, buffer, len);
|
||||||
|
length -= len;
|
||||||
|
buffer += len;
|
||||||
|
tx += len;
|
||||||
|
}
|
||||||
|
return tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
sec_vfprintf2(struct connectdata *conn, FILE *f, const char *fmt, va_list ap)
|
||||||
|
{
|
||||||
|
char *buf;
|
||||||
|
int ret;
|
||||||
|
if(conn->data_prot == prot_clear)
|
||||||
|
return vfprintf(f, fmt, ap);
|
||||||
|
else {
|
||||||
|
buf = aprintf(fmt, ap);
|
||||||
|
ret = buffer_write(&conn->out_buffer, buf, strlen(buf));
|
||||||
|
free(buf);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
sec_fprintf2(struct connectdata *conn, FILE *f, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
ret = sec_vfprintf2(conn, f, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
sec_putc(struct connectdata *conn, int c, FILE *F)
|
||||||
|
{
|
||||||
|
char ch = c;
|
||||||
|
if(conn->data_prot == prot_clear)
|
||||||
|
return putc(c, F);
|
||||||
|
|
||||||
|
buffer_write(&conn->out_buffer, &ch, 1);
|
||||||
|
if(c == '\n' || conn->out_buffer.index >= 1024 /* XXX */) {
|
||||||
|
sec_write(conn, fileno(F), conn->out_buffer.data, conn->out_buffer.index);
|
||||||
|
conn->out_buffer.index = 0;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
sec_read_msg(struct connectdata *conn, char *s, int level)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
char *buf;
|
||||||
|
int code;
|
||||||
|
|
||||||
|
buf = malloc(strlen(s));
|
||||||
|
len = Curl_base64_decode(s + 4, buf); /* XXX */
|
||||||
|
|
||||||
|
len = (*mech->decode)(conn->app_data, buf, len, level, conn);
|
||||||
|
if(len < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
buf[len] = '\0';
|
||||||
|
|
||||||
|
if(buf[3] == '-')
|
||||||
|
code = 0;
|
||||||
|
else
|
||||||
|
sscanf(buf, "%d", &code);
|
||||||
|
if(buf[len-1] == '\n')
|
||||||
|
buf[len-1] = '\0';
|
||||||
|
strcpy(s, buf);
|
||||||
|
free(buf);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* modified to return how many bytes written, or -1 on error ***/
|
||||||
|
int
|
||||||
|
sec_vfprintf(struct connectdata *conn, FILE *f, const char *fmt, va_list ap)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
char *buf;
|
||||||
|
void *enc;
|
||||||
|
int len;
|
||||||
|
if(!conn->sec_complete)
|
||||||
|
return vfprintf(f, fmt, ap);
|
||||||
|
|
||||||
|
buf = aprintf(fmt, ap);
|
||||||
|
len = (*mech->encode)(conn->app_data, buf, strlen(buf),
|
||||||
|
conn->command_prot, &enc,
|
||||||
|
conn);
|
||||||
|
free(buf);
|
||||||
|
if(len < 0) {
|
||||||
|
failf(conn->data, "Failed to encode command.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(Curl_base64_encode(enc, len, &buf) < 0){
|
||||||
|
failf(conn->data, "Out of memory base64-encoding.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#ifdef FTP_SERVER
|
||||||
|
if(command_prot == prot_safe)
|
||||||
|
fprintf(f, "631 %s\r\n", buf);
|
||||||
|
else if(command_prot == prot_private)
|
||||||
|
fprintf(f, "632 %s\r\n", buf);
|
||||||
|
else if(command_prot == prot_confidential)
|
||||||
|
fprintf(f, "633 %s\r\n", buf);
|
||||||
|
#else
|
||||||
|
if(conn->command_prot == prot_safe)
|
||||||
|
ret = fprintf(f, "MIC %s", buf);
|
||||||
|
else if(conn->command_prot == prot_private)
|
||||||
|
ret = fprintf(f, "ENC %s", buf);
|
||||||
|
else if(conn->command_prot == prot_confidential)
|
||||||
|
ret = fprintf(f, "CONF %s", buf);
|
||||||
|
#endif
|
||||||
|
free(buf);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
sec_fprintf(struct connectdata *conn, FILE *f, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
int ret;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
ret = sec_vfprintf(conn, f, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end common stuff */
|
||||||
|
|
||||||
|
#ifdef FTP_SERVER
|
||||||
|
|
||||||
|
/* snip */
|
||||||
|
|
||||||
|
#else /* FTP_SERVER */
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void
|
||||||
|
sec_status(void)
|
||||||
|
{
|
||||||
|
if(conn->sec_complete){
|
||||||
|
printf("Using %s for authentication.\n", mech->name);
|
||||||
|
printf("Using %s command channel.\n", level_to_name(command_prot));
|
||||||
|
printf("Using %s data channel.\n", level_to_name(data_prot));
|
||||||
|
if(buffer_size > 0)
|
||||||
|
printf("Protection buffer size: %lu.\n",
|
||||||
|
(unsigned long)buffer_size);
|
||||||
|
}else{
|
||||||
|
printf("Not using any security mechanism.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int
|
||||||
|
sec_prot_internal(struct connectdata *conn, int level)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
unsigned int s = 1048576;
|
||||||
|
size_t nread;
|
||||||
|
|
||||||
|
if(!conn->sec_complete){
|
||||||
|
infof(conn->data, "No security data exchange has taken place.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(level){
|
||||||
|
Curl_ftpsendf(conn->data->firstsocket, conn,
|
||||||
|
"PBSZ %u", s);
|
||||||
|
/* wait for feedback */
|
||||||
|
nread = Curl_GetFTPResponse(conn->data->firstsocket,
|
||||||
|
conn->data->buffer, conn, NULL);
|
||||||
|
if(nread < 0)
|
||||||
|
return /*CURLE_OPERATION_TIMEOUTED*/-1;
|
||||||
|
if(/*ret != COMPLETE*/conn->data->buffer[0] != '2'){
|
||||||
|
failf(conn->data, "Failed to set protection buffer size.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
conn->buffer_size = s;
|
||||||
|
p = strstr(/*reply_string*/conn->data->buffer, "PBSZ=");
|
||||||
|
if(p)
|
||||||
|
sscanf(p, "PBSZ=%u", &s);
|
||||||
|
if(s < conn->buffer_size)
|
||||||
|
conn->buffer_size = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
Curl_ftpsendf(conn->data->firstsocket, conn,
|
||||||
|
"PROT %c", level["CSEP"]);
|
||||||
|
/* wait for feedback */
|
||||||
|
nread = Curl_GetFTPResponse(conn->data->firstsocket,
|
||||||
|
conn->data->buffer, conn, NULL);
|
||||||
|
if(nread < 0)
|
||||||
|
return /*CURLE_OPERATION_TIMEOUTED*/-1;
|
||||||
|
if(/*ret != COMPLETE*/conn->data->buffer[0] != '2'){
|
||||||
|
failf(conn->data, "Failed to set protection level.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
conn->data_prot = (enum protection_level)level;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum protection_level
|
||||||
|
set_command_prot(struct connectdata *conn, enum protection_level level)
|
||||||
|
{
|
||||||
|
enum protection_level old = conn->command_prot;
|
||||||
|
conn->command_prot = level;
|
||||||
|
return old;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void
|
||||||
|
sec_prot(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int level = -1;
|
||||||
|
|
||||||
|
if(argc < 2 || argc > 3)
|
||||||
|
goto usage;
|
||||||
|
if(!sec_complete) {
|
||||||
|
printf("No security data exchange has taken place.\n");
|
||||||
|
code = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
level = name_to_level(argv[argc - 1]);
|
||||||
|
|
||||||
|
if(level == -1)
|
||||||
|
goto usage;
|
||||||
|
|
||||||
|
if((*mech->check_prot)(conn->app_data, level)) {
|
||||||
|
printf("%s does not implement %s protection.\n",
|
||||||
|
mech->name, level_to_name(level));
|
||||||
|
code = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(argc == 2 || strncasecmp(argv[1], "data", strlen(argv[1])) == 0) {
|
||||||
|
if(sec_prot_internal(level) < 0){
|
||||||
|
code = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if(strncasecmp(argv[1], "command", strlen(argv[1])) == 0)
|
||||||
|
set_command_prot(level);
|
||||||
|
else
|
||||||
|
goto usage;
|
||||||
|
code = 0;
|
||||||
|
return;
|
||||||
|
usage:
|
||||||
|
printf("usage: %s [command|data] [clear|safe|confidential|private]\n",
|
||||||
|
argv[0]);
|
||||||
|
code = -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
sec_set_protection_level(struct connectdata *conn)
|
||||||
|
{
|
||||||
|
if(conn->sec_complete && conn->data_prot != conn->request_data_prot)
|
||||||
|
sec_prot_internal(conn, conn->request_data_prot);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
sec_request_prot(struct connectdata *conn, char *level)
|
||||||
|
{
|
||||||
|
int l = name_to_level(level);
|
||||||
|
if(l == -1)
|
||||||
|
return -1;
|
||||||
|
conn->request_data_prot = (enum protection_level)l;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
sec_login(struct connectdata *conn)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct sec_client_mech **m;
|
||||||
|
size_t nread;
|
||||||
|
struct UrlData *data=conn->data;
|
||||||
|
|
||||||
|
for(m = mechs; *m && (*m)->name; m++) {
|
||||||
|
void *tmp;
|
||||||
|
|
||||||
|
tmp = realloc(conn->app_data, (*m)->size);
|
||||||
|
if (tmp == NULL) {
|
||||||
|
failf (data, "realloc %u failed", (*m)->size);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
conn->app_data = tmp;
|
||||||
|
|
||||||
|
if((*m)->init && (*(*m)->init)(conn->app_data) != 0) {
|
||||||
|
infof(data, "Skipping %s...\n", (*m)->name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
infof(data, "Trying %s...\n", (*m)->name);
|
||||||
|
/*ret = command("AUTH %s", (*m)->name);***/
|
||||||
|
Curl_ftpsendf(conn->data->firstsocket, conn,
|
||||||
|
"AUTH %s", (*m)->name);
|
||||||
|
/* wait for feedback */
|
||||||
|
nread = Curl_GetFTPResponse(conn->data->firstsocket,
|
||||||
|
conn->data->buffer, conn, NULL);
|
||||||
|
if(nread < 0)
|
||||||
|
return /*CURLE_OPERATION_TIMEOUTED*/-1;
|
||||||
|
if(/*ret != CONTINUE*/conn->data->buffer[0] != '3'){
|
||||||
|
if(/*code == 504*/strncmp(conn->data->buffer,"504",3) == 0) {
|
||||||
|
infof(data,
|
||||||
|
"%s is not supported by the server.\n", (*m)->name);
|
||||||
|
}
|
||||||
|
else if(/*code == 534*/strncmp(conn->data->buffer,"534",3) == 0) {
|
||||||
|
infof(data, "%s rejected as security mechanism.\n", (*m)->name);
|
||||||
|
}
|
||||||
|
else if(/*ret == ERROR*/conn->data->buffer[0] == '5') {
|
||||||
|
infof(data, "The server doesn't support the FTP "
|
||||||
|
"security extensions.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = (*(*m)->auth)(conn->app_data, /*host***/conn);
|
||||||
|
|
||||||
|
if(ret == AUTH_CONTINUE)
|
||||||
|
continue;
|
||||||
|
else if(ret != AUTH_OK){
|
||||||
|
/* mechanism is supposed to output error string */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
mech = *m;
|
||||||
|
conn->sec_complete = 1;
|
||||||
|
conn->command_prot = prot_safe;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return *m == NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sec_end(struct connectdata *conn)
|
||||||
|
{
|
||||||
|
if (mech != NULL) {
|
||||||
|
if(mech->end)
|
||||||
|
(*mech->end)(conn->app_data);
|
||||||
|
memset(conn->app_data, 0, mech->size);
|
||||||
|
free(conn->app_data);
|
||||||
|
conn->app_data = NULL;
|
||||||
|
}
|
||||||
|
conn->sec_complete = 0;
|
||||||
|
conn->data_prot = (enum protection_level)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* FTP_SERVER */
|
||||||
|
|
||||||
|
#endif /* KRB4 */
|
||||||
134
lib/security.h
Normal file
134
lib/security.h
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
/* modified by Martin Hedenfalk <mhe@stacken.kth.se> for use in Curl
|
||||||
|
* last modified 2000-09-18
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1998, 1999 Kungliga Tekniska H<>gskolan
|
||||||
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
#ifndef __security_h__
|
||||||
|
#define __security_h__
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include "urldata.h" /* for struct connectdata * */
|
||||||
|
|
||||||
|
struct sec_client_mech {
|
||||||
|
char *name;
|
||||||
|
size_t size;
|
||||||
|
int (*init)(void *);
|
||||||
|
int (*auth)(void *, struct connectdata *);
|
||||||
|
void (*end)(void *);
|
||||||
|
int (*check_prot)(void *, int);
|
||||||
|
int (*overhead)(void *, int, int);
|
||||||
|
int (*encode)(void *, void*, int, int, void**, struct connectdata *);
|
||||||
|
int (*decode)(void *, void*, int, int, struct connectdata *);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sec_server_mech {
|
||||||
|
char *name;
|
||||||
|
size_t size;
|
||||||
|
int (*init)(void *);
|
||||||
|
void (*end)(void *);
|
||||||
|
int (*check_prot)(void *, int);
|
||||||
|
int (*overhead)(void *, int, int);
|
||||||
|
int (*encode)(void *, void*, int, int, void**);
|
||||||
|
int (*decode)(void *, void*, int, int);
|
||||||
|
|
||||||
|
int (*auth)(void *);
|
||||||
|
int (*adat)(void *, void*, size_t);
|
||||||
|
size_t (*pbsz)(void *, size_t);
|
||||||
|
int (*ccc)(void*);
|
||||||
|
int (*userok)(void*, char*);
|
||||||
|
};
|
||||||
|
|
||||||
|
#define AUTH_OK 0
|
||||||
|
#define AUTH_CONTINUE 1
|
||||||
|
#define AUTH_ERROR 2
|
||||||
|
|
||||||
|
#ifdef FTP_SERVER
|
||||||
|
extern struct sec_server_mech krb4_server_mech, gss_server_mech;
|
||||||
|
#else
|
||||||
|
extern struct sec_client_mech krb4_client_mech, gss_client_mech;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern int sec_complete;
|
||||||
|
|
||||||
|
#ifdef FTP_SERVER
|
||||||
|
extern char *ftp_command;
|
||||||
|
void new_ftp_command(char*);
|
||||||
|
void delete_ftp_command(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ---- */
|
||||||
|
|
||||||
|
|
||||||
|
int sec_fflush (struct connectdata *conn, FILE *);
|
||||||
|
int sec_fflush_fd(struct connectdata *conn, int fd);
|
||||||
|
int sec_fprintf (struct connectdata *, FILE *, const char *, ...);
|
||||||
|
int sec_getc (struct connectdata *conn, FILE *);
|
||||||
|
int sec_putc (struct connectdata *conn, int, FILE *);
|
||||||
|
int sec_read (struct connectdata *conn, int, void *, int);
|
||||||
|
int sec_read_msg (struct connectdata *conn, char *, int);
|
||||||
|
|
||||||
|
int sec_vfprintf(struct connectdata *, FILE *, const char *, va_list);
|
||||||
|
int sec_fprintf2(struct connectdata *conn, FILE *f, const char *fmt, ...);
|
||||||
|
int sec_vfprintf2(struct connectdata *conn, FILE *, const char *, va_list);
|
||||||
|
int sec_write (struct connectdata *conn, int, char *, int);
|
||||||
|
|
||||||
|
#ifdef FTP_SERVER
|
||||||
|
void adat (char *);
|
||||||
|
void auth (char *);
|
||||||
|
void ccc (void);
|
||||||
|
void mec (char *, enum protection_level);
|
||||||
|
void pbsz (int);
|
||||||
|
void prot (char *);
|
||||||
|
void delete_ftp_command (void);
|
||||||
|
void new_ftp_command (char *);
|
||||||
|
int sec_userok (char *);
|
||||||
|
int secure_command (void);
|
||||||
|
enum protection_level get_command_prot(void);
|
||||||
|
#else
|
||||||
|
void sec_end (struct connectdata *);
|
||||||
|
int sec_login (struct connectdata *);
|
||||||
|
void sec_prot (int, char **);
|
||||||
|
int sec_request_prot (struct connectdata *conn, char *);
|
||||||
|
void sec_set_protection_level(struct connectdata *conn);
|
||||||
|
void sec_status (void);
|
||||||
|
|
||||||
|
enum protection_level set_command_prot(struct connectdata *,
|
||||||
|
enum protection_level);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __security_h__ */
|
||||||
235
lib/sendf.c
235
lib/sendf.c
@@ -5,38 +5,21 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
@@ -53,12 +36,23 @@
|
|||||||
|
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include "urldata.h"
|
#include "urldata.h"
|
||||||
|
#include "sendf.h"
|
||||||
|
|
||||||
|
#define _MPRINTF_REPLACE /* use the internal *printf() functions */
|
||||||
#include <curl/mprintf.h>
|
#include <curl/mprintf.h>
|
||||||
|
|
||||||
|
#ifdef KRB4
|
||||||
|
#include "security.h"
|
||||||
|
#endif
|
||||||
|
#include <string.h>
|
||||||
|
/* The last #include file should be: */
|
||||||
|
#ifdef MALLOCDEBUG
|
||||||
|
#include "memdebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* infof() is for info message along the way */
|
/* infof() is for info message along the way */
|
||||||
|
|
||||||
void infof(struct UrlData *data, char *fmt, ...)
|
void Curl_infof(struct UrlData *data, char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
if(data->bits.verbose) {
|
if(data->bits.verbose) {
|
||||||
@@ -72,62 +66,181 @@ void infof(struct UrlData *data, char *fmt, ...)
|
|||||||
/* failf() is for messages stating why we failed, the LAST one will be
|
/* failf() is for messages stating why we failed, the LAST one will be
|
||||||
returned for the user (if requested) */
|
returned for the user (if requested) */
|
||||||
|
|
||||||
void failf(struct UrlData *data, char *fmt, ...)
|
void Curl_failf(struct UrlData *data, char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
if(data->errorbuffer)
|
if(data->errorbuffer)
|
||||||
vsprintf(data->errorbuffer, fmt, ap);
|
vsnprintf(data->errorbuffer, CURL_ERROR_SIZE, fmt, ap);
|
||||||
else /* no errorbuffer receives this, write to data->err instead */
|
else /* no errorbuffer receives this, write to data->err instead */
|
||||||
vfprintf(data->err, fmt, ap);
|
vfprintf(data->err, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sendf() sends the formated data to the server */
|
/* Curl_sendf() sends formated data to the server */
|
||||||
int sendf(int fd, struct UrlData *data, char *fmt, ...)
|
size_t Curl_sendf(int sockfd, struct connectdata *conn,
|
||||||
|
char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
struct UrlData *data = conn->data;
|
||||||
size_t bytes_written;
|
size_t bytes_written;
|
||||||
char *s;
|
char *s;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
s = mvaprintf(fmt, ap);
|
s = vaprintf(fmt, ap); /* returns an allocated string */
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
if(!s)
|
if(!s)
|
||||||
return 0; /* failure */
|
return 0; /* failure */
|
||||||
if(data->bits.verbose)
|
if(data->bits.verbose)
|
||||||
fprintf(data->err, "> %s", s);
|
fprintf(data->err, "> %s", s);
|
||||||
#ifndef USE_SSLEAY
|
|
||||||
bytes_written = swrite(fd, s, strlen(s));
|
/* Write the buffer to the socket */
|
||||||
#else
|
Curl_write(conn, sockfd, s, strlen(s), &bytes_written);
|
||||||
if (data->use_ssl) {
|
|
||||||
bytes_written = SSL_write(data->ssl, s, strlen(s));
|
|
||||||
} else {
|
|
||||||
bytes_written = swrite(fd, s, strlen(s));
|
|
||||||
}
|
|
||||||
#endif /* USE_SSLEAY */
|
|
||||||
free(s); /* free the output string */
|
free(s); /* free the output string */
|
||||||
return(bytes_written);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ssend() sends plain (binary) data to the server */
|
|
||||||
size_t ssend(int fd, struct UrlData *data, void *mem, size_t len)
|
|
||||||
{
|
|
||||||
size_t bytes_written;
|
|
||||||
|
|
||||||
if(data->bits.verbose)
|
|
||||||
fprintf(data->err, "> [binary output]\n");
|
|
||||||
#ifndef USE_SSLEAY
|
|
||||||
bytes_written = swrite(fd, mem, len);
|
|
||||||
#else
|
|
||||||
if (data->use_ssl) {
|
|
||||||
bytes_written = SSL_write(data->ssl, mem, len);
|
|
||||||
} else {
|
|
||||||
bytes_written = swrite(fd, mem, len);
|
|
||||||
}
|
|
||||||
#endif /* USE_SSLEAY */
|
|
||||||
return bytes_written;
|
return bytes_written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Curl_write() is an internal write function that sends plain (binary) data
|
||||||
|
* to the server. Works with plain sockets, SSL or kerberos.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
CURLcode Curl_write(struct connectdata *conn, int sockfd,
|
||||||
|
void *mem, size_t len,
|
||||||
|
size_t *written)
|
||||||
|
{
|
||||||
|
size_t bytes_written;
|
||||||
|
struct UrlData *data=conn->data; /* conn knows data, not vice versa */
|
||||||
|
|
||||||
|
#ifdef USE_SSLEAY
|
||||||
|
if (data->ssl.use) {
|
||||||
|
int loop=100; /* just a precaution to never loop endlessly */
|
||||||
|
while(loop--) {
|
||||||
|
bytes_written = SSL_write(data->ssl.handle, mem, len);
|
||||||
|
if((-1 != bytes_written) ||
|
||||||
|
(SSL_ERROR_WANT_WRITE != SSL_get_error(data->ssl.handle,
|
||||||
|
bytes_written) ))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#endif
|
||||||
|
#ifdef KRB4
|
||||||
|
if(conn->sec_complete) {
|
||||||
|
bytes_written = sec_write(conn, sockfd, mem, len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif /* KRB4 */
|
||||||
|
bytes_written = swrite(sockfd, mem, len);
|
||||||
|
#ifdef USE_SSLEAY
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
*written = bytes_written;
|
||||||
|
return CURLE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* External write-function, writes to the data-socket.
|
||||||
|
* Takes care of plain sockets, SSL or kerberos transparently.
|
||||||
|
*/
|
||||||
|
CURLcode curl_write(CURLconnect *c_conn, char *buf, size_t amount,
|
||||||
|
size_t *n)
|
||||||
|
{
|
||||||
|
struct connectdata *conn = (struct connectdata *)c_conn;
|
||||||
|
|
||||||
|
if(!n || !conn || (conn->handle != STRUCT_CONNECT))
|
||||||
|
return CURLE_FAILED_INIT;
|
||||||
|
|
||||||
|
return Curl_write(conn, conn->sockfd, buf, amount, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* client_write() sends data to the write callback(s)
|
||||||
|
|
||||||
|
The bit pattern defines to what "streams" to write to. Body and/or header.
|
||||||
|
The defines are in sendf.h of course.
|
||||||
|
*/
|
||||||
|
CURLcode Curl_client_write(struct UrlData *data,
|
||||||
|
int type,
|
||||||
|
char *ptr,
|
||||||
|
size_t len)
|
||||||
|
{
|
||||||
|
size_t wrote;
|
||||||
|
|
||||||
|
if(0 == len)
|
||||||
|
len = strlen(ptr);
|
||||||
|
|
||||||
|
if(type & CLIENTWRITE_BODY) {
|
||||||
|
wrote = data->fwrite(ptr, 1, len, data->out);
|
||||||
|
if(wrote != len) {
|
||||||
|
failf (data, "Failed writing body");
|
||||||
|
return CURLE_WRITE_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if((type & CLIENTWRITE_HEADER) && data->writeheader) {
|
||||||
|
wrote = data->fwrite(ptr, 1, len, data->writeheader);
|
||||||
|
if(wrote != len) {
|
||||||
|
failf (data, "Failed writing header");
|
||||||
|
return CURLE_WRITE_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return CURLE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Internal read-from-socket function. This is meant to deal with plain
|
||||||
|
* sockets, SSL sockets and kerberos sockets.
|
||||||
|
*/
|
||||||
|
CURLcode Curl_read(struct connectdata *conn, int sockfd,
|
||||||
|
char *buf, size_t buffersize,
|
||||||
|
size_t *n)
|
||||||
|
{
|
||||||
|
struct UrlData *data = conn->data;
|
||||||
|
size_t nread;
|
||||||
|
|
||||||
|
#ifdef USE_SSLEAY
|
||||||
|
if (data->ssl.use) {
|
||||||
|
int loop=100; /* just a precaution to never loop endlessly */
|
||||||
|
while(loop--) {
|
||||||
|
nread = SSL_read(data->ssl.handle, buf, buffersize);
|
||||||
|
if((-1 != nread) ||
|
||||||
|
(SSL_ERROR_WANT_READ != SSL_get_error(data->ssl.handle, nread) ))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#endif
|
||||||
|
#ifdef KRB4
|
||||||
|
if(conn->sec_complete)
|
||||||
|
nread = sec_read(conn, sockfd, buf, buffersize);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
nread = sread (sockfd, buf, buffersize);
|
||||||
|
#ifdef USE_SSLEAY
|
||||||
|
}
|
||||||
|
#endif /* USE_SSLEAY */
|
||||||
|
*n = nread;
|
||||||
|
return CURLE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The public read function reads from the 'sockfd' file descriptor only.
|
||||||
|
* Use the Curl_read() internally when you want to specify fd.
|
||||||
|
*/
|
||||||
|
|
||||||
|
CURLcode curl_read(CURLconnect *c_conn, char *buf, size_t buffersize,
|
||||||
|
size_t *n)
|
||||||
|
{
|
||||||
|
struct connectdata *conn = (struct connectdata *)c_conn;
|
||||||
|
|
||||||
|
if(!n || !conn || (conn->handle != STRUCT_CONNECT))
|
||||||
|
return CURLE_FAILED_INIT;
|
||||||
|
|
||||||
|
return Curl_read(conn, conn->sockfd, buf, buffersize, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
72
lib/sendf.h
72
lib/sendf.h
@@ -7,42 +7,50 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
* Version 1.0 (the "License"); you may not use this file except in
|
|
||||||
* compliance with the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS IS"
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
* License for the specific language governing rights and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
*
|
||||||
* The Original Code is Curl.
|
* 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 MPL or the MIT/X-derivate
|
||||||
|
* licenses. You may pick one of these licenses.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Daniel Stenberg.
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998.
|
* $Id$
|
||||||
* All Rights Reserved.
|
*****************************************************************************/
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* Main author:
|
|
||||||
* - Daniel Stenberg <daniel@haxx.se>
|
|
||||||
*
|
|
||||||
* http://curl.haxx.se
|
|
||||||
*
|
|
||||||
* $Source$
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
* $State$
|
|
||||||
* $Locker$
|
|
||||||
*
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
size_t sendf(int fd, struct UrlData *, char *fmt, ...);
|
size_t Curl_sendf(int fd, struct connectdata *, char *fmt, ...);
|
||||||
size_t ssend(int fd, struct UrlData *, void *fmt, size_t len);
|
void Curl_infof(struct UrlData *, char *fmt, ...);
|
||||||
void infof(struct UrlData *, char *fmt, ...);
|
void Curl_failf(struct UrlData *, char *fmt, ...);
|
||||||
void failf(struct UrlData *, char *fmt, ...);
|
|
||||||
|
#define infof Curl_infof
|
||||||
|
#define failf Curl_failf
|
||||||
|
|
||||||
|
struct send_buffer {
|
||||||
|
char *buffer;
|
||||||
|
long size_max;
|
||||||
|
long size_used;
|
||||||
|
};
|
||||||
|
typedef struct send_buffer send_buffer;
|
||||||
|
|
||||||
|
#define CLIENTWRITE_BODY 1
|
||||||
|
#define CLIENTWRITE_HEADER 2
|
||||||
|
#define CLIENTWRITE_BOTH (CLIENTWRITE_BODY|CLIENTWRITE_HEADER)
|
||||||
|
|
||||||
|
CURLcode Curl_client_write(struct UrlData *data, int type, char *ptr,
|
||||||
|
size_t len);
|
||||||
|
|
||||||
|
/* internal read-function, does plain socket, SSL and krb4 */
|
||||||
|
CURLcode Curl_read(struct connectdata *conn, int sockfd,
|
||||||
|
char *buf, size_t buffersize,
|
||||||
|
size_t *n);
|
||||||
|
/* internal write-function, does plain socket, SSL and krb4 */
|
||||||
|
CURLcode Curl_write(struct connectdata *conn, int sockfd,
|
||||||
|
void *mem, size_t len,
|
||||||
|
size_t *written);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user