Lines Matching +full:windows +full:- +full:remote +full:- +full:only
1 ---
3 SPDX-License-Identifier: curl
4 Title: libcurl-tutorial
7 See-also:
8 - libcurl-easy (3)
9 - libcurl-errors (3)
10 - libcurl-multi (3)
11 - libcurl-url (3)
13 - All
14 ---
18 libcurl-tutorial - libcurl programming tutorial
46 installed them. The 'curl-config'[3] tool can be used to get this information:
48 $ curl-config --cflags
57 command line. To figure out which flags to use, once again the 'curl-config'
60 $ curl-config --libs
66 varies from different libraries and builds is the support for SSL-based
68 properly at build-time, libcurl is built with SSL support. To figure out if an
69 installed libcurl has been built with SSL support enabled, use *curl-config*
73 $ curl-config --feature
86 area. See docs/libcurl/libcurl.m4 file - it includes docs on how to use it.
94 are only a few minor details that differ. If you just make sure to write your
113 which only does anything on Windows machines. When used on a Windows machine,
116 only do this once for each application, so if your program already does this
122 which only does anything on libcurls compiled and built SSL-enabled. On these
124 application. This only needs to be done once for each application so if your
139 should be avoided. They should only be called once each.
143 It is considered best-practice to determine libcurl features at runtime rather
144 than at build-time (if possible of course). By calling
200 remote resource you want to get here. Since you write a sort of application
228 rare platform-dependent nitpicks. Did you spot it? On some platforms[2],
238 CURLOPT_WRITEFUNCTION(3) if you set CURLOPT_WRITEDATA(3) - or experience
248 curl_easy_perform(3) connects to the remote site, does the necessary commands
272 # Multi-threading Issues
275 libcurl-thread(3) for more information.
281 does, or the remote server might return non-standard replies that confuse the
302 Getting some in-depth knowledge about the protocols involved is never wrong,
306 # Upload Data to a Remote Site
309 uploading to a remote FTP site is similar to uploading data to an HTTP server
313 one. Then you set the URL to operate on just like before. This is the remote
366 them URL encoded, as %XX where XX is a two-digit hexadecimal number.
387 passwords, namely in the $HOME/.netrc file (on Windows, libcurl also checks
389 "_netrc" as name). The file should be made private so that only the user may
394 non-FTP protocols such as HTTP. To make curl use this file, use the
425 method is called 'Basic', which is sending the name and password in clear-text
426 in the HTTP request, base64-encoded. This is insecure.
446 claims to support. This method does however add a round-trip since libcurl
467 libcurl to post it all to the remote site:
482 Content-Type: header of the post? Well, binary posts prevent libcurl from being
490 headers = curl_slist_append(headers, "Content-Type: text/xml");
507 POST operations are required, they do not do multi-part formposts. Multi-part
510 called multi-part because they are built by a chain of parts, each part being
512 fact create and post a multi-part formpost with the regular libcurl POST
517 functions: using those, you can create and fill a multi-part form. Function
518 curl_mime_init(3) creates a multi-part body; you can then append new parts
519 to a multi-part body using curl_mime_addpart(3).
522 curl_mime_data(3), file using curl_mime_filedata(3) and user-defined data
524 (i.e.: form field) name, while curl_mime_filename(3) fills in the remote
526 curl_mime_headers(3) allows defining the part's headers. When a multi-part
541 curl_mime_name(part, "logotype-image");
555 curl_mime_subparts(3) implements nested multi-parts, this way of
585 CURLFORM_COPYNAME, "logotype-image",
597 Multipart formposts are chains of parts using MIME-style separators and
599 that describe the individual content-type, size etc. To enable your
608 headers = curl_slist_append(headers, "Content-Type: text/xml");
611 CURLFORM_COPYNAME, "logotype-image",
635 Four rules have to be respected in building the multi-part:
637 - The easy handle must be created before building the multi-part.
639 - The multi-part is always created by a call to curl_mime_init(handle).
641 - Each part is created by a call to curl_mime_addpart(multipart).
643 - When complete, the multi-part must be bound to the easy handle using
664 the headers to be automatically released upon destroyed the multi-part, thus
665 saving a clean-up call to curl_slist_free_all(3).
669 CURLFORM_PTRNAME, "logotype-image",
670 CURLFORM_FILECONTENT, "-",
676 curl_mime_name(part, "logotype-image");
677 curl_mime_data_cb(part, (curl_off_t) -1, fread, fseek, NULL, stdin);
680 curl_mime_name(3) always copies the field name. The special filename "-" is
682 source using fread(). The transfer is be chunk-encoded since the data size is
761 Use of curl_mime_filedata(3) sets the remote filename as a side effect: it is
766 For historical and traditional reasons, libcurl has a built-in progress meter
773 For most applications however, the built-in progress meter is useless and what
795 There is basically only one thing to keep in mind when using C++ instead of C
798 The callbacks CANNOT be non-static class member functions
814 What "proxy" means according to Merriam-Webster: "a person authorized to act
818 Proxies are exceedingly common these days. Companies often only offer Internet
819 access to employees through their proxies. Network clients or user-agents ask
824 asks the proxy for it instead of trying to connect to the actual remote host
842 curl_easy_setopt(handle, CURLOPT_PROXY, "proxy-host.com:8080");
849 If you want to, you can specify the hostname only in the
882 variables, set the proxy name to "" - an empty string - with
887 SSL is for secure point-to-point connections. This involves strong encryption
890 discussed. Instead, the only way to have SSL work over an HTTP proxy is to ask
897 remote host").
910 This is however not the only time proxy-tunneling might offer benefits to
913 As tunneling opens a direct connection from your application to the remote
914 machine, it suddenly also re-introduces the ability to do non-HTTP
926 using a tunnel like this, as it then enables you to operate on the remote
930 ## Proxy Auto-Config
944 - Depending on the JavaScript complexity, write up a script that translates it
947 - Read the JavaScript code and rewrite the same logic in another language.
949 - Implement a JavaScript interpreter; people have successfully used the
952 - Ask your admins to stop this, for a static proxy setup or similar.
956 Re-cycling the same easy handle several times when doing multiple requests is
966 re-connection time.
968 FTP connections that are kept alive save a lot of time, as the command-
969 response round-trips are skipped, and also you do not risk getting blocked
970 without permission to login again like on many FTP servers only allowing N
1009 When doing POST requests, libcurl sets this header to "100-continue" to ask
1018 reliable protocol that is widely deployed and has excellent proxy-support.
1043 HTTP-like protocols pass a series of headers to the server when doing the
1050 headers = curl_slist_append(headers, "Hey-server-hey: how are you?");
1051 headers = curl_slist_append(headers, "X-silly-content: yes");
1066 headers = curl_slist_append(headers, "Accept: Agent-007");
1083 ## Enforcing chunked transfer-encoding
1085 By making sure a request uses the custom header "Transfer-Encoding: chunked"
1086 when doing a non-GET HTTP operation, libcurl switches over to "chunked"
1095 getting 1.1-requests and when dealing with stubborn old things like that, you
1102 Not all protocols are HTTP-like, and thus the above may not help you when
1107 here), and you can only use commands that work on the control-connection
1109 data-connection must be left to libcurl's own judgment. Also be aware that
1113 correct remote directory.
1118 headers = curl_slist_append(headers, "DELE file-to-remove");
1142 are in "HTTP-style", looking like they do in HTTP.
1163 In real-world cases, servers send new cookies to replace existing ones to
1166 Cookies are sent from server to clients with the header Set-Cookie: and
1177 cookies the remote server passes to you, and make sure those cookies are then
1203 file. We call that the cookie-jar. When you set a filename with
1218 best for all the people behind firewalls, NATs or IP-masquerading setups.
1229 something and only allows connections on a single port. libcurl then informs
1230 the remote server which IP address and port number to connect to. This is made
1231 with the CURLOPT_FTPPORT(3) option. If you set it to "-", libcurl uses your
1242 In addition to support HTTP multi-part form fields, the MIME API can be used
1248 multi-part, for example to include another email message or to offer several
1251 To build such a message, you prepare the nth-level multi-part and then include
1252 it as a source to the parent multi-part using function
1254 bound to its parent multi-part, a nth-level multi-part belongs to it and
1257 Email messages data is not supposed to be non-ascii and line length is
1263 use this function (this would over-encode it), but explicitly set the
1295 "Content-Disposition: inline");
1318 Some protocols provide "headers", meta-data separated from the normal
1336 actually true headers, but in this case we pretend they are! ;-)
1351 multi-threaded programs, but the truth is almost the reverse. The multi
1352 interface allows a single-threaded application to perform the same kinds of
1353 multiple, simultaneous transfers that multi-threaded programs can perform. It
1354 allows many of the benefits of multi-threaded transfers without the complexity
1359 designed for using with select(). See the libcurl-multi.3 man page for details
1377 curl_multi_perform(3) is asynchronous. It only performs what can be done
1391 what it wants to do. Take note that libcurl does also feature some time-out
1422 share a lot of the data that otherwise would be kept on a per-easy handle
1429 easy handles by using the share interface, see libcurl-share(3).
1432 example cookies so the only way to share that is with the share interface.
1439 Transfer-Encoding in cases where HTTP uploads are done with data of an unknown
1444 This happens on Windows machines when libcurl is built and used as a
1445 DLL. However, you can still do this on Windows if you link with a static
1450 The curl-config tool is generated at build-time (on Unix-like systems) and