Changeset 2353


Ignore:
Timestamp:
2001-05-03T11:44:54+12:00 (23 years ago)
Author:
sjboddie
Message:

Fixed a bug in the old fnord code that was causing problems if POST
data was longer than a certain buffer size. While playing with this
I also discovered that POST data fails when using the crippled billsock
version - not sure how to fix that yet.

Location:
trunk/gsdl/src/w32server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/w32server/httpreq.cpp

    r2286 r2353  
    4040#include "httpsend.h"
    4141#include "cgiwrapper.h"
     42#include "d_winsock.h"
    4243
    4344/*
     
    183184    //Get Headers
    184185    GetHeadersResult = GetHTTPHeaders(RequestInfo, RequestFields);
     186
    185187    //Figure out what version we're dealing with and deal with it
    186188    switch (GetHeadersResult) {
     
    275277    }
    276278  }
    277  
     279
    278280  //Only accept requests from HTTP/0.9 or HTTP/1.X clients, we'll
    279281  //assume that anything else will require an upgrade or patch
     
    385387    RequestFields.ContentLength = atol(RequestFields.ContentLengthStr);
    386388    if (RequestFields.ContentLength > 0) {
    387      
     389
    388390      //Allocate memory
    389391      RequestFields.Content = new BYTE[RequestFields.ContentLength];
     
    400402     
    401403      while (NumRecv < RequestFields.ContentLength) {
    402     NumRecv = GetData(RequestInfo.ClientSocket,
    403               RequestFields.Content + NumRecv,
    404               RequestFields.ContentLength - NumRecv,
    405               RequestInfo.ThreadNum);
     404    NumRecv += GetData(RequestInfo.ClientSocket,
     405               RequestFields.Content + NumRecv,
     406               RequestFields.ContentLength - NumRecv,
     407               RequestInfo.ThreadNum);
    406408    if (NumRecv < 0) return GH_ERROR;
    407409      }
     410
     411      // It seems to be important on NT that all available data was read
     412      // from the socket before the socket is closed (otherwise netscape
     413      // throws a "connection reset by peer" error). Since netscape seems
     414      // to send a few extra bytes in certain situations we'll make sure we
     415      // slurp it all up here.
     416      char *tmpbuffer = new char(100);
     417      d_recv(RequestInfo.ClientSocket, tmpbuffer, 100, 0);
     418      delete tmpbuffer;
     419
    408420    }
    409421    else {
  • trunk/gsdl/src/w32server/netio.cpp

    r2286 r2353  
    7979
    8080  //Clean up Winsock
    81   d_WSACleanup() == SOCKET_ERROR;
     81  d_WSACleanup();
    8282}
    8383
Note: See TracChangeset for help on using the changeset viewer.