/*
* Copyright (C) 2004-2012 Free Software Foundation, Inc.
* Copyright (C) 2001,2002 Paul Sheer
* Portions Copyright (C) 2002,2003 Nikos Mavrogiannopoulos
*
* This file is part of GnuTLS.
*
* GnuTLS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GnuTLS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/* This server is heavily modified for GnuTLS by Nikos Mavrogiannopoulos
* (which means it is quite unreadable)
*/
#include
#include "common.h"
#include "serv-args.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
/* Gnulib portability files. */
#include "read-file.h"
#include "minmax.h"
#include "sockets.h"
#include "udp-serv.h"
/* konqueror cannot handle sending the page in multiple
* pieces.
*/
/* global stuff */
static int generate = 0;
static int http = 0;
static int x509ctype;
static int debug = 0;
unsigned int verbose = 1;
static int nodb;
static int noticket;
int require_cert;
int disable_client_cert;
const char *psk_passwd = NULL;
const char *srp_passwd = NULL;
const char *srp_passwd_conf = NULL;
const char *pgp_keyring = NULL;
const char *pgp_keyfile = NULL;
const char *pgp_certfile = NULL;
const char *x509_keyfile = NULL;
const char *x509_certfile = NULL;
const char *x509_dsakeyfile = NULL;
const char *x509_dsacertfile = NULL;
const char *x509_ecckeyfile = NULL;
const char *x509_ecccertfile = NULL;
const char *x509_cafile = NULL;
const char *dh_params_file = NULL;
const char *x509_crlfile = NULL;
const char *priorities = NULL;
const char *status_response_ocsp = NULL;
gnutls_datum_t session_ticket_key;
static void tcp_server(const char *name, int port);
/* end of globals */
/* This is a sample TCP echo server.
* This will behave as an http server if any argument in the
* command line is present
*/
#define SMALL_READ_TEST (2147483647)
#define GERR(ret) fprintf(stdout, "Error: %s\n", safe_strerror(ret))
#define HTTP_END "