Changeset 35

Show
Ignore:
Timestamp:
06/19/10 12:11:47 (2 years ago)
Author:
xammy
Message:

Added patch from Ruben.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/fcgi/Conduit.d

    r33 r35  
    4242    } 
    4343     
    44     uint read (void[] dst) 
     44    size_t read (void[] dst) 
    4545    { 
    4646        if (!reader_ || endOfFile_) 
     
    9494    } 
    9595     
    96     uint write (void[] src) 
     96    size_t write (void[] src) 
    9797    { 
    9898        if (reader_) 
     
    106106    } 
    107107     
    108     uint bufferSize () 
     108    size_t bufferSize () 
    109109    { 
    110110        return 1024; 
  • trunk/fcgi/InternalConduit.d

    r33 r35  
    3131    } 
    3232     
    33     uint read (void[] dst) 
     33    size_t read (void[] dst) 
    3434    { 
    3535        if (fileDescriptor_ < 0) 
     
    4444    } 
    4545 
    46     uint write (void[] dst)  
     46    size_t write (void[] dst)  
    4747    { 
    4848        if (fileDescriptor_ < 0) 
     
    6060    } 
    6161     
    62     uint bufferSize () 
     62    size_t bufferSize () 
    6363    { 
    6464        return 1024; 
  • trunk/fcgi/Protocol.d

    r34 r35  
    1313module fcgi.Protocol; 
    1414 
    15 import tango.io.protocol.Reader; 
    16 import tango.io.protocol.Writer; 
     15import mango.io.protocol.Reader; 
     16import mango.io.protocol.Writer; 
    1717 
    1818const byte FastCGIVersion = 1; 
     
    108108 
    109109        // version 
    110         input.get (version_); 
     110        input (version_); 
    111111        // recordType 
    112112        input (cast(ubyte) recordType_); 
     
    148148    void readPadding (IReader input) 
    149149    { 
    150       input.buffer.skip(paddingLength_);  
     150      //input.buffer.skip(paddingLength_);  
     151      if (paddingLength_ > 0) 
     152      { 
     153         byte[] data = new byte[paddingLength_]; 
     154         input (data); 
     155      } 
    151156    } 
    152157 
     
    216221        input (cast(byte) flags_); 
    217222 
    218         input.buffer.skip(5); 
     223        //input.buffer.skip(5); 
     224        byte[] data = new byte[5]; 
     225        input (data); 
    219226    } 
    220227 
  • trunk/fcgi/Request.d

    r34 r35  
    2222private import  tango.io.Console; 
    2323private import  tango.math.Math; 
    24 private import  tango.io.protocol.Reader; 
     24private import  mango.io.protocol.NativeProtocol; 
     25private import  mango.io.protocol.Reader; 
    2526private import  tango.sys.Environment; 
    2627 
     
    4142    private FastCGIInternalConduit conduit_; 
    4243    private Reader reader_; 
     44    private NativeProtocol fcgi_protocol_; 
    4345 
    4446    private FastCGIConduit[FastCGIStreamType] stream_; 
     
    6264        fileDescriptor_ = -1; 
    6365        conduit_ = new FastCGIInternalConduit (); 
    64         reader_ = new Reader (conduit_); 
     66        fcgi_protocol_ = new NativeProtocol(conduit_, false); 
     67        reader_ = new Reader (fcgi_protocol_); 
    6568        exitStatus = 0; 
    6669        id_ = -1; 
     
    121124                // read data from this record and push it onto the stream 
    122125                char[] data = new char[header.contentLength]; 
    123                 reader_.buffer.fill (data); 
     126                reader_.get (data); 
    124127                stream_[header.streamType].pushData (data); 
    125128            } 
     
    161164            exitStatus = 0; 
    162165            id_ = -1; 
    163             reader_.buffer.flush (); 
     166            //reader_.buffer.flush (); 
    164167            role_ = FastCGIRole.UnknownRole; 
    165168            arguments_ = arguments_.init; 
     
    235238                // read directly 
    236239                if (copy > 0) 
    237                     reader_.buffer.fill (data[0 .. copy]); 
     240                    reader_.get (data); //[0 .. copy]); 
    238241            } 
    239242 
     
    242245            { 
    243246                char[] temp = new char[header.contentLength - copy]; 
    244                 reader_.buffer.fill (temp); 
     247                reader_.get (temp); 
    245248                stream_[header.streamType].pushData(temp); 
    246249            } 
     
    350353            // name 
    351354            char[] name = new char[nameLength]; 
    352             reader_.buffer.fill (name); 
     355            reader_.get (name); 
    353356            // value 
    354357            char[] value = new char[valueLength]; 
    355             reader_.buffer.fill (value); 
     358            reader_.get (value); 
    356359            // padding 
    357360            header.readPadding (reader_); 
     
    380383            while (toRead > 0) 
    381384            { 
    382                 int nameLength = readVariableLength (reader_); 
    383                 int valueLength = readVariableLength (reader_); 
     385                int nameLen = readVariableLength (reader_); 
     386                int valueLen = readVariableLength (reader_); 
    384387 
    385388                // name 
    386                 char[] name = new char[nameLength]; 
    387                 reader_.buffer.fill (name); 
     389                char[] name = new char[nameLen]; 
     390                reader_.get (name); 
    388391                // value 
    389                 char[] value = new char[valueLength]; 
    390                 reader_.buffer.fill (value); 
     392                char[] value = new char[valueLen]; 
     393                reader_.get (value); 
    391394                // put it 
    392395                arguments_[name] = value; 
    393396                // decrease toRead 
    394                 toRead -= (nameLength < 128 ? nameLength+1 : nameLength+4) + (valueLength < 128 ? valueLength+1 : valueLength+4); 
     397                toRead -= (nameLen < 128 ? nameLen+1 : nameLen+4) + (valueLen < 128 ? valueLen+1 : valueLen+4); 
    395398            } 
    396399            // padding