curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Download ZIP file of private gitea repository

From: Dan Fandrich via curl-users <curl-users_at_lists.haxx.se>
Date: Sat, 3 Sep 2022 11:03:01 -0700

On Sat, Sep 03, 2022 at 07:50:20AM -0400, albert kao via curl-users wrote:
> I try to use curl to download the same ZIP file.
>
> curl -s -S -L -O --user myusername:mypassword https://someurl.com/mydir/archive
> /master.zip
>
> The downloaded master.zip is only 8534 bytes, much smaller than the expected
> file size.
> In addition, the file cannot be unzipped.

Take a look at the contents of the file. It's probably an HTML file that
contains an error message explaining why the download failed.

> How to download the ZIP file with curl?

It depends on what the error is. I suspect that the site isn't using
HTTP authentication (which is what the --user option is for) but is
using a custom authentication scheme using cookies. Take a look at
https://curl.se/docs/httpscripting.html especially the Web Login section
for some hints on how to script such a login.

Dan
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2022-09-03