Ignore:
Timestamp:
2001-04-05T17:08:52+12:00 (23 years ago)
Author:
sjboddie
Message:

Had a bit of a tidy up in the fnord webserver code. The main change of note
was the removal of our reliance on the MAX_URL_SIZE constant. URLs and post
data of any length should now work.

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 *********************************************************************/
    327
    4 This program is free software; you can redistribute it and/or modify
    5 it under the terms of the GNU General Public License as published by
    6 the Free Software Foundation; either version 2 of the License, or
    7 (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 of
    11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12 GNU General Public License for more details.
    13 
    14 You should have received a copy of the GNU General Public License
    15 along with this program; if not, write to the Free Software
    16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    17 
    18 The author can be contacted via Email at [email protected]
    19 */
    2028#include "text_t.h"
    2129#include <windows.h>
     
    4755// returns 0 on success, and a WSA error otherwise
    4856int StartHTTPServer(HWND PassedMsgWindow) {
    49 
     57 
    5058  MsgWindow = PassedMsgWindow;
    5159  //Create the server socket
     
    6270/******************************************************************************/
    6371void ProcessHTTPServerMsg(WPARAM Socket, LPARAM MsgInfo) {
    64     log_message("accept message arrived\n");
    65     if (Socket != ServerSocket) {
    66         if (gsdl_keep_log || gsdl_show_console) log_message("Incorrect socket sent in message");
    67         }
    68     switch (WSAGETSELECTEVENT(MsgInfo)) {
    69         case FD_ACCEPT:
    70             switch (WSAGETSELECTERROR(MsgInfo)) {
    71                 case WSAENETDOWN:
    72                     LogCriticalError("1","Network Down");
    73                     break;
    74                 default: //No Error
    75                     HTTPServerAnswer();
    76                 }
    77             break;
    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  }
    7987}
    8088
    8189/******************************************************************************/
    8290void HTTPServerAnswer() {
    83     SOCKADDR_IN ClientSockAddr;
    84     SOCKET ClientSocket;
    85     int AddrLen = sizeof(SOCKADDR_IN);
    86     RequestThreadMessageT Parameters;
     91  SOCKADDR_IN ClientSockAddr;
     92  SOCKET ClientSocket;
     93  int AddrLen = sizeof(SOCKADDR_IN);
     94  RequestThreadMessageT Parameters;
    8795  while (AnswerListeningSocket(ServerSocket, ClientSocket, ClientSockAddr, AddrLen) == 0) {
    8896    log_message("Answering socket\n");
    89       //Call the thread procedure to handle the connection
     97    //Call the thread procedure to handle the connection
    9098    Parameters.ClientSockAddr = ClientSockAddr;
    91     Parameters.ClientSocket = ClientSocket;
    92     Parameters.AddrLen = AddrLen;
     99    Parameters.ClientSocket = ClientSocket;
     100    Parameters.AddrLen = AddrLen;
    93101    RequestThread(&Parameters);
    94102  }
    95103}
    96    
Note: See TracChangeset for help on using the changeset viewer.