Compare commits
375 Commits
curl-7_4_1
...
curl-7_6
Author | SHA1 | Date | |
---|---|---|---|
![]() |
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 |
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
|
72
FILES
72
FILES
@@ -1,72 +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
|
||||
docs/examples/README
|
||||
docs/examples/*.c
|
||||
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/config-win32.h
|
||||
src/hugehelp.c
|
||||
src/main.c
|
||||
src/setup.h
|
||||
src/urlglob.c
|
||||
src/urlglob.h
|
||||
src/version.h
|
||||
src/writeout.c
|
||||
src/writeout.h
|
||||
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
|
||||
lib/libcurl.def
|
||||
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
|
||||
version 1.0, which is part of this distribution (MPL-1.0.txt) and
|
||||
available on-line at http://www.mozilla.org/MPL/
|
||||
Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
|
||||
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
|
||||
Regulation" the following exemptions apply to this software:
|
||||
In order to be useful for every potential user, the curl and libcurl are
|
||||
dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
|
||||
* The Initial Developer has the right, regardless of the citizenship
|
||||
of any involved party, to choose the location for settling disputes
|
||||
as refered to under section "11. Miscellaneous" of the Mozilla Public
|
||||
License.
|
||||
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 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
|
||||
document.
|
||||
|
||||
Daniel Stenberg <daniel@haxx.se>
|
||||
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.
|
||||
|
||||
Curl is Copyright (C) 1996-2000 Daniel Stenberg
|
||||
|
||||
|
||||
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
|
||||
|
||||
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 ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# 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/
|
||||
# Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# 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.
|
||||
# In order to be useful for every potential user, curl and libcurl are
|
||||
# dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
# $Id$
|
||||
#############################################################################
|
||||
|
||||
all:
|
||||
./configure
|
||||
@@ -49,6 +29,10 @@ ssl:
|
||||
./configure --with-ssl
|
||||
make
|
||||
|
||||
borland:
|
||||
cd lib; make -f Makefile.b32
|
||||
cd src; make -f Makefile.b32
|
||||
|
||||
mingw32:
|
||||
cd lib; make -f Makefile.m32
|
||||
cd src; make -f Makefile.m32
|
||||
@@ -58,8 +42,16 @@ mingw32-ssl:
|
||||
cd src; make -f Makefile.m32 SSL=1
|
||||
|
||||
vc:
|
||||
cd lib; nmake -f Makefile.vc6
|
||||
cd src; nmake -f Makefile.vc6
|
||||
cd lib
|
||||
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:
|
||||
./configure
|
||||
|
11
README
11
README
@@ -8,15 +8,17 @@ README
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
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!
|
||||
|
||||
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:
|
||||
|
||||
http://curl.haxx.se
|
||||
@@ -25,7 +27,6 @@ README
|
||||
|
||||
Sweden -- ftp://ftp.sunet.se/pub/www/utilities/curl/
|
||||
Germany -- ftp://ftp.fu-berlin.de/pub/unix/network/curl/
|
||||
Australia -- http://curl.linuxworx.com.au/
|
||||
|
||||
To download the very latest source off the CVS server do this:
|
||||
|
||||
@@ -42,3 +43,7 @@ README
|
||||
cvs -d :pserver:anonymous@cvs.curl.sourceforge.net:/cvsroot/curl logout
|
||||
|
||||
(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.
|
||||
|
@@ -36,3 +36,6 @@
|
||||
|
||||
/* 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
|
||||
|
306
config.h.in
306
config.h.in
@@ -1,306 +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
|
||||
|
||||
/* Define if you have the Kerberos4 libraries (including -ldes) */
|
||||
#undef KRB4
|
||||
|
||||
/* 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 krb_get_our_ip_for_realm function. */
|
||||
#undef HAVE_KRB_GET_OUR_IP_FOR_REALM
|
||||
|
||||
/* 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 strlcpy function. */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* 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 <des.h> header file. */
|
||||
#undef HAVE_DES_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 <krb.h> header file. */
|
||||
#undef HAVE_KRB_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 resolv library (-lresolv). */
|
||||
#undef HAVE_LIBRESOLV
|
||||
|
||||
/* 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
|
||||
|
506
configure.in
506
configure.in
@@ -2,7 +2,9 @@ dnl $Id$
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(lib/urldata.h)
|
||||
AM_CONFIG_HEADER(config.h src/config.h)
|
||||
AM_INIT_AUTOMAKE(curl,"7.4.1")
|
||||
|
||||
VERSION=`sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curl.h`
|
||||
AM_INIT_AUTOMAKE(curl,$VERSION)
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl
|
||||
@@ -24,14 +26,268 @@ dnl The install stuff has already been taken care of by the automake stuff
|
||||
dnl AC_PROG_INSTALL
|
||||
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))])])
|
||||
])
|
||||
|
||||
AC_DEFUN(CURL_CHECK_INET_NTOA_R,
|
||||
[
|
||||
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))])])
|
||||
|
||||
])
|
||||
|
||||
AC_DEFUN(CURL_CHECK_GETHOSTBYADDR_R,
|
||||
[
|
||||
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[8192];
|
||||
int h_errnop;
|
||||
struct hostent * hp;
|
||||
|
||||
hp = gethostbyaddr_r(address, length, type, &h,
|
||||
buffer, 8192, &h_errnop);],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
|
||||
ac_cv_gethostbyaddr_args=7],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(if gethostbyaddr_r takes 8 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;
|
||||
int rc;
|
||||
|
||||
rc = gethostbyaddr_r(address, length, type, &h,
|
||||
buffer, 8192, &hp, &h_errnop);],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
|
||||
ac_cv_gethostbyaddr_args=8],[
|
||||
AC_MSG_RESULT(no)
|
||||
have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])])
|
||||
|
||||
|
||||
])
|
||||
|
||||
AC_DEFUN(CURL_CHECK_GETHOSTBYNAME_R,
|
||||
[
|
||||
dnl check for number of arguments to gethostbyname_r. it might take
|
||||
dnl either 3, 5, or 6 arguments.
|
||||
AC_CHECK_FUNCS(gethostbyname_r,[
|
||||
AC_MSG_CHECKING(if gethostbyname_r takes 3 arguments)
|
||||
AC_TRY_RUN([
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
|
||||
int
|
||||
main () {
|
||||
struct hostent h;
|
||||
struct hostent_data hdata;
|
||||
char *name = "localhost";
|
||||
int rc;
|
||||
memset(&h, 0, sizeof(struct hostent));
|
||||
memset(&hdata, 0, sizeof(struct hostent_data));
|
||||
rc = gethostbyname_r(name, &h, &hdata);
|
||||
exit (rc != 0 ? 1 : 0); }],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
|
||||
ac_cv_gethostbyname_args=3],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(if gethostbyname_r with -D_REENTRANT takes 3 arguments)
|
||||
AC_TRY_RUN([
|
||||
#define _REENTRANT
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
|
||||
int
|
||||
main () {
|
||||
struct hostent h;
|
||||
struct hostent_data hdata;
|
||||
char *name = "localhost";
|
||||
int rc;
|
||||
memset(&h, 0, sizeof(struct hostent));
|
||||
memset(&hdata, 0, sizeof(struct hostent_data));
|
||||
rc = gethostbyname_r(name, &h, &hdata);
|
||||
exit (rc != 0 ? 1 : 0); }],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
|
||||
AC_DEFINE(NEED_REENTRANT)
|
||||
ac_cv_gethostbyname_args=3],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(if gethostbyname_r takes 5 arguments)
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
|
||||
int
|
||||
main () {
|
||||
struct hostent *hp;
|
||||
struct hostent h;
|
||||
char *name = "localhost";
|
||||
char buffer[8192];
|
||||
int h_errno;
|
||||
hp = gethostbyname_r(name, &h, buffer, 8192, &h_errno);
|
||||
exit (hp == NULL ? 1 : 0); }],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
|
||||
ac_cv_gethostbyname_args=5],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(if gethostbyname_r takes 6 arguments)
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
|
||||
int
|
||||
main () {
|
||||
struct hostent h;
|
||||
struct hostent *hp;
|
||||
char *name = "localhost";
|
||||
char buf[8192];
|
||||
int rc;
|
||||
int h_errno;
|
||||
rc = gethostbyname_r(name, &h, buf, 8192, &hp, &h_errno);
|
||||
exit (rc != 0 ? 1 : 0); }],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
|
||||
ac_cv_gethostbyname_args=6],[
|
||||
AC_MSG_RESULT(no)
|
||||
have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"],
|
||||
[ac_cv_gethostbyname_args=0])],
|
||||
[ac_cv_gethostbyname_args=0])],
|
||||
[ac_cv_gethostbyname_args=0])],
|
||||
[ac_cv_gethostbyname_args=0])])
|
||||
|
||||
])
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Checks for IPv6
|
||||
dnl **********************************************************************
|
||||
|
||||
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)
|
||||
ipv6=no
|
||||
;;
|
||||
*) AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(ENABLE_IPV6)
|
||||
ipv6=yes
|
||||
;;
|
||||
esac ],
|
||||
|
||||
AC_TRY_RUN([ /* is AF_INET6 available? */
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
main()
|
||||
{
|
||||
if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
|
||||
exit(1);
|
||||
else
|
||||
exit(0);
|
||||
}
|
||||
],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(ENABLE_IPV6)
|
||||
ipv6=yes,
|
||||
AC_MSG_RESULT(no)
|
||||
ipv6=no,
|
||||
AC_MSG_RESULT(no)
|
||||
ipv6=no
|
||||
))
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Checks for libraries.
|
||||
dnl **********************************************************************
|
||||
|
||||
dnl nsl lib?
|
||||
dnl gethostbyname in the nsl lib?
|
||||
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
|
||||
|
||||
if test "$ac_cv_lib_nsl_gethostbyname" != "yes" -a "$ac_cv_func_gethostbyname" != "yes"; then
|
||||
dnl gethostbyname in the socket lib?
|
||||
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
|
||||
@@ -179,7 +435,8 @@ else
|
||||
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"
|
||||
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
|
||||
@@ -192,6 +449,23 @@ else
|
||||
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)
|
||||
|
||||
@@ -254,200 +528,19 @@ then
|
||||
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 either 3, 5, or 6 arguments.
|
||||
AC_CHECK_FUNCS(gethostbyname_r,[
|
||||
AC_MSG_CHECKING(if gethostbyname_r takes 3 arguments)
|
||||
AC_TRY_RUN([
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
|
||||
int
|
||||
main () {
|
||||
struct hostent h;
|
||||
struct hostent_data hdata;
|
||||
char *name = "localhost";
|
||||
int rc;
|
||||
memset(&h, 0, sizeof(struct hostent));
|
||||
memset(&hdata, 0, sizeof(struct hostent_data));
|
||||
rc = gethostbyname_r(name, &h, &hdata);
|
||||
exit (rc != 0 ? 1 : 0); }],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
|
||||
ac_cv_gethostbyname_args=3],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(if gethostbyname_r with -D_REENTRANT takes 3 arguments)
|
||||
AC_TRY_RUN([
|
||||
#define _REENTRANT
|
||||
dnl dig around for gethostbyname_r()
|
||||
CURL_CHECK_GETHOSTBYNAME_R()
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
dnl dig around for gethostbyaddr_r()
|
||||
CURL_CHECK_GETHOSTBYADDR_R()
|
||||
|
||||
int
|
||||
main () {
|
||||
struct hostent h;
|
||||
struct hostent_data hdata;
|
||||
char *name = "localhost";
|
||||
int rc;
|
||||
memset(&h, 0, sizeof(struct hostent));
|
||||
memset(&hdata, 0, sizeof(struct hostent_data));
|
||||
rc = gethostbyname_r(name, &h, &hdata);
|
||||
exit (rc != 0 ? 1 : 0); }],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
|
||||
AC_DEFINE(NEED_REENTRANT)
|
||||
ac_cv_gethostbyname_args=3],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(if gethostbyname_r takes 5 arguments)
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
dnl poke around for inet_ntoa_r()
|
||||
CURL_CHECK_INET_NTOA_R()
|
||||
|
||||
int
|
||||
main () {
|
||||
struct hostent *hp;
|
||||
struct hostent h;
|
||||
char *name = "localhost";
|
||||
char buffer[8192];
|
||||
int h_errno;
|
||||
hp = gethostbyname_r(name, &h, buffer, 8192, &h_errno);
|
||||
exit (hp == NULL ? 1 : 0); }],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
|
||||
ac_cv_gethostbyname_args=5],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(if gethostbyname_r takes 6 arguments)
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
dnl is there a localtime_r()
|
||||
CURL_CHECK_LOCALTIME_R()
|
||||
|
||||
int
|
||||
main () {
|
||||
struct hostent h;
|
||||
struct hostent *hp;
|
||||
char *name = "localhost";
|
||||
char buf[8192];
|
||||
int rc;
|
||||
int h_errno;
|
||||
rc = gethostbyname_r(name, &h, buf, 8192, &hp, &h_errno);
|
||||
exit (rc != 0 ? 1 : 0); }],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
|
||||
ac_cv_gethostbyname_args=6],[
|
||||
AC_MSG_RESULT(no)
|
||||
have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"],
|
||||
[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[8192];
|
||||
int h_errnop;
|
||||
struct hostent * hp;
|
||||
|
||||
hp = gethostbyaddr_r(address, length, type, &h,
|
||||
buffer, 8192, &h_errnop);],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
|
||||
ac_cv_gethostbyaddr_args=7],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(if gethostbyaddr_r takes 8 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;
|
||||
int rc;
|
||||
|
||||
rc = gethostbyaddr_r(address, length, type, &h,
|
||||
buffer, 8192, &hp, &h_errnop);],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
|
||||
ac_cv_gethostbyaddr_args=8],[
|
||||
AC_MSG_RESULT(no)
|
||||
have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])])
|
||||
|
||||
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 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))])])
|
||||
fi
|
||||
|
||||
dnl **********************************************************************
|
||||
@@ -525,12 +618,19 @@ AC_CHECK_FUNCS( socket \
|
||||
tcsetattr \
|
||||
tcgetattr \
|
||||
perror \
|
||||
getpass \
|
||||
closesocket \
|
||||
setvbuf
|
||||
setvbuf \
|
||||
sigaction \
|
||||
signal \
|
||||
getpass_r
|
||||
)
|
||||
|
||||
dnl removed 'getpass' check on October 26, 2000
|
||||
|
||||
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)
|
||||
fi
|
||||
|
||||
@@ -549,14 +649,18 @@ dnl $PATH:/usr/bin/:/usr/local/bin )
|
||||
dnl AC_SUBST(RANLIB)
|
||||
|
||||
AC_OUTPUT( Makefile \
|
||||
curl.spec \
|
||||
curl-ssl.spec \
|
||||
docs/Makefile \
|
||||
docs/examples/Makefile \
|
||||
include/Makefile \
|
||||
include/curl/Makefile \
|
||||
src/Makefile \
|
||||
lib/Makefile )
|
||||
dnl perl/checklinks.pl \
|
||||
dnl perl/getlinks.pl \
|
||||
dnl perl/formfind.pl \
|
||||
dnl perl/recursiveftpget.pl )
|
||||
lib/Makefile \
|
||||
tests/Makefile \
|
||||
tests/data/Makefile \
|
||||
packages/Makefile \
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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.
|
||||
the same license curl and libcurl is already using.
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
@@ -69,6 +68,13 @@ Separate Patches Doing Different Things
|
||||
description exactly what they correct so that all patches can be selectively
|
||||
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
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
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!
|
||||
|
239
docs/FAQ
239
docs/FAQ
@@ -1,4 +1,4 @@
|
||||
Updated: August 22, 2000 (http://curl.haxx.se/docs/faq.shtml)
|
||||
Updated: January 22, 2001 (http://curl.haxx.se/docs/faq.shtml)
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
@@ -33,7 +33,7 @@ FAQ
|
||||
|
||||
4. Running Problems
|
||||
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.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?
|
||||
@@ -43,9 +43,16 @@ FAQ
|
||||
4.5.4 "404 Not Found"
|
||||
4.5.5 "405 Method Not Allowed"
|
||||
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.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 ?
|
||||
|
||||
6. License Issues
|
||||
6.1 I have a GPL program, can I use the libcurl library?
|
||||
@@ -63,20 +70,20 @@ FAQ
|
||||
|
||||
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
|
||||
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
|
||||
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?
|
||||
|
||||
libcurl is the engine inside curl that does all the work. curl is more or
|
||||
less the command line interface that converts the given options into libcurl
|
||||
function invokes. libcurl is a reliable, higly portable multiprotocol file
|
||||
transfer library.
|
||||
libcurl is a reliable, higly portable multiprotocol file transfer library.
|
||||
|
||||
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?
|
||||
|
||||
@@ -97,7 +104,7 @@ FAQ
|
||||
or with PHP.
|
||||
|
||||
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.
|
||||
|
||||
1.4 When will you make curl do XXXX ?
|
||||
@@ -117,7 +124,7 @@ FAQ
|
||||
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
|
||||
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
|
||||
agree.
|
||||
|
||||
@@ -135,7 +142,7 @@ FAQ
|
||||
|
||||
This may be because of several reasons.
|
||||
|
||||
2.1.1. native linker doesn't find openssl
|
||||
2.1.1. native linker doesn't find openssl
|
||||
|
||||
Affected platforms:
|
||||
Solaris (native cc compiler)
|
||||
@@ -157,7 +164,7 @@ FAQ
|
||||
|
||||
Solution submitted by: Bob Allison <allisonb@users.sourceforge.net>
|
||||
|
||||
2.1.2. only the libssl lib is missing
|
||||
2.1.2. only the libssl lib is missing
|
||||
|
||||
If all include files and the libcrypto lib is present, with only the
|
||||
libssl being missing according to configure, this is mostly likely because
|
||||
@@ -194,7 +201,6 @@ FAQ
|
||||
brings this functionality.
|
||||
|
||||
|
||||
|
||||
3. Usage problems
|
||||
|
||||
3.1. curl: (1) SSL is disabled, https: not supported
|
||||
@@ -216,7 +222,7 @@ FAQ
|
||||
|
||||
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?
|
||||
|
||||
@@ -290,7 +296,7 @@ FAQ
|
||||
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.
|
||||
|
||||
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
|
||||
runs the specified command in the background. To safely send the & as a part
|
||||
@@ -301,6 +307,9 @@ FAQ
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
@@ -310,6 +319,12 @@ FAQ
|
||||
|
||||
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?
|
||||
|
||||
Curl asks remote servers for the page you specify. If the page doesn't exist
|
||||
@@ -325,26 +340,26 @@ FAQ
|
||||
RFC2616 clearly explains the return codes. I'll make a short transcript
|
||||
here. Go read the RFC for exact details:
|
||||
|
||||
4.5.1 "400 Bad Request"
|
||||
4.5.1 "400 Bad Request"
|
||||
|
||||
The request could not be understood by the server due to malformed
|
||||
syntax. The client SHOULD NOT repeat the request without modifications.
|
||||
|
||||
4.5.2 "401 Unauthorized"
|
||||
4.5.2 "401 Unauthorized"
|
||||
|
||||
The request requires user authentication.
|
||||
|
||||
4.5.3 "403 Forbidden"
|
||||
4.5.3 "403 Forbidden"
|
||||
|
||||
The server understood the request, but is refusing to fulfill it.
|
||||
Authorization will not help and the request SHOULD NOT be repeated.
|
||||
|
||||
4.5.4 "404 Not Found"
|
||||
4.5.4 "404 Not Found"
|
||||
|
||||
The server has not found anything matching the Request-URI. No indication
|
||||
is given of whether the condition is temporary or permanent.
|
||||
|
||||
4.5.5 "405 Method Not Allowed"
|
||||
4.5.5 "405 Method Not Allowed"
|
||||
|
||||
The method specified in the Request-Line is not allowed for the resource
|
||||
identified by the Request-URI. The response MUST include an Allow header
|
||||
@@ -353,9 +368,9 @@ FAQ
|
||||
4.6. Can you tell me what error code 142 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
|
||||
curl to abort from such a condition and that's why it gets this undocumented
|
||||
error. This is planned to change in a future release.
|
||||
that curl has existed due to a timeout. There was no nice way for curl to
|
||||
abort from such a condition and that's why it got this undocumented
|
||||
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?
|
||||
|
||||
@@ -371,89 +386,153 @@ FAQ
|
||||
at least hide them from being read by human eyes, but that is not what
|
||||
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.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
|
||||
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
|
||||
will attempt to use threadsafe functions instead of non-safe ones.
|
||||
Yes.
|
||||
|
||||
We have written the libcurl code specificly adjusted for multi-threaded
|
||||
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
|
||||
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!
|
||||
|
||||
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)
|
||||
|
||||
6. License Issues
|
||||
|
||||
Curl and libcurl are released under the MPL, the Mozilla Public License. To
|
||||
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
|
||||
clashes yourself. This is a brief summary for the cases we get the most
|
||||
questions. (Parts of this section was enhanced by Bjorn Reese.)
|
||||
NOTE: This section is now updated to concern curl 7.5.2 or later!
|
||||
|
||||
Curl and libcurl are released under a MIT/X derivate license *or* the MPL,
|
||||
the Mozilla Public License. To get a really good answer to your license
|
||||
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?
|
||||
|
||||
No, unfortunately you cannot distribute the (lib)curl code with your code.
|
||||
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.)
|
||||
Yes!
|
||||
|
||||
However, you have two alternative options:
|
||||
|
||||
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.
|
||||
Since libcurl may be distributed under the MIT/X derivate license, it can be
|
||||
used together with GPL in any software.
|
||||
|
||||
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
|
||||
library. If you end up doing changes to the library, only those changes
|
||||
must be made available, not the ones to your program.
|
||||
Yes.
|
||||
|
||||
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?
|
||||
|
||||
Yes, libcurl does not put any restrictions on the program that uses the
|
||||
library. If you end up doing changes to the library, only those changes
|
||||
must be made available, not the ones to your program.
|
||||
Yes.
|
||||
|
||||
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?
|
||||
|
||||
Yes you can. LGPL libraries don't spread to other libraries the same way
|
||||
GPL ones do.
|
||||
Yes.
|
||||
|
||||
However, when you read paragraph (3) of the LGPL license, you'll see that
|
||||
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.
|
||||
The LGPL license don't clash with other licenses.
|
||||
|
||||
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?
|
||||
|
||||
No. We carefully picked this license years ago and a large amount of
|
||||
people have contributed with source code knowing that this is the license
|
||||
we use. This license puts the restrictions we want on curl/libcurl and it
|
||||
does not spread to other programs or libraries that use it.
|
||||
No. We carefully picked this license years ago and a large amount of people
|
||||
have contributed with source code knowing that this is the license we
|
||||
use. This license puts the restrictions we want on curl/libcurl and it does
|
||||
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
|
||||
- uses .netrc
|
||||
- progress bar/time specs while downloading
|
||||
- PROXY environment variables support
|
||||
- "standard" proxy environment variables support
|
||||
- config file support
|
||||
- compiles on win32
|
||||
- redirectable stderr
|
||||
- use selected network interface for outgoing traffic
|
||||
|
||||
HTTP
|
||||
- GET
|
||||
@@ -28,8 +30,9 @@ HTTP
|
||||
- authentication
|
||||
- resume
|
||||
- follow redirects
|
||||
- maximum amount of redirects to follow
|
||||
- custom HTTP request
|
||||
- cookie get/send
|
||||
- cookie get/send fully parsed
|
||||
- understands the netscape cookie file format
|
||||
- custom headers (that can replace/remove internally generated headers)
|
||||
- custom user-agent string
|
||||
@@ -38,11 +41,12 @@ HTTP
|
||||
- proxy authentication
|
||||
- time conditions
|
||||
- via http-proxy
|
||||
- specify interface device/port
|
||||
- retrieve file modification date
|
||||
|
||||
HTTPS (*1)
|
||||
- (all the HTTP features)
|
||||
- using certificates
|
||||
- verify server certificate
|
||||
- via http-proxy
|
||||
|
||||
FTP
|
||||
@@ -63,6 +67,7 @@ FTP
|
||||
- simple "range" support
|
||||
- via http-proxy
|
||||
- all operations can be tunneled through a http-proxy
|
||||
- customizable to retrieve file modification date
|
||||
|
||||
TELNET
|
||||
- connection negotiation
|
||||
|
111
docs/INSTALL
111
docs/INSTALL
@@ -11,41 +11,8 @@ way to proceed is mainly divided in two different ways: the unix way or the
|
||||
windows way.
|
||||
|
||||
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
|
||||
as described in the the UNIX header.
|
||||
|
||||
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.*
|
||||
- i386 BeOS
|
||||
- i386 FreeBSD
|
||||
- i386 Linux 1.3, 2.0, 2.2, 2.3, 2.4
|
||||
- i386 NetBSD
|
||||
- i386 OS/2
|
||||
- i386 OpenBSD
|
||||
- i386 Solaris 2.7
|
||||
- i386 Windows 95, 98, NT, 2000
|
||||
- ia64 Linux 2.3.99
|
||||
- m68k AmigaOS 3
|
||||
- m68k OpenBSD
|
||||
the Win32 or OS/2 headers further down. All other systems should be capable of
|
||||
being installed as described below.
|
||||
|
||||
UNIX
|
||||
====
|
||||
@@ -53,7 +20,9 @@ UNIX
|
||||
The configure script *always* tries to find a working SSL library unless
|
||||
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
|
||||
special.
|
||||
special:
|
||||
|
||||
./configure
|
||||
|
||||
If you have OpenSSL installed in /usr/local/ssl, you can run configure
|
||||
like:
|
||||
@@ -101,21 +70,44 @@ UNIX
|
||||
|
||||
Use the executable `curl` in src/ directory.
|
||||
|
||||
'make install' copies the curl file to /usr/local/bin/ (or $prefix/bin if
|
||||
you used the --prefix option to configure) and copies the man pages, the
|
||||
lib and the include files to a suitable place too.
|
||||
To install curl on your system, run
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
issuing these commands: (from Ralph Beckmann <rabe@uni-paderborn.de>)
|
||||
issuing these commands: (from Ralph Beckmann)
|
||||
|
||||
./configure [...]
|
||||
cd lib; make; cd ..
|
||||
cd src; make; cd ..
|
||||
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
|
||||
|
||||
Remember, to force configure to use the standard cc compiler if both
|
||||
@@ -177,6 +169,8 @@ Win32
|
||||
set, then run 'nmake -f Makefile.vc6' in the lib/ dir and then
|
||||
'nmake -f Makefile.vc6' in the src/ dir.
|
||||
|
||||
The vcvars32.bat file is part of the Microsoft development environment.
|
||||
|
||||
IDE-style
|
||||
-------------------------
|
||||
If you use VC++, Borland or similar compilers. Include all lib source
|
||||
@@ -222,6 +216,8 @@ Win32
|
||||
set, then run 'nmake -f Makefile.vc6 release-ssl' in the lib/ dir and
|
||||
then 'nmake -f Makefile.vc6' in the src/ dir.
|
||||
|
||||
The vcvars32.bat file is part of the Microsoft development environment.
|
||||
|
||||
Microsoft / Borland style
|
||||
-------------------------
|
||||
If you have OpenSSL, and want curl to take advantage of it, edit your
|
||||
@@ -259,6 +255,41 @@ IBM OS/2
|
||||
If you're getting huge binaries, probably your makefiles have the -g in
|
||||
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
|
||||
=======
|
||||
|
||||
|
201
docs/INTERNALS
201
docs/INTERNALS
@@ -1,3 +1,4 @@
|
||||
Updated for curl 7.6 on January 26, 2001
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
@@ -12,29 +13,43 @@ INTERNALS
|
||||
|
||||
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
|
||||
===============
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
destroying binary data, although you do want that conversion if it is
|
||||
text coming through... (sigh)
|
||||
|
||||
In curl, (1) is made with defines and macros, so that the source looks the
|
||||
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) we set stdout to binary under windows
|
||||
We set stdout to binary under windows
|
||||
|
||||
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
|
||||
@@ -43,13 +58,16 @@ Windows vs Unix
|
||||
supposed to look exactly as a config.h file would have looked like on a
|
||||
Windows machine!
|
||||
|
||||
Generally speaking: always remember that this will be compiled on dozens of
|
||||
operating systems. Don't walk on the edge.
|
||||
|
||||
Library
|
||||
=======
|
||||
|
||||
As described elsewhere, libcurl is meant to get two different "layers" of
|
||||
interface. At the present point only the high-level, the "easy", interface
|
||||
has been fully implemented and thus documented. We assume the easy-interface
|
||||
in this description, the low-level interface will be documented when fully
|
||||
interfaces. At the present point only the high-level, the "easy", interface
|
||||
has been fully implemented and documented. We assume the easy-interface in
|
||||
this description, the low-level interface will be documented when fully
|
||||
implemented.
|
||||
|
||||
There are plenty of entry points to the library, namely each publicly defined
|
||||
@@ -57,33 +75,43 @@ Library
|
||||
rather small and easy-to-follow. All the ones prefixed with 'curl_easy' are
|
||||
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
|
||||
passed in pairs, the parameter-ID and the parameter-value. The list of
|
||||
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
|
||||
the remote host. This may involve using a proxy and/or using SSL. The
|
||||
GetHost() function in lib/hostip.c is used for looking up host names.
|
||||
It starts off in the lib/easy.c file by calling curl_transfer(), but the main
|
||||
work is lib/url.c. The function first analyzes the URL, it separates the
|
||||
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
|
||||
the protocols they handle. ftp(), http(), dict(), etc. They all reside in
|
||||
their respective files (ftp.c, http.c and dict.c).
|
||||
When connected, the proper protocol-specific function is called. The
|
||||
functions are named after the protocols they handle. Curl_ftp(), Curl_http(),
|
||||
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
|
||||
setup. They have access to the sendf() (from lib/sendf.c) function to send
|
||||
printf-style formatted data to the remote host and when they're ready to make
|
||||
the actual file transfer they call the Transfer() function (in
|
||||
lib/download.c) to do the transfer. All printf()-style functions use the
|
||||
supplied clones in lib/mprintf.c.
|
||||
The protocol-specific functions of course deal with protocol-specific
|
||||
negotiations and setup. They have access to the Curl_sendf() (from
|
||||
lib/sendf.c) function to send printf-style formatted data to the remote host
|
||||
and when they're ready to make the actual file transfer they call the
|
||||
Curl_Transfer() function (in lib/transfer.c) to setup the transfer and
|
||||
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
|
||||
called). The speedcheck functions in lib/speedcheck.c are also used to verify
|
||||
that the transfer is as fast as required.
|
||||
|
||||
When completed curl_easy_cleanup() should be called to free up used
|
||||
When completed, the curl_easy_cleanup() should be called to free up used
|
||||
resources.
|
||||
|
||||
HTTP(S)
|
||||
@@ -92,9 +120,8 @@ Library
|
||||
code. There is a special file (lib/formdata.c) that offers all the multipart
|
||||
post functions.
|
||||
|
||||
base64-functions for user+password stuff is in (lib/base64.c) and all
|
||||
functions for parsing and sending cookies are found in
|
||||
(lib/cookie.c).
|
||||
base64-functions for user+password stuff (and more) is in (lib/base64.c) and
|
||||
all functions for parsing and sending cookies are found in (lib/cookie.c).
|
||||
|
||||
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
|
||||
@@ -104,9 +131,17 @@ Library
|
||||
|
||||
FTP
|
||||
|
||||
The if2ip() function can be used for getting the IP number of a specified
|
||||
network interface, and it resides in lib/if2ip.c. It is only used for the FTP
|
||||
PORT command.
|
||||
The Curl_if2ip() function can be used for getting the IP number of a
|
||||
specified network interface, and it resides in lib/if2ip.c.
|
||||
|
||||
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
|
||||
|
||||
@@ -125,31 +160,63 @@ Library
|
||||
URL encoding and decoding, called escaping and unescaping in the source code,
|
||||
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
|
||||
more).
|
||||
|
||||
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
|
||||
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
|
||||
gettimeofday() and a few support functions for timeval convertions.
|
||||
|
||||
A function named curl_version() that returns the full curl version string is
|
||||
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
|
||||
======
|
||||
|
||||
main() resides in src/main.c together with most of the client
|
||||
code. src/hugehelp.c is automatically generated by the mkhelp.pl perl script
|
||||
to display the complete "manual" and the src/urlglob.c file holds the
|
||||
functions used for the multiple-URL support.
|
||||
main() resides in src/main.c together with most of the client code.
|
||||
src/hugehelp.c is automatically generated by the mkhelp.pl perl script to
|
||||
display the complete "manual" and the src/urlglob.c file holds the functions
|
||||
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
|
||||
calls the curl_easy_*() functions of the library and when it gets back
|
||||
The client mostly messes around to setup its 'config' struct properly, then
|
||||
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
|
||||
and exits.
|
||||
|
||||
@@ -158,4 +225,50 @@ Client
|
||||
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.
|
||||
|
@@ -282,6 +282,8 @@ REFERER
|
||||
|
||||
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
|
||||
|
||||
A HTTP request has the option to include information about the browser
|
||||
@@ -400,17 +402,26 @@ SPEED LIMIT
|
||||
CONFIG FILE
|
||||
|
||||
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
|
||||
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
|
||||
is treated as a comment.
|
||||
systems) from the user's home dir on startup.
|
||||
|
||||
The config file could be made up with normal command line switches, but you
|
||||
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:
|
||||
|
||||
# We want a 30 minute timeout:
|
||||
-m 1800
|
||||
# ... 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
|
||||
leading up to the first characters of each line are ignored.
|
||||
@@ -424,14 +435,14 @@ CONFIG FILE
|
||||
without URL by making a config file similar to:
|
||||
|
||||
# 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
|
||||
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
|
||||
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
|
||||
|
@@ -12,11 +12,15 @@ man_MANS = \
|
||||
curl_easy_perform.3 \
|
||||
curl_easy_setopt.3 \
|
||||
curl_formparse.3 \
|
||||
curl_formfree.3 \
|
||||
curl_getdate.3 \
|
||||
curl_getenv.3 \
|
||||
curl_slist_append.3 \
|
||||
curl_slist_free_all.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
|
||||
|
@@ -15,6 +15,8 @@ Standards
|
||||
|
||||
RFC 959 - Defines how FTP works
|
||||
|
||||
RFC 1635 - How to Use Anonymous FTP
|
||||
|
||||
RFC 1738 - Uniform Resource Locators
|
||||
|
||||
RFC 1777 - defines the LDAP protocol
|
||||
@@ -38,51 +40,59 @@ Standards
|
||||
|
||||
RFC 2109 - HTTP State Management Mechanism (cookie stuff)
|
||||
- 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 2231 - "MIME Parameter Value and Encoded Word Extensions:
|
||||
Character Sets, Languages, and Continuations"
|
||||
RFC 2231 - MIME Parameter Value and Encoded Word Extensions:
|
||||
Character Sets, Languages, and Continuations
|
||||
|
||||
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
|
||||
one obsoletes 1738, but since 1738 is often mentioned I've left
|
||||
it in this list.
|
||||
one obsoletes RFC 1738, but since RFC 1738 is often mentioned
|
||||
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 2617 - HTTP Authentication
|
||||
|
||||
RFC 2718 - "Guidelines for new URL Schemes"
|
||||
|
||||
RFC 2732 - "Format for Literal IPv6 Addresses in URL's"
|
||||
RFC 2718 - Guidelines for new URL Schemes
|
||||
|
||||
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
|
||||
---------
|
||||
MingW32 - http://www.mingw.org
|
||||
MingW32 - http://www.mingw.org/
|
||||
|
||||
gcc - http://www.gnu.org/software/gcc/gcc.html
|
||||
|
||||
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/
|
||||
|
||||
Similar Tools
|
||||
-------------
|
||||
wget - http://www.gnu.org/software/wget/wget.html
|
||||
wget - http://sunsite.dk/wget/
|
||||
|
||||
snarf - http://www.xach.com/snarf/
|
||||
|
||||
@@ -90,6 +100,14 @@ Similar Tools
|
||||
|
||||
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
|
||||
----------------
|
||||
ftpparse - http://cr.yp.to/ftpparse.html parses FTP LIST responses
|
||||
|
37
docs/TODO
37
docs/TODO
@@ -13,9 +13,22 @@ For the future
|
||||
product! (Yes, you may add things not mentioned here, these are just a
|
||||
few teasers...)
|
||||
|
||||
* Improve the command line option parser to accept '-m300' as well as the '-m
|
||||
300' convention. It should be able to work if '-m300' is considered to be
|
||||
space separated to the next option.
|
||||
* 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:
|
||||
@@ -24,19 +37,19 @@ For the future
|
||||
* Make sure the low-level interface works. highlevel.c should basically be
|
||||
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
|
||||
fork() systems.
|
||||
|
||||
* Move non-URL related functions that are used by both the lib and the curl
|
||||
application to a separate "portability lib".
|
||||
|
||||
* Add support for other languages than C. C++ and perl comes to mind. Python?
|
||||
|
||||
* Improve the -K config file parser (the parameter following the flag should
|
||||
be possible to get specified *exactly* as it is done on a shell command
|
||||
line).
|
||||
|
||||
* rtsp:// support -- "Real Time Streaming Protocol" (RFC 2326)
|
||||
* 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
|
||||
versions of this!) comes to mind. Python anyone?
|
||||
|
||||
* "Content-Encoding: compress/gzip/zlib"
|
||||
|
||||
@@ -51,7 +64,7 @@ For the future
|
||||
sniffing. This should however be a library-based functionality. There are a
|
||||
few different efforts "out there" to make open source HTTP clients support
|
||||
this and it should be possible to take advantage of other people's hard
|
||||
work.
|
||||
work. http://modntlm.sourceforge.net/ is one.
|
||||
|
||||
* RFC2617 compliance, "Digest Access Authentication"
|
||||
A valid test page seem to exist at:
|
||||
@@ -85,5 +98,3 @@ For the future
|
||||
|
||||
* HTTP POST resume using Range:
|
||||
|
||||
* Make curl capable of verifying the server's certificate when connecting
|
||||
with HTTPS://.
|
||||
|
177
docs/curl.1
177
docs/curl.1
@@ -2,18 +2,19 @@
|
||||
.\" nroff -man curl.1
|
||||
.\" Written by Daniel Stenberg
|
||||
.\"
|
||||
.TH curl 1 "26 September 2000" "Curl 7.3" "Curl Manual"
|
||||
.TH curl 1 "19 January 2001" "Curl 7.6" "Curl Manual"
|
||||
.SH NAME
|
||||
curl \- get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE, HTTP or
|
||||
HTTPS syntax.
|
||||
.SH SYNOPSIS
|
||||
.B curl [options]
|
||||
.I url
|
||||
.I [URL...]
|
||||
.SH DESCRIPTION
|
||||
.B curl
|
||||
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.
|
||||
is a client to get documents/files from or send documents to a server, using
|
||||
any of the supported protocols (HTTP, HTTPS, FTP, GOPHER, DICT, TELNET, LDAP
|
||||
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
|
||||
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:
|
||||
|
||||
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
|
||||
.IP "-a/--append"
|
||||
(FTP)
|
||||
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
|
||||
be created.
|
||||
|
||||
If this option is used twice, the second one will disable append mode again.
|
||||
.IP "-A/--user-agent <agent string>"
|
||||
(HTTP)
|
||||
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,
|
||||
surround the string with single quote marks. This can also be set with the
|
||||
-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>"
|
||||
(HTTP)
|
||||
Pass the data to the HTTP server as a cookie. It is supposedly the
|
||||
@@ -67,10 +76,15 @@ format.
|
||||
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
|
||||
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"
|
||||
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
|
||||
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"
|
||||
.B Deprecated. Use '-C -' instead.
|
||||
Continue/Resume a previous file transfer. This instructs curl to
|
||||
@@ -88,27 +102,45 @@ to the destination.
|
||||
If used with uploads, the ftp server command SIZE will not be used by
|
||||
curl. Upload resume is for FTP only.
|
||||
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>"
|
||||
(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
|
||||
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
|
||||
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
|
||||
read the data from, or - if you want curl to read the data from stdin.
|
||||
The contents of the file must already be url-encoded.
|
||||
read the data from, or - if you want curl to read the data from stdin. The
|
||||
contents of the file must already be url-encoded. Multiple files can also be
|
||||
specified.
|
||||
|
||||
To post data purely binary, you should instead use the --data-binary option.
|
||||
|
||||
-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>"
|
||||
(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>"
|
||||
(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
|
||||
want to post a binary file without the strip-newlines feature of the
|
||||
--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>"
|
||||
(HTTP/FTP)
|
||||
Write the HTTP headers to this file. Write the FTP file info to this
|
||||
@@ -117,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
|
||||
site sends to you. The cookies could then be read in a second curl invoke by
|
||||
using the -b/--cookie option!
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.IP "-e/--referer <URL>"
|
||||
(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
|
||||
@@ -124,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
|
||||
previous URL when it follows a Location: header. The ";auto" string can be
|
||||
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]>"
|
||||
(HTTPS)
|
||||
Tells curl to use the specified certificate file when getting a file
|
||||
@@ -131,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
|
||||
the terminal. Note that this certificate is the private key and the private
|
||||
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"
|
||||
(HTTP)
|
||||
Fail silently (no output at all) on server errors. This is mostly done
|
||||
@@ -139,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
|
||||
describes why and more). This flag will prevent curl from
|
||||
outputting that and fail silently instead.
|
||||
|
||||
If this option is used twice, the second will again disable silent failure.
|
||||
.IP "-F/--form <name=content>"
|
||||
(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
|
||||
@@ -158,6 +203,14 @@ input:
|
||||
|
||||
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.
|
||||
|
||||
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"
|
||||
Usage help.
|
||||
.IP "-H/--header <header>"
|
||||
@@ -169,38 +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
|
||||
internal header with one without content on the right side of the colon will
|
||||
prevent that header from appearing.
|
||||
|
||||
This option can be used multiple times.
|
||||
.IP "-i/--include"
|
||||
(HTTP)
|
||||
Include the HTTP-header in the output. The HTTP-header includes things
|
||||
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"
|
||||
(HTTP/FTP)
|
||||
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
|
||||
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>"
|
||||
Specify which config file to read curl arguments from. The config
|
||||
file is a text file in which command line arguments can be written
|
||||
which then will be used as if they were written on the actual command
|
||||
line. If the first column of a config line is a '#' character, the
|
||||
rest of the line will be treated as a comment.
|
||||
Specify which config file to read curl arguments from. The config file is a
|
||||
text file in which command line arguments can be written which then will be
|
||||
used as if they were written on the actual command line. Options and their
|
||||
parameters must be specified on the same config file line. If the parameter is
|
||||
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.
|
||||
|
||||
This option can be used multiple times.
|
||||
.IP "-l/--list-only"
|
||||
(FTP)
|
||||
When listing an FTP directory, this switch forces a name-only view.
|
||||
Especially useful if you want to machine-parse the contents of an FTP
|
||||
directory since the normal directory view doesn't use a standard look
|
||||
or format.
|
||||
|
||||
If this option is used twice, the second will again disable list only.
|
||||
.IP "-L/--location"
|
||||
(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
|
||||
@@ -208,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
|
||||
making a HTTP POST, curl will automatically switch to GET after the initial
|
||||
POST has been done.
|
||||
|
||||
If this option is used twice, the second will again disable location following.
|
||||
.IP "-m/--max-time <seconds>"
|
||||
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
|
||||
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"
|
||||
Manual. Display the huge help text.
|
||||
.IP "-n/--netrc"
|
||||
@@ -232,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:
|
||||
|
||||
.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"
|
||||
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 output the data in chunks, not necessarily exactly when the data arrives.
|
||||
Using this option will disable that buffering.
|
||||
|
||||
If this option is used twice, the second will again switch on buffering.
|
||||
.IP "-o/--output <file>"
|
||||
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>
|
||||
@@ -248,15 +325,21 @@ being fetched. Like in:
|
||||
or use several variables like:
|
||||
|
||||
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"
|
||||
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.)
|
||||
|
||||
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>"
|
||||
(FTP)
|
||||
Reverses the initiator/listener roles when connecting with ftp. This
|
||||
@@ -278,6 +361,8 @@ i.e "my.host.domain" to specify machine
|
||||
.B "-"
|
||||
(any single-letter string) to make it pick the machine's default
|
||||
.RE
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.IP "-q"
|
||||
If used as the first parameter on the command line, the
|
||||
.I $HOME/.curlrc
|
||||
@@ -290,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
|
||||
to be run before and after the transfer. If the server returns failure for one
|
||||
of the commands, the entire operation will be aborted.
|
||||
|
||||
This option can be used multiple times.
|
||||
.IP "-r/--range <range>"
|
||||
(HTTP/FTP)
|
||||
Retrieve a byte range (i.e a partial document) from a HTTP/1.1 or FTP
|
||||
@@ -327,11 +414,17 @@ document.
|
||||
|
||||
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.
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.IP "-s/--silent"
|
||||
Silent mode. Don't show progress meter or error messages. Makes
|
||||
Curl mute.
|
||||
|
||||
If this option is used twice, the second will again disable mute.
|
||||
.IP "-S/--show-error"
|
||||
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"
|
||||
.B Deprecated. Use '-T -' instead.
|
||||
Transfer the stdin data to the specified file. Curl will read
|
||||
@@ -345,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
|
||||
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.
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.IP "-u/--user <user:password>"
|
||||
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
|
||||
ask for it interactively.
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.IP "-U/--proxy-user <user:password>"
|
||||
Specify user and password to use for Proxy authentication. If no
|
||||
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"
|
||||
Makes the fetching more verbose/talkative. Mostly usable for
|
||||
debugging. Lines starting with '>' means data sent by curl, '<'
|
||||
means data received by curl that is hidden in normal cases and lines
|
||||
starting with '*' means additional info provided by curl.
|
||||
|
||||
If this option is used twice, the second will again disable verbose.
|
||||
.IP "-V/--version"
|
||||
Displays the full version of curl, libcurl and other 3rd party libraries
|
||||
linked with the executable.
|
||||
@@ -422,9 +532,13 @@ The average download speed that curl measured for the complete download.
|
||||
.B speed_upload
|
||||
The average upload speed that curl measured for the complete upload.
|
||||
.RE
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.IP "-x/--proxy <proxyhost[:port]>"
|
||||
Use specified proxy. If the port number is not specified, it is assumed at
|
||||
port 1080.
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.IP "-X/--request <command>"
|
||||
(HTTP)
|
||||
Specifies a custom request to use when communicating with the HTTP server.
|
||||
@@ -434,14 +548,20 @@ HTTP 1.1 specification for details and explanations.
|
||||
(FTP)
|
||||
Specifies a custom FTP command to use instead of LIST when doing file lists
|
||||
with ftp.
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.IP "-y/--speed-time <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
|
||||
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>"
|
||||
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
|
||||
not set.
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.IP "-z/--time-cond <date expression>"
|
||||
(HTTP)
|
||||
Request to get a file that has been modified later than the given time and
|
||||
@@ -456,6 +576,8 @@ man pages for date expression details.
|
||||
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
|
||||
than the specified date/time.
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.IP "-3/--sslv3"
|
||||
(HTTPS)
|
||||
Forces curl to use SSL version 3 when negotiating with a remote SSL server.
|
||||
@@ -465,12 +587,18 @@ Forces curl to use SSL version 2 when negotiating with a remote SSL server.
|
||||
.IP "-#/--progress-bar"
|
||||
Make curl display progress information as a progress bar instead of the
|
||||
default statistics.
|
||||
|
||||
If this option is used twice, the second will again disable the progress bar.
|
||||
.IP "--crlf"
|
||||
(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>"
|
||||
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
|
||||
you're using a shell with decent redirecting capabilities.
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.SH FILES
|
||||
.I ~/.curlrc
|
||||
.RS
|
||||
@@ -525,7 +653,7 @@ FTP weird USER reply. Curl couldn't parse the reply sent to the USER request.
|
||||
.IP 13
|
||||
FTP weird PASV reply, Curl couldn't parse the reply sent to the PASV request.
|
||||
.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
|
||||
FTP can't get host. Couldn't resolve the host IP we got in the 227-line.
|
||||
.IP 16
|
||||
@@ -583,12 +711,23 @@ LDAP search failed.
|
||||
Library not found. The LDAP library was not found.
|
||||
.IP 41
|
||||
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
|
||||
There will appear more error codes here in future releases. The existing ones
|
||||
are meant to never change.
|
||||
.SH BUGS
|
||||
If you do find any (or have other suggestions), mail Daniel Stenberg
|
||||
<Daniel.Stenberg@haxx.se>.
|
||||
If you do find bugs, mail them to curl-bug@haxx.se.
|
||||
.SH AUTHORS / CONTRIBUTORS
|
||||
- Daniel Stenberg <Daniel.Stenberg@haxx.se>
|
||||
- Rafael Sagula <sagula@inf.ufrgs.br>
|
||||
@@ -643,6 +782,12 @@ If you do find any (or have other suggestions), mail Daniel Stenberg
|
||||
- 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
|
||||
http://curl.haxx.se
|
||||
|
@@ -2,7 +2,7 @@
|
||||
.\" nroff -man [file]
|
||||
.\" Written by daniel@haxx.se
|
||||
.\"
|
||||
.TH curl_easy_init 3 "2 October 2000" "Curl 7.4" "libcurl Manual"
|
||||
.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
|
||||
@@ -28,6 +28,12 @@ Pass a pointer to a 'char *' to receive the last used effective URL.
|
||||
.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.
|
||||
@@ -70,6 +76,11 @@ received.
|
||||
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
|
||||
|
@@ -2,7 +2,7 @@
|
||||
.\" nroff -man [file]
|
||||
.\" 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
|
||||
curl_easy_perform - Do the actual transfer in a "easy" session
|
||||
.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
|
||||
.I handle
|
||||
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
|
||||
0 means everything was ok, non-zero means an error occurred as
|
||||
.I <curl/curl.h>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
.\" nroff -man [file]
|
||||
.\" Written by daniel@haxx.se
|
||||
.\"
|
||||
.TH curl_easy_setopt 3 "26 September 2000" "Curl 7.3" "libcurl Manual"
|
||||
.TH curl_easy_setopt 3 "28 November 2000" "Curl 7.5" "libcurl Manual"
|
||||
.SH NAME
|
||||
curl_easy_setopt - Set curl easy-session options
|
||||
.SH SYNOPSIS
|
||||
@@ -237,7 +237,7 @@ want the transfer to start from.
|
||||
.B CURLOPT_COOKIE
|
||||
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
|
||||
'[NAME]=[CONTENTS];' Where NAME is the cookie name.
|
||||
[NAME]=[CONTENTS]; Where NAME is the cookie name.
|
||||
.TP
|
||||
.B CURLOPT_HTTPHEADER
|
||||
Pass a pointer to a linked list of HTTP headers to pass to the server in your
|
||||
@@ -267,7 +267,7 @@ the password required to use the CURLOPT_SSLCERT certificate. If the password
|
||||
is not supplied, you will be prompted for it.
|
||||
.TP
|
||||
.B CURLOPT_CRLF
|
||||
TBD.
|
||||
Convert unix newlines to CRLF newlines on FTP uploads.
|
||||
.TP
|
||||
.B CURLOPT_QUOTE
|
||||
Pass a pointer to a linked list of FTP commands to pass to the server prior to
|
||||
@@ -352,6 +352,52 @@ Pass a pointer that will be untouched by libcurl and passed as the first
|
||||
argument in the progress callback set with
|
||||
.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
|
||||
.SH RETURN VALUE
|
||||
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"
|
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;
|
||||
}
|
||||
|
@@ -7,39 +7,23 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
|
||||
*
|
||||
* http://curl.haxx.nu
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
/* The include stuff here is mainly for time_t! */
|
||||
#ifdef vms
|
||||
# include <types.h>
|
||||
@@ -99,8 +83,17 @@ typedef size_t (*curl_read_callback)(char *buffer,
|
||||
size_t nitems,
|
||||
FILE *instream);
|
||||
|
||||
/* All possible error codes from this version of urlget(). Future versions
|
||||
may return other values, stay prepared. */
|
||||
typedef int (*curl_passwd_callback)(void *clientp,
|
||||
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 {
|
||||
CURLE_OK = 0,
|
||||
@@ -145,8 +138,6 @@ typedef enum {
|
||||
|
||||
CURLE_HTTP_POST_ERROR,
|
||||
|
||||
CURLE_HTTP_PORT_FAILED, /* HTTP Interface operation failed */
|
||||
|
||||
CURLE_SSL_CONNECT_ERROR, /* something was wrong when connecting with SSL */
|
||||
|
||||
CURLE_FTP_BAD_DOWNLOAD_RESUME, /* couldn't resume download */
|
||||
@@ -159,10 +150,14 @@ typedef enum {
|
||||
CURLE_FUNCTION_NOT_FOUND,
|
||||
|
||||
CURLE_ABORTED_BY_CALLBACK,
|
||||
|
||||
CURLE_BAD_FUNCTION_ARGUMENT,
|
||||
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
|
||||
} CURLcode;
|
||||
|
||||
@@ -171,10 +166,6 @@ typedef enum {
|
||||
|
||||
#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>,
|
||||
type is one of the defined CURLOPTTYPE_<type>
|
||||
number is unique identifier */
|
||||
@@ -394,12 +385,30 @@ typedef enum {
|
||||
* 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 */
|
||||
} CURLoption;
|
||||
|
||||
#define CURL_PROGRESS_STATS 0 /* default progress display */
|
||||
#define CURL_PROGRESS_BAR 1
|
||||
|
||||
typedef enum {
|
||||
TIMECOND_NONE,
|
||||
|
||||
@@ -422,14 +431,19 @@ typedef enum {
|
||||
|
||||
NOTE: they return TRUE if the strings match *case insensitively*.
|
||||
*/
|
||||
extern int (strequal)(const char *s1, const char *s2);
|
||||
extern int (strnequal)(const char *s1, const char *s2, size_t n);
|
||||
extern int (Curl_strequal)(const char *s1, const char *s2);
|
||||
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 */
|
||||
int curl_formparse(char *string,
|
||||
struct HttpPost **httppost,
|
||||
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
|
||||
MUST be free()ed after usage is complete. */
|
||||
char *curl_getenv(char *variable);
|
||||
@@ -438,8 +452,8 @@ char *curl_getenv(char *variable);
|
||||
char *curl_version(void);
|
||||
|
||||
/* This is the version number */
|
||||
#define LIBCURL_VERSION "7.4.1"
|
||||
#define LIBCURL_VERSION_NUM 0x070401
|
||||
#define LIBCURL_VERSION "7.6"
|
||||
#define LIBCURL_VERSION_NUM 0x070600
|
||||
|
||||
/* linked-list structure for the CURLOPT_QUOTE option (and other) */
|
||||
struct curl_slist {
|
||||
@@ -659,8 +673,10 @@ typedef enum {
|
||||
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 = 13,
|
||||
CURLINFO_LASTONE = 15
|
||||
} CURLINFO;
|
||||
|
||||
/*
|
||||
|
@@ -7,38 +7,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
|
||||
*
|
||||
* http://curl.haxx.nu
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@@ -2,27 +2,14 @@
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* 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/
|
||||
* 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.
|
||||
*
|
||||
* 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 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):
|
||||
* 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.
|
||||
*
|
||||
*************************************************************************
|
||||
*
|
||||
@@ -68,26 +55,28 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
int mprintf(const char *format, ...);
|
||||
int mfprintf(FILE *fd, const char *format, ...);
|
||||
int msprintf(char *buffer, const char *format, ...);
|
||||
int msnprintf(char *buffer, size_t maxlength, const char *format, ...);
|
||||
int mvprintf(const char *format, va_list args);
|
||||
int mvfprintf(FILE *fd, const char *format, va_list args);
|
||||
int mvsprintf(char *buffer, const char *format, va_list args);
|
||||
int mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args);
|
||||
char *maprintf(const char *format, ...);
|
||||
char *mvaprintf(const char *format, va_list args);
|
||||
int curl_mprintf(const char *format, ...);
|
||||
int curl_mfprintf(FILE *fd, const char *format, ...);
|
||||
int curl_msprintf(char *buffer, const char *format, ...);
|
||||
int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...);
|
||||
int curl_mvprintf(const char *format, va_list args);
|
||||
int curl_mvfprintf(FILE *fd, const char *format, va_list args);
|
||||
int curl_mvsprintf(char *buffer, const char *format, va_list args);
|
||||
int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args);
|
||||
char *curl_maprintf(const char *format, ...);
|
||||
char *curl_mvaprintf(const char *format, va_list args);
|
||||
|
||||
#ifdef _MPRINTF_REPLACE
|
||||
# define printf mprintf
|
||||
# define fprintf mfprintf
|
||||
# define sprintf msprintf
|
||||
# define snprintf msnprintf
|
||||
# define vprintf mvprintf
|
||||
# define vfprintf mvfprintf
|
||||
# define vsprintf mvsprintf
|
||||
# define vsnprintf mvsnprintf
|
||||
# define printf curl_mprintf
|
||||
# define fprintf curl_mfprintf
|
||||
# define sprintf curl_msprintf
|
||||
# define snprintf curl_msnprintf
|
||||
# define vprintf curl_mvprintf
|
||||
# define vfprintf curl_mvfprintf
|
||||
# define vsprintf curl_mvsprintf
|
||||
# define vsnprintf curl_mvsnprintf
|
||||
# define aprintf curl_maprintf
|
||||
# define vaprintf curl_mvaprintf
|
||||
#endif
|
||||
|
||||
#endif /* H_MPRINTF */
|
||||
|
@@ -7,38 +7,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
|
||||
*
|
||||
* http://curl.haxx.nu
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
|
@@ -7,38 +7,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
|
||||
*
|
||||
* http://curl.haxx.nu
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
typedef void CURL;
|
||||
typedef void CURLconnect;
|
||||
|
||||
|
@@ -4,6 +4,10 @@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
EXTRA_DIST = getdate.y \
|
||||
Makefile.b32 Makefile.b32.resp Makefile.m32 Makefile.vc6 \
|
||||
libcurl.def dllinit.c
|
||||
|
||||
lib_LTLIBRARIES = libcurl.la
|
||||
|
||||
# Some flags needed when trying to cause warnings ;-)
|
||||
@@ -11,6 +15,36 @@ lib_LTLIBRARIES = libcurl.la
|
||||
|
||||
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 = \
|
||||
arpa_telnet.h file.c getpass.h netrc.h timeval.c \
|
||||
base64.c file.h hostip.c progress.c timeval.h \
|
||||
@@ -19,12 +53,14 @@ 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 \
|
||||
getdate.h ldap.c ssluse.c version.c \
|
||||
getenv.c ldap.h ssluse.h \
|
||||
escape.c getenv.h mprintf.c telnet.c \
|
||||
escape.h getpass.c netrc.c telnet.h \
|
||||
getinfo.c highlevel.c strequal.c strequal.h easy.c \
|
||||
security.h security.c krb4.c memdebug.c memdebug.h
|
||||
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.
|
||||
$(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
|
||||
|
||||
lib_LTLIBRARIES = libcurl.la
|
||||
|
||||
# Some flags needed when trying to cause warnings ;-)
|
||||
# CFLAGS = -DMALLOCDEBUG -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 getinfo.c highlevel.c strequal.c strequal.h easy.c security.h security.c krb4.c memdebug.c memdebug.h
|
||||
|
||||
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 getinfo.lo \
|
||||
highlevel.lo strequal.lo easy.lo security.lo krb4.lo memdebug.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:
|
@@ -30,16 +30,16 @@ libcurl_a_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 \
|
||||
urldata.h transfer.c getdate.h ldap.c ssluse.c version.c transfer.h getenv.c \
|
||||
ldap.h ssluse.h escape.c getenv.h mprintf.c telnet.c escape.h getpass.c netrc.c \
|
||||
telnet.h getinfo.c highlevel.c strequal.c strequal.h easy.c security.h \
|
||||
telnet.h getinfo.c strequal.c strequal.h easy.c security.h \
|
||||
security.c krb4.c
|
||||
|
||||
libcurl_a_OBJECTS = file.o timeval.o base64.o hostip.o progress.o \
|
||||
formdata.o cookie.o http.o sendf.o ftp.o url.o dict.o if2ip.o \
|
||||
speedcheck.o getdate.o download.o ldap.o ssluse.o version.o \
|
||||
speedcheck.o getdate.o transfer.o ldap.o ssluse.o version.o \
|
||||
getenv.o escape.o mprintf.o telnet.o getpass.o netrc.o getinfo.o \
|
||||
highlevel.o strequal.o easy.o security.o krb4.o
|
||||
strequal.o easy.o security.o krb4.o
|
||||
|
||||
LIBRARIES = $(libcurl_a_LIBRARIES)
|
||||
SOURCES = $(libcurl_a_SOURCES)
|
||||
|
108
lib/Makefile.vc6
108
lib/Makefile.vc6
@@ -4,34 +4,36 @@
|
||||
## (default is release)
|
||||
##
|
||||
## Comments to: Troy Engel <tengel@sonic.net>
|
||||
## Updated by: Craig Davison <cd@securityfocus.com>
|
||||
|
||||
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!
|
||||
|
||||
## Release
|
||||
CCR = cl.exe /ML /O2 /D "NDEBUG"
|
||||
LINKR = link.exe -lib
|
||||
CCR = cl.exe /MD /O2 /D "NDEBUG"
|
||||
LINKR = link.exe -lib /out:$(PROGRAM_NAME)
|
||||
|
||||
## Debug
|
||||
CCD = cl.exe /MLd /Gm /ZI /Od /D "_DEBUG" /GZ
|
||||
LINKD = link.exe -lib
|
||||
CCD = cl.exe /MDd /Gm /ZI /Od /D "_DEBUG" /GZ
|
||||
LINKD = link.exe -lib /out:$(PROGRAM_NAME_DEBUG)
|
||||
|
||||
## SSL Release
|
||||
CCRS = cl.exe /ML /O2 /D "NDEBUG" /D "USE_SSLEAY" /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
|
||||
LINKRS = link.exe -lib /LIBPATH:$(OPENSSL_PATH)/out32dll
|
||||
CCRS = cl.exe /MD /O2 /D "NDEBUG" /D "USE_SSLEAY" /I "$(OPENSSL_PATH)/include" /I "$(OPENSSL_PATH)/include/openssl"
|
||||
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"
|
||||
LFLAGS = /nologo /out:$(PROGRAM_NAME)
|
||||
LINKLIBS = kernel32.lib wsock32.lib
|
||||
LFLAGS = /nologo
|
||||
LINKLIBS = wsock32.lib
|
||||
LINKSLIBS = libeay32.lib ssleay32.lib RSAglue.lib
|
||||
|
||||
RELEASE_OBJS= \
|
||||
base64r.obj \
|
||||
cookier.obj \
|
||||
downloadr.obj \
|
||||
transferr.obj \
|
||||
escaper.obj \
|
||||
formdatar.obj \
|
||||
ftpr.obj \
|
||||
@@ -53,21 +55,20 @@ RELEASE_OBJS= \
|
||||
timevalr.obj \
|
||||
urlr.obj \
|
||||
filer.obj \
|
||||
writeoutr.obj \
|
||||
getinfor.obj \
|
||||
versionr.obj \
|
||||
easyr.obj \
|
||||
highlevelr.obj \
|
||||
strequalr.obj
|
||||
easyr.obj \
|
||||
strequalr.obj
|
||||
|
||||
DEBUG_OBJS= \
|
||||
base64d.obj \
|
||||
cookied.obj \
|
||||
downloadd.obj \
|
||||
transferd.obj \
|
||||
escaped.obj \
|
||||
formdatad.obj \
|
||||
ftpd.obj \
|
||||
httpd.obj \
|
||||
ldapd.obj \
|
||||
ldapd.obj \
|
||||
dictd.obj \
|
||||
telnetd.obj \
|
||||
getdated.obj \
|
||||
@@ -84,21 +85,20 @@ DEBUG_OBJS= \
|
||||
timevald.obj \
|
||||
urld.obj \
|
||||
filed.obj \
|
||||
writeoutd.obj \
|
||||
versiond.obj \
|
||||
easyd.obj \
|
||||
highleveld.obj \
|
||||
strequald.obj
|
||||
getinfod.obj \
|
||||
versiond.obj \
|
||||
easyd.obj \
|
||||
strequald.obj
|
||||
|
||||
RELEASE_SSL_OBJS= \
|
||||
base64rs.obj \
|
||||
cookiers.obj \
|
||||
downloadrs.obj \
|
||||
transferrs.obj \
|
||||
escapers.obj \
|
||||
formdatars.obj \
|
||||
ftprs.obj \
|
||||
httprs.obj \
|
||||
ldaprs.obj \
|
||||
ldaprs.obj \
|
||||
dictrs.obj \
|
||||
telnetrs.obj \
|
||||
getdaters.obj \
|
||||
@@ -115,21 +115,20 @@ RELEASE_SSL_OBJS= \
|
||||
timevalrs.obj \
|
||||
urlrs.obj \
|
||||
filers.obj \
|
||||
writeouts.obj \
|
||||
getinfors.obj \
|
||||
versionrs.obj \
|
||||
easyrs.obj \
|
||||
highlevelrs.obj \
|
||||
strequalrs.obj
|
||||
easyrs.obj \
|
||||
strequalrs.obj
|
||||
|
||||
LINK_OBJS= \
|
||||
base64.obj \
|
||||
cookie.obj \
|
||||
download.obj \
|
||||
transfer.obj \
|
||||
escape.obj \
|
||||
formdata.obj \
|
||||
ftp.obj \
|
||||
http.obj \
|
||||
ldap.obj \
|
||||
ldap.obj \
|
||||
dict.obj \
|
||||
telnet.obj \
|
||||
getdate.obj \
|
||||
@@ -146,11 +145,10 @@ LINK_OBJS= \
|
||||
timeval.obj \
|
||||
url.obj \
|
||||
file.obj \
|
||||
writeout.obj \
|
||||
getinfo.obj \
|
||||
version.obj \
|
||||
easy.obj \
|
||||
highlevel.obj \
|
||||
strequal.obj
|
||||
easy.obj \
|
||||
strequal.obj
|
||||
|
||||
all : release
|
||||
|
||||
@@ -163,14 +161,13 @@ debug: $(DEBUG_OBJS)
|
||||
release-ssl: $(RELEASE_SSL_OBJS)
|
||||
$(LINKRS) $(LFLAGS) $(LINKLIBS) $(LINKSLIBS) $(LINK_OBJS)
|
||||
|
||||
|
||||
## Release
|
||||
base64r.obj: base64.c
|
||||
$(CCR) $(CFLAGS) base64.c
|
||||
cookier.obj: cookie.c
|
||||
$(CCR) $(CFLAGS) cookie.c
|
||||
downloadr.obj: download.c
|
||||
$(CCR) $(CFLAGS) download.c
|
||||
transferr.obj: transfer.c
|
||||
$(CCR) $(CFLAGS) transfer.c
|
||||
escaper.obj: escape.c
|
||||
$(CCR) $(CFLAGS) escape.c
|
||||
formdatar.obj: formdata.c
|
||||
@@ -213,14 +210,12 @@ urlr.obj: url.c
|
||||
$(CCR) $(CFLAGS) url.c
|
||||
filer.obj: file.c
|
||||
$(CCR) $(CFLAGS) file.c
|
||||
writeoutr.obj: writeout.c
|
||||
$(CCR) $(CFLAGS) writeout.c
|
||||
getinfor.obj: getinfo.c
|
||||
$(CCR) $(CFLAGS) getinfo.c
|
||||
versionr.obj: version.c
|
||||
$(CCR) $(CFLAGS) version.c
|
||||
easyr.obj: easy.c
|
||||
$(CCR) $(CFLAGS) easy.c
|
||||
highlevelr.obj: highlevel.c
|
||||
$(CCR) $(CFLAGS) highlevel.c
|
||||
strequalr.obj: strequal.c
|
||||
$(CCR) $(CFLAGS) strequal.c
|
||||
|
||||
@@ -229,8 +224,8 @@ base64d.obj: base64.c
|
||||
$(CCD) $(CFLAGS) base64.c
|
||||
cookied.obj: cookie.c
|
||||
$(CCD) $(CFLAGS) cookie.c
|
||||
downloadd.obj: download.c
|
||||
$(CCD) $(CFLAGS) download.c
|
||||
transferd.obj: transfer.c
|
||||
$(CCD) $(CFLAGS) transfer.c
|
||||
escaped.obj: escape.c
|
||||
$(CCD) $(CFLAGS) escape.c
|
||||
formdatad.obj: formdata.c
|
||||
@@ -240,7 +235,7 @@ ftpd.obj: ftp.c
|
||||
httpd.obj: http.c
|
||||
$(CCD) $(CFLAGS) http.c
|
||||
ldapd.obj: ldap.c
|
||||
$(CCR) $(CFLAGS) ldap.c
|
||||
$(CCD) $(CFLAGS) ldap.c
|
||||
dictd.obj: dict.c
|
||||
$(CCD) $(CFLAGS) dict.c
|
||||
telnetd.obj: telnet.c
|
||||
@@ -273,16 +268,14 @@ urld.obj: url.c
|
||||
$(CCD) $(CFLAGS) url.c
|
||||
filed.obj: file.c
|
||||
$(CCD) $(CFLAGS) file.c
|
||||
writeoutd.obj: writeout.c
|
||||
$(CCR) $(CFLAGS) writeout.c
|
||||
getinfod.obj: getinfo.c
|
||||
$(CCD) $(CFLAGS) getinfo.c
|
||||
versiond.obj: version.c
|
||||
$(CCD) $(CFLAGS) version.c
|
||||
easyd.obj: easy.c
|
||||
$(CCR) $(CFLAGS) easy.c
|
||||
highleveld.obj: highlevel.c
|
||||
$(CCR) $(CFLAGS) highlevel.c
|
||||
$(CCD) $(CFLAGS) easy.c
|
||||
strequald.obj: strequal.c
|
||||
$(CCR) $(CFLAGS) strequal.c
|
||||
$(CCD) $(CFLAGS) strequal.c
|
||||
|
||||
|
||||
## Release SSL
|
||||
@@ -290,8 +283,8 @@ base64rs.obj: base64.c
|
||||
$(CCRS) $(CFLAGS) base64.c
|
||||
cookiers.obj: cookie.c
|
||||
$(CCRS) $(CFLAGS) cookie.c
|
||||
downloadrs.obj: download.c
|
||||
$(CCRS) $(CFLAGS) download.c
|
||||
transferrs.obj: transfer.c
|
||||
$(CCRS) $(CFLAGS) transfer.c
|
||||
escapers.obj: escape.c
|
||||
$(CCRS) $(CFLAGS) escape.c
|
||||
formdatars.obj: formdata.c
|
||||
@@ -301,7 +294,7 @@ ftprs.obj: ftp.c
|
||||
httprs.obj: http.c
|
||||
$(CCRS) $(CFLAGS) http.c
|
||||
ldaprs.obj: ldap.c
|
||||
$(CCR) $(CFLAGS) ldap.c
|
||||
$(CCRS) $(CFLAGS) ldap.c
|
||||
dictrs.obj: dict.c
|
||||
$(CCRS) $(CFLAGS) dict.c
|
||||
telnetrs.obj: telnet.c
|
||||
@@ -334,16 +327,15 @@ urlrs.obj: url.c
|
||||
$(CCRS) $(CFLAGS) url.c
|
||||
filers.obj: file.c
|
||||
$(CCRS) $(CFLAGS) file.c
|
||||
writeoutrs.obj: writeout.c
|
||||
$(CCR) $(CFLAGS) writeout.c
|
||||
getinfors.obj: getinfo.c
|
||||
$(CCRS) $(CFLAGS) getinfo.c
|
||||
versionrs.obj: version.c
|
||||
$(CCRS) $(CFLAGS) version.c
|
||||
easyrs.obj: easy.c
|
||||
$(CCR) $(CFLAGS) easy.c
|
||||
highlevelrs.obj: highlevel.c
|
||||
$(CCR) $(CFLAGS) highlevel.c
|
||||
$(CCRS) $(CFLAGS) easy.c
|
||||
strequalrs.obj: strequal.c
|
||||
$(CCR) $(CFLAGS) strequal.c
|
||||
$(CCRS) $(CFLAGS) strequal.c
|
||||
|
||||
|
||||
clean:
|
||||
-@erase *.obj
|
||||
|
@@ -63,6 +63,7 @@
|
||||
#define SYNCH 242 /* for telfunc calls */
|
||||
|
||||
#ifdef TELCMDS
|
||||
static
|
||||
char *telcmds[] = {
|
||||
"EOF", "SUSP", "ABORT", "EOR",
|
||||
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
|
||||
@@ -124,6 +125,7 @@ extern char *telcmds[];
|
||||
|
||||
#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
|
||||
#ifdef TELOPTS
|
||||
static
|
||||
char *telopts[NTELOPTS+1] = {
|
||||
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
|
||||
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
|
||||
|
@@ -55,7 +55,7 @@ static int pos(char c)
|
||||
}
|
||||
|
||||
#if 1
|
||||
int base64_encode(const void *data, int size, char **str)
|
||||
int Curl_base64_encode(const void *data, int size, char **str)
|
||||
{
|
||||
char *s, *p;
|
||||
int i;
|
||||
@@ -93,7 +93,7 @@ int base64_encode(const void *data, int size, char **str)
|
||||
}
|
||||
#endif
|
||||
|
||||
int base64_decode(const char *str, void *data)
|
||||
int Curl_base64_decode(const char *str, void *data)
|
||||
{
|
||||
const char *p;
|
||||
unsigned char *q;
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#ifndef __BASE64_H
|
||||
#define __BASE64_H
|
||||
|
||||
int base64_encode(const void *data, int size, char **str);
|
||||
int Curl_base64_encode(const void *data, int size, char **str);
|
||||
int Curl_base64_decode(const char *str, void *data);
|
||||
|
||||
#endif
|
||||
|
45
lib/cookie.c
45
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$
|
||||
*****************************************************************************/
|
||||
|
||||
/***
|
||||
|
||||
@@ -78,9 +100,10 @@ Example set of cookies:
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
struct Cookie *cookie_add(struct CookieInfo *c,
|
||||
bool httpheader, /* TRUE if HTTP header-style line */
|
||||
char *lineptr) /* first non-space of the line */
|
||||
struct Cookie *
|
||||
Curl_cookie_add(struct CookieInfo *c,
|
||||
bool httpheader, /* TRUE if HTTP header-style line */
|
||||
char *lineptr) /* first non-space of the line */
|
||||
{
|
||||
struct Cookie *clist;
|
||||
char what[MAX_COOKIE_LINE];
|
||||
@@ -325,7 +348,7 @@ struct Cookie *cookie_add(struct CookieInfo *c,
|
||||
* 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];
|
||||
struct CookieInfo *c;
|
||||
@@ -353,7 +376,7 @@ struct CookieInfo *cookie_init(char *file)
|
||||
while(*lineptr && isspace((int)*lineptr))
|
||||
lineptr++;
|
||||
|
||||
cookie_add(c, TRUE, lineptr);
|
||||
Curl_cookie_add(c, TRUE, lineptr);
|
||||
}
|
||||
else {
|
||||
/* This might be a netscape cookie-file line, get it! */
|
||||
@@ -361,7 +384,7 @@ struct CookieInfo *cookie_init(char *file)
|
||||
while(*lineptr && isspace((int)*lineptr))
|
||||
lineptr++;
|
||||
|
||||
cookie_add(c, FALSE, lineptr);
|
||||
Curl_cookie_add(c, FALSE, lineptr);
|
||||
}
|
||||
}
|
||||
if(fromfile)
|
||||
@@ -383,8 +406,8 @@ struct CookieInfo *cookie_init(char *file)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
struct Cookie *cookie_getlist(struct CookieInfo *c,
|
||||
char *host, char *path, bool secure)
|
||||
struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
|
||||
char *host, char *path, bool secure)
|
||||
{
|
||||
struct Cookie *newco;
|
||||
struct Cookie *co;
|
||||
@@ -409,7 +432,7 @@ struct Cookie *cookie_getlist(struct CookieInfo *c,
|
||||
/* now check if the domain is correct */
|
||||
domlen=co->domain?strlen(co->domain):0;
|
||||
if(!co->domain ||
|
||||
((domlen<hostlen) &&
|
||||
((domlen<=hostlen) &&
|
||||
strequal(host+(hostlen-domlen), co->domain)) ) {
|
||||
/* the right part of the host matches the domain stuff in the
|
||||
cookie data */
|
||||
@@ -451,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;
|
||||
if(co) {
|
||||
@@ -471,7 +494,7 @@ void cookie_freelist(struct Cookie *co)
|
||||
* 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 *next;
|
||||
|
32
lib/cookie.h
32
lib/cookie.h
@@ -1,5 +1,27 @@
|
||||
#ifndef __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>
|
||||
#ifdef WIN32
|
||||
@@ -41,10 +63,10 @@ struct CookieInfo {
|
||||
#define MAX_NAME 256
|
||||
#define MAX_NAME_TXT "255"
|
||||
|
||||
struct Cookie *cookie_add(struct CookieInfo *, bool, char *);
|
||||
struct CookieInfo *cookie_init(char *);
|
||||
struct Cookie *cookie_getlist(struct CookieInfo *, char *, char *, bool);
|
||||
void cookie_freelist(struct Cookie *);
|
||||
void cookie_cleanup(struct CookieInfo *);
|
||||
struct Cookie *Curl_cookie_add(struct CookieInfo *, bool, char *);
|
||||
struct CookieInfo *Curl_cookie_init(char *);
|
||||
struct Cookie *Curl_cookie_getlist(struct CookieInfo *, char *, char *, bool);
|
||||
void Curl_cookie_freelist(struct Cookie *);
|
||||
void Curl_cookie_cleanup(struct CookieInfo *);
|
||||
|
||||
#endif
|
||||
|
113
lib/dict.c
113
lib/dict.c
@@ -5,38 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -88,7 +71,7 @@
|
||||
|
||||
#include "urldata.h"
|
||||
#include <curl/curl.h>
|
||||
#include "download.h"
|
||||
#include "transfer.h"
|
||||
#include "sendf.h"
|
||||
|
||||
#include "progress.h"
|
||||
@@ -97,12 +80,12 @@
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
|
||||
CURLcode dict_done(struct connectdata *conn)
|
||||
CURLcode Curl_dict_done(struct connectdata *conn)
|
||||
{
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
CURLcode dict(struct connectdata *conn)
|
||||
CURLcode Curl_dict(struct connectdata *conn)
|
||||
{
|
||||
int nth;
|
||||
char *word;
|
||||
@@ -158,21 +141,21 @@ CURLcode dict(struct connectdata *conn)
|
||||
nth = atoi(nthdef);
|
||||
}
|
||||
|
||||
sendf(data->firstsocket, data,
|
||||
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
||||
"MATCH "
|
||||
"%s " /* database */
|
||||
"%s " /* strategy */
|
||||
"%s\n" /* word */
|
||||
"QUIT\n",
|
||||
Curl_sendf(data->firstsocket, conn,
|
||||
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
||||
"MATCH "
|
||||
"%s " /* database */
|
||||
"%s " /* strategy */
|
||||
"%s\n" /* word */
|
||||
"QUIT\n",
|
||||
|
||||
database,
|
||||
strategy,
|
||||
word
|
||||
);
|
||||
database,
|
||||
strategy,
|
||||
word
|
||||
);
|
||||
|
||||
result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
|
||||
-1, NULL); /* no upload */
|
||||
result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
|
||||
-1, NULL); /* no upload */
|
||||
|
||||
if(result)
|
||||
return result;
|
||||
@@ -208,20 +191,20 @@ CURLcode dict(struct connectdata *conn)
|
||||
nth = atoi(nthdef);
|
||||
}
|
||||
|
||||
sendf(data->firstsocket, data,
|
||||
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
||||
"DEFINE "
|
||||
"%s " /* database */
|
||||
"%s\n" /* word */
|
||||
"QUIT\n",
|
||||
|
||||
database,
|
||||
word
|
||||
);
|
||||
Curl_sendf(data->firstsocket, conn,
|
||||
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
||||
"DEFINE "
|
||||
"%s " /* database */
|
||||
"%s\n" /* word */
|
||||
"QUIT\n",
|
||||
|
||||
database,
|
||||
word
|
||||
);
|
||||
|
||||
result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
|
||||
-1, NULL); /* no upload */
|
||||
|
||||
result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
|
||||
-1, NULL); /* no upload */
|
||||
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
@@ -233,18 +216,18 @@ CURLcode dict(struct connectdata *conn)
|
||||
int i;
|
||||
|
||||
ppath++;
|
||||
for (i = 0; (i < URL_MAX_LENGTH) && (ppath[i]); i++) {
|
||||
for (i = 0; ppath[i]; i++) {
|
||||
if (ppath[i] == ':')
|
||||
ppath[i] = ' ';
|
||||
}
|
||||
sendf(data->firstsocket, data,
|
||||
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
||||
"%s\n"
|
||||
"QUIT\n",
|
||||
ppath);
|
||||
Curl_sendf(data->firstsocket, conn,
|
||||
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
||||
"%s\n"
|
||||
"QUIT\n",
|
||||
ppath);
|
||||
|
||||
result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
|
||||
-1, NULL);
|
||||
result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
|
||||
-1, NULL);
|
||||
|
||||
if(result)
|
||||
return 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
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* 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);
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
CURLcode Curl_dict(struct connectdata *conn);
|
||||
CURLcode Curl_dict_done(struct connectdata *conn);
|
||||
|
||||
#endif
|
||||
|
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
|
41
lib/easy.c
41
lib/easy.c
@@ -5,38 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -89,7 +72,7 @@
|
||||
|
||||
#include "urldata.h"
|
||||
#include <curl/curl.h>
|
||||
#include "highlevel.h"
|
||||
#include "transfer.h"
|
||||
#include <curl/types.h>
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
|
42
lib/escape.c
42
lib/escape.c
@@ -5,38 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
/* Escape and unescape URL encoding in strings. The functions return a new
|
||||
* allocated string or NULL if an error occurred. */
|
||||
@@ -100,7 +83,7 @@ char *curl_unescape(char *string, int length)
|
||||
the "query part" where '+' should become ' '.
|
||||
RFC 2316, section 3.10 */
|
||||
|
||||
while(--alloc) {
|
||||
while(--alloc > 0) {
|
||||
in = *string;
|
||||
if(querypart && ('+' == in))
|
||||
in = ' ';
|
||||
@@ -113,6 +96,7 @@ char *curl_unescape(char *string, int length)
|
||||
if(sscanf(string+1, "%02X", &hex)) {
|
||||
in = hex;
|
||||
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
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
/* Escape and unescape URL encoding in strings. The functions return a new
|
||||
* 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
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -103,6 +86,10 @@
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
|
||||
/* The last #include file should be: */
|
||||
#ifdef MALLOCDEBUG
|
||||
#include "memdebug.h"
|
||||
#endif
|
||||
|
||||
CURLcode file(struct connectdata *conn)
|
||||
{
|
||||
@@ -119,7 +106,7 @@ CURLcode file(struct connectdata *conn)
|
||||
struct UrlData *data = conn->data;
|
||||
char *buf = data->buffer;
|
||||
int bytecount = 0;
|
||||
struct timeval start = tvnow();
|
||||
struct timeval start = Curl_tvnow();
|
||||
struct timeval now = start;
|
||||
int fd;
|
||||
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
|
||||
it avoids problems with select() and recv() on file descriptors
|
||||
in Winsock */
|
||||
#if 0
|
||||
ProgressInit (data, expected_size);
|
||||
#endif
|
||||
if(expected_size != -1)
|
||||
pgrsSetDownloadSize(data, expected_size);
|
||||
Curl_pgrsSetDownloadSize(data, expected_size);
|
||||
|
||||
while (res == CURLE_OK) {
|
||||
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
|
||||
to prevent CR/LF translation (this then goes to a binary mode
|
||||
file descriptor). */
|
||||
if(nread != data->fwrite (buf, 1, nread, data->out)) {
|
||||
failf (data, "Failed writing output");
|
||||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
now = tvnow();
|
||||
if(pgrsUpdate(data))
|
||||
|
||||
res = Curl_client_write(data, CLIENTWRITE_BODY, buf, nread);
|
||||
if(res)
|
||||
return res;
|
||||
|
||||
now = Curl_tvnow();
|
||||
if(Curl_pgrsUpdate(data))
|
||||
res = CURLE_ABORTED_BY_CALLBACK;
|
||||
}
|
||||
now = tvnow();
|
||||
if(pgrsUpdate(data))
|
||||
now = Curl_tvnow();
|
||||
if(Curl_pgrsUpdate(data))
|
||||
res = CURLE_ABORTED_BY_CALLBACK;
|
||||
|
||||
close(fd);
|
||||
|
||||
free(actual_path);
|
||||
|
||||
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
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
CURLcode file(struct connectdata *conn);
|
||||
|
||||
#endif
|
||||
|
115
lib/formdata.c
115
lib/formdata.c
@@ -5,38 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
Debug the form generator stand-alone by compiling this source file with:
|
||||
@@ -108,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_TYPE_SEPARATOR ';'
|
||||
|
||||
static
|
||||
int FormParse(char *input,
|
||||
struct HttpPost **httppost,
|
||||
struct HttpPost **last_post)
|
||||
@@ -315,6 +292,13 @@ int FormParse(char *input,
|
||||
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,
|
||||
void *line,
|
||||
long length)
|
||||
@@ -356,7 +340,7 @@ static int AddFormDataf(struct FormData **formp,
|
||||
}
|
||||
|
||||
|
||||
char *MakeFormBoundary(void)
|
||||
char *Curl_FormBoundary(void)
|
||||
{
|
||||
char *retstring;
|
||||
static int randomizer=0; /* this is just so that two boundaries within
|
||||
@@ -382,21 +366,43 @@ char *MakeFormBoundary(void)
|
||||
|
||||
return retstring;
|
||||
}
|
||||
|
||||
|
||||
void FormFree(struct FormData *form)
|
||||
/* Used from http.c */
|
||||
void Curl_FormFree(struct FormData *form)
|
||||
{
|
||||
struct FormData *next;
|
||||
do {
|
||||
next=form->next; /* the following form line */
|
||||
free(form->line); /* free the line */
|
||||
free(form); /* free the struct */
|
||||
|
||||
} while((form=next)); /* continue */
|
||||
}
|
||||
|
||||
/* 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 *getFormData(struct HttpPost *post,
|
||||
int *sizep)
|
||||
struct FormData *Curl_getFormData(struct HttpPost *post,
|
||||
int *sizep)
|
||||
{
|
||||
struct FormData *form = NULL;
|
||||
struct FormData *firstform;
|
||||
@@ -410,7 +416,7 @@ struct FormData *getFormData(struct HttpPost *post,
|
||||
if(!post)
|
||||
return NULL; /* no input => no output! */
|
||||
|
||||
boundary = MakeFormBoundary();
|
||||
boundary = Curl_FormBoundary();
|
||||
|
||||
/* Make the first line of the output */
|
||||
AddFormDataf(&form,
|
||||
@@ -434,7 +440,7 @@ struct FormData *getFormData(struct HttpPost *post,
|
||||
/* 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 */
|
||||
|
||||
fileboundary = MakeFormBoundary();
|
||||
fileboundary = Curl_FormBoundary();
|
||||
|
||||
size += AddFormDataf(&form,
|
||||
"\r\nContent-Type: multipart/mixed,"
|
||||
@@ -530,24 +536,11 @@ struct FormData *getFormData(struct HttpPost *post,
|
||||
return firstform;
|
||||
}
|
||||
|
||||
int FormInit(struct Form *form, struct FormData *formdata )
|
||||
int Curl_FormInit(struct Form *form, struct FormData *formdata )
|
||||
{
|
||||
if(!formdata)
|
||||
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->sent = 0;
|
||||
|
||||
@@ -555,10 +548,10 @@ int FormInit(struct Form *form, struct FormData *formdata )
|
||||
}
|
||||
|
||||
/* fread() emulation */
|
||||
int FormReader(char *buffer,
|
||||
size_t size,
|
||||
size_t nitems,
|
||||
FILE *mydata)
|
||||
int Curl_FormReader(char *buffer,
|
||||
size_t size,
|
||||
size_t nitems,
|
||||
FILE *mydata)
|
||||
{
|
||||
struct Form *form;
|
||||
int wantedsize;
|
||||
@@ -633,7 +626,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
form=getFormData(httppost, &size);
|
||||
form=Curl_getFormData(httppost, &size);
|
||||
|
||||
FormInit(&formread, form);
|
||||
|
||||
|
@@ -8,69 +8,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* 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
|
||||
*
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
/* plain and simple linked list with lines to send */
|
||||
struct FormData {
|
||||
struct FormData *next;
|
||||
@@ -84,23 +36,19 @@ struct Form {
|
||||
been sent in a previous invoke */
|
||||
};
|
||||
|
||||
int FormParse(char *string,
|
||||
struct HttpPost **httppost,
|
||||
struct HttpPost **last_post);
|
||||
int Curl_FormInit(struct Form *form, struct FormData *formdata );
|
||||
|
||||
int FormInit(struct Form *form, struct FormData *formdata );
|
||||
|
||||
struct FormData *getFormData(struct HttpPost *post,
|
||||
int *size);
|
||||
struct FormData *Curl_getFormData(struct HttpPost *post,
|
||||
int *size);
|
||||
|
||||
/* fread() emulation */
|
||||
int FormReader(char *buffer,
|
||||
size_t size,
|
||||
size_t nitems,
|
||||
FILE *mydata);
|
||||
int Curl_FormReader(char *buffer,
|
||||
size_t size,
|
||||
size_t nitems,
|
||||
FILE *mydata);
|
||||
|
||||
char *MakeFormBoundary(void);
|
||||
char *Curl_FormBoundary(void);
|
||||
|
||||
void FormFree(struct FormData *);
|
||||
void Curl_FormFree(struct FormData *);
|
||||
|
||||
#endif
|
||||
|
452
lib/ftp.c
452
lib/ftp.c
@@ -5,44 +5,28 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -83,17 +67,27 @@
|
||||
#include "if2ip.h"
|
||||
#include "hostip.h"
|
||||
#include "progress.h"
|
||||
#include "download.h"
|
||||
#include "transfer.h"
|
||||
#include "escape.h"
|
||||
#include "http.h" /* for HTTP proxy tunnel stuff */
|
||||
#include "ftp.h"
|
||||
|
||||
#ifdef KRB4
|
||||
#include "security.h"
|
||||
#include "krb4.h"
|
||||
#endif
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
|
||||
/* The last #include file should be: */
|
||||
#ifdef MALLOCDEBUG
|
||||
#include "memdebug.h"
|
||||
#endif
|
||||
|
||||
/* easy-to-use macro: */
|
||||
#define ftpsendf Curl_ftpsendf
|
||||
|
||||
/* returns last node in linked list */
|
||||
static struct curl_slist *slist_get_last(struct curl_slist *list)
|
||||
{
|
||||
@@ -128,7 +122,7 @@ struct curl_slist *curl_slist_append(struct curl_slist *list, char *data)
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Cannot allocate memory for QUOTE list.\n");
|
||||
exit(-1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (list) {
|
||||
@@ -196,6 +190,8 @@ static CURLcode AllowServerConnect(struct UrlData *data,
|
||||
getsockname(sock, (struct sockaddr *) &add, (int *)&size);
|
||||
s=accept(sock, (struct sockaddr *) &add, (int *)&size);
|
||||
|
||||
sclose(sock); /* close the first socket */
|
||||
|
||||
if( -1 == s) {
|
||||
/* DIE! */
|
||||
failf(data, "Error accept()ing server connect");
|
||||
@@ -216,11 +212,16 @@ static CURLcode AllowServerConnect(struct UrlData *data,
|
||||
#define lastline(line) (isdigit((int)line[0]) && isdigit((int)line[1]) && \
|
||||
isdigit((int)line[2]) && (' ' == line[3]))
|
||||
|
||||
int GetLastResponse(int sockfd, char *buf,
|
||||
struct connectdata *conn)
|
||||
/*
|
||||
* We allow the ftpcode pointer to be NULL if no reply integer is wanted
|
||||
*/
|
||||
|
||||
int Curl_GetFTPResponse(int sockfd, char *buf,
|
||||
struct connectdata *conn,
|
||||
int *ftpcode)
|
||||
{
|
||||
int nread;
|
||||
int keepon=TRUE;
|
||||
size_t keepon=TRUE;
|
||||
char *ptr;
|
||||
int timeout = 3600; /* in seconds */
|
||||
struct timeval interval;
|
||||
@@ -233,10 +234,13 @@ int GetLastResponse(int sockfd, char *buf,
|
||||
#define SELECT_TIMEOUT 2
|
||||
int error = SELECT_OK;
|
||||
|
||||
if(ftpcode)
|
||||
*ftpcode=0; /* 0 for errors */
|
||||
|
||||
if(data->timeout) {
|
||||
/* if timeout is requested, find out how much remaining time we have */
|
||||
timeout = data->timeout - /* timeout time */
|
||||
(tvlong(tvnow()) - tvlong(conn->now)); /* spent time */
|
||||
(Curl_tvlong(Curl_tvnow()) - Curl_tvlong(conn->now)); /* spent time */
|
||||
if(timeout <=0 ) {
|
||||
failf(data, "Transfer aborted due to timeout");
|
||||
return -SELECT_TIMEOUT; /* already too little time */
|
||||
@@ -268,22 +272,17 @@ int GetLastResponse(int sockfd, char *buf,
|
||||
break;
|
||||
case 0: /* timeout */
|
||||
error = SELECT_TIMEOUT;
|
||||
infof(data, "Transfer aborted due to timeout\n");
|
||||
failf(data, "Transfer aborted due to timeout");
|
||||
break;
|
||||
default:
|
||||
#ifdef USE_SSLEAY
|
||||
if (data->use_ssl) {
|
||||
keepon = SSL_read(data->ssl, ptr, 1);
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
keepon = sread(sockfd, ptr, 1);
|
||||
#ifdef USE_SSLEAY
|
||||
}
|
||||
#endif /* USE_SSLEAY */
|
||||
|
||||
if ((*ptr == '\n') || (*ptr == '\r'))
|
||||
/*
|
||||
* This code previously didn't use the kerberos sec_read() code
|
||||
* to read, but when we use Curl_read() it may do so. Do confirm
|
||||
* that this is still ok and then remove this comment!
|
||||
*/
|
||||
if(CURLE_OK != Curl_read(conn, sockfd, ptr, 1, &keepon))
|
||||
keepon = FALSE;
|
||||
else if ((*ptr == '\n') || (*ptr == '\r'))
|
||||
keepon = FALSE;
|
||||
}
|
||||
if(keepon) {
|
||||
@@ -317,11 +316,14 @@ int GetLastResponse(int sockfd, char *buf,
|
||||
if(error)
|
||||
return -error;
|
||||
|
||||
if(ftpcode)
|
||||
*ftpcode=atoi(buf); /* return the initial number like this */
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
||||
/* -- who are we? -- */
|
||||
char *getmyhost(char *buf, int buf_size)
|
||||
char *Curl_getmyhost(char *buf, int buf_size)
|
||||
{
|
||||
#if defined(HAVE_GETHOSTNAME)
|
||||
gethostname(buf, buf_size);
|
||||
@@ -337,56 +339,9 @@ char *getmyhost(char *buf, int buf_size)
|
||||
return buf;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* URLfix()
|
||||
*
|
||||
* This function returns a string converted FROM the input URL format to a
|
||||
* format that is more likely usable for the remote server. That is, all
|
||||
* special characters (found as %XX-codes) will be eascaped with \<letter>.
|
||||
*/
|
||||
|
||||
static char *URLfix(char *string)
|
||||
{
|
||||
/* The length of the new string can't be longer than twice the original
|
||||
string, if all letters are '+'... */
|
||||
int alloc = strlen(string)*2;
|
||||
char *ns = malloc(alloc);
|
||||
unsigned char in;
|
||||
int index=0;
|
||||
int hex;
|
||||
|
||||
while(*string) {
|
||||
in = *string;
|
||||
switch(in) {
|
||||
case '+':
|
||||
ns[index++] = '\\';
|
||||
ns[index++] = ' ';
|
||||
string++;
|
||||
continue;
|
||||
|
||||
case '%':
|
||||
/* encoded part */
|
||||
if(sscanf(string+1, "%02X", &hex)) {
|
||||
ns[index++] = '\\';
|
||||
ns[index++] = hex;
|
||||
string+=3;
|
||||
continue;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
ns[index++] = in;
|
||||
string++;
|
||||
}
|
||||
}
|
||||
ns[index]=0; /* terminate it */
|
||||
return ns;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ftp_connect() should do everything that is to be considered a part
|
||||
of the connection phase. */
|
||||
CURLcode ftp_connect(struct connectdata *conn)
|
||||
CURLcode Curl_ftp_connect(struct connectdata *conn)
|
||||
{
|
||||
/* this is FTP and no proxy */
|
||||
int nread;
|
||||
@@ -394,6 +349,7 @@ CURLcode ftp_connect(struct connectdata *conn)
|
||||
char *buf = data->buffer; /* this is our buffer */
|
||||
struct FTP *ftp;
|
||||
CURLcode result;
|
||||
int ftpcode;
|
||||
|
||||
myalarm(0); /* switch off the alarm stuff */
|
||||
|
||||
@@ -411,17 +367,18 @@ CURLcode ftp_connect(struct connectdata *conn)
|
||||
|
||||
if (data->bits.tunnel_thru_httpproxy) {
|
||||
/* We want "seamless" FTP operations through HTTP proxy tunnel */
|
||||
result = GetHTTPProxyTunnel(data, data->firstsocket,
|
||||
data->hostname, data->remote_port);
|
||||
result = Curl_ConnectHTTPProxyTunnel(conn, data->firstsocket,
|
||||
data->hostname, data->remote_port);
|
||||
if(CURLE_OK != result)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* The first thing we do is wait for the "220*" line: */
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
if(strncmp(buf, "220", 3)) {
|
||||
|
||||
if(ftpcode != 220) {
|
||||
failf(data, "This doesn't seem like a nice ftp-server response");
|
||||
return CURLE_FTP_WEIRD_SERVER_REPLY;
|
||||
}
|
||||
@@ -450,31 +407,31 @@ CURLcode ftp_connect(struct connectdata *conn)
|
||||
ftpsendf(data->firstsocket, conn, "USER %s", ftp->user);
|
||||
|
||||
/* wait for feedback */
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(!strncmp(buf, "530", 3)) {
|
||||
if(ftpcode == 530) {
|
||||
/* 530 User ... access denied
|
||||
(the server denies to log the specified user) */
|
||||
failf(data, "Access denied: %s", &buf[4]);
|
||||
return CURLE_FTP_ACCESS_DENIED;
|
||||
}
|
||||
else if(!strncmp(buf, "331", 3)) {
|
||||
else if(ftpcode == 331) {
|
||||
/* 331 Password required for ...
|
||||
(the server requires to send the user's password too) */
|
||||
ftpsendf(data->firstsocket, conn, "PASS %s", ftp->passwd);
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(!strncmp(buf, "530", 3)) {
|
||||
if(ftpcode == 530) {
|
||||
/* 530 Login incorrect.
|
||||
(the username and/or the password are incorrect) */
|
||||
failf(data, "the username and/or the password are incorrect");
|
||||
return CURLE_FTP_USER_PASSWORD_INCORRECT;
|
||||
}
|
||||
else if(!strncmp(buf, "230", 3)) {
|
||||
else if(ftpcode == 230) {
|
||||
/* 230 User ... logged in.
|
||||
(user successfully logged in) */
|
||||
|
||||
@@ -485,7 +442,7 @@ CURLcode ftp_connect(struct connectdata *conn)
|
||||
return CURLE_FTP_WEIRD_PASS_REPLY;
|
||||
}
|
||||
}
|
||||
else if(/*! strncmp(buf, "230", 3)***/ buf[0] == '2') {
|
||||
else if(buf[0] == '2') {
|
||||
/* 230 User ... logged in.
|
||||
(the user logged in without password) */
|
||||
infof(data, "We have successfully logged in\n");
|
||||
@@ -513,13 +470,14 @@ CURLcode ftp_connect(struct connectdata *conn)
|
||||
|
||||
|
||||
/* argument is already checked for validity */
|
||||
CURLcode ftp_done(struct connectdata *conn)
|
||||
CURLcode Curl_ftp_done(struct connectdata *conn)
|
||||
{
|
||||
struct UrlData *data = conn->data;
|
||||
struct FTP *ftp = data->proto.ftp;
|
||||
size_t nread;
|
||||
char *buf = data->buffer; /* this is our buffer */
|
||||
struct curl_slist *qitem; /* QUOTE item */
|
||||
int ftpcode;
|
||||
|
||||
if(data->bits.upload) {
|
||||
if((-1 != data->infilesize) && (data->infilesize != *ftp->bytecountp)) {
|
||||
@@ -549,12 +507,12 @@ CURLcode ftp_done(struct connectdata *conn)
|
||||
if(!data->bits.no_body) {
|
||||
/* now let's see what the server says about the transfer we
|
||||
just performed: */
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
/* 226 Transfer complete, 250 Requested file action okay, completed. */
|
||||
if(!strncmp(buf, "226", 3) && !strncmp(buf, "250", 3)) {
|
||||
if((ftpcode != 226) && (ftpcode != 250)) {
|
||||
failf(data, "%s", buf+4);
|
||||
return CURLE_FTP_WRITE_ERROR;
|
||||
}
|
||||
@@ -569,11 +527,11 @@ CURLcode ftp_done(struct connectdata *conn)
|
||||
if (qitem->data) {
|
||||
ftpsendf(data->firstsocket, conn, "%s", qitem->data);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if (buf[0] != '2') {
|
||||
if (ftpcode >= 400) {
|
||||
failf(data, "QUOT string not accepted: %s",
|
||||
qitem->data);
|
||||
return CURLE_FTP_QUOTE_ERROR;
|
||||
@@ -583,11 +541,6 @@ CURLcode ftp_done(struct connectdata *conn)
|
||||
}
|
||||
}
|
||||
|
||||
if(ftp->file)
|
||||
free(ftp->file);
|
||||
if(ftp->dir)
|
||||
free(ftp->dir);
|
||||
|
||||
free(ftp);
|
||||
data->proto.ftp=NULL; /* it is gone */
|
||||
|
||||
@@ -617,6 +570,7 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
struct FTP *ftp = data->proto.ftp;
|
||||
|
||||
long *bytecountp = ftp->bytecountp;
|
||||
int ftpcode; /* for ftp status */
|
||||
|
||||
/* Send any QUOTE strings? */
|
||||
if(data->quote) {
|
||||
@@ -627,11 +581,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
if (qitem->data) {
|
||||
ftpsendf(data->firstsocket, conn, "%s", qitem->data);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if (buf[0] != '2') {
|
||||
if (ftpcode >= 400) {
|
||||
failf(data, "QUOT string not accepted: %s",
|
||||
qitem->data);
|
||||
return CURLE_FTP_QUOTE_ERROR;
|
||||
@@ -644,16 +598,45 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
/* change directory first! */
|
||||
if(ftp->dir && ftp->dir[0]) {
|
||||
ftpsendf(data->firstsocket, conn, "CWD %s", ftp->dir);
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(strncmp(buf, "250", 3)) {
|
||||
if(ftpcode != 250) {
|
||||
failf(data, "Couldn't change to directory %s", ftp->dir);
|
||||
return CURLE_FTP_ACCESS_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
if(data->bits.get_filetime && ftp->file) {
|
||||
/* we have requested to get the modified-time of the file, this is yet
|
||||
again a grey area as the MDTM is not kosher RFC959 */
|
||||
ftpsendf(data->firstsocket, conn, "MDTM %s", ftp->file);
|
||||
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(ftpcode == 213) {
|
||||
/* we got a time. Format should be: "YYYYMMDDHHMMSS[.sss]" where the
|
||||
last .sss part is optional and means fractions of a second */
|
||||
int year, month, day, hour, minute, second;
|
||||
if(6 == sscanf(buf+4, "%04d%02d%02d%02d%02d%02d",
|
||||
&year, &month, &day, &hour, &minute, &second)) {
|
||||
/* we have a time, reformat it */
|
||||
time_t secs=time(NULL);
|
||||
sprintf(buf, "%04d%02d%02d %02d:%02d:%02d",
|
||||
year, month, day, hour, minute, second);
|
||||
/* now, convert this into a time() value: */
|
||||
data->progress.filetime = curl_getdate(buf, &secs);
|
||||
}
|
||||
else {
|
||||
infof(data, "unsupported MDTM reply format\n");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* If we have selected NOBODY, it means that we only want file information.
|
||||
Which in FTP can't be much more than the file size! */
|
||||
if(data->bits.no_body) {
|
||||
@@ -661,33 +644,59 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
may not support it! It is however the only way we have to get a file's
|
||||
size! */
|
||||
int filesize;
|
||||
ftpsendf(data->firstsocket, conn, "SIZE %s", ftp->file);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
/* Some servers return different sizes for different modes, and thus we
|
||||
must set the proper type before we check the size */
|
||||
ftpsendf(data->firstsocket, conn, "TYPE %s",
|
||||
(data->bits.ftp_ascii)?"A":"I");
|
||||
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(strncmp(buf, "213", 3)) {
|
||||
if(ftpcode != 200) {
|
||||
failf(data, "Couldn't set %s mode",
|
||||
(data->bits.ftp_ascii)?"ASCII":"binary");
|
||||
return (data->bits.ftp_ascii)? CURLE_FTP_COULDNT_SET_ASCII:
|
||||
CURLE_FTP_COULDNT_SET_BINARY;
|
||||
}
|
||||
|
||||
ftpsendf(data->firstsocket, conn, "SIZE %s", ftp->file);
|
||||
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(ftpcode != 213) {
|
||||
failf(data, "Couldn't get file size: %s", buf+4);
|
||||
return CURLE_FTP_COULDNT_GET_SIZE;
|
||||
}
|
||||
/* get the size from the ascii string: */
|
||||
filesize = atoi(buf+4);
|
||||
|
||||
sprintf(buf, "Content-Length: %d\n", filesize);
|
||||
sprintf(buf, "Content-Length: %d\r\n", filesize);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
if(strlen(buf) != data->fwrite(buf, 1, strlen(buf), data->out)) {
|
||||
failf (data, "Failed writing output");
|
||||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
if(data->writeheader) {
|
||||
/* the header is requested to be written to this file */
|
||||
if(strlen(buf) != data->fwrite (buf, 1, strlen(buf),
|
||||
data->writeheader)) {
|
||||
failf (data, "Failed writing output");
|
||||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
#ifdef HAVE_STRFTIME
|
||||
if(data->bits.get_filetime && data->progress.filetime) {
|
||||
struct tm *tm;
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
struct tm buffer;
|
||||
tm = (struct tm *)localtime_r(&data->progress.filetime, &buffer);
|
||||
#else
|
||||
tm = localtime(&data->progress.filetime);
|
||||
#endif
|
||||
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
|
||||
strftime(buf, BUFSIZE-1, "Last-Modified: %a, %d %b %Y %H:%M:%S %Z\r\n",
|
||||
tm);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
@@ -701,23 +710,31 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
char myhost[256] = "";
|
||||
|
||||
if(data->ftpport) {
|
||||
if(if2ip(data->ftpport, myhost, sizeof(myhost))) {
|
||||
h = GetHost(data, myhost, &hostdataptr);
|
||||
if(Curl_if2ip(data->ftpport, myhost, sizeof(myhost))) {
|
||||
h = Curl_gethost(data, myhost, &hostdataptr);
|
||||
}
|
||||
else {
|
||||
if(strlen(data->ftpport)>1)
|
||||
h = GetHost(data, data->ftpport, &hostdataptr);
|
||||
h = Curl_gethost(data, data->ftpport, &hostdataptr);
|
||||
if(h)
|
||||
strcpy(myhost, data->ftpport); /* buffer overflow risk */
|
||||
}
|
||||
}
|
||||
if(! *myhost) {
|
||||
h=GetHost(data, getmyhost(myhost, sizeof(myhost)), &hostdataptr);
|
||||
h=Curl_gethost(data,
|
||||
Curl_getmyhost(myhost, sizeof(myhost)),
|
||||
&hostdataptr);
|
||||
}
|
||||
infof(data, "We connect from %s\n", myhost);
|
||||
|
||||
if ( h ) {
|
||||
if( (portsock = socket(AF_INET, SOCK_STREAM, 0)) >= 0 ) {
|
||||
|
||||
/* we set the secondary socket variable to this for now, it
|
||||
is only so that the cleanup function will close it in case
|
||||
we fail before the true secondary stuff is made */
|
||||
data->secondarysocket = portsock;
|
||||
|
||||
memset((char *)&sa, 0, sizeof(sa));
|
||||
memcpy((char *)&sa.sin_addr,
|
||||
h->h_addr,
|
||||
@@ -756,6 +773,9 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
free(hostdataptr);
|
||||
return CURLE_FTP_PORT_FAILED;
|
||||
}
|
||||
if(hostdataptr)
|
||||
/* free the memory used for name lookup */
|
||||
free(hostdataptr);
|
||||
}
|
||||
else {
|
||||
failf(data, "could't find my own IP address (%s)", myhost);
|
||||
@@ -781,11 +801,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
porttouse & 255);
|
||||
}
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(strncmp(buf, "200", 3)) {
|
||||
if(ftpcode != 200) {
|
||||
failf(data, "Server does not grok PORT, try without it!");
|
||||
return CURLE_FTP_PORT_FAILED;
|
||||
}
|
||||
@@ -794,11 +814,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
|
||||
ftpsendf(data->firstsocket, conn, "PASV");
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(strncmp(buf, "227", 3)) {
|
||||
if(ftpcode != 227) {
|
||||
failf(data, "Odd return code after PASV");
|
||||
return CURLE_FTP_WEIRD_PASV_REPLY;
|
||||
}
|
||||
@@ -844,11 +864,12 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
* previous lookup.
|
||||
*/
|
||||
he = conn->hp;
|
||||
connectport = data->port; /* we connect to the proxy's port */
|
||||
connectport =
|
||||
(unsigned short)data->port; /* we connect to the proxy's port */
|
||||
}
|
||||
else {
|
||||
/* normal, direct, ftp connection */
|
||||
he = GetHost(data, newhost, &hostdataptr);
|
||||
he = Curl_gethost(data, newhost, &hostdataptr);
|
||||
if(!he) {
|
||||
failf(data, "Can't resolve new host %s", newhost);
|
||||
return CURLE_FTP_CANT_GET_HOST;
|
||||
@@ -953,8 +974,8 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
|
||||
if (data->bits.tunnel_thru_httpproxy) {
|
||||
/* We want "seamless" FTP operations through HTTP proxy tunnel */
|
||||
result = GetHTTPProxyTunnel(data, data->secondarysocket,
|
||||
newhost, newport);
|
||||
result = Curl_ConnectHTTPProxyTunnel(conn, data->secondarysocket,
|
||||
newhost, newport);
|
||||
if(CURLE_OK != result)
|
||||
return result;
|
||||
}
|
||||
@@ -969,11 +990,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
ftpsendf(data->firstsocket, conn, "TYPE %s",
|
||||
(data->bits.ftp_ascii)?"A":"I");
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(strncmp(buf, "200", 3)) {
|
||||
if(ftpcode != 200) {
|
||||
failf(data, "Couldn't set %s mode",
|
||||
(data->bits.ftp_ascii)?"ASCII":"binary");
|
||||
return (data->bits.ftp_ascii)? CURLE_FTP_COULDNT_SET_ASCII:
|
||||
@@ -1000,11 +1021,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
|
||||
ftpsendf(data->firstsocket, conn, "SIZE %s", ftp->file);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(strncmp(buf, "213", 3)) {
|
||||
if(ftpcode != 213) {
|
||||
failf(data, "Couldn't get file size: %s", buf+4);
|
||||
return CURLE_FTP_COULDNT_GET_SIZE;
|
||||
}
|
||||
@@ -1016,25 +1037,9 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
if(data->resume_from) {
|
||||
/* do we still game? */
|
||||
int passed=0;
|
||||
#if 0
|
||||
/* Set resume file transfer offset */
|
||||
infof(data, "Instructs server to resume from offset %d\n",
|
||||
data->resume_from);
|
||||
|
||||
ftpsendf(data->firstsocket, conn, "REST %d", data->resume_from);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(strncmp(buf, "350", 3)) {
|
||||
failf(data, "Couldn't use REST: %s", buf+4);
|
||||
return CURLE_FTP_COULDNT_USE_REST;
|
||||
}
|
||||
#else
|
||||
/* enable append instead */
|
||||
data->bits.ftp_append = 1;
|
||||
#endif
|
||||
|
||||
/* 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 */
|
||||
@@ -1062,8 +1067,8 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
data->infilesize -= data->resume_from;
|
||||
|
||||
if(data->infilesize <= 0) {
|
||||
infof(data, "File already completely uploaded\n");
|
||||
return CURLE_OK;
|
||||
failf(data, "File already completely uploaded\n");
|
||||
return CURLE_FTP_COULDNT_STOR_FILE;
|
||||
}
|
||||
}
|
||||
/* we've passed, proceed as normal */
|
||||
@@ -1077,11 +1082,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
else
|
||||
ftpsendf(data->firstsocket, conn, "STOR %s", ftp->file);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(atoi(buf)>=400) {
|
||||
if(ftpcode>=400) {
|
||||
failf(data, "Failed FTP upload:%s", buf+3);
|
||||
/* oops, we never close the sockets! */
|
||||
return CURLE_FTP_COULDNT_STOR_FILE;
|
||||
@@ -1098,11 +1103,9 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
/* When we know we're uploading a specified file, we can get the file
|
||||
size prior to the actual upload. */
|
||||
|
||||
pgrsSetUploadSize(data, data->infilesize);
|
||||
#if 0
|
||||
ProgressInit(data, data->infilesize);
|
||||
#endif
|
||||
result = Transfer(conn, -1, -1, FALSE, NULL, /* no download */
|
||||
Curl_pgrsSetUploadSize(data, data->infilesize);
|
||||
|
||||
result = Curl_Transfer(conn, -1, -1, FALSE, NULL, /* no download */
|
||||
data->secondarysocket, bytecountp);
|
||||
if(result)
|
||||
return result;
|
||||
@@ -1149,11 +1152,7 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
infof(data, "range-download from %d to %d, totally %d bytes\n",
|
||||
from, to, totalsize);
|
||||
}
|
||||
#if 0
|
||||
if(!ppath[0])
|
||||
/* make sure this becomes a valid name */
|
||||
ppath="./";
|
||||
#endif
|
||||
|
||||
if((data->bits.ftp_list_only) || !ftp->file) {
|
||||
/* The specified path ends with a slash, and therefore we think this
|
||||
is a directory that is requested, use LIST. But before that we
|
||||
@@ -1163,11 +1162,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
/* Set type to ASCII */
|
||||
ftpsendf(data->firstsocket, conn, "TYPE A");
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(strncmp(buf, "200", 3)) {
|
||||
if(ftpcode != 200) {
|
||||
failf(data, "Couldn't set ascii mode");
|
||||
return CURLE_FTP_COULDNT_SET_ASCII;
|
||||
}
|
||||
@@ -1185,11 +1184,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
ftpsendf(data->firstsocket, conn, "TYPE %s",
|
||||
(data->bits.ftp_ascii)?"A":"I");
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(strncmp(buf, "200", 3)) {
|
||||
if(ftpcode != 200) {
|
||||
failf(data, "Couldn't set %s mode",
|
||||
(data->bits.ftp_ascii)?"ASCII":"binary");
|
||||
return (data->bits.ftp_ascii)? CURLE_FTP_COULDNT_SET_ASCII:
|
||||
@@ -1206,11 +1205,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
|
||||
ftpsendf(data->firstsocket, conn, "SIZE %s", ftp->file);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(strncmp(buf, "213", 3)) {
|
||||
if(ftpcode != 213) {
|
||||
infof(data, "server doesn't support SIZE: %s", buf+4);
|
||||
/* We couldn't get the size and therefore we can't know if there
|
||||
really is a part of the file left to get, although the server
|
||||
@@ -1250,11 +1249,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
|
||||
ftpsendf(data->firstsocket, conn, "REST %d", data->resume_from);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(strncmp(buf, "350", 3)) {
|
||||
if(ftpcode != 350) {
|
||||
failf(data, "Couldn't use REST: %s", buf+4);
|
||||
return CURLE_FTP_COULDNT_USE_REST;
|
||||
}
|
||||
@@ -1263,11 +1262,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
ftpsendf(data->firstsocket, conn, "RETR %s", ftp->file);
|
||||
}
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(!strncmp(buf, "150", 3) || !strncmp(buf, "125", 3)) {
|
||||
if((ftpcode == 150) || (ftpcode == 125)) {
|
||||
|
||||
/*
|
||||
A;
|
||||
@@ -1322,25 +1321,10 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
}
|
||||
|
||||
}
|
||||
#if 0
|
||||
if(2 != sscanf(buf, "%*[^(](%d bytes%c", &size, &paren))
|
||||
size=-1;
|
||||
#endif
|
||||
}
|
||||
else if(downloadsize > -1)
|
||||
size = downloadsize;
|
||||
|
||||
#if 0
|
||||
if((size > -1) && (data->resume_from>0)) {
|
||||
size -= data->resume_from;
|
||||
if(size <= 0) {
|
||||
failf(data, "Offset (%d) was beyond file size (%d)",
|
||||
data->resume_from, data->resume_from+size);
|
||||
return CURLE_PARTIAL_FILE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(data->bits.ftp_use_port) {
|
||||
result = AllowServerConnect(data, portsock);
|
||||
if( result )
|
||||
@@ -1350,7 +1334,7 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
infof(data, "Getting file with size: %d\n", size);
|
||||
|
||||
/* FTP download: */
|
||||
result=Transfer(conn, data->secondarysocket, size, FALSE,
|
||||
result=Curl_Transfer(conn, data->secondarysocket, size, FALSE,
|
||||
bytecountp,
|
||||
-1, NULL); /* no upload here */
|
||||
if(result)
|
||||
@@ -1370,7 +1354,7 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
/* -- deal with the ftp server! -- */
|
||||
|
||||
/* argument is already checked for validity */
|
||||
CURLcode ftp(struct connectdata *conn)
|
||||
CURLcode Curl_ftp(struct connectdata *conn)
|
||||
{
|
||||
CURLcode retcode;
|
||||
|
||||
@@ -1385,13 +1369,15 @@ CURLcode ftp(struct connectdata *conn)
|
||||
it */
|
||||
ftp->file = strrchr(conn->ppath, '/');
|
||||
if(ftp->file) {
|
||||
if(ftp->file != conn->ppath)
|
||||
dirlength=ftp->file-conn->ppath; /* don't count the traling slash */
|
||||
|
||||
ftp->file++; /* point to the first letter in the file name part or
|
||||
remain NULL */
|
||||
}
|
||||
else {
|
||||
ftp->file = conn->ppath; /* there's only a file part */
|
||||
}
|
||||
dirlength=ftp->file-conn->ppath;
|
||||
|
||||
if(*ftp->file) {
|
||||
ftp->file = curl_unescape(ftp->file, 0);
|
||||
@@ -1419,6 +1405,50 @@ CURLcode ftp(struct connectdata *conn)
|
||||
|
||||
retcode = _ftp(conn);
|
||||
|
||||
/* clean up here, success or error doesn't matter */
|
||||
if(ftp->file)
|
||||
free(ftp->file);
|
||||
if(ftp->dir)
|
||||
free(ftp->dir);
|
||||
|
||||
ftp->file = ftp->dir = NULL; /* zero */
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
||||
/*
|
||||
* ftpsendf() sends the formated string as a ftp command to a ftp server
|
||||
*
|
||||
* NOTE: we build the command in a fixed-length buffer, which sets length
|
||||
* restrictions on the command!
|
||||
*
|
||||
*/
|
||||
size_t Curl_ftpsendf(int fd, struct connectdata *conn, char *fmt, ...)
|
||||
{
|
||||
size_t bytes_written;
|
||||
char s[256];
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(s, 250, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if(conn->data->bits.verbose)
|
||||
fprintf(conn->data->err, "> %s\n", s);
|
||||
|
||||
strcat(s, "\r\n"); /* append a trailing CRLF */
|
||||
|
||||
#ifdef KRB4
|
||||
if(conn->sec_complete && conn->data->cmdchannel) {
|
||||
bytes_written = sec_fprintf(conn, conn->data->cmdchannel, s);
|
||||
fflush(conn->data->cmdchannel);
|
||||
}
|
||||
else
|
||||
#endif /* KRB4 */
|
||||
{
|
||||
bytes_written = swrite(fd, s, strlen(s));
|
||||
}
|
||||
return(bytes_written);
|
||||
}
|
||||
|
||||
|
||||
|
52
lib/ftp.h
52
lib/ftp.h
@@ -8,43 +8,33 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* 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);
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
CURLcode Curl_ftp(struct connectdata *conn);
|
||||
CURLcode Curl_ftp_done(struct connectdata *conn);
|
||||
CURLcode Curl_ftp_connect(struct connectdata *conn);
|
||||
|
||||
size_t Curl_ftpsendf(int fd, struct connectdata *, char *fmt, ...);
|
||||
|
||||
struct curl_slist *curl_slist_append(struct curl_slist *list, char *data);
|
||||
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
|
||||
|
@@ -390,7 +390,7 @@ static const short yycheck[] = { 0,
|
||||
56
|
||||
};
|
||||
/* -*-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. */
|
||||
|
||||
/* Skeleton output parser for bison,
|
||||
@@ -604,7 +604,7 @@ __yy_memcpy (char *to, char *from, unsigned int count)
|
||||
#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
|
||||
into yyparse. The argument should have type void *.
|
||||
@@ -1295,7 +1295,7 @@ case 50:
|
||||
break;}
|
||||
}
|
||||
/* 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;
|
||||
yyssp -= yylen;
|
||||
@@ -1981,7 +1981,7 @@ curl_getdate (const char *p, const time_t *now)
|
||||
yyInput = p;
|
||||
Start = now ? *now : time ((time_t *) NULL);
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
tmp = localtime_r(&Start, &keeptime);
|
||||
tmp = (struct tm *)localtime_r(&Start, &keeptime);
|
||||
#else
|
||||
tmp = localtime (&Start);
|
||||
#endif
|
||||
|
@@ -934,7 +934,7 @@ curl_getdate (const char *p, const time_t *now)
|
||||
yyInput = p;
|
||||
Start = now ? *now : time ((time_t *) NULL);
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
tmp = localtime_r(&Start, &keeptime);
|
||||
tmp = (struct tm *)localtime_r(&Start, &keeptime);
|
||||
#else
|
||||
tmp = localtime (&Start);
|
||||
#endif
|
||||
|
44
lib/getenv.c
44
lib/getenv.c
@@ -5,37 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -49,6 +33,7 @@
|
||||
#include "memdebug.h"
|
||||
#endif
|
||||
|
||||
static
|
||||
char *GetEnv(char *variable)
|
||||
{
|
||||
#ifdef WIN32
|
||||
@@ -56,12 +41,13 @@ char *GetEnv(char *variable)
|
||||
char env[MAX_PATH]; /* MAX_PATH is from windef.h */
|
||||
char *temp = getenv(variable);
|
||||
env[0] = '\0';
|
||||
ExpandEnvironmentStrings(temp, env, sizeof(env));
|
||||
if (temp != NULL)
|
||||
ExpandEnvironmentStrings(temp, env, sizeof(env));
|
||||
#else
|
||||
/* no length control */
|
||||
char *env = getenv(variable);
|
||||
#endif
|
||||
return env?strdup(env):NULL;
|
||||
return (env && env[0])?strdup(env):NULL;
|
||||
}
|
||||
|
||||
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
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* 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
|
||||
*
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
/* Unix and Win32 getenv function call */
|
||||
char *GetEnv(char *variable);
|
||||
#include <curl/curl.h>
|
||||
|
||||
#endif
|
||||
|
@@ -5,38 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -84,6 +67,9 @@ CURLcode curl_getinfo(CURL *curl, CURLINFO info, ...)
|
||||
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;
|
||||
@@ -94,16 +80,13 @@ CURLcode curl_getinfo(CURL *curl, CURLINFO info, ...)
|
||||
*param_doublep = data->progress.timespent;
|
||||
break;
|
||||
case CURLINFO_NAMELOOKUP_TIME:
|
||||
*param_doublep = tvdiff(data->progress.t_nslookup,
|
||||
data->progress.start);
|
||||
*param_doublep = data->progress.t_nslookup;
|
||||
break;
|
||||
case CURLINFO_CONNECT_TIME:
|
||||
*param_doublep = tvdiff(data->progress.t_connect,
|
||||
data->progress.start);
|
||||
*param_doublep = data->progress.t_connect;
|
||||
break;
|
||||
case CURLINFO_PRETRANSFER_TIME:
|
||||
*param_doublep = tvdiff(data->progress.t_pretransfer,
|
||||
data->progress.start);
|
||||
*param_doublep = data->progress.t_pretransfer;
|
||||
break;
|
||||
case CURLINFO_SIZE_UPLOAD:
|
||||
*param_doublep = data->progress.uploaded;
|
||||
@@ -117,6 +100,9 @@ CURLcode curl_getinfo(CURL *curl, CURLINFO info, ...)
|
||||
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;
|
||||
}
|
||||
|
@@ -4,10 +4,11 @@
|
||||
* Redistribution and use are freely permitted provided that:
|
||||
*
|
||||
* 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_r(const char *prompt, char* buffer, int buflen)
|
||||
* 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,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
@@ -34,19 +35,19 @@
|
||||
* Daniel Stenberg <daniel@haxx.se>
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETPASS_R
|
||||
|
||||
#ifndef WIN32
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
# if !defined(HAVE_TCGETATTR) && !defined(HAVE_TCSETATTR)
|
||||
# undef HAVE_TERMIOS_H
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define INPUT_BUFFER 128
|
||||
|
||||
#ifndef RETSIGTYPE
|
||||
# define RETSIGTYPE void
|
||||
#endif
|
||||
@@ -70,11 +71,10 @@
|
||||
# define perror(x) fprintf(stderr, "Error in: %s\n", x)
|
||||
#endif
|
||||
|
||||
char *getpass(const char *prompt)
|
||||
char *getpass_r(const char *prompt, char *buffer, size_t buflen)
|
||||
{
|
||||
FILE *infp;
|
||||
FILE *outfp;
|
||||
static char buf[INPUT_BUFFER];
|
||||
RETSIGTYPE (*sigint)();
|
||||
#ifndef __EMX__
|
||||
RETSIGTYPE (*sigtstp)();
|
||||
@@ -115,25 +115,25 @@ char *getpass(const char *prompt)
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
if(tcgetattr(outfd, &orig) != 0)
|
||||
{
|
||||
perror("tcgetattr");
|
||||
; /*perror("tcgetattr");*/
|
||||
}
|
||||
noecho = orig;
|
||||
noecho.c_lflag &= ~ECHO;
|
||||
if(tcsetattr(outfd, TCSANOW, &noecho) != 0)
|
||||
{
|
||||
perror("tcgetattr");
|
||||
; /*perror("tcgetattr");*/
|
||||
}
|
||||
#else
|
||||
# ifdef HAVE_TERMIO_H
|
||||
if(ioctl(outfd, TCGETA, &orig) != 0)
|
||||
{
|
||||
perror("ioctl");
|
||||
; /*perror("ioctl");*/
|
||||
}
|
||||
noecho = orig;
|
||||
noecho.c_lflag &= ~ECHO;
|
||||
if(ioctl(outfd, TCSETA, &noecho) != 0)
|
||||
{
|
||||
perror("ioctl");
|
||||
; /*perror("ioctl");*/
|
||||
}
|
||||
# else
|
||||
# endif
|
||||
@@ -142,8 +142,8 @@ char *getpass(const char *prompt)
|
||||
fputs(prompt, outfp);
|
||||
fflush(outfp);
|
||||
|
||||
bytes_read=read(infd, buf, INPUT_BUFFER);
|
||||
buf[bytes_read > 0 ? (bytes_read -1) : 0] = '\0';
|
||||
bytes_read=read(infd, buffer, buflen);
|
||||
buffer[bytes_read > 0 ? (bytes_read -1) : 0] = '\0';
|
||||
|
||||
/* print a new line if needed */
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
@@ -157,18 +157,18 @@ char *getpass(const char *prompt)
|
||||
|
||||
/*
|
||||
* reset term charectaristics, use TCSAFLUSH incase the
|
||||
* user types more than INPUT_BUFFER
|
||||
* user types more than buflen
|
||||
*/
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
if(tcsetattr(outfd, TCSAFLUSH, &orig) != 0)
|
||||
{
|
||||
perror("tcgetattr");
|
||||
; /*perror("tcgetattr");*/
|
||||
}
|
||||
#else
|
||||
# ifdef HAVE_TERMIO_H
|
||||
if(ioctl(outfd, TCSETA, &orig) != 0)
|
||||
{
|
||||
perror("ioctl");
|
||||
; /*perror("ioctl");*/
|
||||
}
|
||||
# else
|
||||
# endif
|
||||
@@ -179,15 +179,38 @@ char *getpass(const char *prompt)
|
||||
signal(SIGTSTP, sigtstp);
|
||||
#endif
|
||||
|
||||
return(buf);
|
||||
return buffer; /* we always return success */
|
||||
}
|
||||
#else
|
||||
#else /* WIN32 */
|
||||
#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)
|
||||
{
|
||||
static char password[80];
|
||||
printf(prompt);
|
||||
gets(password);
|
||||
return password;
|
||||
static char buf[256];
|
||||
return getpass_r(prompt, buf, sizeof(buf));
|
||||
}
|
||||
#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
|
58
lib/hostip.c
58
lib/hostip.c
@@ -5,38 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -79,7 +62,7 @@
|
||||
|
||||
/* --- 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)
|
||||
struct in_addr in;
|
||||
@@ -100,18 +83,21 @@ char *MakeIP(unsigned long num,char *addr, int addr_len)
|
||||
return (addr);
|
||||
}
|
||||
|
||||
/* The original code to this function was stolen from the Dancer source code,
|
||||
written by Bjorn Reese, it has since been patched and modified. */
|
||||
/* The original code to this function was once stolen from the Dancer source
|
||||
code, written by Bjorn Reese, it has since been patched and modified
|
||||
considerably. */
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE (unsigned long) ~0
|
||||
#endif
|
||||
struct hostent *GetHost(struct UrlData *data,
|
||||
char *hostname,
|
||||
char **bufp)
|
||||
|
||||
struct hostent *Curl_gethost(struct UrlData *data,
|
||||
char *hostname,
|
||||
char **bufp)
|
||||
{
|
||||
struct hostent *h = NULL;
|
||||
unsigned long in;
|
||||
int ret;
|
||||
int ret; /* this variable is unused on several platforms but used on some */
|
||||
|
||||
#define CURL_NAMELOOKUP_SIZE 9000
|
||||
|
||||
@@ -187,12 +173,14 @@ struct hostent *GetHost(struct UrlData *data,
|
||||
infof(data, "gethostbyname_r(2) failed for %s\n", hostname);
|
||||
h = NULL; /* set return code to NULL */
|
||||
free(buf);
|
||||
*bufp=NULL;
|
||||
}
|
||||
#else
|
||||
else {
|
||||
if ((h = gethostbyname(hostname)) == NULL ) {
|
||||
infof(data, "gethostbyname(2) failed for %s\n", hostname);
|
||||
free(buf);
|
||||
*bufp=NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
43
lib/hostip.h
43
lib/hostip.h
@@ -7,39 +7,24 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
struct hostent *GetHost(struct UrlData *data, char *hostname, char **bufp );
|
||||
struct hostent *Curl_gethost(struct UrlData *data,
|
||||
char *hostname,
|
||||
char **bufp);
|
||||
|
||||
#endif
|
||||
|
343
lib/http.c
343
lib/http.c
@@ -5,38 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -104,14 +87,13 @@
|
||||
|
||||
#include "urldata.h"
|
||||
#include <curl/curl.h>
|
||||
#include "download.h"
|
||||
#include "transfer.h"
|
||||
#include "sendf.h"
|
||||
#include "formdata.h"
|
||||
#include "progress.h"
|
||||
#include "base64.h"
|
||||
#include "cookie.h"
|
||||
#include "strequal.h"
|
||||
#include "url.h"
|
||||
#include "ssluse.h"
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
@@ -122,6 +104,143 @@
|
||||
#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
|
||||
* header (prefix).
|
||||
@@ -140,32 +259,34 @@ bool static checkheaders(struct UrlData *data, char *thisheader)
|
||||
}
|
||||
|
||||
/*
|
||||
* GetHTTPProxyTunnel() requires that we're connected to a HTTP proxy. This
|
||||
* ConnectHTTPProxyTunnel() requires that we're connected to a HTTP proxy. This
|
||||
* 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.
|
||||
*/
|
||||
|
||||
CURLcode GetHTTPProxyTunnel(struct UrlData *data, int tunnelsocket,
|
||||
char *hostname, int remote_port)
|
||||
CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
|
||||
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 statment */
|
||||
sendf(tunnelsocket, data,
|
||||
"CONNECT %s:%d HTTP/1.0\015\012"
|
||||
"%s"
|
||||
"%s"
|
||||
"\r\n",
|
||||
hostname, remote_port,
|
||||
(data->bits.proxy_user_passwd)?data->ptr_proxyuserpwd:"",
|
||||
(data->useragent?data->ptr_uagent:"")
|
||||
);
|
||||
/* OK, now send the connect request to the proxy */
|
||||
Curl_sendf(tunnelsocket, conn,
|
||||
"CONNECT %s:%d HTTP/1.0\015\012"
|
||||
"%s"
|
||||
"%s"
|
||||
"\r\n",
|
||||
hostname, remote_port,
|
||||
(data->bits.proxy_user_passwd)?data->ptr_proxyuserpwd:"",
|
||||
(data->useragent?data->ptr_uagent:"")
|
||||
);
|
||||
|
||||
/* wait for the proxy to send us a HTTP/1.0 200 OK header */
|
||||
while(GetLine(tunnelsocket, data->buffer, data)) {
|
||||
while(GetLine(tunnelsocket, data->buffer, conn)) {
|
||||
if('\r' == data->buffer[0])
|
||||
break; /* end of headers */
|
||||
if(2 == sscanf(data->buffer, "HTTP/1.%d %d",
|
||||
@@ -187,7 +308,7 @@ CURLcode GetHTTPProxyTunnel(struct UrlData *data, int tunnelsocket,
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
CURLcode http_connect(struct connectdata *conn)
|
||||
CURLcode Curl_http_connect(struct connectdata *conn)
|
||||
{
|
||||
struct UrlData *data;
|
||||
CURLcode result;
|
||||
@@ -203,16 +324,15 @@ CURLcode http_connect(struct connectdata *conn)
|
||||
if (conn->protocol & PROT_HTTPS) {
|
||||
if (data->bits.httpproxy) {
|
||||
/* HTTPS through a proxy can only be done with a tunnel */
|
||||
result = GetHTTPProxyTunnel(data, data->firstsocket,
|
||||
data->hostname, data->remote_port);
|
||||
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 */
|
||||
if(UrgSSLConnect (data)) {
|
||||
if(Curl_SSLConnect(data))
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if(data->bits.user_passwd && !data->bits.this_is_a_follow) {
|
||||
@@ -226,14 +346,14 @@ CURLcode http_connect(struct connectdata *conn)
|
||||
|
||||
/* called from curl_close() when this struct is about to get wasted, free
|
||||
protocol-specific resources */
|
||||
CURLcode http_close(struct connectdata *conn)
|
||||
CURLcode Curl_http_close(struct connectdata *conn)
|
||||
{
|
||||
if(conn->data->auth_host)
|
||||
free(conn->data->auth_host);
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
CURLcode http_done(struct connectdata *conn)
|
||||
CURLcode Curl_http_done(struct connectdata *conn)
|
||||
{
|
||||
struct UrlData *data;
|
||||
long *bytecount = &conn->bytecount;
|
||||
@@ -245,7 +365,7 @@ CURLcode http_done(struct connectdata *conn)
|
||||
if(data->bits.http_formpost) {
|
||||
*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->in = http->in; /* restore */
|
||||
@@ -261,7 +381,7 @@ CURLcode http_done(struct connectdata *conn)
|
||||
}
|
||||
|
||||
|
||||
CURLcode http(struct connectdata *conn)
|
||||
CURLcode Curl_http(struct connectdata *conn)
|
||||
{
|
||||
struct UrlData *data=conn->data;
|
||||
char *buf = data->buffer; /* this is a short cut to the buffer */
|
||||
@@ -301,42 +421,48 @@ CURLcode http(struct connectdata *conn)
|
||||
!data->auth_host ||
|
||||
strequal(data->auth_host, data->hostname)) {
|
||||
sprintf(data->buffer, "%s:%s", data->user, data->passwd);
|
||||
if(base64_encode(data->buffer, strlen(data->buffer),
|
||||
&authorization) >= 0) {
|
||||
data->ptr_userpwd = maprintf( "Authorization: Basic %s\015\012",
|
||||
authorization);
|
||||
if(Curl_base64_encode(data->buffer, strlen(data->buffer),
|
||||
&authorization) >= 0) {
|
||||
data->ptr_userpwd = aprintf( "Authorization: Basic %s\015\012",
|
||||
authorization);
|
||||
free(authorization);
|
||||
}
|
||||
}
|
||||
}
|
||||
if((data->bits.set_range) && !checkheaders(data, "Range:")) {
|
||||
data->ptr_rangeline = maprintf("Range: bytes=%s\015\012", data->range);
|
||||
data->ptr_rangeline = aprintf("Range: bytes=%s\015\012", data->range);
|
||||
}
|
||||
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:")) {
|
||||
data->ptr_cookie = maprintf("Cookie: %s\015\012", data->cookie);
|
||||
data->ptr_cookie = aprintf("Cookie: %s\015\012", data->cookie);
|
||||
}
|
||||
|
||||
if(data->cookies) {
|
||||
co = cookie_getlist(data->cookies,
|
||||
host,
|
||||
ppath,
|
||||
conn->protocol&PROT_HTTPS?TRUE:FALSE);
|
||||
co = Curl_cookie_getlist(data->cookies,
|
||||
host,
|
||||
ppath,
|
||||
conn->protocol&PROT_HTTPS?TRUE:FALSE);
|
||||
}
|
||||
if ((data->bits.httpproxy) && !(conn->protocol&PROT_HTTPS)) {
|
||||
/* 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) {
|
||||
/* 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 */
|
||||
http->sendit = getFormData(data->httppost, &http->postsize);
|
||||
http->sendit = Curl_getFormData(data->httppost, &http->postsize);
|
||||
}
|
||||
|
||||
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:"))
|
||||
@@ -345,6 +471,64 @@ CURLcode http(struct connectdata *conn)
|
||||
if(!checkheaders(data, "Accept:"))
|
||||
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 {
|
||||
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 */
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
send_buffer *req_buffer;
|
||||
struct curl_slist *headers=data->headers;
|
||||
@@ -384,11 +568,12 @@ CURLcode http(struct connectdata *conn)
|
||||
|
||||
if(co) {
|
||||
int count=0;
|
||||
struct Cookie *store=co;
|
||||
/* now loop through all cookies that matched */
|
||||
while(co) {
|
||||
if(co->value && strlen(co->value)) {
|
||||
if(0 == count) {
|
||||
add_bufferf(req_buffer, "Cookie:");
|
||||
add_bufferf(req_buffer, "Cookie: ");
|
||||
}
|
||||
add_bufferf(req_buffer,
|
||||
"%s%s=%s", count?"; ":"", co->name, co->value);
|
||||
@@ -399,7 +584,7 @@ CURLcode http(struct connectdata *conn)
|
||||
if(count) {
|
||||
add_buffer(req_buffer, "\r\n", 2);
|
||||
}
|
||||
cookie_freelist(co); /* free the cookie list */
|
||||
Curl_cookie_freelist(store); /* free the cookie list */
|
||||
co=NULL;
|
||||
}
|
||||
|
||||
@@ -448,7 +633,7 @@ CURLcode http(struct connectdata *conn)
|
||||
/* we require a colon for this to be a true header */
|
||||
|
||||
ptr++; /* pass the colon */
|
||||
while(*ptr && isspace(*ptr))
|
||||
while(*ptr && isspace((int)*ptr))
|
||||
ptr++;
|
||||
|
||||
if(*ptr) {
|
||||
@@ -461,7 +646,7 @@ CURLcode http(struct connectdata *conn)
|
||||
}
|
||||
|
||||
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");
|
||||
return CURLE_HTTP_POST_ERROR;
|
||||
}
|
||||
@@ -471,24 +656,24 @@ CURLcode http(struct connectdata *conn)
|
||||
|
||||
data->fread =
|
||||
(size_t (*)(char *, size_t, size_t, FILE *))
|
||||
FormReader; /* set the read function to read from the
|
||||
generated form data */
|
||||
Curl_FormReader; /* set the read function to read from the
|
||||
generated form data */
|
||||
data->in = (FILE *)&http->form;
|
||||
|
||||
add_bufferf(req_buffer,
|
||||
"Content-Length: %d\r\n", http->postsize-2);
|
||||
|
||||
/* set upload size to the progress meter */
|
||||
pgrsSetUploadSize(data, http->postsize);
|
||||
Curl_pgrsSetUploadSize(data, http->postsize);
|
||||
|
||||
data->request_size =
|
||||
add_buffer_send(data->firstsocket, conn, req_buffer);
|
||||
result = Transfer(conn, data->firstsocket, -1, TRUE,
|
||||
result = Curl_Transfer(conn, data->firstsocket, -1, TRUE,
|
||||
&http->readbytecount,
|
||||
data->firstsocket,
|
||||
&http->writebytecount);
|
||||
if(result) {
|
||||
FormFree(http->sendit); /* free that whole lot */
|
||||
Curl_FormFree(http->sendit); /* free that whole lot */
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -504,14 +689,14 @@ CURLcode http(struct connectdata *conn)
|
||||
add_bufferf(req_buffer, "\015\012");
|
||||
|
||||
/* set the upload size to the progress meter */
|
||||
pgrsSetUploadSize(data, data->infilesize);
|
||||
Curl_pgrsSetUploadSize(data, data->infilesize);
|
||||
|
||||
/* 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 = Transfer(conn, data->firstsocket, -1, TRUE,
|
||||
result = Curl_Transfer(conn, data->firstsocket, -1, TRUE,
|
||||
&http->readbytecount,
|
||||
data->firstsocket,
|
||||
&http->writebytecount);
|
||||
@@ -557,7 +742,7 @@ CURLcode http(struct connectdata *conn)
|
||||
add_buffer_send(data->firstsocket, conn, req_buffer);
|
||||
|
||||
/* 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 */
|
||||
}
|
||||
if(result)
|
||||
|
52
lib/http.h
52
lib/http.h
@@ -8,47 +8,31 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
/* ftp can use this as well */
|
||||
CURLcode GetHTTPProxyTunnel(struct UrlData *data, int tunnelsocket,
|
||||
char *hostname, int remote_port);
|
||||
CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
|
||||
int tunnelsocket,
|
||||
char *hostname, int remote_port);
|
||||
|
||||
/* protocol-specific functions set up to be called by the main engine */
|
||||
CURLcode http(struct connectdata *conn);
|
||||
CURLcode http_done(struct connectdata *conn);
|
||||
CURLcode http_connect(struct connectdata *conn);
|
||||
CURLcode http_close(struct connectdata *conn);
|
||||
CURLcode Curl_http(struct connectdata *conn);
|
||||
CURLcode Curl_http_done(struct connectdata *conn);
|
||||
CURLcode Curl_http_connect(struct connectdata *conn);
|
||||
CURLcode Curl_http_close(struct connectdata *conn);
|
||||
|
||||
#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
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -49,7 +32,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if ! defined(WIN32) && ! defined(__BEOS__)
|
||||
#if ! defined(WIN32) && ! defined(__BEOS__) && !defined(__CYGWIN32__)
|
||||
|
||||
#ifdef NEED_REENTRANT
|
||||
#define _REENTRANT
|
||||
@@ -89,7 +72,7 @@
|
||||
|
||||
#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;
|
||||
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
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
#include "setup.h"
|
||||
|
||||
#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
|
||||
#define if2ip(a,b,c) NULL
|
||||
#define Curl_if2ip(a,b,c) NULL
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
43
lib/krb4.c
43
lib/krb4.c
@@ -47,6 +47,9 @@
|
||||
#include <string.h>
|
||||
#include <krb.h>
|
||||
|
||||
#include "ftp.h"
|
||||
#include "sendf.h"
|
||||
|
||||
/* The last #include file should be: */
|
||||
#ifdef MALLOCDEBUG
|
||||
#include "memdebug.h"
|
||||
@@ -95,7 +98,8 @@ strlcpy (char *dst, const char *src, size_t dst_sz)
|
||||
else
|
||||
return n + strlen (src);
|
||||
}
|
||||
|
||||
#else
|
||||
size_t strlcpy (char *dst, const char *src, size_t dst_sz);
|
||||
#endif
|
||||
|
||||
static int
|
||||
@@ -279,12 +283,15 @@ krb4_auth(void *app_data, struct connectdata *conn)
|
||||
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, LOCAL_ADDR, &l) < 0)
|
||||
if(getsockname(conn->data->firstsocket,
|
||||
(struct sockaddr *)LOCAL_ADDR, &l) < 0)
|
||||
perror("getsockname()");
|
||||
|
||||
checksum = getpid();
|
||||
@@ -308,7 +315,7 @@ krb4_auth(void *app_data, struct connectdata *conn)
|
||||
else {
|
||||
if (natAddr.s_addr != localaddr->sin_addr.s_addr) {
|
||||
printf("Using NAT IP address (%s) for kerberos 4\n",
|
||||
inet_ntoa(natAddr));
|
||||
(char *)inet_ntoa(natAddr));
|
||||
localaddr->sin_addr = natAddr;
|
||||
|
||||
/*
|
||||
@@ -327,15 +334,15 @@ krb4_auth(void *app_data, struct connectdata *conn)
|
||||
/*printf("Local address is %s\n", inet_ntoa(localaddr->sin_addr));***/
|
||||
/*printf("Remote address is %s\n", inet_ntoa(remoteaddr->sin_addr));***/
|
||||
|
||||
if(base64_encode(adat.dat, adat.length, &p) < 0) {
|
||||
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)*/
|
||||
ftpsendf(conn->data->firstsocket, conn, "ADAT %s", p);
|
||||
Curl_ftpsendf(conn->data->firstsocket, conn, "ADAT %s", p);
|
||||
/* wait for feedback */
|
||||
nread = GetLastResponse(conn->data->firstsocket,
|
||||
conn->data->buffer, conn);
|
||||
nread = Curl_GetFTPResponse(conn->data->firstsocket,
|
||||
conn->data->buffer, conn, NULL);
|
||||
if(nread < 0)
|
||||
return /*CURLE_OPERATION_TIMEOUTED*/-1;
|
||||
free(p);
|
||||
@@ -351,7 +358,7 @@ krb4_auth(void *app_data, struct connectdata *conn)
|
||||
return AUTH_ERROR;
|
||||
}
|
||||
p += 5;
|
||||
len = base64_decode(p, adat.dat);
|
||||
len = Curl_base64_decode(p, adat.dat);
|
||||
if(len < 0){
|
||||
printf("Failed to decode base64 from server.\n");
|
||||
return AUTH_ERROR;
|
||||
@@ -389,14 +396,11 @@ struct sec_client_mech krb4_client_mech = {
|
||||
|
||||
void krb_kauth(struct connectdata *conn)
|
||||
{
|
||||
int ret;
|
||||
char buf[1024];
|
||||
des_cblock key;
|
||||
des_key_schedule schedule;
|
||||
KTEXT_ST tkt, tktcopy;
|
||||
char *name;
|
||||
char *p;
|
||||
int overbose;
|
||||
char passwd[100];
|
||||
int tmp;
|
||||
size_t nread;
|
||||
@@ -405,20 +409,19 @@ void krb_kauth(struct connectdata *conn)
|
||||
|
||||
save = set_command_prot(conn, prot_private);
|
||||
/*ret = command("SITE KAUTH %s", name);***/
|
||||
ftpsendf(conn->data->firstsocket, conn,
|
||||
Curl_ftpsendf(conn->data->firstsocket, conn,
|
||||
"SITE KAUTH %s", conn->data->user);
|
||||
/* wait for feedback */
|
||||
nread = GetLastResponse(conn->data->firstsocket, conn->data->buffer, conn);
|
||||
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'){
|
||||
/*verbose = overbose;***/
|
||||
set_command_prot(conn, save);
|
||||
/*code = -1;***/
|
||||
return;
|
||||
}
|
||||
/*verbose = overbose;***/
|
||||
p = strstr(/*reply_string***/conn->data->buffer, "T=");
|
||||
if(!p){
|
||||
printf("Bad reply from server.\n");
|
||||
@@ -427,7 +430,7 @@ void krb_kauth(struct connectdata *conn)
|
||||
return;
|
||||
}
|
||||
p += 2;
|
||||
tmp = base64_decode(p, &tkt.dat);
|
||||
tmp = Curl_base64_decode(p, &tkt.dat);
|
||||
if(tmp < 0){
|
||||
printf("Failed to decode base64 in reply.\n");
|
||||
set_command_prot(conn, save);
|
||||
@@ -440,7 +443,6 @@ void krb_kauth(struct connectdata *conn)
|
||||
p = strstr(/*reply_string***/conn->data->buffer, "P=");
|
||||
if(!p){
|
||||
printf("Bad reply from server.\n");
|
||||
/*verbose = overbose;***/
|
||||
set_command_prot(conn, save);
|
||||
/*code = -1;***/
|
||||
return;
|
||||
@@ -476,7 +478,7 @@ void krb_kauth(struct connectdata *conn)
|
||||
memset(key, 0, sizeof(key));
|
||||
memset(schedule, 0, sizeof(schedule));
|
||||
memset(passwd, 0, sizeof(passwd));
|
||||
if(base64_encode(tktcopy.dat, tktcopy.length, &p) < 0) {
|
||||
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;***/
|
||||
@@ -484,10 +486,11 @@ void krb_kauth(struct connectdata *conn)
|
||||
}
|
||||
memset (tktcopy.dat, 0, tktcopy.length);
|
||||
/*ret = command("SITE KAUTH %s %s", name, p);***/
|
||||
ftpsendf(conn->data->firstsocket, conn,
|
||||
Curl_ftpsendf(conn->data->firstsocket, conn,
|
||||
"SITE KAUTH %s %s", name, p);
|
||||
/* wait for feedback */
|
||||
nread = GetLastResponse(conn->data->firstsocket, conn->data->buffer, conn);
|
||||
nread = Curl_GetFTPResponse(conn->data->firstsocket, conn->data->buffer,
|
||||
conn, NULL);
|
||||
if(nread < 0)
|
||||
return /*CURLE_OPERATION_TIMEOUTED*/;
|
||||
free(p);
|
||||
|
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
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Contributor(s):
|
||||
* Bj<42>rn Reese <breese@mail1.stofanet.dk>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -134,19 +117,18 @@ static void * DynaGetFunction(char *name)
|
||||
static int WriteProc(void *param, char *text, int len)
|
||||
{
|
||||
struct UrlData *data = (struct UrlData *)param;
|
||||
|
||||
data->fwrite(text, 1, strlen(text), data->out);
|
||||
Curl_client_write(data, CLIENTWRITE_BODY, text, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CURLcode ldap_done(struct connectdata *conn)
|
||||
CURLcode Curl_ldap_done(struct connectdata *conn)
|
||||
{
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*/
|
||||
CURLcode ldap(struct connectdata *conn)
|
||||
CURLcode Curl_ldap(struct connectdata *conn)
|
||||
{
|
||||
CURLcode status = CURLE_OK;
|
||||
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
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* 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);
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
CURLcode Curl_ldap(struct connectdata *conn);
|
||||
CURLcode Curl_ldap_done(struct connectdata *conn);
|
||||
|
||||
#endif /* __LDAP_H */
|
||||
|
@@ -33,5 +33,10 @@ EXPORTS
|
||||
curl_version @ 24 ;
|
||||
curl_write @ 25 ;
|
||||
maprintf @ 26 ;
|
||||
strequal @ 27 ;
|
||||
strnequal @ 28 ;
|
||||
mfprintf @ 27 ;
|
||||
mprintf @ 28 ;
|
||||
msprintf @ 29 ;
|
||||
msnprintf @ 30 ;
|
||||
mvfprintf @ 31 ;
|
||||
strequal @ 32 ;
|
||||
strnequal @ 33 ;
|
||||
|
129
lib/memdebug.c
129
lib/memdebug.c
@@ -6,45 +6,46 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $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
|
||||
@@ -54,7 +55,7 @@
|
||||
* Don't use these with multithreaded test programs!
|
||||
*/
|
||||
|
||||
FILE *logfile=stderr;
|
||||
FILE *logfile;
|
||||
|
||||
/* this sets the log file name */
|
||||
void curl_memdebug(char *logname)
|
||||
@@ -66,16 +67,25 @@ void curl_memdebug(char *logname)
|
||||
void *curl_domalloc(size_t size, int line, char *source)
|
||||
{
|
||||
void *mem=(malloc)(size);
|
||||
fprintf(logfile, "MEM %s:%d malloc(%d) = %p\n",
|
||||
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=(strdup)(str);
|
||||
size_t len=strlen(str)+1;
|
||||
fprintf(logfile, "MEM %s:%d strdup(%p) (%d) = %p\n",
|
||||
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;
|
||||
}
|
||||
@@ -83,16 +93,65 @@ char *curl_dostrdup(char *str, int line, char *source)
|
||||
void *curl_dorealloc(void *ptr, size_t size, int line, char *source)
|
||||
{
|
||||
void *mem=(realloc)(ptr, size);
|
||||
fprintf(logfile, "MEM %s:%d realloc(%p, %d) = %p\n",
|
||||
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, "MEM %s:%d free(%p)\n",
|
||||
|
||||
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 */
|
||||
|
@@ -1,13 +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:
|
||||
* A merge of Bjorn Reese's format() function and Daniel's dsprintf()
|
||||
* 1.0. A full blooded printf() clone with full support for <num>$
|
||||
@@ -198,7 +207,7 @@ struct asprintf {
|
||||
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)
|
||||
{
|
||||
@@ -946,11 +955,11 @@ static int dprintf_formatf(
|
||||
|
||||
if(width >= 0) {
|
||||
/* RECURSIVE USAGE */
|
||||
fptr += msprintf(fptr, "%d", width);
|
||||
fptr += curl_msprintf(fptr, "%d", width);
|
||||
}
|
||||
if(prec >= 0) {
|
||||
/* RECURSIVE USAGE */
|
||||
fptr += msprintf(fptr, ".%d", prec);
|
||||
fptr += curl_msprintf(fptr, ".%d", prec);
|
||||
}
|
||||
if (p->flags & FLAGS_LONG)
|
||||
strcat(fptr, "l");
|
||||
@@ -1001,33 +1010,6 @@ static int dprintf_formatf(
|
||||
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 */
|
||||
static int addbyter(int output, FILE *data)
|
||||
{
|
||||
@@ -1035,22 +1017,15 @@ static int addbyter(int output, FILE *data)
|
||||
|
||||
if(infop->length < infop->max) {
|
||||
/* only do this if we haven't reached max length yet */
|
||||
if (isprint(output) || isspace(output))
|
||||
{
|
||||
infop->buffer[0] = (char)output; /* store */
|
||||
infop->buffer++; /* increase pointer */
|
||||
infop->length++; /* we are now one byte larger */
|
||||
}
|
||||
else
|
||||
{
|
||||
return StoreNonPrintable(output, infop);
|
||||
}
|
||||
infop->buffer[0] = (char)output; /* store */
|
||||
infop->buffer++; /* increase pointer */
|
||||
infop->length++; /* we are now one byte larger */
|
||||
return output; /* fputc() returns like this on success */
|
||||
}
|
||||
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 */
|
||||
int retcode;
|
||||
@@ -1070,7 +1045,7 @@ int msnprintf(char *buffer, size_t maxlength, const char *format, ...)
|
||||
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;
|
||||
struct nsprintf info;
|
||||
@@ -1117,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 */
|
||||
int retcode;
|
||||
@@ -1138,7 +1113,7 @@ char *maprintf(const char *format, ...)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *mvaprintf(const char *format, va_list ap_save)
|
||||
char *curl_mvaprintf(const char *format, va_list ap_save)
|
||||
{
|
||||
int retcode;
|
||||
struct asprintf info;
|
||||
@@ -1165,7 +1140,7 @@ static int storebuffer(int output, FILE *data)
|
||||
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 */
|
||||
int retcode;
|
||||
@@ -1178,7 +1153,7 @@ int msprintf(char *buffer, const char *format, ...)
|
||||
|
||||
extern int fputc(int, FILE *);
|
||||
|
||||
int mprintf(const char *format, ...)
|
||||
int curl_mprintf(const char *format, ...)
|
||||
{
|
||||
int retcode;
|
||||
va_list ap_save; /* argument pointer */
|
||||
@@ -1188,7 +1163,7 @@ int mprintf(const char *format, ...)
|
||||
return retcode;
|
||||
}
|
||||
|
||||
int mfprintf(FILE *whereto, const char *format, ...)
|
||||
int curl_mfprintf(FILE *whereto, const char *format, ...)
|
||||
{
|
||||
int retcode;
|
||||
va_list ap_save; /* argument pointer */
|
||||
@@ -1198,7 +1173,7 @@ int mfprintf(FILE *whereto, const char *format, ...)
|
||||
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;
|
||||
retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save);
|
||||
@@ -1206,12 +1181,12 @@ int mvsprintf(char *buffer, const char *format, va_list ap_save)
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
59
lib/netrc.c
59
lib/netrc.c
@@ -5,50 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* 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$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -80,15 +51,15 @@ enum {
|
||||
#define LOGINSIZE 64
|
||||
#define PASSWORDSIZE 64
|
||||
|
||||
int ParseNetrc(char *host,
|
||||
char *login,
|
||||
char *password)
|
||||
int Curl_parsenetrc(char *host,
|
||||
char *login,
|
||||
char *password)
|
||||
{
|
||||
FILE *file;
|
||||
char netrcbuffer[256];
|
||||
int retcode=1;
|
||||
|
||||
char *home = GetEnv("HOME"); /* portable environment reader */
|
||||
char *home = curl_getenv("HOME"); /* portable environment reader */
|
||||
int state=NOTHING;
|
||||
|
||||
char state_login=0;
|
||||
|
73
lib/netrc.h
73
lib/netrc.h
@@ -7,67 +7,22 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* 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: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 *password);
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
int Curl_parsenetrc(char *host,
|
||||
char *login,
|
||||
char *password);
|
||||
#endif
|
||||
|
101
lib/progress.c
101
lib/progress.c
@@ -5,38 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -62,7 +45,7 @@
|
||||
|
||||
#include "progress.h"
|
||||
|
||||
void time2str(char *r, int t)
|
||||
static void time2str(char *r, int t)
|
||||
{
|
||||
int h = (t/3600);
|
||||
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,
|
||||
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_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)) {
|
||||
data->progress.lastshow=0;
|
||||
pgrsUpdate(data); /* the final (forced) update */
|
||||
fprintf(stderr, "\n");
|
||||
Curl_pgrsUpdate(data); /* the final (forced) update */
|
||||
fprintf(data->err, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
void pgrsTime(struct UrlData *data, timerid timer)
|
||||
void Curl_pgrsTime(struct UrlData *data, timerid timer)
|
||||
{
|
||||
switch(timer) {
|
||||
default:
|
||||
case TIMER_NONE:
|
||||
/* mistake filter */
|
||||
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:
|
||||
data->progress.t_nslookup = tvnow();
|
||||
data->progress.t_nslookup += Curl_tvdiff(Curl_tvnow(),
|
||||
data->progress.t_startsingle);
|
||||
break;
|
||||
case TIMER_CONNECT:
|
||||
data->progress.t_connect = tvnow();
|
||||
data->progress.t_connect += Curl_tvdiff(Curl_tvnow(),
|
||||
data->progress.t_startsingle);
|
||||
break;
|
||||
case TIMER_PRETRANSFER:
|
||||
data->progress.t_pretransfer = tvnow();
|
||||
data->progress.t_pretransfer += Curl_tvdiff(Curl_tvnow(),
|
||||
data->progress.t_startsingle);
|
||||
break;
|
||||
case TIMER_POSTRANSFER:
|
||||
/* 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;
|
||||
}
|
||||
|
||||
void pgrsSetUploadCounter(struct UrlData *data, double size)
|
||||
void Curl_pgrsSetUploadCounter(struct UrlData *data, double size)
|
||||
{
|
||||
data->progress.uploaded = size;
|
||||
}
|
||||
|
||||
void pgrsSetDownloadSize(struct UrlData *data, double size)
|
||||
void Curl_pgrsSetDownloadSize(struct UrlData *data, double size)
|
||||
{
|
||||
if(size > 0) {
|
||||
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) {
|
||||
data->progress.size_ul = size;
|
||||
@@ -178,7 +171,7 @@ void pgrsSetUploadSize(struct UrlData *data, double size)
|
||||
|
||||
*/
|
||||
|
||||
int pgrsUpdate(struct UrlData *data)
|
||||
int Curl_pgrsUpdate(struct UrlData *data)
|
||||
{
|
||||
struct timeval now;
|
||||
int result;
|
||||
@@ -217,16 +210,16 @@ int pgrsUpdate(struct UrlData *data)
|
||||
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
|
||||
reached */
|
||||
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 */
|
||||
data->progress.dlspeed = data->progress.downloaded/(data->progress.timespent!=0.0?data->progress.timespent:1.0);
|
||||
|
||||
@@ -264,17 +257,13 @@ int pgrsUpdate(struct UrlData *data)
|
||||
}
|
||||
|
||||
/* Figure out the estimated time of arrival for the upload */
|
||||
if(data->progress.flags & PGRS_UL_SIZE_KNOWN) {
|
||||
if(!data->progress.ulspeed)
|
||||
data->progress.ulspeed=1;
|
||||
if((data->progress.flags & PGRS_UL_SIZE_KNOWN) && data->progress.ulspeed){
|
||||
ulestimate = data->progress.size_ul / data->progress.ulspeed;
|
||||
ulpercen = (data->progress.uploaded / data->progress.size_ul)*100;
|
||||
}
|
||||
|
||||
/* ... and the download */
|
||||
if(data->progress.flags & PGRS_DL_SIZE_KNOWN) {
|
||||
if(!data->progress.dlspeed)
|
||||
data->progress.dlspeed=1;
|
||||
if((data->progress.flags & PGRS_DL_SIZE_KNOWN) && data->progress.dlspeed) {
|
||||
dlestimate = data->progress.size_dl / data->progress.dlspeed;
|
||||
dlpercen = (data->progress.downloaded / data->progress.size_dl)*100;
|
||||
}
|
||||
@@ -312,7 +301,7 @@ int pgrsUpdate(struct UrlData *data)
|
||||
if(total_expected_transfer)
|
||||
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",
|
||||
(int)total_percen, /* total % */
|
||||
max5data(total_expected_transfer, max5[2]), /* total size */
|
||||
|
@@ -7,38 +7,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "timeval.h"
|
||||
|
||||
@@ -49,17 +32,18 @@ typedef enum {
|
||||
TIMER_CONNECT,
|
||||
TIMER_PRETRANSFER,
|
||||
TIMER_POSTRANSFER,
|
||||
TIMER_STARTSINGLE,
|
||||
TIMER_LAST /* must be last */
|
||||
} timerid;
|
||||
|
||||
void pgrsDone(struct UrlData *data);
|
||||
void pgrsStartNow(struct UrlData *data);
|
||||
void pgrsSetDownloadSize(struct UrlData *data, double size);
|
||||
void pgrsSetUploadSize(struct UrlData *data, double size);
|
||||
void pgrsSetDownloadCounter(struct UrlData *data, double size);
|
||||
void pgrsSetUploadCounter(struct UrlData *data, double size);
|
||||
int pgrsUpdate(struct UrlData *data);
|
||||
void pgrsTime(struct UrlData *data, timerid timer);
|
||||
void Curl_pgrsDone(struct UrlData *data);
|
||||
void Curl_pgrsStartNow(struct UrlData *data);
|
||||
void Curl_pgrsSetDownloadSize(struct UrlData *data, double size);
|
||||
void Curl_pgrsSetUploadSize(struct UrlData *data, double size);
|
||||
void Curl_pgrsSetDownloadCounter(struct UrlData *data, double size);
|
||||
void Curl_pgrsSetUploadCounter(struct UrlData *data, double size);
|
||||
int Curl_pgrsUpdate(struct UrlData *data);
|
||||
void Curl_pgrsTime(struct UrlData *data, timerid timer);
|
||||
|
||||
|
||||
/* Don't show progress for sizes smaller than: */
|
||||
|
@@ -40,13 +40,22 @@
|
||||
|
||||
#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"
|
||||
@@ -64,6 +73,7 @@ static struct {
|
||||
{ prot_private, "private" }
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const char *
|
||||
level_to_name(enum protection_level level)
|
||||
{
|
||||
@@ -73,6 +83,7 @@ level_to_name(enum protection_level level)
|
||||
return level_names[i].name;
|
||||
return "unknown";
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef FTP_SERVER /* not used in server */
|
||||
static enum protection_level
|
||||
@@ -319,7 +330,7 @@ sec_vfprintf2(struct connectdata *conn, FILE *f, const char *fmt, va_list ap)
|
||||
if(conn->data_prot == prot_clear)
|
||||
return vfprintf(f, fmt, ap);
|
||||
else {
|
||||
buf = maprintf(fmt, ap);
|
||||
buf = aprintf(fmt, ap);
|
||||
ret = buffer_write(&conn->out_buffer, buf, strlen(buf));
|
||||
free(buf);
|
||||
return ret;
|
||||
@@ -360,7 +371,7 @@ sec_read_msg(struct connectdata *conn, char *s, int level)
|
||||
int code;
|
||||
|
||||
buf = malloc(strlen(s));
|
||||
len = base64_decode(s + 4, buf); /* XXX */
|
||||
len = Curl_base64_decode(s + 4, buf); /* XXX */
|
||||
|
||||
len = (*mech->decode)(conn->app_data, buf, len, level, conn);
|
||||
if(len < 0)
|
||||
@@ -390,7 +401,7 @@ sec_vfprintf(struct connectdata *conn, FILE *f, const char *fmt, va_list ap)
|
||||
if(!conn->sec_complete)
|
||||
return vfprintf(f, fmt, ap);
|
||||
|
||||
buf = maprintf(fmt, ap);
|
||||
buf = aprintf(fmt, ap);
|
||||
len = (*mech->encode)(conn->app_data, buf, strlen(buf),
|
||||
conn->command_prot, &enc,
|
||||
conn);
|
||||
@@ -399,7 +410,7 @@ sec_vfprintf(struct connectdata *conn, FILE *f, const char *fmt, va_list ap)
|
||||
failf(conn->data, "Failed to encode command.\n");
|
||||
return -1;
|
||||
}
|
||||
if(base64_encode(enc, len, &buf) < 0){
|
||||
if(Curl_base64_encode(enc, len, &buf) < 0){
|
||||
failf(conn->data, "Out of memory base64-encoding.\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -461,7 +472,6 @@ sec_status(void)
|
||||
static int
|
||||
sec_prot_internal(struct connectdata *conn, int level)
|
||||
{
|
||||
int ret;
|
||||
char *p;
|
||||
unsigned int s = 1048576;
|
||||
size_t nread;
|
||||
@@ -472,11 +482,11 @@ sec_prot_internal(struct connectdata *conn, int level)
|
||||
}
|
||||
|
||||
if(level){
|
||||
ftpsendf(conn->data->firstsocket, conn,
|
||||
"PBSZ %u", s);
|
||||
Curl_ftpsendf(conn->data->firstsocket, conn,
|
||||
"PBSZ %u", s);
|
||||
/* wait for feedback */
|
||||
nread = GetLastResponse(conn->data->firstsocket,
|
||||
conn->data->buffer, conn);
|
||||
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'){
|
||||
@@ -491,11 +501,11 @@ sec_prot_internal(struct connectdata *conn, int level)
|
||||
conn->buffer_size = s;
|
||||
}
|
||||
|
||||
ftpsendf(conn->data->firstsocket, conn,
|
||||
"PROT %c", level["CSEP"]);
|
||||
Curl_ftpsendf(conn->data->firstsocket, conn,
|
||||
"PROT %c", level["CSEP"]);
|
||||
/* wait for feedback */
|
||||
nread = GetLastResponse(conn->data->firstsocket,
|
||||
conn->data->buffer, conn);
|
||||
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'){
|
||||
@@ -600,11 +610,11 @@ sec_login(struct connectdata *conn)
|
||||
}
|
||||
infof(data, "Trying %s...\n", (*m)->name);
|
||||
/*ret = command("AUTH %s", (*m)->name);***/
|
||||
ftpsendf(conn->data->firstsocket, conn,
|
||||
Curl_ftpsendf(conn->data->firstsocket, conn,
|
||||
"AUTH %s", (*m)->name);
|
||||
/* wait for feedback */
|
||||
nread = GetLastResponse(conn->data->firstsocket,
|
||||
conn->data->buffer, conn);
|
||||
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'){
|
||||
|
334
lib/sendf.c
334
lib/sendf.c
@@ -5,38 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -60,8 +43,8 @@
|
||||
|
||||
#ifdef KRB4
|
||||
#include "security.h"
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
/* The last #include file should be: */
|
||||
#ifdef MALLOCDEBUG
|
||||
#include "memdebug.h"
|
||||
@@ -69,7 +52,7 @@
|
||||
|
||||
/* 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;
|
||||
if(data->bits.verbose) {
|
||||
@@ -83,7 +66,7 @@ void infof(struct UrlData *data, char *fmt, ...)
|
||||
/* failf() is for messages stating why we failed, the LAST one will be
|
||||
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_start(ap, fmt);
|
||||
@@ -94,177 +77,170 @@ void failf(struct UrlData *data, char *fmt, ...)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/* sendf() sends the formated data to the server */
|
||||
size_t sendf(int fd, struct UrlData *data, char *fmt, ...)
|
||||
/* Curl_sendf() sends formated data to the server */
|
||||
size_t Curl_sendf(int sockfd, struct connectdata *conn,
|
||||
char *fmt, ...)
|
||||
{
|
||||
struct UrlData *data = conn->data;
|
||||
size_t bytes_written;
|
||||
char *s;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
s = mvaprintf(fmt, ap);
|
||||
s = vaprintf(fmt, ap); /* returns an allocated string */
|
||||
va_end(ap);
|
||||
if(!s)
|
||||
return 0; /* failure */
|
||||
if(data->bits.verbose)
|
||||
fprintf(data->err, "> %s", s);
|
||||
|
||||
#ifndef USE_SSLEAY
|
||||
bytes_written = swrite(fd, s, strlen(s));
|
||||
#else /* USE_SSLEAY */
|
||||
if (data->use_ssl) {
|
||||
bytes_written = SSL_write(data->ssl, s, strlen(s));
|
||||
} else {
|
||||
bytes_written = swrite(fd, s, strlen(s));
|
||||
}
|
||||
#endif /* USE_SSLEAY */
|
||||
/* Write the buffer to the socket */
|
||||
Curl_write(conn, sockfd, s, strlen(s), &bytes_written);
|
||||
|
||||
free(s); /* free the output string */
|
||||
return(bytes_written);
|
||||
}
|
||||
|
||||
/*
|
||||
* ftpsendf() sends the formated string as a ftp command to a ftp server
|
||||
*/
|
||||
size_t ftpsendf(int fd, struct connectdata *conn, char *fmt, ...)
|
||||
{
|
||||
size_t bytes_written;
|
||||
char *s;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
s = mvaprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
if(!s)
|
||||
return 0; /* failure */
|
||||
if(conn->data->bits.verbose)
|
||||
fprintf(conn->data->err, "> %s\n", s);
|
||||
|
||||
#ifdef KRB4
|
||||
if(conn->sec_complete && conn->data->cmdchannel) {
|
||||
bytes_written = sec_fprintf(conn, conn->data->cmdchannel, s);
|
||||
bytes_written += fprintf(conn->data->cmdchannel, "\r\n");
|
||||
fflush(conn->data->cmdchannel);
|
||||
}
|
||||
else
|
||||
#endif /* KRB4 */
|
||||
{
|
||||
bytes_written = swrite(fd, s, strlen(s));
|
||||
bytes_written += swrite(fd, "\r\n", 2);
|
||||
}
|
||||
free(s); /* free the output string */
|
||||
return(bytes_written);
|
||||
}
|
||||
|
||||
|
||||
/* ssend() sends plain (binary) data to the server */
|
||||
size_t ssend(int fd, struct connectdata *conn, void *mem, size_t len)
|
||||
{
|
||||
size_t bytes_written;
|
||||
struct UrlData *data=conn->data; /* conn knows data, not vice versa */
|
||||
|
||||
#ifdef USE_SSLEAY
|
||||
if (data->use_ssl) {
|
||||
bytes_written = SSL_write(data->ssl, mem, len);
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
#ifdef KRB4
|
||||
if(conn->sec_complete) {
|
||||
bytes_written = sec_write(conn, fd, mem, len);
|
||||
}
|
||||
else
|
||||
#endif /* KRB4 */
|
||||
bytes_written = swrite(fd, mem, len);
|
||||
#ifdef USE_SSLEAY
|
||||
}
|
||||
#endif
|
||||
|
||||
return bytes_written;
|
||||
}
|
||||
|
||||
/*
|
||||
* add_buffer_init() returns a fine buffer struct
|
||||
* Curl_write() is an internal write function that sends plain (binary) data
|
||||
* to the server. Works with plain sockets, SSL or kerberos.
|
||||
*
|
||||
*/
|
||||
send_buffer *add_buffer_init(void)
|
||||
CURLcode Curl_write(struct connectdata *conn, int sockfd,
|
||||
void *mem, size_t len,
|
||||
size_t *written)
|
||||
{
|
||||
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 */
|
||||
}
|
||||
size_t bytes_written;
|
||||
struct UrlData *data=conn->data; /* conn knows data, not vice versa */
|
||||
|
||||
/*
|
||||
* add_buffer_send() sends a buffer and frees all associated memory.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
amount = ssend(sockfd, conn, in->buffer, in->size_used);
|
||||
|
||||
if(in->buffer)
|
||||
free(in->buffer);
|
||||
free(in);
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* add_bufferf() builds a buffer from the formatted input
|
||||
*/
|
||||
CURLcode add_bufferf(send_buffer *in, char *fmt, ...)
|
||||
{
|
||||
CURLcode result = CURLE_OUT_OF_MEMORY;
|
||||
char *s;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
s = mvaprintf(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
|
||||
*/
|
||||
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;
|
||||
#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;
|
||||
}
|
||||
memcpy(&in->buffer[in->size_used], inptr, size);
|
||||
|
||||
in->size_used += size;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
67
lib/sendf.h
67
lib/sendf.h
@@ -7,44 +7,28 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
size_t ftpsendf(int fd, struct connectdata *, char *fmt, ...);
|
||||
size_t sendf(int fd, struct UrlData *, char *fmt, ...);
|
||||
size_t ssend(int fd, struct connectdata *, void *fmt, size_t len);
|
||||
void infof(struct UrlData *, char *fmt, ...);
|
||||
void failf(struct UrlData *, char *fmt, ...);
|
||||
size_t Curl_sendf(int fd, struct connectdata *, char *fmt, ...);
|
||||
void Curl_infof(struct UrlData *, char *fmt, ...);
|
||||
void Curl_failf(struct UrlData *, char *fmt, ...);
|
||||
|
||||
#define infof Curl_infof
|
||||
#define failf Curl_failf
|
||||
|
||||
struct send_buffer {
|
||||
char *buffer;
|
||||
@@ -53,11 +37,20 @@ struct send_buffer {
|
||||
};
|
||||
typedef struct send_buffer send_buffer;
|
||||
|
||||
#define CLIENTWRITE_BODY 1
|
||||
#define CLIENTWRITE_HEADER 2
|
||||
#define CLIENTWRITE_BOTH (CLIENTWRITE_BODY|CLIENTWRITE_HEADER)
|
||||
|
||||
send_buffer *add_buffer_init(void);
|
||||
CURLcode add_buffer(send_buffer *in, void *inptr, size_t size);
|
||||
CURLcode add_bufferf(send_buffer *in, char *fmt, ...);
|
||||
size_t add_buffer_send(int sockfd, struct connectdata *conn, send_buffer *in);
|
||||
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
|
||||
|
53
lib/setup.h
53
lib/setup.h
@@ -7,38 +7,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -117,7 +100,6 @@ defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
|
||||
1. close a socket
|
||||
2. read from a socket
|
||||
3. write to a socket
|
||||
(Hopefully, only win32-crap do this weird name changing)
|
||||
|
||||
4. set the SIGALRM signal timeout
|
||||
5. set dir/file naming defines
|
||||
@@ -132,8 +114,8 @@ defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
|
||||
#else
|
||||
/* gcc-for-win is still good :) */
|
||||
#define sclose(x) close(x)
|
||||
#define sread(x,y,z) read(x,y,z)
|
||||
#define swrite(x,y,z) write(x,y,z)
|
||||
#define sread(x,y,z) recv(x,y,z,0)
|
||||
#define swrite(x,y,z) send(x,y,z,0)
|
||||
#define myalarm(x) alarm(x)
|
||||
#endif
|
||||
|
||||
@@ -162,13 +144,4 @@ int fileno( FILE *stream);
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FIXME: code for getting a passwd in windows/non termcap/signal systems?
|
||||
*/
|
||||
#ifndef WIN32
|
||||
#define get_password(x) getpass(x)
|
||||
#else
|
||||
#define get_password(x)
|
||||
#endif
|
||||
|
||||
#endif /* __CONFIG_H */
|
||||
|
@@ -5,38 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -50,21 +33,24 @@
|
||||
#include "sendf.h"
|
||||
#include "speedcheck.h"
|
||||
|
||||
CURLcode speedcheck(struct UrlData *data,
|
||||
struct timeval now)
|
||||
void Curl_speedinit(struct UrlData *data)
|
||||
{
|
||||
static struct timeval keeps_speed;
|
||||
memset(&data->keeps_speed, 0, sizeof(struct timeval));
|
||||
}
|
||||
|
||||
if((data->current_speed >= 0) &&
|
||||
CURLcode Curl_speedcheck(struct UrlData *data,
|
||||
struct timeval now)
|
||||
{
|
||||
if((data->progress.current_speed >= 0) &&
|
||||
data->low_speed_time &&
|
||||
(tvlong(keeps_speed) != 0) &&
|
||||
(data->current_speed < data->low_speed_limit)) {
|
||||
(Curl_tvlong(data->keeps_speed) != 0) &&
|
||||
(data->progress.current_speed < data->low_speed_limit)) {
|
||||
|
||||
/* We are now below the "low speed limit". If we are below it
|
||||
for "low speed time" seconds we consider that enough reason
|
||||
to abort the download. */
|
||||
|
||||
if( tvdiff(now, keeps_speed) > data->low_speed_time) {
|
||||
if( Curl_tvdiff(now, data->keeps_speed) > data->low_speed_time) {
|
||||
/* we have been this slow for long enough, now die */
|
||||
failf(data,
|
||||
"Operation too slow. "
|
||||
@@ -76,7 +62,7 @@ CURLcode speedcheck(struct UrlData *data,
|
||||
}
|
||||
else {
|
||||
/* we keep up the required speed all right */
|
||||
keeps_speed = now;
|
||||
data->keeps_speed = now;
|
||||
}
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
@@ -7,44 +7,28 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#include "timeval.h"
|
||||
|
||||
CURLcode speedcheck(struct UrlData *data,
|
||||
struct timeval now);
|
||||
void Curl_speedinit(struct UrlData *data);
|
||||
CURLcode Curl_speedcheck(struct UrlData *data,
|
||||
struct timeval now);
|
||||
|
||||
#endif
|
||||
|
130
lib/ssluse.c
130
lib/ssluse.c
@@ -5,38 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* The original SSL code was written by
|
||||
@@ -79,9 +62,10 @@ static int passwd_callback(char *buf, int num, int verify
|
||||
* from) source from the SSLeay package written by Eric Young
|
||||
* (eay@cryptsoft.com). */
|
||||
|
||||
int SSL_cert_stuff(struct UrlData *data,
|
||||
char *cert_file,
|
||||
char *key_file)
|
||||
static
|
||||
int cert_stuff(struct UrlData *data,
|
||||
char *cert_file,
|
||||
char *key_file)
|
||||
{
|
||||
if (cert_file != NULL) {
|
||||
SSL *ssl;
|
||||
@@ -94,10 +78,10 @@ int SSL_cert_stuff(struct UrlData *data,
|
||||
*/
|
||||
strcpy(global_passwd, data->cert_passwd);
|
||||
/* Set passwd callback: */
|
||||
SSL_CTX_set_default_passwd_cb(data->ctx, passwd_callback);
|
||||
SSL_CTX_set_default_passwd_cb(data->ssl.ctx, passwd_callback);
|
||||
}
|
||||
|
||||
if (SSL_CTX_use_certificate_file(data->ctx,
|
||||
if (SSL_CTX_use_certificate_file(data->ssl.ctx,
|
||||
cert_file,
|
||||
SSL_FILETYPE_PEM) <= 0) {
|
||||
failf(data, "unable to set certificate file (wrong password?)\n");
|
||||
@@ -106,14 +90,14 @@ int SSL_cert_stuff(struct UrlData *data,
|
||||
if (key_file == NULL)
|
||||
key_file=cert_file;
|
||||
|
||||
if (SSL_CTX_use_PrivateKey_file(data->ctx,
|
||||
if (SSL_CTX_use_PrivateKey_file(data->ssl.ctx,
|
||||
key_file,
|
||||
SSL_FILETYPE_PEM) <= 0) {
|
||||
failf(data, "unable to set public key file\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
ssl=SSL_new(data->ctx);
|
||||
ssl=SSL_new(data->ssl.ctx);
|
||||
x509=SSL_get_certificate(ssl);
|
||||
|
||||
if (x509 != NULL)
|
||||
@@ -127,7 +111,7 @@ int SSL_cert_stuff(struct UrlData *data,
|
||||
|
||||
/* Now we know that a key and cert have been set against
|
||||
* the SSL context */
|
||||
if (!SSL_CTX_check_private_key(data->ctx)) {
|
||||
if (!SSL_CTX_check_private_key(data->ssl.ctx)) {
|
||||
failf(data, "Private key does not match the certificate public key\n");
|
||||
return(0);
|
||||
}
|
||||
@@ -140,7 +124,8 @@ int SSL_cert_stuff(struct UrlData *data,
|
||||
|
||||
#endif
|
||||
|
||||
#if SSL_VERIFY_CERT
|
||||
#ifdef USE_SSLEAY
|
||||
static
|
||||
int cert_verify_callback(int ok, X509_STORE_CTX *ctx)
|
||||
{
|
||||
X509 *err_cert;
|
||||
@@ -156,7 +141,7 @@ int cert_verify_callback(int ok, X509_STORE_CTX *ctx)
|
||||
|
||||
/* ====================================================== */
|
||||
int
|
||||
UrgSSLConnect (struct UrlData *data)
|
||||
Curl_SSLConnect (struct UrlData *data)
|
||||
{
|
||||
#ifdef USE_SSLEAY
|
||||
int err;
|
||||
@@ -164,7 +149,7 @@ UrgSSLConnect (struct UrlData *data)
|
||||
SSL_METHOD *req_method;
|
||||
|
||||
/* mark this is being ssl enabled from here on out. */
|
||||
data->use_ssl = 1;
|
||||
data->ssl.use = TRUE;
|
||||
|
||||
/* Lets get nice error messages */
|
||||
SSL_load_error_strings();
|
||||
@@ -180,7 +165,7 @@ UrgSSLConnect (struct UrlData *data)
|
||||
RAND_screen();
|
||||
#else
|
||||
int len;
|
||||
char *area = MakeFormBoundary();
|
||||
char *area = Curl_FormBoundary();
|
||||
if(!area)
|
||||
return 3; /* out of memory */
|
||||
|
||||
@@ -195,7 +180,7 @@ UrgSSLConnect (struct UrlData *data)
|
||||
/* Setup all the global SSL stuff */
|
||||
SSLeay_add_ssl_algorithms();
|
||||
|
||||
switch(data->ssl_version) {
|
||||
switch(data->ssl.version) {
|
||||
default:
|
||||
req_method = SSLv23_client_method();
|
||||
break;
|
||||
@@ -207,36 +192,45 @@ UrgSSLConnect (struct UrlData *data)
|
||||
break;
|
||||
}
|
||||
|
||||
data->ctx = SSL_CTX_new(req_method);
|
||||
data->ssl.ctx = SSL_CTX_new(req_method);
|
||||
|
||||
if(!data->ctx) {
|
||||
if(!data->ssl.ctx) {
|
||||
failf(data, "SSL: couldn't create a context!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(data->cert) {
|
||||
if (!SSL_cert_stuff(data, data->cert, data->cert)) {
|
||||
if (!cert_stuff(data, data->cert, data->cert)) {
|
||||
failf(data, "couldn't use certificate!\n");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
#if SSL_VERIFY_CERT
|
||||
SSL_CTX_set_verify(data->ctx,
|
||||
SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT|
|
||||
SSL_VERIFY_CLIENT_ONCE,
|
||||
cert_verify_callback);
|
||||
#endif
|
||||
if(data->ssl.verifypeer){
|
||||
SSL_CTX_set_verify(data->ssl.ctx,
|
||||
SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT|
|
||||
SSL_VERIFY_CLIENT_ONCE,
|
||||
cert_verify_callback);
|
||||
if (!SSL_CTX_load_verify_locations(data->ssl.ctx,
|
||||
data->ssl.CAfile,
|
||||
data->ssl.CApath)) {
|
||||
failf(data,"error setting cerficate verify locations\n");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
SSL_CTX_set_verify(data->ssl.ctx, SSL_VERIFY_NONE, cert_verify_callback);
|
||||
|
||||
|
||||
/* Lets make an SSL structure */
|
||||
data->ssl = SSL_new (data->ctx);
|
||||
SSL_set_connect_state (data->ssl);
|
||||
data->ssl.handle = SSL_new (data->ssl.ctx);
|
||||
SSL_set_connect_state (data->ssl.handle);
|
||||
|
||||
data->server_cert = 0x0;
|
||||
data->ssl.server_cert = 0x0;
|
||||
|
||||
/* pass the raw socket into the SSL layers */
|
||||
SSL_set_fd (data->ssl, data->firstsocket);
|
||||
err = SSL_connect (data->ssl);
|
||||
SSL_set_fd (data->ssl.handle, data->firstsocket);
|
||||
err = SSL_connect (data->ssl.handle);
|
||||
|
||||
if (-1 == err) {
|
||||
err = ERR_get_error();
|
||||
@@ -244,8 +238,9 @@ UrgSSLConnect (struct UrlData *data)
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
||||
infof (data, "SSL connection using %s\n", SSL_get_cipher (data->ssl));
|
||||
/* Informational message */
|
||||
infof (data, "SSL connection using %s\n",
|
||||
SSL_get_cipher(data->ssl.handle));
|
||||
|
||||
/* Get server's certificate (note: beware of dynamic allocation) - opt */
|
||||
/* major serious hack alert -- we should check certificates
|
||||
@@ -253,14 +248,15 @@ UrgSSLConnect (struct UrlData *data)
|
||||
* attack
|
||||
*/
|
||||
|
||||
data->server_cert = SSL_get_peer_certificate (data->ssl);
|
||||
if(!data->server_cert) {
|
||||
data->ssl.server_cert = SSL_get_peer_certificate (data->ssl.handle);
|
||||
if(!data->ssl.server_cert) {
|
||||
failf(data, "SSL: couldn't get peer certificate!");
|
||||
return 3;
|
||||
}
|
||||
infof (data, "Server certificate:\n");
|
||||
|
||||
str = X509_NAME_oneline (X509_get_subject_name (data->server_cert), NULL, 0);
|
||||
str = X509_NAME_oneline (X509_get_subject_name (data->ssl.server_cert),
|
||||
NULL, 0);
|
||||
if(!str) {
|
||||
failf(data, "SSL: couldn't get X509-subject!");
|
||||
return 4;
|
||||
@@ -268,7 +264,8 @@ UrgSSLConnect (struct UrlData *data)
|
||||
infof(data, "\t subject: %s\n", str);
|
||||
CRYPTO_free(str);
|
||||
|
||||
str = X509_NAME_oneline (X509_get_issuer_name (data->server_cert), NULL, 0);
|
||||
str = X509_NAME_oneline (X509_get_issuer_name (data->ssl.server_cert),
|
||||
NULL, 0);
|
||||
if(!str) {
|
||||
failf(data, "SSL: couldn't get X509-issuer name!");
|
||||
return 5;
|
||||
@@ -279,11 +276,14 @@ UrgSSLConnect (struct UrlData *data)
|
||||
/* We could do all sorts of certificate verification stuff here before
|
||||
deallocating the certificate. */
|
||||
|
||||
#if SSL_VERIFY_CERT
|
||||
infof(data, "Verify result: %d\n", SSL_get_verify_result(data->ssl));
|
||||
#endif
|
||||
if(data->ssl.verifypeer) {
|
||||
data->ssl.certverifyresult=SSL_get_verify_result(data->ssl.handle);
|
||||
infof(data, "Verify result: %d\n", data->ssl.certverifyresult);
|
||||
}
|
||||
else
|
||||
data->ssl.certverifyresult=0;
|
||||
|
||||
X509_free(data->server_cert);
|
||||
X509_free(data->ssl.server_cert);
|
||||
#else /* USE_SSLEAY */
|
||||
/* this is for "-ansi -Wall -pedantic" to stop complaining! (rabe) */
|
||||
(void) data;
|
||||
|
44
lib/ssluse.h
44
lib/ssluse.h
@@ -7,40 +7,20 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
int SSL_cert_stuff(struct UrlData *data,
|
||||
char *cert_file,
|
||||
char *key_file);
|
||||
int UrgSSLConnect (struct UrlData *data);
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
int Curl_SSLConnect (struct UrlData *data);
|
||||
#endif
|
||||
|
@@ -5,44 +5,27 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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) 2000.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
int strequal(const char *first, const char *second)
|
||||
int Curl_strequal(const char *first, const char *second)
|
||||
{
|
||||
#if defined(HAVE_STRCASECMP)
|
||||
return !strcasecmp(first, second);
|
||||
@@ -62,7 +45,7 @@ int strequal(const char *first, const char *second)
|
||||
#endif
|
||||
}
|
||||
|
||||
int strnequal(const char *first, const char *second, size_t max)
|
||||
int Curl_strnequal(const char *first, const char *second, size_t max)
|
||||
{
|
||||
#if defined(HAVE_STRCASECMP)
|
||||
return !strncasecmp(first, second, max);
|
||||
|
@@ -7,39 +7,25 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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) 2000.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
int strequal(const char *first, const char *second);
|
||||
int strnequal(const char *first, const char *second, size_t max);
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
int Curl_strequal(const char *first, const char *second);
|
||||
int Curl_strnequal(const char *first, const char *second, size_t max);
|
||||
|
||||
#define strequal(a,b) Curl_strequal(a,b)
|
||||
#define strnequal(a,b,c) Curl_strnequal(a,b,c)
|
||||
|
||||
#endif
|
||||
|
190
lib/telnet.c
190
lib/telnet.c
@@ -5,46 +5,21 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* 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/
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* 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.
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
*
|
||||
* This implementation of the TELNET protocol is written by
|
||||
* Linus Nielsen <Linus.Nielsen@haxx.se>,
|
||||
* with some code snippets stolen from the BSD Telnet client.
|
||||
*
|
||||
* The negotiation is performed according to RFC 1143 (D. Bernstein,
|
||||
* "The Q Method of Implementing TELNET Option Negotiation")
|
||||
*
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -96,17 +71,14 @@
|
||||
|
||||
#include "urldata.h"
|
||||
#include <curl/curl.h>
|
||||
#include "download.h"
|
||||
#include "transfer.h"
|
||||
#include "sendf.h"
|
||||
#include "formdata.h"
|
||||
#include "progress.h"
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
|
||||
#define TELOPTS
|
||||
#define TELCMDS
|
||||
#define SLC_NAMES
|
||||
|
||||
#include "arpa_telnet.h"
|
||||
|
||||
@@ -123,10 +95,7 @@
|
||||
#define SB_EOF() (subpointer >= subend)
|
||||
#define SB_LEN() (subend - subpointer)
|
||||
|
||||
void telwrite(struct UrlData *data,
|
||||
unsigned char *buffer, /* Data to write */
|
||||
int count); /* Number of bytes to write */
|
||||
|
||||
static
|
||||
void telrcv(struct UrlData *data,
|
||||
unsigned char *inbuf, /* Data received from socket */
|
||||
int count); /* Number of bytes received */
|
||||
@@ -180,6 +149,7 @@ static int him[256];
|
||||
static int himq[256];
|
||||
static int him_preferred[256];
|
||||
|
||||
static
|
||||
void init_telnet(struct UrlData *data)
|
||||
{
|
||||
telrcv_state = TS_DATA;
|
||||
@@ -271,6 +241,7 @@ static void send_negotiation(struct UrlData *data, int cmd, int option)
|
||||
printoption(data, "SENT", cmd, option);
|
||||
}
|
||||
|
||||
static
|
||||
void set_remote_option(struct UrlData *data, int option, int newstate)
|
||||
{
|
||||
if(newstate == YES)
|
||||
@@ -351,6 +322,7 @@ void set_remote_option(struct UrlData *data, int option, int newstate)
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void rec_will(struct UrlData *data, int option)
|
||||
{
|
||||
switch(him[option])
|
||||
@@ -402,6 +374,7 @@ void rec_will(struct UrlData *data, int option)
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void rec_wont(struct UrlData *data, int option)
|
||||
{
|
||||
switch(him[option])
|
||||
@@ -525,6 +498,7 @@ void set_local_option(struct UrlData *data, int option, int newstate)
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void rec_do(struct UrlData *data, int option)
|
||||
{
|
||||
switch(us[option])
|
||||
@@ -575,7 +549,8 @@ void rec_do(struct UrlData *data, int option)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void rec_dont(struct UrlData *data, int option)
|
||||
{
|
||||
switch(us[option])
|
||||
@@ -694,6 +669,7 @@ static void suboption(struct UrlData *data)
|
||||
return;
|
||||
}
|
||||
|
||||
static
|
||||
void telrcv(struct UrlData *data,
|
||||
unsigned char *inbuf, /* Data received from socket */
|
||||
int count) /* Number of bytes received */
|
||||
@@ -713,8 +689,8 @@ void telrcv(struct UrlData *data,
|
||||
{
|
||||
break; /* Ignore \0 after CR */
|
||||
}
|
||||
|
||||
data->fwrite((char *)&c, 1, 1, data->out);
|
||||
|
||||
Curl_client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
|
||||
continue;
|
||||
|
||||
case TS_DATA:
|
||||
@@ -728,7 +704,7 @@ void telrcv(struct UrlData *data,
|
||||
telrcv_state = TS_CR;
|
||||
}
|
||||
|
||||
data->fwrite((char *)&c, 1, 1, data->out);
|
||||
Curl_client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
|
||||
continue;
|
||||
|
||||
case TS_IAC:
|
||||
@@ -752,8 +728,8 @@ void telrcv(struct UrlData *data,
|
||||
telrcv_state = TS_SB;
|
||||
continue;
|
||||
case IAC:
|
||||
data->fwrite((char *)&c, 1, 1, data->out);
|
||||
break;
|
||||
Curl_client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
|
||||
break;
|
||||
case DM:
|
||||
case NOP:
|
||||
case GA:
|
||||
@@ -843,40 +819,12 @@ void telrcv(struct UrlData *data,
|
||||
}
|
||||
}
|
||||
|
||||
void telwrite(struct UrlData *data,
|
||||
unsigned char *buffer, /* Data to write */
|
||||
int count) /* Number of bytes to write */
|
||||
{
|
||||
unsigned char outbuf[2];
|
||||
int out_count = 0;
|
||||
int bytes_written;
|
||||
|
||||
while(count--)
|
||||
{
|
||||
outbuf[0] = *buffer++;
|
||||
out_count = 1;
|
||||
if(outbuf[0] == IAC)
|
||||
outbuf[out_count++] = IAC;
|
||||
|
||||
#ifndef USE_SSLEAY
|
||||
bytes_written = swrite(data->firstsocket, outbuf, out_count);
|
||||
#else
|
||||
if (data->use_ssl) {
|
||||
bytes_written = SSL_write(data->ssl, (char *)outbuf, out_count);
|
||||
}
|
||||
else {
|
||||
bytes_written = swrite(data->firstsocket, outbuf, out_count);
|
||||
}
|
||||
#endif /* USE_SSLEAY */
|
||||
}
|
||||
}
|
||||
|
||||
CURLcode telnet_done(struct connectdata *conn)
|
||||
CURLcode Curl_telnet_done(struct connectdata *conn)
|
||||
{
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
CURLcode telnet(struct connectdata *conn)
|
||||
CURLcode Curl_telnet(struct connectdata *conn)
|
||||
{
|
||||
struct UrlData *data = conn->data;
|
||||
int sockfd = data->firstsocket;
|
||||
@@ -885,7 +833,7 @@ CURLcode telnet(struct connectdata *conn)
|
||||
|
||||
bool keepon = TRUE;
|
||||
char *buf = data->buffer;
|
||||
int nread;
|
||||
size_t nread;
|
||||
|
||||
init_telnet(data);
|
||||
|
||||
@@ -895,49 +843,49 @@ CURLcode telnet(struct connectdata *conn)
|
||||
|
||||
keepfd = readfd;
|
||||
|
||||
while (keepon)
|
||||
{
|
||||
readfd = keepfd; /* set this every lap in the loop */
|
||||
while (keepon) {
|
||||
readfd = keepfd; /* set this every lap in the loop */
|
||||
|
||||
switch (select (sockfd + 1, &readfd, NULL, NULL, NULL))
|
||||
{
|
||||
case -1: /* error, stop reading */
|
||||
keepon = FALSE;
|
||||
continue;
|
||||
case 0: /* timeout */
|
||||
break;
|
||||
default: /* read! */
|
||||
if(FD_ISSET(1, &readfd))
|
||||
{
|
||||
nread = read(1, buf, 255);
|
||||
telwrite(data, (unsigned char *)buf, nread);
|
||||
}
|
||||
switch (select (sockfd + 1, &readfd, NULL, NULL, NULL)) {
|
||||
case -1: /* error, stop reading */
|
||||
keepon = FALSE;
|
||||
continue;
|
||||
case 0: /* timeout */
|
||||
break;
|
||||
default: /* read! */
|
||||
if(FD_ISSET(1, &readfd)) { /* read from stdin */
|
||||
unsigned char outbuf[2];
|
||||
int out_count = 0;
|
||||
size_t bytes_written;
|
||||
char *buffer = buf;
|
||||
|
||||
nread = read(1, buf, 255);
|
||||
|
||||
if(FD_ISSET(sockfd, &readfd))
|
||||
{
|
||||
#ifndef USE_SSLEAY
|
||||
nread = sread (sockfd, buf, BUFSIZE - 1);
|
||||
#else
|
||||
if (data->use_ssl) {
|
||||
nread = SSL_read (data->ssl, buf, BUFSIZE - 1);
|
||||
}
|
||||
else {
|
||||
nread = sread (sockfd, buf, BUFSIZE - 1);
|
||||
}
|
||||
#endif /* USE_SSLEAY */
|
||||
}
|
||||
|
||||
/* if we receive 0 or less here, the server closed the connection and
|
||||
we bail out from this! */
|
||||
if (nread <= 0) {
|
||||
keepon = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
telrcv(data, (unsigned char *)buf, nread);
|
||||
while(nread--) {
|
||||
outbuf[0] = *buffer++;
|
||||
out_count = 1;
|
||||
if(outbuf[0] == IAC)
|
||||
outbuf[out_count++] = IAC;
|
||||
|
||||
Curl_write(conn, data->firstsocket, outbuf,
|
||||
out_count, &bytes_written);
|
||||
}
|
||||
}
|
||||
}
|
||||
return CURLE_OK;
|
||||
|
||||
if(FD_ISSET(sockfd, &readfd))
|
||||
Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread);
|
||||
|
||||
/* if we receive 0 or less here, the server closed the connection and
|
||||
we bail out from this! */
|
||||
if (nread <= 0) {
|
||||
keepon = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
telrcv(data, (unsigned char *)buf, nread);
|
||||
}
|
||||
}
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user