C code for http-webdav client using the CURLlibrary
I am searching for c code for http-webdav client using the CURL library with authentication enabled.
I have tried with some of the sample codes provided by the CURL , but nothing seem to pass the authentication methods and work.
I have enabled the digest authentication with the user and password.
The client request is sent correctly but the server response is 301.
I have captured the packets using the wireshark.
Is there any thing that is missing?
Below is the code I have tried.
/* read callback function, fread() look alike */
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
{
ssize_t retcode;
curl_off_t nread;
int *fdp = (int *)stream;
int fd = *fdp;
retcode = read(fd, ptr, size * nmemb);
nread = (curl_off_t)retcode;
fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T
" bytes from filen", nread);
return retcode;
}
/*
* This example shows a HTTP PUT operation. PUTs a file given as a command
* line argument to the URL also given on the command line.
*
* This example also uses its own read callback.
*
* Here's an article on how to setup a PUT handler for Apache:
* http://www.apacheweek.com/features/put
*/
int curlApache ()
{
CURL *curl;
CURLcode res;
FILE * hd_src;
struct stat file_info;
char *file;
char *url;
char error;
file = "/bd0/filecreate.txt";
url = "http://10.1.20.127/sites/";
//url = "http://10.1.21.14/webdav/test.txt";
struct curl_slist *slist = NULL;
slist = curl_slist_append(slist, "Accept: text/xml");
slist = curl_slist_append(slist, "Depth: infinity");
slist = curl_slist_append(slist, "Connection: Keep-Alive");
slist = curl_slist_append(slist, "Content-Type: text/xml");
slist = curl_slist_append(slist, "Expect:");
/* get the file size of the local file */
stat(file, &file_info);
hd_src = fopen(file, "a+");
if (hd_src == NULL)
printf("Disc full or no permissionn");
const char *str = "This is the file content";
const char read[24];
if (hd_src != NULL)
if (fputs (str, hd_src) != EOF);
if( fgets (read, 24, hd_src)!=NULL ) {
/* writing content to stdout */
puts(read);
}
/* In windows, this will init the winsock stuff */
curl_global_init(CURL_GLOBAL_ALL);
/* get a curl handle */
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 3L);
/* we want to use our own read function */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
/* enable uploading */
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
/* HTTP PUT please */
curl_easy_setopt(curl, CURLOPT_PUT, 1L);
/* tell libcurl we can use "any" auth, which lets the lib pick one, but it
also costs one extra round-trip and possibly sending of all the PUT
data twice!!! */
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_DIGEST);
curl_easy_setopt(curl, CURLOPT_USERPWD, "admin:nimo0630");
fseek(hd_src, 0L, SEEK_END);
int file_size;
file_size = ftell(hd_src);
Curl_setopt(curl, CURLOPT_INFILE, hd_src);
Curl_setopt(curl, CURLOPT_INFILESIZE, file_size);
/* specify target URL, and note that this URL should include a file
name, not only a directory */
curl_easy_setopt(curl, CURLOPT_URL, url);
/* now specify which file to upload */
curl_easy_setopt(curl, CURLOPT_READDATA, hd_src);
/* provide the size of the upload, we specicially typecast the value
to curl_off_t since we must be sure to use the correct data size */
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_info.st_size);
/* Now run off and do what you've been told! */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %sn",
curl_easy_strerror(res));
if(!res) {
/* extract the available authentication types */
long auth;
res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_AVAIL, &auth);
if(!res)
{
if(!auth)
printf("No auth available, perhaps no 401?n");
else
{
printf("%s%s%s%sn",
auth & CURLAUTH_BASIC ? "Basic ":"",
auth & CURLAUTH_DIGEST ? "Digest ":"",
auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
auth % CURLAUTH_NTLM ? "NTLM ":"");
}
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
fclose(hd_src); /* close the local file */
curl_global_cleanup();
return 0;
}
network-programming libcurl webdav
add a comment |
I am searching for c code for http-webdav client using the CURL library with authentication enabled.
I have tried with some of the sample codes provided by the CURL , but nothing seem to pass the authentication methods and work.
I have enabled the digest authentication with the user and password.
The client request is sent correctly but the server response is 301.
I have captured the packets using the wireshark.
Is there any thing that is missing?
Below is the code I have tried.
/* read callback function, fread() look alike */
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
{
ssize_t retcode;
curl_off_t nread;
int *fdp = (int *)stream;
int fd = *fdp;
retcode = read(fd, ptr, size * nmemb);
nread = (curl_off_t)retcode;
fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T
" bytes from filen", nread);
return retcode;
}
/*
* This example shows a HTTP PUT operation. PUTs a file given as a command
* line argument to the URL also given on the command line.
*
* This example also uses its own read callback.
*
* Here's an article on how to setup a PUT handler for Apache:
* http://www.apacheweek.com/features/put
*/
int curlApache ()
{
CURL *curl;
CURLcode res;
FILE * hd_src;
struct stat file_info;
char *file;
char *url;
char error;
file = "/bd0/filecreate.txt";
url = "http://10.1.20.127/sites/";
//url = "http://10.1.21.14/webdav/test.txt";
struct curl_slist *slist = NULL;
slist = curl_slist_append(slist, "Accept: text/xml");
slist = curl_slist_append(slist, "Depth: infinity");
slist = curl_slist_append(slist, "Connection: Keep-Alive");
slist = curl_slist_append(slist, "Content-Type: text/xml");
slist = curl_slist_append(slist, "Expect:");
/* get the file size of the local file */
stat(file, &file_info);
hd_src = fopen(file, "a+");
if (hd_src == NULL)
printf("Disc full or no permissionn");
const char *str = "This is the file content";
const char read[24];
if (hd_src != NULL)
if (fputs (str, hd_src) != EOF);
if( fgets (read, 24, hd_src)!=NULL ) {
/* writing content to stdout */
puts(read);
}
/* In windows, this will init the winsock stuff */
curl_global_init(CURL_GLOBAL_ALL);
/* get a curl handle */
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 3L);
/* we want to use our own read function */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
/* enable uploading */
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
/* HTTP PUT please */
curl_easy_setopt(curl, CURLOPT_PUT, 1L);
/* tell libcurl we can use "any" auth, which lets the lib pick one, but it
also costs one extra round-trip and possibly sending of all the PUT
data twice!!! */
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_DIGEST);
curl_easy_setopt(curl, CURLOPT_USERPWD, "admin:nimo0630");
fseek(hd_src, 0L, SEEK_END);
int file_size;
file_size = ftell(hd_src);
Curl_setopt(curl, CURLOPT_INFILE, hd_src);
Curl_setopt(curl, CURLOPT_INFILESIZE, file_size);
/* specify target URL, and note that this URL should include a file
name, not only a directory */
curl_easy_setopt(curl, CURLOPT_URL, url);
/* now specify which file to upload */
curl_easy_setopt(curl, CURLOPT_READDATA, hd_src);
/* provide the size of the upload, we specicially typecast the value
to curl_off_t since we must be sure to use the correct data size */
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_info.st_size);
/* Now run off and do what you've been told! */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %sn",
curl_easy_strerror(res));
if(!res) {
/* extract the available authentication types */
long auth;
res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_AVAIL, &auth);
if(!res)
{
if(!auth)
printf("No auth available, perhaps no 401?n");
else
{
printf("%s%s%s%sn",
auth & CURLAUTH_BASIC ? "Basic ":"",
auth & CURLAUTH_DIGEST ? "Digest ":"",
auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
auth % CURLAUTH_NTLM ? "NTLM ":"");
}
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
fclose(hd_src); /* close the local file */
curl_global_cleanup();
return 0;
}
network-programming libcurl webdav
Welcome to Stack Overflow. Please post the code of your attempts, describe what doesn't work and someone might be able to help. We do not write your home work for you!
– Daniel Stenberg
Nov 21 '18 at 9:26
Thanks for your suggestions. I have updated my code with description. The problem is with the server response. I have tried PUT to the IIS and Apache webdav server with CURL commands and it works fine. When I try with the code I have 301 response from the server. I understand there is some thing missing in the code.
– VamsiKrishna Neelam
Nov 22 '18 at 8:15
If you get 301, the authentication worked. EnableCURL_VERBOSE
and you might even see that. You probably want to enable redirect-following withCURLOPT_FOLLOWLOCATION
...
– Daniel Stenberg
Nov 22 '18 at 8:19
add a comment |
I am searching for c code for http-webdav client using the CURL library with authentication enabled.
I have tried with some of the sample codes provided by the CURL , but nothing seem to pass the authentication methods and work.
I have enabled the digest authentication with the user and password.
The client request is sent correctly but the server response is 301.
I have captured the packets using the wireshark.
Is there any thing that is missing?
Below is the code I have tried.
/* read callback function, fread() look alike */
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
{
ssize_t retcode;
curl_off_t nread;
int *fdp = (int *)stream;
int fd = *fdp;
retcode = read(fd, ptr, size * nmemb);
nread = (curl_off_t)retcode;
fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T
" bytes from filen", nread);
return retcode;
}
/*
* This example shows a HTTP PUT operation. PUTs a file given as a command
* line argument to the URL also given on the command line.
*
* This example also uses its own read callback.
*
* Here's an article on how to setup a PUT handler for Apache:
* http://www.apacheweek.com/features/put
*/
int curlApache ()
{
CURL *curl;
CURLcode res;
FILE * hd_src;
struct stat file_info;
char *file;
char *url;
char error;
file = "/bd0/filecreate.txt";
url = "http://10.1.20.127/sites/";
//url = "http://10.1.21.14/webdav/test.txt";
struct curl_slist *slist = NULL;
slist = curl_slist_append(slist, "Accept: text/xml");
slist = curl_slist_append(slist, "Depth: infinity");
slist = curl_slist_append(slist, "Connection: Keep-Alive");
slist = curl_slist_append(slist, "Content-Type: text/xml");
slist = curl_slist_append(slist, "Expect:");
/* get the file size of the local file */
stat(file, &file_info);
hd_src = fopen(file, "a+");
if (hd_src == NULL)
printf("Disc full or no permissionn");
const char *str = "This is the file content";
const char read[24];
if (hd_src != NULL)
if (fputs (str, hd_src) != EOF);
if( fgets (read, 24, hd_src)!=NULL ) {
/* writing content to stdout */
puts(read);
}
/* In windows, this will init the winsock stuff */
curl_global_init(CURL_GLOBAL_ALL);
/* get a curl handle */
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 3L);
/* we want to use our own read function */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
/* enable uploading */
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
/* HTTP PUT please */
curl_easy_setopt(curl, CURLOPT_PUT, 1L);
/* tell libcurl we can use "any" auth, which lets the lib pick one, but it
also costs one extra round-trip and possibly sending of all the PUT
data twice!!! */
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_DIGEST);
curl_easy_setopt(curl, CURLOPT_USERPWD, "admin:nimo0630");
fseek(hd_src, 0L, SEEK_END);
int file_size;
file_size = ftell(hd_src);
Curl_setopt(curl, CURLOPT_INFILE, hd_src);
Curl_setopt(curl, CURLOPT_INFILESIZE, file_size);
/* specify target URL, and note that this URL should include a file
name, not only a directory */
curl_easy_setopt(curl, CURLOPT_URL, url);
/* now specify which file to upload */
curl_easy_setopt(curl, CURLOPT_READDATA, hd_src);
/* provide the size of the upload, we specicially typecast the value
to curl_off_t since we must be sure to use the correct data size */
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_info.st_size);
/* Now run off and do what you've been told! */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %sn",
curl_easy_strerror(res));
if(!res) {
/* extract the available authentication types */
long auth;
res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_AVAIL, &auth);
if(!res)
{
if(!auth)
printf("No auth available, perhaps no 401?n");
else
{
printf("%s%s%s%sn",
auth & CURLAUTH_BASIC ? "Basic ":"",
auth & CURLAUTH_DIGEST ? "Digest ":"",
auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
auth % CURLAUTH_NTLM ? "NTLM ":"");
}
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
fclose(hd_src); /* close the local file */
curl_global_cleanup();
return 0;
}
network-programming libcurl webdav
I am searching for c code for http-webdav client using the CURL library with authentication enabled.
I have tried with some of the sample codes provided by the CURL , but nothing seem to pass the authentication methods and work.
I have enabled the digest authentication with the user and password.
The client request is sent correctly but the server response is 301.
I have captured the packets using the wireshark.
Is there any thing that is missing?
Below is the code I have tried.
/* read callback function, fread() look alike */
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
{
ssize_t retcode;
curl_off_t nread;
int *fdp = (int *)stream;
int fd = *fdp;
retcode = read(fd, ptr, size * nmemb);
nread = (curl_off_t)retcode;
fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T
" bytes from filen", nread);
return retcode;
}
/*
* This example shows a HTTP PUT operation. PUTs a file given as a command
* line argument to the URL also given on the command line.
*
* This example also uses its own read callback.
*
* Here's an article on how to setup a PUT handler for Apache:
* http://www.apacheweek.com/features/put
*/
int curlApache ()
{
CURL *curl;
CURLcode res;
FILE * hd_src;
struct stat file_info;
char *file;
char *url;
char error;
file = "/bd0/filecreate.txt";
url = "http://10.1.20.127/sites/";
//url = "http://10.1.21.14/webdav/test.txt";
struct curl_slist *slist = NULL;
slist = curl_slist_append(slist, "Accept: text/xml");
slist = curl_slist_append(slist, "Depth: infinity");
slist = curl_slist_append(slist, "Connection: Keep-Alive");
slist = curl_slist_append(slist, "Content-Type: text/xml");
slist = curl_slist_append(slist, "Expect:");
/* get the file size of the local file */
stat(file, &file_info);
hd_src = fopen(file, "a+");
if (hd_src == NULL)
printf("Disc full or no permissionn");
const char *str = "This is the file content";
const char read[24];
if (hd_src != NULL)
if (fputs (str, hd_src) != EOF);
if( fgets (read, 24, hd_src)!=NULL ) {
/* writing content to stdout */
puts(read);
}
/* In windows, this will init the winsock stuff */
curl_global_init(CURL_GLOBAL_ALL);
/* get a curl handle */
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 3L);
/* we want to use our own read function */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
/* enable uploading */
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
/* HTTP PUT please */
curl_easy_setopt(curl, CURLOPT_PUT, 1L);
/* tell libcurl we can use "any" auth, which lets the lib pick one, but it
also costs one extra round-trip and possibly sending of all the PUT
data twice!!! */
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_DIGEST);
curl_easy_setopt(curl, CURLOPT_USERPWD, "admin:nimo0630");
fseek(hd_src, 0L, SEEK_END);
int file_size;
file_size = ftell(hd_src);
Curl_setopt(curl, CURLOPT_INFILE, hd_src);
Curl_setopt(curl, CURLOPT_INFILESIZE, file_size);
/* specify target URL, and note that this URL should include a file
name, not only a directory */
curl_easy_setopt(curl, CURLOPT_URL, url);
/* now specify which file to upload */
curl_easy_setopt(curl, CURLOPT_READDATA, hd_src);
/* provide the size of the upload, we specicially typecast the value
to curl_off_t since we must be sure to use the correct data size */
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_info.st_size);
/* Now run off and do what you've been told! */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %sn",
curl_easy_strerror(res));
if(!res) {
/* extract the available authentication types */
long auth;
res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_AVAIL, &auth);
if(!res)
{
if(!auth)
printf("No auth available, perhaps no 401?n");
else
{
printf("%s%s%s%sn",
auth & CURLAUTH_BASIC ? "Basic ":"",
auth & CURLAUTH_DIGEST ? "Digest ":"",
auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
auth % CURLAUTH_NTLM ? "NTLM ":"");
}
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
fclose(hd_src); /* close the local file */
curl_global_cleanup();
return 0;
}
network-programming libcurl webdav
network-programming libcurl webdav
edited Nov 22 '18 at 8:14
VamsiKrishna Neelam
asked Nov 20 '18 at 8:49
VamsiKrishna NeelamVamsiKrishna Neelam
1318
1318
Welcome to Stack Overflow. Please post the code of your attempts, describe what doesn't work and someone might be able to help. We do not write your home work for you!
– Daniel Stenberg
Nov 21 '18 at 9:26
Thanks for your suggestions. I have updated my code with description. The problem is with the server response. I have tried PUT to the IIS and Apache webdav server with CURL commands and it works fine. When I try with the code I have 301 response from the server. I understand there is some thing missing in the code.
– VamsiKrishna Neelam
Nov 22 '18 at 8:15
If you get 301, the authentication worked. EnableCURL_VERBOSE
and you might even see that. You probably want to enable redirect-following withCURLOPT_FOLLOWLOCATION
...
– Daniel Stenberg
Nov 22 '18 at 8:19
add a comment |
Welcome to Stack Overflow. Please post the code of your attempts, describe what doesn't work and someone might be able to help. We do not write your home work for you!
– Daniel Stenberg
Nov 21 '18 at 9:26
Thanks for your suggestions. I have updated my code with description. The problem is with the server response. I have tried PUT to the IIS and Apache webdav server with CURL commands and it works fine. When I try with the code I have 301 response from the server. I understand there is some thing missing in the code.
– VamsiKrishna Neelam
Nov 22 '18 at 8:15
If you get 301, the authentication worked. EnableCURL_VERBOSE
and you might even see that. You probably want to enable redirect-following withCURLOPT_FOLLOWLOCATION
...
– Daniel Stenberg
Nov 22 '18 at 8:19
Welcome to Stack Overflow. Please post the code of your attempts, describe what doesn't work and someone might be able to help. We do not write your home work for you!
– Daniel Stenberg
Nov 21 '18 at 9:26
Welcome to Stack Overflow. Please post the code of your attempts, describe what doesn't work and someone might be able to help. We do not write your home work for you!
– Daniel Stenberg
Nov 21 '18 at 9:26
Thanks for your suggestions. I have updated my code with description. The problem is with the server response. I have tried PUT to the IIS and Apache webdav server with CURL commands and it works fine. When I try with the code I have 301 response from the server. I understand there is some thing missing in the code.
– VamsiKrishna Neelam
Nov 22 '18 at 8:15
Thanks for your suggestions. I have updated my code with description. The problem is with the server response. I have tried PUT to the IIS and Apache webdav server with CURL commands and it works fine. When I try with the code I have 301 response from the server. I understand there is some thing missing in the code.
– VamsiKrishna Neelam
Nov 22 '18 at 8:15
If you get 301, the authentication worked. Enable
CURL_VERBOSE
and you might even see that. You probably want to enable redirect-following with CURLOPT_FOLLOWLOCATION
...– Daniel Stenberg
Nov 22 '18 at 8:19
If you get 301, the authentication worked. Enable
CURL_VERBOSE
and you might even see that. You probably want to enable redirect-following with CURLOPT_FOLLOWLOCATION
...– Daniel Stenberg
Nov 22 '18 at 8:19
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389250%2fc-code-for-http-webdav-client-using-the-curllibrary%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389250%2fc-code-for-http-webdav-client-using-the-curllibrary%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Welcome to Stack Overflow. Please post the code of your attempts, describe what doesn't work and someone might be able to help. We do not write your home work for you!
– Daniel Stenberg
Nov 21 '18 at 9:26
Thanks for your suggestions. I have updated my code with description. The problem is with the server response. I have tried PUT to the IIS and Apache webdav server with CURL commands and it works fine. When I try with the code I have 301 response from the server. I understand there is some thing missing in the code.
– VamsiKrishna Neelam
Nov 22 '18 at 8:15
If you get 301, the authentication worked. Enable
CURL_VERBOSE
and you might even see that. You probably want to enable redirect-following withCURLOPT_FOLLOWLOCATION
...– Daniel Stenberg
Nov 22 '18 at 8:19