Exemple #1
0
/********************************************************
 READ METHODS
 ********************************************************/
void RestServer::read_request(char new_char) {
	// debug code
	if (debug_code) Serial.print(new_char);
	
	if (server_state == READ_VERB) get_verb(new_char);	

	else if (server_state == READ_RESOURCE) {
		if (request_type == GET_REQUESTS) read_get_requests(new_char);
		else if (request_type == POST_REQUESTS) read_post_requests(new_char);
		if (request.length == REQUEST_MAX_LENGTH-1) server_state = PARSE;
	}
}
Exemple #2
0
void stomp_receive(int sock, char *buf, int size) 
{
	stomp *stp = get_stomp(sock);
	scs_nappend(get_buffer(stp), buf, size);
	stomp_frame *f = stomp_frame_parse(get_buffer(stp)); 
	if (f == NULL) 
	{
		return; 
	}
    
	printf("Get %s frame from client %d\n", f == NULL ? NULL : get_verb(f), get_client_sock(stp));
	stomp_process(stp, f);

	stomp_frame_free(f); 
	scs_clear(get_buffer(stp));
}