cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl library on linux

From: Hisseine Dj. <djandabri_at_sympatico.ca>
Date: Thu, 9 May 2002 08:50:13 -0400

H Daniel,

Thanks for your answer, I still have the same problem.

Here are the informations that you request:

-- Curl library version: 7.8

-- Call back function:

struct MemoryStruct {
  char *memory;
  size_t size;
};

size_t
WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
{
  register int realsize = realsize * nmemb;
  struct MemoryStruct *mem = (struct MemoryStruct *)data;
  mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1);
  if (mem->memory) {
    memcpy(&(mem->memory[mem->size]), ptr, realsize);
    mem->size += realsize;
    mem->memory[mem->size] = 0;
  }
  return realsize;
}

I will check for the protocol dump

Hisseine

----- Original Message -----
From: "Daniel Stenberg" <daniel_at_haxx.se>
To: "Hisseine Dj." <djandabri_at_sympatico.ca>
Cc: "libcurl Mailing list" <curl-library_at_lists.sourceforge.net>
Sent: Thursday, May 09, 2002 5:07 AM
Subject: Re: curl library on linux

> On Wed, 8 May 2002, Hisseine Dj. wrote:
>
> > I am using curl library to connect to a web server, this web server
needs
> > the user to be authenticate before doing anything.
> >
> > See this code:
> >
> > curl_handle = curl_easy_init();
> > curl_easy_setopt(curl_handle, CURLOPT_URL, MyURL);
> > curl_easy_setopt(curl_handle, CURLOPT_USERPWD, "Myuser:Mypass");
> > curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, MyCallback);
> > curl_easy_setopt(curl_handle, CURLOPT_FILE, (void *)&Mychunk);
> > curl_easy_perform(curl_handle);
> > curl_easy_cleanup(curl_handle);
> >
> > This will connect to the server and GET data and put it in the memory.
> >
> > The problem is that the data that I am getting is not complete (JPEG) or
is
> > corrupted?
>
> If you got a 200 code back, the returned data should only be broken if:
> 1. The server sends you bad data
> 2. libcurl bugs
> 3. Your write callback function bugs
> 4. Something other I didn't think of right now.
>
> I'd say that the option 3 is the most likely here. Option 1 is probably
easy
> checked with a normal browser. I don't think option 2 is very likely
either
> on this kind of simple transfer that are very often performed by users all
> over.
>
> > It seems that there is an authentication problem or data transfert, not
> > sure !!!!
>
> If there was a authentication problem, you wouldn't get a 200.
>
> Now, if you still have this problem. You should include libcurl version
and
> an as detailed protocol dump as you can showing the transfer fail. Also,
you
> could include your code that receives the data.
>
> --
> Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
>
>
> _______________________________________________________________
>
> Have big pipes? SourceForge.net is looking for download mirrors. We supply
> the hardware. You get the recognition. Email Us: bandwidth_at_sourceforge.net
>
>

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: bandwidth_at_sourceforge.net
Received on 2002-05-09