[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Use of CommSSL_Connect in HTTP application
Hi Eric,
> Anyone know of a way to use the CommSSL_Connect procedure by itself from
> within my application?
CommSSL_Connect is intended to be an internal routine used by HTTPAPI.
It's not intended to be called from your programs. Of course, since you
have the source code, you're welcome to use it as an example of how to
write your own SSL routines, if that's something you need to do.
> I am quite new at this socket stuff. I have created test applications
> to open a non secure socket to a remote server and Send a 'GET
> http://www ...' that is used to prepare data on the remote server. It
> all works great, due mostly to the LIBHTTP library that we installed
> from the scottklement site. The next step is to perform a similar
> function using SSL. This is where my troubles began.
HTTPAPI is intended to allow you to perform HTTP access from your
applications. But instead of using it, you're using the socket API to
write your own?
If you're going to write your own, then why are you using HTTPAPI? I'm
just really confused.
To perform a GET request with HTTPAPI, you do this:
rc = http_url_get( 'http://www.example.com/foo/bar'
: '/tmp/result.txt' );
This is all it takes to perform a GET request. You don't need to use the
socket API. You don't need to manually format the HTTP protocol commands,
keywords, etc -- nor parse them -- just call the existing routine in
HTTPAPI, as shown above.
There are many more routines in HTTPAPI, they're intended to make your
life easier so that you don't HAVE to write your own GET requests from the
ground up.
Check out the source members named EXAMPLE1 - EXAMPLE19. They demonstrate
many of the functions of HTTPAPI. Theres "reference documentation" in the
comments in the HTTPAPI_H member as well.
> I have reviewed the latest code examples from LIBHTTP and found no
> direct 'call' to CommSSL_Connect from the examples.
That's because you're not supposed to call CommSSL_Connect() manually...
it's an internal routine intended for use by HTTPAPI itself, not from your
programs.
If you want to do an SSL HTTP request instead of a plain-text one, all you
need to do is this:
rc = http_url_get( 'https://www.example.com/foo/bar'
: '/tmp/result.txt' );
The only difference between this and the previous example is that I
specified "https:" instead of "http:" in the URL. HTTPAPI will see that
change, and it'll use the SSL routines instead of the plaintext routines
to download the document.
Again, take a look at the EXAMPLE members, they demonstrate SSL as well as
regular HTTP calls.
> The compile gave the error - 'Name or indicator not defined' for
> CommSSL_Connect. I thought it should find CommSSL_Connect since
> COMMSSLR4 is one of the modules in the HTTPAPIR4 service program. Why
> does the compile not find it?
The 'Name or indicator not defined' is because it can't find the prototype
-- and has nothing to do with the binding of modules. But, if you fixed
that error (by including the prototype) your next problem would be a
binding error looking for the routine.
Why? because CommSSL_Connect() isn't exported from the service program.
Why isn't it exported? Because it's an internal routine, and you were
never supposed to call it directly.
If you don't like that behavior, you're welcome to use the code as a guide
of how to write your own routine that functions the way you want it to
function. But, HTTPAPI is not intended to be a general-purpose socket
programming toolkit. And it's not intended to be a general-purpose SSL
programming toolkit. It's purpose is purely for making HTTP calls, so
that's all you can do with HTTPAPI.
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------