/*---------------------------------------------------------------------------*/ static PT_THREAD( handle_input ( struct httpd_state *s ) ) { PSOCK_BEGIN( &s->sin ); ( void ) PT_YIELD_FLAG; PSOCK_READTO( &s->sin, ISO_space ); if( strncmp(s->inputbuf, http_get, 4) != 0 ) { PSOCK_CLOSE_EXIT( &s->sin ); } PSOCK_READTO( &s->sin, ISO_space ); if( s->inputbuf[0] != ISO_slash ) { PSOCK_CLOSE_EXIT( &s->sin ); } if( s->inputbuf[1] == ISO_space ) { strncpy( s->filename, http_index_html, sizeof(s->filename) ); } else { s->inputbuf[PSOCK_DATALEN( &s->sin ) - 1] = 0; /* Process any form input being sent to the server. */ #if UIP_CONF_PROCESS_HTTPD_FORMS == 1 { extern void vApplicationProcessFormInput( char *pcInputString ); vApplicationProcessFormInput( s->inputbuf ); } #endif strncpy( s->filename, &s->inputbuf[0], sizeof(s->filename) ); } /* httpd_log_file(uip_conn->ripaddr, s->filename);*/ s->state = STATE_OUTPUT; while( 1 ) { PSOCK_READTO( &s->sin, ISO_nl ); if( strncmp(s->inputbuf, http_referer, 8) == 0 ) { s->inputbuf[PSOCK_DATALEN( &s->sin ) - 2] = 0; /* httpd_log(&s->inputbuf[9]);*/ } } PSOCK_END( &s->sin ); }
/*---------------------------------------------------------------------------*/ static PT_THREAD(handle_input(struct httpd_state *s)) { PSOCK_BEGIN(&s->sin); PSOCK_READTO(&s->sin, ISO_space); if(strncmp(s->inputbuf, http_get, 4) != 0) { PSOCK_CLOSE_EXIT(&s->sin); } PSOCK_READTO(&s->sin, ISO_space); if(s->inputbuf[0] != ISO_slash) { PSOCK_CLOSE_EXIT(&s->sin); } if(s->inputbuf[1] == ISO_space) { strncpy(s->filename, http_index_html, sizeof(s->filename)); } else { s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; /* Process any form input being sent to the server. */ { // Form input called here extern void vApplicationProcessFormInput( char *pcInputString, long xInputLength ); vApplicationProcessFormInput( s->inputbuf, PSOCK_DATALEN(&s->sin) ); } strncpy(s->filename, &s->inputbuf[0], sizeof(s->filename)); } /* httpd_log_file(uip_conn->ripaddr, s->filename);*/ s->state = STATE_OUTPUT; while(1) { PSOCK_READTO(&s->sin, ISO_nl); if(strncmp(s->inputbuf, http_referer, 8) == 0) { s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0; /* httpd_log(&s->inputbuf[9]);*/ } } PSOCK_END(&s->sin); }