Merge branch 'master' of github.com:cyassl/cyassl

This commit is contained in:
toddouska
2012-01-27 11:55:35 -08:00

View File

@ -135,6 +135,8 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
char command[1024]; char command[1024];
int echoSz = 0; int echoSz = 0;
int clientfd; int clientfd;
int firstRead = 1;
int gotFirstG = 0;
#ifndef CYASSL_DTLS #ifndef CYASSL_DTLS
SOCKADDR_IN_T client; SOCKADDR_IN_T client;
@ -165,6 +167,18 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
#endif #endif
while ( (echoSz = CyaSSL_read(ssl, command, sizeof(command))) > 0) { while ( (echoSz = CyaSSL_read(ssl, command, sizeof(command))) > 0) {
if (firstRead == 1) {
firstRead = 0; /* browser may send 1 byte 'G' to start */
if (echoSz == 1 && command[0] == 'G') {
gotFirstG = 1;
continue;
}
}
else if (gotFirstG == 1 && strncmp(command, "ET /", 4) == 0) {
strncpy(command, "GET", 4);
/* fall through to normal GET */
}
if ( strncmp(command, "quit", 4) == 0) { if ( strncmp(command, "quit", 4) == 0) {
printf("client sent quit command: shutting down!\n"); printf("client sent quit command: shutting down!\n");