pax_global_header00006660000000000000000000000064151743200260014512gustar00rootroot0000000000000052 comment=a0c7c3abb336f0309e95495fcfcf52fafe1f93df guile-curl-0.10/000077500000000000000000000000001517432002600135025ustar00rootroot00000000000000guile-curl-0.10/.github/000077500000000000000000000000001517432002600150425ustar00rootroot00000000000000guile-curl-0.10/.github/workflows/000077500000000000000000000000001517432002600170775ustar00rootroot00000000000000guile-curl-0.10/.github/workflows/ubuntu-22-04.yml000066400000000000000000000022761517432002600216150ustar00rootroot00000000000000name: Ubuntu 22.04 LTS w/ Guile 3.0 on: push: branches: [ master ] pull_request: branches: [ master ] jobs: build: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - name: env run: export LANG=C.UTF-8 TERM=dumb VERBOSE=true DEBIAN_FRONTEND=noninteractive TZ=America/Los_Angeles - name: install packages run: sudo apt-get install -y curl libcurl4-openssl-dev guile-3.0-dev gnulib texlive - name: look for guile run: ls -l /usr/bin/gu* - name: make dist directory run: mkdir `pwd`/dist - name: bootstrap run: ./bootstrap - name: configure run: ./configure --with-gnu-filesystem-hierarchy --enable-hardening --prefix=`pwd`/dist - name: make run: make - name: make check run: make check - name: make install run: make install - name: make distcheck run: make distcheck - name: Archive production artifacts uses: actions/upload-artifact@v4 with: name: dist path: dist - name: Uncompress tarballs run: gunzip *.tar.gz - name: Archive tarball uses: actions/upload-artifact@v4 with: name: tarball path: ./*tar guile-curl-0.10/.github/workflows/ubuntu-24-04.yml000066400000000000000000000022761517432002600216170ustar00rootroot00000000000000name: Ubuntu 24.04 LTS w/ Guile 3.0 on: push: branches: [ master ] pull_request: branches: [ master ] jobs: build: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - name: env run: export LANG=C.UTF-8 TERM=dumb VERBOSE=true DEBIAN_FRONTEND=noninteractive TZ=America/Los_Angeles - name: install packages run: sudo apt-get install -y curl libcurl4-openssl-dev guile-3.0-dev gnulib texlive - name: look for guile run: ls -l /usr/bin/gu* - name: make dist directory run: mkdir `pwd`/dist - name: bootstrap run: ./bootstrap - name: configure run: ./configure --with-gnu-filesystem-hierarchy --enable-hardening --prefix=`pwd`/dist - name: make run: make - name: make check run: make check - name: make install run: make install - name: make distcheck run: make distcheck - name: Archive production artifacts uses: actions/upload-artifact@v4 with: name: dist path: dist - name: Uncompress tarballs run: gunzip *.tar.gz - name: Archive tarball uses: actions/upload-artifact@v4 with: name: tarball path: ./*tar guile-curl-0.10/.gitignore000066400000000000000000000013531517432002600154740ustar00rootroot00000000000000#* *.gz *.info *~ .#* .sc* /GNUmakefile /maint.mk INSTALL Makefile Makefile.in aclocal.m4 autom4te.cache/ build-aux/Makefile build-aux/Makefile.in build-aux/ar-lib build-aux/compile build-aux/config.guess build-aux/config.sub build-aux/depcomp build-aux/install-sh build-aux/ltmain.sh build-aux/mdate-sh build-aux/missing build-aux/test-driver build-aux/texinfo.tex config.h config.h.in config.log config.status configure doc/Makefile doc/Makefile.in doc/curl.info doc/stamp-vti doc/version.texi libtool m4/Makefile m4/Makefile.in m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 m4/pkg.m4 src/*.la src/*.lo src/*.o src/.deps/ src/.libs/ src/Makefile src/Makefile.in stamp-h1 test/.deps test/Makefile test/Makefile.in guile-curl-0.10/AUTHORS000066400000000000000000000000351517432002600145500ustar00rootroot00000000000000Mike Gran guile-curl-0.10/COPYING000077500000000000000000001045131517432002600145440ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . guile-curl-0.10/Makefile.am000066400000000000000000000101711517432002600155360ustar00rootroot00000000000000## Process this file with automake to produce Makefile.in # Copyright (C) 2011, 2013, 2021 Michael L. Gran # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . ACLOCAL_AMFLAGS = -I m4 --install ################# # Directories # ################# exampledir = $(datadir)/doc/guile-curl guilesitedir = $(datadir)/guile/site/$(GUILE_EFFECTIVE_VERSION) guileextensiondir = $(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/extensions ################# # Top Level # ################# ################# # Documentation # ################# info_TEXINFOS = doc/guile-curl.texi dist_example_DATA = doc/ex_http_simple_get.scm \ doc/ex_http_simple_get_utf8.scm \ doc/ex_http_web_response.scm # In make distcheck, avoid building a doc format that requires TeX. AM_DISTCHECK_DVI_TARGET = html ################### # libguile-curl # ################### guileextension_LTLIBRARIES = src/libguile-curl.la src_libguile_curl_la_c_sources = \ src/const.c \ src/type.c \ src/func.c \ src/main.c src_libguile_curl_la_internal_headers = \ src/visibility.h \ src/const.h \ src/type.h \ src/func.h src_libguile_curl_la_SOURCES = \ $(src_libguile_curl_la_internal_headers) \ $(src_libguile_curl_la_c_sources) AM_CFLAGS = \ $(CURL_CFLAGS) \ $(GUILE_CFLAGS) ETAGS_ARGS = src/curl.scm src_libguile_curl_la_LDFLAGS = \ -version-info $(LIBGUILE_CURL_INTERFACE) src_libguile_curl_la_LIBADD = $(CURL_LIBS) $(GUILE_LIBS) if BUILDING_DLL AM_CFLAGS += -DCL_DLL -DCL_DLL_EXPORTS src_libguile_curl_la_LDFLAGS += -no-undefined # For MinGW, force the dll to be installed in $(guileextensiondir) # instead of $(guileextensiondir)/../bin src_libguile_curl_la_LDFLAGS += -bindir $(DESTDIR)$(guileextensiondir) endif if !DLL_VERSION_INFO src_libguile_curl_la_LDFLAGS += -avoid-version endif ################# # Guile Modules # ################# dist_guilesite_DATA = \ module/curl.scm if GUILD $(top_builddir)/module/curl.go: $(top_builddir)/src/libguile-curl.la guileobject_DATA = \ $(dist_guilesite_DATA:%.scm=%.go) GUILEC_FLAGS = \ -O2 \ -Warity-mismatch \ -Wformat \ -Wmacro-use-before-definition \ -Wunbound-variable \ --load-path=$(abs_srcdir)/module \ --load-path=$(abs_builddir)/module .scm.go: GUILE_AUTO_COMPILE=0 \ LTDL_LIBRARY_PATH=$(abs_builddir)/src/.libs \ $(GUILD) compile --target="$(host)" $(GUILEC_FLAGS) \ -o "$@" "$<" endif ################# # Tests # ################# TEST_EXTENSIONS = .scm TESTS_LTDLOPEN = -dlopen ${abs_top_builddir}/src/libguile-curl.la TESTS = \ test/bytevectors.scm \ test/setopt.scm \ test/stress.scm \ test/getinfo.scm SCM_LOG_DRIVER = \ $(top_builddir)/libtool $(TESTS_LTDLOPEN) --mode=execute \ $(GUILE) --no-auto-compile \ -L $(abs_srcdir)/module \ -L $(abs_builddir)/module \ $(top_srcdir)/build-aux/test-driver.scm LOG_DRIVER = \ $(top_srcdir)/build-aux/test-driver check_PROGRAMS = check_type check_type_SOURCES = \ test/check_type.c \ $(src_libguile_curl_la_SOURCES) check_type_CFLAGS = $(CURL_CFLAGS) $(GUILE_CFLAGS) check_type_LDFLAGS = $(CURL_LIBS) $(GUILE_LIBS) TESTS += check_type test: check ################# # Variables # ################# CLEANFILES = \ doc/guile-gi.dvi \ examples/resources/test.gresource \ $(guileobject_DATA) $(pkgguileobject_DATA) $(scriptguileobject_DATA) \ $(BUILT_SOURCES) \ $(check_DATA) \ *.log EXTRA_DIST = \ AUTHORS \ NEWS \ README \ COPYING \ TODO \ m4/guile.m4 \ build-aux/texinfo.tex \ build-aux/ar-lib build-aux/compile build-aux/missing \ build-aux/test-driver build-aux/test-driver.scm \ build-aux/config.rpath \ $(TESTS) \ test/profile.scm SUFFIXES = guile-curl-0.10/NEWS000066400000000000000000000030051517432002600141770ustar00rootroot00000000000000For Release 0.9 - Jan 19, 2021 - Speed up bv->url-encoded-bytevector - Improve reliability of parallel builds For Release 0.8 - Jan 11, 2021 - Eliminate all traces of gnulib - Use srfi-64 for test scripts - Avoid recursive automake - Simplify build somewhat - When CURL constants and enums are not present, the Guile versions will be #f, instead of undefined now. - Use pkg-config instead of curl-config to gather information about the libcurl install - Remove ChangeLog For Release 0.7 - Jan 1, 2021 - Eliminate Guile 2.0 support - Allow Guile 3.0 support - Update gnulib For Release 0.6 - Feb 15, 2019 - Eliminate Guile 1.8 support - Update to libcurl 7.61.x constant - guilesitedir become guilemoduledir - follow guile-hall's guidance of how guile directories are formed - load unversioned libguile-curl library in curl.scm For Release 0.5 - April 8, 2017 - Fix configure to search for Guile 2.2.x. For Release 0.4 - Oct 23, 2016 - Fix GC with Guile 2.0.12+ - Add support for readdata option For Release 0.3 - Oct 2, 2014 - Fix bad memory allocation for POSTFIELDS - More tests For Release 0.2 - Feb 16, 2013 - Update to recent curl library - Add support for all current options, including those that take slist and httppost - Fix guile-1.8 and guile-2.0 specific functionality - Fixes for i386-unknown-openbsd5.2 - New debugging function %curl-dump-handle For Release 0.1 - Initial release guile-curl-0.10/README000066400000000000000000000011061517432002600143600ustar00rootroot00000000000000guile-curl is a project that has procedures that allow Guile to do client-side URL transfers, like requesting documents from http or ftp servers. It is based on the libcurl library. If trying to build this from the repository instead of a tarball, you'll need to run 'autoreconf -vi'. There is a 'bootstrap' script, but, it is just a call to 'autoreconf'. This is an autotools build, so usually building is a "./configure && make && make install" sort of thing. For information on how to use it, there is a manual in the doc/ directory. Regards, Mike Gran guile-curl-0.10/README-hacking000066400000000000000000000007111517432002600157630ustar00rootroot00000000000000Notes on hacking guile-curl =========================== To get bootstrap to work on OpenBSD 1. create a sha1sum program in /usr/bin with the following script #!/bin/sh if test "x$1" = "x--version"; then echo "0.0"; exit 0; else sha1 -r $1; fi 2. pkg_add libtool (version 2.4.2) pkg_add autoconf (version 2.68) pkg_add automake (version 1.11.5p1) 3. set some environment variables export AUTOCONF_VERSION=2.68 export AUTOMAKE_VERSION=1.11 guile-curl-0.10/TODO000066400000000000000000000003151517432002600141710ustar00rootroot00000000000000TODO ** update to libcurl v8.x ** httppost needs multiple file sections ** httppost needs content headers ** handle CURLINFO_TLS_SSL_PTR ** handle CURLINFO_CERTINFO ** test and document curl_easy_getinfo guile-curl-0.10/bootstrap000077500000000000000000000000311517432002600154370ustar00rootroot00000000000000#!/bin/sh autoreconf -vi guile-curl-0.10/build-aux/000077500000000000000000000000001517432002600153745ustar00rootroot00000000000000guile-curl-0.10/build-aux/config.rpath000077500000000000000000000442161517432002600177130ustar00rootroot00000000000000#! /bin/sh # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # # Copyright 1996-2021 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit , 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # The first argument passed to this file is the canonical host specification, # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld # should be set by the caller. # # The set of defined variables is at the end of this script. # Known limitations: # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer # than 256 bytes, otherwise the compiler driver will dump core. The only # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a shrext=.so host="$1" host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # Code taken from libtool.m4's _LT_CC_BASENAME. for cc_temp in $CC""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` # Code taken from libtool.m4's _LT_COMPILER_PIC. wl= if test "$GCC" = yes; then wl='-Wl,' else case "$host_os" in aix*) wl='-Wl,' ;; mingw* | cygwin* | pw32* | os2* | cegcc*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' ;; irix5* | irix6* | nonstopux*) wl='-Wl,' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in ecc*) wl='-Wl,' ;; icc* | ifort*) wl='-Wl,' ;; lf95*) wl='-Wl,' ;; nagfor*) wl='-Wl,-Wl,,' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) wl='-Wl,' ;; ccc*) wl='-Wl,' ;; xl* | bgxl* | bgf* | mpixl*) wl='-Wl,' ;; como) wl='-lopt=' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) wl= ;; *Sun\ C*) wl='-Wl,' ;; esac ;; esac ;; newsos6) ;; *nto* | *qnx*) ;; osf3* | osf4* | osf5*) wl='-Wl,' ;; rdos*) ;; solaris*) case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) wl='-Qoption ld ' ;; *) wl='-Wl,' ;; esac ;; sunos4*) wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3*) wl='-Wl,' ;; sysv4*MP*) ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) wl='-Wl,' ;; unicos*) wl='-Wl,' ;; uts4*) ;; esac fi # Code taken from libtool.m4's _LT_LINKER_SHLIBS. hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no case "$host_os" in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. # Unlike libtool, we use -rpath here, not --rpath, since the documented # option of GNU ld is called -rpath, not --rpath. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' case "$host_os" in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no fi ;; amigaos*) case "$host_cpu" in powerpc) ;; m68k) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then : else ld_shlibs=no fi ;; haiku*) ;; interix[3-9]*) hardcode_direct=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; netbsd*) ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' else ld_shlibs=no fi ;; esac ;; sunos4*) hardcode_direct=yes ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then hardcode_libdir_flag_spec= fi else case "$host_os" in aix3*) # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac fi hardcode_direct=yes hardcode_libdir_separator=':' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac fi # Begin _LT_AC_SYS_LIBPATH_AIX. echo 'int main () { return 0; }' > conftest.c ${CC} ${LDFLAGS} conftest.c -o conftest aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` fi if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib" fi rm -f conftest.c conftest # End _LT_AC_SYS_LIBPATH_AIX. if test "$aix_use_runtimelinking" = yes; then hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' else hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" fi fi ;; amigaos*) case "$host_cpu" in powerpc) ;; m68k) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' libext=lib ;; darwin* | rhapsody*) hardcode_direct=no if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then : else ld_shlibs=no fi ;; dgux*) hardcode_libdir_flag_spec='-L$libdir' ;; freebsd2.[01]*) hardcode_direct=yes hardcode_minus_L=yes ;; freebsd* | dragonfly*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; hpux9*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; hpux10*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no ;; *) hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; newsos6) hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then hardcode_libdir_flag_spec='${wl}-rpath,$libdir' else case "$host_os" in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) hardcode_libdir_flag_spec='-R$libdir' ;; *) hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; osf3*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) if test "$GCC" = yes; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else # Both cc and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) hardcode_libdir_flag_spec='-R$libdir' ;; sunos4*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; sysv4) case $host_vendor in sni) hardcode_direct=yes # is this really true??? ;; siemens) hardcode_direct=no ;; motorola) hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac ;; sysv4.3*) ;; sysv4*MP*) if test -d /usr/nec; then ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) ;; sysv5* | sco3.2v5* | sco5v6*) hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' ;; uts4*) hardcode_libdir_flag_spec='-L$libdir' ;; *) ld_shlibs=no ;; esac fi # Check dynamic linker characteristics # Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. # Unlike libtool.m4, here we don't care about _all_ names of the library, but # only about the one the linker finds when passed -lNAME. This is the last # element of library_names_spec in libtool.m4, or possibly two of them if the # linker has special search rules. library_names_spec= # the last element of library_names_spec in libtool.m4 libname_spec='lib$name' case "$host_os" in aix3*) library_names_spec='$libname.a' ;; aix[4-9]*) library_names_spec='$libname$shrext' ;; amigaos*) case "$host_cpu" in powerpc*) library_names_spec='$libname$shrext' ;; m68k) library_names_spec='$libname.a' ;; esac ;; beos*) library_names_spec='$libname$shrext' ;; bsdi[45]*) library_names_spec='$libname$shrext' ;; cygwin* | mingw* | pw32* | cegcc*) shrext=.dll library_names_spec='$libname.dll.a $libname.lib' ;; darwin* | rhapsody*) shrext=.dylib library_names_spec='$libname$shrext' ;; dgux*) library_names_spec='$libname$shrext' ;; freebsd[23].*) library_names_spec='$libname$shrext$versuffix' ;; freebsd* | dragonfly*) library_names_spec='$libname$shrext' ;; gnu*) library_names_spec='$libname$shrext' ;; haiku*) library_names_spec='$libname$shrext' ;; hpux9* | hpux10* | hpux11*) case $host_cpu in ia64*) shrext=.so ;; hppa*64*) shrext=.sl ;; *) shrext=.sl ;; esac library_names_spec='$libname$shrext' ;; interix[3-9]*) library_names_spec='$libname$shrext' ;; irix5* | irix6* | nonstopux*) library_names_spec='$libname$shrext' case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; *) libsuff= shlibsuff= ;; esac ;; esac ;; linux*oldld* | linux*aout* | linux*coff*) ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) library_names_spec='$libname$shrext' ;; knetbsd*-gnu) library_names_spec='$libname$shrext' ;; netbsd*) library_names_spec='$libname$shrext' ;; newsos6) library_names_spec='$libname$shrext' ;; *nto* | *qnx*) library_names_spec='$libname$shrext' ;; openbsd*) library_names_spec='$libname$shrext$versuffix' ;; os2*) libname_spec='$name' shrext=.dll library_names_spec='$libname.a' ;; osf3* | osf4* | osf5*) library_names_spec='$libname$shrext' ;; rdos*) ;; solaris*) library_names_spec='$libname$shrext' ;; sunos4*) library_names_spec='$libname$shrext$versuffix' ;; sysv4 | sysv4.3*) library_names_spec='$libname$shrext' ;; sysv4*MP*) library_names_spec='$libname$shrext' ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) library_names_spec='$libname$shrext' ;; tpf*) library_names_spec='$libname$shrext' ;; uts4*) library_names_spec='$libname$shrext' ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>$log_file # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: guile-curl-0.10/build-aux/test-driver.scm000066400000000000000000000224111517432002600203500ustar00rootroot00000000000000;;;; test-driver.scm - Guile test driver for Automake testsuite harness (define script-version "2018-03-25.05") ;UTC ;;; Copyright © 2015-2018 Free Software Foundation, Inc. ;;; ;;; This program is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see . ;;;; Commentary: ;;; ;;; This script provides a Guile test driver using the SRFI-64 Scheme API for ;;; test suites. SRFI-64 is distributed with Guile since version 2.0.9. ;;; ;;; To use it, you have to manually copy this file in the ‘build-aux’ ;;; directory of your package, then adapt the following snippets to your ;;; actual needs: ;;; ;;; configure.ac: ;;; AC_CONFIG_AUX_DIR([build-aux]) ;;; AC_REQUIRE_AUX_FILE([test-driver.scm]) ;;; AC_PATH_PROG([GUILE], [guile]) ;;; ;;; Makefile.am ;;; TEST_LOG_DRIVER = $(GUILE) $(top_srcdir)/build-aux/test-driver.scm ;;; AM_TESTS_ENVIRONMENT = env GUILE_AUTO_COMPILE='0' ;;; TESTS = foo.test ;;; EXTRA_DIST = $(TESTS) ;;; ;;; foo.test ;;; (use-modules (srfi srfi-64)) ;;; (test-begin "foo") ;;; (test-assert "assertion example" #t) ;;; (test-end "foo") ;;; ;;; See for general ;;; information about SRFI-64 usage. ;;; ;;;; Code: (use-modules (ice-9 getopt-long) (ice-9 match) (ice-9 pretty-print) (srfi srfi-11) (srfi srfi-26) (srfi srfi-64) (system vm coverage) (system vm vm)) (define (show-help) (display "Usage: test-driver --test-name=NAME --log-file=PATH --trs-file=PATH [--expect-failure={yes|no}] [--color-tests={yes|no}] [--enable-hard-errors={yes|no}] [--brief={yes|no}}] [--coverage={yes|no}] [--] TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] The '--test-name', '--log-file' and '--trs-file' options are mandatory.\n")) (define %options '((test-name (value #t)) (log-file (value #t)) (trs-file (value #t)) (color-tests (value #t)) (expect-failure (value #t)) ;XXX: not implemented yet (enable-hard-errors (value #t)) ;not implemented in SRFI-64 (coverage (value #t)) (brief (value #t)) (help (single-char #\h) (value #f)) (version (single-char #\V) (value #f)))) (define (option->boolean options key) "Return #t if the value associated with KEY in OPTIONS is \"yes\"." (and=> (option-ref options key #f) (cut string=? <> "yes"))) (define* (test-display field value #:optional (port (current-output-port)) #:key pretty?) "Display \"FIELD: VALUE\\n\" on PORT." (if pretty? (begin (format port "~A:~%" field) (pretty-print value port #:per-line-prefix "+ ")) (format port "~A: ~S~%" field value))) (define* (result->string symbol #:key colorize?) "Return SYMBOL as an upper case string. Use colors when COLORIZE is #t." (let ((result (string-upcase (symbol->string symbol)))) (if colorize? (string-append (case symbol ((pass) "") ;green ((xfail) "") ;light green ((skip) "") ;blue ((fail xpass) "") ;red ((error) "")) ;magenta result "") ;no color result))) (define* (test-runner-gnu test-name #:key color? brief? out-port trs-port) "Return an custom SRFI-64 test runner. TEST-NAME is a string specifying the file name of the current the test. COLOR? specifies whether to use colors, and BRIEF?, well, you know. OUT-PORT and TRS-PORT must be output ports. The current output port is supposed to be redirected to a '.log' file." (define (test-on-test-begin-gnu runner) ;; Procedure called at the start of an individual test case, before the ;; test expression (and expected value) are evaluated. (let ((result (cute assq-ref (test-result-alist runner) <>))) (format #t "test-name: ~A~%" (result 'test-name)) (format #t "location: ~A~%" (string-append (result 'source-file) ":" (number->string (result 'source-line)))) (test-display "source" (result 'source-form) #:pretty? #t))) (define (test-on-test-end-gnu runner) ;; Procedure called at the end of an individual test case, when the result ;; of the test is available. (let* ((results (test-result-alist runner)) (result? (cut assq <> results)) (result (cut assq-ref results <>))) (unless brief? ;; Display the result of each test case on the console. (format out-port "~A: ~A - ~A~%" (result->string (test-result-kind runner) #:colorize? color?) test-name (test-runner-test-name runner))) (when (result? 'expected-value) (test-display "expected-value" (result 'expected-value))) (when (result? 'expected-error) (test-display "expected-error" (result 'expected-error) #:pretty? #t)) (when (result? 'actual-value) (test-display "actual-value" (result 'actual-value))) (when (result? 'actual-error) (test-display "actual-error" (result 'actual-error) #:pretty? #t)) (format #t "result: ~a~%" (result->string (result 'result-kind))) (newline) (format trs-port ":test-result: ~A ~A~%" (result->string (test-result-kind runner)) (test-runner-test-name runner)))) (define (test-on-group-end-gnu runner) ;; Procedure called by a 'test-end', including at the end of a test-group. (let ((fail (or (positive? (test-runner-fail-count runner)) (positive? (test-runner-xpass-count runner)))) (skip (or (positive? (test-runner-skip-count runner)) (positive? (test-runner-xfail-count runner))))) ;; XXX: The global results need some refinements for XPASS. (format trs-port ":global-test-result: ~A~%" (if fail "FAIL" (if skip "SKIP" "PASS"))) (format trs-port ":recheck: ~A~%" (if fail "yes" "no")) (format trs-port ":copy-in-global-log: ~A~%" (if (or fail skip) "yes" "no")) (when brief? ;; Display the global test group result on the console. (format out-port "~A: ~A~%" (result->string (if fail 'fail (if skip 'skip 'pass)) #:colorize? color?) test-name)) #f)) (let ((runner (test-runner-null))) (test-runner-on-test-begin! runner test-on-test-begin-gnu) (test-runner-on-test-end! runner test-on-test-end-gnu) (test-runner-on-group-end! runner test-on-group-end-gnu) (test-runner-on-bad-end-name! runner test-on-bad-end-name-simple) runner)) ;;; ;;; Entry point. ;;; (let* ((opts (getopt-long (command-line) %options)) (option (cut option-ref opts <> <>))) (cond ((option 'help #f) (show-help)) ((option 'version #f) (format #t "test-driver.scm ~A" script-version)) (else (match (option '() '()) (() (display "missing test script argument\n" (current-error-port)) (exit 1)) ((script . args) (let ((log (open-file (option 'log-file "") "w0")) (trs (open-file (option 'trs-file "") "wl")) (out (duplicate-port (current-output-port) "wl"))) (define (check) (test-with-runner (test-runner-gnu (option 'test-name #f) #:color? (option->boolean opts 'color-tests) #:brief? (option->boolean opts 'brief) #:out-port out #:trs-port trs) (primitive-load script))) (redirect-port log (current-output-port)) (redirect-port log (current-warning-port)) (redirect-port log (current-error-port)) (if (not (option->boolean opts 'coverage)) (check) (begin ;; The debug engine is required for tracing coverage data. (set-vm-engine! 'debug) (let-values (((data result) (with-code-coverage check))) (let* ((file (string-append (option 'test-name #f) ".info")) (port (open-output-file file))) (coverage-data->lcov data port) (close port))))) (close-port log) (close-port trs) (close-port out)))))) (exit 0)) ;;; Local Variables: ;;; eval: (add-hook 'before-save-hook 'time-stamp) ;;; time-stamp-start: "(define script-version \"" ;;; time-stamp-format: "%:y-%02m-%02d.%02H" ;;; time-stamp-time-zone: "UTC0" ;;; time-stamp-end: "\") ;UTC" ;;; End: ;;;; test-driver.scm ends here. guile-curl-0.10/configure.ac000066400000000000000000000115451517432002600157760ustar00rootroot00000000000000# Process this file with autoconf to produce a configure script # Copyright 2001, 2013, 2014, 2016, 2017, 2019, 2021, 2025 Michael L Gran # This file is part of guile-curl. # guile-curl is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # guile-curl is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with guile-curl. If not, see . ################## # Package info AC_PREREQ([2.71]) AC_INIT([guile_curl],[0.10],[spk121@yahoo.com]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([no-dependencies subdir-objects -Wall foreign]) PKG_PROG_PKG_CONFIG AC_PROG_CC AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) ################## # Set some version constants LIBGUILE_CURL_MAJOR=2 LIBGUILE_CURL_INTERFACE="2:2:0" AC_SUBST(LIBGUILE_CURL_MAJOR) AC_SUBST(LIBGUILE_CURL_INTERFACE) ################## # Check for Programs AC_CANONICAL_HOST AC_PROG_INSTALL AM_PROG_AR LT_INIT([disable-fast-install win32-dll disable-static shared]) AC_PROG_MKDIR_P ################## # Initial guess of platform specific options AS_CASE([$host_os], [mingw*], [building_dll=yes;dll_version_info=no], [cygwin*], [building_dll=yes;dll_version_info=no], [pw32*], [building_dll=yes;dll_version_info=yes], [cegcc*], [building_dll=yes;dll_version_info=yes], [building_dll=no;dll_version_info=yes]) AM_CONDITIONAL([BUILDING_DLL], [test "$building_dll" = yes]) AM_CONDITIONAL([DLL_VERSION_INFO], [test "$dll_version_info" = yes]) ################## # Check for libraries PKG_CHECK_MODULES(CURL, [libcurl]) GUILE_PKG([3.0 2.2]) GUILE_PROGS GUILE_FLAGS GUILE_SITE_DIR dnl Installation directories for .scm and .go files. guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION" guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache" guileextensiondir=${libdir}/guile/$GUILE_EFFECTIVE_VERSION/extensions AC_SUBST([guilemoduledir]) AC_SUBST([guileobjectdir]) AC_SUBST([guileextensiondir]) AC_ARG_ENABLE([guild], [AS_HELP_STRING([--disable-guild], [don't compile guile sources])], [AS_CASE(["${enableval}"], [yes], [guild=true], [no], [guild=false], [AC_MSG_ERROR([bad value ${enableval} for --enable-guild])])], [guild=true]) AM_CONDITIONAL([GUILD], [test x$guild = xtrue]) ################## # Check for header files tmp_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $CURL_CFLAGS $GUILE_CFLAGS" AC_CHECK_HEADER([curl/curl.h], , [AC_MSG_ERROR([ was not found])]) AC_CHECK_HEADERS([libguile.h], , [AC_MSG_ERROR([ was not found])]) CPPFLAGS="$tmp_CPPFLAGS" ################## # Check for types, structures, compiler characteristics m4_define([compiler_flags_common],[ dnl -D_FORTIFY_SOURCE=2 dnl -DSCM_DEBUG_TYPING_STRICTNESS=2 dnl -O2 dnl -pipe dnl -g dnl -grecord-gcc-switches dnl -Wall dnl -Werror=format-security dnl -Werror=implicit-function-declaration dnl -Werror=shadow dnl -fno-omit-frame-pointer dnl -fasynchronous-unwind-tables dnl -fexceptions dnl -fvar-tracking dnl -fstack-protector-strong dnl -fstack-clash-protection dnl -fcf-protection dnl -fplugin=annobin dnl -Wl,--dynamic-list-data dnl -Wl,-z,defs dnl -Wl,-z,now dnl -Wl,-z,relro dnl -Wsuggest-attribute=format dnl -Wsuggest-attribute=malloc dnl -Wsuggest-attribute=noreturn dnl -Wsuggest-attribute=pure dnl -fdiagnostics-color=auto dnl ]) AC_ARG_ENABLE([hardening], [AS_HELP_STRING([--enable-hardening], [compile with common hardening flags])]) AS_IF([test "x$enable_hardening" = xyes], [CC_CHECK_CFLAGS_APPEND([compiler_flags_common])]) ################## # Check for library functions ################## # Check for system services ################## # Output AC_CONFIG_FILES([Makefile]) AC_OUTPUT if test "$guilemoduledir" != "$GUILE_SITE"; then # Guile has a different prefix than this module AC_MSG_WARN([] [The Guile modules will be installed in '${guilemoduledir}'.] [This Guile expects them in ${GUILE_SITE}.] [If these differ, you may have to adjust the `GUILE_LOAD_PATH' environment] [variable.]) fi if test "x$GUILE_EXTENSION" != "x"; then if test "$guileextensiondir" != "$GUILE_EXTENSION"; then AC_MSG_WARN([] [The Guile extensions will be installed in ${guileextensiondir}.] [This Guile expects them in ${GUILE_EXTENSION}.]) fi fi guile-curl-0.10/doc/000077500000000000000000000000001517432002600142475ustar00rootroot00000000000000guile-curl-0.10/doc/.gitignore000066400000000000000000000000161517432002600162340ustar00rootroot00000000000000/gpl-3.0.texi guile-curl-0.10/doc/ex_http_simple_get.scm000066400000000000000000000002731517432002600206400ustar00rootroot00000000000000;; This code requires Guile-1.8 or greater (use-modules (curl)) (define handle (curl-easy-init)) (curl-easy-setopt handle 'url "http://www.gnu.org") (display (curl-easy-perform handle)) guile-curl-0.10/doc/ex_http_simple_get_utf8.scm000066400000000000000000000003311517432002600216010ustar00rootroot00000000000000;; This code requires Guile-2.0+ (use-modules (curl)) (setlocale LC_ALL "") (define handle (curl-easy-init)) (curl-easy-setopt handle 'url "http://www.gnu.org") (display (utf8->string (curl-easy-perform handle #t))) guile-curl-0.10/doc/ex_http_web_response.scm000066400000000000000000000025761517432002600212130ustar00rootroot00000000000000;; This code requires Guile-2.0+ (use-modules (curl) (web response) (ice-9 pretty-print) (rnrs bytevectors)) (setlocale LC_ALL "") ;; Create a Curl handle (let ((handle (curl-easy-init))) ;; Set the URL from which to get the data (curl-easy-setopt handle 'url "https://twitter.com/") ;; Request that the HTTP headers be included in the response (curl-easy-setopt handle 'header #t) ;; Get the result as a Latin-1 string (let* ((response-string (curl-easy-perform handle)) ;; Create a string port from the response (response-port (open-input-string response-string)) ;; Have the (web response) module to parse the response (response (read-response response-port)) ;; Have the (web response) module extract the body from the ;; response (response-body (read-response-body response))) ;; Display the unpacked HTTP headers (display "Response header ----------") (newline) (write response) (newline) (newline) ;; Display information about the HTTP body (format #t "The body contains ~a bytes~%" (bytevector-length response-body)) (format #t "The body is of type ~A~%" (car (response-content-type response))) (format #t "The encoding of the body is ~A~%" (assoc-ref (response-content-type response) 'charset)))) guile-curl-0.10/doc/guile-curl.texi000066400000000000000000001377651517432002600172350ustar00rootroot00000000000000\input texinfo @c -*- Mode: texinfo; Fillcolumn: 70; -*- @c %**start of header @c Copyright @copyright{} 2007, 2011, 2013, 2014, 2019, 2025 Michael L. Gran @c Permission is hereby granted, free of charge, to any person obtaining a @c copy of these software and associated documentation files (the @c "Software"), to deal in the Software without restriction, including @c without limitation the rights to use, copy, modify, merge, publish, @c distribute, distribute with modifications, sublicense, and/or sell @c copies of the Software, and to permit persons to whom the Software is @c furnished to do so, subject to the following conditions: @c The above copyright notice and this permission notice shall be included @c in all copies or substantial portions of the Software. @c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS @c OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF @c MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @c IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, @c DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR @c OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR @c THE USE OR OTHER DEALINGS IN THE SOFTWARE. @c Except as contained in this notice, the name(s) of the above copyright @c holders shall not be used in advertising or otherwise to promote the @c sale, use or other dealings in this Software without prior written @c authorization. @setfilename guile-curl.info @include version.texi @settitle Curl @value{VERSION} @syncodeindex fn cp @syncodeindex vr cp @syncodeindex ky cp @syncodeindex pg cp @syncodeindex tp cp @c %**end of header @copying This manual is for @code{guile-curl}, a Guile net client library, (version @value{VERSION}, @value{UPDATED}). @code{guile-curl} provides bindings for the underlying libcurl library, which provides functionality for accessing files via urls. Copyright @copyright{} 2007, 2011, 2013, 2014, 2019, 2025 Michael L. Gran Includes portions of the libcurl documentation, which is Copyright @copyright{} 1998 - 2015 Daniel Stenberg, et al. @end copying @dircategory The Algorithmic Language Scheme @direntry * Guile Curl: (guile-curl). A URL-fetching library for Guile. @end direntry @titlepage @title A Guile Curl Library @subtitle For version @value{VERSION}, @value{UPDATED} @author Michael L. Gran @page @vskip 0pt plus 1filll @insertcopying @end titlepage @summarycontents @contents @ifnottex @node Top, Introduction, (dir), (dir) @top A Guile Curl Library @insertcopying @end ifnottex @menu * Introduction:: * Reference:: * Index:: @detailmenu --- The Detailed Node Listing --- Tutorial * Fetching from an HTTP server:: Fetching from an HTTP server * Performing the HTTP GET:: * Using web response procedures:: * Handling String Encodings:: Reference * Procedures:: * Options for setopt:: * Error Codes:: Options for setopt * Option Table:: * Option Data Types:: Option Data Types * Postfields:: * Integer Constants for protocols:: * Integer Constants for proxytype:: * Integer Constants for netrc:: * Integer Constants for httpauth:: * Integer Constants for postredir:: * Integer Constants for http-version:: * Integer Constants for ftpsslauth:: * Integer Constants for ftp-ssl-ccc:: * Integer Constants for ftp-filemethod:: * Integer Constants for rtsp-request:: * Integer Constants for sslversion:: * Integer Constants for ipresolve:: * Integer Constants for use-ssl:: * Integer Constants for gssapi-delegation:: * Integer Constants for ssh-auth-types:: @end detailmenu @end menu @node Introduction, Reference, Top, Top @chapter Tutorial This library has procedures that allow Guile to do client-side URL transfers, like requesting documents from http or ftp servers. It is based on the libcurl library. Before using these functions, you must first load the library. If the library built and installed correctly, you should be able to load the library in the usual way by using @code{(use-modules (curl))}. To transfer a file, you start off by creating a handle using @code{curl-easy-init}. @code{curl-easy-init} is a procecure that takes no arguments and returns a handle. The handle represents a single connection between computers using some standard protocol. The handle holds opaque information used by the underlying @code{libcurl} library, so displaying it or writing it doesn't produce much useful information beyond the location of a pointer in memory. Before the handle can be used, it must first be given information about the connection and transfer that it will do. The procedure @code{curl-easy-setopt} is used to tell this handle's connection how to behave. There are many dozens of options that can be set, but, at a minimum, it just needs a URL. Then, to initiate the transfer, the procedure @code{curl-easy-perform} is called. It can return the requested resource as either a bytevector or a string. If the data is returned as a string, no coding conversions will be performed, e.g., the program will presume that the data is in the Latin-1 encoding. @menu * Fetching from an HTTP server:: @end menu @node Fetching from an HTTP server, , Introduction, Introduction @section Fetching from an HTTP server Let's begin with the most familiar case: fetching data from a webserver. Guile 3.0 already has a nice set of functions to handle fetching from an HTTP server, so there is no need to use this library for simple use cases like this. But @code{guile-curl} may still be of value if you are trying to use @code{https} or POST or other more complicated HTTP requests. @menu * Performing the HTTP GET:: * Using web response procedures:: * Handling String Encodings:: @end menu @node Performing the HTTP GET, Using web response procedures, Fetching from an HTTP server, Fetching from an HTTP server @subsection Performing the HTTP GET The following code will get a web page from an HTTP server and the pass it as a string to the @code{display} procedure. @code{display} will write the string to the current output port. @lisp @verbatiminclude ex_http_simple_get.scm @end lisp The returned string is also read in as binary and put into a string of 8-bit, single byte characters. But, since Guile's characters are Unicode codepoints, this, in effect, means that the response was interpreted in the ISO-8859-1 (or Latin-1) encoding. You can also fetch the resource as a bytevector by adding the optional argument @code{#t} to the call to @code{curl-easy-perform}. Fetching a result as a bytevector is useful as it can then be re-encoded into UTF-8 by using the @code{utf8->string} procedure or to any character encoding by using the @code{bytevector->string} procedure. The following code will fetch a web page from an HTTP server as a bytevector, convert the bytevector to a string interpreting its contents as UTF-8 encoded data, and then pass the string to the @code{display} procedure. @code{display} will write the string to the current output port. @lisp @verbatiminclude ex_http_simple_get_utf8.scm @end lisp In summary @itemize @bullet @item Use @code{(curl-easy-perform handle)} to get US-ASCII or ISO-8859-1 @item Use @code{(curl-easy-perform handle #t)} to get a bytevector @item Use @code{(utf8->string (curl-easy-perform handle #t))} to get a UTF-8 string @end itemize That's pretty much all there is to it for a simple fetch. Beyond that, there are dozens of options that can be set by @code{curl-easy-setopt} that change how the request is performed. Easy-peasy. But things get much, much worse if you don't know the encoding of your data before hand and have to learn it from the HTTP server. In that case, things get complicated. @node Using web response procedures, Handling String Encodings, Performing the HTTP GET, Fetching from an HTTP server @subsection Using web response procedures The @code{(web response)} module can be used to help interpret the response from an HTTP server. The module has many procedures for the proper parsing of the HTTP header. But since @code{(web response)} was written to expect data from Guile's internal HTTP client @code{(web client)}, we need to do some simple gymnastics to convince it that the Curl-fetched data is as good as the @code{(web client)}-fetched data. First, we need to fetch both the HTTP headers as well as the body. To do this, the @code{curl-easy-setopt} option @code{'header} must be @code{#t}. When this option is set, the HTTP headers are pre-pended to the body. Second, we need to create a string port from the response. @example @verbatiminclude ex_http_web_response.scm @end example @node Handling String Encodings, , Using web response procedures, Fetching from an HTTP server @subsection Handling String Encodings The result passed to you from @code{curl-easy-perform} will either be as a string or as a bytevector, depending on the value of the 2nd parameter. The default is to return a string, which you will receive if you call it this way. @lisp (curl-easy-perform handle) @end lisp or @lisp (curl-easy-perform handle #f) @end lisp The string will always be returned in the ISO-8859-1 encoding, aka the Latin-1 encoding. This is because converting data in some unknown format to Latin-1 will never fail. It may not be right, but, the conversion won't fail. If you know that the data to be fetched is to be interpreted as a UTF-8 string, you should request the data as a bytevector and then convert the result to a string, like so... @lisp (utf8->string (curl-easy-perform handle #t))) @end lisp But if you don't know the encoding, things are gonna get way more complicated. The first and best place to look for an HTTP document's encoding is in the @code{Content-Type} field of the HTTP headers. In the headers, there may be a @code{Content-Type} header line like the following. @verbatim Content-Type: text/html; charset=utf-8 @end verbatim In the above case, the encoding of the document is listed as UTF-8 text. The previous example demonstrates how to unpack a HTTP header to find its encoding. But, not all HTTP-served documents have a @code{charset} line in the @code{Content-Type} header. If it isn't there, the next most authoritative place to look for an encoding is in the XML declaration if this is an XHTML document. But XHTML is uncommon. The another place to check is in a @code{meta} element in the HTML document itself. The @code{meta} element is in the HTML and might look like the following. @verbatim @end verbatim Yet another place that might be the source of encoding information for the resulting data is a UTF-16 BOM. It is a bit of a muddle. OK. Once you finally know what the encoding of your HTML document is, you can convert the body of your request into a string. If you've requested the HTML document as a bytevector, the @code{bytevector->string} procedure could be used to make the conversion. @node Reference, Index, Introduction, Top @chapter Reference @menu * Procedures:: * Options for setopt:: * Error Codes:: @end menu @node Procedures, Options for setopt, Reference, Reference @section Procedures These are the procedures provided by the library. @deffn Procedure curl-easy-init Returns a curl handle that you must use as input to other functions. This handle represents one connection to a server. If it fails, it will throw an error. @end deffn @deffn Procedure curl-easy-handle? x Returns @code{#t} if @var{x} is a curl handle such as would be created by @code{curl-easy-handle}. @code{#f} otherwise. @end deffn @deffn Procedure curl-easy-cleanup handle This forcibly closes all connections that this handle has used and have possibly kept open until now. Any use of the handle after it has been closed is invalid. The return value is unspecified. Calling this procedure is optional: handles will automatically be freed when no longer in use. @end deffn @deffn Procedure curl-easy-reset handle @quotation Re-initializes all options previously set on a specified CURL handle to its default values. This puts back the handle to the same state as it was in when it was just created with [@code{curl-easy-init}]. It does not change the following information kept in the handle: live connections, the Session ID cache, the DNS cache, the cookies and shares.@footnote{from the libcurl 7.12.1 curl_easy_reset man page} @end quotation The return value is unspecified. @end deffn @deffn Procedure curl-easy-perform handle #:optional bytevector? #:optional header? From the C documentation @quotation This function is called after the init and all the [@code{curl-easy-setopt}] calls are made, and will perform the transfer as described in the options. It must be called with the same handle as input as the [@code{curl-easy-init}] call returned. You can do any amount of calls to [@code{curl-easy-perform}] while using the same handle. If you intend to transfer more than one file, you are even encouraged to do so. libcurl will then attempt to re-use the same connection for the following transfers, thus making the operations faster, less CPU intense and using less network resources. Just note that you will have to use [@code{curl-easy-setopt}] between the invokes to set options for the following [@code{curl-easy-perform}] You must never call this function simultaneously from two places using the same handle. Let the function return first before invoking it another time. If you want parallel transfers, you must use several curl handles.@footnote{from the libcurl 7.7 curl_easy_perform man page} @end quotation The default behavior is to return a string containing the resource. There is no way to handle the encoding of the string: the binary data will mapped byte-by-byte to a string containing codepoints U+0000 through U+00FF. If the optional @var{bytevector?} parameter is given and is set to @code{#t}, the resource will be returned as a bytevector. It returns either a string containing the resource, a bytevector containing the resource, or @code{#f} on failure. For information about the failure, you can call @code{curl-error-string}. If the optional @code{header?} parameter is set to @code{#t}, it returns a list of two elements. The first is a string that contains any headers, such as HTTP headers, associated with this operation. The second is the body of the request, either as a string or as a bytevector, as described above. @end deffn @deffn Procedure curl-error-string If a call to @code{curl-easy-perform} fails, calling this function will return information about the last error as a string. @end deffn @deffn Procedure curl-error-code If a call to @code{curl-easy-perform} fails, calling this function will return information about the last error as an integer. These integers come from the libcurl library and are defined in its header file . @end deffn @deffn Procedure curl-easy-setopt handle option info This procedure sets the options for this @var{handle} that will describe what will happen when @code{curl-easy-perform} is called. At a minimum, @code{curl-easy-setopt} must be called at least once per handle to set the @code{url} option. @var{option} is a symbol name of an option, and @var{info} is additional information needed for the option. @xref{Options for setopt}, for a table of options and their associated required type. @quotation important Options for a handle are not cleared after @code{curl-easy-perform} is called. Make sure to call @code{curl-easy-reset} when you want the options for this handle to be reset. @end quotation This may throw an error if @var{handle} is already closed or if @var{option} is not the correct type. @end deffn @deffn Procedure curl-easy-getinfo handle option This procedure will extract internal information from a curl handle. The @var{option} is an symbol that indicates the value to be returned. The returned value is either the requested value or is @code{#f} on error. You must execute an operation on a handle with @code{curl-easy-perform} before @code{curl-easy-getinfo} can be called on that handle. @quotation important Care must be taken not do disrupt internal values managed by curl. For example, this procedure can return a file descriptor which is managed by curl and should not be closed. @end quotation This may throw an error if @var{handle} is already closed or has not yet been used to perform an operation. Also, it may thrown an error if @var{option} is not available for the version of curl being used. @end deffn The @code{curl-easy-getinfo} procedure takes one of the option symbols give in the first column of the table below. These symbols are shorthand for the underlying CURL option given in the 2nd column. Note that whether these options are available is dependent on the version of curl being used. To verify that a particular option is available, check that the defined constant is not @code{#f}. For example, to ensure the the @code{'xfer-id} option is available, check that the @code{CURLINFO_XFER_ID} evaluates to an integer. @multitable @columnfractions .25 .55 .25 @headitem Option Symbol @tab C Library Name @tab Output Type @item activesocket @tab CURLINFO_ACTIVESOCKET @tab integer file descriptor @item appconnect-time @tab CURLINFO_APPCONNECT_TIME @tab real seconds @item appconnect-time-t @tab CURLINFO_APPCONNECT_TIME_T @tab integer microseconds @item cainfo @tab CURLINFO_CAINFO @tab string @item capath @tab CURLINFO_CAPATH @tab string @c @item certinfo @tab CURLINFO_CERTINFO @tab integer @item condition-unmet @tab CURLINFO_CONDITION_UNMET @tab integer 1 or zero @item connect-time @tab CURLINFO_CONNECT_TIME @tab real seconds @item connect-time-t @tab CURLINFO_CONNECT_TIME_T @tab integer microseconds @item conn-id @tab CURLINFO_CONN_ID @tab integer @item content-length-download-t @tab CURLINFO_CONTENT_LENGTH_DOWNLOAD_T @tab integer @item content-length-upload-t @tab CURLINFO_CONTENT_LENGTH_UPLOAD_T @tab integer @item cookielist @tab CURLINFO_COOKIELIST @tab list of strings @item earlydata-sent-t @tab CURLINFO_EARLYDATA_SENT_T @tab integer bytes @item effective-method @tab CURLINFO_EFFECTIVE_METHOD @tab string @item effective-url @tab CURLINFO_EFFECTIVE_URL @tab string @item filetime @tab CURLINFO_FILETIME @tab integer @item filetime-t @tab CURLINFO_FILETIME_T @tab integer @item ftp-entry-path @tab CURLINFO_FTP_ENTRY_PATH @tab string @item header-size @tab CURLINFO_HEADER_SIZE @tab integer @item httpauth-avail @tab CURLINFO_HTTPAUTH_AVAIL @tab bitfield of CURLAUTH constants @xref{Integer Constants for httpauth} @item httpauth-used @tab CURLINFO_HTTPAUTH_USED @tab bitfield of CURLAUTH constants @xref{Integer Constants for httpauth} @item http-connectcode @tab CURLINFO_HTTP_CONNECTCODE @tab integer @item http-version @tab CURLINFO_HTTP_VERSION @tab integer of CURL_HTTP_VERSION constants @xref{Integer Constants for http-version} @item local-ip @tab CURLINFO_LOCAL_IP @tab string @item local-port @tab CURLINFO_LOCAL_PORT @tab integer @item namelookup-time @tab CURLINFO_NAMELOOKUP_TIME @tab real seconds @item namelookup-time-t @tab CURLINFO_NAMELOOKUP_TIME_T @tab integer microseconds @item num-connects @tab CURLINFO_NUM_CONNECTS @tab integer @item os-errno @tab CURLINFO_OS_ERRNO @tab integer @item posttransfer-time-t @tab CURLINFO_POSTTRANSFER_TIME_T @tab integer microseconds @item pretransfer-time @tab CURLINFO_PRETRANSFER_TIME @tab real seconds @item pretransfer-time-t @tab CURLINFO_PRETRANSFER_TIME_T @tab integer microseconds @item primary-ip @tab CURLINFO_PRIMARY_IP @tab string @item primary-port @tab CURLINFO_PRIMARY_PORT @tab integer @item proxyauth-avail @tab CURLINFO_PROXYAUTH_AVAIL @tab bitfield of CURLAUTH constants @item proxyauth-used @tab CURLINFO_PROXYAUTH_USED @tab bitfield of CURLAUTH constants @item proxy-error @tab CURLINFO_PROXY_ERROR @tab integer of a CURLPX constant @item proxy-ssl-verifyresult @tab CURLINFO_PROXY_SSL_VERIFYRESULT @tab integer @item queue-time-t @tab CURLINFO_QUEUE_TIME_T @tab integer microseconds @item redirect-count @tab CURLINFO_REDIRECT_COUNT @tab integer @item redirect-time @tab CURLINFO_REDIRECT_TIME @tab real seconds @item redirect-time-t @tab CURLINFO_REDIRECT_TIME_T @tab integer microseconds @item redirect-url @tab CURLINFO_REDIRECT_URL @tab string @item referer @tab CURLINFO_REFERER @tab string @item request-size @tab CURLINFO_REQUEST_SIZE @tab integer @item response-code @tab CURLINFO_RESPONSE_CODE @tab integer @item retry-after @tab CURLINFO_RETRY_AFTER @tab integer @item rtsp-client-cseq @tab CURLINFO_RTSP_CLIENT_CSEQ @tab integer CSeq @item rtsp-cseq-recv @tab CURLINFO_RTSP_CSEQ_RECV @tab integer CSeq @item rtsp-server-cseq @tab CURLINFO_RTSP_SERVER_CSEQ @tab integer CSeq @item rtsp-session-id @tab CURLINFO_RTSP_SESSION_ID @tab string @item scheme @tab CURLINFO_SCHEME @tab string @item size-download-t @tab CURLINFO_SIZE_DOWNLOAD_T @tab integer @item size-upload-t @tab CURLINFO_SIZE_UPLOAD_T @tab integer @item speed-download-t @tab CURLINFO_SPEED_DOWNLOAD_T @tab integer microseconds @item speed-upload-t @tab CURLINFO_SPEED_UPLOAD_T @tab integer microseconds @item ssl-engines @tab CURLINFO_SSL_ENGINES @tab list of strings @item ssl-verifyresult @tab CURLINFO_SSL_VERIFYRESULT @tab integer @item starttransfer-time @tab CURLINFO_STARTTRANSFER_TIME @tab real seconds @item starttransfer-time-t @tab CURLINFO_STARTTRANSFER_TIME_T @tab integer microseconds @c tls-ssl-ptr @item total-time @tab CURLINFO_TOTAL_TIME @tab real seconds @item total-time-t @tab CURLINFO_TOTAL_TIME_T @tab integer microseconds @item used-proxy @tab CURLINFO_USED_PROXY @tab integer form of boolean @item xfer-id @tab CURLINFO_XFER_ID @tab integer ID @end multitable @node Options for setopt, Error Codes, Procedures, Reference @section Options for setopt The options that can be set by @code{curl-easy-setopt} are listed in this section. For a much better an explanation of what each of these options does, you can look at the manual page for C library function @code{curl_easy_setopt} which comes with the libcurl library, which you should have since it is required to compile this package. @menu * Option Table:: * Option Data Types:: @end menu @node Option Table, Option Data Types, Options for setopt, Options for setopt @subsection Option Table The table describes the options and the type of info expected for each option. @itemize @bullet @item The first column is the symbol that you would pass as the @code{option} argument to @code{curl-easy-setopt}. @item The second column is the name of the option as it is listed in the manual page for the C library function @code{curl_easy_setopt}. @item The third column is the type of data that you would pass as the @code{info} argument to @code{curl-easy-setopt}. These may differ from those in the manual page for C library function @code{curl_easy_setopt}. @xref{Option Data Types}, for more about these types. @end itemize @multitable @columnfractions .25 .55 .25 @headitem Option Symbol @tab C Library Name @tab Info Type @item BEHAVIOR OPTIONS @item verbose @tab CURLOPT_VERBOSE @tab boolean @item header @tab CURLOPT_HEADER @tab boolean @c CURLOPT_NOPROGRESS is deprecated @item nosignal @tab CURLOPT_NOSIGNAL @tab boolean @item wildcardmatch @tab CURLOPT_WILDCARDMATCH @tab boolean @item CALLBACK OPTIONS @item readdata @tab CURLOPT_READDATA @tab input port @item NETWORK OPTIONS @item url @tab CURLOPT_URL @tab string @item path-as-is @tab CURLOPT_PATH_AS_IS @tab boolean @item protocols @tab CURLOPT_PROTOCOLS @tab integer@footnote{@xref{Integer Constants for protocols}.} @item redir-protocols @tab CURLOPT_REDIR_PROTOCOLS @tab integer@footnote{@xref{Integer Constants for protocols}.} @item default-protocol @tab CURLOPT_DEFAULT_PROTOCOL @tab string @item proxy @tab CURLOPT_PROXY @tab string @item pre-proxy @tab CURLOPT_PRE_PROXY @tab string @item proxyport @tab CURLOPT_PROXYPORT @tab integer @item proxytype @tab CURLOPT_PROXYTYPE @tab integer@footnote{@xref{Integer Constants for proxytype}.} @item noproxy @tab CURLOPT_NOPROXY @tab string @item httpproxytunnel @tab CURLOPT_HTTPPROXYTUNNEL @tab boolean @item connect-to @tab CURLOPT_CONNECT_TO @tab slist @item socks5-auth @tab CURLOPT_SOCKS5_AUTH @tab integer @item socks5-gssapi-service @tab CURLOPT_SOCKS5_GSSAPI_SERVICE @tab string @item socks5-gssapi-nec @tab CURLOPT_SOCKS5_GSSAPI_NEC @tab boolean @item proxy-service-name @tab CURLOPT_PROXY_SERVICE_NAME @tab string @item haproxyprotocol @tab CURLOPT_HAPROXYPROTOCOL @tab boolean @item service-name @tab CURLOPT_SERVICE_NAME @tab string @item interface @tab CURLOPT_INTERFACE @tab string @item localport @tab CURLOPT_LOCALPORT @tab integer @item localportrange @tab CURLOPT_LOCALPORTRANGE @tab integer @item dns-cache-timeout @tab CURLOPT_DNS_CACHE_TIMEOUT @tab integer @item doh-url @tab CURLOPT_DOH_URL @tab string @item buffersize @tab CURLOPT_BUFFERSIZE @tab integer @item port @tab CURLOPT_PORT @tab integer @item tcp-fastopen @tab CURLOPT_TCP_FASTOPEN @tab boolean @item tcp-nodelay @tab CURLOPT_TCP_NODELAY @tab boolean @item address-scope @tab CURLOPT_ADDRESS_SCOPE @tab integer @item tcp-keepalive @tab CURLOPT_TCP_KEEPALIVE @tab boolean @item tcp-keepidle @tab CURLOPT_TCP_KEEPIDLE @tab integer @item tcp-keepintvl @tab CURLOPT_TCP_KEEPINTVL @tab integer @item unix-socket-path @tab CURLOPT_UNIX_SOCKET_PATH @tab string @item abstract-unix-socket @tab CURLOPT_ABSTRACT_UNIX_SOCKET @tab string @item NAMES AND PASSWORD OPTIONS @item netrc @tab CURLOPT_NETRC @tab integer@footnote{@xref{Integer Constants for netrc}.} @item netrc-file @tab CURLOPT_NETRC_FILE @tab string @item userpwd @tab CURLOPT_USERPWD @tab string @item proxyuserpwd @tab CURLOPT_PROXYUSERPWD @tab string @item username @tab CURLOPT_USERNAME @tab string @item password @tab CURLOPT_PASSWORD @tab string @item login-options @tab CURLOPT_LOGIN_OPTIONS @tab string @item proxyusername @tab CURLOPT_PROXYUSERNAME @tab string @item proxypassword @tab CURLOPT_PROXYPASSWORD @tab string @item httpauth @tab CURLOPT_HTTPAUTH @tab integer@footnote{@xref{Integer Constants for httpauth}.} @item tlsauth-username @tab CURLOPT_TLSAUTH_USERNAME @tab string @item tlsauth-type @tab CURLOPT_TLSAUTH_TYPE @tab string @item proxy-tlsauth-username @tab CURLOPT_PROXY_TLSAUTH_USERNAME @tab string @item tlsauth-password @tab CURLOPT_TLSAUTH_PASSWORD @tab string @item proxy-tlsauth-password @tab CURLOPT_PROXY_TLSAUTH_PASSWORD @tab string @item tlsauth-type @tab CURLOPT_TLSAUTH_TYPE @tab string @item proxy-tlsauth-type @tab CURLOPT_PROXY_TLSAUTH_TYPE @tab string @item proxyauth @tab CURLOPT_PROXYAUTH @tab integer@footnote{@xref{Integer Constants for httpauth}.} @item sasl-ir @tab CURLOPT_SASL_IR @tab boolean @item xoauth2-bearer @tab CURLOPT_XOAUTH2_BEARER @tab string @item disallow-username-in-url @tab CURLOPT_DISALLOW_USERNAME_IN_URL @tab boolean @item HTTP OPTIONS @item autoreferer @tab CURLOPT_AUTOREFERER @tab boolean @item accept-encoding @tab CURLOPT_ACCEPT_ENCODING @tab string @item transfer-encoding @tab CURLOPT_TRANSFER_ENCODING @tab string @item followlocation @tab CURLOPT_FOLLOWLOCATION @tab boolean @item unrestricted-auth @tab CURLOPT_UNRESTRICTED_AUTH @tab boolean @item maxredirs @tab CURLOPT_MAXREDIRS @tab integer @item postredir @tab CURLOPT_POSTREDIR @tab integer@footnote{@xref{Integer Constants for postredir}.} @item put @tab CURLOPT_PUT @tab boolean @item post @tab CURLOPT_POST @tab boolean @item postfields@footnote{@xref{Postfields}.} @tab CURLOPT_POSTFIELDS @tab bytevector @c @item postfieldsize @tab CURLOPT_POSTFIELDSIZE @tab integer @c @item postfieldsize-large @tab CURLOPT_POSTFIELDSIZE_LARGE @tab biginteger @c @item copypostfields @tab CURLOPT_COPYPOSTFIELDS @tab bytevector @item httppost @tab CURLOPT_HTTPPOST @tab httppost @item referer @tab CURLOPT_REFERER @tab string @item useragent @tab CURLOPT_USERAGENT @tab string @item httpheader @tab CURLOPT_HTTPHEADER @tab slist@footnote{Pass an empty list to clear out the HTTP headers.} @item headeropt @tab CURLOPT_HEADEROPT @tab integer @item proxyheader @tab CURLOPT_PROXYHEADER @tab slist @item http200aliases @tab CURLOPT_HTTP200ALIASES @tab slist @item cookie @tab CURLOPT_COOKIE @tab string @item cookiefile @tab CURLOPT_COOKIEFILE @tab string @item cookiejar @tab CURLOPT_COOKIEJAR @tab string @item cookiesession @tab CURLOPT_COOKIESESSION @tab boolean @item cookielist @tab CURLOPT_COOKIELIST @tab string @item httpget @tab CURLOPT_HTTPGET @tab boolean @item request-target @tab CURLOPT_REQUEST_TARGET @tab string @item http-version @tab CURLOPT_HTTP_VERSION @tab integer@footnote{@xref{Integer Constants for http-version}.} @item http09-allowed @tab CURLOPT_HTTP09_ALLOWED @tab boolean @item ignore-content-length @tab CURLOPT_IGNORE_CONTENT_LENGTH @tab boolean @item http-content-decoding @tab CURLOPT_HTTP_CONTENT_DECODING @tab boolean @item http-transfer-decoding @tab CURLOPT_HTTP_TRANSFER_DECODING @tab boolean @item expect-100-timeout-ms @tab CURLOPT_EXPECT_100_TIMEOUT_MS @tab integer @item pipewait @tab CURLOPT_PIPEWAIT @tab boolean @item stream-wait @tab CURLOPT_STREAM_WEIGHT @tab integer @item SMTP OPTIONS @item mail-from @tab CURLOPT_MAIL_FROM @tab string @item mail-rcpt @tab CURLOPT_MAIL_RCPT @tab slist @item mail-auth @tab CURLOPT_MAIL_AUTH @tab string @item TFTP OPTIONS @item tftp-blksize @tab CURLOPT_TFTP_BLKSIZE @tab integer @item tftp-no-options @tab CURLOPT_TFTP_NO_OPTIONS @tab boolean @item FTP OPTIONS @item ftpport @tab CURLOPT_FTPPORT @tab string @item quote @tab CURLOPT_QUOTE @tab slist @item postquote @tab CURLOPT_POSTQUOTE @tab slist @item prequote @tab CURLOPT_PREQUOTE @tab slist @c @item dirlistonly, @tab CURLOPT_DIRLISTONLY @tab boolean @item append @tab CURLOPT_APPEND @tab boolean @item ftp-use-eprt @tab CURLOPT_FTP_USE_EPRT @tab boolean @item ftp-use-epsv @tab CURLOPT_FTP_USE_EPSV @tab boolean @item ftp-use-pret @tab CURLOPT_FTP_USE_PRET @tab boolean @item ftp-create-missing-dirs @tab CURLOPT_FTP_CREATE_MISSING_DIRS @tab boolean @item ftp-response-timeout @tab CURLOPT_FTP_RESPONSE_TIMEOUT @tab integer @item ftp-alternative-to-user @tab CURLOPT_FTP_ALTERNATIVE_TO_USER @tab string @item ftp-skip-pasv-ip @tab CURLOPT_FTP_SKIP_PASV_IP @tab boolean @item ftpsslauth @tab CURLOPT_FTPSSLAUTH @tab integer@footnote{@xref{Integer Constants for ftpsslauth}.} @item ftp-ssl-ccc @tab CURLOPT_FTP_SSL_CCC @tab integer@footnote{@xref{Integer Constants for ftp-ssl-ccc}.} @item ftp-account @tab CURLOPT_FTP_ACCOUNT @tab string @item ftp-filemethod @tab CURLOPT_FTP_FILEMETHOD @tab integer@footnote{@xref{Integer Constants for ftp-filemethod}.} @item RTSP OPTIONS @item rtsp-request @tab CURLOPT_RTSP_REQUEST @tab integer@footnote{@xref{Integer Constants for rtsp-request}.} @item rtsp-session-id @tab CURLOPT_RTSP_SESSION_ID @tab string @item rtsp-stream-uri @tab CURLOPT_RTSP_STREAM_URI @tab string @item rtsp-transport @tab CURLOPT_RTSP_TRANSPORT @tab string @c rtsp-header is unimplemented @item rtsp-client-cseq @tab CURLOPT_RTSP_CLIENT_CSEQ @tab integer @c rtsp-server-cseq is unimplemented @item PROTOCOL OPTIONS @item transfertext @tab CURLOPT_TRANSFERTEXT @tab boolean @item proxy-transfer-mode @tab CURLOPT_PROXY_TRANSFER_MODE @tab boolean @item crlf @tab CURLOPT_CRLF @tab boolean @item range @tab CURLOPT_RANGE @tab string @item resume-from @tab CURLOPT_RESUME_FROM @tab integer @item resume-from-large @tab CURLOPT_RESUME_FROM_LARGE @tab biginteger @item customrequest @tab CURLOPT_CUSTOMREQUEST @tab string @item filetime @tab CURLOPT_FILETIME @tab boolean @item nobody @tab CURLOPT_NOBODY @tab boolean @item infilesize @tab CURLOPT_INFILESIZE @tab integer @item infilesize-large @tab CURLOPT_INFILESIZE_LARGE @tab biginteger @item upload @tab CURLOPT_UPLOAD @tab boolean @item upload-buffersize @tab CURLOPT_UPLOAD_BUFFERSIZE @tab integer @item maxfilesize @tab CURLOPT_MAXFILESIZE @tab integer @item maxfilesize-large @tab CURLOPT_MAXFILESIZE_LARGE @tab biginteger @item timecondition @tab CURLOPT_TIMECONDITION @tab integer @item timevalue @tab CURLOPT_TIMEVALUE @tab integer @item timevalue-large @tab CURLOPT_TIMEVALUE_LARGE @tab biginteger @item CONNECTION OPTIONS @item timeout @tab CURLOPT_TIMEOUT @tab integer @item timeout-ms @tab CURLOPT_TIMEOUT_MS @tab integer @item low-speed-limit @tab CURLOPT_LOW_SPEED_LIMIT @tab integer @item low-speed-time @tab CURLOPT_LOW_SPEED_TIME @tab integer @item max-send-speed-large @tab CURLOPT_MAX_SEND_SPEED_LARGE @tab biginteger @item max-recv-speed-large @tab CURLOPT_MAX_RECV_SPEED_LARGE @tab biginteger @item maxconnects @tab CURLOPT_MAXCONNECTS @tab integer @c closepolicy is obsolete @item fresh-connect @tab CURLOPT_FRESH_CONNECT @tab boolean @item forbid-reuse @tab CURLOPT_FORBID_REUSE @tab boolean @item connecttimeout @tab CURLOPT_CONNECTTIMEOUT @tab integer @item connecttimeout-ms @tab CURLOPT_CONNECTTIMEOUT_MS @tab integer @item ipresolve @tab CURLOPT_IPRESOLVE @tab integer@footnote{@xref{Integer Constants for ipresolve}.} @item connect-only @tab CURLOPT_CONNECT_ONLY @tab boolean @item use-ssl @tab CURLOPT_USE_SSL @tab integer@footnote{@xref{Integer Constants for use-ssl}.} @item resolve @tab CURLOPT_RESOLVE @tab slist @item dns-interface @tab CURLOPT_DNS_INTERFACE @tab string @item dns-local-ip4 @tab CURLOPT_DNS_LOCAL_IP4 @tab string @item dns-local-ip6 @tab CURLOPT_DNS_LOCAL_IP6 @tab string @item dns-servers @tab CURLOPT_DNS_SERVERS @tab string @item dns-shuffle-addresses @tab CURLOPT_DNS_SHUFFLE_ADDRESSES @tab boolean @item accepttimeout-ms @tab CURLOPT_ACCEPTTIMEOUT_MS @tab integer @item happy-eyeballs-timeout-ms @tab CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS @tab integer @item upkeep-interval-ms @tab CURLOPT_UPKEEP_INTERVAL_MS @tab integer) @item SSL AND SECURITY OPTIONS @item sslcert @tab CURLOPT_SSLCERT @tab string @item proxy-sslcert @tab CURLOPT_PROXY_SSLCERT @tab string @item sslcerttype @tab CURLOPT_SSLCERTTYPE @tab string @item proxy-sslcerttype @tab CURLOPT_PROXY_SSLCERTTYPE @tab string @item sslkey @tab CURLOPT_SSLKEY @tab string @item proxy-sslkey @tab CURLOPT_PROXY_SSLKEY @tab string @item sslkeytype @tab CURLOPT_SSLKEYTYPE @tab string @item proxy-sslkeytype @tab CURLOPT_PROXY_SSLKEYTYPE @tab string @item keypasswd @tab CURLOPT_KEYPASSWD @tab string @item proxy-keypasswd @tab CURLOPT_PROXY_KEYPASSWD @tab string @item ssl-enable-alpn @tab CURLOPT_SSL_ENABLE_ALPN @tab boolean @item ssl-enable-npn @tab CURLOPT_SSL_ENABLE_ALPN @tab boolean @item sslengine @tab CURLOPT_SSLENGINE @tab string @item sslengine-default @tab CURLOPT_SSLENGINE_DEFAULT @tab boolean @item ssl-falsestart @tab CURLOPT_SSL_FALSESTART @tab boolean @item sslversion @tab CURLOPT_SSLVERSION @tab integer@footnote{@xref{Integer Constants for sslversion}.} @item proxy-sslversion @tab CURLOPT_PROXY_SSLVERSION @tab integer@footnote{@xref{Integer Constants for sslversion}.} @item ssl-verifyhost @tab CURLOPT_SSL_VERIFYHOST @tab boolean @item proxy-ssl-verifyhost @tab CURLOPT_SSL_VERIFYHOST @tab boolean @item ssl-verifypeer @tab CURLOPT_SSL_VERIFYPEER @tab boolean @item proxy-ssl-verifypeer @tab CURLOPT_PROXY_SSL_VERIFYPEER @tab boolean @item cainfo @tab CURLOPT_CAINFO @tab string @item proxy-cainfo @tab CURLOPT_PROXY_CAINFO @tab string @item issuercert @tab CURLOPT_ISSUERCERT @tab string @item capath @tab CURLOPT_CAPATH @tab string @item proxy-capath @tab CURLOPT_PROXY_CAPATH @tab string @item crlfile @tab CURLOPT_CRLFILE @tab string @item ssl-verifyhost @tab CURLOPT_SSL_VERIFYHOST @tab integer @item certinfo @tab CURLOPT_CERTINFO @tab boolean @item random-file @tab CURLOPT_RANDOM_FILE @tab string @item egdsocket @tab CURLOPT_EGDSOCKET @tab string @item ssl-cipher-list @tab CURLOPT_SSL_CIPHER_LIST @tab string @item ssl-sessionid-cache @tab CURLOPT_SSL_SESSIONID_CACHE @tab boolean @item krblevel @tab CURLOPT_KRBLEVEL @tab string @item gssapi-delegation @tab CURLOPT_GSSAPI_DELEGATION @tab integer@footnote{@xref{Integer Constants for gssapi-delegation}.} @item SSH OPTIONS @item ssh-auth-types @tab CURLOPT_SSH_AUTH_TYPES @tab integer@footnote{@xref{Integer Constants for ssh-auth-types}.} @item ssh-host-public-key-md5 @tab CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 @tab string @item ssh-public-keyfile @tab CURLOPT_SSH_PUBLIC_KEYFILE @tab string @item ssh-private-keyfile @tab CURLOPT_SSH_PRIVATE_KEYFILE @tab string @item ssh-known-hosts @tab CURLOPT_SSH_KNOWN_HOSTS @tab string @c ssh-keyfunction is unimplemented @c ssh-keydata is unimplemented @c private is unimplemented @c share is unimplemented @item new-file-perms @tab CURLOPT_NEW_FILE_PERMS @tab integer @item new-directory-perms @tab CURLOPT_NEW_DIRECTORY_PERMS @tab integer @item telnetoptions @tab CURLOPT_TELNETOPTIONS @tab slist @end multitable @node Option Data Types, , Option Table, Options for setopt @subsection Option Data Types In the options table there are several possible types listed for the option info argument: @table @code @item boolean @code{#t} or @code{#f} @item integer A @code{long} integer. Note that many options have named integer-valued constants defined. @item biginteger An integer that is possibly longer than a @code{long} integer. @item string A string. The scheme string is converted to a C string encoded in the current locale. @item bytevector Either a bytevector or a string that only contains the Unicode code points U+0000 through U+00FF. @item slist A list containing zero or more strings. The scheme string is converted to a C string encoded in the current locale. @item httppost A list containing data that will be used for an HTTP Post operation. Obviously, this is only for handles for which the @code{url} option is set to an HTTP URL that will accept a Post operation. The @var{httppost} data is a list of one or more HTTP Post elements. The HTTP Post elements will be passed to the server in the order in which they appear in the list. Each HTTP Post element it itself a list. The list has two required and two optional arguments. @enumerate @item Name of the element [required @code{string}] @item Contents of the element [required @code{bytevector}] @item The mime type for this element [optional @code{string}] @item The filename of this element [optional @code{string}] @end enumerate The @code{string} and @code{bytevector} types are as described above. @quotation important The format of this data structure will change in the next version @end quotation @end table @menu * Postfields:: * Integer Constants for protocols:: * Integer Constants for proxytype:: * Integer Constants for netrc:: * Integer Constants for httpauth:: * Integer Constants for postredir:: * Integer Constants for http-version:: * Integer Constants for ftpsslauth:: * Integer Constants for ftp-ssl-ccc:: * Integer Constants for ftp-filemethod:: * Integer Constants for rtsp-request:: * Integer Constants for sslversion:: * Integer Constants for ipresolve:: * Integer Constants for use-ssl:: * Integer Constants for gssapi-delegation:: * Integer Constants for ssh-auth-types:: @end menu @node Postfields, Integer Constants for protocols, Option Data Types, Option Data Types @subsubsection Postfields The @code{postfields} option is treated somewhat different than with the C API. In the C API, to make postfields, one must pass a @code{CURLOPT_POSTFIELDSIZE} option along with the @code{CURLOPT_POSTFIELDS}. In this Scheme API, the @code{CURLOPT_POSTFIELDSIZE} is calculated automatically from the bytevector used the @code{postfields} option. Also, in this API, the postfields data is always copied from the source. There is no need to hold on to the bytevector passed to the @code{postfields} option. @node Integer Constants for protocols, Integer Constants for proxytype, Postfields, Option Data Types @subsubsection Integer Constants for protocols The following list of integer constants can be used for the @code{protocols} and @code{redir-protocols} options. @flushleft CURLPROTO_ALL, CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_FTP, CURLPROTO_FTPS, CURLPROTO_GOPHER, CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_IMAP, CURLPROTO_IMAPS, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_POP3, CURLPROTO_POP3S, CURLPROTO_RTMP, CURLPROTO_RTMPE, CURLPROTO_RTMPS, CURLPROTO_RTMPT, CURLPROTO_RTMPTE, CURLPROTO_RTMPTS, CURLPROTO_RTSP, CURLPROTO_SCP, CURLPROTO_SFTP, CURLPROTO_SMB, CURLPROTO_SMBS, CURLPROTO_SMTP, CURLPROTO_SMTPS, CURLPROTO_TELNET, CURLPROTO_TFTP @end flushleft @node Integer Constants for proxytype, Integer Constants for netrc, Integer Constants for protocols, Option Data Types @subsubsection Integer Constants for proxytype The following list of integer constants can be used for the @code{proxytype} option. @flushleft CURLPROXY_HTTP, CURLPROXY_HTTPS, CURLPROXY_HTTP_1_0, CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A, CURLPROXY_SOCKS5, CURLPROXY_SOCKS5_HOSTNAME @end flushleft @node Integer Constants for netrc, Integer Constants for httpauth, Integer Constants for proxytype, Option Data Types @subsubsection Integer Constants for netrc The following list of integer constants can be used for the @code{netrc} option. @flushleft CURL_NETRC_OPTIONAL, CURL_NETRC_IGNORED, CURL_NETRC_REQUIRED @end flushleft @node Integer Constants for httpauth, Integer Constants for postredir, Integer Constants for netrc, Option Data Types @subsubsection Integer Constants for httpauth The following list of integer constants can be used with the @code{httpauth} and @code{proxyauth} options. @flushleft CURLAUTH_BASIC, CURLAUTH_DIGEST, CURLAUTH_DIGEST_IE, CURLAUTH_BEARER, CURLAUTH_NEGOTIATE, CURLAUTH_NTLM, CURLAUTH_NTLM_WB, CURLAUTH_ANY, CURLAUTH_ANYSAFE, CURLAUTH_ONLY @end flushleft @node Integer Constants for postredir, Integer Constants for http-version, Integer Constants for httpauth, Option Data Types @subsubsection Integer Constants for postredir The following list integer constants can be used with the @code{postredir} option. @flushleft CURL_REDIR_POST_301, CURL_REDIR_POST_302, CURL_REDIR_POST_ALL @end flushleft @node Integer Constants for http-version, Integer Constants for ftpsslauth, Integer Constants for postredir, Option Data Types @subsubsection Integer Constants for http-version The following list integer constants can be used with the @code{http-version} option. @flushleft CURL_HTTP_VERSION_NONE, CURL_HTTP_VERSION_1_0, CURL_HTTP_VERSION_1_1, CURL_HTTP_VERSION_2_0, CURL_HTTP_VERSION_2TLS, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE @end flushleft @node Integer Constants for ftpsslauth, Integer Constants for ftp-ssl-ccc, Integer Constants for http-version, Option Data Types @subsubsection Integer Constants for ftpsslauth The following list integer constants can be used with the @code{ftpsslauth} option. @flushleft CURLFTPAUTH_DEFAULT, CURLFTPAUTH_SSL, CURLFTPAUTH_TLS @end flushleft @node Integer Constants for ftp-ssl-ccc, Integer Constants for ftp-filemethod, Integer Constants for ftpsslauth, Option Data Types @subsubsection Integer Constants for ftp-ssl-ccc The following list integer constants can be used with the @code{ftp-ssl-ccc} option. @flushleft CURLFTPSSL_CCC_NONE, CURLFTPSSL_CCC_PASSIVE, CURLFTPSSL_CCC_ACTIVE @end flushleft @node Integer Constants for ftp-filemethod, Integer Constants for rtsp-request, Integer Constants for ftp-ssl-ccc, Option Data Types @subsubsection Integer Constants for ftp-filemethod The following list integer constants can be used with the @code{ftp-filemethod} option. @flushleft CURLFTPMETHOD_MULTICWD, CURLFTPMETHOD_NOCWD, CURLFTPMETHOD_SINGLECWD @end flushleft @node Integer Constants for rtsp-request, Integer Constants for sslversion, Integer Constants for ftp-filemethod, Option Data Types @subsubsection Integer Constants for rtsp-request The following list integer constants can be used with the @code{rtsp-request} option. @flushleft CURL_RTSPREQ_OPTIONS, CURL_RTSPREQ_DESCRIBE, CURL_RTSPREQ_ANNOUNCE, CURL_RTSPREQ_SETUP, CURL_RTSPREQ_PLAY, CURL_RTSPREQ_PAUSE, CURL_RTSPREQ_TEARDOWN, CURL_RTSPREQ_GET_PARAMETER, CURL_RTSPREQ_SET_PARAMETER, CURL_RTSPREQ_RECORD, CURL_RTSPREQ_RECEIVE @end flushleft @node Integer Constants for sslversion, Integer Constants for ipresolve, Integer Constants for rtsp-request, Option Data Types @subsubsection Integer Constants for sslversion The following list integer constants can be used with the @code{sslversion} option. @flushleft CURL_SSLVERSION_DEFAULT, CURL_SSLVERSION_TLSv1, CURL_SSLVERSION_TLSv1_0, CURL_SSLVERSION_TLSv1_1, CURL_SSLVERSION_TLSv1_2, CURL_SSLVERSION_TLSv1_3, CURL_SSLVERSION_MAX_DEFAULT, CURL_SSLVERSION_MAX_TLSv1_0, CURL_SSLVERSION_MAX_TLSv1_1, CURL_SSLVERSION_MAX_TLSv1_2, CURL_SSLVERSION_MAX_TLSv1_3, CURL_SSLVERSION_SSLv2, CURL_SSLVERSION_SSLv3, @end flushleft @node Integer Constants for ipresolve, Integer Constants for use-ssl, Integer Constants for sslversion, Option Data Types @subsubsection Integer Constants for ipresolve The following list integer constants can be used with the @code{ipresolve} option. @flushleft CURL_IPRESOLVE_WHATEVER, CURL_IPRESOLVE_V4, CURL_IPRESOLVE_V6 @end flushleft @node Integer Constants for use-ssl, Integer Constants for gssapi-delegation, Integer Constants for ipresolve, Option Data Types @subsubsection Integer Constants for use-ssl The following list integer constants can be used with the @code{use-ssl} option. @flushleft CURLUSESSL_NONE, CURLUSESSL_TRY, CURLUSESSL_CONTROL, CURLUSESSL_ALL @end flushleft @node Integer Constants for gssapi-delegation, Integer Constants for ssh-auth-types, Integer Constants for use-ssl, Option Data Types @subsubsection Integer Constants for gssapi-delegation The following list integer constants can be used with the @code{gssapi-delegation} option. @flushleft CURLGSSAPI_DELEGATION_FLAG, CURLGSSAPI_DELEGATION_POLICY_FLAG @end flushleft @node Integer Constants for ssh-auth-types, , Integer Constants for gssapi-delegation, Option Data Types @subsubsection Integer Constants for ssh-auth-types The following list integer constants can be used with the @code{ssh-auth-types} option. @flushleft CURLSSH_AUTH_PUBLICKEY, CURLSSH_AUTH_PASSWORD, CURLSSH_AUTH_HOST, CURLSSH_AUTH_KEYBOARD, CURHSSH_AUTH_ANY @end flushleft @node Error Codes, , Options for setopt, Reference @section Error Codes There is a set of named integer-value constants for the error codes. @table @code @item CURLE_OK @item CURLE_UNSUPPORTED_PROTOCOL @item CURLE_FAILED_INIT @item CURLE_URL_MALFORMAT @item CURLE_NOT_BUILT_IN @item CURLE_COULDNT_RESOLVE_PROXY @item CURLE_COULDNT_RESOLVE_HOST @item CURLE_COULDNT_CONNECT @item CURLE_FTP_WEIRD_SERVER_REPLY @item CURLE_REMOTE_ACCESS_DENIED @item CURLE_FTP_ACCEPT_FAILED @item CURLE_FTP_WEIRD_PASS_REPLY @item CURLE_FTP_ACCEPT_TIMEOUT @item CURLE_FTP_WEIRD_PASV_REPLY @item CURLE_FTP_WEIRD_227_FORMAT @item CURLE_FTP_CANT_GET_HOST @item CURLE_HTTP2 @item CURLE_FTP_COULDNT_SET_TYPE @item CURLE_PARTIAL_FILE @item CURLE_FTP_COULDNT_RETR_FILE @item CURLE_FTP_QUOTE_ERROR @item CURLE_HTTP_RETURNED_ERROR @item CURLE_WRITE_ERROR @item CURLE_UPLOAD_FAILED @item CURLE_READ_ERROR @item CURLE_OUT_OF_MEMORY @item CURLE_OPERATION_TIMEDOUT @item CURLE_FTP_PORT_FAILED @item CURLE_FTP_COULDNT_USE_REST @end table . @table @code @item CURLE_RANGE_ERROR @item CURLE_HTTP_POST_ERROR @item CURLE_SSL_CONNECT_ERROR @item CURLE_BAD_DOWNLOAD_RESUME @item CURLE_FILE_COULDNT_READ_FILE @item CURLE_LDAP_CANNOT_BIND @item CURLE_LDAP_SEARCH_FAILED @item CURLE_FUNCTION_NOT_FOUND @item CURLE_ABORTED_BY_CALLBACK @item CURLE_BAD_FUNCTION_ARGUMENT @item CURLE_INTERFACE_FAILED @item CURLE_TOO_MANY_REDIRECTS @item CURLE_UNKNOWN_OPTION @item CURLE_TELNET_OPTION_SYNTAX @item CURLE_GOT_NOTHING @item CURLE_SSL_ENGINE_NOTFOUND @item CURLE_SSL_ENGINE_SETFAILED @item CURLE_SEND_ERROR @item CURLE_RECV_ERROR @item CURLE_SSL_CERTPROBLEM @item CURLE_SSL_CIPHER @item CURLE_PEER_FAILED_VERIFICATION @item CURLE_BAD_CONTENT_ENCODING @item CURLE_LDAP_INVALID_URL @item CURLE_FILESIZE_EXCEEDED @item CURLE_USE_SSL_FAILED @item CURLE_SEND_FAIL_REWIND @item CURLE_SSL_ENGINE_INITFAILED @item CURLE_LOGIN_DENIED @item CURLE_TFTP_NOTFOUND @item CURLE_TFTP_PERM @item CURLE_REMOTE_DISK_FULL @item CURLE_TFTP_ILLEGAL @item CURLE_TFTP_UNKNOWNID @item CURLE_REMOTE_FILE_EXISTS @item CURLE_TFTP_NOSUCHUSER @item CURLE_CONV_FAILED @item CURLE_CONV_REQD @item CURLE_SSL_CACERT_BADFILE @item CURLE_REMOTE_FILE_NOT_FOUND @item CURLE_SSH @item CURLE_SSL_SHUTDOWN_FAILED @item CURLE_AGAIN @end table . @table @code @item CURLE_SSL_CRL_BADFILE @item CURLE_SSL_ISSUER_ERROR @item CURLE_FTP_PRET_FAILED @item CURLE_RTSP_CSEQ_ERROR @item CURLE_FTP_BAD_FILE_LIST @item CURLE_CHUNK_FAILED @item CURLE_NO_CONNECTION_AVAILABLE @item CURLE_SSL_PINNEDPUBKEYNOTMATCH @item CURLE_SSL_INVALIDCERTSTATUS @item CURLE_HTTP2_STREAM @item CURLE_RECURSIVE_API_CALL @end table @node Index, , Reference, Top @unnumbered Index @printindex cp @bye guile-curl-0.10/m4/000077500000000000000000000000001517432002600140225ustar00rootroot00000000000000guile-curl-0.10/m4/.gitignore000066400000000000000000000003311517432002600160070ustar00rootroot00000000000000/lt~obsolete.m4 /ltversion.m4 /ltsugar.m4 /ltoptions.m4 /libtool.m4 /00gnulib.m4 /gnulib-common.m4 /gnulib-comp.m4 /gnulib-tool.m4 /lib-ld.m4 /lib-link.m4 /lib-prefix.m4 /visibility.m4 /host-cpu-c-abi.m4 /zzgnulib.m4 guile-curl-0.10/m4/attributes.m4000066400000000000000000000227121517432002600164560ustar00rootroot00000000000000dnl Macros to check the presence of generic (non-typed) symbols. dnl Copyright (c) 2006-2007 Diego Petten. dnl Copyright (c) 2006-2007 xine project dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2, or (at your option) dnl any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA dnl 02110-1301, USA. dnl dnl As a special exception, the copyright owners of the dnl macro gives unlimited permission to copy, distribute and modify the dnl configure scripts that are the output of Autoconf when processing the dnl Macro. You need not follow the terms of the GNU General Public dnl License when using or distributing such scripts, even though portions dnl of the text of the Macro appear in them. The GNU General Public dnl License (GPL) does govern all other use of the material that dnl constitutes the Autoconf Macro. dnl dnl This special exception to the GPL applies to versions of the dnl Autoconf Macro released by this project. When you make and dnl distribute a modified version of the Autoconf Macro, you may extend dnl this special exception to the GPL to apply to your modified version as dnl well. dnl Check if the flag is supported by compiler dnl CC_CHECK_CFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [ AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]), [ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $1" AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])], [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"], [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"]) CFLAGS="$ac_save_CFLAGS" ]) AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], [$2], [$3]) ]) dnl Check if the flag is supported by compiler (cacheable) dnl CC_CHECK_CFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) AC_DEFUN([CC_CHECK_CFLAGS], [ AC_CACHE_CHECK([if $CC supports $1 flag], AS_TR_SH([cc_cv_cflags_$1]), CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here! ) AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], [$2], [$3]) ]) dnl CC_CHECK_CFLAG_APPEND(FLAG, [action-if-found], [action-if-not-found]) dnl Check for CFLAG and appends them to CFLAGS if supported AC_DEFUN([CC_CHECK_CFLAG_APPEND], [ AC_CACHE_CHECK([if $CC supports $1 flag], AS_TR_SH([cc_cv_cflags_$1]), CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here! ) AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], [CFLAGS="$CFLAGS $1"; $2], [$3]) ]) dnl CC_CHECK_CFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not]) AC_DEFUN([CC_CHECK_CFLAGS_APPEND], [ for flag in $1; do CC_CHECK_CFLAG_APPEND($flag, [$2], [$3]) done ]) dnl Check if the flag is supported by linker (cacheable) dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) AC_DEFUN([CC_CHECK_LDFLAGS], [ AC_CACHE_CHECK([if $CC supports $1 flag], AS_TR_SH([cc_cv_ldflags_$1]), [ac_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $1" AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])], [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"], [eval "AS_TR_SH([cc_cv_ldflags_$1])="]) LDFLAGS="$ac_save_LDFLAGS" ]) AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes], [$2], [$3]) ]) dnl Check for a -Werror flag or equivalent. -Werror is the GCC dnl and ICC flag that tells the compiler to treat all the warnings dnl as fatal. We usually need this option to make sure that some dnl constructs (like attributes) are not simply ignored. dnl dnl Other compilers don't support -Werror per se, but they support dnl an equivalent flag: dnl - Sun Studio compiler supports -errwarn=%all AC_DEFUN([CC_CHECK_WERROR], [ AC_CACHE_CHECK( [for $CC way to treat warnings as errors], [cc_cv_werror], [CC_CHECK_CFLAGS_SILENT([-Werror], [cc_cv_werror=-Werror], [CC_CHECK_CFLAGS_SILENT([-errwarn=%all], [cc_cv_werror=-errwarn=%all])]) ]) ]) AC_DEFUN([CC_CHECK_ATTRIBUTE], [ AC_REQUIRE([CC_CHECK_WERROR]) AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))], AS_TR_SH([cc_cv_attribute_$1]), [ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cc_cv_werror" AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])], [eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"], [eval "AS_TR_SH([cc_cv_attribute_$1])='no'"]) CFLAGS="$ac_save_CFLAGS" ]) AS_IF([eval test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes], [AC_DEFINE( AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1, [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))] ) $4], [$5]) ]) AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [ CC_CHECK_ATTRIBUTE( [constructor],, [extern void foo(); void __attribute__((constructor)) ctor() { foo(); }], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_DESTRUCTOR], [ CC_CHECK_ATTRIBUTE( [destructor],, [extern void foo(); void __attribute__((destructor)) dtor() { foo(); }], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_FORMAT], [ CC_CHECK_ATTRIBUTE( [format], [format(printf, n, n)], [void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; }], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [ CC_CHECK_ATTRIBUTE( [format_arg], [format_arg(printf)], [char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; }], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [ CC_CHECK_ATTRIBUTE( [visibility_$1], [visibility("$1")], [void __attribute__((visibility("$1"))) $1_function() { }], [$2], [$3]) ]) AC_DEFUN([CC_ATTRIBUTE_NONNULL], [ CC_CHECK_ATTRIBUTE( [nonnull], [nonnull()], [void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = (void*)0; bar = (void*)0; }], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_UNUSED], [ CC_CHECK_ATTRIBUTE( [unused], , [void some_function(void *foo, __attribute__((unused)) void *bar);], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [ CC_CHECK_ATTRIBUTE( [sentinel], , [void some_function(void *foo, ...) __attribute__((sentinel));], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [ CC_CHECK_ATTRIBUTE( [deprecated], , [void some_function(void *foo, ...) __attribute__((deprecated));], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_ALIAS], [ CC_CHECK_ATTRIBUTE( [alias], [weak, alias], [void other_function(void *foo) { } void some_function(void *foo) __attribute__((weak, alias("other_function")));], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_MALLOC], [ CC_CHECK_ATTRIBUTE( [malloc], , [void * __attribute__((malloc)) my_alloc(int n);], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_PACKED], [ CC_CHECK_ATTRIBUTE( [packed], , [struct astructure { char a; int b; long c; void *d; } __attribute__((packed)); char assert@<:@(sizeof(struct astructure) == (sizeof(char)+sizeof(int)+sizeof(long)+sizeof(void*)))-1@:>@;], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_CONST], [ CC_CHECK_ATTRIBUTE( [const], , [int __attribute__((const)) twopow(int n) { return 1 << n; } ], [$1], [$2]) ]) AC_DEFUN([CC_FLAG_VISIBILITY], [ AC_REQUIRE([CC_CHECK_WERROR]) AC_CACHE_CHECK([if $CC supports -fvisibility=hidden], [cc_cv_flag_visibility], [cc_flag_visibility_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cc_cv_werror" CC_CHECK_CFLAGS_SILENT([-fvisibility=hidden], cc_cv_flag_visibility='yes', cc_cv_flag_visibility='no') CFLAGS="$cc_flag_visibility_save_CFLAGS"]) AS_IF([test "x$cc_cv_flag_visibility" = "xyes"], [AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1, [Define this if the compiler supports the -fvisibility flag]) $1], [$2]) ]) AC_DEFUN([CC_FUNC_EXPECT], [ AC_REQUIRE([CC_CHECK_WERROR]) AC_CACHE_CHECK([if compiler has __builtin_expect function], [cc_cv_func_expect], [ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cc_cv_werror" AC_COMPILE_IFELSE( [int some_function() { int a = 3; return (int)__builtin_expect(a, 3); }], [cc_cv_func_expect=yes], [cc_cv_func_expect=no]) CFLAGS="$ac_save_CFLAGS" ]) AS_IF([test "x$cc_cv_func_expect" = "xyes"], [AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1, [Define this if the compiler supports __builtin_expect() function]) $1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [ AC_REQUIRE([CC_CHECK_WERROR]) AC_CACHE_CHECK([highest __attribute__ ((aligned ())) supported], [cc_cv_attribute_aligned], [ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cc_cv_werror" for cc_attribute_align_try in 64 32 16 8 4 2; do AC_COMPILE_IFELSE([ int main() { static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0; return c; }], [cc_cv_attribute_aligned=$cc_attribute_align_try; break]) done CFLAGS="$ac_save_CFLAGS" ]) if test "x$cc_cv_attribute_aligned" != "x"; then AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], [$cc_cv_attribute_aligned], [Define the highest alignment supported]) fi ]) guile-curl-0.10/m4/guile.m4000066400000000000000000000365561517432002600154100ustar00rootroot00000000000000## Autoconf macros for working with Guile. ## ## Copyright (C) 1998,2001, 2006, 2010, 2012, 2013, 2014, 2020 Free Software Foundation, Inc. ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public License ## as published by the Free Software Foundation; either version 3 of ## the License, or (at your option) any later version. ## ## This library is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## Lesser General Public License for more details. ## ## You should have received a copy of the GNU Lesser General Public ## License along with this library; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301 USA # serial 11 ## Index ## ----- ## ## GUILE_PKG -- find Guile development files ## GUILE_PROGS -- set paths to Guile interpreter, config and tool programs ## GUILE_FLAGS -- set flags for compiling and linking with Guile ## GUILE_SITE_DIR -- find path to Guile "site" directories ## GUILE_CHECK -- evaluate Guile Scheme code and capture the return value ## GUILE_MODULE_CHECK -- check feature of a Guile Scheme module ## GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module ## GUILE_MODULE_REQUIRED -- fail if a Guile Scheme module is unavailable ## GUILE_MODULE_EXPORTS -- check if a module exports a variable ## GUILE_MODULE_REQUIRED_EXPORT -- fail if a module doesn't export a variable ## Code ## ---- ## NOTE: Comments preceding an AC_DEFUN (starting from "Usage:") are massaged ## into doc/ref/autoconf-macros.texi (see Makefile.am in that directory). # GUILE_PKG -- find Guile development files # # Usage: GUILE_PKG([VERSIONS]) # # This macro runs the @code{pkg-config} tool to find development files # for an available version of Guile. # # By default, this macro will search for the latest stable version of # Guile (e.g. 3.0), falling back to the previous stable version # (e.g. 2.2) if it is available. If no guile-@var{VERSION}.pc file is # found, an error is signalled. The found version is stored in # @var{GUILE_EFFECTIVE_VERSION}. # # If @code{GUILE_PROGS} was already invoked, this macro ensures that the # development files have the same effective version as the Guile # program. # # @var{GUILE_EFFECTIVE_VERSION} is marked for substitution, as by # @code{AC_SUBST}. # AC_DEFUN([GUILE_PKG], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if test "x$PKG_CONFIG" = x; then AC_MSG_ERROR([pkg-config is missing, please install it]) fi _guile_versions_to_search="m4_default([$1], [3.0 2.2 2.0])" if test -n "$GUILE_EFFECTIVE_VERSION"; then _guile_tmp="" for v in $_guile_versions_to_search; do if test "$v" = "$GUILE_EFFECTIVE_VERSION"; then _guile_tmp=$v fi done if test -z "$_guile_tmp"; then AC_MSG_FAILURE([searching for guile development files for versions $_guile_versions_to_search, but previously found $GUILE version $GUILE_EFFECTIVE_VERSION]) fi _guile_versions_to_search=$GUILE_EFFECTIVE_VERSION fi GUILE_EFFECTIVE_VERSION="" _guile_errors="" for v in $_guile_versions_to_search; do if test -z "$GUILE_EFFECTIVE_VERSION"; then AC_MSG_NOTICE([checking for guile $v]) PKG_CHECK_EXISTS([guile-$v], [GUILE_EFFECTIVE_VERSION=$v], []) fi done if test -z "$GUILE_EFFECTIVE_VERSION"; then AC_MSG_ERROR([ No Guile development packages were found. Please verify that you have Guile installed. If you installed Guile from a binary distribution, please verify that you have also installed the development packages. If you installed it yourself, you might need to adjust your PKG_CONFIG_PATH; see the pkg-config man page for more. ]) fi AC_MSG_NOTICE([found guile $GUILE_EFFECTIVE_VERSION]) AC_SUBST([GUILE_EFFECTIVE_VERSION]) ]) # GUILE_FLAGS -- set flags for compiling and linking with Guile # # Usage: GUILE_FLAGS # # This macro runs the @code{pkg-config} tool to find out how to compile # and link programs against Guile. It sets four variables: # @var{GUILE_CFLAGS}, @var{GUILE_LDFLAGS}, @var{GUILE_LIBS}, and # @var{GUILE_LTLIBS}. # # @var{GUILE_CFLAGS}: flags to pass to a C or C++ compiler to build code that # uses Guile header files. This is almost always just one or more @code{-I} # flags. # # @var{GUILE_LDFLAGS}: flags to pass to the compiler to link a program # against Guile. This includes @code{-lguile-@var{VERSION}} for the # Guile library itself, and may also include one or more @code{-L} flag # to tell the compiler where to find the libraries. But it does not # include flags that influence the program's runtime search path for # libraries, and will therefore lead to a program that fails to start, # unless all necessary libraries are installed in a standard location # such as @file{/usr/lib}. # # @var{GUILE_LIBS} and @var{GUILE_LTLIBS}: flags to pass to the compiler or to # libtool, respectively, to link a program against Guile. It includes flags # that augment the program's runtime search path for libraries, so that shared # libraries will be found at the location where they were during linking, even # in non-standard locations. @var{GUILE_LIBS} is to be used when linking the # program directly with the compiler, whereas @var{GUILE_LTLIBS} is to be used # when linking the program is done through libtool. # # The variables are marked for substitution, as by @code{AC_SUBST}. # AC_DEFUN([GUILE_FLAGS], [AC_REQUIRE([GUILE_PKG]) PKG_CHECK_MODULES(GUILE, [guile-$GUILE_EFFECTIVE_VERSION]) dnl GUILE_CFLAGS and GUILE_LIBS are already defined and AC_SUBST'd by dnl PKG_CHECK_MODULES. But GUILE_LIBS to pkg-config is GUILE_LDFLAGS dnl to us. GUILE_LDFLAGS=$GUILE_LIBS dnl Determine the platform dependent parameters needed to use rpath. dnl AC_LIB_LINKFLAGS_FROM_LIBS is defined in gnulib/m4/lib-link.m4 and needs dnl the file gnulib/build-aux/config.rpath. AC_LIB_LINKFLAGS_FROM_LIBS([GUILE_LIBS], [$GUILE_LDFLAGS], []) GUILE_LIBS="$GUILE_LDFLAGS $GUILE_LIBS" AC_LIB_LINKFLAGS_FROM_LIBS([GUILE_LTLIBS], [$GUILE_LDFLAGS], [yes]) GUILE_LTLIBS="$GUILE_LDFLAGS $GUILE_LTLIBS" AC_SUBST([GUILE_EFFECTIVE_VERSION]) AC_SUBST([GUILE_CFLAGS]) AC_SUBST([GUILE_LDFLAGS]) AC_SUBST([GUILE_LIBS]) AC_SUBST([GUILE_LTLIBS]) ]) # GUILE_SITE_DIR -- find path to Guile site directories # # Usage: GUILE_SITE_DIR # # This looks for Guile's "site" directories. The variable @var{GUILE_SITE} will # be set to Guile's "site" directory for Scheme source files (usually something # like PREFIX/share/guile/site). @var{GUILE_SITE_CCACHE} will be set to the # directory for compiled Scheme files also known as @code{.go} files # (usually something like # PREFIX/lib/guile/@var{GUILE_EFFECTIVE_VERSION}/site-ccache). # @var{GUILE_EXTENSION} will be set to the directory for compiled C extensions # (usually something like # PREFIX/lib/guile/@var{GUILE_EFFECTIVE_VERSION}/extensions). The latter two # are set to blank if the particular version of Guile does not support # them. Note that this macro will run the macros @code{GUILE_PKG} and # @code{GUILE_PROGS} if they have not already been run. # # The variables are marked for substitution, as by @code{AC_SUBST}. # AC_DEFUN([GUILE_SITE_DIR], [AC_REQUIRE([GUILE_PKG]) AC_REQUIRE([GUILE_PROGS]) AC_MSG_CHECKING(for Guile site directory) GUILE_SITE=`$PKG_CONFIG --print-errors --variable=sitedir guile-$GUILE_EFFECTIVE_VERSION` AC_MSG_RESULT($GUILE_SITE) if test "$GUILE_SITE" = ""; then AC_MSG_FAILURE(sitedir not found) fi AC_SUBST(GUILE_SITE) AC_MSG_CHECKING([for Guile site-ccache directory using pkgconfig]) GUILE_SITE_CCACHE=`$PKG_CONFIG --variable=siteccachedir guile-$GUILE_EFFECTIVE_VERSION` if test "$GUILE_SITE_CCACHE" = ""; then AC_MSG_RESULT(no) AC_MSG_CHECKING([for Guile site-ccache directory using interpreter]) GUILE_SITE_CCACHE=`$GUILE -c "(display (if (defined? '%site-ccache-dir) (%site-ccache-dir) \"\"))"` if test $? != "0" -o "$GUILE_SITE_CCACHE" = ""; then AC_MSG_RESULT(no) GUILE_SITE_CCACHE="" AC_MSG_WARN([siteccachedir not found]) fi fi AC_MSG_RESULT($GUILE_SITE_CCACHE) AC_SUBST([GUILE_SITE_CCACHE]) AC_MSG_CHECKING(for Guile extensions directory) GUILE_EXTENSION=`$PKG_CONFIG --print-errors --variable=extensiondir guile-$GUILE_EFFECTIVE_VERSION` AC_MSG_RESULT($GUILE_EXTENSION) if test "$GUILE_EXTENSION" = ""; then GUILE_EXTENSION="" AC_MSG_WARN(extensiondir not found) fi AC_SUBST(GUILE_EXTENSION) ]) # GUILE_PROGS -- set paths to Guile interpreter, config and tool programs # # Usage: GUILE_PROGS([VERSION]) # # This macro looks for programs @code{guile} and @code{guild}, setting # variables @var{GUILE} and @var{GUILD} to their paths, respectively. # The macro will attempt to find @code{guile} with the suffix of # @code{-X.Y}, followed by looking for it with the suffix @code{X.Y}, and # then fall back to looking for @code{guile} with no suffix. If # @code{guile} is still not found, signal an error. The suffix, if any, # that was required to find @code{guile} will be used for @code{guild} # as well. # # By default, this macro will search for the latest stable version of # Guile (e.g. 3.0). x.y or x.y.z versions can be specified. If an older # version is found, the macro will signal an error. # # The effective version of the found @code{guile} is set to # @var{GUILE_EFFECTIVE_VERSION}. This macro ensures that the effective # version is compatible with the result of a previous invocation of # @code{GUILE_FLAGS}, if any. # # As a legacy interface, it also looks for @code{guile-config} and # @code{guile-tools}, setting @var{GUILE_CONFIG} and @var{GUILE_TOOLS}. # # The variables are marked for substitution, as by @code{AC_SUBST}. # AC_DEFUN([GUILE_PROGS], [_guile_required_version="m4_default([$1], [$GUILE_EFFECTIVE_VERSION])" if test -z "$_guile_required_version"; then _guile_required_version=3.0 fi _guile_candidates=guile _tmp= for v in `echo "$_guile_required_version" | tr . ' '`; do if test -n "$_tmp"; then _tmp=$_tmp.; fi _tmp=$_tmp$v _guile_candidates="guile-$_tmp guile$_tmp $_guile_candidates" done AC_PATH_PROGS(GUILE,[$_guile_candidates]) if test -z "$GUILE"; then AC_MSG_ERROR([guile required but not found]) fi _guile_suffix=`echo "$GUILE" | sed -e 's,^.*/guile\(.*\)$,\1,'` _guile_effective_version=`$GUILE -c "(display (effective-version))"` if test -z "$GUILE_EFFECTIVE_VERSION"; then GUILE_EFFECTIVE_VERSION=$_guile_effective_version elif test "$GUILE_EFFECTIVE_VERSION" != "$_guile_effective_version"; then AC_MSG_ERROR([found development files for Guile $GUILE_EFFECTIVE_VERSION, but $GUILE has effective version $_guile_effective_version]) fi _guile_major_version=`$GUILE -c "(display (major-version))"` _guile_minor_version=`$GUILE -c "(display (minor-version))"` _guile_micro_version=`$GUILE -c "(display (micro-version))"` _guile_prog_version="$_guile_major_version.$_guile_minor_version.$_guile_micro_version" AC_MSG_CHECKING([for Guile version >= $_guile_required_version]) _major_version=`echo $_guile_required_version | cut -d . -f 1` _minor_version=`echo $_guile_required_version | cut -d . -f 2` _micro_version=`echo $_guile_required_version | cut -d . -f 3` if test "$_guile_major_version" -gt "$_major_version"; then true elif test "$_guile_major_version" -eq "$_major_version"; then if test "$_guile_minor_version" -gt "$_minor_version"; then true elif test "$_guile_minor_version" -eq "$_minor_version"; then if test -n "$_micro_version"; then if test "$_guile_micro_version" -lt "$_micro_version"; then AC_MSG_ERROR([Guile $_guile_required_version required, but $_guile_prog_version found]) fi fi elif test "$GUILE_EFFECTIVE_VERSION" = "$_major_version.$_minor_version" -a -z "$_micro_version"; then # Allow prereleases that have the right effective version. true else as_fn_error $? "Guile $_guile_required_version required, but $_guile_prog_version found" "$LINENO" 5 fi elif test "$GUILE_EFFECTIVE_VERSION" = "$_major_version.$_minor_version" -a -z "$_micro_version"; then # Allow prereleases that have the right effective version. true else AC_MSG_ERROR([Guile $_guile_required_version required, but $_guile_prog_version found]) fi AC_MSG_RESULT([$_guile_prog_version]) AC_PATH_PROG(GUILD,[guild$_guile_suffix]) AC_SUBST(GUILD) AC_PATH_PROG(GUILE_CONFIG,[guile-config$_guile_suffix]) AC_SUBST(GUILE_CONFIG) if test -n "$GUILD"; then GUILE_TOOLS=$GUILD else AC_PATH_PROG(GUILE_TOOLS,[guile-tools$_guile_suffix]) fi AC_SUBST(GUILE_TOOLS) ]) # GUILE_CHECK -- evaluate Guile Scheme code and capture the return value # # Usage: GUILE_CHECK_RETVAL(var,check) # # @var{var} is a shell variable name to be set to the return value. # @var{check} is a Guile Scheme expression, evaluated with "$GUILE -c", and # returning either 0 or non-#f to indicate the check passed. # Non-0 number or #f indicates failure. # Avoid using the character "#" since that confuses autoconf. # AC_DEFUN([GUILE_CHECK], [AC_REQUIRE([GUILE_PROGS]) $GUILE -c "$2" > /dev/null 2>&1 $1=$? ]) # GUILE_MODULE_CHECK -- check feature of a Guile Scheme module # # Usage: GUILE_MODULE_CHECK(var,module,featuretest,description) # # @var{var} is a shell variable name to be set to "yes" or "no". # @var{module} is a list of symbols, like: (ice-9 common-list). # @var{featuretest} is an expression acceptable to GUILE_CHECK, q.v. # @var{description} is a present-tense verb phrase (passed to AC_MSG_CHECKING). # AC_DEFUN([GUILE_MODULE_CHECK], [AC_MSG_CHECKING([if $2 $4]) GUILE_CHECK($1,(use-modules $2) (exit ((lambda () $3)))) if test "$$1" = "0" ; then $1=yes ; else $1=no ; fi AC_MSG_RESULT($$1) ]) # GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module # # Usage: GUILE_MODULE_AVAILABLE(var,module) # # @var{var} is a shell variable name to be set to "yes" or "no". # @var{module} is a list of symbols, like: (ice-9 common-list). # AC_DEFUN([GUILE_MODULE_AVAILABLE], [GUILE_MODULE_CHECK($1,$2,0,is available) ]) # GUILE_MODULE_REQUIRED -- fail if a Guile Scheme module is unavailable # # Usage: GUILE_MODULE_REQUIRED(symlist) # # @var{symlist} is a list of symbols, WITHOUT surrounding parens, # like: ice-9 common-list. # AC_DEFUN([GUILE_MODULE_REQUIRED], [GUILE_MODULE_AVAILABLE(ac_guile_module_required, ($1)) if test "$ac_guile_module_required" = "no" ; then AC_MSG_ERROR([required guile module not found: ($1)]) fi ]) # GUILE_MODULE_EXPORTS -- check if a module exports a variable # # Usage: GUILE_MODULE_EXPORTS(var,module,modvar) # # @var{var} is a shell variable to be set to "yes" or "no". # @var{module} is a list of symbols, like: (ice-9 common-list). # @var{modvar} is the Guile Scheme variable to check. # AC_DEFUN([GUILE_MODULE_EXPORTS], [GUILE_MODULE_CHECK($1,$2,$3,exports `$3') ]) # GUILE_MODULE_REQUIRED_EXPORT -- fail if a module doesn't export a variable # # Usage: GUILE_MODULE_REQUIRED_EXPORT(module,modvar) # # @var{module} is a list of symbols, like: (ice-9 common-list). # @var{modvar} is the Guile Scheme variable to check. # AC_DEFUN([GUILE_MODULE_REQUIRED_EXPORT], [GUILE_MODULE_EXPORTS(guile_module_required_export,$1,$2) if test "$guile_module_required_export" = "no" ; then AC_MSG_ERROR([module $1 does not export $2; required]) fi ]) ## guile.m4 ends here guile-curl-0.10/module/000077500000000000000000000000001517432002600147675ustar00rootroot00000000000000guile-curl-0.10/module/curl.scm000066400000000000000000001007441517432002600164460ustar00rootroot00000000000000;; -*- Mode: scheme; -*- ;;; Copyright (C) 2011, 2013, 2014, 2019, 2021 Michael L. Gran ;;; This program is free software: you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation, either version 3 of the License, or ;;; (at your option) any later version. ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see . (define-module (curl) #:use-module (srfi srfi-1) #:use-module (ice-9 optargs) #:use-module (rnrs bytevectors) #:export ( curl-easy-handle? curl-easy-init curl-easy-getinfo curl-easy-setopt curl-easy-perform curl-easy-cleanup curl-easy-reset curl-error-string curl-error-code %curl-dump-handle bv->url-encoded-bv CURLPROTO_ALL CURLPROTO_DICT CURLPROTO_FILE CURLPROTO_FTP CURLPROTO_FTPS CURLPROTO_GOPHER CURLPROTO_HTTP CURLPROTO_HTTPS CURLPROTO_IMAP CURLPROTO_IMAPS CURLPROTO_LDAP CURLPROTO_LDAPS CURLPROTO_POP3 CURLPROTO_POP3S CURLPROTO_RTMP CURLPROTO_RTMPE CURLPROTO_RTMPS CURLPROTO_RTMPT CURLPROTO_RTMPTE CURLPROTO_RTMPTS CURLPROTO_RTSP CURLPROTO_SCP CURLPROTO_SFTP CURLPROTO_SMB CURLPROTO_SMBS CURLPROTO_SMTP CURLPROTO_SMTPS CURLPROTO_TELNET CURLPROTO_TFTP CURLPROXY_HTTP CURLPROXY_HTTPS CURLPROXY_HTTP_1_0 CURLPROXY_SOCKS4 CURLPROXY_SOCKS4A CURLPROXY_SOCKS5 CURLPROXY_SOCKS5_HOSTNAME CURL_NETRC_OPTIONAL CURL_NETRC_IGNORED CURL_NETRC_REQUIRED CURLAUTH_BASIC CURLAUTH_BEARER CURLAUTH_DIGEST CURLAUTH_DIGEST_IE CURLAUTH_NEGOTIATE CURLAUTH_NTLM CURLAUTH_NTLM_WB CURLAUTH_ANY CURLAUTH_ANYSAFE CURLAUTH_ONLY CURL_REDIR_POST_301 CURL_REDIR_POST_302 CURL_REDIR_POST_ALL CURL_HTTP_VERSION_NONE CURL_HTTP_VERSION_1_0 CURL_HTTP_VERSION_1_1 CURL_HTTP_VERSION_2_0 CURL_HTTP_VERSION_2TLS CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE CURLFTPAUTH_DEFAULT CURLFTPAUTH_SSL CURLFTPAUTH_TLS CURLFTPSSL_CCC_NONE CURLFTPSSL_CCC_PASSIVE CURLFTPSSL_CCC_ACTIVE CURLFTPMETHOD_MULTICWD CURLFTPMETHOD_NOCWD CURLFTPMETHOD_SINGLECWD CURL_RTSPREQ_OPTIONS CURL_RTSPREQ_DESCRIBE CURL_RTSPREQ_ANNOUNCE CURL_RTSPREQ_SETUP CURL_RTSPREQ_PLAY CURL_RTSPREQ_PAUSE CURL_RTSPREQ_TEARDOWN CURL_RTSPREQ_GET_PARAMETER CURL_RTSPREQ_SET_PARAMETER CURL_RTSPREQ_RECORD CURL_RTSPREQ_RECEIVE CURL_IPRESOLVE_WHATEVER CURL_IPRESOLVE_V4 CURL_IPRESOLVE_V6 CURLUSESSL_NONE CURLUSESSL_TRY CURLUSESSL_CONTROL CURLUSESSL_ALL CURL_SSLVERSION_DEFAULT CURL_SSLVERSION_TLSv1 CURL_SSLVERSION_TLSv1_0 CURL_SSLVERSION_TLSv1_1 CURL_SSLVERSION_TLSv1_2 CURL_SSLVERSION_TLSv1_3 CURL_SSLVERSION_MAX_DEFAULT CURL_SSLVERSION_MAX_TLSv1_0 CURL_SSLVERSION_MAX_TLSv1_1 CURL_SSLVERSION_MAX_TLSv1_2 CURL_SSLVERSION_MAX_TLSv1_3 CURL_SSLVERSION_SSLv2 CURL_SSLVERSION_SSLv3 CURLGSSAPI_DELEGATION_FLAG CURLGSSAPI_DELEGATION_POLICY_FLAG CURLSSH_AUTH_PUBLICKEY CURLSSH_AUTH_PASSWORD CURLSSH_AUTH_HOST CURLSSH_AUTH_KEYBOARD CURLSSH_AUTH_ANY CURLINFO_ACTIVESOCKET CURLINFO_APPCONNECT_TIME CURLINFO_APPCONNECT_TIME_T CURLINFO_CAINFO CURLINFO_CAPATH ;; CURLINFO_CERTINFO CURLINFO_CONDITION_UNMET CURLINFO_CONNECT_TIME CURLINFO_CONNECT_TIME_T CURLINFO_CONN_ID CURLINFO_CONTENT_LENGTH_DOWNLOAD_T CURLINFO_CONTENT_LENGTH_UPLOAD_T CURLINFO_COOKIELIST CURLINFO_EARLYDATA_SENT_T CURLINFO_EFFECTIVE_METHOD CURLINFO_EFFECTIVE_URL CURLINFO_FILETIME CURLINFO_FILETIME_T CURLINFO_FTP_ENTRY_PATH CURLINFO_HEADER_SIZE CURLINFO_HTTPAUTH_AVAIL CURLINFO_HTTPAUTH_USED CURLINFO_HTTP_CONNECTCODE CURLINFO_HTTP_VERSION CURLINFO_LOCAL_IP CURLINFO_LOCAL_PORT CURLINFO_NAMELOOKUP_TIME CURLINFO_NAMELOOKUP_TIME_T CURLINFO_NUM_CONNECTS CURLINFO_OS_ERRNO CURLINFO_POSTTRANSFER_TIME_T CURLINFO_PRETRANSFER_TIME CURLINFO_PRETRANSFER_TIME_T CURLINFO_PRIMARY_IP CURLINFO_PRIMARY_PORT CURLINFO_PROXYAUTH_AVAIL CURLINFO_PROXYAUTH_USED CURLINFO_PROXY_ERROR CURLINFO_PROXY_SSL_VERIFYRESULT CURLINFO_QUEUE_TIME_T CURLINFO_REDIRECT_COUNT CURLINFO_REDIRECT_TIME CURLINFO_REDIRECT_TIME_T CURLINFO_REDIRECT_URL CURLINFO_REFERER CURLINFO_REQUEST_SIZE CURLINFO_RESPONSE_CODE CURLINFO_RETRY_AFTER CURLINFO_RTSP_CLIENT_CSEQ CURLINFO_RTSP_CSEQ_RECV CURLINFO_RTSP_SERVER_CSEQ CURLINFO_RTSP_SESSION_ID CURLINFO_SCHEME CURLINFO_SIZE_DOWNLOAD_T CURLINFO_SIZE_UPLOAD_T CURLINFO_SPEED_DOWNLOAD_T CURLINFO_SPEED_UPLOAD_T CURLINFO_SSL_ENGINES CURLINFO_SSL_VERIFYRESULT CURLINFO_STARTTRANSFER_TIME CURLINFO_STARTTRANSFER_TIME_T CURLINFO_TLS_SSL_PTR CURLINFO_TOTAL_TIME CURLINFO_TOTAL_TIME_T CURLINFO_USED_PROXY CURLINFO_XFER_ID CURLE_OK CURLE_UNSUPPORTED_PROTOCOL CURLE_FAILED_INIT CURLE_URL_MALFORMAT CURLE_NOT_BUILT_IN CURLE_COULDNT_RESOLVE_PROXY CURLE_COULDNT_RESOLVE_HOST CURLE_COULDNT_CONNECT CURLE_FTP_WEIRD_SERVER_REPLY CURLE_REMOTE_ACCESS_DENIED CURLE_FTP_ACCEPT_FAILED CURLE_FTP_WEIRD_PASS_REPLY CURLE_FTP_ACCEPT_TIMEOUT CURLE_FTP_WEIRD_PASV_REPLY CURLE_FTP_WEIRD_227_FORMAT CURLE_FTP_CANT_GET_HOST CURLE_HTTP2 CURLE_FTP_COULDNT_SET_TYPE CURLE_PARTIAL_FILE CURLE_FTP_COULDNT_RETR_FILE CURLE_FTP_QUOTE_ERROR CURLE_HTTP_RETURNED_ERROR CURLE_WRITE_ERROR CURLE_UPLOAD_FAILED CURLE_READ_ERROR CURLE_OUT_OF_MEMORY CURLE_OPERATION_TIMEDOUT CURLE_FTP_PORT_FAILED CURLE_FTP_COULDNT_USE_REST CURLE_RANGE_ERROR CURLE_HTTP_POST_ERROR CURLE_SSL_CONNECT_ERROR CURLE_BAD_DOWNLOAD_RESUME CURLE_FILE_COULDNT_READ_FILE CURLE_LDAP_CANNOT_BIND CURLE_LDAP_SEARCH_FAILED CURLE_FUNCTION_NOT_FOUND CURLE_ABORTED_BY_CALLBACK CURLE_BAD_FUNCTION_ARGUMENT CURLE_INTERFACE_FAILED CURLE_TOO_MANY_REDIRECTS CURLE_UNKNOWN_OPTION CURLE_TELNET_OPTION_SYNTAX CURLE_GOT_NOTHING CURLE_SSL_ENGINE_NOTFOUND CURLE_SSL_ENGINE_SETFAILED CURLE_SEND_ERROR CURLE_RECV_ERROR CURLE_SSL_CERTPROBLEM CURLE_SSL_CIPHER CURLE_PEER_FAILED_VERIFICATION CURLE_BAD_CONTENT_ENCODING CURLE_LDAP_INVALID_URL CURLE_FILESIZE_EXCEEDED CURLE_USE_SSL_FAILED CURLE_SEND_FAIL_REWIND CURLE_SSL_ENGINE_INITFAILED CURLE_LOGIN_DENIED CURLE_TFTP_NOTFOUND CURLE_TFTP_PERM CURLE_REMOTE_DISK_FULL CURLE_TFTP_ILLEGAL CURLE_TFTP_UNKNOWNID CURLE_REMOTE_FILE_EXISTS CURLE_TFTP_NOSUCHUSER CURLE_CONV_FAILED CURLE_CONV_REQD CURLE_SSL_CACERT_BADFILE CURLE_REMOTE_FILE_NOT_FOUND CURLE_SSH CURLE_SSL_SHUTDOWN_FAILED CURLE_AGAIN CURLE_SSL_CRL_BADFILE CURLE_SSL_ISSUER_ERROR CURLE_FTP_PRET_FAILED CURLE_RTSP_CSEQ_ERROR CURLE_FTP_BAD_FILE_LIST CURLE_CHUNK_FAILED CURLE_NO_CONNECTION_AVAILABLE CURLE_SSL_PINNEDPUBKEYNOTMATCH CURLE_SSL_INVALIDCERTSTATUS CURLE_HTTP2_STREAM CURLE_OK CURLE_UNSUPPORTED_PROTOCOL CURLE_FAILED_INIT CURLE_URL_MALFORMAT CURLE_URL_MALFORMAT_USER CURLE_COULDNT_RESOLVE_PROXY CURLE_COULDNT_RESOLVE_HOST CURLE_COULDNT_CONNECT CURLE_FTP_WEIRD_SERVER_REPLY CURLE_FTP_ACCESS_DENIED CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_FTP_WEIRD_PASS_REPLY CURLE_FTP_WEIRD_USER_REPLY CURLE_FTP_WEIRD_PASV_REPLY CURLE_FTP_WEIRD_227_FORMAT CURLE_FTP_CANT_GET_HOST CURLE_FTP_CANT_RECONNECT CURLE_FTP_COULDNT_SET_BINARY CURLE_PARTIAL_FILE CURLE_FTP_COULDNT_RETR_FILE CURLE_FTP_WRITE_ERROR CURLE_FTP_QUOTE_ERROR CURLE_HTTP_RETURNED_ERROR CURLE_WRITE_ERROR CURLE_MALFORMAT_USER CURLE_UPLOAD_FAILED CURLE_READ_ERROR CURLE_OUT_OF_MEMORY CURLE_OPERATION_TIMEOUTED CURLE_FTP_COULDNT_SET_ASCII CURLE_FTP_PORT_FAILED CURLE_FTP_COULDNT_USE_REST CURLE_FTP_COULDNT_GET_SIZE CURLE_HTTP_RANGE_ERROR CURLE_HTTP_POST_ERROR CURLE_SSL_CONNECT_ERROR CURLE_BAD_DOWNLOAD_RESUME CURLE_FILE_COULDNT_READ_FILE CURLE_LDAP_CANNOT_BIND CURLE_LDAP_SEARCH_FAILED CURLE_LIBRARY_NOT_FOUND CURLE_FUNCTION_NOT_FOUND CURLE_ABORTED_BY_CALLBACK CURLE_BAD_FUNCTION_ARGUMENT CURLE_BAD_CALLING_ORDER CURLE_INTERFACE_FAILED CURLE_BAD_PASSWORD_ENTERED CURLE_TOO_MANY_REDIRECTS CURLE_UNKNOWN_TELNET_OPTION CURLE_TELNET_OPTION_SYNTAX CURLE_OBSOLETE CURLE_SSL_PEER_CERTIFICATE CURLE_GOT_NOTHING CURLE_SSL_ENGINE_NOTFOUND CURLE_SSL_ENGINE_SETFAILED CURLE_SEND_ERROR CURLE_RECV_ERROR CURLE_SHARE_IN_USE CURLE_SSL_CERTPROBLEM CURLE_SSL_CIPHER CURLE_SSL_CACERT CURLE_BAD_CONTENT_ENCODING CURLE_LDAP_INVALID_URL CURLE_FILESIZE_EXCEEDED CURLE_FTP_SSL_FAILED CURLE_SEND_FAIL_REWIND CURLE_SSL_ENGINE_INITFAILED CURLE_LOGIN_DENIED CURLE_TFTP_NOTFOUND CURLE_TFTP_PERM CURLE_TFTP_DISKFULL CURLE_TFTP_ILLEGAL CURLE_TFTP_UNKNOWNID CURLE_TFTP_EXISTS CURLE_TFTP_NOSUCHUSER CURLE_CONV_FAILED CURLE_CONV_REQD CURLE_SSL_CACERT_BADFILE CURLE_REMOTE_FILE_NOT_FOUND CURLE_SSH CURLE_SSL_SHUTDOWN_FAILED CURLE_RECURSIVE_API_CALL CURLPX_OK CURLPX_BAD_ADDRESS_TYPE CURLPX_BAD_VERSION CURLPX_CLOSED CURLPX_GSSAPI CURLPX_GSSAPI_PERMSG CURLPX_GSSAPI_PROTECTION CURLPX_IDENTD CURLPX_IDENTD_DIFFER CURLPX_LONG_HOSTNAME CURLPX_LONG_PASSWD CURLPX_LONG_USER CURLPX_NO_AUTH CURLPX_RECV_ADDRESS CURLPX_RECV_AUTH CURLPX_RECV_CONNECT CURLPX_RECV_REQACK CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED CURLPX_REPLY_COMMAND_NOT_SUPPORTED CURLPX_REPLY_CONNECTION_REFUSED CURLPX_REPLY_GENERAL_SERVER_FAILURE CURLPX_REPLY_HOST_UNREACHABLE CURLPX_REPLY_NETWORK_UNREACHABLE CURLPX_REPLY_NOT_ALLOWED CURLPX_REPLY_TTL_EXPIRED CURLPX_REPLY_UNASSIGNED CURLPX_REQUEST_FAILED CURLPX_RESOLVE_HOST CURLPX_SEND_AUTH CURLPX_SEND_CONNECT CURLPX_SEND_REQUEST CURLPX_UNKNOWN_FAIL CURLPX_UNKNOWN_MODE CURLPX_USER_REJECTED )) (eval-when (expand load eval) (load-extension "libguile-curl" "cl_init")) (define (c-bool x) (if x 1 0)) (define (num->ascii-hex-num x) "Given a number between 0 and 15, it returns the ASCII character code of the hex digit 0123456789ABCDEF" (cond ((and (>= x 0) (<= x 9)) (+ x 48)) ; 47 == #\0 ((and (>= x 10) (<= x 15)) (+ (- x 10) 65)) ; 65 is #\A (else (error "out of range")))) (define (needs-escape x) (if (or (= x 36) ; #\$ (and (>= x 39) (<= x 57)) ; #\` to #\9 (and (>= x 65) (<= x 90)) ; #\A to #\Z (= x 95) ; #\_ (and (>= x 97) (<= x 122))) ; #\a to #\z #f #t)) (define (bv->url-encoded-bv bv) "Creates a bytevector that contains a URL-encoded representation of the original bytevector" ;; Compute the length of the new bytevector (let* ((len (bytevector-length bv)) (new-len (let loop ((i 0) (n 0)) (if (< i len) (if (needs-escape (bytevector-u8-ref bv i)) (loop (1+ i) (+ 3 n)) ;; else (loop (1+ i) (+ 1 n))) ;; else n)))) (let ((bv2 (make-bytevector new-len 0))) (let loop ((i 0) (j 0)) (if (< i len) (let ((x (bytevector-u8-ref bv i))) (if (needs-escape x) (begin (bytevector-u8-set! bv2 j 37) ; PERCENT SIGN (bytevector-u8-set! bv2 (1+ j) (num->ascii-hex-num (quotient x 16))) (bytevector-u8-set! bv2 (+ 2 j) (num->ascii-hex-num (remainder x 16))) (loop (1+ i) (+ 3 j))) ;; else (begin (bytevector-u8-set! bv2 j x) (loop (1+ i) (1+ j))))))) bv2))) (define (curl-easy-init) "Returns a curl handle that you must use as input to other functions. This handle represents one connection to a server." (%curl-easy-init)) (define (curl-easy-handle? handle) "Returns #t if HANDLE is a CURL handle such as would be created by `curl-easy-init'" (%curl-easy-handle? handle)) (define (curl-easy-cleanup handle) "This forcibly closes all connections that this handle has used and has possibly kept open until now. Any use of the handle after it has been closed is invalid. Calling this procedure is optional: handles will automatically be freed when no longer in use." (%curl-easy-cleanup handle)) (define (curl-easy-reset handle) "Re-initializes all options previously set on this CURL handle to its default values. It does not change live connections, the Session ID cache, the DNS cache, the cookies or the shared." (%curl-easy-reset handle)) (define symbol-options `( ;; BEHAVIOR OPTIONS (verbose ,CURLOPT_VERBOSE boolean) (header ,CURLOPT_HEADER boolean) ;; CURLOPT_NOPROGRESS is deprecated (nosignal ,CURLOPT_NOSIGNAL boolean) (wildcardmatch ,CURLOPT_WILDCARDMATCH boolean) ;; CALLBACK OPTIONS (readdata ,CURLOPT_READDATA input-port) ;; NETWORK OPTIONS (url ,CURLOPT_URL string) (path-as-is ,CURLOPT_PATH_AS_IS boolean) (protocols ,CURLOPT_PROTOCOLS integer) (redir-protocols ,CURLOPT_REDIR_PROTOCOLS integer) (default-protocol ,CURLOPT_DEFAULT_PROTOCOL string) (proxy ,CURLOPT_PROXY string) (pre-proxy ,CURLOPT_PRE_PROXY string) (proxyport ,CURLOPT_PROXYPORT integer) (proxytype ,CURLOPT_PROXYTYPE integer) (noproxy ,CURLOPT_NOPROXY string) (httpproxytunnel ,CURLOPT_HTTPPROXYTUNNEL boolean) (connect-to ,CURLOPT_CONNECT_TO slist) (socks5-auth, CURLOPT_SOCKS5_AUTH integer) (socks5-gssapi-service ,CURLOPT_SOCKS5_GSSAPI_SERVICE string) (socks5-gssapi-nec ,CURLOPT_SOCKS5_GSSAPI_NEC boolean) (proxy-service-name ,CURLOPT_PROXY_SERVICE_NAME string) (haproxyprotocol ,CURLOPT_HAPROXYPROTOCOL integer) (service-name ,CURLOPT_SERVICE_NAME string) (interface ,CURLOPT_INTERFACE string) (localport ,CURLOPT_LOCALPORT integer) (localportrange ,CURLOPT_LOCALPORTRANGE integer) (dns-cache-timeout ,CURLOPT_DNS_CACHE_TIMEOUT integer) ;; dns-use-global-cache is deprecated (doh-url ,CURLOPT_DOH_URL string) (buffersize ,CURLOPT_BUFFERSIZE integer) (port ,CURLOPT_PORT integer) (tcp-fastopen ,CURLOPT_TCP_FASTOPEN boolean) (tcp-nodelay ,CURLOPT_TCP_NODELAY boolean) (address-scope ,CURLOPT_ADDRESS_SCOPE integer) (tcp-keepalive ,CURLOPT_TCP_KEEPALIVE boolean) (tcp-keepidle ,CURLOPT_TCP_KEEPIDLE integer) (tcp-keepintvl ,CURLOPT_TCP_KEEPINTVL integer) (unix-socket-path ,CURLOPT_UNIX_SOCKET_PATH string) (abstract-unix-socket ,CURLOPT_ABSTRACT_UNIX_SOCKET string) ;; NAMES AND PASSWORD OPTIONS (netrc ,CURLOPT_NETRC integer) (netrc-file ,CURLOPT_NETRC_FILE string) (userpwd ,CURLOPT_USERPWD string) (proxyuserpwd ,CURLOPT_PROXYUSERPWD string) (username ,CURLOPT_USERNAME string) (password ,CURLOPT_PASSWORD string) (login-options ,CURLOPT_LOGIN_OPTIONS string) (proxyusername ,CURLOPT_PROXYUSERNAME string) (proxypassword ,CURLOPT_PROXYPASSWORD string) (httpauth ,CURLOPT_HTTPAUTH integer) (tlsauth-type ,CURLOPT_TLSAUTH_TYPE string) (tlsauth-username ,CURLOPT_TLSAUTH_USERNAME string) (proxy-tlsauth-username ,CURLOPT_PROXY_TLSAUTH_USERNAME string) (tlsauth-password ,CURLOPT_TLSAUTH_PASSWORD string) (proxy-tlsauth-password ,CURLOPT_PROXY_TLSAUTH_PASSWORD string) (tlsauth-type ,CURLOPT_TLSAUTH_TYPE string) (proxy-tlsauth-type ,CURLOPT_PROXY_TLSAUTH_TYPE string) (proxyauth ,CURLOPT_PROXYAUTH integer) (sasl-ir ,CURLOPT_SASL_IR boolean) (xoauth2-bearer ,CURLOPT_XOAUTH2_BEARER string) (disallow-username-in-url ,CURLOPT_DISALLOW_USERNAME_IN_URL boolean) ;; HTTP OPTIONS (autoreferer ,CURLOPT_AUTOREFERER boolean) (accept-encoding ,CURLOPT_ACCEPT_ENCODING string) (transfer-encoding ,CURLOPT_TRANSFER_ENCODING string) (followlocation ,CURLOPT_FOLLOWLOCATION boolean) (unrestricted-auth ,CURLOPT_UNRESTRICTED_AUTH boolean) (maxredirs ,CURLOPT_MAXREDIRS integer) (postredir ,CURLOPT_POSTREDIR integer) (put ,CURLOPT_PUT boolean) (post ,CURLOPT_POST boolean) (postfields ,CURLOPT_POSTFIELDS bytevector) (postfieldsize ,CURLOPT_POSTFIELDSIZE integer) (postfieldsize-large ,CURLOPT_POSTFIELDSIZE_LARGE biginteger) (copypostfields ,CURLOPT_COPYPOSTFIELDS bytevector) (httppost ,CURLOPT_HTTPPOST httppost) (referer ,CURLOPT_REFERER string) (useragent ,CURLOPT_USERAGENT string) (httpheader ,CURLOPT_HTTPHEADER slist) (headeropt ,CURLOPT_HEADEROPT integer) (http200aliases ,CURLOPT_HTTP200ALIASES slist) (cookie ,CURLOPT_COOKIE string) (cookiefile ,CURLOPT_COOKIEFILE string) (cookiejar ,CURLOPT_COOKIEJAR string) (cookiesession ,CURLOPT_COOKIESESSION boolean) (cookielist ,CURLOPT_COOKIELIST string) (httpget ,CURLOPT_HTTPGET boolean) (request-target ,CURLOPT_REQUEST_TARGET string) (http-version ,CURLOPT_HTTP_VERSION integer) (http09-allowed ,CURLOPT_HTTP09_ALLOWED boolean) (ignore-content-length ,CURLOPT_IGNORE_CONTENT_LENGTH boolean) (http-content-decoding ,CURLOPT_HTTP_CONTENT_DECODING boolean) (http-transfer-decoding ,CURLOPT_HTTP_TRANSFER_DECODING boolean) (expect-100-timeout-ms ,CURLOPT_EXPECT_100_TIMEOUT_MS integer) (pipewait ,CURLOPT_PIPEWAIT boolean) (stream-wait ,CURLOPT_STREAM_WEIGHT integer) ;; SMTP OPTIONS (mail-from ,CURLOPT_MAIL_FROM string) (mail-rcpt ,CURLOPT_MAIL_RCPT slist) (mail-auth ,CURLOPT_MAIL_AUTH string) ;; TFTP OPTIONS (tftp-blksize ,CURLOPT_TFTP_BLKSIZE integer) (tftp-no-options ,CURLOPT_TFTP_NO_OPTIONS boolean) ;; FTP OPTIONS (ftpport ,CURLOPT_FTPPORT string) (quote ,CURLOPT_QUOTE slist) (postquote ,CURLOPT_POSTQUOTE slist) (prequote ,CURLOPT_PREQUOTE slist) ;; (dirlistonly ,CURLOPT_DIRLISTONLY boolean) (append ,CURLOPT_APPEND boolean) (ftp-use-eprt ,CURLOPT_FTP_USE_EPRT boolean) (ftp-use-epsv ,CURLOPT_FTP_USE_EPSV boolean) (ftp-use-pret ,CURLOPT_FTP_USE_PRET boolean) (ftp-create-missing-dirs ,CURLOPT_FTP_CREATE_MISSING_DIRS boolean) (ftp-response-timeout ,CURLOPT_FTP_RESPONSE_TIMEOUT integer) (ftp-alternative-to-user ,CURLOPT_FTP_ALTERNATIVE_TO_USER string) (ftp-skip-pasv-ip ,CURLOPT_FTP_SKIP_PASV_IP boolean) (ftpsslauth ,CURLOPT_FTPSSLAUTH integer) (ftp-ssl-ccc ,CURLOPT_FTP_SSL_CCC integer) (ftp-account ,CURLOPT_FTP_ACCOUNT string) (ftp-filemethod ,CURLOPT_FTP_FILEMETHOD integer) ;; RTSP OPTIONS (rtsp-request ,CURLOPT_RTSP_REQUEST integer) (rtsp-session-id ,CURLOPT_RTSP_SESSION_ID string) (rtsp-stream-uri ,CURLOPT_RTSP_STREAM_URI string) (rtsp-transport ,CURLOPT_RTSP_TRANSPORT string) ;; rtsp-header is unimplmented (rtsp-client-cseq ,CURLOPT_RTSP_CLIENT_CSEQ integer) ;; rtsp-server-cseq is unimplemented ;; PROTOCOL OPTIONS (transfertext ,CURLOPT_TRANSFERTEXT boolean) (proxy-transfer-mode ,CURLOPT_PROXY_TRANSFER_MODE boolean) (crlf ,CURLOPT_CRLF boolean) (range ,CURLOPT_RANGE string) (resume-from ,CURLOPT_RESUME_FROM integer) (resume-from-large ,CURLOPT_RESUME_FROM_LARGE biginteger) (customrequest ,CURLOPT_CUSTOMREQUEST string) (filetime ,CURLOPT_FILETIME boolean) (dirlistonly ,CURLOPT_DIRLISTONLY boolean) (nobody ,CURLOPT_NOBODY boolean) (infilesize ,CURLOPT_INFILESIZE integer) (infilesize-large ,CURLOPT_INFILESIZE_LARGE biginteger) (upload ,CURLOPT_UPLOAD boolean) (upload-buffersize ,CURLOPT_UPLOAD_BUFFERSIZE integer) (maxfilesize ,CURLOPT_MAXFILESIZE integer) (maxfilesize-large ,CURLOPT_MAXFILESIZE_LARGE biginteger) (timecondition ,CURLOPT_TIMECONDITION integer) (timevalue ,CURLOPT_TIMEVALUE integer) (timevalue-large ,CURLOPT_TIMEVALUE_LARGE biginteger) ;; CONNECTION OPTIONS (timeout ,CURLOPT_TIMEOUT integer) (timeout-ms ,CURLOPT_TIMEOUT_MS integer) (low-speed-limit ,CURLOPT_LOW_SPEED_LIMIT integer) (low-speed-time ,CURLOPT_LOW_SPEED_TIME integer) (max-send-speed-large ,CURLOPT_MAX_SEND_SPEED_LARGE biginteger) (max-recv-speed-large ,CURLOPT_MAX_RECV_SPEED_LARGE biginteger) (maxconnects ,CURLOPT_MAXCONNECTS integer) ;; closepolicy is obsolete (fresh-connect ,CURLOPT_FRESH_CONNECT boolean) (forbid-reuse ,CURLOPT_FORBID_REUSE boolean) (connecttimeout ,CURLOPT_CONNECTTIMEOUT integer) (connecttimeout-ms ,CURLOPT_CONNECTTIMEOUT_MS integer) (ipresolve ,CURLOPT_IPRESOLVE integer) (connect-only ,CURLOPT_CONNECT_ONLY boolean) (use-ssl ,CURLOPT_USE_SSL integer) (resolve ,CURLOPT_RESOLVE slist) (dns-interface ,CURLOPT_DNS_INTERFACE string) (dns-local-ip4 ,CURLOPT_DNS_LOCAL_IP4 string) (dns-local-ip6 ,CURLOPT_DNS_LOCAL_IP6 string) (dns-shuffle-addresses ,CURLOPT_DNS_SHUFFLE_ADDRESSES boolean) (dns-servers ,CURLOPT_DNS_SERVERS string) (accepttimeout-ms ,CURLOPT_ACCEPTTIMEOUT_MS integer) (happy-eyeballs-timeout-ms ,CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS integer) (upkeep-interval-ms ,CURLOPT_UPKEEP_INTERVAL_MS integer) ;; SSL and SECURITY OPTIONS (sslcert ,CURLOPT_SSLCERT string) (proxy-sslcert ,CURLOPT_PROXY_SSLCERT string) (sslcerttype ,CURLOPT_SSLCERTTYPE string) (proxy-sslcerttype ,CURLOPT_PROXY_SSLCERTTYPE string) (sslkey ,CURLOPT_SSLKEY string) (proxy-sslkey ,CURLOPT_PROXY_SSLKEY string) (sslkeytype ,CURLOPT_SSLKEYTYPE string) (proxy-sslkeytype ,CURLOPT_PROXY_SSLKEYTYPE string) (keypasswd ,CURLOPT_KEYPASSWD string) (proxy-keypasswd ,CURLOPT_PROXY_KEYPASSWD string) (ssl-enable-alpn ,CURLOPT_SSL_ENABLE_ALPN boolean) (ssl-enable-npn ,CURLOPT_SSL_ENABLE_NPN boolean) (sslengine ,CURLOPT_SSLENGINE string) (sslengine-default ,CURLOPT_SSLENGINE_DEFAULT boolean) (ssl-falsestart ,CURLOPT_SSL_FALSESTART boolean) (sslversion ,CURLOPT_SSLVERSION integer) (proxy-sslversion ,CURLOPT_PROXY_SSLVERSION integer) (ssl-verifyhost ,CURLOPT_SSL_VERIFYHOST boolean) (proxy-ssl-verifyhost ,CURLOPT_PROXY_SSL_VERIFYHOST boolean) (ssl-verifypeer ,CURLOPT_SSL_VERIFYPEER boolean) (proxy-ssl-verifypeer ,CURLOPT_PROXY_SSL_VERIFYPEER boolean) (cainfo ,CURLOPT_CAINFO string) (proxy-cainfo ,CURLOPT_PROXY_CAINFO string) (issuercert ,CURLOPT_ISSUERCERT string) (capath ,CURLOPT_CAPATH string) (proxy-capath ,CURLOPT_PROXY_CAPATH string) (crlfile ,CURLOPT_CRLFILE string) (ssl-verifyhost ,CURLOPT_SSL_VERIFYHOST integer) (certinfo ,CURLOPT_CERTINFO boolean) (random-file ,CURLOPT_RANDOM_FILE string) (egdsocket ,CURLOPT_EGDSOCKET string) (ssl-cipher-list ,CURLOPT_SSL_CIPHER_LIST string) (ssl-sessionid-cache ,CURLOPT_SSL_SESSIONID_CACHE boolean) (krblevel ,CURLOPT_KRBLEVEL string) (gssapi-delegation ,CURLOPT_GSSAPI_DELEGATION integer) (ssh-auth-types ,CURLOPT_SSH_AUTH_TYPES integer) (ssh-host-public-key-md5 ,CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 string) (ssh-public-keyfile ,CURLOPT_SSH_PUBLIC_KEYFILE string) (ssh-private-keyfile ,CURLOPT_SSH_PRIVATE_KEYFILE string) (ssh-known-hosts ,CURLOPT_SSH_KNOWNHOSTS string) ;; ssh-keyfunction is unimplemented because it is complicated ;; ssh-keydata ;; private ;; share (new-file-perms ,CURLOPT_NEW_FILE_PERMS integer) (new-directory-perms ,CURLOPT_NEW_DIRECTORY_PERMS integer) (telnetoptions ,CURLOPT_TELNETOPTIONS slist) )) (define (curl-easy-setopt handle option arg) "Apply the option and argument to a given handle. Returns #t on success and #f on failure." (let ((value (assq-ref symbol-options option))) (if value (let ((option (car value)) (type (cadr value))) (cond ((or (and (eq? type 'integer) (integer? arg)) (and (eq? type 'string) (string? arg))) (%curl-easy-setopt handle option arg #f)) ((and (eq? type 'biginteger) (integer? arg)) (%curl-easy-setopt handle option arg #t)) ((eq? type 'boolean) (%curl-easy-setopt handle option (c-bool arg) #f)) ((and (eq? type 'bytevector) (or (string? arg) (bytevector? arg) )) (%curl-easy-setopt handle option arg #f)) ((and (eq? type 'slist) (list? arg) (every string? arg)) (%curl-easy-setopt handle option arg #f)) ((and (eq? type 'httppost) (list? arg)) (%curl-easy-setopt handle option arg #f)) ((and (eq? type 'input-port) (input-port? arg)) (%curl-easy-setopt handle option arg #f)) ((not (member type '(integer boolean string biginteger slist httppost bytevector))) (error (format #f "unimplemented type: ~a" type))) (else (error (format #f "wrong type arg: ~a" arg))))) ;; else (error (format #f "unknown option: ~a" option))))) (define getinfo-options `( (activesocket . ,CURLINFO_ACTIVESOCKET) (appconnect-time . ,CURLINFO_APPCONNECT_TIME) (appconnect-time-t . ,CURLINFO_APPCONNECT_TIME_T) (cainfo . ,CURLINFO_CAINFO) (capath . ,CURLINFO_CAPATH) ;; (certinfo . ,CURLINFO_CERTINFO) (condition-unmet . ,CURLINFO_CONDITION_UNMET) (connect-time . ,CURLINFO_CONNECT_TIME) (connect-time-t . ,CURLINFO_CONNECT_TIME_T) (conn-id . ,CURLINFO_CONN_ID) (content-length-download-t . ,CURLINFO_CONTENT_LENGTH_DOWNLOAD_T) (content-length-upload-t . ,CURLINFO_CONTENT_LENGTH_UPLOAD_T) (cookielist . ,CURLINFO_COOKIELIST) (earlydata-sent-t . ,CURLINFO_EARLYDATA_SENT_T) (effective-method . ,CURLINFO_EFFECTIVE_METHOD) (effective-url . ,CURLINFO_EFFECTIVE_URL) (filetime . ,CURLINFO_FILETIME) (filetime-t . ,CURLINFO_FILETIME_T) (ftp-entry-path . ,CURLINFO_FTP_ENTRY_PATH) (header-size . ,CURLINFO_HEADER_SIZE) (httpauth-avail . ,CURLINFO_HTTPAUTH_AVAIL) (httpauth-used . ,CURLINFO_HTTPAUTH_USED) (http-connectcode . ,CURLINFO_HTTP_CONNECTCODE) (http-version . ,CURLINFO_HTTP_VERSION) (local-ip . ,CURLINFO_LOCAL_IP) (local-port . ,CURLINFO_LOCAL_PORT) (namelookup-time . ,CURLINFO_NAMELOOKUP_TIME) (namelookup-time-t . ,CURLINFO_NAMELOOKUP_TIME_T) (num-connects . ,CURLINFO_NUM_CONNECTS) (os-errno . ,CURLINFO_OS_ERRNO) (posttransfer-time-t . ,CURLINFO_POSTTRANSFER_TIME_T) (pretransfer-time . ,CURLINFO_PRETRANSFER_TIME) (pretransfer-time-t . ,CURLINFO_PRETRANSFER_TIME_T) (primary-ip . ,CURLINFO_PRIMARY_IP) (primary-port . ,CURLINFO_PRIMARY_PORT) (proxyauth-avail . ,CURLINFO_PROXYAUTH_AVAIL) (proxyauth-used . ,CURLINFO_PROXYAUTH_USED) (proxy-error . ,CURLINFO_PROXY_ERROR) (proxy-ssl-verifyresult . ,CURLINFO_PROXY_SSL_VERIFYRESULT) (queue-time-t . ,CURLINFO_QUEUE_TIME_T) (redirect-count . ,CURLINFO_REDIRECT_COUNT) (redirect-time . ,CURLINFO_REDIRECT_TIME) (redirect-time-t . ,CURLINFO_REDIRECT_TIME_T) (redirect-url . ,CURLINFO_REDIRECT_URL) (referer . ,CURLINFO_REFERER) (request-size . ,CURLINFO_REQUEST_SIZE) (response-code . ,CURLINFO_RESPONSE_CODE) (retry-after . ,CURLINFO_RETRY_AFTER) (rtsp-client-cseq . ,CURLINFO_RTSP_CLIENT_CSEQ) (rtsp-cseq-recv . ,CURLINFO_RTSP_CSEQ_RECV) (rtsp-server-cseq . ,CURLINFO_RTSP_SERVER_CSEQ) (rtsp-session-id . ,CURLINFO_RTSP_SESSION_ID) (scheme . ,CURLINFO_SCHEME) (size-download-t . ,CURLINFO_SIZE_DOWNLOAD_T) (size-upload-t . ,CURLINFO_SIZE_UPLOAD_T) (speed-download-t . ,CURLINFO_SPEED_DOWNLOAD_T) (speed-upload-t . ,CURLINFO_SPEED_UPLOAD_T) (ssl-engines . ,CURLINFO_SSL_ENGINES) (ssl-verifyresult . ,CURLINFO_SSL_VERIFYRESULT) (starttransfer-time . ,CURLINFO_STARTTRANSFER_TIME) (starttransfer-time-t . ,CURLINFO_STARTTRANSFER_TIME_T) ;; (tls-ssl-ptr . ,CURLINFO_TLS_SSL_PTR) (total-time . ,CURLINFO_TOTAL_TIME) (total-time-t . ,CURLINFO_TOTAL_TIME_T) (used-proxy . ,CURLINFO_USED_PROXY) (xfer-id . ,CURLINFO_XFER_ID))) (define (curl-easy-getinfo handle option) "This function returns information about the current handle in accordance with the given operation. It usually returns #f on a recoverable error; check curl-error-code or curl-error-string for more information." (let ((value (assq-ref getinfo-options option))) (if value (%curl-easy-getinfo handle value) ;; else (error (format #f "unknown option: ~a" option))))) (define* (curl-easy-perform handle #:optional (bytevector? #f) (header? #f)) "This function is called after the init and all the curl-easy-setopt calls are made, and will perform the transfer as described in the options. It must be called with the same handle as input as the curl_easy_init call returned." (%curl-easy-perform handle bytevector? header?)) (define (curl-error-string) "Returns information about the last error as a string." (%curl-error-string)) (define (curl-error-code) "Returns the libcurl error ID of the last error." (%curl-error-code)) guile-curl-0.10/src/000077500000000000000000000000001517432002600142715ustar00rootroot00000000000000guile-curl-0.10/src/const.c000066400000000000000000000761321517432002600155740ustar00rootroot00000000000000/* Constants for guile-curl Copyright (c) 2013, 2019, 2021, 2025 Michael L. Gran This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include #include #include #include "const.h" #define I(x) SCM cl_ ## x #define __I(x) SCM clb_ ## x #define D(x) cl_ ## x = scm_permanent_object (scm_c_define (#x, scm_from_int ((int) x))) #define __D(x) clb_ ## x = scm_permanent_object (scm_c_define (#x, scm_from_int ((int) x))) #define ND(x) cl_ ## x = scm_permanent_object (scm_c_define (#x, SCM_BOOL_F)) #define __ND(x) clb_ ## x = scm_permanent_object (scm_c_define (#x, SCM_BOOL_F)) /* from curl_easy_setopt */ I(CURLOPT_VERBOSE); I(CURLOPT_HEADER); // CURLOPT_NOPROGRESS is deprecated I(CURLOPT_NOSIGNAL); I(CURLOPT_WILDCARDMATCH); I(CURLOPT_READDATA); // NETWORK OPTIONS I(CURLOPT_URL); I(CURLOPT_PATH_AS_IS); I(CURLOPT_PROTOCOLS); __I(CURLPROTO_ALL); __I(CURLPROTO_DICT); __I(CURLPROTO_FILE); __I(CURLPROTO_FTP); __I(CURLPROTO_FTPS); __I(CURLPROTO_GOPHER); __I(CURLPROTO_HTTP); __I(CURLPROTO_HTTPS); __I(CURLPROTO_IMAP); __I(CURLPROTO_IMAPS); __I(CURLPROTO_LDAP); __I(CURLPROTO_LDAPS); __I(CURLPROTO_POP3); __I(CURLPROTO_POP3S); __I(CURLPROTO_RTMP); __I(CURLPROTO_RTMPE); __I(CURLPROTO_RTMPS); __I(CURLPROTO_RTMPT); __I(CURLPROTO_RTMPTE); __I(CURLPROTO_RTMPTS); __I(CURLPROTO_RTSP); __I(CURLPROTO_SCP); __I(CURLPROTO_SFTP); __I(CURLPROTO_SMB); __I(CURLPROTO_SMBS); __I(CURLPROTO_SMTP); __I(CURLPROTO_SMTPS); __I(CURLPROTO_TELNET); __I(CURLPROTO_TFTP); I(CURLOPT_REDIR_PROTOCOLS); I(CURLOPT_DEFAULT_PROTOCOL); I(CURLOPT_PROXY); I(CURLOPT_PRE_PROXY); I(CURLOPT_PROXYPORT); I(CURLOPT_PROXYTYPE); __I(CURLPROXY_HTTP); __I(CURLPROXY_HTTPS); __I(CURLPROXY_HTTP_1_0); __I(CURLPROXY_SOCKS4); __I(CURLPROXY_SOCKS4A); __I(CURLPROXY_SOCKS5); __I(CURLPROXY_SOCKS5_HOSTNAME); I(CURLOPT_NOPROXY); I(CURLOPT_HTTPPROXYTUNNEL); I(CURLOPT_CONNECT_TO); I(CURLOPT_SOCKS5_AUTH); I(CURLOPT_SOCKS5_GSSAPI_SERVICE); I(CURLOPT_SOCKS5_GSSAPI_NEC); I(CURLOPT_PROXY_SERVICE_NAME); I(CURLOPT_HAPROXYPROTOCOL); I(CURLOPT_SERVICE_NAME); I(CURLOPT_INTERFACE); I(CURLOPT_LOCALPORT); I(CURLOPT_LOCALPORTRANGE); I(CURLOPT_DNS_CACHE_TIMEOUT); // CURLOPT_DNS_USE_GLOBAL_CACHE is deprecated I(CURLOPT_DOH_URL); I(CURLOPT_BUFFERSIZE); I(CURLOPT_PORT); I(CURLOPT_TCP_FASTOPEN); I(CURLOPT_TCP_NODELAY); I(CURLOPT_ADDRESS_SCOPE); I(CURLOPT_TCP_KEEPALIVE); I(CURLOPT_TCP_KEEPIDLE); I(CURLOPT_TCP_KEEPINTVL); I(CURLOPT_UNIX_SOCKET_PATH); I(CURLOPT_ABSTRACT_UNIX_SOCKET); // NAMES AND PASSWORDS OPTIONS I(CURLOPT_NETRC); __I(CURL_NETRC_OPTIONAL); __I(CURL_NETRC_IGNORED); __I(CURL_NETRC_REQUIRED); I(CURLOPT_NETRC_FILE); I(CURLOPT_USERPWD); I(CURLOPT_PROXYUSERPWD); I(CURLOPT_USERNAME); I(CURLOPT_PASSWORD); I(CURLOPT_LOGIN_OPTIONS); I(CURLOPT_PROXYUSERNAME); I(CURLOPT_PROXYPASSWORD); I(CURLOPT_HTTPAUTH); __I(CURLAUTH_BASIC); __I(CURLAUTH_DIGEST); __I(CURLAUTH_DIGEST_IE); __I(CURLAUTH_BEARER); __I(CURLAUTH_NEGOTIATE); __I(CURLAUTH_NTLM); __I(CURLAUTH_NTLM_WB); __I(CURLAUTH_ANY); __I(CURLAUTH_ANYSAFE); __I(CURLAUTH_ONLY); I(CURLOPT_TLSAUTH_USERNAME); I(CURLOPT_PROXY_TLSAUTH_USERNAME); I(CURLOPT_TLSAUTH_PASSWORD); I(CURLOPT_PROXY_TLSAUTH_PASSWORD); I(CURLOPT_TLSAUTH_TYPE); I(CURLOPT_PROXY_TLSAUTH_TYPE); I(CURLOPT_PROXYAUTH); I(CURLOPT_SASL_IR); I(CURLOPT_XOAUTH2_BEARER); I(CURLOPT_DISALLOW_USERNAME_IN_URL); // HTTP OPTIONS I(CURLOPT_AUTOREFERER); I(CURLOPT_ACCEPT_ENCODING); I(CURLOPT_TRANSFER_ENCODING); I(CURLOPT_FOLLOWLOCATION); I(CURLOPT_UNRESTRICTED_AUTH); I(CURLOPT_MAXREDIRS); I(CURLOPT_POSTREDIR); __I(CURL_REDIR_POST_301); __I(CURL_REDIR_POST_302); __I(CURL_REDIR_POST_303); __I(CURL_REDIR_POST_ALL); I(CURLOPT_PUT); I(CURLOPT_POST); I(CURLOPT_POSTFIELDS); I(CURLOPT_POSTFIELDSIZE); I(CURLOPT_POSTFIELDSIZE_LARGE); I(CURLOPT_COPYPOSTFIELDS); I(CURLOPT_HTTPPOST); I(CURLOPT_REFERER); I(CURLOPT_USERAGENT); I(CURLOPT_HTTPHEADER); I(CURLOPT_HEADEROPT); I(CURLOPT_PROXYHEADER); I(CURLOPT_HTTP200ALIASES); I(CURLOPT_COOKIE); I(CURLOPT_COOKIEFILE); I(CURLOPT_COOKIEJAR); I(CURLOPT_COOKIESESSION); I(CURLOPT_COOKIELIST); I(CURLOPT_HTTPGET); I(CURLOPT_REQUEST_TARGET); I(CURLOPT_HTTP_VERSION); __I(CURL_HTTP_VERSION_NONE); __I(CURL_HTTP_VERSION_1_0); __I(CURL_HTTP_VERSION_1_1); __I(CURL_HTTP_VERSION_2_0); __I(CURL_HTTP_VERSION_2TLS); __I(CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); I(CURLOPT_HTTP09_ALLOWED); I(CURLOPT_IGNORE_CONTENT_LENGTH); I(CURLOPT_HTTP_CONTENT_DECODING); I(CURLOPT_HTTP_TRANSFER_DECODING); I(CURLOPT_EXPECT_100_TIMEOUT_MS); I(CURLOPT_PIPEWAIT); I(CURLOPT_STREAM_WEIGHT); // SMTP OPTIONS I(CURLOPT_MAIL_FROM); I(CURLOPT_MAIL_RCPT); I(CURLOPT_MAIL_AUTH); // TFTP OPTIONS I(CURLOPT_TFTP_BLKSIZE); I(CURLOPT_TFTP_NO_OPTIONS); // FTP OPTIONS I(CURLOPT_FTPPORT); I(CURLOPT_QUOTE); I(CURLOPT_POSTQUOTE); I(CURLOPT_PREQUOTE); I(CURLOPT_APPEND); I(CURLOPT_FTP_USE_EPRT); I(CURLOPT_FTP_USE_EPSV); I(CURLOPT_FTP_USE_PRET); I(CURLOPT_FTP_CREATE_MISSING_DIRS); I(CURLOPT_FTP_RESPONSE_TIMEOUT); I(CURLOPT_FTP_ALTERNATIVE_TO_USER); I(CURLOPT_FTP_SKIP_PASV_IP); I(CURLOPT_FTPSSLAUTH); __I(CURLFTPAUTH_DEFAULT); __I(CURLFTPAUTH_SSL); __I(CURLFTPAUTH_TLS); I(CURLOPT_FTP_SSL_CCC); __I(CURLFTPSSL_CCC_NONE); __I(CURLFTPSSL_CCC_PASSIVE); __I(CURLFTPSSL_CCC_ACTIVE); I(CURLOPT_FTP_ACCOUNT); I(CURLOPT_FTP_FILEMETHOD); __I(CURLFTPMETHOD_MULTICWD); __I(CURLFTPMETHOD_NOCWD); __I(CURLFTPMETHOD_SINGLECWD); // RSTP OPTIONS I(CURLOPT_RTSP_REQUEST); __I(CURL_RTSPREQ_OPTIONS); __I(CURL_RTSPREQ_DESCRIBE); __I(CURL_RTSPREQ_ANNOUNCE); __I(CURL_RTSPREQ_SETUP); __I(CURL_RTSPREQ_PLAY); __I(CURL_RTSPREQ_PAUSE); __I(CURL_RTSPREQ_TEARDOWN); __I(CURL_RTSPREQ_GET_PARAMETER); __I(CURL_RTSPREQ_SET_PARAMETER); __I(CURL_RTSPREQ_RECORD); __I(CURL_RTSPREQ_RECEIVE); I(CURLOPT_RTSP_SESSION_ID); I(CURLOPT_RTSP_STREAM_URI); I(CURLOPT_RTSP_TRANSPORT); // CURLOPT_RTSP_HEADER is unimplemented I(CURLOPT_RTSP_CLIENT_CSEQ); // CURLOPT_RTSP_SERVER_CSEQ is unimplemented // PROTOCOL OPTIONS I(CURLOPT_TRANSFERTEXT); I(CURLOPT_PROXY_TRANSFER_MODE); I(CURLOPT_CRLF); I(CURLOPT_RANGE); I(CURLOPT_RESUME_FROM); I(CURLOPT_RESUME_FROM_LARGE); I(CURLOPT_CUSTOMREQUEST); I(CURLOPT_FILETIME); I(CURLOPT_DIRLISTONLY); I(CURLOPT_NOBODY); I(CURLOPT_INFILESIZE); I(CURLOPT_INFILESIZE_LARGE); I(CURLOPT_UPLOAD); I(CURLOPT_UPLOAD_BUFFERSIZE); I(CURLOPT_MAXFILESIZE); I(CURLOPT_MAXFILESIZE_LARGE); I(CURLOPT_TIMECONDITION); I(CURLOPT_TIMEVALUE); I(CURLOPT_TIMEVALUE_LARGE); // CONNECTION OPTIONS I(CURLOPT_TIMEOUT); I(CURLOPT_TIMEOUT_MS); I(CURLOPT_LOW_SPEED_LIMIT); I(CURLOPT_LOW_SPEED_TIME); I(CURLOPT_MAX_SEND_SPEED_LARGE); I(CURLOPT_MAX_RECV_SPEED_LARGE); I(CURLOPT_MAXCONNECTS); // CURLOPT_CLOSEPOLICY is obsolete I(CURLOPT_FRESH_CONNECT); I(CURLOPT_FORBID_REUSE); I(CURLOPT_CONNECTTIMEOUT); I(CURLOPT_CONNECTTIMEOUT_MS); I(CURLOPT_IPRESOLVE); __I(CURL_IPRESOLVE_WHATEVER); __I(CURL_IPRESOLVE_V4); __I(CURL_IPRESOLVE_V6); I(CURLOPT_CONNECT_ONLY); I(CURLOPT_USE_SSL); __I(CURLUSESSL_NONE); __I(CURLUSESSL_TRY); __I(CURLUSESSL_CONTROL); __I(CURLUSESSL_ALL); I(CURLOPT_RESOLVE); I(CURLOPT_DNS_INTERFACE); I(CURLOPT_DNS_LOCAL_IP4); I(CURLOPT_DNS_LOCAL_IP6); I(CURLOPT_DNS_SERVERS); I(CURLOPT_DNS_SHUFFLE_ADDRESSES); I(CURLOPT_ACCEPTTIMEOUT_MS); I(CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS); I(CURLOPT_UPKEEP_INTERVAL_MS); // SSL AND SECURITY OPTIONS I(CURLOPT_SSLCERT); I(CURLOPT_PROXY_SSLCERT); I(CURLOPT_SSLCERTTYPE); I(CURLOPT_PROXY_SSLCERTTYPE); I(CURLOPT_SSLKEY); I(CURLOPT_PROXY_SSLKEY); I(CURLOPT_SSLKEYTYPE); I(CURLOPT_PROXY_SSLKEYTYPE); I(CURLOPT_KEYPASSWD); I(CURLOPT_PROXY_KEYPASSWD); I(CURLOPT_SSL_ENABLE_ALPN); I(CURLOPT_SSL_ENABLE_NPN); I(CURLOPT_SSLENGINE); I(CURLOPT_SSLENGINE_DEFAULT); I(CURLOPT_SSL_FALSESTART); I(CURLOPT_SSLVERSION); __I(CURL_SSLVERSION_DEFAULT); __I(CURL_SSLVERSION_TLSv1); __I(CURL_SSLVERSION_TLSv1_0); __I(CURL_SSLVERSION_TLSv1_1); __I(CURL_SSLVERSION_TLSv1_2); __I(CURL_SSLVERSION_TLSv1_3); __I(CURL_SSLVERSION_MAX_DEFAULT); __I(CURL_SSLVERSION_MAX_TLSv1_0); __I(CURL_SSLVERSION_MAX_TLSv1_1); __I(CURL_SSLVERSION_MAX_TLSv1_2); __I(CURL_SSLVERSION_MAX_TLSv1_3); __I(CURL_SSLVERSION_SSLv2); __I(CURL_SSLVERSION_SSLv3); I(CURLOPT_PROXY_SSLVERSION); I(CURLOPT_SSL_VERIFYHOST); I(CURLOPT_PROXY_SSL_VERIFYHOST); I(CURLOPT_SSL_VERIFYPEER); I(CURLOPT_PROXY_SSL_VERIFYPEER); I(CURLOPT_CAINFO); I(CURLOPT_PROXY_CAINFO); I(CURLOPT_ISSUERCERT); I(CURLOPT_CAPATH); I(CURLOPT_PROXY_CAPATH); I(CURLOPT_CRLFILE); I(CURLOPT_SSL_VERIFYHOST); I(CURLOPT_CERTINFO); I(CURLOPT_RANDOM_FILE); I(CURLOPT_EGDSOCKET); I(CURLOPT_SSL_CIPHER_LIST); I(CURLOPT_SSL_SESSIONID_CACHE); I(CURLOPT_KRBLEVEL); I(CURLOPT_GSSAPI_DELEGATION); __I(CURLGSSAPI_DELEGATION_FLAG); __I(CURLGSSAPI_DELEGATION_POLICY_FLAG); I(CURLOPT_SSH_AUTH_TYPES); __I(CURLSSH_AUTH_PUBLICKEY); __I(CURLSSH_AUTH_PASSWORD); __I(CURLSSH_AUTH_HOST); __I(CURLSSH_AUTH_KEYBOARD); __I(CURLSSH_AUTH_ANY); I(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5); I(CURLOPT_SSH_PUBLIC_KEYFILE); I(CURLOPT_SSH_PRIVATE_KEYFILE); I(CURLOPT_SSH_KNOWNHOSTS); // CURLOPT_SSH_KEYFUNCTION is complicated //__I(CURLKHSTAT_FINE_ADD_TO_FILE); //__I(CURLKHSTAT_FINE); //__I(CURLKHSTAT_REJECT); //__I(CURLKHSTAT_DEFER); //I(CURLOPT_SSH_KEYDATA); //I(CURLOPT_PRIVATE); //I(CURLOPT_SHARE); I(CURLOPT_NEW_FILE_PERMS); I(CURLOPT_NEW_DIRECTORY_PERMS); I(CURLOPT_TELNETOPTIONS); // CURLINFO OPTIONS I(CURLINFO_ACTIVESOCKET); I(CURLINFO_APPCONNECT_TIME); I(CURLINFO_APPCONNECT_TIME_T); I(CURLINFO_CAINFO); I(CURLINFO_CAPATH); I(CURLINFO_CERTINFO); I(CURLINFO_CONDITION_UNMET); I(CURLINFO_CONNECT_TIME); I(CURLINFO_CONNECT_TIME_T); I(CURLINFO_CONN_ID); I(CURLINFO_CONTENT_LENGTH_DOWNLOAD_T); I(CURLINFO_CONTENT_LENGTH_UPLOAD_T); I(CURLINFO_COOKIELIST); I(CURLINFO_EARLYDATA_SENT_T); I(CURLINFO_EFFECTIVE_METHOD); I(CURLINFO_EFFECTIVE_URL); I(CURLINFO_FILETIME); I(CURLINFO_FILETIME_T); I(CURLINFO_FTP_ENTRY_PATH); I(CURLINFO_HEADER_SIZE); I(CURLINFO_HTTPAUTH_AVAIL); I(CURLINFO_HTTPAUTH_USED); I(CURLINFO_HTTP_CONNECTCODE); I(CURLINFO_HTTP_VERSION); I(CURLINFO_LOCAL_IP); I(CURLINFO_LOCAL_PORT); I(CURLINFO_NAMELOOKUP_TIME); I(CURLINFO_NAMELOOKUP_TIME_T); I(CURLINFO_NUM_CONNECTS); I(CURLINFO_OS_ERRNO); I(CURLINFO_POSTTRANSFER_TIME_T); I(CURLINFO_PRETRANSFER_TIME); I(CURLINFO_PRETRANSFER_TIME_T); I(CURLINFO_PRIMARY_IP); I(CURLINFO_PRIMARY_PORT); I(CURLINFO_PROXYAUTH_AVAIL); I(CURLINFO_PROXYAUTH_USED); I(CURLINFO_PROXY_ERROR); I(CURLINFO_PROXY_SSL_VERIFYRESULT); I(CURLINFO_QUEUE_TIME_T); I(CURLINFO_REDIRECT_COUNT); I(CURLINFO_REDIRECT_TIME); I(CURLINFO_REDIRECT_TIME_T); I(CURLINFO_REDIRECT_URL); I(CURLINFO_REFERER); I(CURLINFO_REQUEST_SIZE); I(CURLINFO_RESPONSE_CODE); I(CURLINFO_RETRY_AFTER); I(CURLINFO_RTSP_CLIENT_CSEQ); I(CURLINFO_RTSP_CSEQ_RECV); I(CURLINFO_RTSP_SERVER_CSEQ); I(CURLINFO_RTSP_SESSION_ID); I(CURLINFO_SCHEME); I(CURLINFO_SIZE_DOWNLOAD_T); I(CURLINFO_SIZE_UPLOAD_T); I(CURLINFO_SPEED_DOWNLOAD_T); I(CURLINFO_SPEED_UPLOAD_T); I(CURLINFO_SSL_ENGINES); I(CURLINFO_SSL_VERIFYRESULT); I(CURLINFO_STARTTRANSFER_TIME); I(CURLINFO_STARTTRANSFER_TIME_T); I(CURLINFO_TLS_SSL_PTR); I(CURLINFO_TOTAL_TIME); I(CURLINFO_TOTAL_TIME_T); I(CURLINFO_USED_PROXY); I(CURLINFO_XFER_ID); /* ERROR CODES */ I(CURLE_OK); I(CURLE_UNSUPPORTED_PROTOCOL); I(CURLE_FAILED_INIT); I(CURLE_URL_MALFORMAT); I(CURLE_NOT_BUILT_IN); I(CURLE_COULDNT_RESOLVE_PROXY); I(CURLE_COULDNT_RESOLVE_HOST); I(CURLE_COULDNT_CONNECT); I(CURLE_FTP_WEIRD_SERVER_REPLY); I(CURLE_REMOTE_ACCESS_DENIED); I(CURLE_FTP_ACCEPT_FAILED); I(CURLE_FTP_WEIRD_PASS_REPLY); I(CURLE_FTP_ACCEPT_TIMEOUT); I(CURLE_FTP_WEIRD_PASV_REPLY); I(CURLE_FTP_WEIRD_227_FORMAT); I(CURLE_FTP_CANT_GET_HOST); I(CURLE_HTTP2); I(CURLE_FTP_COULDNT_SET_TYPE); I(CURLE_PARTIAL_FILE); I(CURLE_FTP_COULDNT_RETR_FILE); I(CURLE_FTP_QUOTE_ERROR); I(CURLE_HTTP_RETURNED_ERROR); I(CURLE_WRITE_ERROR); I(CURLE_UPLOAD_FAILED); I(CURLE_READ_ERROR); I(CURLE_OUT_OF_MEMORY); I(CURLE_OPERATION_TIMEDOUT); I(CURLE_FTP_PORT_FAILED); I(CURLE_FTP_COULDNT_USE_REST); I(CURLE_RANGE_ERROR); I(CURLE_HTTP_POST_ERROR); I(CURLE_SSL_CONNECT_ERROR); I(CURLE_BAD_DOWNLOAD_RESUME); I(CURLE_FILE_COULDNT_READ_FILE); I(CURLE_LDAP_CANNOT_BIND); I(CURLE_LDAP_SEARCH_FAILED); I(CURLE_FUNCTION_NOT_FOUND); I(CURLE_ABORTED_BY_CALLBACK); I(CURLE_BAD_FUNCTION_ARGUMENT); I(CURLE_INTERFACE_FAILED); I(CURLE_TOO_MANY_REDIRECTS); I(CURLE_UNKNOWN_OPTION); I(CURLE_TELNET_OPTION_SYNTAX); I(CURLE_GOT_NOTHING); I(CURLE_SSL_ENGINE_NOTFOUND); I(CURLE_SSL_ENGINE_SETFAILED); I(CURLE_SEND_ERROR); I(CURLE_RECV_ERROR); I(CURLE_SSL_CERTPROBLEM); I(CURLE_SSL_CIPHER); I(CURLE_PEER_FAILED_VERIFICATION); //I(CURLE_SSL_CACERT); I(CURLE_BAD_CONTENT_ENCODING); I(CURLE_LDAP_INVALID_URL); I(CURLE_FILESIZE_EXCEEDED); I(CURLE_USE_SSL_FAILED); I(CURLE_SEND_FAIL_REWIND); I(CURLE_SSL_ENGINE_INITFAILED); I(CURLE_LOGIN_DENIED); I(CURLE_TFTP_NOTFOUND); I(CURLE_TFTP_PERM); I(CURLE_REMOTE_DISK_FULL); I(CURLE_TFTP_ILLEGAL); I(CURLE_TFTP_UNKNOWNID); I(CURLE_REMOTE_FILE_EXISTS); I(CURLE_TFTP_NOSUCHUSER); I(CURLE_CONV_FAILED); I(CURLE_CONV_REQD); I(CURLE_SSL_CACERT_BADFILE); I(CURLE_REMOTE_FILE_NOT_FOUND); I(CURLE_SSH); I(CURLE_SSL_SHUTDOWN_FAILED); I(CURLE_AGAIN); I(CURLE_SSL_CRL_BADFILE); I(CURLE_SSL_ISSUER_ERROR); I(CURLE_FTP_PRET_FAILED); I(CURLE_RTSP_CSEQ_ERROR); I(CURLE_FTP_BAD_FILE_LIST); I(CURLE_CHUNK_FAILED); I(CURLE_NO_CONNECTION_AVAILABLE); I(CURLE_SSL_PINNEDPUBKEYNOTMATCH); I(CURLE_SSL_INVALIDCERTSTATUS); I(CURLE_HTTP2_STREAM); I(CURLE_RECURSIVE_API_CALL); // PROXY ERROR CODES I(CURLPX_OK); I(CURLPX_BAD_ADDRESS_TYPE); I(CURLPX_BAD_VERSION); I(CURLPX_CLOSED); I(CURLPX_GSSAPI); I(CURLPX_GSSAPI_PERMSG); I(CURLPX_GSSAPI_PROTECTION); I(CURLPX_IDENTD); I(CURLPX_IDENTD_DIFFER); I(CURLPX_LONG_HOSTNAME); I(CURLPX_LONG_PASSWD); I(CURLPX_LONG_USER); I(CURLPX_NO_AUTH); I(CURLPX_RECV_ADDRESS); I(CURLPX_RECV_AUTH); I(CURLPX_RECV_CONNECT); I(CURLPX_RECV_REQACK); I(CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED); I(CURLPX_REPLY_COMMAND_NOT_SUPPORTED); I(CURLPX_REPLY_CONNECTION_REFUSED); I(CURLPX_REPLY_GENERAL_SERVER_FAILURE); I(CURLPX_REPLY_HOST_UNREACHABLE); I(CURLPX_REPLY_NETWORK_UNREACHABLE); I(CURLPX_REPLY_NOT_ALLOWED); I(CURLPX_REPLY_TTL_EXPIRED); I(CURLPX_REPLY_UNASSIGNED); I(CURLPX_REQUEST_FAILED); I(CURLPX_RESOLVE_HOST); I(CURLPX_SEND_AUTH); I(CURLPX_SEND_CONNECT); I(CURLPX_SEND_REQUEST); I(CURLPX_UNKNOWN_FAIL); I(CURLPX_UNKNOWN_MODE); I(CURLPX_USER_REJECTED); void cl_init_const () { D(CURLOPT_VERBOSE); D(CURLOPT_HEADER); // CURLOPT_NOPROGRESS is deprecated D(CURLOPT_NOSIGNAL); D(CURLOPT_WILDCARDMATCH); D(CURLOPT_READDATA); // NETWORK OPTIONS D(CURLOPT_URL); D(CURLOPT_PATH_AS_IS); D(CURLOPT_PROTOCOLS); __D(CURLPROTO_ALL); __D(CURLPROTO_DICT); __D(CURLPROTO_FILE); __D(CURLPROTO_FTP); __D(CURLPROTO_FTPS); __D(CURLPROTO_GOPHER); __D(CURLPROTO_HTTP); __D(CURLPROTO_HTTPS); __D(CURLPROTO_IMAP); __D(CURLPROTO_IMAPS); __D(CURLPROTO_LDAP); __D(CURLPROTO_LDAPS); __D(CURLPROTO_POP3); __D(CURLPROTO_POP3S); __D(CURLPROTO_RTMP); __D(CURLPROTO_RTMPE); __D(CURLPROTO_RTMPS); __D(CURLPROTO_RTMPT); __D(CURLPROTO_RTMPTE); __D(CURLPROTO_RTMPTS); __D(CURLPROTO_RTSP); __D(CURLPROTO_SCP); __D(CURLPROTO_SFTP); __D(CURLPROTO_SMB); __D(CURLPROTO_SMBS); __D(CURLPROTO_SMTP); __D(CURLPROTO_SMTPS); __D(CURLPROTO_TELNET); __D(CURLPROTO_TFTP); D(CURLOPT_REDIR_PROTOCOLS); D(CURLOPT_DEFAULT_PROTOCOL); D(CURLOPT_PROXY); D(CURLOPT_PRE_PROXY); D(CURLOPT_PROXYPORT); D(CURLOPT_PROXYTYPE); __D(CURLPROXY_HTTP); __D(CURLPROXY_HTTPS); __D(CURLPROXY_HTTP_1_0); __D(CURLPROXY_SOCKS4); __D(CURLPROXY_SOCKS4A); __D(CURLPROXY_SOCKS5); __D(CURLPROXY_SOCKS5_HOSTNAME); D(CURLOPT_NOPROXY); D(CURLOPT_HTTPPROXYTUNNEL); D(CURLOPT_CONNECT_TO); D(CURLOPT_SOCKS5_AUTH); D(CURLOPT_SOCKS5_GSSAPI_SERVICE); D(CURLOPT_SOCKS5_GSSAPI_NEC); D(CURLOPT_PROXY_SERVICE_NAME); #ifdef CURLOPT_HAPROXYPROTOCOL D(CURLOPT_HAPROXYPROTOCOL); #else ND(CURLOPT_HAPROXYPROTOCOL); #endif D(CURLOPT_SERVICE_NAME); D(CURLOPT_INTERFACE); D(CURLOPT_LOCALPORT); D(CURLOPT_LOCALPORTRANGE); D(CURLOPT_DNS_CACHE_TIMEOUT); // CURLOPT_DNS_USE_GLOBAL_CACHE is deprecated #ifdef CURLOPT_DOH_URL D(CURLOPT_DOH_URL); #else ND(CURLOPT_DOH_URL); #endif D(CURLOPT_BUFFERSIZE); D(CURLOPT_PORT); D(CURLOPT_TCP_FASTOPEN); D(CURLOPT_TCP_NODELAY); D(CURLOPT_ADDRESS_SCOPE); D(CURLOPT_TCP_KEEPALIVE); D(CURLOPT_TCP_KEEPIDLE); D(CURLOPT_TCP_KEEPINTVL); D(CURLOPT_UNIX_SOCKET_PATH); D(CURLOPT_ABSTRACT_UNIX_SOCKET); // NAMES AND PASSWORDS OPTIONS D(CURLOPT_NETRC); __D(CURL_NETRC_OPTIONAL); __D(CURL_NETRC_IGNORED); __D(CURL_NETRC_REQUIRED); D(CURLOPT_NETRC_FILE); D(CURLOPT_USERPWD); D(CURLOPT_PROXYUSERPWD); D(CURLOPT_USERNAME); D(CURLOPT_PASSWORD); D(CURLOPT_LOGIN_OPTIONS); D(CURLOPT_PROXYUSERNAME); D(CURLOPT_PROXYPASSWORD); D(CURLOPT_HTTPAUTH); __D(CURLAUTH_BASIC); __D(CURLAUTH_DIGEST); __D(CURLAUTH_DIGEST_IE); #ifdef CURLAUTH_BEARER __D(CURLAUTH_BEARER); #else __ND(CURLAUTH_BEARER); #endif __D(CURLAUTH_NEGOTIATE); __D(CURLAUTH_NTLM); __D(CURLAUTH_NTLM_WB); __D(CURLAUTH_ANY); __D(CURLAUTH_ANYSAFE); __D(CURLAUTH_ONLY); D(CURLOPT_TLSAUTH_USERNAME); D(CURLOPT_PROXY_TLSAUTH_USERNAME); D(CURLOPT_TLSAUTH_PASSWORD); D(CURLOPT_PROXY_TLSAUTH_PASSWORD); D(CURLOPT_TLSAUTH_TYPE); D(CURLOPT_PROXY_TLSAUTH_TYPE); D(CURLOPT_PROXYAUTH); D(CURLOPT_SASL_IR); D(CURLOPT_XOAUTH2_BEARER); #ifdef CURLOPT_DISALLOW_USERNAME_IN_URL D(CURLOPT_DISALLOW_USERNAME_IN_URL); #else ND(CURLOPT_DISALLOW_USERNAME_IN_URL); #endif // HTTP OPTIONS D(CURLOPT_AUTOREFERER); D(CURLOPT_ACCEPT_ENCODING); D(CURLOPT_TRANSFER_ENCODING); D(CURLOPT_FOLLOWLOCATION); D(CURLOPT_UNRESTRICTED_AUTH); D(CURLOPT_MAXREDIRS); D(CURLOPT_POSTREDIR); __D(CURL_REDIR_POST_301); __D(CURL_REDIR_POST_302); __D(CURL_REDIR_POST_303); __D(CURL_REDIR_POST_ALL); D(CURLOPT_PUT); D(CURLOPT_POST); D(CURLOPT_POSTFIELDS); D(CURLOPT_POSTFIELDSIZE); D(CURLOPT_POSTFIELDSIZE_LARGE); D(CURLOPT_COPYPOSTFIELDS); D(CURLOPT_HTTPPOST); D(CURLOPT_REFERER); D(CURLOPT_USERAGENT); D(CURLOPT_HTTPHEADER); D(CURLOPT_HEADEROPT); D(CURLOPT_PROXYHEADER); D(CURLOPT_HTTP200ALIASES); D(CURLOPT_COOKIE); D(CURLOPT_COOKIEFILE); D(CURLOPT_COOKIEJAR); D(CURLOPT_COOKIESESSION); D(CURLOPT_COOKIELIST); D(CURLOPT_HTTPGET); D(CURLOPT_REQUEST_TARGET); D(CURLOPT_HTTP_VERSION); __D(CURL_HTTP_VERSION_NONE); __D(CURL_HTTP_VERSION_1_0); __D(CURL_HTTP_VERSION_1_1); __D(CURL_HTTP_VERSION_2_0); __D(CURL_HTTP_VERSION_2TLS); __D(CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); #ifdef CURLOPT_HTTP09_ALLOWED D(CURLOPT_HTTP09_ALLOWED); #else ND(CURLOPT_HTTP09_ALLOWED); #endif D(CURLOPT_IGNORE_CONTENT_LENGTH); D(CURLOPT_HTTP_CONTENT_DECODING); D(CURLOPT_HTTP_TRANSFER_DECODING); D(CURLOPT_EXPECT_100_TIMEOUT_MS); D(CURLOPT_PIPEWAIT); D(CURLOPT_STREAM_WEIGHT); // SMTP OPTIONS D(CURLOPT_MAIL_FROM); D(CURLOPT_MAIL_RCPT); D(CURLOPT_MAIL_AUTH); // TFTP OPTIONS D(CURLOPT_TFTP_BLKSIZE); D(CURLOPT_TFTP_NO_OPTIONS); // FTP OPTIONS D(CURLOPT_FTPPORT); D(CURLOPT_QUOTE); D(CURLOPT_POSTQUOTE); D(CURLOPT_PREQUOTE); D(CURLOPT_APPEND); D(CURLOPT_FTP_USE_EPRT); D(CURLOPT_FTP_USE_EPSV); D(CURLOPT_FTP_USE_PRET); D(CURLOPT_FTP_CREATE_MISSING_DIRS); D(CURLOPT_FTP_RESPONSE_TIMEOUT); D(CURLOPT_FTP_ALTERNATIVE_TO_USER); D(CURLOPT_FTP_SKIP_PASV_IP); D(CURLOPT_FTPSSLAUTH); __D(CURLFTPAUTH_DEFAULT); __D(CURLFTPAUTH_SSL); __D(CURLFTPAUTH_TLS); D(CURLOPT_FTP_SSL_CCC); __D(CURLFTPSSL_CCC_NONE); __D(CURLFTPSSL_CCC_PASSIVE); __D(CURLFTPSSL_CCC_ACTIVE); D(CURLOPT_FTP_ACCOUNT); D(CURLOPT_FTP_FILEMETHOD); __D(CURLFTPMETHOD_MULTICWD); __D(CURLFTPMETHOD_NOCWD); __D(CURLFTPMETHOD_SINGLECWD); // RSTP OPTIONS D(CURLOPT_RTSP_REQUEST); __D(CURL_RTSPREQ_OPTIONS); __D(CURL_RTSPREQ_DESCRIBE); __D(CURL_RTSPREQ_ANNOUNCE); __D(CURL_RTSPREQ_SETUP); __D(CURL_RTSPREQ_PLAY); __D(CURL_RTSPREQ_PAUSE); __D(CURL_RTSPREQ_TEARDOWN); __D(CURL_RTSPREQ_GET_PARAMETER); __D(CURL_RTSPREQ_SET_PARAMETER); __D(CURL_RTSPREQ_RECORD); __D(CURL_RTSPREQ_RECEIVE); D(CURLOPT_RTSP_SESSION_ID); D(CURLOPT_RTSP_STREAM_URI); D(CURLOPT_RTSP_TRANSPORT); // CURLOPT_RTSP_HEADER is unimplemented D(CURLOPT_RTSP_CLIENT_CSEQ); // CURLOPT_RTSP_SERVER_CSEQ is unimplemented // PROTOCOL OPTIONS D(CURLOPT_TRANSFERTEXT); D(CURLOPT_PROXY_TRANSFER_MODE); D(CURLOPT_CRLF); D(CURLOPT_RANGE); D(CURLOPT_RESUME_FROM); D(CURLOPT_RESUME_FROM_LARGE); D(CURLOPT_CUSTOMREQUEST); D(CURLOPT_FILETIME); D(CURLOPT_DIRLISTONLY); D(CURLOPT_NOBODY); D(CURLOPT_INFILESIZE); D(CURLOPT_INFILESIZE_LARGE); D(CURLOPT_UPLOAD); #ifdef CURLOPT_UPLOAD_BUFFERSIZE D(CURLOPT_UPLOAD_BUFFERSIZE); #else ND(CURLOPT_UPLOAD_BUFFERSIZE); #endif D(CURLOPT_MAXFILESIZE); D(CURLOPT_MAXFILESIZE_LARGE); D(CURLOPT_TIMECONDITION); D(CURLOPT_TIMEVALUE); #ifdef CURLOPT_TIMEVALUE_LARGE D(CURLOPT_TIMEVALUE_LARGE); #else ND(CURLOPT_TIMEVALUE_LARGE); #endif // CONNECTION OPTIONS D(CURLOPT_TIMEOUT); D(CURLOPT_TIMEOUT_MS); D(CURLOPT_LOW_SPEED_LIMIT); D(CURLOPT_LOW_SPEED_TIME); D(CURLOPT_MAX_SEND_SPEED_LARGE); D(CURLOPT_MAX_RECV_SPEED_LARGE); D(CURLOPT_MAXCONNECTS); // CURLOPT_CLOSEPOLICY is obsolete D(CURLOPT_FRESH_CONNECT); D(CURLOPT_FORBID_REUSE); D(CURLOPT_CONNECTTIMEOUT); D(CURLOPT_CONNECTTIMEOUT_MS); D(CURLOPT_IPRESOLVE); __D(CURL_IPRESOLVE_WHATEVER); __D(CURL_IPRESOLVE_V4); __D(CURL_IPRESOLVE_V6); D(CURLOPT_CONNECT_ONLY); D(CURLOPT_USE_SSL); __D(CURLUSESSL_NONE); __D(CURLUSESSL_TRY); __D(CURLUSESSL_CONTROL); __D(CURLUSESSL_ALL); D(CURLOPT_RESOLVE); D(CURLOPT_DNS_INTERFACE); D(CURLOPT_DNS_LOCAL_IP4); D(CURLOPT_DNS_LOCAL_IP6); D(CURLOPT_DNS_SERVERS); #ifdef CURLOPT_DNS_SHUFFLE_ADDRESSES D(CURLOPT_DNS_SHUFFLE_ADDRESSES); #else ND(CURLOPT_DNS_SHUFFLE_ADDRESSES); #endif D(CURLOPT_ACCEPTTIMEOUT_MS); #ifdef CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS D(CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS); #else ND(CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS); #endif #ifdef CURLOPT_UPKEEP_INTERVAL_MS D(CURLOPT_UPKEEP_INTERVAL_MS); #else ND(CURLOPT_UPKEEP_INTERVAL_MS); #endif // SSL AND SECURITY OPTIONS D(CURLOPT_SSLCERT); D(CURLOPT_PROXY_SSLCERT); D(CURLOPT_SSLCERTTYPE); D(CURLOPT_PROXY_SSLCERTTYPE); D(CURLOPT_SSLKEY); D(CURLOPT_PROXY_SSLKEY); D(CURLOPT_SSLKEYTYPE); D(CURLOPT_PROXY_SSLKEYTYPE); D(CURLOPT_KEYPASSWD); D(CURLOPT_PROXY_KEYPASSWD); D(CURLOPT_SSL_ENABLE_ALPN); D(CURLOPT_SSL_ENABLE_NPN); D(CURLOPT_SSLENGINE); D(CURLOPT_SSLENGINE_DEFAULT); D(CURLOPT_SSL_FALSESTART); D(CURLOPT_SSLVERSION); __D(CURL_SSLVERSION_DEFAULT); __D(CURL_SSLVERSION_TLSv1); __D(CURL_SSLVERSION_TLSv1_0); __D(CURL_SSLVERSION_TLSv1_1); __D(CURL_SSLVERSION_TLSv1_2); __D(CURL_SSLVERSION_TLSv1_3); __D(CURL_SSLVERSION_MAX_DEFAULT); __D(CURL_SSLVERSION_MAX_TLSv1_0); __D(CURL_SSLVERSION_MAX_TLSv1_1); __D(CURL_SSLVERSION_MAX_TLSv1_2); __D(CURL_SSLVERSION_MAX_TLSv1_3); __D(CURL_SSLVERSION_SSLv2); __D(CURL_SSLVERSION_SSLv3); D(CURLOPT_PROXY_SSLVERSION); D(CURLOPT_SSL_VERIFYHOST); D(CURLOPT_PROXY_SSL_VERIFYHOST); D(CURLOPT_SSL_VERIFYPEER); D(CURLOPT_PROXY_SSL_VERIFYPEER); D(CURLOPT_CAINFO); D(CURLOPT_PROXY_CAINFO); D(CURLOPT_ISSUERCERT); D(CURLOPT_CAPATH); D(CURLOPT_PROXY_CAPATH); D(CURLOPT_CRLFILE); D(CURLOPT_SSL_VERIFYHOST); D(CURLOPT_CERTINFO); D(CURLOPT_RANDOM_FILE); D(CURLOPT_EGDSOCKET); D(CURLOPT_SSL_CIPHER_LIST); D(CURLOPT_SSL_SESSIONID_CACHE); D(CURLOPT_KRBLEVEL); D(CURLOPT_GSSAPI_DELEGATION); __D(CURLGSSAPI_DELEGATION_FLAG); __D(CURLGSSAPI_DELEGATION_POLICY_FLAG); D(CURLOPT_SSH_AUTH_TYPES); __D(CURLSSH_AUTH_PUBLICKEY); __D(CURLSSH_AUTH_PASSWORD); __D(CURLSSH_AUTH_HOST); __D(CURLSSH_AUTH_KEYBOARD); __D(CURLSSH_AUTH_ANY); D(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5); D(CURLOPT_SSH_PUBLIC_KEYFILE); D(CURLOPT_SSH_PRIVATE_KEYFILE); D(CURLOPT_SSH_KNOWNHOSTS); // CURLOPT_SSH_KEYFUNCTION is complicated //__D(CURLKHSTAT_FINE_ADD_TO_FILE); //__D(CURLKHSTAT_FINE); //__D(CURLKHSTAT_REJECT); //__D(CURLKHSTAT_DEFER); //D(CURLOPT_SSH_KEYDATA); //D(CURLOPT_PRIVATE); //D(CURLOPT_SHARE); D(CURLOPT_NEW_FILE_PERMS); D(CURLOPT_NEW_DIRECTORY_PERMS); D(CURLOPT_TELNETOPTIONS); D(CURLINFO_ACTIVESOCKET); D(CURLINFO_APPCONNECT_TIME); D(CURLINFO_APPCONNECT_TIME_T); #ifdef CURLINFO_CAINFO D(CURLINFO_CAINFO); #else ND(CURLINFO_CAINFO); #endif #ifdef CURLINFO_CAPATH D(CURLINFO_CAPATH); #else ND(CURLINFO_CAPATH); #endif D(CURLINFO_CERTINFO); D(CURLINFO_CONDITION_UNMET); D(CURLINFO_CONNECT_TIME); D(CURLINFO_CONNECT_TIME_T); #ifdef CURLINFO_CONN_ID D(CURLINFO_CONN_ID); #else ND(CURLINFO_CONN_ID); #endif D(CURLINFO_CONTENT_LENGTH_DOWNLOAD_T); D(CURLINFO_CONTENT_LENGTH_UPLOAD_T); D(CURLINFO_COOKIELIST); #ifdef CURLINFO_EARLYDATA_SENT_T D(CURLINFO_EARLYDATA_SENT_T); #else ND(CURLINFO_EARLYDATA_SENT_T); #endif D(CURLINFO_EFFECTIVE_METHOD); D(CURLINFO_EFFECTIVE_URL); D(CURLINFO_FILETIME); D(CURLINFO_FILETIME_T); D(CURLINFO_FTP_ENTRY_PATH); D(CURLINFO_HEADER_SIZE); D(CURLINFO_HTTPAUTH_AVAIL); #ifdef CURLINFO_HTTPAUTH_USED D(CURLINFO_HTTPAUTH_USED); #else ND(CURLINFO_HTTPAUTH_USED); #endif D(CURLINFO_HTTP_CONNECTCODE); D(CURLINFO_HTTP_VERSION); D(CURLINFO_LOCAL_IP); D(CURLINFO_LOCAL_PORT); D(CURLINFO_NAMELOOKUP_TIME); D(CURLINFO_NAMELOOKUP_TIME_T); D(CURLINFO_NUM_CONNECTS); D(CURLINFO_OS_ERRNO); #ifdef CURLINFO_POSTTRANSFER_TIME_T D(CURLINFO_POSTTRANSFER_TIME_T); #else ND(CURLINFO_POSTTRANSFER_TIME_T); #endif D(CURLINFO_PRETRANSFER_TIME); D(CURLINFO_PRETRANSFER_TIME_T); D(CURLINFO_PRIMARY_IP); D(CURLINFO_PRIMARY_PORT); D(CURLINFO_PROXYAUTH_AVAIL); #ifdef CURLINFO_PROXYAUTH_USED D(CURLINFO_PROXYAUTH_USED); #else ND(CURLINFO_PROXYAUTH_USED); #endif D(CURLINFO_PROXY_ERROR); D(CURLINFO_PROXY_SSL_VERIFYRESULT); #ifdef CURLINFO_QUEUE_TIME_T D(CURLINFO_QUEUE_TIME_T); #else ND(CURLINFO_QUEUE_TIME_T); #endif D(CURLINFO_REDIRECT_COUNT); D(CURLINFO_REDIRECT_TIME); D(CURLINFO_REDIRECT_TIME_T); D(CURLINFO_REDIRECT_URL); D(CURLINFO_REFERER); D(CURLINFO_REQUEST_SIZE); D(CURLINFO_RESPONSE_CODE); D(CURLINFO_RETRY_AFTER); D(CURLINFO_RTSP_CLIENT_CSEQ); D(CURLINFO_RTSP_CSEQ_RECV); D(CURLINFO_RTSP_SERVER_CSEQ); D(CURLINFO_RTSP_SESSION_ID); D(CURLINFO_SCHEME); D(CURLINFO_SIZE_DOWNLOAD_T); D(CURLINFO_SIZE_UPLOAD_T); D(CURLINFO_SPEED_DOWNLOAD_T); D(CURLINFO_SPEED_UPLOAD_T); D(CURLINFO_SSL_ENGINES); D(CURLINFO_SSL_VERIFYRESULT); D(CURLINFO_STARTTRANSFER_TIME); D(CURLINFO_STARTTRANSFER_TIME_T); D(CURLINFO_TLS_SSL_PTR); D(CURLINFO_TOTAL_TIME); D(CURLINFO_TOTAL_TIME_T); #ifdef CURLINFO_USED_PROXY D(CURLINFO_USED_PROXY); #else ND(CURLINFO_USED_PROXY); #endif #ifdef CURLINFO_XFER_ID D(CURLINFO_XFER_ID); #else ND(CURLINFO_XFER_ID); #endif /* ERROR CODES */ D(CURLE_OK); D(CURLE_UNSUPPORTED_PROTOCOL); D(CURLE_FAILED_INIT); D(CURLE_URL_MALFORMAT); D(CURLE_NOT_BUILT_IN); D(CURLE_COULDNT_RESOLVE_PROXY); D(CURLE_COULDNT_RESOLVE_HOST); D(CURLE_COULDNT_CONNECT); D(CURLE_FTP_WEIRD_SERVER_REPLY); D(CURLE_REMOTE_ACCESS_DENIED); D(CURLE_FTP_ACCEPT_FAILED); D(CURLE_FTP_WEIRD_PASS_REPLY); D(CURLE_FTP_ACCEPT_TIMEOUT); D(CURLE_FTP_WEIRD_PASV_REPLY); D(CURLE_FTP_WEIRD_227_FORMAT); D(CURLE_FTP_CANT_GET_HOST); D(CURLE_HTTP2); D(CURLE_FTP_COULDNT_SET_TYPE); D(CURLE_PARTIAL_FILE); D(CURLE_FTP_COULDNT_RETR_FILE); D(CURLE_FTP_QUOTE_ERROR); D(CURLE_HTTP_RETURNED_ERROR); D(CURLE_WRITE_ERROR); D(CURLE_UPLOAD_FAILED); D(CURLE_READ_ERROR); D(CURLE_OUT_OF_MEMORY); D(CURLE_OPERATION_TIMEDOUT); D(CURLE_FTP_PORT_FAILED); D(CURLE_FTP_COULDNT_USE_REST); D(CURLE_RANGE_ERROR); D(CURLE_HTTP_POST_ERROR); D(CURLE_SSL_CONNECT_ERROR); D(CURLE_BAD_DOWNLOAD_RESUME); D(CURLE_FILE_COULDNT_READ_FILE); D(CURLE_LDAP_CANNOT_BIND); D(CURLE_LDAP_SEARCH_FAILED); D(CURLE_FUNCTION_NOT_FOUND); D(CURLE_ABORTED_BY_CALLBACK); D(CURLE_BAD_FUNCTION_ARGUMENT); D(CURLE_INTERFACE_FAILED); D(CURLE_TOO_MANY_REDIRECTS); D(CURLE_UNKNOWN_OPTION); D(CURLE_TELNET_OPTION_SYNTAX); D(CURLE_GOT_NOTHING); D(CURLE_SSL_ENGINE_NOTFOUND); D(CURLE_SSL_ENGINE_SETFAILED); D(CURLE_SEND_ERROR); D(CURLE_RECV_ERROR); D(CURLE_SSL_CERTPROBLEM); D(CURLE_SSL_CIPHER); D(CURLE_PEER_FAILED_VERIFICATION); //D(CURLE_SSL_CACERT); D(CURLE_BAD_CONTENT_ENCODING); D(CURLE_LDAP_INVALID_URL); D(CURLE_FILESIZE_EXCEEDED); D(CURLE_USE_SSL_FAILED); D(CURLE_SEND_FAIL_REWIND); D(CURLE_SSL_ENGINE_INITFAILED); D(CURLE_LOGIN_DENIED); D(CURLE_TFTP_NOTFOUND); D(CURLE_TFTP_PERM); D(CURLE_REMOTE_DISK_FULL); D(CURLE_TFTP_ILLEGAL); D(CURLE_TFTP_UNKNOWNID); D(CURLE_REMOTE_FILE_EXISTS); D(CURLE_TFTP_NOSUCHUSER); D(CURLE_CONV_FAILED); D(CURLE_CONV_REQD); D(CURLE_SSL_CACERT_BADFILE); D(CURLE_REMOTE_FILE_NOT_FOUND); D(CURLE_SSH); D(CURLE_SSL_SHUTDOWN_FAILED); D(CURLE_AGAIN); D(CURLE_SSL_CRL_BADFILE); D(CURLE_SSL_ISSUER_ERROR); D(CURLE_FTP_PRET_FAILED); D(CURLE_RTSP_CSEQ_ERROR); D(CURLE_FTP_BAD_FILE_LIST); D(CURLE_CHUNK_FAILED); D(CURLE_NO_CONNECTION_AVAILABLE); D(CURLE_SSL_PINNEDPUBKEYNOTMATCH); D(CURLE_SSL_INVALIDCERTSTATUS); D(CURLE_HTTP2_STREAM); #ifdef CURLE_RECURSIVE_API_CALL D(CURLE_RECURSIVE_API_CALL); #else ND(CURLE_RECURSIVE_API_CALL); #endif // PROXY ERROR CODES D(CURLPX_OK); D(CURLPX_BAD_ADDRESS_TYPE); D(CURLPX_BAD_VERSION); D(CURLPX_CLOSED); D(CURLPX_GSSAPI); D(CURLPX_GSSAPI_PERMSG); D(CURLPX_GSSAPI_PROTECTION); D(CURLPX_IDENTD); D(CURLPX_IDENTD_DIFFER); D(CURLPX_LONG_HOSTNAME); D(CURLPX_LONG_PASSWD); D(CURLPX_LONG_USER); D(CURLPX_NO_AUTH); D(CURLPX_RECV_ADDRESS); D(CURLPX_RECV_AUTH); D(CURLPX_RECV_CONNECT); D(CURLPX_RECV_REQACK); D(CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED); D(CURLPX_REPLY_COMMAND_NOT_SUPPORTED); D(CURLPX_REPLY_CONNECTION_REFUSED); D(CURLPX_REPLY_GENERAL_SERVER_FAILURE); D(CURLPX_REPLY_HOST_UNREACHABLE); D(CURLPX_REPLY_NETWORK_UNREACHABLE); D(CURLPX_REPLY_NOT_ALLOWED); D(CURLPX_REPLY_TTL_EXPIRED); D(CURLPX_REPLY_UNASSIGNED); D(CURLPX_REQUEST_FAILED); D(CURLPX_RESOLVE_HOST); D(CURLPX_SEND_AUTH); D(CURLPX_SEND_CONNECT); D(CURLPX_SEND_REQUEST); D(CURLPX_UNKNOWN_FAIL); D(CURLPX_UNKNOWN_MODE); D(CURLPX_USER_REJECTED); } guile-curl-0.10/src/const.h000066400000000000000000000015631517432002600155750ustar00rootroot00000000000000/* Constants for guile-curl Copyright (c) 2013 Michael L. Gran This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef CL_CONST_H #define CL_CONST_H #ifdef DLL_EXPORT #define API __attribute__ ((dllexport, cdecl)) #else #define API #endif void cl_init_const (void) API; #endif guile-curl-0.10/src/func.c000066400000000000000000000517551517432002600154050ustar00rootroot00000000000000/* Functions for guile-curl Copyright (c) 2011, 2013, 2014, 2016, 2025 Michael L. Gran This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include #include #include #include #include #include #include "type.h" #include "func.h" static size_t write_callback (void *ptr, size_t size, size_t nmemb, void *port); static size_t read_callback (void *ptr, size_t size, size_t nmemb, void *port); CURLcode error_code = CURLE_OK; char error_string[CURL_ERROR_SIZE+1] = ""; struct scm_flag { SCM scm; int flag; }; SCM DLL_PUBLIC cl_easy_init () { CURL *handle; handle_post_t *hp; handle = curl_easy_init (); if (handle == NULL) { scm_error (SCM_BOOL_F, "curl-easy-init", "initialization failure", SCM_BOOL_F, SCM_BOOL_F); } hp = scm_malloc (sizeof (handle_post_t)); memset (hp, 0, sizeof (handle_post_t)); hp->handle = handle; if (0) { fprintf (stderr, "Allocating <#handle %p>\n", hp); fprintf (stderr, "\t handle %p\n", hp->handle); fprintf (stderr, "\t httppost %p\n", hp->httppost); fprintf (stderr, "\t httpheader %p\n", hp->httpheader); fprintf (stderr, "\thttp200aliases %p\n", hp->http200aliases); fprintf (stderr, "\t mail_rcpt %p\n", hp->mail_rcpt); fprintf (stderr, "\t quote %p\n", hp->quote); fprintf (stderr, "\t postquote %p\n", hp->postquote); fprintf (stderr, "\t prequote %p\n", hp->prequote); fprintf (stderr, "\t resolve %p\n", hp->resolve); fprintf (stderr, "\t telnetoptions %p\n", hp->telnetoptions); fprintf (stderr, "\t transfers %d\n", hp->transfers); fflush (stderr); } return _scm_from_handle (hp); } SCM DLL_PUBLIC cl_easy_setopt (SCM handle, SCM option, SCM param, SCM big) { handle_post_t *c_handle; CURLoption c_option; CURLcode code = CURLE_UNSUPPORTED_PROTOCOL; SCM_ASSERT (_scm_is_handle (handle), handle, SCM_ARG1, "curl-easy-setopt"); SCM_ASSERT (scm_is_integer (option), option, SCM_ARG2, "curl-easy-setopt"); c_handle = _scm_to_handle (handle); c_option = (CURLoption) scm_to_int (option); if (c_option == CURLOPT_POSTFIELDS) { if (_scm_can_convert_to_byte_data (param)) { size_t len; uint8_t *m = _scm_convert_to_byte_data (param, &len); free (c_handle->postfields); c_handle->postfields = m; curl_easy_setopt (c_handle->handle, CURLOPT_POSTFIELDSIZE, len); c_handle->postfieldsize = len; code = curl_easy_setopt (c_handle->handle, CURLOPT_POSTFIELDS, (char *) m); } else scm_error (SCM_BOOL_F, "cl-easy-setopt", "CURLOPT_POSTFIELDS requires 8-bit string or bytevector data", SCM_BOOL_F, SCM_BOOL_F); } else if (c_option == CURLOPT_HTTPHEADER) { if (_scm_can_convert_to_slist (param)) { /* slists require special handling to free them properly, so they are stored with the Curl handle. */ struct curl_slist *sl = _scm_convert_to_slist (param); if (c_handle->httpheader) curl_slist_free_all (c_handle->httpheader); c_handle->httpheader = sl; code = curl_easy_setopt (c_handle->handle, CURLOPT_HTTPHEADER, sl); } else scm_error (SCM_BOOL_F, "cl-easy-setopt", "CURLOPT_HTTPHEADER requires a list of strings", SCM_BOOL_F, SCM_BOOL_F); } else if (scm_is_integer (param)) { if (scm_is_true (big)) code = curl_easy_setopt (c_handle->handle, c_option, scm_to_int64 (param)); else code = curl_easy_setopt (c_handle->handle, c_option, scm_to_long (param)); } else if (scm_is_string (param)) { /* Strings are copied by curl, so they can be freed here. */ char *str; str = scm_to_locale_string (param); code = curl_easy_setopt (c_handle->handle, c_option, str); free (str); } else if (_scm_can_convert_to_slist (param)) { /* slists require special handling to free them properly, so they are stored with the Curl handle. */ struct curl_slist *sl = _scm_convert_to_slist (param); int ok = 1; if (c_option == CURLOPT_HTTP200ALIASES) { if (c_handle->http200aliases) curl_slist_free_all (c_handle->http200aliases); c_handle->http200aliases = sl; } else if (c_option == CURLOPT_MAIL_RCPT) { if (c_handle->mail_rcpt) curl_slist_free_all (c_handle->mail_rcpt); c_handle->mail_rcpt = sl; } else if (c_option == CURLOPT_QUOTE) { if (c_handle->quote) curl_slist_free_all (c_handle->quote); c_handle->quote = sl; } else if (c_option == CURLOPT_POSTQUOTE) { if (c_handle->postquote) curl_slist_free_all (c_handle->postquote); c_handle->postquote = sl; } else if (c_option == CURLOPT_PREQUOTE) { if (c_handle->prequote) curl_slist_free_all (c_handle->prequote); c_handle->prequote = sl; } else if (c_option == CURLOPT_RESOLVE) { if (c_handle->resolve) curl_slist_free_all (c_handle->resolve); c_handle->resolve = sl; } else if (c_option == CURLOPT_TELNETOPTIONS) { if (c_handle->telnetoptions) curl_slist_free_all (c_handle->telnetoptions); c_handle->telnetoptions = sl; } else { // Bad slist option ok = 0; } if (ok) code = curl_easy_setopt (c_handle->handle, c_option, sl); } else if (_scm_can_convert_to_httppost (param)) { if (c_option == CURLOPT_HTTPPOST) { struct curl_httppost *p; p = _scm_convert_to_httppost (param); free (c_handle->httppost); c_handle->httppost = p; code = curl_easy_setopt (c_handle, CURLOPT_HTTPPOST, p); } } else if (scm_is_true (scm_input_port_p (param))) { if (c_option == CURLOPT_READDATA) { curl_easy_setopt (c_handle->handle, CURLOPT_READFUNCTION, read_callback); code = curl_easy_setopt (c_handle->handle, CURLOPT_READDATA, SCM2PTR (param)); } } else scm_error (SCM_BOOL_F, "curl-easy-setopt", "unimplemented option type", SCM_BOOL_F, SCM_BOOL_F); if (code != CURLE_OK) scm_error (SCM_BOOL_F, "curl-easy-setopt", "bad handle", SCM_BOOL_F, SCM_BOOL_F); return SCM_UNSPECIFIED; } SCM DLL_PUBLIC cl_easy_getinfo (SCM handle, SCM option) { handle_post_t *c_handle; CURLoption c_option; CURLcode code = CURLE_UNSUPPORTED_PROTOCOL; SCM_ASSERT (_scm_is_handle (handle), handle, SCM_ARG1, "curl-easy-getinfo"); SCM_ASSERT (scm_is_integer (option), option, SCM_ARG2, "curl-easy-getinfo"); c_handle = _scm_to_handle (handle); c_option = (CURLoption) scm_to_int (option); if (c_handle->transfers < 1) scm_misc_error ("curl-easy-getinfo", "cannot retrieve information before performing an operation", SCM_EOL); if (c_option == CURLINFO_ACTIVESOCKET) { curl_socket_t c_sockfd; code = curl_easy_getinfo(c_handle->handle, c_option, &c_sockfd); if (code == CURLE_OK && c_sockfd != CURL_SOCKET_BAD) #ifdef _WIN32 return scm_from_unsigned_int (c_sockfd); #else return scm_from_int (c_sockfd); #endif else { error_code = code; return SCM_BOOL_F; } } else if ((c_option == CURLINFO_APPCONNECT_TIME_T) || (c_option == CURLINFO_CONNECT_TIME_T) #ifdef CURLINFO_CONN_ID || (c_option == CURLINFO_CONN_ID) #endif || (c_option == CURLINFO_CONTENT_LENGTH_DOWNLOAD_T) || (c_option == CURLINFO_CONTENT_LENGTH_UPLOAD_T) || (c_option == CURLINFO_FILETIME_T) || (c_option == CURLINFO_NAMELOOKUP_TIME_T) #ifdef CURLINFO_POSTTRANSFER_TIME_T || (c_option == CURLINFO_POSTTRANSFER_TIME_T) #endif || (c_option == CURLINFO_PRETRANSFER_TIME_T) #ifdef CURLINFO_QUEUE_TIME_T || (c_option == CURLINFO_QUEUE_TIME_T) #endif || (c_option == CURLINFO_REDIRECT_TIME_T) || (c_option == CURLINFO_RETRY_AFTER) || (c_option == CURLINFO_SIZE_DOWNLOAD_T) || (c_option == CURLINFO_SIZE_UPLOAD_T) || (c_option == CURLINFO_SPEED_DOWNLOAD_T) || (c_option == CURLINFO_STARTTRANSFER_TIME_T) || (c_option == CURLINFO_TOTAL_TIME_T) ) { curl_off_t c_val; code = curl_easy_getinfo (c_handle->handle, c_option, &c_val); if (code == CURLE_OK) { if (sizeof (curl_off_t) == 4) return scm_from_int32 (c_val); else if (sizeof (curl_off_t) == 8) return scm_from_int64 (c_val); else { error_code = code; return SCM_BOOL_F; } } } else if ((c_option == CURLINFO_CONDITION_UNMET) || (c_option == CURLINFO_FILETIME) || (c_option == CURLINFO_HEADER_SIZE) || (c_option == CURLINFO_HTTPAUTH_AVAIL) #ifdef CURLINFO_HTTPAUTH_USED || (c_option == CURLINFO_HTTPAUTH_USED) #endif || (c_option == CURLINFO_HTTP_CONNECTCODE) || (c_option == CURLINFO_HTTP_VERSION) || (c_option == CURLINFO_LOCAL_PORT) || (c_option == CURLINFO_NUM_CONNECTS) || (c_option == CURLINFO_OS_ERRNO) || (c_option == CURLINFO_PRIMARY_PORT) || (c_option == CURLINFO_PROXYAUTH_AVAIL) #ifdef CURLINFO_PROXYAUTH_USED || (c_option == CURLINFO_PROXYAUTH_USED) #endif || (c_option == CURLINFO_PROXY_ERROR) || (c_option == CURLINFO_PROXY_SSL_VERIFYRESULT) || (c_option == CURLINFO_REDIRECT_COUNT) || (c_option == CURLINFO_REQUEST_SIZE) || (c_option == CURLINFO_RESPONSE_CODE) || (c_option == CURLINFO_RTSP_CLIENT_CSEQ) || (c_option == CURLINFO_RTSP_CSEQ_RECV) || (c_option == CURLINFO_RTSP_SERVER_CSEQ) || (c_option == CURLINFO_SSL_VERIFYRESULT) #ifdef CURLINFO_USED_PROXY || (c_option == CURLINFO_USED_PROXY) #endif #ifdef CURLINFO_XFER_ID || (c_option == CURLINFO_XFER_ID) #endif ) { long c_val; code = curl_easy_getinfo (c_handle->handle, c_option, &c_val); if (code == CURLE_OK) return scm_from_long(c_val); else { error_code = code; return SCM_BOOL_F; } } else if ((c_option == CURLINFO_COOKIELIST) || (c_option == CURLINFO_SSL_ENGINES)) { struct curl_slist *c_cookies; code = curl_easy_getinfo (c_handle->handle, c_option, &c_cookies); if (code == CURLE_OK) { struct curl_slist *c_each; SCM lst = SCM_EOL; c_each = c_cookies; while (c_each) { lst = scm_cons (scm_from_utf8_string (c_each->data), lst); c_each = c_each->next; } curl_slist_free_all (c_cookies); return scm_reverse(lst); } else { error_code = code; return SCM_BOOL_F; } } else if (0 #ifdef CURLINFO_CAINFO || (c_option == CURLINFO_CAINFO) #endif #ifdef CURLINFO_CAPATH || (c_option == CURLINFO_CAPATH) #endif || (c_option == CURLINFO_EFFECTIVE_METHOD) || (c_option == CURLINFO_EFFECTIVE_URL) || (c_option == CURLINFO_FTP_ENTRY_PATH) || (c_option == CURLINFO_LOCAL_IP) || (c_option == CURLINFO_PRIMARY_IP) || (c_option == CURLINFO_REDIRECT_URL) || (c_option == CURLINFO_REFERER) || (c_option == CURLINFO_RTSP_SESSION_ID) || (c_option == CURLINFO_SCHEME) ) { char *c_str = NULL; code = curl_easy_getinfo (c_handle->handle, c_option, &c_str); if (code == CURLE_OK) { if (c_str == NULL) return scm_from_utf8_string (""); return scm_from_utf8_string (c_str); } else { error_code = code; return SCM_BOOL_F; } } else if ((c_option == CURLINFO_APPCONNECT_TIME) || (c_option == CURLINFO_CONNECT_TIME) || (c_option == CURLINFO_NAMELOOKUP_TIME) || (c_option == CURLINFO_PRETRANSFER_TIME) || (c_option == CURLINFO_STARTTRANSFER_TIME) || (c_option == CURLINFO_REDIRECT_TIME) || (c_option == CURLINFO_TOTAL_TIME) ) { double c_val; code = curl_easy_getinfo (c_handle->handle, c_option, &c_val); if (code == CURLE_OK) return scm_from_double (c_val); else { error_code = code; return SCM_BOOL_F; } } else scm_error (SCM_BOOL_F, "curl-easy-getinfo", "unimplemented option type", SCM_BOOL_F, SCM_BOOL_F); return SCM_BOOL_F; } SCM DLL_PUBLIC cl_easy_perform (SCM handle, SCM bvflag, SCM headerflag) { handle_post_t *c_handle; SCM data; CURLcode status; struct scm_flag body_sf, header_sf; SCM_ASSERT (_scm_is_handle (handle), handle, SCM_ARG1, "%curl-easy-perform"); c_handle = _scm_to_handle (handle); body_sf.flag = scm_is_true (bvflag); if (body_sf.flag) data = scm_c_make_bytevector (0); else data = scm_c_make_string (0, SCM_MAKE_CHAR('\n')); body_sf.scm = data; header_sf.flag = 0; if (header_sf.flag) data = scm_c_make_bytevector (0); else data = scm_c_make_string (0, SCM_MAKE_CHAR('\n')); header_sf.scm = data; if (scm_is_true (headerflag)) { curl_easy_setopt (c_handle->handle, CURLOPT_HEADERFUNCTION, write_callback); curl_easy_setopt (c_handle->handle, CURLOPT_HEADERDATA, &header_sf); curl_easy_setopt (c_handle->handle, CURLOPT_ERRORBUFFER, error_string); } curl_easy_setopt (c_handle->handle, CURLOPT_WRITEFUNCTION, write_callback); curl_easy_setopt (c_handle->handle, CURLOPT_WRITEDATA, &body_sf); curl_easy_setopt (c_handle->handle, CURLOPT_ERRORBUFFER, error_string); /* Do the transfer, and fill c_str with the result */ status = curl_easy_perform (c_handle->handle); if (status != CURLE_OK) { error_code = status; return (SCM_BOOL_F); } if (c_handle->transfers < INT_MAX) c_handle->transfers ++; if (scm_is_true (headerflag)) return (scm_list_2 (header_sf.scm, body_sf.scm)); return (body_sf.scm); } /* This callback function catches the data passed by libcurl and sends it back as a scheme string */ static size_t write_callback (void *ptr, size_t size, size_t nmemb, void *userdata) { size_t length1, length2; SCM data1, data2; struct scm_flag *sf; sf = (struct scm_flag *) userdata; data1 = sf->scm; if (sf->flag) length1 = scm_c_bytevector_length (data1); else length1 = scm_c_string_length (data1); length2 = size * nmemb; /* printf ("In write_callback\n"); */ if (sf->flag) { data2 = scm_c_make_bytevector (length1 + length2); memcpy (SCM_BYTEVECTOR_CONTENTS (data2), SCM_BYTEVECTOR_CONTENTS (data1), length1); memcpy (SCM_BYTEVECTOR_CONTENTS (data2) + length1, ptr, length2); } else { data2 = scm_c_make_string (length1 + length2, SCM_MAKE_CHAR('\0')); for (size_t i = 0; i < length1; i ++) { scm_c_string_set_x (data2, i, scm_c_string_ref (data1, i)); } for (size_t i = 0; i < length2; i ++) { scm_c_string_set_x (data2, i + length1, SCM_MAKE_CHAR (((char *)ptr)[i])); } } sf->scm = data2; return length2; } /* This callback function sends some data from a port over to curl. */ static size_t read_callback (void *ptr, size_t size, size_t nmemb, void *userdata) { size_t length1; SCM port; port = PTR2SCM(userdata); length1 = scm_c_read (port, ptr, size * nmemb); return length1; } SCM DLL_PUBLIC cl_easy_reset (SCM handle) { handle_post_t *c_handle; SCM_ASSERT (_scm_is_handle (handle), handle, SCM_ARG1, "%curl-easy-reset"); c_handle = _scm_to_handle (handle); curl_easy_reset (c_handle->handle); return SCM_UNSPECIFIED; } SCM DLL_PUBLIC cl_easy_cleanup (SCM handle) { SCM_ASSERT (_scm_is_handle (handle), handle, SCM_ARG1, "%curl-easy-cleanup"); gc_free_handle (handle); return SCM_UNSPECIFIED; } SCM DLL_PUBLIC cl_error_string () { return (scm_from_locale_string (error_string)); } SCM DLL_PUBLIC cl_error_code () { return scm_from_int ((int) error_code); } static void print_slist (struct curl_slist *sl) { struct curl_slist *p = sl; int i = 0; while (p != NULL) { fprintf (stderr, "\t\t%d: \"%s\"\n", i, p->data); i++; p = p->next; } } static void print_mem (char *data, long len) { long print_len = len; if (print_len > 40) print_len = 40; if (data == NULL || len == 0) { fprintf (stderr, "(nil)"); return; } for (long i = 0; i < print_len; i ++) { if (isprint (data[i])) fprintf (stderr, "%c", data[i]); else if (data[i] + 32 < 256) fprintf (stderr, "^%c", data[i] + 32); else fprintf (stderr, "?"); } if (print_len != len) fprintf (stderr, "..."); } static size_t xstrlen (const char *s) { if (s == NULL) return 0; return strlen (s); } static void print_httppost (struct curl_httppost *hp) { struct curl_httppost *p = hp; int i = 0; while (p != NULL) { fprintf (stderr, "\t\t%d: name: ", i); print_mem (p->name, p->namelength); fprintf (stderr, "\n\t\t contents: "); print_mem (p->contents, p->contentslength); fprintf (stderr, "\n\t\t buffer: "); print_mem (p->buffer, p->bufferlength); fprintf (stderr, "\n\t\t contenttype: "); print_mem (p->contenttype, xstrlen (p->contenttype)); fprintf (stderr, "\n\t\t contentheader: "); print_slist (p->contentheader); fprintf (stderr, "\n\t\t showfilename: "); print_mem (p->showfilename, xstrlen (p->showfilename)); fprintf (stderr, "\n\t\t flags: 0x%lx", p->flags); fprintf (stderr, "\n"); i++; p = p->next; } } SCM DLL_PUBLIC cl_dump_handle (SCM handle) { handle_post_t *hp; SCM_ASSERT (_scm_is_handle (handle), handle, SCM_ARG1, "%curl-dump-handle"); hp = _scm_to_handle (handle); fprintf (stderr, "<#handle %p>\n", hp); fprintf (stderr, "\t handle %p\n", hp->handle); fprintf (stderr, "\t postfields %p\n", hp->postfields); fprintf (stderr, "\t postfieldsize %zu\n", hp->postfieldsize); print_mem (hp->postfields, hp->postfieldsize); fprintf (stderr, "\t httppost %p\n", hp->httppost); print_httppost (hp->httppost); fprintf (stderr, "\t httpheader %p\n", hp->httpheader); print_slist (hp->httpheader); fprintf (stderr, "\thttp200aliases %p\n", hp->http200aliases); print_slist (hp->http200aliases); fprintf (stderr, "\t mail_rcpt %p\n", hp->mail_rcpt); print_slist (hp->mail_rcpt); fprintf (stderr, "\t quote %p\n", hp->quote); print_slist (hp->quote); fprintf (stderr, "\t postquote %p\n", hp->postquote); print_slist (hp->postquote); fprintf (stderr, "\t prequote %p\n", hp->prequote); print_slist (hp->prequote); fprintf (stderr, "\t resolve %p\n", hp->resolve); print_slist (hp->resolve); fprintf (stderr, "\t telnetoptions %p\n", hp->telnetoptions); print_slist (hp->telnetoptions); fflush (stderr); return SCM_UNDEFINED; } void cl_init_func () { static int first = 1; if (first) { scm_c_define_gsubr ("%curl-easy-init", 0, 0, 0, cl_easy_init); scm_c_define_gsubr ("%curl-easy-getinfo", 2, 0, 0, cl_easy_getinfo); scm_c_define_gsubr ("%curl-easy-setopt", 4, 0, 0, cl_easy_setopt); scm_c_define_gsubr ("%curl-easy-perform", 3, 0, 0, cl_easy_perform); scm_c_define_gsubr ("%curl-easy-cleanup", 1, 0, 0, cl_easy_cleanup); scm_c_define_gsubr ("%curl-easy-reset", 1, 0, 0, cl_easy_reset); scm_c_define_gsubr ("%curl-error-string", 0, 0, 0, cl_error_string); scm_c_define_gsubr ("%curl-error-code", 0, 0, 0, cl_error_code); scm_c_define_gsubr ("%curl-dump-handle", 1, 0, 0, cl_dump_handle); first = 0; } } guile-curl-0.10/src/func.h000066400000000000000000000025411517432002600153770ustar00rootroot00000000000000/* Constants for guile-curl Copyright (c) 2011, 2013, 2025 Michael L. Gran This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef CL_FUNC_H #define CL_FUNC_H #include #include #include "visibility.h" SCM DLL_PUBLIC cl_easy_init (void); SCM DLL_PUBLIC cl_easy_getopt (SCM handle, SCM label, SCM val); SCM DLL_PUBLIC cl_easy_getinfo (SCM handle, SCM option); SCM DLL_PUBLIC cl_easy_setopt (SCM handle, SCM option, SCM param, SCM big); SCM DLL_PUBLIC cl_easy_perform (SCM handle, SCM bvflag, SCM headerflag); SCM DLL_PUBLIC cl_easy_cleanup (SCM handle); SCM DLL_PUBLIC cl_easy_reset (SCM handle); SCM DLL_PUBLIC cl_error_string (void); SCM DLL_PUBLIC cl_error_code (void); SCM DLL_PUBLIC cl_dump_handle (SCM h); void cl_init_func (void); #endif guile-curl-0.10/src/main.c000066400000000000000000000022641517432002600153650ustar00rootroot00000000000000/* guile-curl Copyright (c) 2011, 2013, 2014, 2016 Michael L. Gran This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include #include #include #include "const.h" #include "type.h" #include "func.h" #include "visibility.h" void DLL_PUBLIC cl_init (void); void DLL_PUBLIC cl_init () { CURLcode ret; ret = curl_global_init (CURL_GLOBAL_ALL); if (ret) scm_misc_error ("curl initialization", "initialization failed", SCM_EOL); else { cl_init_type (); cl_init_const (); cl_init_func (); atexit (curl_global_cleanup); } } guile-curl-0.10/src/type.c000066400000000000000000000274701517432002600154300ustar00rootroot00000000000000/* Type helper functions for guile-curl Copyright (c) 2011, 2013, 2014, 2016, 2021 Michael L. Gran This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #define _GNU_SOURCE #include #include #include #include #include #include "type.h" #define SCM_C_LIST_REF(x,i) scm_list_ref(x,scm_from_size_t(i)) #define SCM_C_LIST_LENGTH(x) scm_to_size_t(scm_length(x)) #define SCM_IS_LIST(x) scm_is_true(scm_list_p(x)) static scm_t_bits handle_tag; int print_handle (SCM x, SCM port, scm_print_state *pstate); /* handle -- In C, a handle_post_t pointer. In scheme, a struct that contains that pointer. */ int _scm_is_handle (SCM x) { if (SCM_SMOB_PREDICATE (handle_tag, x)) { if ((handle_post_t *) SCM_SMOB_DATA (x) != (handle_post_t *) NULL) return 1; else return 0; } else return 0; } handle_post_t * _scm_to_handle (SCM x) { return (handle_post_t *) SCM_SMOB_DATA (x); } SCM _scm_from_handle (handle_post_t *x) { SCM s_handle; assert (x != NULL); SCM_NEWSMOB (s_handle, handle_tag, x); assert (x == (handle_post_t *) SCM_SMOB_DATA (s_handle)); if (0) { fprintf (stderr, "Making <#handle %p>\n", x); fprintf (stderr, "\t handle %p\n", x->handle); fprintf (stderr, "\t postfields %p\n", x->postfields); fprintf (stderr, "\t httppost %p\n", x->httppost); fprintf (stderr, "\t httpheader %p\n", x->httpheader); fprintf (stderr, "\thttp200aliases %p\n", x->http200aliases); fprintf (stderr, "\t mail_rcpt %p\n", x->mail_rcpt); fprintf (stderr, "\t quote %p\n", x->quote); fprintf (stderr, "\t postquote %p\n", x->postquote); fprintf (stderr, "\t prequote %p\n", x->prequote); fprintf (stderr, "\t resolve %p\n", x->resolve); fprintf (stderr, "\t telnetoptions %p\n", x->telnetoptions); fprintf (stderr, "\t transfers %d\n", x->transfers); fflush (stderr); } return (s_handle); } // Handles are equal if they point to the same C structure SCM equalp_handle (SCM x1, SCM x2) { SCM ret; CURL *handle1; CURL *handle2; handle1 = (handle_post_t *) SCM_SMOB_DATA (x1); handle2 = (handle_post_t *) SCM_SMOB_DATA (x2); if ((handle1 == NULL) || (handle2 == NULL)) ret = SCM_BOOL_F; else if ((handle1 != handle2)) ret = SCM_BOOL_F; else ret = SCM_BOOL_T; return ret; } size_t gc_free_handle (SCM handle) { handle_post_t *x = _scm_to_handle (handle); if (0) { fprintf (stderr, "Freeing <#handle %p>\n", x); fprintf (stderr, "\t handle %p\n", x->handle); fprintf (stderr, "\t httppost %p\n", x->httppost); fprintf (stderr, "\t httpheader %p\n", x->httpheader); fprintf (stderr, "\thttp200aliases %p\n", x->http200aliases); fprintf (stderr, "\t mail_rcpt %p\n", x->mail_rcpt); fprintf (stderr, "\t quote %p\n", x->quote); fprintf (stderr, "\t postquote %p\n", x->postquote); fprintf (stderr, "\t prequote %p\n", x->prequote); fprintf (stderr, "\t resolve %p\n", x->resolve); fprintf (stderr, "\t telnetoptions %p\n", x->telnetoptions); fprintf (stderr, "\t transfers %d\n", x->transfers); fflush (stderr); } if (x != NULL) { if (x->postfields != NULL) { free (x->postfields); x->postfields = NULL; x->postfieldsize = 0; } if (x->httppost != NULL) { curl_formfree (x->httppost); x->httppost = NULL; } if (x->httpheader != NULL) { curl_slist_free_all (x->httpheader); x->httpheader = NULL; } if (x->http200aliases != NULL) { curl_slist_free_all (x->http200aliases); x->http200aliases = NULL; } if (x->mail_rcpt != NULL) { curl_slist_free_all (x->mail_rcpt); x->mail_rcpt = NULL; } if (x->quote != NULL) { curl_slist_free_all (x->quote); x->quote = NULL; } if (x->postquote != NULL) { curl_slist_free_all (x->postquote); x->postquote = NULL; } if (x->prequote != NULL) { curl_slist_free_all (x->prequote); x->prequote = NULL; } if (x->resolve != NULL) { curl_slist_free_all (x->resolve); x->resolve = NULL; } if (x->telnetoptions != NULL) { curl_slist_free_all (x->telnetoptions); x->telnetoptions = NULL; } x->transfers = 0; if (x->handle != NULL) { curl_easy_cleanup (x->handle); x->handle = NULL; } free (x); x = NULL; SCM_SET_SMOB_DATA(handle, NULL); } return 0; } int #ifdef __GNUC__ print_handle (SCM x, SCM port, scm_print_state *pstate __attribute__ ((unused))) #else print_handle (SCM x, SCM port, scm_print_state *pstate) #endif { handle_post_t *frm = (handle_post_t *) SCM_SMOB_DATA (x); char *str; scm_puts ("#", port); // non-zero means success return 1; } SCM DLL_PUBLIC cl_is_handle_p (SCM x) { return scm_from_bool (_scm_is_handle (x)); } /* slist -- In C, a struct curl_slist *. In Scheme, a list of strings of bytevectors */ int _scm_can_convert_to_slist (SCM x) { size_t i, n; SCM elt; if (!SCM_IS_LIST(x)) return 0; n = SCM_C_LIST_LENGTH(x); if (n == 0) return 1; /* Empty slist */ for (i = 0; i < n; i ++) { elt = SCM_C_LIST_REF (x, i); if (!scm_is_string (elt)) return 0; } return 1; } struct curl_slist * _scm_convert_to_slist (SCM x) { int i, n; SCM elt; char *str; struct curl_slist *slist = NULL; if (!_scm_can_convert_to_slist (x)) return NULL; n = scm_to_int (scm_length (x)); if (n == 0) return NULL; for (i = 0; i < n; i ++) { elt = SCM_C_LIST_REF(x, i); if (scm_is_string (elt)) { str = scm_to_locale_string (elt); slist = curl_slist_append (slist, str); if (slist == NULL) { /* This should be impossible. */ scm_error (SCM_BOOL_F, "_scm_convert_to_slist", "failed to create a Curl list of strings from a Guile list of strings", SCM_BOOL_F, SCM_BOOL_F); break; } } else { /* This should be impossible. */ scm_error (SCM_BOOL_F, "_scm_convert_to_slist", "failed to create a Curl list of strings from a Guile list that contained non-string data", SCM_BOOL_F, SCM_BOOL_F); break; } } return slist; } /* For Guile-1.8, tests to see if this is a string. For Guile-2.0, tests to see if this is a string or bytevector. */ #define SCM_C_STRING_REF(s,i) \ scm_to_int (scm_char_to_integer (scm_c_string_ref (s, i))) int _scm_can_convert_to_byte_data (SCM x) { int i, n; int c; if (scm_is_bytevector (x)) return 1; else if (scm_is_string (x)) { n = scm_c_string_length (x); if (n == 0) return 1; /* Empty string */ for (i = 0; i < n; i ++) { c = SCM_C_STRING_REF (x, i); if (c > 255) return 0; } return 1; } return 0; } /* For Guile-1.8, returns the memory location of the chars of a string. For Guile-2.0, returns the memory location of the bytes of a bytevector. Since these are SCM objects, they are GC'd. */ uint8_t * _scm_convert_to_byte_data (SCM x, size_t *len) { if (scm_is_string (x)) { size_t i; uint8_t *buf; *len = scm_c_string_length (x); if (*len == 0) return NULL; buf = scm_malloc (*len); for (i = 0; i < *len; i ++) { buf[i] = SCM_C_STRING_REF (x, i); } return buf; } else { size_t i; uint8_t *buf; *len = SCM_BYTEVECTOR_LENGTH (x); if (*len == 0) return NULL; buf = scm_malloc (*len); for (i = 0; i < *len; i ++) { buf[i] = SCM_BYTEVECTOR_CONTENTS (x)[i]; } return buf; } } /* Each entry in an http post is a list of 2 to 4 elements. 1. name - string 2. data - byte data 3. mime - string, optional 4. filename - string, optional */ static int _scm_can_convert_to_httppost_entry (SCM x) { size_t n; if (!SCM_IS_LIST(x)) return 0; n = SCM_C_LIST_LENGTH(x); if (n < 2 || n > 4) return 0; if (!scm_is_string (SCM_C_LIST_REF(x, 0))) return 0; if (!_scm_can_convert_to_byte_data (SCM_C_LIST_REF(x, 1))) return 0; if (n == 3 && !scm_is_string (SCM_C_LIST_REF(x, 2))) return 0; if (n == 4 && !scm_is_string (SCM_C_LIST_REF(x, 3))) return 0; return 1; } int _scm_can_convert_to_httppost (SCM x) { int i, n; SCM elt; if (!SCM_IS_LIST(x)) return 0; n = SCM_C_LIST_LENGTH(x); if (n == 0) return 1; /* Empty post */ for (i = 0; i < n; i ++) { elt = SCM_C_LIST_REF(x, i); if (!_scm_can_convert_to_httppost_entry (elt)) return 0; } return 1; } struct curl_httppost * _scm_convert_to_httppost (SCM x) { struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; size_t j,m,n; n = SCM_C_LIST_LENGTH (x); for (j = 0; j < n; j ++) { char *name = NULL, *mime = NULL, *filename = NULL; uint8_t *contents = NULL; size_t name_len, contents_len; SCM elt = SCM_C_LIST_REF (x, j); m = SCM_C_LIST_LENGTH (elt); name = scm_to_locale_stringn (SCM_C_LIST_REF (elt, 0), &name_len); contents = _scm_convert_to_byte_data (SCM_C_LIST_REF (elt, 1), &contents_len); if (m >= 3) mime = scm_to_locale_string (SCM_C_LIST_REF (elt, 2)); if (m == 4) filename = scm_to_locale_string (SCM_C_LIST_REF (elt, 3)); if (m == 2) curl_formadd (&post, &last, CURLFORM_PTRNAME, name, CURLFORM_NAMELENGTH, name_len, CURLFORM_PTRCONTENTS, contents, CURLFORM_CONTENTSLENGTH, contents_len, CURLFORM_END); else if (m == 3) { curl_formadd (&post, &last, CURLFORM_PTRNAME, name, CURLFORM_NAMELENGTH, name_len, CURLFORM_PTRCONTENTS, contents, CURLFORM_CONTENTSLENGTH, contents_len, CURLFORM_CONTENTTYPE, mime, CURLFORM_END); free (mime); } else if (m == 4) { curl_formadd (&post, &last, CURLFORM_PTRNAME, name, CURLFORM_NAMELENGTH, name_len, CURLFORM_PTRCONTENTS, contents, CURLFORM_CONTENTSLENGTH, contents_len, CURLFORM_CONTENTTYPE, mime, CURLFORM_FILENAME, filename, CURLFORM_END); free (mime); free (filename); } } return post; } void DLL_PUBLIC cl_init_type () { handle_tag = scm_make_smob_type ("handle", sizeof (handle_post_t)); scm_set_smob_free (handle_tag, gc_free_handle); scm_set_smob_print (handle_tag, print_handle); scm_set_smob_equalp (handle_tag, equalp_handle); scm_c_define_gsubr ("%curl-easy-handle?", 1, 0, 0, cl_is_handle_p); } guile-curl-0.10/src/type.h000066400000000000000000000034621517432002600154300ustar00rootroot00000000000000/* Constants for guile-curl Copyright (c) 2011, 2013 Michael L. Gran This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef CL_TYPE_H #define CL_TYPE_H #include #include #include "visibility.h" typedef struct handle_post_tag { CURL *handle; uint8_t *postfields; size_t postfieldsize; // curl_off_t postfieldsize_large; struct curl_httppost *httppost; struct curl_slist *httpheader; struct curl_slist *http200aliases; struct curl_slist *mail_rcpt; struct curl_slist *quote; struct curl_slist *postquote; struct curl_slist *prequote; struct curl_slist *resolve; struct curl_slist *telnetoptions; int transfers; } handle_post_t; void DLL_PUBLIC cl_init_type (void); int _scm_is_handle (SCM x); handle_post_t *_scm_to_handle (SCM x); SCM _scm_from_handle (handle_post_t *x); size_t gc_free_handle (SCM handle); SCM equalp_handle (SCM x1, SCM x2); SCM DLL_PUBLIC cl_is_handle_p (SCM x); int _scm_can_convert_to_slist (SCM x); struct curl_slist *_scm_convert_to_slist (SCM x); int _scm_can_convert_to_byte_data (SCM x); uint8_t *_scm_convert_to_byte_data (SCM x, size_t *len); int _scm_can_convert_to_httppost (SCM x); struct curl_httppost *_scm_convert_to_httppost (SCM x); #endif guile-curl-0.10/src/visibility.h000066400000000000000000000014071517432002600166330ustar00rootroot00000000000000/* This header, or versions very much like it, are everywhere. I think, at this point, this code fragment is basically public domain. */ #ifndef VISIBILITY_H #define VISIBILITY_H #ifdef CL_DLL #ifdef CL_DLL_EXPORTS #ifdef __GNUC__ #define DLL_PUBLIC __attribute__ ((dllexport)) #else #define DLL_PUBLIC __declspec(dllexport) #endif #else #ifdef __GNUC__ #define DLL_PUBLIC __attribute__ ((dllimport)) #else #define DLL_PUBLIC __declspec(dllimport) #endif #endif #define DLL_LOCAL #else #if __GNUC__ >= 4 #define DLL_PUBLIC __attribute__ ((visibility ("default"))) #define DLL_LOCAL __attribute__ ((visibility ("hidden"))) #else #define DLL_PUBLIC #define DLL_LOCAL #endif #endif #endif guile-curl-0.10/test/000077500000000000000000000000001517432002600144615ustar00rootroot00000000000000guile-curl-0.10/test/bytevectors.scm000066400000000000000000000026121517432002600175370ustar00rootroot00000000000000;; -*- Mode: scheme; -*- ;;; Copyright (C) 2021 Michael L. Gran ;;; This program is free software: you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation, either version 3 of the License, or ;;; (at your option) any later version. ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see . (use-modules (curl) (srfi srfi-64) (rnrs bytevectors)) (test-begin "bytevectors") (define (string->latin1-bytevector str) (u8-list->bytevector (map char->integer (string->list str)))) (define (latin1-bytevector->string bv) (apply string (map integer->char (bytevector->u8-list bv)))) (test-equal "ascii text is unchanged by bv->url-encoded-bv" "hello" (latin1-bytevector->string (bv->url-encoded-bv (string->latin1-bytevector "hello")))) (test-equal "whitespace text is modified by bv->url-encoded-bv" "%20%09%0D%0A" (latin1-bytevector->string (bv->url-encoded-bv (string->latin1-bytevector (string #\space #\tab #\return #\newline))))) (test-end "bytevectors") guile-curl-0.10/test/check_type.c000066400000000000000000000172361517432002600167540ustar00rootroot00000000000000/* Test driver for type functions for guile-curl Copyright (c) 2014, 2021 Michael L. Gran This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include #include #include "../src/type.h" #include "../src/func.h" #include "../src/const.h" int test_scm_is_handle(void) { SCM handle = cl_easy_init(); int ret = _scm_is_handle(handle); cl_easy_cleanup(handle); return (ret == 1); } int test_scm_is_not_handle(void) { SCM handle = SCM_BOOL_T; int ret = _scm_is_handle(handle); return (ret == 0); } int test_equalp_handle(void) { SCM handle = cl_easy_init(); SCM ret = equalp_handle(handle, handle); return (scm_is_true (ret)); } int test_not_equalp_handle(void) { SCM handle1 = cl_easy_init(); SCM handle2 = cl_easy_init(); SCM ret = equalp_handle(handle1, handle2); return (scm_is_false (ret)); } int test_not_free_handle(void) { SCM handle = cl_easy_init(); handle_post_t *x = _scm_to_handle(handle); int ret = (x != NULL); gc_free_handle(handle); return ret; } int test_free_handle(void) { SCM handle = cl_easy_init(); gc_free_handle(handle); handle_post_t *x = _scm_to_handle(handle); int ret = (x == NULL); return ret; } void test_double_free_handle(void) { SCM handle = cl_easy_init(); gc_free_handle(handle); gc_free_handle(handle); gc_free_handle(handle); } void test_free_handle_string_postfields(void) { extern SCM cl_CURLOPT_POSTFIELDS; SCM handle = cl_easy_init(); SCM str = scm_from_locale_string("abcdefghijklmnopqrstuvwxyz"); SCM ret = cl_easy_setopt(handle, scm_variable_ref(cl_CURLOPT_POSTFIELDS), str, SCM_BOOL_F); gc_free_handle(handle); } #if (SCM_MAJOR_VERSION != 1) void test_free_handle_bytevector_postfields(void) { extern SCM cl_CURLOPT_POSTFIELDS; SCM handle = cl_easy_init(); SCM bv = scm_c_make_bytevector (26); for (int i = 0; i <= 25; i ++) SCM_BYTEVECTOR_CONTENTS(bv)[i] = i + 'a'; SCM ret = cl_easy_setopt(handle, scm_variable_ref(cl_CURLOPT_POSTFIELDS), bv, SCM_BOOL_F); gc_free_handle(handle); } #endif void test_free_handle_slist_option (SCM option) { SCM handle = cl_easy_init(); SCM str_list = scm_list_2(scm_from_locale_string("foo"), scm_from_locale_string("bar")); SCM ret = cl_easy_setopt(handle, scm_variable_ref(option), str_list, SCM_BOOL_F); gc_free_handle(handle); } void test_free_handle_empty_slist_option (SCM option) { SCM handle = cl_easy_init(); SCM str_list = scm_list_n(SCM_UNDEFINED); SCM ret = cl_easy_setopt(handle, scm_variable_ref(option), str_list, SCM_BOOL_F); gc_free_handle(handle); } int test_cl_is_handle_p__handle (void) { SCM handle = cl_easy_init(); SCM ret = cl_is_handle_p(handle); printf("test that cl_is_handle_p returns #t when passed a handle: %d\n", ret); return scm_is_true(ret); } int test_cl_is_handle_p__true (void) { SCM handle = SCM_BOOL_T; SCM ret = cl_is_handle_p(handle); printf("test that cl_is_handle_p returns #f when not passed a handle: %d\n", ret); return scm_is_false(ret); } int test_can_convert_to_slist__slist (void) { SCM str_list = scm_list_2(scm_from_locale_string("foo"), scm_from_locale_string("bar")); int ret = _scm_can_convert_to_slist (str_list); printf("test that _scm_can_convert_to_slist returns 1 when passed a list of strings: %d\n", ret == 1); return ret == 1; } int test_can_convert_to_slist__empty_list (void) { SCM str_list = scm_list_n(SCM_UNDEFINED); int ret = _scm_can_convert_to_slist (str_list); printf("test that _scm_can_convert_to_slist returns 1 when passed an empty list: %d\n", ret == 1); return ret == 1; } int test_can_convert_to_slist__list_of_integers (void) { SCM str_list = scm_list_2(scm_from_int(1), scm_from_int(2)); int ret = _scm_can_convert_to_slist (str_list); printf("test that _scm_can_convert_to_slist returns 0 when passed a list of integers: %d\n", ret == 0); return ret == 0; } int test_scm_convert_to_slist__slist (void) { SCM str_list = scm_list_2(scm_from_locale_string("foo"), scm_from_locale_string("bar")); struct curl_slist *ret = _scm_convert_to_slist (str_list); printf("test that _scm_convert_to_slist returns an slist when passed a list of strings: %d\n", ret != NULL); return ret != NULL; } int test_scm_convert_to_slist__empty_list (void) { SCM str_list = scm_list_n(SCM_UNDEFINED); struct curl_slist *ret = _scm_convert_to_slist (str_list); printf("test that _scm_convert_to_slist returns NULL when passed an empty list: %d\n", ret == NULL); return ret == NULL; } int test_scm_convert_to_slist__list_of_integers (void) { SCM str_list = scm_list_2(scm_from_int(1), scm_from_int(2)); struct curl_slist *ret = _scm_convert_to_slist (str_list); printf("test that _scm_convert_to_slist returns NULL when passed a list of integers: %d\n", ret == NULL); return ret == NULL; } int main(int argc, char **argv) { int ret; scm_init_guile(); cl_init_const(); ret = test_scm_is_handle(); printf("test that a handle is a handle: %d\n", ret); if (!ret) return 1; ret = test_scm_is_not_handle(); printf("test that a bool is not handle: %d\n", ret); if (!ret) return 1; ret = test_equalp_handle(); printf("test that a handle equals itself: %d\n", ret); if (!ret) return 1; ret = test_not_equalp_handle(); printf("test that a handle does not equal another handle: %d\n", ret); if (!ret) return 1; ret = test_not_free_handle(); printf("test that an unfreed handle has non-NULL SMOB data: %d\n", ret); if (!ret) return 1; ret = test_free_handle(); printf("test that a freed handle has NULL SMOB data: %d\n", ret); if (!ret) return 1; printf("test that double frees of handles don't segfault\n"); test_double_free_handle(); printf("test that frees of a handle with string-based postfields doesn't segfault\n"); test_free_handle_string_postfields(); #if SCM_MAJOR_VERSION != 1 printf("test that frees of a handle with bytevector-based postfields doesn't segfault\n"); test_free_handle_bytevector_postfields(); #endif #define TEST_SLIST(x) \ extern SCM x; \ printf ("test that frees of a handle with a " #x " slist doesn't segfault\n"); \ test_free_handle_slist_option(x); \ printf ("test that frees of a handle with an empty " #x " slist don't segfault\n"); \ test_free_handle_empty_slist_option(x) TEST_SLIST(cl_CURLOPT_HTTPHEADER); TEST_SLIST(cl_CURLOPT_HTTP200ALIASES); TEST_SLIST(cl_CURLOPT_MAIL_RCPT); TEST_SLIST(cl_CURLOPT_QUOTE); TEST_SLIST(cl_CURLOPT_POSTQUOTE); TEST_SLIST(cl_CURLOPT_PREQUOTE); TEST_SLIST(cl_CURLOPT_RESOLVE); TEST_SLIST(cl_CURLOPT_TELNETOPTIONS); ret = test_cl_is_handle_p__handle (); if (!ret) return 1; ret = test_cl_is_handle_p__true (); if (!ret) return 1; ret = test_can_convert_to_slist__slist (); if (!ret) return 1; ret = test_can_convert_to_slist__empty_list (); if (!ret) return 1; ret = test_can_convert_to_slist__list_of_integers (); if (!ret) return 1; ret = test_scm_convert_to_slist__slist (); if (!ret) return 1; ret = test_scm_convert_to_slist__empty_list (); if (!ret) return 1; ret = test_scm_convert_to_slist__list_of_integers (); if (!ret) return 1; return 0; } guile-curl-0.10/test/do_gdb000077500000000000000000000001571517432002600156300ustar00rootroot00000000000000#!/bin/sh libtool -dlopen ../src/libguile-curl.la \ --mode=execute gdb --args guile -L .. -L ../src -s $1 guile-curl-0.10/test/getinfo.scm000066400000000000000000000047631517432002600166320ustar00rootroot00000000000000;; -*- Mode: scheme; -*- ;;; Copyright (C) 2025 Michael L. Gran ;;; This program is free software: you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation, either version 3 of the License, or ;;; (at your option) any later version. ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see . (use-modules (srfi srfi-64) (web server) (web response) (web request) (ice-9 threads) (curl)) (test-begin "getinfo") ;; Define a simple web server handler (define (simple-handler request request-body) (values (build-response #:code 200) "Hello, Guile!")) ;; Start the web server in a separate thread (define (start-web-server port) (begin-thread (run-server simple-handler 'http `(#:port ,port)))) (define (test-curl-getinfo-http) (let ((port 8080) (url "http://localhost:8080") (handle (curl-easy-init))) (start-web-server port) ;; Give the server a moment to start (usleep 100000) ;; Perform curl operation in a separate thread from the web server (let ((transfer-thread (begin-thread (curl-easy-setopt handle 'url url) (curl-easy-setopt handle 'verbose #t) (curl-easy-perform handle)))) ;; Wait for transfer to complete (join-thread transfer-thread) ;; Get info from curl handle (test-group "curl-easy-getinfo" (test-equal "HTTP Version" (curl-easy-getinfo handle 'http-version) CURL_HTTP_VERSION_1_1) (test-equal "HTTP response code" 200 (curl-easy-getinfo handle 'response-code)) (test-assert "Total time" (number? (curl-easy-getinfo handle 'total-time))) (test-assert "Content length" (equal? (curl-easy-getinfo handle 'content-length-download-t) (string-length "Hello, Guile!"))) (test-assert "Active socket" (number? (curl-easy-getinfo handle 'activesocket))) ) ;; Cleanup (curl-easy-cleanup handle)))) (test-curl-getinfo-http) (test-end "getinfo") guile-curl-0.10/test/lib.scm000066400000000000000000000504551517432002600157440ustar00rootroot00000000000000;;;; test/lib.scm --- generic support for testing ;;;; Copyright (C) 1999, 2000, 2001, 2004, 2006, 2007, 2014 Free Software Foundation, Inc. ;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation; either version 3, or (at your option) ;;;; any later version. ;;;; ;;;; This program is distributed in the hope that it will be useful, ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; GNU General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with this software; see the file COPYING. If not, write to ;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;;;; Boston, MA 02110-1301 USA (define-module (lib) :use-module (ice-9 stack-catch) :use-module (ice-9 regex) :use-module (srfi srfi-1) :export ( ;; Exceptions which are commonly being tested for. exception:bad-variable exception:missing-expression exception:out-of-range exception:unbound-var exception:used-before-defined exception:wrong-num-args exception:wrong-type-arg exception:numerical-overflow exception:struct-set!-denied exception:system-error exception:miscellaneous-error exception:string-contains-nul ;; Reporting passes and failures. run-test pass-if expect-fail pass-if-exception expect-fail-exception ;; Naming groups of tests in a regular fashion. with-test-prefix with-test-prefix* current-test-prefix format-test-name ;; Reporting results in various ways. register-reporter unregister-reporter reporter-registered? make-count-reporter print-counts make-log-reporter full-reporter user-reporter)) ;;;; If you're using Emacs's Scheme mode: ;;;; (put 'with-test-prefix 'scheme-indent-function 1) ;;;; CORE FUNCTIONS ;;;; ;;;; The function (run-test name expected-result thunk) is the heart of the ;;;; testing environment. The first parameter NAME is a unique name for the ;;;; test to be executed (for an explanation of this parameter see below under ;;;; TEST NAMES). The second parameter EXPECTED-RESULT is a boolean value ;;;; that indicates whether the corresponding test is expected to pass. If ;;;; EXPECTED-RESULT is #t the test is expected to pass, if EXPECTED-RESULT is ;;;; #f the test is expected to fail. Finally, THUNK is the function that ;;;; actually performs the test. For example: ;;;; ;;;; (run-test "integer addition" #t (lambda () (= 2 (+ 1 1)))) ;;;; ;;;; To report success, THUNK should either return #t or throw 'pass. To ;;;; report failure, THUNK should either return #f or throw 'fail. If THUNK ;;;; returns a non boolean value or throws 'unresolved, this indicates that ;;;; the test did not perform as expected. For example the property that was ;;;; to be tested could not be tested because something else went wrong. ;;;; THUNK may also throw 'untested to indicate that the test was deliberately ;;;; not performed, for example because the test case is not complete yet. ;;;; Finally, if THUNK throws 'unsupported, this indicates that this test ;;;; requires some feature that is not available in the configured testing ;;;; environment. All other exceptions thrown by THUNK are considered as ;;;; errors. ;;;; ;;;; ;;;; Convenience macros for tests expected to pass or fail ;;;; ;;;; * (pass-if name body) is a short form for ;;;; (run-test name #t (lambda () body)) ;;;; * (expect-fail name body) is a short form for ;;;; (run-test name #f (lambda () body)) ;;;; ;;;; For example: ;;;; ;;;; (pass-if "integer addition" (= 2 (+ 1 1))) ;;;; ;;;; ;;;; Convenience macros to test for exceptions ;;;; ;;;; The following macros take exception parameters which are pairs ;;;; (type . message), where type is a symbol that denotes an exception type ;;;; like 'wrong-type-arg or 'out-of-range, and message is a string holding a ;;;; regular expression that describes the error message for the exception ;;;; like "Argument .* out of range". ;;;; ;;;; * (pass-if-exception name exception body) will pass if the execution of ;;;; body causes the given exception to be thrown. If no exception is ;;;; thrown, the test fails. If some other exception is thrown, it is an ;;;; error. ;;;; * (expect-fail-exception name exception body) will pass unexpectedly if ;;;; the execution of body causes the given exception to be thrown. If no ;;;; exception is thrown, the test fails expectedly. If some other ;;;; exception is thrown, it is an error. ;;;; TEST NAMES ;;;; ;;;; Every test in the test suite has a unique name, to help ;;;; developers find tests that are failing (or unexpectedly passing), ;;;; and to help gather statistics. ;;;; ;;;; A test name is a list of printable objects. For example: ;;;; ("ports.scm" "file" "read and write back list of strings") ;;;; ("ports.scm" "pipe" "read") ;;;; ;;;; Test names may contain arbitrary objects, but they always have ;;;; the following properties: ;;;; - Test names can be compared with EQUAL?. ;;;; - Test names can be reliably stored and retrieved with the standard WRITE ;;;; and READ procedures; doing so preserves their identity. ;;;; ;;;; For example: ;;;; ;;;; (pass-if "simple addition" (= 4 (+ 2 2))) ;;;; ;;;; In that case, the test name is the list ("simple addition"). ;;;; ;;;; In the case of simple tests the expression that is tested would often ;;;; suffice as a test name by itself. Therefore, the convenience macros ;;;; pass-if and expect-fail provide a shorthand notation that allows to omit ;;;; a test name in such cases. ;;;; ;;;; * (pass-if expression) is a short form for ;;;; (run-test 'expression #t (lambda () expression)) ;;;; * (expect-fail expression) is a short form for ;;;; (run-test 'expression #f (lambda () expression)) ;;;; ;;;; For example: ;;;; ;;;; (pass-if (= 2 (+ 1 1))) ;;;; ;;;; The WITH-TEST-PREFIX syntax and WITH-TEST-PREFIX* procedure establish ;;;; a prefix for the names of all tests whose results are reported ;;;; within their dynamic scope. For example: ;;;; ;;;; (begin ;;;; (with-test-prefix "basic arithmetic" ;;;; (pass-if "addition" (= (+ 2 2) 4)) ;;;; (pass-if "subtraction" (= (- 4 2) 2))) ;;;; (pass-if "multiplication" (= (* 2 2) 4))) ;;;; ;;;; In that example, the three test names are: ;;;; ("basic arithmetic" "addition"), ;;;; ("basic arithmetic" "subtraction"), and ;;;; ("multiplication"). ;;;; ;;;; WITH-TEST-PREFIX can be nested. Each WITH-TEST-PREFIX postpends ;;;; a new element to the current prefix: ;;;; ;;;; (with-test-prefix "arithmetic" ;;;; (with-test-prefix "addition" ;;;; (pass-if "integer" (= (+ 2 2) 4)) ;;;; (pass-if "complex" (= (+ 2+3i 4+5i) 6+8i))) ;;;; (with-test-prefix "subtraction" ;;;; (pass-if "integer" (= (- 2 2) 0)) ;;;; (pass-if "complex" (= (- 2+3i 1+2i) 1+1i)))) ;;;; ;;;; The four test names here are: ;;;; ("arithmetic" "addition" "integer") ;;;; ("arithmetic" "addition" "complex") ;;;; ("arithmetic" "subtraction" "integer") ;;;; ("arithmetic" "subtraction" "complex") ;;;; ;;;; To print a name for a human reader, we DISPLAY its elements, ;;;; separated by ": ". So, the last set of test names would be ;;;; reported as: ;;;; ;;;; arithmetic: addition: integer ;;;; arithmetic: addition: complex ;;;; arithmetic: subtraction: integer ;;;; arithmetic: subtraction: complex ;;;; ;;;; The Guile benchmarks use with-test-prefix to include the name of ;;;; the source file containing the test in the test name, to help ;;;; developers to find failing tests, and to provide each file with its ;;;; own namespace. ;;;; REPORTERS ;;;; ;;;; A reporter is a function which we apply to each test outcome. ;;;; Reporters can log results, print interesting results to the ;;;; standard output, collect statistics, etc. ;;;; ;;;; A reporter function takes two mandatory arguments, RESULT and TEST, and ;;;; possibly additional arguments depending on RESULT; its return value ;;;; is ignored. RESULT has one of the following forms: ;;;; ;;;; pass - The test named TEST passed. ;;;; Additional arguments are ignored. ;;;; upass - The test named TEST passed unexpectedly. ;;;; Additional arguments are ignored. ;;;; fail - The test named TEST failed. ;;;; Additional arguments are ignored. ;;;; xfail - The test named TEST failed, as expected. ;;;; Additional arguments are ignored. ;;;; unresolved - The test named TEST did not perform as expected, for ;;;; example the property that was to be tested could not be ;;;; tested because something else went wrong. ;;;; Additional arguments are ignored. ;;;; untested - The test named TEST was not actually performed, for ;;;; example because the test case is not complete yet. ;;;; Additional arguments are ignored. ;;;; unsupported - The test named TEST requires some feature that is not ;;;; available in the configured testing environment. ;;;; Additional arguments are ignored. ;;;; error - An error occurred while the test named TEST was ;;;; performed. Since this result means that the system caught ;;;; an exception it could not handle, the exception arguments ;;;; are passed as additional arguments. ;;;; ;;;; This library provides some standard reporters for logging results ;;;; to a file, reporting interesting results to the user, and ;;;; collecting totals. ;;;; ;;;; You can use the REGISTER-REPORTER function and friends to add ;;;; whatever reporting functions you like. If you don't register any ;;;; reporters, the library uses FULL-REPORTER, which simply writes ;;;; all results to the standard output. ;;;; MISCELLANEOUS ;;;; ;;; Define some exceptions which are commonly being tested for. (define exception:bad-variable (cons 'syntax-error "Bad variable")) (define exception:missing-expression (cons 'misc-error "^missing or extra expression")) (define exception:out-of-range (cons 'out-of-range "^.*out of range")) (define exception:unbound-var (cons 'unbound-variable "^Unbound variable")) (define exception:used-before-defined (cons 'unbound-variable "^Variable used before given a value")) (define exception:wrong-num-args (cons 'wrong-number-of-args "^Wrong number of arguments")) (define exception:wrong-type-arg (cons 'wrong-type-arg "^Wrong type")) (define exception:numerical-overflow (cons 'numerical-overflow "^Numerical overflow")) (define exception:struct-set!-denied (cons 'misc-error "^set! denied for field")) (define exception:system-error (cons 'system-error ".*")) (define exception:miscellaneous-error (cons 'misc-error "^.*")) ;; as per throw in scm_to_locale_stringn() (define exception:string-contains-nul (cons 'misc-error "^string contains #\\\\nul character")) ;;; Display all parameters to the default output port, followed by a newline. (define (display-line . objs) (for-each display objs) (newline)) ;;; Display all parameters to the given output port, followed by a newline. (define (display-line-port port . objs) (for-each (lambda (obj) (display obj port)) objs) (newline port)) ;;;; CORE FUNCTIONS ;;;; ;;; The central testing routine. ;;; The idea is taken from Greg, the GNUstep regression test environment. (define run-test #f) (let ((test-running #f)) (define (local-run-test name expect-pass thunk) (if test-running (error "Nested calls to run-test are not permitted.") (let ((test-name (full-name name))) (set! test-running #t) (catch #t (lambda () (let ((result (thunk))) (if (eq? result #t) (throw 'pass)) (if (eq? result #f) (throw 'fail)) (throw 'unresolved))) (lambda (key . args) (case key ((pass) (report (if expect-pass 'pass 'upass) test-name)) ((fail) (report (if expect-pass 'fail 'xfail) test-name)) ((unresolved untested unsupported) (report key test-name)) ((quit) (report 'unresolved test-name) (quit)) (else (report 'error test-name (cons key args)))))) (set! test-running #f)))) (set! run-test local-run-test)) ;;; A short form for tests that are expected to pass, taken from Greg. (defmacro pass-if (name . rest) (if (and (null? rest) (pair? name)) ;; presume this is a simple test, i.e. (pass-if (even? 2)) ;; where the body should also be the name. `(run-test ',name #t (lambda () ,name)) `(run-test ,name #t (lambda () ,@rest)))) ;;; A short form for tests that are expected to fail, taken from Greg. (defmacro expect-fail (name . rest) (if (and (null? rest) (pair? name)) ;; presume this is a simple test, i.e. (expect-fail (even? 2)) ;; where the body should also be the name. `(run-test ',name #f (lambda () ,name)) `(run-test ,name #f (lambda () ,@rest)))) ;;; A helper function to implement the macros that test for exceptions. (define (run-test-exception name exception expect-pass thunk) (run-test name expect-pass (lambda () (stack-catch (car exception) (lambda () (thunk) #f) (lambda (key proc message . rest) (cond ;; handle explicit key ((string-match (cdr exception) message) #t) ;; handle `(error ...)' which uses `misc-error' for key and doesn't ;; yet format the message and args (we have to do it here). ((and (eq? 'misc-error (car exception)) (list? rest) (string-match (cdr exception) (apply simple-format #f message (car rest)))) #t) ;; handle syntax errors which use `syntax-error' for key and don't ;; yet format the message and args (we have to do it here). ((and (eq? 'syntax-error (car exception)) (list? rest) (string-match (cdr exception) (apply simple-format #f message (car rest)))) #t) ;; unhandled; throw again (else (apply throw key proc message rest)))))))) ;;; A short form for tests that expect a certain exception to be thrown. (defmacro pass-if-exception (name exception body . rest) `(,run-test-exception ,name ,exception #t (lambda () ,body ,@rest))) ;;; A short form for tests expected to fail to throw a certain exception. (defmacro expect-fail-exception (name exception body . rest) `(,run-test-exception ,name ,exception #f (lambda () ,body ,@rest))) ;;;; TEST NAMES ;;;; ;;;; Turn a test name into a nice human-readable string. (define (format-test-name name) (call-with-output-string (lambda (port) (let loop ((name name) (separator "")) (if (pair? name) (begin (display separator port) (display (car name) port) (loop (cdr name) ": "))))))) ;;;; For a given test-name, deliver the full name including all prefixes. (define (full-name name) (append (current-test-prefix) (list name))) ;;; A fluid containing the current test prefix, as a list. (define prefix-fluid (make-fluid)) (fluid-set! prefix-fluid '()) (define (current-test-prefix) (fluid-ref prefix-fluid)) ;;; Postpend PREFIX to the current name prefix while evaluting THUNK. ;;; The name prefix is only changed within the dynamic scope of the ;;; call to with-test-prefix*. Return the value returned by THUNK. (define (with-test-prefix* prefix thunk) (with-fluids ((prefix-fluid (append (fluid-ref prefix-fluid) (list prefix)))) (thunk))) ;;; (with-test-prefix PREFIX BODY ...) ;;; Postpend PREFIX to the current name prefix while evaluating BODY ... ;;; The name prefix is only changed within the dynamic scope of the ;;; with-test-prefix expression. Return the value returned by the last ;;; BODY expression. (defmacro with-test-prefix (prefix . body) `(with-test-prefix* ,prefix (lambda () ,@body))) ;;;; REPORTERS ;;;; ;;; The global list of reporters. (define reporters '()) ;;; The default reporter, to be used only if no others exist. (define default-reporter #f) ;;; Add the procedure REPORTER to the current set of reporter functions. ;;; Signal an error if that reporter procedure object is already registered. (define (register-reporter reporter) (if (memq reporter reporters) (error "register-reporter: reporter already registered: " reporter)) (set! reporters (cons reporter reporters))) ;;; Remove the procedure REPORTER from the current set of reporter ;;; functions. Signal an error if REPORTER is not currently registered. (define (unregister-reporter reporter) (if (memq reporter reporters) (set! reporters (delq! reporter reporters)) (error "unregister-reporter: reporter not registered: " reporter))) ;;; Return true iff REPORTER is in the current set of reporter functions. (define (reporter-registered? reporter) (if (memq reporter reporters) #t #f)) ;;; Send RESULT to all currently registered reporter functions. (define (report . args) (if (pair? reporters) (for-each (lambda (reporter) (apply reporter args)) reporters) (apply default-reporter args))) ;;;; Some useful standard reporters: ;;;; Count reporters count the occurrence of each test result type. ;;;; Log reporters write all test results to a given log file. ;;;; Full reporters write all test results to the standard output. ;;;; User reporters write interesting test results to the standard output. ;;; The complete list of possible test results. (define result-tags '((pass "PASS" "passes: ") (fail "FAIL" "failures: ") (upass "UPASS" "unexpected passes: ") (xfail "XFAIL" "expected failures: ") (unresolved "UNRESOLVED" "unresolved test cases: ") (untested "UNTESTED" "untested test cases: ") (unsupported "UNSUPPORTED" "unsupported test cases: ") (error "ERROR" "errors: "))) ;;; The list of important test results. (define important-result-tags '(fail upass unresolved error)) ;;; Display a single test result in formatted form to the given port (define (print-result port result name . args) (let* ((tag (assq result result-tags)) (label (if tag (cadr tag) #f))) (if label (begin (display label port) (display ": " port) (display (format-test-name name) port) (if (pair? args) (begin (display " - arguments: " port) (write args port) )) (newline port)) (error "(test-suite lib) FULL-REPORTER: unrecognized result: " result)))) ;;; Return a list of the form (COUNTER RESULTS), where: ;;; - COUNTER is a reporter procedure, and ;;; - RESULTS is a procedure taking no arguments which returns the ;;; results seen so far by COUNTER. The return value is an alist ;;; mapping outcome symbols (`pass', `fail', etc.) onto counts. (define (make-count-reporter) (let ((counts (map (lambda (tag) (cons (car tag) 0)) result-tags))) (list (lambda (result name . args) (let ((pair (assq result counts))) (if pair (set-cdr! pair (+ 1 (cdr pair))) (error "count-reporter: unexpected test result: " (cons result (cons name args)))))) (lambda () (append counts '()))))) ;;; Print a count reporter's results nicely. Pass this function the value ;;; returned by a count reporter's RESULTS procedure. (define (print-counts results . port?) (let ((port (if (pair? port?) (car port?) (current-output-port)))) (newline port) (display-line-port port "Totals for this test run:") (for-each (lambda (tag) (let ((result (assq (car tag) results))) (if result (display-line-port port (caddr tag) (cdr result)) (display-line-port port "Test suite bug: " "no total available for `" (car tag) "'")))) result-tags) (newline port))) ;;; Return a reporter procedure which prints all results to the file ;;; FILE, in human-readable form. FILE may be a filename, or a port. (define (make-log-reporter file) (let ((port (if (output-port? file) file (open-output-file file)))) (lambda args (apply print-result port args) (force-output port)))) ;;; A reporter that reports all results to the user. (define (full-reporter . args) (apply print-result (current-output-port) args)) ;;; A reporter procedure which shows interesting results (failures, ;;; unexpected passes etc.) to the user. (define (user-reporter result name . args) (if (memq result important-result-tags) (apply full-reporter result name args))) (set! default-reporter full-reporter) guile-curl-0.10/test/profile.scm000066400000000000000000000036011517432002600166250ustar00rootroot00000000000000;; -*- Mode: scheme; -*- ;;; Copyright (C) 2021 Michael L. Gran ;;; This program is free software: you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation, either version 3 of the License, or ;;; (at your option) any later version. ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see . (use-modules (curl) (rnrs bytevectors)) (define bv-1k (make-bytevector 1024)) (define bv-10k (make-bytevector (* 10 1024))) (define bv-100k (make-bytevector (* 100 1024))) (define (init-bytevector! bv) (let ((len (bytevector-length bv))) (let loop ((i 0)) (when (< i len) (bytevector-u8-set! bv i (modulo i 256)) (loop (1+ i)))))) (init-bytevector! bv-1k) (init-bytevector! bv-10k) (init-bytevector! bv-100k) ; (write bv-1k) (newline) (define (with-timer name thunk) (format #t "Test: ~A~%" name) (let* ((start-time (times)) (ret (thunk)) (end-time (times))) (format #t "clock: ~A, utime: ~A~%" (- (tms:clock end-time) (tms:clock start-time)) (- (tms:utime end-time) (tms:utime start-time))))) (define (test-bv-thunk bv N) (lambda () (let loop ((i 0) (tmp #f)) (if (< i N) (loop (1+ i) (bv->url-encoded-bv2 bv)) tmp)))) (with-timer "short bytevector" (test-bv-thunk bv-1k 1000)) (with-timer "medium bytevector" (test-bv-thunk bv-10k 100)) (with-timer "long bytevector" (test-bv-thunk bv-100k 10)) guile-curl-0.10/test/setopt.scm000066400000000000000000000117021517432002600165040ustar00rootroot00000000000000;; -*- Mode: scheme; -*- ;;; Copyright (C) 2013, 2014, 2021 Michael L. Gran ;;; This program is free software: you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation, either version 3 of the License, or ;;; (at your option) any later version. ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see . (use-modules (curl) (srfi srfi-64)) (false-if-exception (delete-file "cookie.txt")) (test-begin "setopt") (test-assert "curl-easy-init returns a handle" (curl-easy-handle? (curl-easy-init))) (define (check-setopt opt val) (false-if-exception (let ((h (curl-easy-init))) (curl-easy-setopt h opt val) #t))) (define (true-if-exception x) (not (false-if-exception x))) (test-assert "'verbose #t" (check-setopt 'verbose #t)) (test-assert "'header #t" (check-setopt 'header #t)) (test-assert "'nosignal #t" (check-setopt 'nosignal #t)) (test-assert "'wildcardmatch #t" (check-setopt 'wildcardmatch #t)) ;; NETWORK OPTIONS (test-assert "'url \"http://localhost\"" (check-setopt 'url "http://localhost")) (test-assert "'protocols CURLPROTO_HTTP" (check-setopt 'protocols CURLPROTO_HTTP)) (test-assert "'redir-protocols CURLPROTO_HTTP" (check-setopt 'redir-protocols CURLPROTO_HTTP)) (test-assert "'proxy \"http://localhost\"" (check-setopt 'proxy "http://localhost")) (test-assert "'proxyport 8080" (check-setopt 'proxyport 8080)) (test-assert "'proxytype CURLPROXY_HTTP" (check-setopt 'proxytype CURLPROXY_HTTP)) (test-assert "'noproxy \"locahost\"" (check-setopt 'noproxy "localhost")) (test-assert "'httpproxytunnel #t" (check-setopt 'httpproxytunnel #t)) (test-assert "'socks5-gssapi-service \"rcmd/server-fqdn\"" (check-setopt 'socks5-gssapi-service "rcmd/server-fqdn")) (test-assert "'socks5-gssapi-nec #t" (check-setopt 'socks5-gssapi-nec #t)) (test-assert "'interface \"localhost\"" (check-setopt 'interface "localhost")) (test-assert "'localport 8000" (check-setopt 'localport 8000)) (test-assert "'localportrange 100" (check-setopt 'localportrange 100)) (test-assert "'dns-cache-timeout 5" (check-setopt 'dns-cache-timeout 5)) (test-assert "'buffersize 1024" (check-setopt 'buffersize 1024)) (test-assert "'port 8080" (check-setopt 'port 8080)) (test-assert "'tcp-nodelay #t" (check-setopt 'tcp-nodelay #t)) (test-assert "'address-scope 0" (check-setopt 'address-scope 0)) ;; AUTHENTICATION (test-assert "'netrc CURL_NETRC_OPTIONAL" (check-setopt 'netrc CURL_NETRC_OPTIONAL)) (test-assert "'netrc-file \"net.rc\"" (check-setopt 'netrc-file "net.rc")) (test-assert "'userpwd \"1234\"" (check-setopt 'userpwd "1234")) (test-assert "'proxyuserpwd \"1234\"" (check-setopt 'proxyuserpwd "1234")) (test-assert "'username \"root\"" (check-setopt 'username "root")) (test-assert "'password \"1234\"" (check-setopt 'password "1234")) (test-assert "'proxyusername \"root\"" (check-setopt 'proxyusername "root")) (test-assert "'proxypassword \"1234\"" (check-setopt 'proxypassword "1234")) (test-assert "'httpauth CURLAUTH_BASIC" (check-setopt 'httpauth CURLAUTH_BASIC)) (test-assert "'proxyauth CURLAUTH_BASIC" (check-setopt 'proxyauth CURLAUTH_BASIC)) ;; HTTP OPTIONS (test-assert "'autoreferer #t" (check-setopt 'autoreferer #t)) (test-assert "'followlocation #t" (check-setopt 'followlocation #t)) (test-assert "'unrestricted-auth #t" (check-setopt 'unrestricted-auth #t)) (test-assert "'maxredirs 100" (check-setopt 'maxredirs 100)) (test-assert "'postredir CURL_REDIR_POST_301" (check-setopt 'postredir CURL_REDIR_POST_301)) (test-assert "'put #t" (check-setopt 'put #t)) (test-assert "'post #t" (check-setopt 'post #t)) ;; RNRS_BYTEVECTORS_BEGIN (test-assert "'postfields #vu(0 1 2)" (check-setopt 'postfields #vu8(0 1 2))) ;; RNRS_BYTEVECTORS_END (test-assert "'postfields #\\nul #\\soh #\\stx" (check-setopt 'postfields (string #\nul #\soh #\stx))) (test-assert "'cookie \"a=1\"" (check-setopt 'cookie "a=1")) (test-assert "'cookiefile \"cookie.txt\"" (check-setopt 'cookiefile "cookie.txt")) (test-assert "'cookiejar \"cookie.txt\"" (check-setopt 'cookiejar "cookie.txt")) (test-assert "'cookiesession #t" (check-setopt 'cookiesession #t)) (test-assert "'cookielist \"ALL\"" (check-setopt 'cookielist "ALL")) (test-assert "'httpget #t" (check-setopt 'httpget #t)) (test-assert "'http-version CURL_HTTP_VERSION_1_1" (check-setopt 'http-version CURL_HTTP_VERSION_1_1)) (test-assert "'ignore-content-length #t" (check-setopt 'ignore-content-length #t)) (test-assert "'http-content-decoding #t" (check-setopt 'http-content-decoding #t)) (test-assert "'http-transfer-decoding #t" (check-setopt 'http-transfer-decoding #t)) (false-if-exception (delete-file "cookie.txt")) (test-end "setopt") guile-curl-0.10/test/stress.scm000066400000000000000000000022041517432002600165060ustar00rootroot00000000000000;; -*- Mode: scheme; -*- ;;; Copyright (C) 2013, 2014, 2021 Michael L. Gran ;;; This program is free software: you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation, either version 3 of the License, or ;;; (at your option) any later version. ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see . (use-modules (curl) (srfi srfi-64)) (test-begin "stress") (test-assert "doesn't crash" (false-if-exception (begin (let loop ((i 0)) (if (< i 100000) (begin (let ((h (curl-easy-init))) (curl-easy-setopt h 'url "http://localhost") (curl-easy-setopt h 'httpheader (list (make-string 100 #\a) (make-string 100 #\b))) (loop (1+ i)))) #t))))) (test-end "stress")