Changeset 2286 for trunk/gsdl/src/w32server/httpsrv.cpp
- Timestamp:
- 2001-04-05T17:08:52+12:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/w32server/httpsrv.cpp
r1203 r2286 1 /* 2 Copyright (C) 1996 1 /********************************************************************** 2 * 3 * httpsrc.cpp 4 * Copyright (C) 1996 5 * 6 * A component of the fnord webserver written by [email protected]. 7 * 8 * Altered for use with the Greenstone digital library software by the 9 * New Zealand Digital Library Project at the University of Waikato, 10 * New Zealand. 11 * 12 * This program is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by 14 * the Free Software Foundation; either version 2 of the License, or 15 * (at your option) any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public License 23 * along with this program; if not, write to the Free Software 24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 * 26 *********************************************************************/ 3 27 4 This program is free software; you can redistribute it and/or modify5 it under the terms of the GNU General Public License as published by6 the Free Software Foundation; either version 2 of the License, or7 (at your option) any later version.8 9 This program is distributed in the hope that it will be useful,10 but WITHOUT ANY WARRANTY; without even the implied warranty of11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12 GNU General Public License for more details.13 14 You should have received a copy of the GNU General Public License15 along with this program; if not, write to the Free Software16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.17 18 The author can be contacted via Email at [email protected]19 */20 28 #include "text_t.h" 21 29 #include <windows.h> … … 47 55 // returns 0 on success, and a WSA error otherwise 48 56 int StartHTTPServer(HWND PassedMsgWindow) { 49 57 50 58 MsgWindow = PassedMsgWindow; 51 59 //Create the server socket … … 62 70 /******************************************************************************/ 63 71 void ProcessHTTPServerMsg(WPARAM Socket, LPARAM MsgInfo) { 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 72 log_message("accept message arrived\n"); 73 if (Socket != ServerSocket) { 74 if (gsdl_keep_log || gsdl_show_console) log_message("Incorrect socket sent in message"); 75 } 76 switch (WSAGETSELECTEVENT(MsgInfo)) { 77 case FD_ACCEPT: 78 switch (WSAGETSELECTERROR(MsgInfo)) { 79 case WSAENETDOWN: 80 LogCriticalError("1","Network Down"); 81 break; 82 default: //No Error 83 HTTPServerAnswer(); 84 } 85 break; 86 } 79 87 } 80 88 81 89 /******************************************************************************/ 82 90 void HTTPServerAnswer() { 83 84 85 86 91 SOCKADDR_IN ClientSockAddr; 92 SOCKET ClientSocket; 93 int AddrLen = sizeof(SOCKADDR_IN); 94 RequestThreadMessageT Parameters; 87 95 while (AnswerListeningSocket(ServerSocket, ClientSocket, ClientSockAddr, AddrLen) == 0) { 88 96 log_message("Answering socket\n"); 89 97 //Call the thread procedure to handle the connection 90 98 Parameters.ClientSockAddr = ClientSockAddr; 91 92 99 Parameters.ClientSocket = ClientSocket; 100 Parameters.AddrLen = AddrLen; 93 101 RequestThread(&Parameters); 94 102 } 95 103 } 96
Note:
See TracChangeset
for help on using the changeset viewer.