packages feed

curlhs 0.1.3 → 0.1.4

raw patch · 11 files changed

+90/−64 lines, 11 filesdep ~basedep ~hspecdep ~rtldPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, hspec, rtld

API changes (from Hackage documentation)

Files

LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2012-2014 Krzysztof Kardzis+Copyright (c) 2012-2015 Krzysztof Kardzis  Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above
Network/CURL000.hs view
@@ -1,14 +1,14 @@ ------------------------------------------------------------------------------- -- | -- Module      :  Network.CURL000--- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis+-- Copyright   :  Copyright (c) 2012-2015 Krzysztof Kardzis -- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)--- +-- -- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com> -- Stability   :  experimental -- Portability :  non-portable ----- <<http://ga-beacon.appspot.com/UA-53767359-1/hackage/curlhs/CURL000>>+-- <<https://ga-beacon.appspot.com/UA-53767359-1/curlhs/Network-CURL000>> -------------------------------------------------------------------------------  module Network.CURL000 (
Network/CURL000/LibC0.c view
@@ -1,7 +1,7 @@ /* ------------------------------------------------------------------------- */ /* |                                                                         */ /* Module      :  Network.CURL000.LibC0                                      */-/* Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis                    */+/* Copyright   :  Copyright (c) 2012-2015 Krzysztof Kardzis                  */ /* License     :  ISC License (MIT/BSD-style, see LICENSE file for details)  */ /*                                                                           */ /* Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>                     */@@ -66,7 +66,7 @@   , {CURL720, CURLXXX, "curl_multi_socket_all"}   , {CURL720, CURLXXX, "curl_multi_strerror"}   , {CURL720, CURLXXX, "curl_multi_timeout"}- // {CURL728, CURLXXX, "curl_multi_wait"}+/*, {CURL728, CURLXXX, "curl_multi_wait"} */   , {CURL730, CURLXXX, "curl_multi_wait"}   , {CURL720, CURLXXX, "curl_mvaprintf"}   , {CURL720, CURLXXX, "curl_mvfprintf"}@@ -86,9 +86,7 @@   , {CURL720, CURLXXX, "curl_version_info"}   }; -/* Force section .data instead of default .bss, because with .bss something  */-/* wrong happens during linking in ghci/runghc (at least on FreeBSD).        */-void* __attribute__((section(".data"))) curlADRTAB[TABLEN] = {};+void* curlADRTAB[TABLEN] = {NULL};   /* ------------------------------------------------------------------------- */@@ -98,17 +96,40 @@  int curlOptLong(setoptFP setopt, void *handle, int opt, long val) {   return setopt(handle, opt, val);-};+}  int curlOptCOff(setoptFP setopt, void *handle, int opt, curl_off_t val) {   return setopt(handle, opt, val);-};+}  int curlOptDPtr(setoptFP setopt, void *handle, int opt, void *val) {   return setopt(handle, opt, val);-};+}  int curlOptFPtr(setoptFP setopt, void *handle, int opt, void (*val)()) {   return setopt(handle, opt, val);-};+}+++/* ------------------------------------------------------------------------- */+#undef hsc_ENUM+#define hsc_ENUM(type, ...)                           \+  printf("data " #type "\n");                         \+  { char *x, xs[] = #__VA_ARGS__;                     \+    printf("  = %s\n", strtok(xs,","));               \+    while ((x=strtok(NULL,",")) != NULL) {            \+      printf("  |%s\n", x);                           \+    };                                                \+  };                                                  \+  printf("\n");                                       \+  printf("instance ENUM " #type " where\n");          \+  printf("  enumlist = [ " #__VA_ARGS__ " ]\n");      \+  printf("  toENUM x = case x of\n");                 \+  { char  *x, xs[] = #__VA_ARGS__;                    \+    unsigned long vs[] = {__VA_ARGS__}; int i=1;      \+    printf("    %s -> %lu\n", strtok(xs,","), vs[0]); \+    while ((x=strtok(NULL,",")) != NULL) {            \+      printf("   %s -> %lu\n", x, vs[i++]);           \+    };                                                \+  };                                                  \ 
Network/CURL000/LibCC.hsc view
@@ -1,9 +1,9 @@ ------------------------------------------------------------------------------- -- | -- Module      :  Network.CURL000.LibCC--- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis+-- Copyright   :  Copyright (c) 2012-2015 Krzysztof Kardzis -- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)--- +-- -- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com> -- Stability   :  experimental -- Portability :  non-portable@@ -101,11 +101,13 @@ import Foreign.C.Types import Foreign.Ptr -import Control.Applicative ((<$>), (<*>))-import Control.Monad       (when)+import Control.Applicative+import Control.Monad  import System.IO.Unsafe (unsafePerformIO) import System.RTLD++import Prelude  #include "LibC0.c" 
Network/CURL000/LibHS.hsc view
@@ -1,9 +1,9 @@ ------------------------------------------------------------------------------- -- | -- Module      :  Network.CURL000.LibHS--- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis+-- Copyright   :  Copyright (c) 2012-2015 Krzysztof Kardzis -- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)--- +-- -- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com> -- Stability   :  experimental -- Portability :  non-portable@@ -87,7 +87,7 @@ import Data.List              (partition) import Data.Unique            (newUnique) -import Control.Applicative ((<$>), (<*>))+import Control.Applicative import Control.Concurrent  (MVar, newMVar, takeMVar, tryPutMVar, modifyMVar) import Control.Concurrent  (withMVar, modifyMVar_) import Control.Exception   (throwIO, bracketOnError)@@ -100,6 +100,8 @@ import Foreign.C.String import Foreign.C.Types import Foreign.Ptr++import Prelude  #include "LibC0.c" 
Network/CURL000/LibLD.hs view
@@ -1,9 +1,9 @@ ------------------------------------------------------------------------------- -- | -- Module      :  Network.CURL000.LibLD--- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis+-- Copyright   :  Copyright (c) 2012-2015 Krzysztof Kardzis -- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)--- +-- -- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com> -- Stability   :  experimental -- Portability :  non-portable
Network/CURL000/Types.hsc view
@@ -1,9 +1,9 @@ ------------------------------------------------------------------------------- -- | -- Module      :  Network.CURL000.Types--- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis+-- Copyright   :  Copyright (c) 2012-2015 Krzysztof Kardzis -- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)--- +-- -- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com> -- Stability   :  experimental -- Portability :  non-portable@@ -39,7 +39,7 @@  ------------------------------------------------------------------------------- class ENUM a where-  toENUM :: a -> Int+  toENUM :: a -> CULong   enumlist :: [a]  instance ENUM a => ENUM [a] where
Network/CURL720.hs view
@@ -1,14 +1,14 @@ ------------------------------------------------------------------------------- -- | -- Module      :  Network.CURL720--- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis+-- Copyright   :  Copyright (c) 2012-2015 Krzysztof Kardzis -- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)--- +-- -- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com> -- Stability   :  experimental -- Portability :  non-portable ----- <<http://ga-beacon.appspot.com/UA-53767359-1/hackage/curlhs/CURL720>>+-- <<https://ga-beacon.appspot.com/UA-53767359-1/curlhs/Network-CURL720>> -------------------------------------------------------------------------------  module Network.CURL720@@ -23,13 +23,13 @@   --   -- Without that, any foreign call to @libcurl@ will fail.   ---  -- More info may be found in the <docs>.+  -- More info may be found in the <docs/#/README.md docs>. - + ------------------------------------------------------------------------------- -- * Global interface -------------------------------------------------------------------------------- +   -- ** Version info   , curl_version   , curl_version_info
Network/CURL730.hs view
@@ -1,14 +1,14 @@ ------------------------------------------------------------------------------- -- | -- Module      :  Network.CURL730--- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis+-- Copyright   :  Copyright (c) 2012-2015 Krzysztof Kardzis -- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)--- +-- -- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com> -- Stability   :  experimental -- Portability :  non-portable ----- <<http://ga-beacon.appspot.com/UA-53767359-1/hackage/curlhs/CURL730>>+-- <<https://ga-beacon.appspot.com/UA-53767359-1/curlhs/Network-CURL730>> -------------------------------------------------------------------------------  module Network.CURL730@@ -23,13 +23,13 @@   --   -- Without that, any foreign call to @libcurl@ will fail.   ---  -- More info may be found in the <docs>.+  -- More info may be found in the <docs/#/README.md docs>.   ------------------------------------------------------------------------------- -- * Global interface -------------------------------------------------------------------------------- +   -- ** Version info   , curl_version   , curl_version_info
curlhs.cabal view
@@ -1,12 +1,12 @@ name:          curlhs-version:       0.1.3+version:       0.1.4 synopsis:      bindings to libcurl, the multiprotocol file transfer library-homepage:      https://kkardzis.github.com/curlhs+homepage:      https://github.com/kkardzis/curlhs category:      Network  author:        Krzysztof Kardzis <kkardzis@gmail.com> maintainer:    Krzysztof Kardzis <kkardzis@gmail.com>-copyright:     Copyright © 2012-2014 Krzysztof Kardzis+copyright:     Copyright (c) 2012-2015 Krzysztof Kardzis -- license:    ISC License (MIT/BSD-style, see LICENSE file for details) license:       OtherLicense license-file:  LICENSE@@ -43,15 +43,14 @@   .   >   .-  More info about @curlhs@, such as tutorials or examples, may be found-  in the <docs> section (if on Hackage try <curlhs-0.1.3/docs/docs>-  or <curlhs-0.1.3/src/docs>).+  More information about @curlhs@, such as tutorials or examples,+  may be found in the <docs/#/README.md documentation> section.   .   Package is distributed under the   <http://choosealicense.com/licenses/isc/ ISC License>-  (MIT\/BSD-style, see <curlhs-0.1.3/src/LICENSE LICENSE> file for details).+  (MIT\/BSD-style, see <LICENSE> file for details).   .-  <<http://ga-beacon.appspot.com/UA-53767359-1/hackage/curlhs>>+  <<https://ga-beacon.appspot.com/UA-53767359-1/curlhs>>   -------------------------------------------------------------------------------@@ -64,6 +63,7 @@   docs/index.html   docs/*.md   README.md+  LICENSE  ------------------------------------------------------------------------------- library@@ -71,7 +71,7 @@   build-tools: hsc2hs    build-depends:-    base ==4.*, rtld, bytestring, time+    base==4.*, rtld==0.0.*, bytestring, time    exposed-modules:     Network.CURL000@@ -94,7 +94,7 @@ ------------------------------------------------------------------------------- test-suite hspec   type:           exitcode-stdio-1.0-  build-depends:  base, hspec, curlhs+  build-depends:  base==4.*, hspec==1.*, curlhs   ghc-options:    -Wall -fwarn-tabs   main-is:        Spec.hs   hs-source-dirs: test
docs/tutorial.md view
@@ -6,7 +6,7 @@  > *libcurl* is most probably the most portable, most powerful > and most often used C-based multi-platform file transfer library-> on this planet - be it open source or commercial. +> on this planet - be it open source or commercial.  The main *libcurl* web site is at <http://curl.haxx.se/libcurl/> and it contains a vast amount of documentation and resources.@@ -60,10 +60,10 @@ *** Exception: <curlhs> failed to call 'curl_version' (NULL) ``` -Obviously not what was expected. But what's wrong?-The short answer is that *libcurl* was not loaded before use.-*curlhs* depends on *libcurl*, but does not link with it at compile/build-time like usually. It is required to explicitly load *libcurl* at runtime.+Obviously that's not what was expected. But what's wrong? The short answer+is that *libcurl* was not loaded before use. *curlhs* depends on *libcurl*,+but does not link with *libcurl* at compile/build time like most libraries+would. Instead, it is necessary to explicitly load *libcurl* at runtime. So let's try:  ```hs@@ -72,7 +72,7 @@ ```  What now? Let's assume we are on Windows, where *libcurl* is not installed-by default. Dynamic loader searchs for "libcurl.dll", but it cannot find+by default. The dynamic loader searchs for "libcurl.dll", but it cannot find it in the default search path. It's time to install *libcurl*.  @@ -84,18 +84,19 @@ With *curlhs* it's now easy to use them together. All that *curlhs* needs to work is a "libcurl.dll" with its dependencies like SSL, SSH etc. -*libcurl* can be build from sources of course, but the recommended+*libcurl* can be build from source of course, but the recommended way is to search for the precompiled binaries for Windows. Good place to start may be at <http://www.confusedbycode.com/curl/>. -Be carefull however. *libcurl* uses many different libraries behind the scenes -to do its work, some of them may be optional, some none. It may be build+Be careful. *libcurl* uses many different libraries behind the scenes to do+its work, some (but not all) of which are optional. *libcurl* may be built with different implementations of SSL for example, or even without SSL-support at all. The same with other features, so pay attention to how+support at all. Similarly, other features may only be available if they+were selected at compile time for *libcurl*, so pay attention to how a package was build and that all dependencies are included. -Good choice, though not the latest now, are these packages from-<http://curl.haxx.se/download.html>:+A good choice for *libcurl*, although not the latest version, are these+packages from <http://curl.haxx.se/download.html>:  * <http://curl.haxx.se/gknw.net/7.34.0/dist-w32/curl-7.34.0-devel-mingw32.zip> * <http://curl.haxx.se/gknw.net/7.34.0/dist-w64/curl-7.34.0-devel-mingw64.7z>@@ -110,16 +111,16 @@ * ssleay32.dll * zlib1.dll -Where to put those dll's? Please refer to the `LoadLibrary` function+Where should we put those DLLs? Please refer to the `LoadLibrary` function documentation on MSDN for exhaustive information about the default search path used to locate the libraries in Windows. Three notable-places where Windows looks for the dll's are:+places where Windows looks for the DLLs are:  * the directory from which the application was loaded (where the exe is) * the directories listed in the PATH environment variable * the current directory -That's it. To test just `cd` into the directory where those dll's+That's it. To test just `cd` to the directory where those DLLs are placed and run GHCi from there.  @@ -128,8 +129,8 @@ In the unix world *libcurl* is a widely used library and is probably installed by default, or as a dependency for some tool, notably the popular tool *curl*. To check it, use the command `curl --version`.-In case *libcurl* is not installed, the easiest way to get it and its-dependencies, is with the system package manager like *apt-get*, *yum*+If *libcurl* has not been installed, the easiest way to install it and its+dependencies is with the system package manager like *apt-get*, *yum* or similar. For example:  ```sh@@ -144,7 +145,7 @@  ### BSD -Like on Linux systems: first check if *libcurl* is not installed already,+As with Linux systems: first check if *libcurl* is installed, for example with `curl --version`, and if it's not, use the system package manager to install it. For example: