- Timestamp:
- 06/19/10 12:11:47 (2 years ago)
- Files:
-
- trunk/fcgi/Conduit.d (modified) (3 diffs)
- trunk/fcgi/InternalConduit.d (modified) (3 diffs)
- trunk/fcgi/Protocol.d (modified) (4 diffs)
- trunk/fcgi/Request.d (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/fcgi/Conduit.d
r33 r35 42 42 } 43 43 44 uint read (void[] dst)44 size_t read (void[] dst) 45 45 { 46 46 if (!reader_ || endOfFile_) … … 94 94 } 95 95 96 uint write (void[] src)96 size_t write (void[] src) 97 97 { 98 98 if (reader_) … … 106 106 } 107 107 108 uint bufferSize ()108 size_t bufferSize () 109 109 { 110 110 return 1024; trunk/fcgi/InternalConduit.d
r33 r35 31 31 } 32 32 33 uint read (void[] dst)33 size_t read (void[] dst) 34 34 { 35 35 if (fileDescriptor_ < 0) … … 44 44 } 45 45 46 uint write (void[] dst)46 size_t write (void[] dst) 47 47 { 48 48 if (fileDescriptor_ < 0) … … 60 60 } 61 61 62 uint bufferSize ()62 size_t bufferSize () 63 63 { 64 64 return 1024; trunk/fcgi/Protocol.d
r34 r35 13 13 module fcgi.Protocol; 14 14 15 import tango.io.protocol.Reader;16 import tango.io.protocol.Writer;15 import mango.io.protocol.Reader; 16 import mango.io.protocol.Writer; 17 17 18 18 const byte FastCGIVersion = 1; … … 108 108 109 109 // version 110 input .get(version_);110 input (version_); 111 111 // recordType 112 112 input (cast(ubyte) recordType_); … … 148 148 void readPadding (IReader input) 149 149 { 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 } 151 156 } 152 157 … … 216 221 input (cast(byte) flags_); 217 222 218 input.buffer.skip(5); 223 //input.buffer.skip(5); 224 byte[] data = new byte[5]; 225 input (data); 219 226 } 220 227 trunk/fcgi/Request.d
r34 r35 22 22 private import tango.io.Console; 23 23 private import tango.math.Math; 24 private import tango.io.protocol.Reader; 24 private import mango.io.protocol.NativeProtocol; 25 private import mango.io.protocol.Reader; 25 26 private import tango.sys.Environment; 26 27 … … 41 42 private FastCGIInternalConduit conduit_; 42 43 private Reader reader_; 44 private NativeProtocol fcgi_protocol_; 43 45 44 46 private FastCGIConduit[FastCGIStreamType] stream_; … … 62 64 fileDescriptor_ = -1; 63 65 conduit_ = new FastCGIInternalConduit (); 64 reader_ = new Reader (conduit_); 66 fcgi_protocol_ = new NativeProtocol(conduit_, false); 67 reader_ = new Reader (fcgi_protocol_); 65 68 exitStatus = 0; 66 69 id_ = -1; … … 121 124 // read data from this record and push it onto the stream 122 125 char[] data = new char[header.contentLength]; 123 reader_. buffer.fill(data);126 reader_.get (data); 124 127 stream_[header.streamType].pushData (data); 125 128 } … … 161 164 exitStatus = 0; 162 165 id_ = -1; 163 reader_.buffer.flush ();166 //reader_.buffer.flush (); 164 167 role_ = FastCGIRole.UnknownRole; 165 168 arguments_ = arguments_.init; … … 235 238 // read directly 236 239 if (copy > 0) 237 reader_. buffer.fill (data[0 .. copy]);240 reader_.get (data); //[0 .. copy]); 238 241 } 239 242 … … 242 245 { 243 246 char[] temp = new char[header.contentLength - copy]; 244 reader_. buffer.fill(temp);247 reader_.get (temp); 245 248 stream_[header.streamType].pushData(temp); 246 249 } … … 350 353 // name 351 354 char[] name = new char[nameLength]; 352 reader_. buffer.fill(name);355 reader_.get (name); 353 356 // value 354 357 char[] value = new char[valueLength]; 355 reader_. buffer.fill(value);358 reader_.get (value); 356 359 // padding 357 360 header.readPadding (reader_); … … 380 383 while (toRead > 0) 381 384 { 382 int nameLen gth= readVariableLength (reader_);383 int valueLen gth= readVariableLength (reader_);385 int nameLen = readVariableLength (reader_); 386 int valueLen = readVariableLength (reader_); 384 387 385 388 // name 386 char[] name = new char[nameLen gth];387 reader_. buffer.fill(name);389 char[] name = new char[nameLen]; 390 reader_.get (name); 388 391 // value 389 char[] value = new char[valueLen gth];390 reader_. buffer.fill(value);392 char[] value = new char[valueLen]; 393 reader_.get (value); 391 394 // put it 392 395 arguments_[name] = value; 393 396 // decrease toRead 394 toRead -= (nameLen gth < 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); 395 398 } 396 399 // padding
