| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 get requestBodySize() | 230 get requestBodySize() |
| 231 { | 231 { |
| 232 return !this._request.requestFormData ? 0 : this._request.requestFormDat
a.length; | 232 return !this._request.requestFormData ? 0 : this._request.requestFormDat
a.length; |
| 233 }, | 233 }, |
| 234 | 234 |
| 235 /** | 235 /** |
| 236 * @return {number} | 236 * @return {number} |
| 237 */ | 237 */ |
| 238 get responseBodySize() | 238 get responseBodySize() |
| 239 { | 239 { |
| 240 if (this._request.cached || this._request.statusCode === 304) | 240 if (this._request.cached() || this._request.statusCode === 304) |
| 241 return 0; | 241 return 0; |
| 242 if (!this._request.responseHeadersText) | 242 if (!this._request.responseHeadersText) |
| 243 return -1; | 243 return -1; |
| 244 return this._request.transferSize - this._request.responseHeadersText.le
ngth; | 244 return this._request.transferSize - this._request.responseHeadersText.le
ngth; |
| 245 }, | 245 }, |
| 246 | 246 |
| 247 /** | 247 /** |
| 248 * @return {number|undefined} | 248 * @return {number|undefined} |
| 249 */ | 249 */ |
| 250 get responseCompression() | 250 get responseCompression() |
| 251 { | 251 { |
| 252 if (this._request.cached || this._request.statusCode === 304 || this._re
quest.statusCode === 206) | 252 if (this._request.cached() || this._request.statusCode === 304 || this._
request.statusCode === 206) |
| 253 return; | 253 return; |
| 254 if (!this._request.responseHeadersText) | 254 if (!this._request.responseHeadersText) |
| 255 return; | 255 return; |
| 256 return this._request.resourceSize - this.responseBodySize; | 256 return this._request.resourceSize - this.responseBodySize; |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 /** | 260 /** |
| 261 * @param {number} time | 261 * @param {number} time |
| 262 * @return {number} | 262 * @return {number} |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 this._writeProgress.done(); | 430 this._writeProgress.done(); |
| 431 return; | 431 return; |
| 432 } | 432 } |
| 433 const chunkSize = 100000; | 433 const chunkSize = 100000; |
| 434 var text = this._text.substring(this._bytesWritten, this._bytesWritten +
chunkSize); | 434 var text = this._text.substring(this._bytesWritten, this._bytesWritten +
chunkSize); |
| 435 this._bytesWritten += text.length; | 435 this._bytesWritten += text.length; |
| 436 stream.write(text, this._writeNextChunk.bind(this)); | 436 stream.write(text, this._writeNextChunk.bind(this)); |
| 437 this._writeProgress.setWorked(this._bytesWritten); | 437 this._writeProgress.setWorked(this._bytesWritten); |
| 438 } | 438 } |
| 439 } | 439 } |
| OLD | NEW |