flickr-downloadr / flickr-downloadr-gtk

A cross-platform desktop app, written in Mono that would download (all or selected) photos from your photostream in their selected size along with their description, title and tags.
https://flickrdownloadr.com/
MIT License
180 stars 41 forks source link

Unable to download photos #38

Closed CGarces closed 3 years ago

CGarces commented 8 years ago

I'm using flickr-downloadr from the deb package on Debian 8 stable.

After fix one error in the login (#37)

I get another error after try to download something from my account.

Fatal Error: System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.RemoteValidation (Mono.Security.Protocol.Tls.ClientContext context, AlertDescription description) [0x00000] in :0 at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in :0 at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in :0 at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in :0 at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process () at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in :0 at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in :0 --- End of inner exception stack trace --- at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in :0 --- End of inner exception stack trace --- at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in :0 at System.Net.HttpWebRequest.GetResponse () [0x00000] in :0 at FloydPink.Flickr.Downloadr.UI.CachedImage.HttpHelper.Get (System.String url) [0x00000] in :0 at FloydPink.Flickr.Downloadr.UI.CachedImage.HttpHelper.GetAndSaveToFile (System.String url, System.String fileName) [0x00000] in :0 at FloydPink.Flickr.Downloadr.UI.CachedImage.FileCache.FromUrl (System.String url) [0x00000] in :0 at FloydPink.Flickr.Downloadr.ImageExtension.SetCachedImage (Gtk.Image self, System.String imageUrl) [0x00000] in :0 at FloydPink.Flickr.Downloadr.UI.Widgets.PhotoWidget.set_ImageUrl (System.String value) [0x00000] in :0 at FloydPink.Flickr.Downloadr.UI.Widgets.PhotoWidget.set_WidgetItem (IGridWidgetItem value) [0x00000] in :0 at FloydPink.Flickr.Downloadr.UI.Windows.LandingWindow.set_PublicPhotoset (FloydPink.Flickr.Downloadr.Model.Photoset value) [0x00000] in :0 at FloydPink.Flickr.Downloadr.Presentation.LandingPresenter+c__async0.MoveNext () [0x00000] in :0 ... False

CGarces commented 8 years ago

It's really strange.

How reproduce the error.

Create /usr/bin/flickr-downloader with the following content

#!/bin/bash

if [ ! -f ~/.config/flickr-downloadr/token.repo ]; then
  sudo cert-sync /etc/ssl/certs/ca-certificates.crt
fi

/opt/flickrdownloadr/bin/flickr-downloadr.exe

Be sure that ~/.config/flickr-downloadr folder not exist

The certificates will be imported, login should work fine, I can get my photos.

Close the program and run again, the Unhandled Exception appears. I need to rm -rf ~/.config/flickr-downloadr to get the tool working again.

Unhandled Exception:
System.Net.WebException: Error: SecureChannelFailure (The authentication or decryption has failed.) ---> System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: Error while sending TLS Alert (Fatal:InternalError): System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.
  at Mono.Security.Protocol.Tls.RecordProtocol.EndReceiveRecord (System.IAsyncResult asyncResult) [0x00040] in <e220be0b0a364427860ee43376ab6f2b>:0 
  at Mono.Security.Protocol.Tls.SslClientStream.SafeEndReceiveRecord (System.IAsyncResult ar, System.Boolean ignoreEmpty) [0x00000] in <e220be0b0a364427860ee43376ab6f2b>:0 
  at Mono.Security.Protocol.Tls.SslClientStream.NegotiateAsyncWorker (System.IAsyncResult result) [0x00071] in <e220be0b0a364427860ee43376ab6f2b>:0 
   --- End of inner exception stack trace ---
  at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (System.IAsyncResult result) [0x0003b] in <e220be0b0a364427860ee43376ab6f2b>:0 
  at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (System.IAsyncResult asyncResult) [0x0000c] in <e220be0b0a364427860ee43376ab6f2b>:0  ---> System.IO.IOException: Unable to write data to the transport connection: The socket has been shut down. ---> System.Net.Sockets.SocketException: The socket has been shut down
  at System.Net.Sockets.Socket.EndSend (System.IAsyncResult result) [0x00033] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at System.Net.Sockets.NetworkStream.EndWrite (System.IAsyncResult asyncResult) [0x0005f] in <6c7c03f48a9747c8a644da4f63a34480>:0 
   --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.EndWrite (System.IAsyncResult asyncResult) [0x000af] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at Mono.Security.Protocol.Tls.RecordProtocol.EndSendRecord (System.IAsyncResult asyncResult) [0x00040] in <e220be0b0a364427860ee43376ab6f2b>:0 
  at Mono.Security.Protocol.Tls.RecordProtocol.SendRecord (Mono.Security.Protocol.Tls.ContentType contentType, System.Byte[] recordData) [0x0000b] in <e220be0b0a364427860ee43376ab6f2b>:0 
  at Mono.Security.Protocol.Tls.RecordProtocol.SendAlert (Mono.Security.Protocol.Tls.Alert alert) [0x00027] in <e220be0b0a364427860ee43376ab6f2b>:0 
  at Mono.Security.Protocol.Tls.RecordProtocol.SendAlert (System.Exception& ex) [0x00021] in <e220be0b0a364427860ee43376ab6f2b>:0 
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
  at Mono.Security.Protocol.Tls.SslStreamBase.EndRead (System.IAsyncResult asyncResult) [0x00057] in <e220be0b0a364427860ee43376ab6f2b>:0 
  at Mono.Net.Security.Private.LegacySslStream.EndAuthenticateAsClient (System.IAsyncResult asyncResult) [0x00011] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at Mono.Net.Security.Private.LegacySslStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x0000e] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at Mono.Net.Security.MonoTlsStream.CreateStream (System.Byte[] buffer) [0x00044] in <6c7c03f48a9747c8a644da4f63a34480>:0 
   --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00064] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at System.Net.HttpWebRequest.GetResponse () [0x0000e] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at FloydPink.Flickr.Downloadr.Logic.UpdateCheckLogic.UpdateAvailable (FloydPink.Flickr.Downloadr.Model.Preferences preferences) [0x00053] in <ad386597db914146b84689f1bca42c43>:0 
  at FloydPink.Flickr.Downloadr.Presentation.LoginPresenter.ApplyUser (FloydPink.Flickr.Downloadr.Model.User user) [0x0001b] in <37bacda32e4f441b8e01b49a30028cef>:0 
  at FloydPink.Flickr.Downloadr.Logic.LoginLogic+<CallApplyUser>c__async0.MoveNext () [0x00092] in <ad386597db914146b84689f1bca42c43>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__1 (System.Object state) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x0000e] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x0008d] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x0002a] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00096] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
CGarces commented 8 years ago

I found the offending file: prefs.repo

If I remove prefs.repo before launch flickr-downloadr it works ok. I have added rm -f ${XDG_CONFIG_HOME:-$HOME/.config}/flickr-downloadr/prefs.repo at /opt/flickrdownloadr/flickrdownloadr as workarround.

floydpink commented 7 years ago

Can you check the latest version that was released a few hours back to see if this issue still persists, @CGarces ?

👍