cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: SSL with curl

From: amit paliwal <amit.ambitions_at_gmail.com>
Date: Wed, 12 Jan 2011 18:12:36 -0500

On Wed, Jan 12, 2011 at 5:54 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Wed, 12 Jan 2011, amit paliwal wrote:
>
> [The questions and thoughts in this mail show a definite need to read up on
> how libcurl works and probably how HTTP(S) work as well, so I've had to
> guess and assume things that I of course may have guessed wrong about.
> Please take this into account below.]

I have gone through how libcurl works but was just trying to exploe some
extra things and for that i was taking help, it is not like i have not read
libcurl and i am directly asking questions. But i apologise if it might have
given this feeling.

>
>
> What will happen when one set of request-response is done as per HTTP1.1
>> on a persisten connection and the Client receives plain raw data on the
>> socket (this raw data is not standard HTTP data).
>>
>
> libcurl speaks HTTP. If you ask it to talk HTTP with a server (by
> specifying a URL and some othe options) it will send a HTTP request and
> assume a HTTP response.
>
> I don't know what "raw data" means here, but I assume you mean that the
> server doesn't send any headers at all? If so, that's not syntactically
> correct HTTP and I think libcurl is entiteled to drop out or do whatever. I
> _believe_ however that it will pretend as if there were only non-interesting
> headers and it will deliver the "raw data" as response body contents and
> assume a closed connection when done.

Reply: yes you are right here, as HTTP1.1 follows persistent connection,
what will happen if some data comes without HTTP header in it. closed
connection should not happen unless we get "Connection:close" as part of
HTTP , right?

>
>
> Will it call the registered write handler?? or the write handler will be
>> called only when we say easy_perform().
>>
>
> Now you really confuse me. If you use the easy interface, OF COURSE it
> won't call any callbacks at all until you call curl_easy_perform() as it
> basically doesn't do anything until you call that.
>
> This is quite clearly documented and we have probably 30 examples showing
> it as well.

Reply: yes i have seen the examples, and i have seen some of the code also,
but i was now knowing how does curl handles non HTTP header data that comes
on socket, and that is why i asked this. It might throw some error
condition, and I am interested in knowing the error condition.

>
>
> 1) I have SSL enabled on my socket, and expect Open SSL read and write
>> function to be called for receiving and sending data on socket, irrespective
>> of application layer protocol is HTTP or something else.
>>
>
> (I don't understand this question.)
>
> libcurl will of course not use any OpenSSL (or any other SSL library) calls
> to read regular HTTP traffic. libcurl will send all received data to the
> write callback, no matter what.

Reply: I am sorry here, but I wanted to ask about HTTPS connection, in that
case it should use SSL calls right? I am sorry again for the wrong question.

>
>
> So if plain raw data comes, will it still come via SSL layer???
>>
>
> (I don't understand this question.)
>
> If you send "raw data" over HTTPS then yes that "raw data" will be sent to
> the write callback.
>
Reply: ok i put my question in better way:

although i know it is not HTTPS but if If i receive non HTTP header data,
and I want it to be TLS authenticated what shall I do ? I can think of some
possibilities like:

1) use curl_easy_recv() to receive the data, but here will it internally
authenticate it with TLS? or it will just copy it in my buffer and I need to
authenticate it.
2) use OS related recv() call and handle TLS ourself.

Regards,
Amit

>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

-- 
Regards,
Amit

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-13