1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00
Commit Graph

514 Commits

Author SHA1 Message Date
Daniel Stenberg
3a6563d668 examples: adhere to curl code style
All plain C examples now (mostly) adhere to the curl code style. While
they are only examples, they had diverted so much and contained all
sorts of different mixed code styles by now. Having them use a unified
style helps users and readability. Also, as they get copy-and-pasted
widely by users, making sure they're clean and nice is a good idea.

573 checksrc warnings were addressed.
2016-02-11 09:44:45 +01:00
Daniel Stenberg
936d8f07df examples/cookie_interface.c: add cleanup call
cleaning up handles is a good idea as we leak memory otherwise

Also, line wrapped before 80 columns.
2016-02-11 08:44:59 +01:00
Gisle Vanem
c71b6a2795 examples/asiohiper: Avoid function name collision on Windows
closesocket => close_socket
Winsock already has the former.

Bug: https://curl.haxx.se/mail/lib-2016-02/0016.html
2016-02-06 17:04:38 -05:00
Gisle Vanem
6f702ebaa2 examples/htmltitle: Use _stricmp on Windows
Bug: https://curl.haxx.se/mail/lib-2016-02/0017.html
2016-02-06 17:02:55 -05:00
Viktor Szakats
b4f595bde4 URLs: change more http to https 2016-02-02 22:29:47 -05:00
Daniel Stenberg
4af40b3646 URLs: change all http:// URLs to https:// 2016-02-03 00:19:02 +01:00
Daniel Stenberg
e400a89b18 getredirect.c: fix variable name
Reported-by: Bernard Spil
2016-01-27 09:35:55 +01:00
Daniel Stenberg
06bf874bbc examples/Makefile.inc: specify programs without .c! 2016-01-27 08:30:04 +01:00
Daniel Stenberg
1d15a509dd progressfunc.c: spellfix description 2016-01-04 18:49:10 +01:00
Daniel Stenberg
a3b8a9e036 docs/examples/multi-app.c: fix bad desc formatting 2016-01-04 15:35:16 +01:00
Daniel Stenberg
2e503441ed examples: added descriptions 2016-01-04 15:34:05 +01:00
Daniel Stenberg
e45059214c example/simple.c: add description 2016-01-04 15:12:37 +01:00
Daniel Stenberg
1c9298ff1b getredirect.c: a new example 2016-01-04 15:12:37 +01:00
Daniel Stenberg
a47137c4a5 docs/examples: gitignore some more built examples 2015-12-01 09:09:04 +01:00
Daniel Stenberg
99d17a5e2b examples/README: cut out the incomplete list
... and add a generic explanation for them instead. Each example file
should contain its own description these days.
2015-11-25 10:49:22 +01:00
Steve Holme
06b288a72d examples: Added website parse-able descriptions to the e-mail examples 2015-11-22 11:55:10 +00:00
Steve Holme
c90e348579 examples: Fixed compilation warnings
pop3-multi.c:96:5: warning: implicit declaration of function 'memset'
imap-multi.c:96:5: warning: implicit declaration of function 'memset'
http2-download.c:226:5: warning: implicit declaration of function 'memset'
http2-upload.c:290:5: warning: implicit declaration of function 'memset'
http2-upload.c:290:5: warning: implicit declaration of function 'memset'
2015-11-21 01:47:02 +00:00
Daniel Stenberg
5fecdc26f7 copyrights: update Gisle Vanem's email 2015-10-20 13:33:01 +02:00
rouzier
b1d55997e5 hiperfifo: fix the pointer passed to WRITEDATA
Closes https://github.com/bagder/curl/pull/471
2015-10-04 17:16:14 -04:00
Viktor Szakats
9ee40ce2ab build: refer to fixed libidn versions
closes #371
2015-08-10 23:20:18 +02:00
Jay Satiro
8f0178a56b examples: Fix typo in multi-single.c 2015-07-11 02:32:53 -04:00
Daniel Stenberg
c00b18d540 examples: provide <DESC> sections 2015-07-01 11:43:12 +02:00
Daniel Stenberg
bf445b6e12 http2-serverpush.c: example code 2015-06-24 23:44:42 +02:00
Daniel Stenberg
0e7d76d6a8 examples: more descriptions 2015-06-18 11:38:54 +02:00
Daniel Stenberg
26583a62ab examples: add descriptions with <DESC>
Using this fixed format for example descriptions, we can generate a
better list on the web site.
2015-06-18 10:17:02 +02:00
Daniel Stenberg
eaeeed2e8f fopen.c: fix a few compiler warnings 2015-06-08 13:47:33 +02:00
Ville Skyttä
56b7663f73 docs: Spelling fixes 2015-06-08 13:43:31 +02:00
Jay Satiro
3013bb6b1c cookie: Stop exporting any-domain cookies
Prior to this change any-domain cookies (cookies without a domain that
are sent to any domain) were exported with domain name "unknown".

Bug: https://github.com/bagder/curl/issues/292
2015-06-03 21:48:47 -04:00
Daniel Stenberg
9f5dcab83d http2-upload.c: use PIPEWAIT for playing HTTP/2 better 2015-06-01 08:46:18 +02:00
Daniel Stenberg
41db5aed7a http2-download: check for CURLPIPE_MULTIPLEX properly
Bug: http://curl.haxx.se/mail/lib-2015-06/0001.html
Reported-by: Rafayel Mkrtchyan
2015-06-01 08:45:30 +02:00
Daniel Stenberg
f348a6b4ab dist: add the http2 examples 2015-05-28 16:04:13 +02:00
Daniel Stenberg
d1b1d782f5 http2 examples: clean up some comments 2015-05-28 16:04:00 +02:00
Daniel Stenberg
e57f08863a examples: added two programs doing multiplexed HTTP/2 2015-05-28 15:58:34 +02:00
Viktor Szakats
3d38a38012 build: bump version in default nghttp2 paths 2015-05-19 07:42:16 +02:00
Viktor Szakats
6a61285909 build: update depedency versions, urls, example makefiles
- update default versions of dependencies (except for rare/old platforms)
- update urls
- sync examples makefiles with main ones
- remove line ending space
2015-04-30 08:29:00 +02:00
Markus Elfring
29c655c0a6 Bug #149: Deletion of unnecessary checks before calls of the function "free"
The function "free" is documented in the way that no action shall occur for
a passed null pointer. It is therefore not needed that a function caller
repeats a corresponding check.
http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first

This issue was fixed by using the software Coccinelle 1.0.0-rc24.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2015-03-16 12:13:56 +01:00
Steve Holme
4c8a053855 sepheaders.c: Applied curl oding standards 2014-12-31 11:20:41 +00:00
Julien Nabet
8a3c0fbed1 sepheaders.c: Fixed resource leak on failure 2014-12-31 11:14:22 +00:00
Steve Holme
a9eadc9f91 asiohiper.cpp: No need to initialise members of ConnInfo
...as calloc() automatically clears the area of memory with zeros.
2014-12-27 12:01:13 +00:00
Steve Holme
193ba7b46e asiohiper.cpp: Updated for curl coding standards
...with the exception of the start of block statement curly brackets.
2014-12-27 12:01:11 +00:00
Steve Holme
151ae59436 code/docs: Use correct case for IPv4 and IPv6
For consistency, as we seem to have a bit of a mixed bag, changed all
instances of ipv4 and ipv6 in comments and documentations to use the
correct case.
2014-12-27 11:31:55 +00:00
Steve Holme
1abe65d928 code/docs: Use Unix rather than UNIX to avoid use of the trademark
Use Unix when generically writing about Unix based systems as UNIX is
the trademark and should only be used in a particular product's name.
2014-12-26 21:42:44 +00:00
Guenter Knauf
c0fc9066a9 synctime.c: added own user-agent string. 2014-12-13 15:02:30 +01:00
Guenter Knauf
157c9752d5 synctime.c: removed another timeserver URL.
worldtimeserver.com seems also no longer available.
2014-12-13 13:43:19 +01:00
Guenter Knauf
e98b7b1cb3 synctime.c: fixed timeserver URLs.
For getting the date header its not necessary to access special
pages or even CGI scripts - all pages including the main index
reply with the date header, therefore shortened URLs to domain.
Removed worldtime.com; added pool.ntp.org.
2014-12-13 13:38:37 +01:00
Guenter Knauf
c3b85c12a9 synctime.c: fixed user-agent setting.
Some websites meanwhile refuse to reply to requests from ancient
browsers like IE6, therefore I've comment out this setting, but
also fixed the string to now fake IE8 if someone enables it.
2014-12-09 18:18:40 +01:00
Steve Holme
58b317c9da Makefile.inc: Added our standard header and updated file formatting 2014-12-06 19:53:44 +00:00
Guenter Knauf
ccfa139c71 build: updated dependencies in makefiles. 2014-12-05 14:54:25 +01:00
Jay Satiro
7b5ca30917 examples: remove sony.com from 10-at-a-time
Prior to this change the 10-at-a-time example showed CURLE_RECV_ERROR
for the sony website because it ends the connection when the request is
missing a user agent.
2014-12-04 14:27:44 -08:00
Daniel Stenberg
bc860548c2 multi-single.c: switch to use curl_multi_wait
Makes the example much easier and straight-forward!
2014-11-25 11:45:38 +01:00
Steve Holme
804e462305 multi-uv.c: Updated for curl coding standards 2014-11-19 20:15:32 +00:00
Jay Satiro
cb13fad733 examples: Wait recommended 100ms when no file descriptors are ready
Prior to this change when no file descriptors were ready on platforms
other than Windows the multi examples would sleep whatever was in
timeout, which may or may not have been less than the minimum
recommended value [1] of 100ms.

[1]: http://curl.haxx.se/libcurl/c/curl_multi_fdset.html
2014-11-19 13:34:05 +01:00
Waldek Kozba
9406ab91a2 multi-uv.c: close the file handle after download 2014-11-19 13:28:48 +01:00
Jay Satiro
a607f8a20c examples: Don't call select() to sleep on windows
Windows does not support using select() for sleeping without a dummy
socket. Instead use Windows' Sleep() and sleep for 100ms which is the
minimum suggested value in the curl_multi_fdset() doc.

Prior to this change the multi examples would exit prematurely since
select() would error instead of sleeping when called without an fd.

Reported-by: Johan Lantz
Bug: http://curl.haxx.se/mail/lib-2014-11/0221.html
2014-11-15 21:27:20 +01:00
Daniel Stenberg
c927c92086 httpcustomheader.c: make use of more CURLOPT_HTTPHEADER features
... and only do a single request for clarity.
2014-10-16 11:38:32 +02:00
Waldek Kozba
b7d3338df2 multi-uv.c: call curl_multi_info_read() better
Improves it for low-latency cases (like the communication with
localhost)
2014-10-07 10:20:41 +02:00
Daniel Stenberg
9e6c3638e6 ftp-wildcard.c: spell fix
Reported-By: Frank Gevaerts
2014-09-09 11:10:18 +02:00
David Woodhouse
9ad282b1ae Remove all traces of FBOpenSSL SPNEGO support
This is just fundamentally broken. SPNEGO (RFC4178) is a protocol which
allows client and server to negotiate the underlying mechanism which will
actually be used to authenticate. This is *often* Kerberos, and can also
be NTLM and other things. And to complicate matters, there are various
different OIDs which can be used to specify the Kerberos mechanism too.

A SPNEGO exchange will identify *which* GSSAPI mechanism is being used,
and will exchange GSSAPI tokens which are appropriate for that mechanism.

But this SPNEGO implementation just strips the incoming SPNEGO packet
and extracts the token, if any. And completely discards the information
about *which* mechanism is being used. Then we *assume* it was Kerberos,
and feed the token into gss_init_sec_context() with the default
mechanism (GSS_S_NO_OID for the mech_type argument).

Furthermore... broken as this code is, it was never even *used* for input
tokens anyway, because higher layers of curl would just bail out if the
server actually said anything *back* to us in the negotiation. We assume
that we send a single token to the server, and it accepts it. If the server
wants to continue the exchange (as is required for NTLM and for SPNEGO
to do anything useful), then curl was broken anyway.

So the only bit which actually did anything was the bit in
Curl_output_negotiate(), which always generates an *initial* SPNEGO
token saying "Hey, I support only the Kerberos mechanism and this is its
token".

You could have done that by manually just prefixing the Kerberos token
with the appropriate bytes, if you weren't going to do any proper SPNEGO
handling. There's no need for the FBOpenSSL library at all.

The sane way to do SPNEGO is just to *ask* the GSSAPI library to do
SPNEGO. That's what the 'mech_type' argument to gss_init_sec_context()
is for. And then it should all Just Work™.

That 'sane way' will be added in a subsequent patch, as will bug fixes
for our failure to handle any exchange other than a single outbound
token to the server which results in immediate success.
2014-07-16 17:26:08 +02:00
Dan Fandrich
3ae2b6cd7f Update instances of some obsolete CURLOPTs to their new names 2014-07-05 22:47:13 +02:00
Dimitrios Siganos
22eb00f937 example: use correct type (long) for CURLOPT_FOLLOWLOCATION 2014-07-03 22:47:28 +02:00
Daniel Stenberg
1343756742 cacertinmem: fix memory leak
While "just" an example it still isn't nice to leak memory.

Bug: http://curl.haxx.se/bug/view.cgi?id=1368
Fixed-by: Marko
2014-05-09 13:33:21 +02:00
Steve Holme
0c4589f0c0 imap-append.c: Fixed compilation errors on some platforms
In the initializer for len, there is no prototype for "strlen".
In this statement, there is no prototype for "memcpy".
2014-03-30 10:56:51 +01:00
Daniel Stenberg
1f60728f81 examples: remove all use of CURLM_CALL_MULTI_PERFORM
... since it is never returned since a long while back.
2014-02-17 08:25:39 +01:00
Steve Holme
dc0f8c04ec examples: Added IMAP LSUB example 2014-02-16 00:09:22 +00:00
Daniel Stenberg
8bcf677a30 examples: gitignore more binaries 2014-01-29 10:22:40 +01:00
Steve Holme
27ecc22649 pop3-dele.c: Added missing CURLOPT_NOBODY following feedback 2014-01-15 23:39:46 +00:00
Steve Holme
a33e7edcec examples: Fixed compilation errors
error: 'MULTI_PERFORM_HANG_TIMEOUT' undeclared
2014-01-12 18:43:40 +00:00
Steve Holme
0fea86afe3 imap-multi.c: Corrected typo 2014-01-12 18:27:33 +00:00
Steve Holme
3a4cd2ad8d smtp-multi.c: Minor coding style tidyup following POP3 and IMAP additions 2014-01-12 18:24:48 +00:00
Steve Holme
82c472228e examples: Added IMAP multi example 2014-01-12 18:21:46 +00:00
Steve Holme
0089e65008 pop3-multi.c: Corrected copy/paste typo 2014-01-12 18:11:22 +00:00
Steve Holme
2492fd30e5 examples: Added POP3 multi example 2014-01-12 18:02:22 +00:00
Steve Holme
190e41f840 examples: Added comments to SMTP multi example based on other MAIL examples 2014-01-12 16:45:52 +00:00
Steve Holme
5d25d626b1 examples: Removed user information and TLS setup from SMTP multi example
Simplified the SMTP multi example as this example should demonstrate
the differences the easy and multi interfaces rather than introduce new
concepts such as user authentication and TLS which are shown in the TLS
and SSL examples.
2014-01-12 16:33:19 +00:00
Steve Holme
e473a4d2f3 examples: Updated SMTP MAIL example to return libcurl result code 2014-01-12 15:55:08 +00:00
Steve Holme
7e85964080 examples: Synchronised comments between SMTP MAIL examples 2014-01-12 15:43:07 +00:00
Steve Holme
9bd2fdb8e2 examples: Updated SMTP MAIL example to use a read function for data
Updated to read data from a callback rather than from stdio as this is
more realistic to most use cases.
2014-01-12 15:43:05 +00:00
Steve Holme
fc0b4b0d31 examples: Added required libcurl version information to SMTP examples 2014-01-05 23:00:56 +00:00
Steve Holme
149e0c8d10 Examples: Renamed SMTP MAIL example to match other email examples 2014-01-05 17:51:18 +00:00
Steve Holme
0f4bf77bd3 examples: Added POP3 TLS example 2014-01-05 14:26:51 +00:00
Steve Holme
ecb0dc4c90 examples: Added IMAP NOOP example 2014-01-05 14:22:35 +00:00
Steve Holme
a6742a1c12 examples: Added POP3 NOOP example 2014-01-05 13:59:21 +00:00
Steve Holme
e209d60713 pop3-stat.c: Corrected small typo from commit 91d62e9abd 2014-01-05 13:56:49 +00:00
Steve Holme
91d62e9abd examples: Added POP3 STAT example 2014-01-05 13:29:50 +00:00
Steve Holme
3e17db4882 examples: Added POP3 TOP example 2014-01-05 13:16:41 +00:00
Steve Holme
ef2d7cb44b examples: Added POP3 DELE example 2014-01-05 13:00:25 +00:00
Steve Holme
e948b9c6e3 examples: Added POP3 UIDL example 2014-01-05 12:31:28 +00:00
Steve Holme
afb65c6cf3 examples: Added POP3 RETR example 2014-01-05 12:17:15 +00:00
Steve Holme
5be92d03b0 examples: Added return of error code in POP3 examples 2014-01-05 12:05:02 +00:00
Steve Holme
ad39e7ec01 examples: Reworked POP3 examples for additional upcoming POP3 examples 2014-01-05 11:28:24 +00:00
Steve Holme
98b7fc0195 examples: Added SMTP SSL example 2014-01-05 11:27:29 +00:00
Steve Holme
f9797871aa examples: Added IMAP SSL and TLS examples 2014-01-05 11:26:41 +00:00
Steve Holme
5220c1d692 examples: Standardised username and password settings for all email examples
Replaced the use of CURLOPT_USERPWD for the preferred CURLOPT_USERNAME
and CURLOPT_PASSWORD options and used the same username and password for
all email examples which is the same as that used in the test suite.
2014-01-04 18:12:02 +00:00
Steve Holme
4c51f2b578 examples: Added IMAP COPY example 2014-01-04 01:11:26 +00:00
Steve Holme
2b026784a8 examples: Added IMAP DELETE example 2014-01-04 01:11:03 +00:00
Steve Holme
3c1519117a examples: Added IMAP CREATE example 2014-01-04 01:05:46 +00:00
Steve Holme
0f340f0572 examples: Added IMAP SEARCH example 2014-01-02 20:19:45 +00:00
Steve Holme
f063773b83 examples: Added IMAP EXAMINE mailbox folder example 2014-01-02 20:19:36 +00:00
Steve Holme
6bc9e46bf1 examples: Updated SMTP multi example to be more realistic
Updated the contents of the email and payload callback as per the IMAP
and other SMTP examples.
2014-01-01 20:58:04 +00:00
Steve Holme
1f47a77b29 examples: Corrected unescaped backslash in imap-store.c 2014-01-01 19:31:41 +00:00