mlj / castget

A simple, command-line based RSS enclosure downloader, primarily intended for automatic, unattended downloading of podcasts.
http://castget.johndal.com
GNU General Public License v2.0
103 stars 23 forks source link

--debug doesn't seem to do anything #55

Closed blzbrg closed 2 years ago

blzbrg commented 2 years ago

What happened

For example, when running castget --debug --verbose mountain_stage I only got one line per enclosure. For example:

Updating channel mountain_stage...
 * https://feedpress.me/link/13907/14951381/33959.mp3 (128.5 MB)
 * Set ID3 tag content type to Podcast.
 * https://feedpress.me/link/13907/14910289/33933.mp3 (131.1 MB)
 * Set ID3 tag content type to Podcast

What I expected

Enough curl information to debug what requests are actually made, for example:

 * https://feedpress.me/link/13907/14806892/33875.mp3 (134.3 MB)
*   Trying 5.135.16.50:443...
* Connected to feedpress.me (5.135.16.50) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: none
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=feedpress.me
*  start date: Nov  1 11:36:45 2021 GMT
*  expire date: Jan 30 11:36:44 2022 GMT
*  subjectAltName: host "feedpress.me" matched cert's "feedpress.me"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
> GET /link/13907/14806892/33875.mp3 HTTP/1.1
Host: feedpress.me
User-Agent: castget 2.0.1 (castget rss enclosure downloader)
Accept: */*
Accept-Encoding: deflate, gzip, br, zstd

* old SSL session ID is stale, removing
* Mark bundle as not supporting multiuse
< HTTP/1.1 301 Moved Permanently
< server: nginx
< date: Wed, 22 Dec 2021 01:45:10 GMT
< content-length: 0
< location: https://tracking.feedpress.com/link/13907/14806892/33875.mp3
< x-backend-server: 172.16.0.55
< access-control-allow-origin: *
< access-control-allow-methods: GET,OPTIONS
< access-control-allow-headers: Content-Type,Origin,Accept
### SNIP ###

Version information

I am using castget on x86_64 Arch Linux. The Arch package is version 2.0.1-1, with a stated build date of Noc 19 2019.

Plausible fix

I am pretty sure that the --debug flag is not hooked up correctly in castget.c

The option write to show_debug_info:

    { "debug", 'd', 0, G_OPTION_ARG_NONE, &show_debug_info,
      "print connection debug information" },

But the functions use debug:

  case OP_UPDATE:
    channel_update(c, channel_configuration, update_callback, 0, 0, first_only,
                   resume, filter, debug, show_progress_bar);

Which does not ever seem to be written to.

I recompiled and fixed this and the issue appeared to be fixed in my manual testing. Will make a PR soon.

mlj commented 2 years ago

Thanks for your thorough investigation and for the fix!

Fix verified and merged.