From: Daniel M. <tub...@us...> - 2003-04-29 16:54:01
|
Update of /cvsroot/epp-rtk/epp-rtk/c++/src/transport In directory sc8-pr-cvs1:/tmp/cvs-serv6483/transport Modified Files: epp_TransportSSL.cc Log Message: fixed readFromServer in ssl transport to use 05 draft of EPP TCP (32-bit big-endian header for length of message) Index: epp_TransportSSL.cc =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/transport/epp_TransportSSL.cc,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** epp_TransportSSL.cc 28 Apr 2003 20:51:12 -0000 1.19 --- epp_TransportSSL.cc 29 Apr 2003 16:53:57 -0000 1.20 *************** *** 98,135 **** string s; try { ! char c; ! while(connected()) { ! if ((c = sslserver->getch()) == EOF) { ! throw epp_TrException(__FILE__, __LINE__, "Unable to read from server (getch)"); ! } ! s += c; ! if(c == '<') { // if "<" ! c = sslserver->getch(); ! s += c; ! if(c == '/') { // if "</" ! c = sslserver->getch(); ! s += c; ! if(c == 'e') { // if "</e" ! c = sslserver->getch(); ! s += c; ! if(c == 'p') { // if "</ep" ! c = sslserver->getch(); ! s += c; ! if(c == 'p') { // if "</epp" ! c = sslserver->getch(); ! s += c; ! if(c == '>') { // if "</epp>" ! break; ! } // if "</epp>" ! } // if "</epp" ! } // if "</ep" ! } // if "</e" ! } // if "</" ! } // if "<" ! ! } // while } catch(epp_TrException & e) { --- 98,128 ---- string s; + unsigned long int header_length = 0; + try { ! char header[4]; ! bzero(header, 4); ! const char *temp_ptr; ! temp_ptr = sslserver->getchars(4); ! if ( temp_ptr[0] == -1 ) { ! throw epp_TrException(__FILE__, __LINE__, "Unable to read header from server"); ! } ! memcpy(header, temp_ptr, 4); + header_length = ( ( header[0] & 0xff ) << 24 ) | + ( ( header[1] & 0xff ) << 16 ) | + ( ( header[2] & 0xff ) << 8 ) | + ( ( header[3] & 0xff ) ); + + header_length -= 4; // less the size of the header + + if ( header_length > 0 ) { + temp_ptr = sslserver->getchars(header_length); + if ( temp_ptr[0] == -1 ) { + throw epp_TrException(__FILE__, __LINE__, "Unable to read xml message from server (byte1)"); + } + s = temp_ptr; + } } catch(epp_TrException & e) { |