Compare commits
269 Commits
curl-7_4_1
...
curl-7_5_2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
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 |
20
CVS-INFO
Normal file
20
CVS-INFO
Normal file
@@ -0,0 +1,20 @@
|
||||
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
|
||||
% autoconf
|
||||
% ./configure
|
||||
% make
|
26
FILES
26
FILES
@@ -1,19 +1,18 @@
|
||||
CHANGES
|
||||
FILES
|
||||
LEGAL
|
||||
MPL-1.0.txt
|
||||
MPL-1.1.txt
|
||||
MITX.txt
|
||||
README
|
||||
*spec
|
||||
*spec.in
|
||||
docs/BUGS
|
||||
docs/CONTRIBUTE
|
||||
docs/FAQ
|
||||
docs/FEATURES
|
||||
docs/INSTALL
|
||||
docs/INTERNALS
|
||||
docs/README.curl
|
||||
docs/MANUAL
|
||||
docs/README.win32
|
||||
docs/README.libcurl
|
||||
docs/LIBCURL
|
||||
docs/RESOURCES
|
||||
docs/TODO
|
||||
docs/curl.1
|
||||
@@ -55,6 +54,7 @@ src/*.in
|
||||
src/*.am
|
||||
src/mkhelp.pl
|
||||
src/Makefile.vc6
|
||||
src/Makefile.b32
|
||||
src/*m32
|
||||
lib/getdate.y
|
||||
lib/*.[ch]
|
||||
@@ -62,6 +62,8 @@ lib/*in
|
||||
lib/*am
|
||||
lib/Makefile.vc6
|
||||
lib/*m32
|
||||
lib/Makefile.b32
|
||||
lib/Makefile.b32.resp
|
||||
lib/libcurl.def
|
||||
include/README
|
||||
include/Makefile.in
|
||||
@@ -69,4 +71,16 @@ include/Makefile.am
|
||||
include/curl/*.h
|
||||
include/curl/Makefile.in
|
||||
include/curl/Makefile.am
|
||||
|
||||
packages/Linux/RPM/curl-ssl.spec
|
||||
packages/Linux/RPM/curl.spec
|
||||
packages/Linux/RPM/make_curl_rpm
|
||||
packages/Linux/RPM/README
|
||||
packages/Win32/README
|
||||
packages/README
|
||||
tests/Makefile.am
|
||||
tests/Makefile.in
|
||||
tests/runtests.pl
|
||||
tests/README
|
||||
tests/httpserver.pl
|
||||
tests/ftpserver.pl
|
||||
tests/data/*.txt
|
||||
|
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.]
|
||||
|
@@ -6,5 +6,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||
|
||||
EXTRA_DIST = curl.spec curl-ssl.spec
|
||||
|
||||
SUBDIRS = docs lib src include
|
||||
SUBDIRS = docs lib src include tests
|
||||
|
||||
test:
|
||||
@(cd tests; make quiet-test)
|
||||
|
@@ -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.
|
||||
|
10
config.h.in
10
config.h.in
@@ -79,8 +79,8 @@
|
||||
/* 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 getpass_r function. */
|
||||
#undef HAVE_GETPASS_R
|
||||
|
||||
/* Define if you have the getservbyname function. */
|
||||
#undef HAVE_GETSERVBYNAME
|
||||
@@ -112,6 +112,12 @@
|
||||
/* Define if you have the setvbuf function. */
|
||||
#undef HAVE_SETVBUF
|
||||
|
||||
/* Define if you have the sigaction function. */
|
||||
#undef HAVE_SIGACTION
|
||||
|
||||
/* Define if you have the signal function. */
|
||||
#undef HAVE_SIGNAL
|
||||
|
||||
/* Define if you have the socket function. */
|
||||
#undef HAVE_SOCKET
|
||||
|
||||
|
452
configure.in
452
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,230 @@ 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 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 +397,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 +411,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 +490,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,11 +580,15 @@ 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 socket() function)
|
||||
fi
|
||||
@@ -549,13 +608,12 @@ dnl $PATH:/usr/bin/:/usr/local/bin )
|
||||
dnl AC_SUBST(RANLIB)
|
||||
|
||||
AC_OUTPUT( Makefile \
|
||||
curl.spec \
|
||||
curl-ssl.spec \
|
||||
docs/Makefile \
|
||||
include/Makefile \
|
||||
include/curl/Makefile \
|
||||
src/Makefile \
|
||||
lib/Makefile )
|
||||
lib/Makefile \
|
||||
tests/Makefile)
|
||||
dnl perl/checklinks.pl \
|
||||
dnl perl/getlinks.pl \
|
||||
dnl perl/formfind.pl \
|
||||
|
@@ -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 FPL 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!
|
||||
|
204
docs/FAQ
204
docs/FAQ
@@ -1,4 +1,4 @@
|
||||
Updated: August 22, 2000 (http://curl.haxx.se/docs/faq.shtml)
|
||||
Updated: January 4, 2001 (http://curl.haxx.se/docs/faq.shtml)
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
@@ -43,9 +43,15 @@ 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.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?
|
||||
|
||||
6. License Issues
|
||||
6.1 I have a GPL program, can I use the libcurl library?
|
||||
@@ -63,11 +69,14 @@ 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.
|
||||
|
||||
Please 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
|
||||
@@ -76,7 +85,7 @@ FAQ
|
||||
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. Just make sure changes to the lib itself are made public.
|
||||
|
||||
1.3 What is cURL not?
|
||||
|
||||
@@ -97,7 +106,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 +126,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 +144,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 +166,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 +203,6 @@ FAQ
|
||||
brings this functionality.
|
||||
|
||||
|
||||
|
||||
3. Usage problems
|
||||
|
||||
3.1. curl: (1) SSL is disabled, https: not supported
|
||||
@@ -216,7 +224,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?
|
||||
|
||||
@@ -325,26 +333,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 +361,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 +379,143 @@ 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 or mail a detailed bug description
|
||||
to curl-bug@haxx.se.
|
||||
|
||||
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?
|
||||
|
||||
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.
|
||||
We have attempted to write the entire code adjusted for multi-threaded
|
||||
programs. If your system has such, curl will attempt to use threadsafe
|
||||
functions instead of non-safe ones.
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
|
88
docs/INSTALL
88
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,9 +70,17 @@ 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
|
||||
|
||||
@@ -259,6 +236,39 @@ 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.*
|
||||
- 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
|
||||
|
||||
OpenSSL
|
||||
=======
|
||||
|
||||
|
@@ -12,6 +12,17 @@ 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
|
||||
===============
|
||||
|
||||
@@ -47,9 +58,9 @@ 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,11 +68,14 @@ Library
|
||||
rather small and easy-to-follow. All the ones prefixed with 'curl_easy' are
|
||||
put in the lib/easy.c file.
|
||||
|
||||
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
|
||||
@@ -131,11 +145,12 @@ Library
|
||||
|
||||
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.
|
||||
|
||||
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().
|
||||
|
||||
A function named curl_version() that returns the full curl version string is
|
||||
found in lib/version.c.
|
||||
@@ -143,10 +158,10 @@ Library
|
||||
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 multiple-URL support.
|
||||
|
||||
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
|
||||
@@ -158,4 +173,16 @@ Client
|
||||
curl_easy_getinfo() function to extract useful information from the curl
|
||||
session.
|
||||
|
||||
Test Suite
|
||||
==========
|
||||
|
||||
During 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.
|
||||
|
@@ -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
|
||||
|
@@ -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,8 @@ Similar Tools
|
||||
|
||||
swebget - http://www.uni-hildesheim.de/~smol0075/swebget/
|
||||
|
||||
Kermit - http://www.columbia.edu/kermit/ftpclient
|
||||
|
||||
Related Software
|
||||
----------------
|
||||
ftpparse - http://cr.yp.to/ftpparse.html parses FTP LIST responses
|
||||
|
38
docs/TODO
38
docs/TODO
@@ -13,10 +13,31 @@ For the future
|
||||
product! (Yes, you may add things not mentioned here, these are just a
|
||||
few teasers...)
|
||||
|
||||
* Make SSL session ids get used if multiple HTTPS documents from the same
|
||||
host is requested.
|
||||
|
||||
* 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 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.
|
||||
|
||||
* Make curl with multiple URLs, even outside of {}-letters. I could also
|
||||
imagine an optional fork()ed system that downloads each URL in its own
|
||||
thread. It should of course have a maximum amount of simultaneous fork()s.
|
||||
|
||||
* 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. This requires some fiddling on FTP but comes
|
||||
almost free for HTTP.
|
||||
|
||||
* Make the SSL layer option capable of using the Mozilla Security Services as
|
||||
an alternative to OpenSSL:
|
||||
http://www.mozilla.org/projects/security/pki/nss/
|
||||
@@ -24,19 +45,18 @@ 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.
|
||||
|
||||
* 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 +71,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 +105,3 @@ For the future
|
||||
|
||||
* HTTP POST resume using Range:
|
||||
|
||||
* Make curl capable of verifying the server's certificate when connecting
|
||||
with HTTPS://.
|
||||
|
146
docs/curl.1
146
docs/curl.1
@@ -2,7 +2,7 @@
|
||||
.\" nroff -man curl.1
|
||||
.\" Written by Daniel Stenberg
|
||||
.\"
|
||||
.TH curl 1 "26 September 2000" "Curl 7.3" "Curl Manual"
|
||||
.TH curl 1 "4 January 2001" "Curl 7.5.2" "Curl Manual"
|
||||
.SH NAME
|
||||
curl \- get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE, HTTP or
|
||||
HTTPS syntax.
|
||||
@@ -43,12 +43,17 @@ supported at the moment:
|
||||
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 +72,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 +98,40 @@ 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 last one will be used.
|
||||
.IP "--data-ascii <data>"
|
||||
(HTTP) This is an alias for the -d/--data option.
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.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.
|
||||
.IP "-D/--dump-header <file>"
|
||||
(HTTP/FTP)
|
||||
Write the HTTP headers to this file. Write the FTP file info to this
|
||||
@@ -117,6 +140,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 +149,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 +158,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 +173,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 +194,8 @@ 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 "-h/--help"
|
||||
Usage help.
|
||||
.IP "-H/--header <header>"
|
||||
@@ -169,38 +207,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 +262,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 +290,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 +310,20 @@ being fetched. Like in:
|
||||
or use several variables like:
|
||||
|
||||
curl http://{site,host}.host[1-5].com -o "#1_#2"
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.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.)
|
||||
|
||||
.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 +345,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 +359,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 +398,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 +422,31 @@ 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>"
|
||||
Set the URL to fetch. This option is mostly handy when you wanna specify URL
|
||||
in a config file.
|
||||
|
||||
If this option is used serveral times, the last one will be used.
|
||||
.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 +512,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 +528,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 +556,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 +567,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 +633,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 +691,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 +762,9 @@ 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>
|
||||
|
||||
.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_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!
|
||||
|
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,7 +166,7 @@ typedef enum {
|
||||
|
||||
#define CURL_ERROR_SIZE 256
|
||||
|
||||
/* maximum URL length we deal with */
|
||||
/* maximum URL length we deal with in headers */
|
||||
#define URL_MAX_LENGTH 4096
|
||||
#define URL_MAX_LENGTH_TXT "4095"
|
||||
|
||||
@@ -394,12 +389,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,
|
||||
|
||||
@@ -430,6 +443,9 @@ 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 +454,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.5.2"
|
||||
#define LIBCURL_VERSION_NUM 0x070502
|
||||
|
||||
/* linked-list structure for the CURLOPT_QUOTE option (and other) */
|
||||
struct curl_slist {
|
||||
@@ -659,8 +675,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.
|
||||
*
|
||||
*************************************************************************
|
||||
*
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -11,6 +11,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 \
|
||||
|
75
lib/Makefile.b32
Normal file
75
lib/Makefile.b32
Normal file
@@ -0,0 +1,75 @@
|
||||
############################################################
|
||||
# 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 \
|
||||
download.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 \
|
||||
highlevel.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
|
||||
|
||||
|
29
lib/Makefile.b32.resp
Normal file
29
lib/Makefile.b32.resp
Normal file
@@ -0,0 +1,29 @@
|
||||
+base64.obj &
|
||||
+cookie.obj &
|
||||
+download.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 &
|
||||
+highlevel.obj &
|
||||
+strequal.obj
|
@@ -86,6 +86,35 @@ 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 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
|
||||
@@ -98,7 +127,6 @@ 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 \
|
||||
|
@@ -4,28 +4,30 @@
|
||||
## (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= \
|
||||
@@ -53,11 +55,11 @@ RELEASE_OBJS= \
|
||||
timevalr.obj \
|
||||
urlr.obj \
|
||||
filer.obj \
|
||||
writeoutr.obj \
|
||||
getinfor.obj \
|
||||
versionr.obj \
|
||||
easyr.obj \
|
||||
highlevelr.obj \
|
||||
strequalr.obj
|
||||
easyr.obj \
|
||||
highlevelr.obj \
|
||||
strequalr.obj
|
||||
|
||||
DEBUG_OBJS= \
|
||||
base64d.obj \
|
||||
@@ -67,7 +69,7 @@ DEBUG_OBJS= \
|
||||
formdatad.obj \
|
||||
ftpd.obj \
|
||||
httpd.obj \
|
||||
ldapd.obj \
|
||||
ldapd.obj \
|
||||
dictd.obj \
|
||||
telnetd.obj \
|
||||
getdated.obj \
|
||||
@@ -84,11 +86,11 @@ DEBUG_OBJS= \
|
||||
timevald.obj \
|
||||
urld.obj \
|
||||
filed.obj \
|
||||
writeoutd.obj \
|
||||
versiond.obj \
|
||||
easyd.obj \
|
||||
highleveld.obj \
|
||||
strequald.obj
|
||||
getinfod.obj \
|
||||
versiond.obj \
|
||||
easyd.obj \
|
||||
highleveld.obj \
|
||||
strequald.obj
|
||||
|
||||
RELEASE_SSL_OBJS= \
|
||||
base64rs.obj \
|
||||
@@ -98,7 +100,7 @@ RELEASE_SSL_OBJS= \
|
||||
formdatars.obj \
|
||||
ftprs.obj \
|
||||
httprs.obj \
|
||||
ldaprs.obj \
|
||||
ldaprs.obj \
|
||||
dictrs.obj \
|
||||
telnetrs.obj \
|
||||
getdaters.obj \
|
||||
@@ -115,11 +117,11 @@ RELEASE_SSL_OBJS= \
|
||||
timevalrs.obj \
|
||||
urlrs.obj \
|
||||
filers.obj \
|
||||
writeouts.obj \
|
||||
getinfors.obj \
|
||||
versionrs.obj \
|
||||
easyrs.obj \
|
||||
highlevelrs.obj \
|
||||
strequalrs.obj
|
||||
easyrs.obj \
|
||||
highlevelrs.obj \
|
||||
strequalrs.obj
|
||||
|
||||
LINK_OBJS= \
|
||||
base64.obj \
|
||||
@@ -129,7 +131,7 @@ LINK_OBJS= \
|
||||
formdata.obj \
|
||||
ftp.obj \
|
||||
http.obj \
|
||||
ldap.obj \
|
||||
ldap.obj \
|
||||
dict.obj \
|
||||
telnet.obj \
|
||||
getdate.obj \
|
||||
@@ -146,11 +148,11 @@ LINK_OBJS= \
|
||||
timeval.obj \
|
||||
url.obj \
|
||||
file.obj \
|
||||
writeout.obj \
|
||||
getinfo.obj \
|
||||
version.obj \
|
||||
easy.obj \
|
||||
highlevel.obj \
|
||||
strequal.obj
|
||||
easy.obj \
|
||||
highlevel.obj \
|
||||
strequal.obj
|
||||
|
||||
all : release
|
||||
|
||||
@@ -163,7 +165,6 @@ debug: $(DEBUG_OBJS)
|
||||
release-ssl: $(RELEASE_SSL_OBJS)
|
||||
$(LINKRS) $(LFLAGS) $(LINKLIBS) $(LINKSLIBS) $(LINK_OBJS)
|
||||
|
||||
|
||||
## Release
|
||||
base64r.obj: base64.c
|
||||
$(CCR) $(CFLAGS) base64.c
|
||||
@@ -213,8 +214,8 @@ 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
|
||||
@@ -240,7 +241,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 +274,16 @@ 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
|
||||
$(CCD) $(CFLAGS) easy.c
|
||||
highleveld.obj: highlevel.c
|
||||
$(CCR) $(CFLAGS) highlevel.c
|
||||
$(CCD) $(CFLAGS) highlevel.c
|
||||
strequald.obj: strequal.c
|
||||
$(CCR) $(CFLAGS) strequal.c
|
||||
$(CCD) $(CFLAGS) strequal.c
|
||||
|
||||
|
||||
## Release SSL
|
||||
@@ -301,7 +302,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 +335,17 @@ 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
|
||||
$(CCRS) $(CFLAGS) easy.c
|
||||
highlevelrs.obj: highlevel.c
|
||||
$(CCR) $(CFLAGS) highlevel.c
|
||||
$(CCRS) $(CFLAGS) highlevel.c
|
||||
strequalrs.obj: strequal.c
|
||||
$(CCR) $(CFLAGS) strequal.c
|
||||
$(CCRS) $(CFLAGS) strequal.c
|
||||
|
||||
|
||||
clean:
|
||||
-@erase *.obj
|
||||
|
24
lib/cookie.c
24
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$
|
||||
*****************************************************************************/
|
||||
|
||||
/***
|
||||
|
||||
@@ -409,7 +431,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 */
|
||||
|
22
lib/cookie.h
22
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
lib/dict.c
41
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"
|
||||
|
||||
@@ -233,7 +216,7 @@ 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] = ' ';
|
||||
}
|
||||
|
39
lib/dict.h
39
lib/dict.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 dict(struct connectdata *conn);
|
||||
CURLcode dict_done(struct connectdata *conn);
|
||||
|
||||
|
@@ -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"
|
||||
|
||||
|
@@ -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$
|
||||
*****************************************************************************/
|
||||
CURLcode
|
||||
Transfer (struct connectdata *data,
|
||||
int sockfd, /* socket to read from or -1 */
|
||||
|
39
lib/easy.c
39
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"
|
||||
|
||||
|
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. */
|
||||
|
||||
|
57
lib/file.c
57
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)
|
||||
{
|
||||
@@ -151,9 +138,6 @@ 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);
|
||||
|
||||
@@ -170,10 +154,11 @@ 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;
|
||||
}
|
||||
|
||||
res = client_write(data, CLIENTWRITE_BODY, buf, nread);
|
||||
if(res)
|
||||
return res;
|
||||
|
||||
now = tvnow();
|
||||
if(pgrsUpdate(data))
|
||||
res = CURLE_ABORTED_BY_CALLBACK;
|
||||
@@ -184,7 +169,5 @@ CURLcode file(struct connectdata *conn)
|
||||
|
||||
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
|
||||
|
@@ -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:
|
||||
@@ -382,8 +365,8 @@ char *MakeFormBoundary(void)
|
||||
|
||||
return retstring;
|
||||
}
|
||||
|
||||
|
||||
/* Used from http.c */
|
||||
void FormFree(struct FormData *form)
|
||||
{
|
||||
struct FormData *next;
|
||||
@@ -391,6 +374,28 @@ void FormFree(struct FormData *form)
|
||||
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 */
|
||||
}
|
||||
|
@@ -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;
|
||||
|
341
lib/ftp.c
341
lib/ftp.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"
|
||||
|
||||
@@ -85,6 +68,7 @@
|
||||
#include "progress.h"
|
||||
#include "download.h"
|
||||
#include "escape.h"
|
||||
#include "http.h" /* for HTTP proxy tunnel stuff */
|
||||
|
||||
#ifdef KRB4
|
||||
#include "security.h"
|
||||
@@ -128,7 +112,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 +180,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");
|
||||
@@ -217,7 +203,8 @@ static CURLcode AllowServerConnect(struct UrlData *data,
|
||||
isdigit((int)line[2]) && (' ' == line[3]))
|
||||
|
||||
int GetLastResponse(int sockfd, char *buf,
|
||||
struct connectdata *conn)
|
||||
struct connectdata *conn,
|
||||
int *ftpcode)
|
||||
{
|
||||
int nread;
|
||||
int keepon=TRUE;
|
||||
@@ -233,6 +220,8 @@ int GetLastResponse(int sockfd, char *buf,
|
||||
#define SELECT_TIMEOUT 2
|
||||
int error = SELECT_OK;
|
||||
|
||||
*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 */
|
||||
@@ -273,8 +262,8 @@ int GetLastResponse(int sockfd, char *buf,
|
||||
break;
|
||||
default:
|
||||
#ifdef USE_SSLEAY
|
||||
if (data->use_ssl) {
|
||||
keepon = SSL_read(data->ssl, ptr, 1);
|
||||
if (data->ssl.use) {
|
||||
keepon = SSL_read(data->ssl.handle, ptr, 1);
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
@@ -317,6 +306,8 @@ int GetLastResponse(int sockfd, char *buf,
|
||||
if(error)
|
||||
return -error;
|
||||
|
||||
*ftpcode=atoi(buf); /* return the initial number like this */
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
||||
@@ -337,53 +328,6 @@ 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)
|
||||
@@ -394,6 +338,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 */
|
||||
|
||||
@@ -418,10 +363,11 @@ CURLcode ftp_connect(struct connectdata *conn)
|
||||
}
|
||||
|
||||
/* The first thing we do is wait for the "220*" line: */
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = GetLastResponse(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 +396,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 = GetLastResponse(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 = GetLastResponse(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 +431,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");
|
||||
@@ -520,6 +466,7 @@ CURLcode ftp_done(struct connectdata *conn)
|
||||
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 +496,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 = GetLastResponse(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 +516,11 @@ CURLcode ftp_done(struct connectdata *conn)
|
||||
if (qitem->data) {
|
||||
ftpsendf(data->firstsocket, conn, "%s", qitem->data);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = GetLastResponse(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 +530,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 +559,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 +570,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
if (qitem->data) {
|
||||
ftpsendf(data->firstsocket, conn, "%s", qitem->data);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = GetLastResponse(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 +587,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 = GetLastResponse(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 = GetLastResponse(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 +633,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 = GetLastResponse(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 = GetLastResponse(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 = 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 = client_write(data, CLIENTWRITE_BOTH, buf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
@@ -718,6 +716,12 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
|
||||
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 +760,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 +788,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
porttouse & 255);
|
||||
}
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = GetLastResponse(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 +801,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
|
||||
ftpsendf(data->firstsocket, conn, "PASV");
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = GetLastResponse(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,7 +851,8 @@ 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 */
|
||||
@@ -969,11 +977,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 = GetLastResponse(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 +1008,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
|
||||
ftpsendf(data->firstsocket, conn, "SIZE %s", ftp->file);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = GetLastResponse(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 +1024,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 +1054,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 +1069,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
else
|
||||
ftpsendf(data->firstsocket, conn, "STOR %s", ftp->file);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = GetLastResponse(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;
|
||||
@@ -1099,9 +1091,7 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
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 */
|
||||
data->secondarysocket, bytecountp);
|
||||
if(result)
|
||||
@@ -1149,11 +1139,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 +1149,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
/* Set type to ASCII */
|
||||
ftpsendf(data->firstsocket, conn, "TYPE A");
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = GetLastResponse(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 +1171,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 = GetLastResponse(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 +1192,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
|
||||
ftpsendf(data->firstsocket, conn, "SIZE %s", ftp->file);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = GetLastResponse(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 +1236,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
|
||||
ftpsendf(data->firstsocket, conn, "REST %d", data->resume_from);
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = GetLastResponse(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 +1249,11 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
ftpsendf(data->firstsocket, conn, "RETR %s", ftp->file);
|
||||
}
|
||||
|
||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||
nread = GetLastResponse(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 +1308,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 )
|
||||
@@ -1385,13 +1356,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 +1392,14 @@ 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;
|
||||
}
|
||||
|
||||
|
39
lib/ftp.h
39
lib/ftp.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 ftp(struct connectdata *conn);
|
||||
CURLcode ftp_done(struct connectdata *conn);
|
||||
CURLcode ftp_connect(struct connectdata *conn);
|
||||
|
@@ -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
|
||||
|
38
lib/getenv.c
38
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>
|
||||
|
67
lib/getenv.h
67
lib/getenv.h
@@ -7,66 +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.
|
||||
*
|
||||
* 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);
|
||||
|
@@ -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,8 @@
|
||||
char *getpass(const char *prompt);
|
||||
#ifndef __GETPASS_H
|
||||
#define __GETPASS_H
|
||||
/*
|
||||
* Returning NULL will abort the continued operation!
|
||||
*/
|
||||
char* getpass_r(char *prompt, char* buffer, size_t buflen );
|
||||
|
||||
#endif
|
||||
|
128
lib/highlevel.c
128
lib/highlevel.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"
|
||||
|
||||
@@ -149,6 +132,7 @@ _Transfer(struct connectdata *c_conn)
|
||||
long bodywrites=0;
|
||||
|
||||
char newurl[URL_MAX_LENGTH]; /* buffer for Location: URL */
|
||||
int writetype;
|
||||
|
||||
/* the highest fd we use + 1 */
|
||||
struct UrlData *data;
|
||||
@@ -174,6 +158,7 @@ _Transfer(struct connectdata *c_conn)
|
||||
#define KEEP_WRITE 2
|
||||
|
||||
pgrsTime(data, TIMER_PRETRANSFER);
|
||||
speedinit(data);
|
||||
|
||||
if (!conn->getheader) {
|
||||
header = FALSE;
|
||||
@@ -335,24 +320,15 @@ _Transfer(struct connectdata *c_conn)
|
||||
|
||||
/* now, only output this if the header AND body are requested:
|
||||
*/
|
||||
if (data->bits.http_include_header) {
|
||||
if((p - data->headerbuff) !=
|
||||
data->fwrite (data->headerbuff, 1,
|
||||
p - data->headerbuff, data->out)) {
|
||||
failf (data, "Failed writing output");
|
||||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
if(data->writeheader) {
|
||||
/* obviously, the header is requested to be written to
|
||||
this file: */
|
||||
if((p - data->headerbuff) !=
|
||||
data->fwrite (data->headerbuff, 1, p - data->headerbuff,
|
||||
data->writeheader)) {
|
||||
failf (data, "Failed writing output");
|
||||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
writetype = CLIENTWRITE_HEADER;
|
||||
if (data->bits.http_include_header)
|
||||
writetype |= CLIENTWRITE_BODY;
|
||||
|
||||
urg = client_write(data, writetype, data->headerbuff,
|
||||
p - data->headerbuff);
|
||||
if(urg)
|
||||
return urg;
|
||||
|
||||
data->header_size += p - data->headerbuff;
|
||||
break; /* exit header line loop */
|
||||
}
|
||||
@@ -402,9 +378,11 @@ _Transfer(struct connectdata *c_conn)
|
||||
}
|
||||
else if(strnequal("Last-Modified:", p,
|
||||
strlen("Last-Modified:")) &&
|
||||
data->timecondition) {
|
||||
(data->timecondition || data->bits.get_filetime) ) {
|
||||
time_t secs=time(NULL);
|
||||
timeofdoc = curl_getdate(p+strlen("Last-Modified:"), &secs);
|
||||
if(data->bits.get_filetime)
|
||||
data->progress.filetime = timeofdoc;
|
||||
}
|
||||
else if ((code >= 300 && code < 400) &&
|
||||
(data->bits.http_follow_location) &&
|
||||
@@ -415,21 +393,15 @@ _Transfer(struct connectdata *c_conn)
|
||||
instead */
|
||||
data->newurl = strdup (newurl);
|
||||
}
|
||||
|
||||
if (data->bits.http_include_header) {
|
||||
if(hbuflen != data->fwrite (p, 1, hbuflen, 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(hbuflen != data->fwrite (p, 1, hbuflen,
|
||||
data->writeheader)) {
|
||||
failf (data, "Failed writing output");
|
||||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
writetype = CLIENTWRITE_HEADER;
|
||||
if (data->bits.http_include_header)
|
||||
writetype |= CLIENTWRITE_BODY;
|
||||
|
||||
urg = client_write(data, writetype, p, hbuflen);
|
||||
if(urg)
|
||||
return urg;
|
||||
|
||||
data->header_size += hbuflen;
|
||||
|
||||
/* reset hbufp pointer && hbuflen */
|
||||
@@ -514,10 +486,9 @@ _Transfer(struct connectdata *c_conn)
|
||||
|
||||
pgrsSetDownloadCounter(data, (double)bytecount);
|
||||
|
||||
if (nread != data->fwrite (str, 1, nread, data->out)) {
|
||||
failf (data, "Failed writing output");
|
||||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
urg = client_write(data, CLIENTWRITE_BODY, str, nread);
|
||||
if(urg)
|
||||
return urg;
|
||||
|
||||
} /* if (! header and data to read ) */
|
||||
} /* if( read from socket ) */
|
||||
@@ -619,11 +590,12 @@ CURLcode curl_transfer(CURL *curl)
|
||||
{
|
||||
CURLcode res;
|
||||
struct UrlData *data = curl;
|
||||
struct connectdata *c_connect;
|
||||
struct connectdata *c_connect=NULL;
|
||||
|
||||
pgrsStartNow(data);
|
||||
|
||||
do {
|
||||
pgrsTime(data, TIMER_STARTSINGLE);
|
||||
res = curl_connect(curl, (CURLconnect **)&c_connect);
|
||||
if(res == CURLE_OK) {
|
||||
res = curl_do(c_connect);
|
||||
@@ -634,13 +606,24 @@ CURLcode curl_transfer(CURL *curl)
|
||||
}
|
||||
|
||||
if((res == CURLE_OK) && data->newurl) {
|
||||
/* Location: redirect */
|
||||
/* Location: redirect
|
||||
|
||||
This is assumed to happen for HTTP(S) only!
|
||||
*/
|
||||
char prot[16];
|
||||
char path[URL_MAX_LENGTH];
|
||||
if (data->maxredirs && (data->followlocation >= data->maxredirs)) {
|
||||
failf(data,"Maximum (%d) redirects followed", data->maxredirs);
|
||||
curl_disconnect(c_connect);
|
||||
res=CURLE_TOO_MANY_REDIRECTS;
|
||||
break;
|
||||
}
|
||||
|
||||
/* mark the next request as a followed location: */
|
||||
data->bits.this_is_a_follow = TRUE;
|
||||
|
||||
data->followlocation++; /* count location-followers */
|
||||
|
||||
if(data->bits.http_auto_referer) {
|
||||
/* We are asked to automatically set the previous URL as the
|
||||
referer when we get the next URL. We pick the ->url field,
|
||||
@@ -718,6 +701,9 @@ CURLcode curl_transfer(CURL *curl)
|
||||
/* TBD: set the port with curl_setopt() */
|
||||
data->port = 0;
|
||||
}
|
||||
|
||||
if(data->bits.urlstringalloc)
|
||||
free(data->url);
|
||||
|
||||
/* TBD: set the URL with curl_setopt() */
|
||||
data->url = data->newurl;
|
||||
@@ -744,12 +730,6 @@ CURLcode curl_transfer(CURL *curl)
|
||||
if(data->newurl)
|
||||
free(data->newurl);
|
||||
|
||||
#if 0
|
||||
if((CURLE_OK == res) && data->writeinfo) {
|
||||
/* Time to output some info to stdout */
|
||||
WriteOut(data);
|
||||
}
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@@ -7,37 +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$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
CURLcode curl_transfer(CURL *curl);
|
||||
#endif
|
||||
|
43
lib/hostip.c
43
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"
|
||||
|
||||
@@ -111,7 +94,7 @@ struct hostent *GetHost(struct UrlData *data,
|
||||
{
|
||||
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 +170,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
|
||||
}
|
||||
|
39
lib/hostip.h
39
lib/hostip.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$
|
||||
*****************************************************************************/
|
||||
|
||||
struct hostent *GetHost(struct UrlData *data, char *hostname, char **bufp );
|
||||
|
||||
|
56
lib/http.c
56
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"
|
||||
|
||||
@@ -327,7 +310,7 @@ CURLcode http(struct connectdata *conn)
|
||||
}
|
||||
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
|
||||
@@ -336,7 +319,13 @@ CURLcode http(struct connectdata *conn)
|
||||
}
|
||||
|
||||
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 = maprintf("Host: %s\r\n", host);
|
||||
else
|
||||
data->ptr_host = maprintf("Host: %s:%d\r\n", host, data->remote_port);
|
||||
}
|
||||
|
||||
if(!checkheaders(data, "Pragma:"))
|
||||
@@ -384,11 +373,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 +389,7 @@ CURLcode http(struct connectdata *conn)
|
||||
if(count) {
|
||||
add_buffer(req_buffer, "\r\n", 2);
|
||||
}
|
||||
cookie_freelist(co); /* free the cookie list */
|
||||
cookie_freelist(store); /* free the cookie list */
|
||||
co=NULL;
|
||||
}
|
||||
|
||||
@@ -448,7 +438,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) {
|
||||
|
39
lib/http.h
39
lib/http.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$
|
||||
*****************************************************************************/
|
||||
|
||||
/* ftp can use this as well */
|
||||
CURLcode GetHTTPProxyTunnel(struct UrlData *data, int tunnelsocket,
|
||||
|
39
lib/if2ip.c
39
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"
|
||||
|
||||
|
39
lib/if2ip.h
39
lib/if2ip.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$
|
||||
*****************************************************************************/
|
||||
#include "setup.h"
|
||||
|
||||
#if ! defined(WIN32) && ! defined(__BEOS__)
|
||||
|
42
lib/ldap.c
42
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,8 +117,7 @@ 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);
|
||||
client_write(data, CLIENTWRITE_BODY, text, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
39
lib/ldap.h
39
lib/ldap.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://www.fts.frontec.se/~dast/curl/
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
CURLcode ldap(struct connectdata *conn);
|
||||
CURLcode ldap_done(struct connectdata *conn);
|
||||
|
||||
|
@@ -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 sockfd;
|
||||
}
|
||||
|
||||
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>$
|
||||
@@ -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,16 +1017,9 @@ 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;
|
||||
|
51
lib/netrc.c
51
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"
|
||||
|
||||
|
67
lib/netrc.h
67
lib/netrc.h
@@ -7,66 +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.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
int ParseNetrc(char *host,
|
||||
char *login,
|
||||
char *password);
|
||||
|
@@ -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"
|
||||
|
||||
@@ -113,7 +96,7 @@ void pgrsDone(struct UrlData *data)
|
||||
if(!(data->progress.flags & PGRS_HIDE)) {
|
||||
data->progress.lastshow=0;
|
||||
pgrsUpdate(data); /* the final (forced) update */
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(data->err, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,14 +107,24 @@ void pgrsTime(struct UrlData *data, timerid timer)
|
||||
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 = tvnow();
|
||||
break;
|
||||
|
||||
case TIMER_NAMELOOKUP:
|
||||
data->progress.t_nslookup = tvnow();
|
||||
data->progress.t_nslookup += tvdiff(tvnow(),
|
||||
data->progress.t_startsingle);
|
||||
break;
|
||||
case TIMER_CONNECT:
|
||||
data->progress.t_connect = tvnow();
|
||||
data->progress.t_connect += tvdiff(tvnow(),
|
||||
data->progress.t_startsingle);
|
||||
break;
|
||||
case TIMER_PRETRANSFER:
|
||||
data->progress.t_pretransfer = tvnow();
|
||||
data->progress.t_pretransfer += tvdiff(tvnow(),
|
||||
data->progress.t_startsingle);
|
||||
break;
|
||||
case TIMER_POSTRANSFER:
|
||||
/* this is the normal end-of-transfer thing */
|
||||
@@ -312,7 +305,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,6 +32,7 @@ typedef enum {
|
||||
TIMER_CONNECT,
|
||||
TIMER_PRETRANSFER,
|
||||
TIMER_POSTRANSFER,
|
||||
TIMER_STARTSINGLE,
|
||||
TIMER_LAST /* must be last */
|
||||
} timerid;
|
||||
|
||||
|
101
lib/sendf.c
101
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"
|
||||
@@ -111,8 +94,8 @@ size_t sendf(int fd, struct UrlData *data, char *fmt, ...)
|
||||
#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));
|
||||
if (data->ssl.use) {
|
||||
bytes_written = SSL_write(data->ssl.handle, s, strlen(s));
|
||||
} else {
|
||||
bytes_written = swrite(fd, s, strlen(s));
|
||||
}
|
||||
@@ -123,37 +106,39 @@ size_t sendf(int fd, struct UrlData *data, char *fmt, ...)
|
||||
|
||||
/*
|
||||
* 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 ftpsendf(int fd, struct connectdata *conn, char *fmt, ...)
|
||||
{
|
||||
size_t bytes_written;
|
||||
char *s;
|
||||
char s[256];
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
s = mvaprintf(fmt, ap);
|
||||
vsnprintf(s, 250, fmt, ap);
|
||||
va_end(ap);
|
||||
if(!s)
|
||||
return 0; /* failure */
|
||||
|
||||
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);
|
||||
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)
|
||||
{
|
||||
@@ -161,8 +146,8 @@ size_t ssend(int fd, struct connectdata *conn, void *mem, size_t len)
|
||||
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);
|
||||
if (data->ssl.use) {
|
||||
bytes_written = SSL_write(data->ssl.handle, mem, len);
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
@@ -180,6 +165,40 @@ size_t ssend(int fd, struct connectdata *conn, void *mem, size_t len)
|
||||
return bytes_written;
|
||||
}
|
||||
|
||||
/* 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 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;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* add_buffer_init() returns a fine buffer struct
|
||||
*/
|
||||
|
44
lib/sendf.h
44
lib/sendf.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$
|
||||
*****************************************************************************/
|
||||
|
||||
size_t ftpsendf(int fd, struct connectdata *, char *fmt, ...);
|
||||
size_t sendf(int fd, struct UrlData *, char *fmt, ...);
|
||||
@@ -53,7 +36,12 @@ struct send_buffer {
|
||||
};
|
||||
typedef struct send_buffer send_buffer;
|
||||
|
||||
#define CLIENTWRITE_BODY 1
|
||||
#define CLIENTWRITE_HEADER 2
|
||||
#define CLIENTWRITE_BOTH (CLIENTWRITE_BODY|CLIENTWRITE_HEADER)
|
||||
|
||||
CURLcode client_write(struct UrlData *data, int type, char *ptr,
|
||||
size_t len);
|
||||
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, ...);
|
||||
|
48
lib/setup.h
48
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$
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -162,13 +145,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"
|
||||
|
||||
void speedinit(struct UrlData *data)
|
||||
{
|
||||
memset(&data->keeps_speed, 0, sizeof(struct timeval));
|
||||
}
|
||||
|
||||
CURLcode speedcheck(struct UrlData *data,
|
||||
struct timeval now)
|
||||
{
|
||||
static struct timeval keeps_speed;
|
||||
|
||||
if((data->current_speed >= 0) &&
|
||||
if((data->progress.current_speed >= 0) &&
|
||||
data->low_speed_time &&
|
||||
(tvlong(keeps_speed) != 0) &&
|
||||
(data->current_speed < data->low_speed_limit)) {
|
||||
(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( 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,43 +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"
|
||||
|
||||
#include "timeval.h"
|
||||
|
||||
void speedinit(struct UrlData *data);
|
||||
CURLcode speedcheck(struct UrlData *data,
|
||||
struct timeval now);
|
||||
|
||||
|
116
lib/ssluse.c
116
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
|
||||
@@ -94,10 +77,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 +89,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 +110,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 +123,7 @@ int SSL_cert_stuff(struct UrlData *data,
|
||||
|
||||
#endif
|
||||
|
||||
#if SSL_VERIFY_CERT
|
||||
#ifdef USE_SSLEAY
|
||||
int cert_verify_callback(int ok, X509_STORE_CTX *ctx)
|
||||
{
|
||||
X509 *err_cert;
|
||||
@@ -164,7 +147,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();
|
||||
@@ -195,7 +178,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,9 +190,9 @@ 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;
|
||||
}
|
||||
@@ -221,22 +204,31 @@ UrgSSLConnect (struct UrlData *data)
|
||||
}
|
||||
}
|
||||
|
||||
#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 +236,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 +246,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 +262,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 +274,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;
|
||||
|
39
lib/ssluse.h
39
lib/ssluse.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$
|
||||
*****************************************************************************/
|
||||
int SSL_cert_stuff(struct UrlData *data,
|
||||
char *cert_file,
|
||||
char *key_file);
|
||||
|
@@ -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) 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"
|
||||
|
||||
|
@@ -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) 2000.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
* Main author:
|
||||
* - Daniel Stenberg <daniel@haxx.se>
|
||||
*
|
||||
* http://curl.haxx.se
|
||||
*
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ------------------------------------------------------------
|
||||
****************************************************************************/
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
int strequal(const char *first, const char *second);
|
||||
int strnequal(const char *first, const char *second, size_t max);
|
||||
|
||||
|
66
lib/telnet.c
66
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"
|
||||
|
||||
@@ -713,8 +688,8 @@ void telrcv(struct UrlData *data,
|
||||
{
|
||||
break; /* Ignore \0 after CR */
|
||||
}
|
||||
|
||||
data->fwrite((char *)&c, 1, 1, data->out);
|
||||
|
||||
client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
|
||||
continue;
|
||||
|
||||
case TS_DATA:
|
||||
@@ -728,7 +703,7 @@ void telrcv(struct UrlData *data,
|
||||
telrcv_state = TS_CR;
|
||||
}
|
||||
|
||||
data->fwrite((char *)&c, 1, 1, data->out);
|
||||
client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
|
||||
continue;
|
||||
|
||||
case TS_IAC:
|
||||
@@ -752,8 +727,8 @@ void telrcv(struct UrlData *data,
|
||||
telrcv_state = TS_SB;
|
||||
continue;
|
||||
case IAC:
|
||||
data->fwrite((char *)&c, 1, 1, data->out);
|
||||
break;
|
||||
client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
|
||||
break;
|
||||
case DM:
|
||||
case NOP:
|
||||
case GA:
|
||||
@@ -861,8 +836,9 @@ void telwrite(struct UrlData *data,
|
||||
#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);
|
||||
if (data->ssl.use) {
|
||||
bytes_written = SSL_write(data->ssl.handle, (char *)outbuf,
|
||||
out_count);
|
||||
}
|
||||
else {
|
||||
bytes_written = swrite(data->firstsocket, outbuf, out_count);
|
||||
@@ -918,8 +894,8 @@ CURLcode telnet(struct connectdata *conn)
|
||||
#ifndef USE_SSLEAY
|
||||
nread = sread (sockfd, buf, BUFSIZE - 1);
|
||||
#else
|
||||
if (data->use_ssl) {
|
||||
nread = SSL_read (data->ssl, buf, BUFSIZE - 1);
|
||||
if (data->ssl.use) {
|
||||
nread = SSL_read (data->ssl.handle, buf, BUFSIZE - 1);
|
||||
}
|
||||
else {
|
||||
nread = sread (sockfd, buf, BUFSIZE - 1);
|
||||
|
39
lib/telnet.h
39
lib/telnet.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 telnet(struct connectdata *conn);
|
||||
CURLcode telnet_done(struct connectdata *conn);
|
||||
|
||||
|
@@ -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$
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.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$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
|
405
lib/url.c
405
lib/url.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$
|
||||
*****************************************************************************/
|
||||
|
||||
/* -- WIN32 approved -- */
|
||||
|
||||
@@ -109,6 +92,7 @@
|
||||
#include "progress.h"
|
||||
#include "cookie.h"
|
||||
#include "strequal.h"
|
||||
#include "escape.h"
|
||||
|
||||
/* And now for the protocols */
|
||||
#include "ftp.h"
|
||||
@@ -150,19 +134,19 @@ void curl_free(void)
|
||||
void static urlfree(struct UrlData *data, bool totally)
|
||||
{
|
||||
#ifdef USE_SSLEAY
|
||||
if (data->use_ssl) {
|
||||
if(data->ssl) {
|
||||
(void)SSL_shutdown(data->ssl);
|
||||
SSL_set_connect_state(data->ssl);
|
||||
if (data->ssl.use) {
|
||||
if(data->ssl.handle) {
|
||||
(void)SSL_shutdown(data->ssl.handle);
|
||||
SSL_set_connect_state(data->ssl.handle);
|
||||
|
||||
SSL_free (data->ssl);
|
||||
data->ssl = NULL;
|
||||
SSL_free (data->ssl.handle);
|
||||
data->ssl.handle = NULL;
|
||||
}
|
||||
if(data->ctx) {
|
||||
SSL_CTX_free (data->ctx);
|
||||
data->ctx = NULL;
|
||||
if(data->ssl.ctx) {
|
||||
SSL_CTX_free (data->ssl.ctx);
|
||||
data->ssl.ctx = NULL;
|
||||
}
|
||||
data->use_ssl = FALSE; /* get back to ordinary socket usage */
|
||||
data->ssl.use = FALSE; /* get back to ordinary socket usage */
|
||||
}
|
||||
#endif /* USE_SSLEAY */
|
||||
|
||||
@@ -190,6 +174,7 @@ void static urlfree(struct UrlData *data, bool totally)
|
||||
if(data->bits.rangestringalloc) {
|
||||
free(data->range);
|
||||
data->range=NULL;
|
||||
data->bits.rangestringalloc=0; /* free now */
|
||||
}
|
||||
|
||||
if(data->ptr_proxyuserpwd) {
|
||||
@@ -263,6 +248,17 @@ CURLcode curl_close(CURL *curl)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
int my_getpass(void *clientp, char *prompt, char* buffer, int buflen )
|
||||
{
|
||||
char *retbuf;
|
||||
retbuf = getpass_r(prompt, buffer, buflen);
|
||||
if(NULL == retbuf)
|
||||
return 1;
|
||||
else
|
||||
return 0; /* success */
|
||||
}
|
||||
|
||||
|
||||
CURLcode curl_open(CURL **curl, char *url)
|
||||
{
|
||||
/* We don't yet support specifying the URL at this point */
|
||||
@@ -285,13 +281,6 @@ CURLcode curl_open(CURL **curl, char *url)
|
||||
|
||||
data-> headersize=HEADERSIZE;
|
||||
|
||||
#if 0
|
||||
/* Let's set some default values: */
|
||||
curl_setopt(data, CURLOPT_FILE, stdout); /* default output to stdout */
|
||||
curl_setopt(data, CURLOPT_INFILE, stdin); /* default input from stdin */
|
||||
curl_setopt(data, CURLOPT_STDERR, stderr); /* default stderr to stderr! */
|
||||
#endif
|
||||
|
||||
data->out = stdout; /* default output to stdout */
|
||||
data->in = stdin; /* default input from stdin */
|
||||
data->err = stderr; /* default stderr to stderr */
|
||||
@@ -305,6 +294,9 @@ CURLcode curl_open(CURL **curl, char *url)
|
||||
/* use fread as default function to read input */
|
||||
data->fread = (size_t (*)(char *, size_t, size_t, FILE *))fread;
|
||||
|
||||
/* set the default passwd function */
|
||||
data->fpasswd = my_getpass;
|
||||
|
||||
data->infilesize = -1; /* we don't know any size */
|
||||
|
||||
data->current_speed = -1; /* init to negative == impossible */
|
||||
@@ -349,6 +341,9 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||
case CURLOPT_POST:
|
||||
data->bits.http_post = va_arg(param, long)?TRUE:FALSE;
|
||||
break;
|
||||
case CURLOPT_FILETIME:
|
||||
data->bits.get_filetime = va_arg(param, long)?TRUE:FALSE;
|
||||
break;
|
||||
case CURLOPT_FTPLISTONLY:
|
||||
data->bits.ftp_list_only = va_arg(param, long)?TRUE:FALSE;
|
||||
break;
|
||||
@@ -380,7 +375,7 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||
break;
|
||||
|
||||
case CURLOPT_SSLVERSION:
|
||||
data->ssl_version = va_arg(param, long);
|
||||
data->ssl.version = va_arg(param, long);
|
||||
break;
|
||||
|
||||
case CURLOPT_COOKIEFILE:
|
||||
@@ -431,9 +426,7 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||
data->url = va_arg(param, char *);
|
||||
break;
|
||||
case CURLOPT_PORT:
|
||||
/* this typecast is used to fool the compiler to NOT warn for a
|
||||
"cast from pointer to integer of different size" */
|
||||
data->port = (unsigned short)(va_arg(param, long));
|
||||
data->port = va_arg(param, long);
|
||||
break;
|
||||
case CURLOPT_POSTFIELDS:
|
||||
data->postfields = va_arg(param, char *);
|
||||
@@ -461,6 +454,9 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||
case CURLOPT_TIMEOUT:
|
||||
data->timeout = va_arg(param, long);
|
||||
break;
|
||||
case CURLOPT_MAXREDIRS:
|
||||
data->maxredirs = va_arg(param, long);
|
||||
break;
|
||||
case CURLOPT_USERAGENT:
|
||||
data->useragent = va_arg(param, char *);
|
||||
break;
|
||||
@@ -478,6 +474,12 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||
case CURLOPT_PROGRESSDATA:
|
||||
data->progress_client = va_arg(param, void *);
|
||||
break;
|
||||
case CURLOPT_PASSWDFUNCTION:
|
||||
data->fpasswd = va_arg(param, curl_passwd_callback);
|
||||
break;
|
||||
case CURLOPT_PASSWDDATA:
|
||||
data->passwd_client = va_arg(param, void *);
|
||||
break;
|
||||
case CURLOPT_PROXYUSERPWD:
|
||||
data->proxyuserpwd = va_arg(param, char *);
|
||||
data->bits.proxy_user_passwd = data->proxyuserpwd?1:0;
|
||||
@@ -495,11 +497,6 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||
case CURLOPT_WRITEFUNCTION:
|
||||
data->fwrite = va_arg(param, curl_write_callback);
|
||||
break;
|
||||
#if 0
|
||||
case CURLOPT_WRITEINFO:
|
||||
data->writeinfo = va_arg(param, char *);
|
||||
break;
|
||||
#endif
|
||||
case CURLOPT_READFUNCTION:
|
||||
data->fread = va_arg(param, curl_read_callback);
|
||||
break;
|
||||
@@ -522,6 +519,13 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||
data->krb4_level = va_arg(param, char *);
|
||||
data->bits.krb4=data->krb4_level?TRUE:FALSE;
|
||||
break;
|
||||
case CURLOPT_SSL_VERIFYPEER:
|
||||
data->ssl.verifypeer = va_arg(param, long);
|
||||
break;
|
||||
case CURLOPT_CAINFO:
|
||||
data->ssl.CAfile = va_arg(param, char *);
|
||||
data->ssl.CApath = NULL; /*This does not work on windows.*/
|
||||
break;
|
||||
default:
|
||||
/* unknown tag and its companion, just ignore: */
|
||||
return CURLE_READ_ERROR; /* correct this */
|
||||
@@ -546,8 +550,8 @@ int GetLine(int sockfd, char *buf, struct UrlData *data)
|
||||
(nread<BUFSIZE) && read_rc;
|
||||
nread++, ptr++) {
|
||||
#ifdef USE_SSLEAY
|
||||
if (data->use_ssl) {
|
||||
read_rc = SSL_read(data->ssl, ptr, 1);
|
||||
if (data->ssl.use) {
|
||||
read_rc = SSL_read(data->ssl.handle, ptr, 1);
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
@@ -593,8 +597,8 @@ CURLcode curl_write(CURLconnect *c_conn, char *buf, size_t amount,
|
||||
data = conn->data;
|
||||
|
||||
#ifdef USE_SSLEAY
|
||||
if (data->use_ssl) {
|
||||
bytes_written = SSL_write(data->ssl, buf, amount);
|
||||
if (data->ssl.use) {
|
||||
bytes_written = SSL_write(data->ssl.handle, buf, amount);
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
@@ -624,8 +628,8 @@ CURLcode curl_read(CURLconnect *c_conn, char *buf, size_t buffersize,
|
||||
data = conn->data;
|
||||
|
||||
#ifdef USE_SSLEAY
|
||||
if (data->use_ssl) {
|
||||
nread = SSL_read (data->ssl, buf, buffersize);
|
||||
if (data->ssl.use) {
|
||||
nread = SSL_read (data->ssl.handle, buf, buffersize);
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
@@ -651,6 +655,9 @@ CURLcode curl_disconnect(CURLconnect *c_connect)
|
||||
if(conn->hostent_buf) /* host name info */
|
||||
free(conn->hostent_buf);
|
||||
|
||||
if(conn->path) /* the URL path part */
|
||||
free(conn->path);
|
||||
|
||||
free(conn); /* free the connection oriented data */
|
||||
|
||||
/* clean up the sockets and SSL stuff from the previous "round" */
|
||||
@@ -659,33 +666,18 @@ CURLcode curl_disconnect(CURLconnect *c_connect)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* NAME curl_connect()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Connects to the peer server and performs the initial setup. This function
|
||||
* writes a connect handle to its second argument that is a unique handle for
|
||||
* this connect. This allows multiple connects from the same handle returned
|
||||
* by curl_open().
|
||||
*
|
||||
* EXAMPLE
|
||||
*
|
||||
* CURLCode result;
|
||||
* CURL curl;
|
||||
* CURLconnect connect;
|
||||
* result = curl_connect(curl, &connect);
|
||||
*/
|
||||
|
||||
CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
|
||||
{
|
||||
char *tmp;
|
||||
char *buf;
|
||||
CURLcode result;
|
||||
char resumerange[12]="";
|
||||
char resumerange[40]="";
|
||||
struct UrlData *data = curl;
|
||||
struct connectdata *conn;
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction sigact;
|
||||
#endif
|
||||
int urllen;
|
||||
|
||||
if(!data || (data->handle != STRUCT_OPEN))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT; /* TBD: make error codes */
|
||||
@@ -711,17 +703,41 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
|
||||
buf = data->buffer; /* this is our buffer */
|
||||
|
||||
#if 0
|
||||
#ifdef HAVE_SIGACTION
|
||||
sigaction(SIGALRM, NULL, &sigact);
|
||||
sigact.sa_handler = alarmfunc;
|
||||
#ifdef SA_RESTART
|
||||
/* HPUX doesn't have SA_RESTART but defaults to that behaviour! */
|
||||
sigact.sa_flags &= ~SA_RESTART;
|
||||
#endif
|
||||
sigaction(SIGALRM, &sigact, NULL);
|
||||
#else
|
||||
/* no sigaction(), revert to the much lamer signal() */
|
||||
#ifdef HAVE_SIGNAL
|
||||
signal(SIGALRM, alarmfunc);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* We need to allocate memory to store the path in. We get the size of the
|
||||
full URL to be sure, and we need to make it at least 256 bytes since
|
||||
other parts of the code will rely on this fact */
|
||||
#define LEAST_PATH_ALLOC 256
|
||||
urllen=strlen(data->url);
|
||||
if(urllen < LEAST_PATH_ALLOC)
|
||||
urllen=LEAST_PATH_ALLOC;
|
||||
|
||||
conn->path=(char *)malloc(urllen);
|
||||
if(NULL == conn->path)
|
||||
return CURLE_OUT_OF_MEMORY; /* really bad error */
|
||||
|
||||
/* Parse <url> */
|
||||
/* We need to parse the url, even when using the proxy, because
|
||||
* we will need the hostname and port in case we are trying
|
||||
* to SSL connect through the proxy -- and we don't know if we
|
||||
* will need to use SSL until we parse the url ...
|
||||
*/
|
||||
if((2 == sscanf(data->url, "%64[^:]://%" URL_MAX_LENGTH_TXT "[^\n]",
|
||||
if((2 == sscanf(data->url, "%64[^:]://%[^\n]",
|
||||
conn->proto,
|
||||
conn->path)) && strequal(conn->proto, "file")) {
|
||||
/* we deal with file://<host>/<path> differently since it
|
||||
@@ -741,11 +757,11 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
strcpy(conn->path, "/");
|
||||
|
||||
if (2 > sscanf(data->url,
|
||||
"%64[^\n:]://%256[^\n/]%" URL_MAX_LENGTH_TXT "[^\n]",
|
||||
"%64[^\n:]://%256[^\n/]%[^\n]",
|
||||
conn->proto, conn->gname, conn->path)) {
|
||||
|
||||
/* badly formatted, let's try the browser-style _without_ 'http://' */
|
||||
if((1 > sscanf(data->url, "%256[^\n/]%" URL_MAX_LENGTH_TXT "[^\n]",
|
||||
if((1 > sscanf(data->url, "%256[^\n/]%[^\n]",
|
||||
conn->gname, conn->path)) ) {
|
||||
failf(data, "<url> malformed");
|
||||
return CURLE_URL_MALFORMAT;
|
||||
@@ -780,16 +796,19 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
|
||||
if(*data->userpwd != ':') {
|
||||
/* the name is given, get user+password */
|
||||
sscanf(data->userpwd, "%127[^:]:%127[^@]",
|
||||
sscanf(data->userpwd, "%127[^:]:%127[^\n]",
|
||||
data->user, data->passwd);
|
||||
}
|
||||
else
|
||||
/* no name given, get the password only */
|
||||
sscanf(data->userpwd+1, "%127[^@]", data->passwd);
|
||||
sscanf(data->userpwd+1, "%127[^\n]", data->passwd);
|
||||
|
||||
/* check for password, if no ask for one */
|
||||
if( !data->passwd[0] ) {
|
||||
strncpy(data->passwd, getpass("password: "), sizeof(data->passwd));
|
||||
if(!data->fpasswd ||
|
||||
data->fpasswd(data->passwd_client,
|
||||
"password:", data->passwd, sizeof(data->passwd)))
|
||||
return CURLE_BAD_PASSWORD_ENTERED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -799,16 +818,21 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
|
||||
if(*data->proxyuserpwd != ':') {
|
||||
/* the name is given, get user+password */
|
||||
sscanf(data->proxyuserpwd, "%127[^:]:%127[^@]",
|
||||
sscanf(data->proxyuserpwd, "%127[^:]:%127[^\n]",
|
||||
data->proxyuser, data->proxypasswd);
|
||||
}
|
||||
else
|
||||
/* no name given, get the password only */
|
||||
sscanf(data->proxyuserpwd+1, "%127[^@]", data->proxypasswd);
|
||||
sscanf(data->proxyuserpwd+1, "%127[^\n]", data->proxypasswd);
|
||||
|
||||
/* check for password, if no ask for one */
|
||||
if( !data->proxypasswd[0] ) {
|
||||
strncpy(data->proxypasswd, getpass("proxy password: "), sizeof(data->proxypasswd));
|
||||
if(!data->fpasswd ||
|
||||
data->fpasswd( data->passwd_client,
|
||||
"proxy password:",
|
||||
data->proxypasswd,
|
||||
sizeof(data->proxypasswd)))
|
||||
return CURLE_BAD_PASSWORD_ENTERED;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -822,20 +846,29 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
/* If proxy was not specified, we check for default proxy environment
|
||||
variables, to enable i.e Lynx compliance:
|
||||
|
||||
HTTP_PROXY http://some.server.dom:port/
|
||||
HTTPS_PROXY http://some.server.dom:port/
|
||||
FTP_PROXY http://some.server.dom:port/
|
||||
GOPHER_PROXY http://some.server.dom:port/
|
||||
NO_PROXY host.domain.dom (a comma-separated list of hosts which should
|
||||
not be proxied, or an asterisk to override all proxy variables)
|
||||
ALL_PROXY seems to exist for the CERN www lib. Probably the first to
|
||||
check for.
|
||||
|
||||
http_proxy=http://some.server.dom:port/
|
||||
https_proxy=http://some.server.dom:port/
|
||||
ftp_proxy=http://some.server.dom:port/
|
||||
gopher_proxy=http://some.server.dom:port/
|
||||
no_proxy=domain1.dom,host.domain2.dom
|
||||
(a comma-separated list of hosts which should
|
||||
not be proxied, or an asterisk to override
|
||||
all proxy variables)
|
||||
all_proxy=http://some.server.dom:port/
|
||||
(seems to exist for the CERN www lib. Probably
|
||||
the first to check for.)
|
||||
|
||||
For compatibility, the all-uppercase versions of these variables are
|
||||
checked if the lowercase versions don't exist.
|
||||
*/
|
||||
char *no_proxy=GetEnv("NO_PROXY");
|
||||
char *no_proxy=NULL;
|
||||
char *proxy=NULL;
|
||||
char proxy_env[128];
|
||||
|
||||
no_proxy=GetEnv("no_proxy");
|
||||
if(!no_proxy)
|
||||
no_proxy=GetEnv("NO_PROXY");
|
||||
|
||||
if(!no_proxy || !strequal("*", no_proxy)) {
|
||||
/* NO_PROXY wasn't specified or it wasn't just an asterisk */
|
||||
char *nope;
|
||||
@@ -858,23 +891,31 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
char *envp = proxy_env;
|
||||
char *prox;
|
||||
|
||||
/* Now, build <PROTOCOL>_PROXY and check for such a one to use */
|
||||
while(*protop) {
|
||||
*envp++ = toupper(*protop++);
|
||||
}
|
||||
/* append _PROXY */
|
||||
strcpy(envp, "_PROXY");
|
||||
#if 0
|
||||
infof(data, "DEBUG: checks the environment variable %s\n", proxy_env);
|
||||
#endif
|
||||
/* Now, build <protocol>_proxy and check for such a one to use */
|
||||
while(*protop)
|
||||
*envp++ = tolower(*protop++);
|
||||
|
||||
/* append _proxy */
|
||||
strcpy(envp, "_proxy");
|
||||
|
||||
/* read the protocol proxy: */
|
||||
prox=GetEnv(proxy_env);
|
||||
|
||||
if(!prox) {
|
||||
/* There was no lowercase variable, try the uppercase version: */
|
||||
for(envp = proxy_env; *envp; envp++)
|
||||
*envp = toupper(*envp);
|
||||
prox=GetEnv(proxy_env);
|
||||
}
|
||||
|
||||
if(prox && *prox) { /* don't count "" strings */
|
||||
proxy = prox; /* use this */
|
||||
}
|
||||
else
|
||||
proxy = GetEnv("ALL_PROXY"); /* default proxy to use */
|
||||
}
|
||||
else {
|
||||
proxy = GetEnv("all_proxy"); /* default proxy to use */
|
||||
if(!proxy)
|
||||
proxy=GetEnv("ALL_PROXY");
|
||||
}
|
||||
|
||||
if(proxy && *proxy) {
|
||||
/* we have a proxy here to set */
|
||||
@@ -882,7 +923,7 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
data->bits.proxystringalloc=1; /* this needs to be freed later */
|
||||
data->bits.httpproxy=1;
|
||||
}
|
||||
} /* if (!nope) - it wasn't specfied non-proxy */
|
||||
} /* if (!nope) - it wasn't specified non-proxy */
|
||||
} /* NO_PROXY wasn't specified or '*' */
|
||||
if(no_proxy)
|
||||
free(no_proxy);
|
||||
@@ -961,7 +1002,7 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
conn->curl_close = http_close;
|
||||
|
||||
#else /* USE_SSLEAY */
|
||||
failf(data, "SSL is disabled, https: not supported!");
|
||||
failf(data, "libcurl was built with SSL disabled, https: not supported!");
|
||||
return CURLE_UNSUPPORTED_PROTOCOL;
|
||||
#endif /* !USE_SSLEAY */
|
||||
}
|
||||
@@ -1094,13 +1135,7 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
user+password pair in a string like:
|
||||
ftp://user:password@ftp.my.site:8021/README */
|
||||
char *ptr=NULL; /* assign to remove possible warnings */
|
||||
#if 0
|
||||
if(':' == *conn->name) {
|
||||
failf(data, "URL malformat: user can't be zero length");
|
||||
return CURLE_URL_MALFORMAT_USER;
|
||||
}
|
||||
#endif
|
||||
if(ptr=strchr(conn->name, '@')) {
|
||||
if((ptr=strchr(conn->name, '@'))) {
|
||||
/* there's a user+password given here, to the left of the @ */
|
||||
|
||||
data->user[0] =0;
|
||||
@@ -1108,16 +1143,37 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
|
||||
if(*conn->name != ':') {
|
||||
/* the name is given, get user+password */
|
||||
sscanf(conn->name, "%127[^:]:%127[^@]",
|
||||
sscanf(conn->name, "%127[^:@]:%127[^@]",
|
||||
data->user, data->passwd);
|
||||
}
|
||||
else
|
||||
/* no name given, get the password only */
|
||||
sscanf(conn->name+1, "%127[^@]", data->passwd);
|
||||
|
||||
if(data->user[0]) {
|
||||
char *newname=curl_unescape(data->user, 0);
|
||||
if(strlen(newname) < sizeof(data->user)) {
|
||||
strcpy(data->user, newname);
|
||||
}
|
||||
/* if the new name is longer than accepted, then just use
|
||||
the unconverted name, it'll be wrong but what the heck */
|
||||
free(newname);
|
||||
}
|
||||
|
||||
/* check for password, if no ask for one */
|
||||
if( !data->passwd[0] ) {
|
||||
strncpy(data->passwd, getpass("password: "), sizeof(data->passwd));
|
||||
if(!data->fpasswd ||
|
||||
data->fpasswd(data->passwd_client,
|
||||
"password:",data->passwd,sizeof(data->passwd)))
|
||||
return CURLE_BAD_PASSWORD_ENTERED;
|
||||
}
|
||||
else {
|
||||
/* we have a password found in the URL, decode it! */
|
||||
char *newpasswd=curl_unescape(data->passwd, 0);
|
||||
if(strlen(newpasswd) < sizeof(data->passwd)) {
|
||||
strcpy(data->passwd, newpasswd);
|
||||
}
|
||||
free(newpasswd);
|
||||
}
|
||||
|
||||
conn->name = ++ptr;
|
||||
@@ -1137,11 +1193,12 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
*tmp++ = '\0';
|
||||
data->port = atoi(tmp);
|
||||
}
|
||||
|
||||
data->remote_port = data->port; /* it is the same port */
|
||||
|
||||
/* Connect to target host right on */
|
||||
conn->hp = GetHost(data, conn->name, &conn->hostent_buf);
|
||||
if(!conn->hp) {
|
||||
failf(data, "Couldn't resolv host '%s'", conn->name);
|
||||
failf(data, "Couldn't resolve host '%s'", conn->name);
|
||||
return CURLE_COULDNT_RESOLVE_HOST;
|
||||
}
|
||||
}
|
||||
@@ -1197,7 +1254,7 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
/* connect to proxy */
|
||||
conn->hp = GetHost(data, proxyptr, &conn->hostent_buf);
|
||||
if(!conn->hp) {
|
||||
failf(data, "Couldn't resolv proxy '%s'", proxyptr);
|
||||
failf(data, "Couldn't resolve proxy '%s'", proxyptr);
|
||||
return CURLE_COULDNT_RESOLVE_PROXY;
|
||||
}
|
||||
|
||||
@@ -1228,12 +1285,10 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
#endif
|
||||
|
||||
if (data->device && (strlen(data->device)<255)) {
|
||||
struct ifreq ifr;
|
||||
struct sockaddr_in sa;
|
||||
struct hostent *h=NULL;
|
||||
char *hostdataptr;
|
||||
char *hostdataptr=NULL;
|
||||
size_t size;
|
||||
unsigned short porttouse;
|
||||
char myhost[256] = "";
|
||||
unsigned long in;
|
||||
|
||||
@@ -1309,23 +1364,6 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
case ENOMEM:
|
||||
failf(data, "Insufficient kernel memory was available: %d", errno);
|
||||
break;
|
||||
#if 0
|
||||
case EROFS:
|
||||
failf(data,
|
||||
"Socket inode would reside on a read-only file system: %d",
|
||||
errno);
|
||||
break;
|
||||
case ENOENT:
|
||||
failf(data, "File does not exist: %d", errno);
|
||||
break;
|
||||
case ENOTDIR:
|
||||
failf(data, "Component of path prefix is not a directory: %d",
|
||||
errno);
|
||||
break;
|
||||
case ELOOP:
|
||||
failf(data,"Too many symbolic links encountered: %d",errno);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
failf(data,"errno %d\n");
|
||||
} /* end of switch */
|
||||
@@ -1345,7 +1383,8 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
return CURLE_HTTP_PORT_FAILED;
|
||||
}
|
||||
|
||||
free(hostdataptr); /* allocated by GetHost() */
|
||||
if(hostdataptr)
|
||||
free(hostdataptr); /* allocated by GetHost() */
|
||||
|
||||
} /* end of device selection support */
|
||||
#endif /* end of HAVE_INET_NTOA */
|
||||
@@ -1390,22 +1429,9 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
failf(data, "Attempt to connect to broadcast address without socket broadcast flag or local firewall rule violated: %d",errno);
|
||||
break;
|
||||
#endif
|
||||
#ifdef EINTR
|
||||
case EINTR:
|
||||
failf(data, "Connection timeouted");
|
||||
break;
|
||||
#endif
|
||||
#if 0
|
||||
case EAFNOSUPPORT:
|
||||
failf(data, "Incorrect address family: %d",errno);
|
||||
break;
|
||||
case ENOTSOCK:
|
||||
failf(data, "File descriptor is not a socket: %d",errno);
|
||||
break;
|
||||
case EBADF:
|
||||
failf(data, "File descriptor is not a valid index in descriptor table: %d",errno);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
failf(data, "Can't connect to server: %d", errno);
|
||||
break;
|
||||
@@ -1452,10 +1478,6 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
infof(data, "Connected to %s (%s)\n", conn->hp->h_name, inet_ntoa(in));
|
||||
}
|
||||
|
||||
#if 0 /* Kerberos experiements! Beware! Take cover! */
|
||||
kerberos_connect(data, name);
|
||||
#endif
|
||||
|
||||
#ifdef __EMX__
|
||||
/* 20000330 mgs
|
||||
* the check is quite a hack...
|
||||
@@ -1471,6 +1493,52 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
|
||||
{
|
||||
CURLcode code;
|
||||
struct connectdata *conn;
|
||||
|
||||
/* call the stuff that needs to be called */
|
||||
code = _connect(curl, in_connect);
|
||||
|
||||
if(CURLE_OK != code) {
|
||||
/* We're not allowed to return failure with memory left allocated
|
||||
in the connectdata struct, free those here */
|
||||
conn = (struct connectdata *)*in_connect;
|
||||
if(conn) {
|
||||
if(conn->path)
|
||||
free(conn->path);
|
||||
if(conn->hostent_buf)
|
||||
free(conn->hostent_buf);
|
||||
free(conn);
|
||||
*in_connect=NULL;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* NAME curl_connect()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Connects to the peer server and performs the initial setup. This function
|
||||
* writes a connect handle to its second argument that is a unique handle for
|
||||
* this connect. This allows multiple connects from the same handle returned
|
||||
* by curl_open().
|
||||
*
|
||||
* EXAMPLE
|
||||
*
|
||||
* CURLCode result;
|
||||
* CURL curl;
|
||||
* CURLconnect connect;
|
||||
* result = curl_connect(curl, &connect);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
CURLcode curl_done(CURLconnect *c_connect)
|
||||
{
|
||||
struct connectdata *conn = c_connect;
|
||||
@@ -1522,13 +1590,6 @@ CURLcode curl_do(CURLconnect *in_conn)
|
||||
|
||||
conn->state = CONN_DO; /* we have entered this state */
|
||||
|
||||
#if 0
|
||||
if(conn->bytecount) {
|
||||
double ittook = tvdiff (tvnow(), conn->now);
|
||||
infof(data, "%i bytes transfered in %.3lf seconds (%.0lf bytes/sec).\n",
|
||||
conn->bytecount, ittook, (double)conn->bytecount/(ittook!=0.0?ittook:1));
|
||||
}
|
||||
#endif
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
|
39
lib/url.h
39
lib/url.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$
|
||||
*****************************************************************************/
|
||||
int GetLine(int sockfd, char *buf, struct UrlData *data);
|
||||
|
||||
#endif
|
||||
|
103
lib/urldata.h
103
lib/urldata.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$
|
||||
*****************************************************************************/
|
||||
|
||||
/* This file is for lib internal stuff */
|
||||
|
||||
@@ -175,7 +158,7 @@ struct connectdata {
|
||||
char proto[64];
|
||||
char gname[256];
|
||||
char *name;
|
||||
char path[URL_MAX_LENGTH];
|
||||
char *path; /* formerly staticly this size: URL_MAX_LENGTH */
|
||||
char *ppath;
|
||||
long bytecount;
|
||||
struct timeval now;
|
||||
@@ -244,11 +227,14 @@ struct Progress {
|
||||
double ulspeed;
|
||||
|
||||
struct timeval start;
|
||||
struct timeval t_startsingle;
|
||||
/* various data stored for possible later report */
|
||||
struct timeval t_nslookup;
|
||||
struct timeval t_connect;
|
||||
struct timeval t_pretransfer;
|
||||
double t_nslookup;
|
||||
double t_connect;
|
||||
double t_pretransfer;
|
||||
int httpcode;
|
||||
time_t filetime; /* If requested, this is might get set. It may be 0 if
|
||||
the time was unretrievable */
|
||||
|
||||
#define CURR_TIME 5
|
||||
|
||||
@@ -286,6 +272,7 @@ struct FTP {
|
||||
};
|
||||
|
||||
struct Configbits {
|
||||
bool get_filetime;
|
||||
bool tunnel_thru_httpproxy;
|
||||
bool ftp_append;
|
||||
bool ftp_ascii;
|
||||
@@ -326,6 +313,21 @@ typedef enum {
|
||||
CURLI_LAST
|
||||
} CurlInterface;
|
||||
|
||||
struct ssldata {
|
||||
bool use; /* use ssl encrypted communications TRUE/FALSE */
|
||||
long version; /* what version the client wants to use */
|
||||
long certverifyresult; /* result from the certificate verification */
|
||||
long verifypeer; /* set TRUE if this is desired */
|
||||
char *CApath; /* DOES NOT WORK ON WINDOWS */
|
||||
char *CAfile; /* cerficate to verify peer against */
|
||||
#ifdef USE_SSLEAY
|
||||
/* these ones requires specific SSL-types */
|
||||
SSL_CTX* ctx;
|
||||
SSL* handle;
|
||||
X509* server_cert;
|
||||
#endif /* USE_SSLEAY */
|
||||
};
|
||||
|
||||
/*
|
||||
* As of April 11, 2000 we're now trying to split up the urldata struct in
|
||||
* three different parts:
|
||||
@@ -385,8 +387,8 @@ struct UrlData {
|
||||
char *url; /* what to get */
|
||||
char *freethis; /* if non-NULL, an allocated string for the URL */
|
||||
char *hostname; /* hostname to connect, as parsed from url */
|
||||
unsigned short port; /* which port to use (if non-protocol bind) set
|
||||
CONF_PORT to use this */
|
||||
long port; /* which port to use (if non-protocol bind) set
|
||||
CONF_PORT to use this */
|
||||
unsigned short remote_port; /* what remote port to connect to, not the proxy
|
||||
port! */
|
||||
struct Configbits bits; /* new-style (v7) flag data */
|
||||
@@ -394,17 +396,24 @@ struct UrlData {
|
||||
char *userpwd; /* <user:password>, if used */
|
||||
char *range; /* range, if used. See README for detailed specification on
|
||||
this syntax. */
|
||||
|
||||
/* stuff related to HTTP */
|
||||
|
||||
long followlocation;
|
||||
long maxredirs; /* maximum no. of http(s) redirects to follow */
|
||||
char *referer;
|
||||
bool free_referer; /* set TRUE if 'referer' points to a string we
|
||||
allocated */
|
||||
char *useragent; /* User-Agent string */
|
||||
char *postfields; /* if POST, set the fields' values here */
|
||||
long postfieldsize; /* if POST, this might have a size to use instead of
|
||||
strlen(), and then the data *may* be binary (contain
|
||||
zero bytes) */
|
||||
|
||||
bool free_referer; /* set TRUE if 'referer' points to a string we
|
||||
allocated */
|
||||
char *referer;
|
||||
char *useragent; /* User-Agent string */
|
||||
|
||||
/* stuff related to FTP */
|
||||
char *ftpport; /* port to send with the PORT command */
|
||||
|
||||
/* general things */
|
||||
char *device; /* Interface to use */
|
||||
|
||||
/* function that stores the output:*/
|
||||
@@ -417,6 +426,10 @@ struct UrlData {
|
||||
curl_progress_callback fprogress;
|
||||
void *progress_client; /* pointer to pass to the progress callback */
|
||||
|
||||
/* function to call instead of the internal for password */
|
||||
curl_passwd_callback fpasswd;
|
||||
void *passwd_client; /* pointer to pass to the passwd callback */
|
||||
|
||||
long timeout; /* in seconds, 0 means no timeout */
|
||||
long infilesize; /* size of file to upload, -1 means unknown */
|
||||
|
||||
@@ -438,8 +451,6 @@ struct UrlData {
|
||||
|
||||
char *cookie; /* HTTP cookie string to send */
|
||||
|
||||
short use_ssl; /* use ssl encrypted communications */
|
||||
|
||||
char *newurl; /* This can only be set if a Location: was in the
|
||||
document headers */
|
||||
|
||||
@@ -451,12 +462,8 @@ struct UrlData {
|
||||
|
||||
struct CookieInfo *cookies;
|
||||
|
||||
long ssl_version; /* what version the client wants to use */
|
||||
#ifdef USE_SSLEAY
|
||||
SSL_CTX* ctx;
|
||||
SSL* ssl;
|
||||
X509* server_cert;
|
||||
#endif /* USE_SSLEAY */
|
||||
struct ssldata ssl; /* this is for ssl-stuff */
|
||||
|
||||
long crlf;
|
||||
struct curl_slist *quote; /* before the transfer */
|
||||
struct curl_slist *postquote; /* after the transfer */
|
||||
@@ -503,6 +510,8 @@ struct UrlData {
|
||||
#ifdef KRB4
|
||||
FILE *cmdchannel;
|
||||
#endif
|
||||
|
||||
struct timeval keeps_speed; /* this should be request-specific */
|
||||
};
|
||||
|
||||
#define LIBCURL_NAME "libcurl"
|
||||
|
@@ -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"
|
||||
|
||||
|
38
maketgz
38
maketgz
@@ -62,25 +62,25 @@ findprog()
|
||||
# brand new version number:
|
||||
#
|
||||
|
||||
if { findprog autoconf >/dev/null 2>/dev/null; } then
|
||||
echo "- No autoconf found, we leave configure as it is"
|
||||
else
|
||||
# Replace version number in configure.in file:
|
||||
|
||||
CONF="configure.in"
|
||||
|
||||
sed 's/^AM_INIT_AUTOMAKE.*/AM_INIT_AUTOMAKE(curl,"'$version'")/g' $CONF >$CONF.new
|
||||
|
||||
# Save old file
|
||||
cp -p $CONF $CONF.old
|
||||
|
||||
# Make new configure.in
|
||||
mv $CONF.new $CONF
|
||||
|
||||
# Update the configure script
|
||||
echo "Runs autoconf"
|
||||
autoconf
|
||||
fi
|
||||
#if { findprog autoconf >/dev/null 2>/dev/null; } then
|
||||
# echo "- No autoconf found, we leave configure as it is"
|
||||
#else
|
||||
# # Replace version number in configure.in file:
|
||||
#
|
||||
# CONF="configure.in"
|
||||
#
|
||||
# sed 's/^AM_INIT_AUTOMAKE.*/AM_INIT_AUTOMAKE(curl,"'$version'")/g' $CONF >$CONF.new
|
||||
#
|
||||
# # Save old file
|
||||
# cp -p $CONF $CONF.old
|
||||
#
|
||||
# # Make new configure.in
|
||||
# mv $CONF.new $CONF
|
||||
#
|
||||
# # Update the configure script
|
||||
# echo "Runs autoconf"
|
||||
# autoconf
|
||||
#fi
|
||||
|
||||
############################################################################
|
||||
#
|
||||
|
100
memanalyze.pl
100
memanalyze.pl
@@ -24,7 +24,7 @@ while(<STDIN>) {
|
||||
$linenum = $2;
|
||||
$function = $3;
|
||||
|
||||
if($function =~ /free\(([0-9a-f]*)/) {
|
||||
if($function =~ /free\(0x([0-9a-f]*)/) {
|
||||
$addr = $1;
|
||||
if($sizeataddr{$addr} <= 0) {
|
||||
print "FREE ERROR: No memory allocated: $line\n";
|
||||
@@ -35,7 +35,7 @@ while(<STDIN>) {
|
||||
$getmem{$addr}=""; # forget after a good free()
|
||||
}
|
||||
}
|
||||
elsif($function =~ /malloc\((\d*)\) = ([0-9a-f]*)/) {
|
||||
elsif($function =~ /malloc\((\d*)\) = 0x([0-9a-f]*)/) {
|
||||
$size = $1;
|
||||
$addr = $2;
|
||||
$sizeataddr{$addr}=$size;
|
||||
@@ -43,7 +43,7 @@ while(<STDIN>) {
|
||||
|
||||
$getmem{$addr}="$source:$linenum";
|
||||
}
|
||||
elsif($function =~ /realloc\(([0-9a-f]*), (\d*)\) = ([0-9a-f]*)/) {
|
||||
elsif($function =~ /realloc\(0x([0-9a-f]*), (\d*)\) = 0x([0-9a-f]*)/) {
|
||||
$oldaddr = $1;
|
||||
$newsize = $2;
|
||||
$newaddr = $3;
|
||||
@@ -57,7 +57,7 @@ while(<STDIN>) {
|
||||
$getmem{$oldaddr}="";
|
||||
$getmem{$newaddr}="$source:$linenum";
|
||||
}
|
||||
elsif($function =~ /strdup\(([0-9a-f]*)\) \((\d*)\) = ([0-9a-f]*)/) {
|
||||
elsif($function =~ /strdup\(0x([0-9a-f]*)\) \((\d*)\) = 0x([0-9a-f]*)/) {
|
||||
# strdup(a5b50) (8) = df7c0
|
||||
|
||||
$dup = $1;
|
||||
@@ -72,6 +72,61 @@ while(<STDIN>) {
|
||||
print "Not recognized input line: $function\n";
|
||||
}
|
||||
}
|
||||
# FD url.c:1282 socket() = 5
|
||||
elsif($_ =~ /^FD ([^:]*):(\d*) (.*)/) {
|
||||
# generic match for the filename+linenumber
|
||||
$source = $1;
|
||||
$linenum = $2;
|
||||
$function = $3;
|
||||
|
||||
if($function =~ /socket\(\) = (\d*)/) {
|
||||
$filedes{$1}=1;
|
||||
$getfile{$1}="$source:$linenum";
|
||||
$openfile++;
|
||||
}
|
||||
elsif($function =~ /accept\(\) = (\d*)/) {
|
||||
$filedes{$1}=1;
|
||||
$getfile{$1}="$source:$linenum";
|
||||
$openfile++;
|
||||
}
|
||||
elsif($function =~ /sclose\((\d*)\)/) {
|
||||
if($filedes{$1} != 1) {
|
||||
print "Close without open: $line\n";
|
||||
}
|
||||
else {
|
||||
$filedes{$1}=0; # closed now
|
||||
$openfile--;
|
||||
}
|
||||
}
|
||||
}
|
||||
# FILE url.c:1282 fopen("blabla") = 0x5ddd
|
||||
elsif($_ =~ /^FILE ([^:]*):(\d*) (.*)/) {
|
||||
# generic match for the filename+linenumber
|
||||
$source = $1;
|
||||
$linenum = $2;
|
||||
$function = $3;
|
||||
|
||||
if($function =~ /fopen\(\"([^\"]*)\"\) = (\(nil\)|0x([0-9a-f]*))/) {
|
||||
if($2 eq "(nil)") {
|
||||
;
|
||||
}
|
||||
else {
|
||||
$fopen{$3}=1;
|
||||
$fopenfile{$3}="$source:$linenum";
|
||||
$fopens++;
|
||||
}
|
||||
}
|
||||
# fclose(0x1026c8)
|
||||
elsif($function =~ /fclose\(0x([0-9a-f]*)\)/) {
|
||||
if(!$fopen{$1}) {
|
||||
print "fclose() without fopen(): $line\n";
|
||||
}
|
||||
else {
|
||||
$fopen{$1}=0;
|
||||
$fopens--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "Not recognized prefix line: $line\n";
|
||||
}
|
||||
@@ -80,19 +135,32 @@ while(<STDIN>) {
|
||||
}
|
||||
}
|
||||
|
||||
if(0 == $totalmem) {
|
||||
print "No leak found\n";
|
||||
exit;
|
||||
}
|
||||
if($totalmem) {
|
||||
print "Leak detected: memory still allocated: $totalmem bytes\n";
|
||||
|
||||
print "Leak detected: memory still allocated: $totalmem bytes\n";
|
||||
|
||||
for(keys %sizeataddr) {
|
||||
$addr = $_;
|
||||
$size = $sizeataddr{$addr};
|
||||
if($size) {
|
||||
print "At $addr, there's $size bytes.\n";
|
||||
print " allocated by ".$getmem{$addr}."\n";
|
||||
for(keys %sizeataddr) {
|
||||
$addr = $_;
|
||||
$size = $sizeataddr{$addr};
|
||||
if($size) {
|
||||
print "At $addr, there's $size bytes.\n";
|
||||
print " allocated by ".$getmem{$addr}."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($openfile) {
|
||||
for(keys %filedes) {
|
||||
if($filedes{$_} == 1) {
|
||||
print "Open file descriptor created at ".$getfile{$_}."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($fopens) {
|
||||
print "Open FILE handles left at:\n";
|
||||
for(keys %fopen) {
|
||||
if($fopen{$_} == 1) {
|
||||
print "fopen() called at ".$fopenfile{$_}."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
5
packages/Linux/RPM/README
Normal file
5
packages/Linux/RPM/README
Normal file
@@ -0,0 +1,5 @@
|
||||
Author: Daniel (I'm not trustworthy, replace this!)
|
||||
|
||||
Paul Marquis's 'make_curl_rpm' script is a fine example on how to automate the
|
||||
jobs. You need to fill in your own name and email at least.
|
||||
|
@@ -1,26 +1,26 @@
|
||||
%define ver @VERSION@
|
||||
%define ver 7.4.2
|
||||
%define rel 1
|
||||
%define prefix /usr
|
||||
|
||||
Summary: get a file from a FTP, GOPHER or HTTP server.
|
||||
Name: @PACKAGE@-ssl
|
||||
Name: curl-ssl
|
||||
Version: %ver
|
||||
Release: %rel
|
||||
Copyright: MPL
|
||||
Group: Utilities/Console
|
||||
Source: @PACKAGE@-%{version}.tar.gz
|
||||
URL: http://@PACKAGE@.haxx.se
|
||||
Source: curl-%{version}.tar.gz
|
||||
URL: http://curl.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
|
||||
curl-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,
|
||||
curl-ssl offers a busload of useful tricks like proxy support,
|
||||
user authentication, ftp upload, HTTP post, file transfer
|
||||
resume and more.
|
||||
|
||||
@@ -31,7 +31,7 @@ Authors:
|
||||
|
||||
|
||||
%prep
|
||||
%setup -n @PACKAGE@-@VERSION@
|
||||
%setup -n %{name}-%{version}
|
||||
|
||||
|
||||
%build
|
||||
@@ -74,7 +74,7 @@ find ${RPM_BUILD_ROOT}%{prefix} -type f | sed -e "s#^${RPM_BUILD_ROOT}##g" >> fi
|
||||
|
||||
|
||||
%clean
|
||||
(cd ..; rm -rf @PACKAGE@-@VERSION@ ${RPM_BUILD_ROOT})
|
||||
(cd ..; rm -rf curl-7.4.2 ${RPM_BUILD_ROOT})
|
||||
|
||||
|
||||
%files -f file-lists
|
||||
@@ -90,7 +90,7 @@ find ${RPM_BUILD_ROOT}%{prefix} -type f | sed -e "s#^${RPM_BUILD_ROOT}##g" >> fi
|
||||
%doc MPL-1.0.txt
|
||||
%doc README
|
||||
%doc README.curl
|
||||
%doc README.lib@PACKAGE@
|
||||
%doc README.libcurl
|
||||
%doc RESOURCES
|
||||
%doc TODO
|
||||
%doc %{name}-ssl.spec.in
|
@@ -1,25 +1,25 @@
|
||||
%define ver @VERSION@
|
||||
%define ver 7.4.2
|
||||
%define rel 1
|
||||
%define prefix /usr
|
||||
|
||||
Summary: get a file from a FTP, GOPHER or HTTP server.
|
||||
Name: @PACKAGE@
|
||||
Name: curl
|
||||
Version: %ver
|
||||
Release: %rel
|
||||
Copyright: MPL
|
||||
Group: Utilities/Console
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
URL: http://@PACKAGE@.haxx.se
|
||||
URL: http://curl.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
|
||||
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.
|
||||
|
||||
@PACKAGE@ offers a busload of useful tricks like proxy support,
|
||||
curl offers a busload of useful tricks like proxy support,
|
||||
user authentication, ftp upload, HTTP post, file transfer
|
||||
resume and more.
|
||||
|
||||
@@ -88,7 +88,7 @@ find ${RPM_BUILD_ROOT}%{prefix} -type f | sed -e "s#^${RPM_BUILD_ROOT}##g" >> fi
|
||||
%doc MPL-1.0.txt
|
||||
%doc README
|
||||
%doc README.curl
|
||||
%doc README.lib@PACKAGE@
|
||||
%doc README.libcurl
|
||||
%doc RESOURCES
|
||||
%doc TODO
|
||||
%doc %{name}-ssl.spec.in
|
62
packages/Linux/RPM/make_curl_rpm
Normal file
62
packages/Linux/RPM/make_curl_rpm
Normal file
@@ -0,0 +1,62 @@
|
||||
#! /bin/sh
|
||||
# script to build curl RPM from src RPM (SSL and non-SSL versions)
|
||||
|
||||
# initialize
|
||||
top_dir=/usr/src/redhat
|
||||
sources_dir=$top_dir/SOURCES
|
||||
specs_dir=$top_dir/SPECS
|
||||
rpms_dir=$top_dir/RPMS
|
||||
arch=`rpm --showrc | awk 'NF == 3 && $2 == "_arch" { print $3 }'`
|
||||
|
||||
# fill in your own name and email here
|
||||
packager_name="Mr Joe Packager Person"
|
||||
packager_email='<Joe@packager.person>'
|
||||
|
||||
# make sure we're running as root
|
||||
if test `id -u` -ne `id -u root`
|
||||
then
|
||||
echo "you must build the RPM as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# get version and release number
|
||||
if test $# -lt 1
|
||||
then
|
||||
echo "version number?"
|
||||
read version
|
||||
else
|
||||
version=$1
|
||||
fi
|
||||
|
||||
if test $# -lt 2
|
||||
then
|
||||
echo "release number?"
|
||||
read release
|
||||
else
|
||||
release=$2
|
||||
fi
|
||||
|
||||
# build all the files
|
||||
targets="curl curl-ssl"
|
||||
for target in $targets
|
||||
do
|
||||
# make sure src RPM exist
|
||||
src_rpm="$target-$version-$release.src.rpm"
|
||||
if test -f $src_rpm
|
||||
then
|
||||
rpm -ivh $src_rpm
|
||||
|
||||
# replace packager in spec file
|
||||
sed -e 's/^Packager: .*/Packager: $packager_name $packager_email/' $specs_dir/$target.spec > $specs_dir/$target-$version-$arch.spec
|
||||
|
||||
# build it
|
||||
if ! rpm -ba $specs_dir/$target-$version-$arch.spec
|
||||
then
|
||||
echo "error building $target for $arch -- check output above"
|
||||
fi
|
||||
|
||||
echo "$target rpm is now in $rpms_dir/$arch"
|
||||
else
|
||||
echo $src_rpm does not exist
|
||||
fi
|
||||
done
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user