Main Page | Class List | File List | Class Members | File Members | Related Pages

wshttpserver.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Bojan D.                                        *
00003  *   bojan_d@users.sourceforge.net                                         *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef WSHTTPSERVER_H
00021 #define WSHTTPSERVER_H
00022 
00032 #include <qserversocket.h>
00033 #include <qsocket.h>
00034 #include <qhttp.h>
00035 #include "configuration.h"
00036 
00051 class WSHttpServer : public QServerSocket
00052 {
00053         Q_OBJECT
00054 
00055 public:
00060     WSHttpServer(QObject* parent = 0);
00061         
00063     ~WSHttpServer();
00064         
00073         void newConnection( int socket );
00074         
00075 signals:
00077                 void newConnect();
00078                 
00080         void endConnect();
00081         
00083         void wroteToClient();
00084         
00088         void message(const QString& text, int type = Configuration::Normal);
00089         
00090                 
00091 private slots:
00092 
00099         void readClient();
00100         
00105         void discardClient();
00106         
00113         void closeClient();
00114         
00121         void onError(int errno);
00122 
00131         void sendHttpError(QSocket* s, int error_code, const QString& reason, const QString data);
00132         
00142         void sendHttpResponse(QSocket* s, int status_code, const QString& reason, QHttpHeader& headers, QString resp);
00143         
00153         void sendHttpResponse(QSocket* s, int status_code, const QString& reason, QHttpHeader& headers, QByteArray output);
00154         
00155 private:
00162         QString getFilePath(const QString& filename);   
00163 
00164 };
00165 
00166 #endif

Generated on Mon Sep 5 12:52:34 2005 for kwebsnap.kdevelop by  doxygen 1.3.9.1