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: albert kao via curl-users <curl-users_at_lists.haxx.se>
Date: Sun, 4 Sep 2022 09:56:17 -0400

I followed gitea API:
https://docs.gitea.io/en-us/api-usage/

and tried:
curl -XPOST -H "Content-Type: application/json" -k -d '{"name":"test"}' -u
username:password https://gitea.your.host/api/v1/users/<username>/tokens


curl --request GET --url https://yourusername:password_at_gitea.your.host
/api/v1/users/<username>/tokens

Both curls were successful.

Then I tried:
curl --location-trusted --user myusername:mypassword --request GET -H
"Authorization: token 16c3e37d" -O --url
https://someurl.com/mydir/archive/master.zip

I got the same file, size is still only 8534 bytes, much smaller than the
expected file size. The content I sent earlier today.
How to proceed further?

On Sat, Sep 3, 2022 at 2:06 PM Alex Bligh via curl-users <
curl-users_at_lists.haxx.se> wrote:

>
>
> > On 3 Sep 2022, at 20:03, Dan Fandrich via curl-users <
> curl-users_at_lists.haxx.se> wrote:
> >
> >> 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.
>
> gitea appears to have an API:
> https://docs.gitea.io/en-us/api-usage/
>
> A 5 second skim suggests you can use basic auth, but only to get a
> token. The API documentation has examples with curl. Perhaps better
> to use the API than scrape the website.
>
> --
> Alex Bligh
>
>
>
>
> --
> Unsubscribe: https://lists.haxx.se/listinfo/curl-users
> Etiquette: https://curl.se/mail/etiquette.html
>


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