Giter VIP home page Giter VIP logo

haskellnet-ssl's Introduction

HaskellNet-SSL

Build Status

This package ties together the excellent HaskellNet and connection packages to make it easy to open IMAP and SMTP connections over SSL. This is a simple "glue" library; all credit for a) connecting to IMAP/SMTP servers and b) making an SSL connection goes to the aforementioned libraries.

haskellnet-ssl's People

Contributors

da-x avatar dpwright avatar hazelfire avatar jcristovao avatar lemol avatar limick avatar niboor avatar vincenthz avatar vzaliva avatar ygale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

haskellnet-ssl's Issues

Cabal dependencies

Hi,

I'm running into a dependency problem and I can't seem to be able to install HaskellNet-SSL. Below you can find the output from cabal install. I think the problem can be solved if HaskellNet-SSL did not depend on tls-extra (which has been deprecated in favor of tls), but it depended on the latest version of tls.

What do you think?

Resolving dependencies...
cabal: Could not resolve dependencies:
trying: HaskellNet-SSL-0.2.1 (user goal)
trying: connection-0.2.0 (dependency of HaskellNet-SSL-0.2.1)
trying: tls-extra-0.6.6 (dependency of HaskellNet-SSL-0.2.1)
next goal: tls (dependency of HaskellNet-SSL-0.2.1)
rejecting: tls-1.2.2, 1.2.1, 1.2.0 (conflict: tls-extra => tls>=1.1.0 &&
<1.2.0)
rejecting: tls-1.1.5, 1.1.4, 1.1.3, 1.1.2 (conflict: connection => tls>=1.2)
rejecting: tls-1.1.1, 1.1.0, 1.0.3, 1.0.2, 1.0.1, 1.0.0, 0.9.11, 0.9.10,
0.9.9, 0.9.8, 0.9.7, 0.9.6, 0.9.5, 0.9.4, 0.9.3, 0.9.2, 0.9.1, 0.9.0, 0.8.5,
0.8.4, 0.8.3.2, 0.8.3.1, 0.8.3, 0.8.2, 0.8.1, 0.8.0, 0.7.2, 0.7.1, 0.7.0,
0.6.4, 0.6.3, 0.6.2, 0.6.1, 0.6.0, 0.5.1, 0.5.0, 0.4.1, 0.4.0, 0.3.3, 0.3.2,
0.3.1, 0.3, 0.2, 0.1.3, 0.1.2, 0.1.1, 0.1 (conflict: HaskellNet-SSL =>
tls>=1.1.2)
Backjump limit reached (change with --max-backjumps).

Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.

maxLineLength too small

I got LineTooLong exception on read and spent some time debugging from HaskellNet-SSL via HaskellNet down to ByteString (where the exception occurs) before I found maxLineLength in the top SSL.hs of HaskellNet-SSL. This value should perhaps be a parameter and also be renamed defaultMaxLineLength. The standard of 10000 is quite short, I had to increase it tenfold - and then it was still barely enough (I have a lot of emails) - but it works now.

503 error when using SMTP.doSMTPSTARTTLS

Hi,
I've successfully used this package to send emails using doSMTPSSL server. However, when I try to use doSMTPSTARTTLS server, it fails straight away (before authenticating) with the error cannot connect to server: 503 Bad sequence of commands. For info: I'm trying to connect to a 1&1 smtp server: auth.smtp.1and1.co.uk, and this definitely works with STARTTLS on port 587 because that's how I have my email client set up. I also tried a different server, smtp.hermes.cam.ac.uk, and that failed with a slightly different error message (but probably the same problem): cannot connect to server: 503 STARTTLS command used when not advertised. I read somewhere that you might need to send an extra EHLO command or something. Would be good if this could be fixed or you could suggest a workaround. Thanks.

smtp-example gives exception

Unsure if this is an issue with HaskellNet or HaskellNet-SSL, but when I download the most recent versions from Github and try smtpTest in example.hs I get, on both Mac and Windows:

*** Exception: <socket: 11>: hPutBuf: illegal operation (handle is closed)

If I try the same code on an Office365 account I get:

*** Exception: HandshakeFailed Error_EOF

Please let me know if you need any more information. I would be happy to help out.

Module ‘Network.Socket.Internal’ does not export ‘PortNumber’

Building a project with LTS-15.0/ghc-8.8.2, I hit the following error:

HaskellNet-SSL                   > [1 of 5] Compiling Network.HaskellNet.SSL
HaskellNet-SSL                   >                                         
HaskellNet-SSL                   > /private/var/folders/3k/ycnfbqgx33n7qdytkl9ryx7m0000gn/T/stack16499/HaskellNet-SSL-0.3.4.1/src/Network/HaskellNet/SSL.hs:6:33: error:
HaskellNet-SSL                   >     Module ‘Network.Socket.Internal’ does not export ‘PortNumber’
HaskellNet-SSL                   >   |                                     
HaskellNet-SSL                   > 6 | import Network.Socket.Internal (PortNumber)
HaskellNet-SSL                   >   |                                 ^^^^^^^^^^
HaskellNet-SSL                   >      

Solved by changing import of PortNumber in src/Network/HaskellNet/SSL.hs to:

import Network.Socket (PortNumber)

and by adding network-bsd to cabal file

network-bsd >= 2.8.1,

and by adding following extra-deps in stack.yml

extra-deps:
  - git: [email protected]:jtdaugherty/HaskellNet.git
    commit: 5aa1f3b009253b02c4822005ac59ee208a10a347

and finally, because I didn't want to dig into cabal file versioning, allow-newer in stack.yml

allow-newer: true

All this let's a build against LTS-15.0 complete.

thanks for the great work,
Stephen.

Example broken

On the latest version, gmail.hs fails with a type error, as well as a deprecation warning.

gmail login example not working

Hi,

the SMTP.authenticate action returns false when I'm logged in to Gmail over SMTP (TLS or SSL). I suspect this has something to do with HaskellNet, or maybe it's a combination of using SMTP with SSL.

If there is anything I can do to help solving this issue, please let me know!

IMAP's `fetch` results with extreme memory usage and computer freezing.

Reposting from qnikst/HaskellNet#39:

I have written the following function using the HaskellNet and HaskellNet-SSL libraries.
Using the "fetch" function results with memory usage blowing up and extreme swapping.
What am I doing wrong? Might it be a bug?

import qualified Data.ByteString.Char8       as SB8
import           Network.HaskellNet.IMAP
import           Network.HaskellNet.IMAP.SSL

main = retrieveCSV

retrieveCSV = do
    con <- connectIMAPSSL imapServer
    login con username password
    select con mailbox
    lastMsg <- last <$> search con [ALLs]
    -- this works:
    _ <- fetchHeader con lastMsg
    -- this works:
    _ <- fetchSize con lastMsg
    -- this blows up in memory usage:
    _ <- fetch con lastMsg
    undefined
    where
    imapServer = "imap.gmail.com"
    username   = "example" -- imagine this username is real
    password   = "example" -- imagine this password is real
    mailbox    = "example" -- imagine this mailbox is real

Not in lts-13.0

There are some warnings with lts-13.0 (which can be fixed), but otherwise this builds fine. Any reason it's not in lts-13.* and can we get it in? Excuse me if this is the wrong place/way to ask.

Could not install from hackage

Today i tried to install this package from hackage to a cabal sandbox, but cabal gave me the folloving error:

Resolving dependencies...
Configuring HaskellNet-SSL-0.2.3...
Building HaskellNet-SSL-0.2.3...
Preprocessing library HaskellNet-SSL-0.2.3...
[1 of 5] Compiling Network.HaskellNet.SSL ( src/Network/HaskellNet/SSL.hs, dist/dist-sandbox-762990c8/build/Network/HaskellNet/SSL.o )
[2 of 5] Compiling Network.HaskellNet.SSL.Internal ( src/Network/HaskellNet/SSL/Internal.hs, dist/dist-sandbox-762990c8/build/Network/HaskellNet/SSL/Internal.o )

src/Network/HaskellNet/SSL/Internal.hs:36:55:
    No instance for (Default TLSSettings)
      arising from a use of `def'
    Possible fix: add an instance declaration for (Default TLSSettings)
    In the first argument of `Just', namely `def'
    In the third argument of `ConnectionParams', namely `(Just def)'
    In the expression:
      ConnectionParams hostname port (Just def) Nothing
Failed to install HaskellNet-SSL-0.2.3
cabal: Error: some packages failed to install:
HaskellNet-SSL-0.2.3 failed during the building phase. The exception was:
ExitFailure 1

ghc version: Glasgow Haskell Compiler, Version 7.4.1
cabal version: cabal-install version 1.18.0.2

Edit:
I could install version 0.2.2 successfully, the updated dependencies cause the problem.

TLS fails to authorise if the server stopped supporting HELO command

Yandex smtp server dropped support of the HELO command in the protocol as a result authorisation fail with log:

HaskellNet-SSL RECV: "220 sas1-37da021029ee.qloud-c.yandex.net SMTP\r"
HaskellNet-SSL SEND: "HELO Alexanders-MacBook-Pro.local\r\n"
HaskellNet-SSL RECV: "502 5.5.1 Unrecognized command\r"
)

If we don't try to send HELO , and sent EHLO immediately everything works fine:

openssl s_client -connect smtp.yandex.ru:465
220 iva8-a4a480c9f089.qloud-c.yandex.net SMTP
EHLO alexander.vershilov.localhost
250-8BITMIME
250-PIPELINING
250-SIZE 42991616
250-STARTTLS
250-AUTH LOGIN PLAIN XOAUTH2
250-DSN
250 ENHANCEDSTATUSCODES

There are two options to fix this issue:

  1. drop support of the old servers that can't work with HELO
  2. do not fail if the server returns 502 on HELO command.

I think that the second option is better and will try to provide a MR soon.

stack build tools support

Please refresh your library dependencies to become compatible with stack tools. It guess it should compiles with latest versions of cabal packages

HaskellNET-SSL broken with all libraries that switched to crypton-connection

The connection library - and in fact the entire ecosystem based on cryptonite - is no longer supported and is now considered dangerous to use.

As an immediate fix, @kazu-yamamoto provided the fork crypton-connection that is a drop-in replacement. Essentially all libraries on Hackage that depended on connection have migrated to crypton-connection. Any project that uses any of those libraries together with HaskellNet-SSL cannot be built.

It is urgent to make the change from connection to crypton-connection in this library as well.

Add package to Stackage LTS 16

This library has been missing from stackage since LTS 13. There's a couple of things we'll need to do to add it back to stackage:

  • Get our dependency HaskellNet back on stackage
  • Merge #24 to allow newer versions of the network library

This should help resolve #22 and #25

Why not to re-export HaskellNet modules?

For example, instead of doing:

import Network.HaskellNet.IMAP
import Network.HaskellNet.IMAP.SSL
import Network.HaskellNet.Auth

just do

import Network.HaskellNet.IMAP.SSL

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.