@@ -80,7 +80,6 @@ public abstract class RequestBuilderBase<T extends RequestBuilderBase<T>> {
80
80
protected List <Param > formParams ;
81
81
protected List <Part > bodyParts ;
82
82
protected String virtualHost ;
83
- protected long contentLength = -1 ;
84
83
protected ProxyServer proxyServer ;
85
84
protected Realm realm ;
86
85
protected File file ;
@@ -129,7 +128,6 @@ protected RequestBuilderBase(Request prototype, boolean disableUrlEncoding, bool
129
128
this .bodyParts = new ArrayList <>(prototype .getBodyParts ());
130
129
}
131
130
this .virtualHost = prototype .getVirtualHost ();
132
- this .contentLength = prototype .getContentLength ();
133
131
this .proxyServer = prototype .getProxyServer ();
134
132
this .realm = prototype .getRealm ();
135
133
this .file = prototype .getFile ();
@@ -204,11 +202,6 @@ public T setHeaders(Map<String, Collection<String>> headers) {
204
202
return asDerivedType ();
205
203
}
206
204
207
- public T setContentLength (int contentLength ) {
208
- this .contentLength = contentLength ;
209
- return asDerivedType ();
210
- }
211
-
212
205
private void lazyInitCookies () {
213
206
if (this .cookies == null )
214
207
this .cookies = new ArrayList <>(3 );
@@ -267,7 +260,6 @@ public void resetNonMultipartData() {
267
260
this .stringData = null ;
268
261
this .streamData = null ;
269
262
this .bodyGenerator = null ;
270
- this .contentLength = -1 ;
271
263
}
272
264
273
265
public void resetMultipartData () {
@@ -472,7 +464,6 @@ private RequestBuilderBase<?> executeSignatureCalculator() {
472
464
rb .streamData = this .streamData ;
473
465
rb .bodyGenerator = this .bodyGenerator ;
474
466
rb .virtualHost = this .virtualHost ;
475
- rb .contentLength = this .contentLength ;
476
467
rb .proxyServer = this .proxyServer ;
477
468
rb .realm = this .realm ;
478
469
rb .file = this .file ;
@@ -508,22 +499,6 @@ private Charset computeCharset() {
508
499
return this .charset ;
509
500
}
510
501
511
- private long computeRequestContentLength () {
512
- if (this .contentLength < 0 && this .streamData == null ) {
513
- // can't concatenate content-length
514
- final String contentLength = this .headers .get (HttpHeaders .Names .CONTENT_LENGTH );
515
-
516
- if (contentLength != null ) {
517
- try {
518
- return Long .parseLong (contentLength );
519
- } catch (NumberFormatException e ) {
520
- // NoOp -- we won't specify length so it will be chunked?
521
- }
522
- }
523
- }
524
- return this .contentLength ;
525
- }
526
-
527
502
private Uri computeUri () {
528
503
529
504
Uri tempUri = this .uri ;
@@ -541,7 +516,6 @@ public Request build() {
541
516
RequestBuilderBase <?> rb = executeSignatureCalculator ();
542
517
Uri finalUri = rb .computeUri ();
543
518
Charset finalCharset = rb .computeCharset ();
544
- long finalContentLength = rb .computeRequestContentLength ();
545
519
546
520
// make copies of mutable internal collections
547
521
List <Cookie > cookiesCopy = rb .cookies == null ? Collections .emptyList () : new ArrayList <>(rb .cookies );
@@ -563,7 +537,6 @@ public Request build() {
563
537
formParamsCopy ,//
564
538
bodyPartsCopy ,//
565
539
rb .virtualHost ,//
566
- finalContentLength ,//
567
540
rb .proxyServer ,//
568
541
rb .realm ,//
569
542
rb .file ,//
0 commit comments