コード例 #1
0
ファイル: webserver.c プロジェクト: cuongth/SSLTLS
static void process_http_request( int connection ) {
  char *request_line;
  request_line = read_line( connection );
  if ( strncmp(request_line, "GET", 3) ) {
    // Only supports "GET" requests
    build_error_response( connection, 501 );
  } else {
    // Skip over all header lines, don't care
    while ( strcmp(read_line(connection), "") );

    build_success_response( connection );

    if ( close(connection) == -1 ) {
      perror( "Unable to close connection" );
    }
  }
}
コード例 #2
0
ファイル: http_server.c プロジェクト: tramber30/ssl_train
int process_http_request (int connection)
{
	int res = 0;
	char *req_line;

	req_line = read_line(connection);
	if (strncmp(req_line, "GET", 3))
		build_error_response(connection, 501);
	else { //Skip over all header lines, don't care
		while(strcmp(read_line(connection), ""));

		build_success_response(connection);
	}

	res = shutdown(connection, 2);
	if (res)
		perror("Unable to close connection");

	return 0;
}