cURL / Mailing Lists / curl-library / Single Mail

curl-library

Fwd: Problems with document root when retrieving files- continued

From: Randy Zauhar <artemisdiscovery_at_me.com>
Date: Tue, 20 Jul 2010 12:11:37 -0400

Sorry to repeat my message below. Briefly there was a path problem where libcurl refused to find a file to download from my document root.

I followed your collective advice, and in the end the problem was really dumb - my code was appending an '/' to the URL, so that even though I entered http://artemisdiscovery.com/foo.txt, the internal variable held http://artemisdiscovery.com/foo.txt/ . The trailing slash causes the error.

The advice to run curl https://www.artemisdiscovery.com/foo.txt --libcurl libcurl.out on the command line gave me the answer, since this worked, and the sample code contained my URL without trailing slash. After much dicking around I discovered what was happening.

Many thanks for your help! libcurl is my new favorite API!

Randy

Begin forwarded message:

> From: Randy Zauhar <artemisdiscovery_at_me.com>
> Date: July 19, 2010 12:56:37 PM EDT
> To: curl-library_at_cool.haxx.se
> Subject: Problems with document root when retrieving files
> Reply-To: libcurl development <curl-library_at_cool.haxx.se>
>
> Hi All,
>
> I looked in the archive but did not see reference to this specific problem. May simply reflect my ignorance of how URLs are interpreted.
>
> Just to be concrete, my apache server is configured with document root /Library/WebServer/Documents/ArtemisDiscoveryWeb. If I use a browser, I can readily pull a file by simply entering the URL in the browser window: https://www.artemisdiscovery.com/foo.txt,where foo.txt is in my document root.
>
> When using libcurl (I essentially copied from the 'getinmemory.c' example) I receive a 404 message (file not not found) and the path of the missing file is reported as /foo.txt (why the leading / ?)
>
> I actually have a workaround - I wrote a simple PHP script that is invoked as
>
> https://www.artemisdiscovery.com/pumpFile.php?name=foo.txt
>
> and that seems to work great! But why am I having to take this route?
>
> Thanks in advance,
>
> Randy
>
> Randy J. Zauhar, PhD
>
> ArtemisDiscovery, LLC
> Independents Hall
> 20 N. 3rd Street, Unit 201
> Philadelphia, PA 19106
>
> 267-303-4766
> artemisdiscovery_at_me.com
>
> University address:
>
> Depts. of Chemistry & Biochemistry,
> Bioinformatics & Computer Science
> University of the Sciences in Philadelphia
> 600 S. 43rd Street
> Philadelphia, PA 19104
>
> 215-596-8691
> r.zauhar_at_usp.edu
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html

Randy J. Zauhar, PhD

ArtemisDiscovery, LLC
Independents Hall
20 N. 3rd Street, Unit 201
Philadelphia, PA 19106

EMail: artemisdiscovery_at_me.com
Phone: 267-303-4766

University:

Depts. of Chemistry & Biochemistry, and
Bioinformatics & Computer Science
University of the Sciences
600 S. 43rd Street
Philadelphia, PA 19104

EMail: r.zauhar_at_usp.edu
Phone: 215-596-8691

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-20