mirror of
https://github.com/curl/curl.git
synced 2026-08-24 22:13:33 +03:00
parent
381c3d56e3
commit
3a0c600a1e
90 changed files with 463 additions and 593 deletions
|
|
@ -117,8 +117,7 @@ int main(void)
|
|||
/* HTTP-header style cookie. If you use the Set-Cookie format and do not
|
||||
specify a domain then the cookie is sent for any domain and is not
|
||||
modified, likely not what you intended. For more information refer to
|
||||
the CURLOPT_COOKIELIST documentation.
|
||||
*/
|
||||
the CURLOPT_COOKIELIST documentation. */
|
||||
snprintf(nline, sizeof(nline),
|
||||
"Set-Cookie: OLD_PREF=3d141414bf4209321; "
|
||||
"expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.example.com");
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@
|
|||
/* <DESC>
|
||||
* Get a webpage, extract the title with libxml.
|
||||
* </DESC>
|
||||
|
||||
Written by Lars Nilsson
|
||||
|
||||
GNU C++ compile command line suggestion (edit paths accordingly):
|
||||
|
||||
g++ -Wall -I/opt/curl/include -I/opt/libxml/include/libxml2 htmltitle.cpp \
|
||||
-o htmltitle -L/opt/curl/lib -L/opt/libxml/lib -lcurl -lxml2
|
||||
*/
|
||||
*
|
||||
* Written by Lars Nilsson
|
||||
*
|
||||
* GNU C++ compile command line suggestion (edit paths accordingly):
|
||||
*
|
||||
* g++ -Wall -I/opt/curl/include -I/opt/libxml/include/libxml2 htmltitle.cpp \
|
||||
* -o htmltitle -L/opt/curl/lib -L/opt/libxml/lib -lcurl -lxml2
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
|||
|
|
@ -102,13 +102,11 @@ int main(void)
|
|||
/* get verbose debug output please */
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
/*
|
||||
If you use POST to an HTTP 1.1 server, you can send data without knowing
|
||||
the size before starting the POST if you use chunked encoding. You
|
||||
enable this by adding a header like "Transfer-Encoding: chunked" with
|
||||
CURLOPT_HTTPHEADER. With HTTP 1.0 or without chunked transfer, you must
|
||||
specify the size in the request.
|
||||
*/
|
||||
/* If you use POST to an HTTP 1.1 server, you can send data without knowing
|
||||
the size before starting the POST if you use chunked encoding. You
|
||||
enable this by adding a header like "Transfer-Encoding: chunked" with
|
||||
CURLOPT_HTTPHEADER. With HTTP 1.0 or without chunked transfer, you must
|
||||
specify the size in the request. */
|
||||
#ifdef USE_CHUNKED
|
||||
{
|
||||
struct curl_slist *chunk = NULL;
|
||||
|
|
|
|||
|
|
@ -89,8 +89,7 @@ int main(void)
|
|||
supports "natively", you are doing it wrong and you should stop.
|
||||
|
||||
This example uses HTTP only to show how to use this API, it does not
|
||||
suggest that writing an application doing this is sensible.
|
||||
*/
|
||||
suggest that writing an application doing this is sensible. */
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
4. if you do not use a crypto engine:
|
||||
4.1. set pKeyName to the filename of your client key
|
||||
4.2. if the format of the key file is DER, set pKeyType to "DER"
|
||||
*/
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -73,11 +73,9 @@ static void *pull_one_url(void *p)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
int pthread_create(pthread_t *new_thread_ID,
|
||||
/* int pthread_create(pthread_t *new_thread_ID,
|
||||
const pthread_attr_t *attr,
|
||||
void * (*start_func)(void *), void *arg);
|
||||
*/
|
||||
void * (*start_func)(void *), void *arg); */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -100,17 +100,15 @@ int main(void)
|
|||
before a transfer is performed. Cookies in the list that have the same
|
||||
hostname, path and name as in my_cookie are skipped. That is because
|
||||
libcurl has already imported my_cookie and it is considered a "live"
|
||||
cookie. A live cookie is not replaced by one read from a file.
|
||||
*/
|
||||
cookie. A live cookie is not replaced by one read from a file. */
|
||||
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "cookies.txt"); /* import */
|
||||
|
||||
/* Cookies are exported after curl_easy_cleanup is called. The server
|
||||
may have added, deleted or modified cookies by then. The cookies that
|
||||
were skipped on import are not exported.
|
||||
*/
|
||||
were skipped on import are not exported. */
|
||||
curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "cookies.txt"); /* export */
|
||||
|
||||
result = curl_easy_perform(curl); /* cookies imported from cookies.txt */
|
||||
result = curl_easy_perform(curl); /* cookies imported from cookies.txt */
|
||||
|
||||
curl_easy_cleanup(curl); /* cookies exported to cookies.txt */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,9 +82,8 @@ int main(void)
|
|||
result = curl_easy_perform(curl);
|
||||
|
||||
/* if the request did not complete correctly, show the error
|
||||
information. if no detailed error information was written to errbuf
|
||||
show the more generic information from curl_easy_strerror instead.
|
||||
*/
|
||||
information. if no detailed error information was written to errbuf
|
||||
show the more generic information from curl_easy_strerror instead. */
|
||||
if(result != CURLE_OK) {
|
||||
size_t len = strlen(errbuf);
|
||||
fprintf(stderr, "\nlibcurl: (%d) ", result);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue