[Haskell-cafe] Need urgent help with Network.tls

C K Kashyap ckkashyap at gmail.com
Sat Feb 23 19:58:06 CET 2013


The reason I want to use TLS is that I'd want to pack the whole thing in a
DLL and give it off to a friend for use.

What I am really looking for is a small sample code that demonstrates how
TLS package can be used to connect to a webserver or imapserver.

Regards,
Kashyap


On Sat, Feb 23, 2013 at 10:46 PM, satvik chauhan <mystic.satvik at gmail.com>wrote:

> You can use HaskellNet <http://hackage.haskell.org/package/HaskellNet> or
> imapget <http://hackage.haskell.org/package/imapget> directly or look
> into their source code for connecting to imap manually.
>
> -Satvik
>
> On Sat, Feb 23, 2013 at 8:58 PM, C K Kashyap <ckkashyap at gmail.com> wrote:
>
>> Hi,
>>
>> I am trying to use Haskell to download email/attachments from gmail. For
>> which I am exploring Network.TLS. I got this sample from the net that
>> connects to gmail smtp and works just fine -
>> http://hpaste.org/82890
>>
>> However, when I modify it a bit to try to connect to imap, it simply does
>> not work. To debug, I tried to connect to a webserver, even that seems to
>> not work. I modified the function as follows.
>>
>>
>> emailGmail2 = do
>>         let host = "localhost"
>>         let port = 443
>> let params = defaultParamsClient{pCiphers = ciphers}
>>  g <- RNG.makeSystem
>> h <- connectTo host (PortNumber (fromIntegral port))
>> hSetBuffering h LineBuffering
>>  cWrite h "GET / HTTP/1.0"
>> cWrite h ""
>> cWaitFor h "ABCD"
>>  con <- contextNewOnHandle h params g
>> handshake con
>> bye con
>>
>>
>> And I get a "BAD request" response from the server - Can some please give
>> me a sample code that uses Network.TLS to connect to a imap.google.com(or even a webserver for that matter)?
>>
>> Regards,
>> Kashyap
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130224/d46a1d7f/attachment.htm>


More information about the Haskell-Cafe mailing list