[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Test Connect



Ron wrote:
>    We have noticed that the http_persist_open does not always check the
>    connection but returns a comm connection that is not null.

What do you mean by "check the connection"?

http_persist_open() should connect to the HTTP server.  If it's unable 
to connect, it should return *NULL.  The fact that it successfully 
connects should imply that all is well with the connection...  if not, 
I'm not sure what you can do (other than an actual HTTP operation like 
GET or POST) to check it further??


> This occurs if we are trying to connect to an SSL port without setting
> up to connect to an SSL port. Ie not using the https_init(` `) and
> using http://

HTTP does not provide any way to "auto-detect" whether you are using SSL 
or not.  You must specify https: if you want SSL, or HTTP if you do not. 
  If you specify http: and connect to a server that's expecting SSL, 
then the connection will succeed, but you won't be able to transfer 
successfully, because you'll be sending unencrypted data, and the server 
will be expecting encrypted data.

The server will likely disconnect you as soon as it notices this.

Since http_persist_open() does not exchange any data (it merely 
connects) you won't notice the failure until you do a get or a post. 
This seems to describe your symptoms.

However, I'm not sure what I can do about it?  Again, there's no way in 
the HTTP protocol to detect whether the server is expecting SSL or 
not... it entirely relies on what you told it...

Whether you do or do not call https_init() should not have any imact on 
this at all.  All that should impact it is whether you use http: or 
https: in your URI.


> This also occurs if we are using the User Authentication which we
> understand does not normally get done until after a post.

User Authentication is PART of a request.  i.e. it happens as part of a 
GET or POST request, it's not done ahead of time  (but also not after!)


> Is there a way to test the connection without doing an
> http_persist_post to make sure.

You understand that the connection is actually succeeding, and all is 
well.. the problem is that you aren't speaking the same protocol as the 
server.  You could create the same problem by connecting to a TELNET or 
FTP server.  HTTP and HTTPS (HTTP over SSL) are technically different 
protocols running on different ports.

I could add additional HTTP operations (besides just POST and GET). 
there may be one that's innocuous enough that you could use it to test 
the connection.  Trouble with that is that not all HTTP servers support 
all operations.  Pretty much all of them support GET and POST, but the 
others are more obscure.

How important is this feature to you?
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------