How to determine when data is finished on an SSL socket

2014-01-11 Thread M. V.
Hi everybody, I'm writing an application that creates multiple non-blocking SSL connections to an https server, in each one I send a request and read the server's response. my problem is, whatever I do, I can't determine when the response data is finished. here's part of my code responsible

Re: How to determine when data is finished on an SSL socket

2014-01-11 Thread Matthew Donald
Sockets (SSL or otherwise) are layer-3 objects while content is a layer-7 object. To get an accurate end-of-content marker, you'll need to parse the output, buts since you are using the https protocol, that's going to be easy. Essentially, parse out the Content-Length header and read that many

Re: How to determine when data is finished on an SSL socket

2014-01-11 Thread chris . gray
Matthew Donald scripsit: Sockets (SSL or otherwise) are layer-3 objects while content is a layer-7 object. To get an accurate end-of-content marker, you'll need to parse the output, buts since you are using the https protocol, that's going to be easy. Essentially, parse out the

Re: How to determine when data is finished on an SSL socket

2014-01-11 Thread M. V.
Hi Matthew, but from what I know, not all HTTP responses have Content-Length field. responses with chunked payload are one of them. what can I do then? Thank you. On Saturday, January 11, 2014 1:23 PM, Matthew Donald matthew.b.don...@gmail.com wrote: Sockets (SSL or otherwise) are

Re: How to determine when data is finished on an SSL socket

2014-01-11 Thread Matthew Donald
When in doubt, use the source - or in this case RFC2616 ยง4.4.http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4 TL;DR version - the length is indicated by one of three situations: 1. A Content-Length header exists 2. Transfer-Encoding is chunked, in which case each chunk (there can be