Re: BIO_read is continuously returning -1
When I tried to print the values returned by BIO_read it shows -1, 8, 12, 30, 24, 79, 407, 47, 10, 2, 61, 2, 3, 2, 80, 2, 2, -1, -1, -1. , -1 I tried to catch the error using perror which shows the error message Error 0 till the return value 2, after that Resource temporarily unavailable for all -1 returned values. If you want to see code then let me know. On 12/28/05, Pankaj [EMAIL PROTECTED] wrote: I am quite new for the OpenSSL programming. I am using Perl client program and C client program for connecting to the same server. Perl script works fine with the get_https request. But in C, I am getting -1 return value from the server while reading. C program implimentation is same as of sslcat method of SSLeay.pm module. I tried to differentiate between the reply header and found that there is only single difference between them as : Perl client script: CONNECTION: close C Script: HTTP/1.1 302 Found Proxy-Connection: Keep-Alive Connection: Keep-Alive i.e. 2 extra lines with difference in Connection header. Rest of the returned header content is same for both. I am not understanding that if server is getting connected for the Perl script (which uses Net::SSLeay::get_https() method), then what is the problem with the C code? While debugging I found that it getting connected, accepts request and replys back with the series of chunks (in BIO_read), but it seems that it is not ending (no 0 return). contineously it is giving -1. I am using openssl-0.9.7g version. If you require code then I will provide in next email. Any help in this regard will greatly appreciated. -- Best Regards, Pankaj Solanki [EMAIL PROTECTED] The Price of Greatness is responsibility over each of your thoughts -- Best Regards, Pankaj Solanki [EMAIL PROTECTED] Ph : 09810823740. The Price of Greatness is responsibility over each of your thoughts __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: BIO_read is continuously returning -1
Hi Pankaj., This difference in the HTTP response header is very critical. It influences the way in which the Client is going to behave. In case of 1, as the Connection: Close header is sent as part of the response, the http server will initiate the tcp teardown and need not bother sending the content length of the application payload. In case of 2, the client is expected to keep the HTTP connection alive, so that perhaps subsequent http requests can be pipelined, this is a feature of HTTP1.1. when a 302 is sent from the server, it means that either a REDIRECT req needs to be sent by the client as the http resource is not available in the requested path, so this redirect url will be as part of the Redirect header of the HTTP response, also as the connection keep alive has been set, the redirect request from the client will have to go on the same tcp connection over which the 302 was got, which is not supported by your ssl server? Thanks --Gayathri When I tried to print the values returned by BIO_read it shows -1, 8, 12, 30, 24, 79, 407, 47, 10, 2, 61, 2, 3, 2, 80, 2, 2, -1, -1, -1. , -1 I tried to catch the error using perror which shows the error message Error 0 till the return value 2, after that Resource temporarily unavailable for all -1 returned values. If you want to see code then let me know. On 12/28/05, Pankaj [EMAIL PROTECTED] wrote: I am quite new for the OpenSSL programming. I am using Perl client program and C client program for connecting to the same server. Perl script works fine with the get_https request. But in C, I am getting -1 return value from the server while reading. C program implimentation is same as of sslcat method of SSLeay.pm module. I tried to differentiate between the reply header and found that there is only single difference between them as : Perl client script: CONNECTION: close C Script: HTTP/1.1 302 Found Proxy-Connection: Keep-Alive Connection: Keep-Alive i.e. 2 extra lines with difference in Connection header. Rest of the returned header content is same for both. I am not understanding that if server is getting connected for the Perl script (which uses Net::SSLeay::get_https() method), then what is the problem with the C code? While debugging I found that it getting connected, accepts request and replys back with the series of chunks (in BIO_read), but it seems that it is not ending (no 0 return). contineously it is giving -1. I am using openssl-0.9.7g version. If you require code then I will provide in next email. Any help in this regard will greatly appreciated. -- Best Regards, Pankaj Solanki [EMAIL PROTECTED] The Price of Greatness is responsibility over each of your thoughts -- Best Regards, Pankaj Solanki [EMAIL PROTECTED] Ph : 09810823740. The Price of Greatness is responsibility over each of your thoughts __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED] __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: BIO_read is continuously returning -1
Forgot to mention that perhaps your client does not understand HTTP 1.1? Check whether the redirect request came back to the server. Hi Pankaj., This difference in the HTTP response header is very critical. It influences the way in which the Client is going to behave. In case of 1, as the Connection: Close header is sent as part of the response, the http server will initiate the tcp teardown and need not bother sending the content length of the application payload. In case of 2, the client is expected to keep the HTTP connection alive, so that perhaps subsequent http requests can be pipelined, this is a feature of HTTP1.1. when a 302 is sent from the server, it means that either a REDIRECT req needs to be sent by the client as the http resource is not available in the requested path, so this redirect url will be as part of the Redirect header of the HTTP response, also as the connection keep alive has been set, the redirect request from the client will have to go on the same tcp connection over which the 302 was got, which is not supported by your ssl server? Thanks --Gayathri When I tried to print the values returned by BIO_read it shows -1, 8, 12, 30, 24, 79, 407, 47, 10, 2, 61, 2, 3, 2, 80, 2, 2, -1, -1, -1. , -1 I tried to catch the error using perror which shows the error message Error 0 till the return value 2, after that Resource temporarily unavailable for all -1 returned values. If you want to see code then let me know. On 12/28/05, Pankaj [EMAIL PROTECTED] wrote: I am quite new for the OpenSSL programming. I am using Perl client program and C client program for connecting to the same server. Perl script works fine with the get_https request. But in C, I am getting -1 return value from the server while reading. C program implimentation is same as of sslcat method of SSLeay.pm module. I tried to differentiate between the reply header and found that there is only single difference between them as : Perl client script: CONNECTION: close C Script: HTTP/1.1 302 Found Proxy-Connection: Keep-Alive Connection: Keep-Alive i.e. 2 extra lines with difference in Connection header. Rest of the returned header content is same for both. I am not understanding that if server is getting connected for the Perl script (which uses Net::SSLeay::get_https() method), then what is the problem with the C code? While debugging I found that it getting connected, accepts request and replys back with the series of chunks (in BIO_read), but it seems that it is not ending (no 0 return). contineously it is giving -1. I am using openssl-0.9.7g version. If you require code then I will provide in next email. Any help in this regard will greatly appreciated. -- Best Regards, Pankaj Solanki [EMAIL PROTECTED] The Price of Greatness is responsibility over each of your thoughts -- Best Regards, Pankaj Solanki [EMAIL PROTECTED] Ph : 09810823740. The Price of Greatness is responsibility over each of your thoughts __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED] __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: BIO_read is continuously returning -1
Thanks Gayatri, I dont have access to the server, so I wont be able to verify that. I dont think that it is needed as both clients interacting with same server. For one client it is working and for second it is not, so I dont think that server has any problem. Also how can I make a client to get Connection: Close header as part of the response from server? I think there is some small mistake I am making, but not able to figure it out. Here is part of the code which creats connection object SSL_load_error_strings(); OpenSSL_add_ssl_algorithms(); ssl_ctx=SSL_CTX_new(SSLv23_client_method()); SSL_CTX_set_options(ssl_ctx,SSL_OP_ALL); /* tried to reset to all option again */ ssl=SSL_new(ssl_ctx); SSL_set_connect_state(ssl); ssl_bio=BIO_new(BIO_f_ssl()); BIO_set_ssl(ssl_bio,ssl,BIO_CLOSE); sprintf(host, %s:%i, host_name, port_num); out=BIO_new(BIO_s_connect()); BIO_set_conn_hostname(out,host); BIO_set_nbio(out,1); out=BIO_push(ssl_bio,out); You may be able to catch the problem. Thanks, Pankaj On 12/28/05, Gayathri Sundar [EMAIL PROTECTED] wrote: Forgot to mention that perhaps your client does not understand HTTP 1.1? Check whether the redirect request came back to the server. Hi Pankaj., This difference in the HTTP response header is very critical. It influences the way in which the Client is going to behave. In case of 1, as the Connection: Close header is sent as part of the response, the http server will initiate the tcp teardown and need not bother sending the content length of the application payload. In case of 2, the client is expected to keep the HTTP connection alive, so that perhaps subsequent http requests can be pipelined, this is a feature of HTTP1.1. when a 302 is sent from the server, it means that either a REDIRECT req needs to be sent by the client as the http resource is not available in the requested path, so this redirect url will be as part of the Redirect header of the HTTP response, also as the connection keep alive has been set, the redirect request from the client will have to go on the same tcp connection over which the 302 was got, which is not supported by your ssl server? Thanks --Gayathri When I tried to print the values returned by BIO_read it shows -1, 8, 12, 30, 24, 79, 407, 47, 10, 2, 61, 2, 3, 2, 80, 2, 2, -1, -1, -1. , -1 I tried to catch the error using perror which shows the error message Error 0 till the return value 2, after that Resource temporarily unavailable for all -1 returned values. If you want to see code then let me know. On 12/28/05, Pankaj [EMAIL PROTECTED] wrote: I am quite new for the OpenSSL programming. I am using Perl client program and C client program for connecting to the same server. Perl script works fine with the get_https request. But in C, I am getting -1 return value from the server while reading. C program implimentation is same as of sslcat method of SSLeay.pm module. I tried to differentiate between the reply header and found that there is only single difference between them as : Perl client script: CONNECTION: close C Script: HTTP/1.1 302 Found Proxy-Connection: Keep-Alive Connection: Keep-Alive i.e. 2 extra lines with difference in Connection header. Rest of the returned header content is same for both. I am not understanding that if server is getting connected for the Perl script (which uses Net::SSLeay::get_https() method), then what is the problem with the C code? While debugging I found that it getting connected, accepts request and replys back with the series of chunks (in BIO_read), but it seems that it is not ending (no 0 return). contineously it is giving -1. I am using openssl-0.9.7g version. If you require code then I will provide in next email. Any help in this regard will greatly appreciated. -- Best Regards, Pankaj Solanki [EMAIL PROTECTED] The Price of Greatness is responsibility over each of your thoughts -- Best Regards, Pankaj Solanki [EMAIL PROTECTED] Ph : 09810823740. The Price of Greatness is responsibility over each of your thoughts __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED] __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED] -- Best Regards, Pankaj Solanki [EMAIL PROTECTED] Ph : 09810823740. The Price of Greatness is responsibility over each of your thoughts
Re: BIO_read is continuously returning -1
On Wed, Dec 28, 2005, Pankaj wrote: I am quite new for the OpenSSL programming. I am using Perl client program and C client program for connecting to the same server. Perl script works fine with the get_https request. But in C, I am getting -1 return value from the server while reading. A -1 return value from BIO_read() is not necessarily an error. Check out the BIO_read() manual page for more details. Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
RE: BIO_read is continuously returning -1
I am quite new for the OpenSSL programming. I am using Perl client program and C client program for connecting to the same server. Perl script works fine with the get_https request. But in C, I am getting -1 return value from the server while reading. Why do you keep calling BIO_read? What are you waiting for? You should only be looping on BIO_read if there is nothing you want to do until the server does something. Why did you tell the server that you supported HTTP 1.1 if you don't? Do you support chunked encoding? What about connection keep-alive? DS __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]