Dear all,
I had some difficulty to upload large files (>20MB) with SSL connection. I think it is also related to https://elog.psi.ch/elogs/Forum/68636
During debuging, I found that, when uploading large files, ssl connection is dropped since 'SSL_read' function returns -1.
But it doesn't alway mean broken connection. It may be "SSL_ERROR_WANT_READ".
I changed the "server_loop" function in the source code to "continue" when it is SSL_ERROR_WANT_READ. And it fixed the problem.
Here is my code.
## elogd.c "server_loop" function L30031
if (FD_ISSET(_sock, &readfds)) {
#ifdef HAVE_SSL
if (_ssl_flag){
i = SSL_read(_ssl_con, net_buffer + len, net_buffer_size - len);
if(i<=0){
int ssl_error=SSL_get_error(_ssl_con,i); ## check ssl error code
if(ssl_error==SSL_ERROR_WANT_READ||ssl_error==SSL_ERROR_WANT_WRITE) continue; ## if ssl wants more, continue
}
}
else
#endif
i = recv(_sock, net_buffer + len, net_buffer_size - len, 0);
I am ignorant about networking. Some experts on ssl connection would know a better way to deal with this problem.
Best,
HyonSan Seo
|