cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: curl-users Digest, Vol 19, Issue 30

From: Jose Esqueda <Jose.Esqueda_at_Copart.Com>
Date: Mon, 29 Aug 2005 08:58:24 -0700

I have created a tunnel to capture the response from the command line instead of using -o to send the output to a file. The following is the example of the code I used:

Const BUFSIZE As Long = 1024 * 10
Dim hPipeRead As Long
Dim hPipeWrite As Long
Dim sa As SECURITY_ATTRIBUTES
Dim si As STARTUPINFO
Dim pi As PROCESS_INFORMATION
Dim baOutput(BUFSIZE) As Byte
Dim sOutput As String
Dim lBytesRead As Long
    
    With sa
        .nLength = Len(sa)
        .bInheritHandle = 1 ' get inheritable pipe handles
    End With 'SA
    
    If CreatePipe(hPipeRead, hPipeWrite, sa, 0) = 0 Then
        Exit Sub
    End If

    With si
        .cb = Len(si)
        .dwFlags = STARTF_USESHOWWINDOW Or STARTF_USESTDHANDLES
        .wShowWindow = SW_HIDE ' hide the window
        .hStdOutput = hPipeWrite
        .hStdError = hPipeWrite
    End With 'SI
    
    If CreateProcess(vbNullString, sCommandLine, ByVal 0&, ByVal 0&, 1, 0&, ByVal 0&, sStartInFolder, si, pi) Then
        Call CloseHandle(hPipeWrite)
        Call CloseHandle(pi.hThread)
        hPipeWrite = 0
        Do
            DoEvents
            If ReadFile(hPipeRead, baOutput(0), BUFSIZE, lBytesRead, ByVal 0&) = 0 Then
                Exit Do
            End If
            sOutput = Left$(StrConv(baOutput(), vbUnicode), lBytesRead)
            gsResponse = gsResponse + sOutput
        Loop
        Call CloseHandle(pi.hProcess)
    End If
    ' To make sure...
    Call CloseHandle(hPipeRead)
    Call CloseHandle(hPipeWrite)

End Sub

The code transfers the results to a string, and then using instr I can tell if it failed or completed the HTTP transfer.

Thanks

Jose

-----------------------------------------------------------------------------------

':)Code Fixer V2.2.0 (25/02/2005 2:08:57 PM) 57 + 62 = 119 Lines Thanks Ulli for inspiration and lots of code.

-----Original Message-----
From: curl-users-bounces_at_cool.haxx.se
[mailto:curl-users-bounces_at_cool.haxx.se]On Behalf Of
curl-users-request_at_cool.haxx.se
Sent: Monday, August 29, 2005 3:01 AM
To: curl-users_at_cool.haxx.se
Subject: curl-users Digest, Vol 19, Issue 30

Send curl-users mailing list submissions to
        curl-users_at_cool.haxx.se

To subscribe or unsubscribe via the World Wide Web, visit
        http://cool.haxx.se/mailman/listinfo/curl-users
or, via email, send a message with subject or body 'help' to
        curl-users-request_at_cool.haxx.se

You can reach the person managing the list at
        curl-users-owner_at_cool.haxx.se

When replying, please edit your Subject line so it is more specific
than "Re: Contents of curl-users digest..."

Today's Topics:

   1. Receiving a HTTP response using Curl, within a VB Shell
      command (Jose Esqueda)
   2. Re: Receiving a HTTP response using Curl, within a VB Shell
      command (Daniel Stenberg)
   3. 7.14.0 is failing test 56 on my AIX 5.2 box (Scott Davis)
   4. Re: 7.14.0 is failing test 56 on my AIX 5.2 box (Daniel Stenberg)
   5. [PATCH] Support for GNU GSS (Simon Josefsson)
   6. Re: [PATCH] Support for GNU GSS (Daniel Stenberg)
   7. Re: [PATCH] Support for GNU GSS (Simon Josefsson)

----------------------------------------------------------------------

Message: 1
Date: Sun, 28 Aug 2005 10:25:41 -0700
From: "Jose Esqueda" <Jose.Esqueda_at_Copart.Com>
Subject: Receiving a HTTP response using Curl, within a VB Shell
        command
To: <curl-users_at_cool.haxx.se>
Message-ID:
        <FB423729EE4D4245897BFD96A50E39D008882F_at_FFCEML002.corp.copart.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi

I have just been introduced to Curl within the last couple of days. I have been amazed at its capabilities. But I have encountered an issue that I have not been able to resolve or find information for.

I am calling Curl within Visual Basic 6, using the shell commmand. I have succesful sending a file via HTTP to our server from a client, but unsuccessful receiving the Server response. Does anyone have an idea of how I would receive this response? Is their a argument that redirects the response to a text file?

Any help will be greatly appreciated, since I have a deadline. Got love this work!

Ruben

------------------------------

Message: 2
Date: Sun, 28 Aug 2005 20:08:52 +0200 (CEST)
From: Daniel Stenberg <daniel-curl_at_haxx.se>
Subject: Re: Receiving a HTTP response using Curl, within a VB Shell
        command
To: curl tool talk <curl-users_at_cool.haxx.se>
Message-ID: <Pine.LNX.4.63.0508282007560.12725_at_yvahk3.pbagnpgbe.fr>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Sun, 28 Aug 2005, Jose Esqueda wrote:

> I am calling Curl within Visual Basic 6, using the shell commmand. I have
> succesful sending a file via HTTP to our server from a client, but
> unsuccessful receiving the Server response. Does anyone have an idea of how
> I would receive this response? Is their a argument that redirects the
> response to a text file?

Are you perhaps looking for -o ?

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
------------------------------
Message: 3
Date: Sun, 28 Aug 2005 21:19:04 -0700 (PDT)
From: Scott Davis <scott_victor_davis_at_yahoo.com>
Subject: 7.14.0 is failing test 56 on my AIX 5.2 box
To: Curl Mailing List <curl-users_at_cool.haxx.se>
Message-ID: <20050829041904.43400.qmail_at_web51510.mail.yahoo.com>
Content-Type: text/plain; charset=iso-8859-1
Does anyone else on AIX 5.2 have this problem with 7.14.0?
Would like to know whether this is isolated to my system or not.
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
------------------------------
Message: 4
Date: Mon, 29 Aug 2005 08:18:11 +0200 (CEST)
From: Daniel Stenberg <daniel-curl_at_haxx.se>
Subject: Re: 7.14.0 is failing test 56 on my AIX 5.2 box
To: curl tool talk <curl-users_at_cool.haxx.se>
Message-ID: <Pine.LNX.4.63.0508290744390.27846_at_yvahk3.pbagnpgbe.fr>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
On Sun, 28 Aug 2005, Scott Davis wrote:
> Does anyone else on AIX 5.2 have this problem with 7.14.0? Would like to 
> know whether this is isolated to my system or not.
I haven't seen such a failure on my (rather limited) AIX 5.2 tests, and we 
don't see any on Tor Arntsen's daily AIX 5100-06 tests.
I just built and ran the latest CVS on AIX 5.2 (soon to be version 7.14.1), 
and it ran test case 56 fine. I have no reason to believe that the 7.14.0 
release would be any different.
TESTDONE: 248 tests out of 248 reported OK: 100%
TESTDONE: 295 tests were considered during 509 seconds.
(built without SSL support)
-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
------------------------------
Message: 5
Date: Fri, 26 Aug 2005 13:40:31 +0200
From: Simon Josefsson <jas_at_extundo.com>
Subject: [PATCH] Support for GNU GSS
To: curl-users_at_cool.haxx.se
Message-ID: <iluoe7lorio.fsf_at_latte.josefsson.org>
Content-Type: text/plain; charset=us-ascii
Hello.
The patch below make curl use GNU GSS [1] if it is installed.  In
fact, if GNU GSS is installed, it will be preferred over MIT/Heimdal,
but I reckon this is preferable; I doubt anyone that doesn't want GNU
GSS has it installed.  The same problem exists now with MIT vs
Heimdal; if both MIT and Heimdal are installed, you get Heimdal.
I have not tested this, since I don't have a HTTP+GSS server.
However, any problems are likely to be in my library, and not in curl,
so with this, people can test the combination.
[1] http://josefsson.org/gss/
Thanks,
Simon
Index: configure.ac
===================================================================
RCS file: /cvsroot/curl/curl/configure.ac,v
retrieving revision 1.158
diff -u -p -r1.158 configure.ac
--- configure.ac	21 Aug 2005 21:15:07 -0000	1.158
+++ configure.ac	26 Aug 2005 11:33:10 -0000
@@ -687,7 +687,7 @@ AC_ARG_WITH(gssapi-includes,
 AC_ARG_WITH(gssapi-libs,
   AC_HELP_STRING([--with-gssapi-libs=DIR],
   		 [Specify location of GSSAPI libs]),
-  [ GSSAPI_LIBS="-L$withval -lgssapi"
+  [ GSSAPI_LIBS="-L$withval"
     want_gss="yes" ]
 )
 
@@ -702,6 +702,8 @@ AC_ARG_WITH(gssapi,
 
 AC_MSG_CHECKING([if GSSAPI support is requested])
 if test x"$want_gss" = xyes; then
+  AC_MSG_RESULT(yes)
+
   if test -z "$GSSAPI_INCS"; then
      if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
         GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
@@ -709,9 +711,51 @@ if test x"$want_gss" = xyes; then
         GSSAPI_INCS="-I$GSSAPI_ROOT/include"
      fi
   fi
+  save_CPPFLAGS="$CPPFLAGS"
   CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
-  
-  if test -z "$GSSAPI_LIB_DIR"; then
+
+  AC_CHECK_HEADER(gss.h,
+    [
+      dnl found in the given dirs
+      AC_DEFINE(HAVE_GSSGNU, 1, [if you have the GNU gssapi libraries])
+      gnu_gss=yes
+    ],
+    [
+      dnl not found, check Heimdal
+      AC_CHECK_HEADER(gssapi.h,
+        [
+          dnl found in the given dirs
+          AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
+        ],
+        [
+          dnl not found, check in gssapi/ subdir 
+          AC_CHECK_HEADER(gssapi/gssapi.h,
+            [
+              dnl found 
+              AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
+            ],
+            [
+              dnl no header found, disabling GSS
+              want_gss=no
+              AC_MSG_WARN(disabling GSSAPI since no header files was found)
+            ]
+          )
+        ]
+      )        
+    ]
+  )
+else
+  AC_MSG_RESULT(no)
+fi
+if test x"$want_gss" = xyes; then
+  AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries])
+
+  curl_gss_msg="enabled (MIT/Heimdal)"
+
+  if test -n "$gnu_gss"; then
+    curl_gss_msg="enabled (GNU GSS)"
+    LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR -lgss"
+  elif test -z "$GSSAPI_LIB_DIR"; then
      if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
         gss_ldflags=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
 	LDFLAGS="$LDFLAGS $gss_ldflags"
@@ -721,31 +765,10 @@ if test x"$want_gss" = xyes; then
         LDFLAGS="$LDFLAGS -lgssapi"
      fi
   else
-     LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
+     LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR -lgssapi"
   fi
-
-  AC_MSG_RESULT(yes)
-  AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries])
-
-  curl_gss_msg="enabled"
-
-  AC_CHECK_HEADER(gssapi.h,
-    [
-       dnl found in the given dirs
-      AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
-    ],
-    [
-      dnl not found, check in gssapi/ subdir 
-      AC_CHECK_HEADER(gssapi/gssapi.h,
-        dnl found 
-        AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
-      )
-      
-    ]
-  )
-
 else
-  AC_MSG_RESULT(no)
+  CPPFLAGS="$save_CPPFLAGS"
 fi
   
 dnl **********************************************************************
Index: lib/urldata.h
===================================================================
RCS file: /cvsroot/curl/curl/lib/urldata.h,v
retrieving revision 1.269
diff -u -p -r1.269 urldata.h
--- lib/urldata.h	24 Aug 2005 10:57:29 -0000	1.269
+++ lib/urldata.h	26 Aug 2005 11:33:10 -0000
@@ -98,12 +98,14 @@
 #include "hash.h"
 
 #ifdef HAVE_GSSAPI
-#ifdef HAVE_GSSMIT
-#include <gssapi/gssapi.h>
-#include <gssapi/gssapi_generic.h>
-#else
-#include <gssapi.h>
-#endif
+# ifdef HAVE_GSSGNU
+#  include <gss.h>
+# elif defined HAVE_GSSMIT
+#  include <gssapi/gssapi.h>
+#  include <gssapi/gssapi_generic.h>
+# else
+#  include <gssapi.h>
+# endif
 #endif
 
 /* Download buffer size, keep it fairly big for speed reasons */
------------------------------
Message: 6
Date: Mon, 29 Aug 2005 10:42:11 +0200 (CEST)
From: Daniel Stenberg <daniel-curl_at_haxx.se>
Subject: Re: [PATCH] Support for GNU GSS
To: curl tool talk <curl-users_at_cool.haxx.se>
Message-ID: <Pine.LNX.4.63.0508291031110.7329_at_yvahk3.pbagnpgbe.fr>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
On Fri, 26 Aug 2005, Simon Josefsson wrote:
> The patch below make curl use GNU GSS [1] if it is installed.
Thanks!
> In fact, if GNU GSS is installed, it will be preferred over MIT/Heimdal, but 
> I reckon this is preferable; I doubt anyone that doesn't want GNU GSS has it 
> installed.  The same problem exists now with MIT vs Heimdal; if both MIT and 
> Heimdal are installed, you get Heimdal.
I think that's a fine assumption. The GSS situation is a bit incomplete (or 
should I say unsatisfactory) in (lib)curl anyway, so I don't think it'll cause 
harm to anyone.
> I have not tested this, since I don't have a HTTP+GSS server.
Neither do I. And there are no GSS tests or GSS-capable things in the test 
suite.
Applied and committed just now. Will be included in the upcoming 7.14.1 
release!
-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
------------------------------
Message: 7
Date: Mon, 29 Aug 2005 11:27:34 +0200
From: Simon Josefsson <jas_at_extundo.com>
Subject: Re: [PATCH] Support for GNU GSS
To: curl tool talk <curl-users_at_cool.haxx.se>
Message-ID: <iluzmr1ks8p.fsf_at_latte.josefsson.org>
Content-Type: text/plain; charset=us-ascii
Daniel Stenberg <daniel-curl_at_haxx.se> writes:
>> I have not tested this, since I don't have a HTTP+GSS server.
>
> Neither do I. And there are no GSS tests or GSS-capable things in the test 
> suite.
It is difficult to self test.  GSS authenticated FTP appear more
popular, and would even be a better test of GSS since GSS-FTP use
channel bindings.  There is a number of implementations around (e.g.,
in Heimdal).  Alas, I don't have time to work on it.
> Applied and committed just now. Will be included in the upcoming 7.14.1 
> release!
Great!
Regards,
Simon
------------------------------
_______________________________________________
curl-users mailing list
curl-users_at_cool.haxx.se
http://cool.haxx.se/mailman/listinfo/curl-users
End of curl-users Digest, Vol 19, Issue 30
******************************************
Received on 2005-08-29