-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathAuthorizationModule.java
More file actions
776 lines (640 loc) · 20 KB
/
AuthorizationModule.java
File metadata and controls
776 lines (640 loc) · 20 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
/*
* @(#)AuthorizationModule.java 0.3-3 06/05/2001
*
* This file is part of the HTTPClient package
* Copyright (C) 1996-2001 Ronald Tschal�r
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA
*
* For questions, suggestions, bug-reports, enhancement-requests etc.
* I may be contacted at:
*
* ronald@innovation.ch
*
* The HTTPClient's home page is located at:
*
* http://www.innovation.ch/java/HTTPClient/
*
*/
package HTTPClient;
import java.io.IOException;
import java.net.ProtocolException;
import java.util.Hashtable;
import java.util.Vector;
import com.genexus.common.interfaces.SpecificImplementation;
/**
* This module handles authentication requests. Authentication info is
* preemptively sent if any suitable candidate info is available. If a
* request returns with an appropriate status (401 or 407) then the
* necessary info is sought from the AuthenticationInfo class.
*
* @version 0.3-3 06/05/2001
* @author Ronald Tschal�r
*/
class AuthorizationModule implements HTTPClientModule
{
/** This holds the current Proxy-Authorization-Info for each
HTTPConnection */
private static Hashtable proxy_cntxt_list = new Hashtable();
/** a list of deferred authorization retries (used with
Response.retryRequest()) */
private static Hashtable<HttpOutputStream, AuthorizationModule> deferred_auth_list = new Hashtable<>();
/** counters for challenge and auth-info lists */
private int auth_lst_idx,
prxy_lst_idx,
auth_scm_idx,
prxy_scm_idx;
/** the last auth info sent, if any */
private AuthorizationInfo auth_sent;
private AuthorizationInfo prxy_sent;
/** is the info in auth_sent a preemtive guess or the result of a 4xx */
private boolean auth_from_4xx;
private boolean prxy_from_4xx;
/** guard against bugs on both our side and the server side */
private int num_tries;
/** keep track of removed close tokens (for NTLM) */
private boolean close_tok_remd = false;
/** used for deferred authoriation retries */
private Request saved_req;
private Response saved_resp;
// Constructors
/**
* Initialize counters for challenge and auth-info lists.
*/
AuthorizationModule()
{
auth_lst_idx = 0;
prxy_lst_idx = 0;
auth_scm_idx = 0;
prxy_scm_idx = 0;
auth_sent = null;
prxy_sent = null;
auth_from_4xx = false;
prxy_from_4xx = false;
num_tries = 0;
saved_req = null;
saved_resp = null;
}
// Methods
/**
* Invoked by the HTTPClient.
*/
public int requestHandler(Request req, Response[] resp)
throws IOException, AuthSchemeNotImplException
{
HTTPConnection con = req.getConnection();
AuthorizationHandler auth_handler = AuthorizationInfo.getAuthHandler();
AuthorizationInfo guess;
NVPair[] hdrs = req.getHeaders();
int rem_idx = -1;
// check for retries
HttpOutputStream out = req.getStream();
if (out != null && deferred_auth_list.get(out) != null)
{
copyFrom(deferred_auth_list.remove(out));
req.copyFrom(saved_req);
Log.write(Log.AUTH, "AuthM: Handling deferred auth challenge");
handle_auth_challenge(req, saved_resp);
if (auth_sent != null)
Log.write(Log.AUTH, "AuthM: Sending request with " +
"Authorization '" + auth_sent + "'");
else
Log.write(Log.AUTH, "AuthM: Sending request with " +
"Proxy-Authorization '" + prxy_sent +
"'");
return REQ_RESTART;
}
// Preemptively send proxy authorization info
Proxy: if (con.getProxyHost() != null && !prxy_from_4xx)
{
// first remove any Proxy-Auth header that still may be around
for (int idx=0; idx<hdrs.length; idx++)
{
if (hdrs[idx].getName().equalsIgnoreCase("Proxy-Authorization"))
{
rem_idx = idx;
break;
}
}
Hashtable proxy_auth_list = Util.getList(proxy_cntxt_list,
con.getContext());
guess = (AuthorizationInfo) proxy_auth_list.get(
con.getProxyHost()+":"+con.getProxyPort());
if (guess == null) break Proxy;
if (auth_handler != null)
{
try
{ guess = auth_handler.fixupAuthInfo(guess, req, null, null); }
catch (AuthSchemeNotImplException asnie)
{ break Proxy; }
if (guess == null) break Proxy;
}
if (rem_idx == -1) // add proxy-auth header
{
rem_idx = hdrs.length;
hdrs = Util.resizeArray(hdrs, rem_idx+1);
req.setHeaders(hdrs);
}
hdrs[rem_idx] = new NVPair("Proxy-Authorization", guess.toString());
rem_idx = -1;
prxy_sent = guess;
prxy_from_4xx = false;
Log.write(Log.AUTH, "AuthM: Preemptively sending " +
"Proxy-Authorization '" + guess + "'");
}
if (rem_idx >= 0)
{
System.arraycopy(hdrs, rem_idx+1, hdrs, rem_idx, hdrs.length-rem_idx-1);
hdrs = Util.resizeArray(hdrs, hdrs.length-1);
req.setHeaders(hdrs);
}
// Preemptively send authorization info
rem_idx = -1;
Auth: if (!auth_from_4xx)
{
// first remove any Auth header that still may be around
/*for (int idx=0; idx<hdrs.length; idx++)
{
if (hdrs[idx].getName().equalsIgnoreCase("Authorization"))
{
rem_idx = idx;
break;
}
}*/
// now try and guess whether we need to send auth info
guess = AuthorizationInfo.findBest(req);
if (guess == null) break Auth;
if (auth_handler != null)
{
try
{ guess = auth_handler.fixupAuthInfo(guess, req, null, null); }
catch (AuthSchemeNotImplException asnie)
{ break Auth; }
if (guess == null) break Auth;
}
if (rem_idx == -1) // add auth header
{
rem_idx = hdrs.length;
hdrs = Util.resizeArray(hdrs, rem_idx+1);
req.setHeaders(hdrs);
}
hdrs[rem_idx] = new NVPair("Authorization", guess.toString());
rem_idx = -1;
auth_sent = guess;
auth_from_4xx = false;
Log.write(Log.AUTH, "AuthM: Preemptively sending Authorization '"
+ guess + "'");
}
if (rem_idx >= 0)
{
System.arraycopy(hdrs, rem_idx+1, hdrs, rem_idx, hdrs.length-rem_idx-1);
hdrs = Util.resizeArray(hdrs, hdrs.length-1);
req.setHeaders(hdrs);
}
return REQ_CONTINUE;
}
/**
* Invoked by the HTTPClient.
*/
public void responsePhase1Handler(Response resp, RoRequest req)
throws IOException
{
/* If auth info successful update path list. Note: if we
* preemptively sent auth info we don't actually know if
* it was necessary. Therefore we don't update the path
* list in this case; this prevents it from being
* contaminated. If the info was necessary, then the next
* time we access this resource we will again guess the
* same info and send it.
*/
if (resp.getStatusCode() != 401 && resp.getStatusCode() != 407)
{
if (auth_sent != null && auth_from_4xx)
{
try
{
AuthorizationInfo.getAuthorization(auth_sent, req, resp,
false, false).addPath(req.getRequestURI());
}
catch (AuthSchemeNotImplException asnie)
{ /* shouldn't happen */ }
}
// reset guard if not an auth challenge
num_tries = 0;
}
auth_from_4xx = false;
prxy_from_4xx = false;
if (resp.getHeader("WWW-Authenticate") == null)
{
auth_lst_idx = 0;
auth_scm_idx = 0;
}
if (resp.getHeader("Proxy-Authenticate") == null)
{
prxy_lst_idx = 0;
prxy_scm_idx = 0;
}
}
/**
* Invoked by the HTTPClient.
*/
public int responsePhase2Handler(Response resp, Request req)
throws IOException, AuthSchemeNotImplException
{
// Let the AuthHandler handle any Authentication headers.
AuthorizationHandler h = AuthorizationInfo.getAuthHandler();
if (h != null)
h.handleAuthHeaders(resp, req, auth_sent, prxy_sent);
// hack for NTLM
if (close_tok_remd)
{
add_close_token(req);
close_tok_remd = false;
}
// handle 401 and 407 response codes
int sts = resp.getStatusCode();
switch(sts)
{
case 401: // Unauthorized
case 407: // Proxy Authentication Required
// guard against infinite retries due to bugs
num_tries++;
if (num_tries > 10)
throw new ProtocolException("Bug in authorization handling: server refused the given info 10 times");
// defer handling if a stream was used
if (req.getStream() != null)
{
if (!HTTPConnection.deferStreamed)
{
Log.write(Log.AUTH, "AuthM: status " + sts +
" not handled - request has " +
"an output stream");
return RSP_CONTINUE;
}
saved_req = (Request) req.clone();
saved_resp = (Response) resp.clone();
deferred_auth_list.put(req.getStream(), this);
req.getStream().reset();
resp.setRetryRequest(true);
Log.write(Log.AUTH, "AuthM: Handling of status " +
sts + " deferred because an " +
"output stream was used");
return RSP_CONTINUE;
}
// handle the challenge
Log.write(Log.AUTH, "AuthM: Handling status: " + sts + " " +
resp.getReasonLine());
handle_auth_challenge(req, resp);
// check for valid challenge
if (auth_sent != null || prxy_sent != null)
{
try { resp.getInputStream().close(); }
catch (IOException ioe) { }
if (auth_sent != null)
Log.write(Log.AUTH, "AuthM: Resending request " +
"with Authorization '" +
auth_sent + "'");
else
Log.write(Log.AUTH, "AuthM: Resending request " +
"with Proxy-Authorization '" +
prxy_sent + "'");
return RSP_REQUEST;
}
if (req.getStream() != null)
Log.write(Log.AUTH, "AuthM: status " + sts + " not " +
"handled - request has an output " +
"stream");
else
Log.write(Log.AUTH, "AuthM: No Auth Info found - " +
"status " + sts + " not handled");
return RSP_CONTINUE;
default:
return RSP_CONTINUE;
}
}
/**
* Invoked by the HTTPClient.
*/
public void responsePhase3Handler(Response resp, RoRequest req)
{
}
/**
* Invoked by the HTTPClient.
*/
public void trailerHandler(Response resp, RoRequest req) throws IOException
{
// Let the AuthHandler handle any Authentication headers.
AuthorizationHandler h = AuthorizationInfo.getAuthHandler();
if (h != null)
h.handleAuthTrailers(resp, req, auth_sent, prxy_sent);
}
/**
*
*/
@SuppressWarnings("unchecked")
private void handle_auth_challenge(Request req, Response resp)
throws AuthSchemeNotImplException, IOException
{
// handle WWW-Authenticate
int[] idx_arr = { auth_lst_idx, // hack to pass by ref
auth_scm_idx};
auth_sent = setAuthHeaders(resp.getHeader("WWW-Authenticate"),
req, resp, "Authorization", false, idx_arr,
auth_sent);
if (auth_sent != null)
{
auth_from_4xx = true;
auth_lst_idx = idx_arr[0];
auth_scm_idx = idx_arr[1];
}
else
{
auth_lst_idx = 0;
auth_scm_idx = 0;
}
// handle Proxy-Authenticate
idx_arr[0] = prxy_lst_idx; // hack to pass by ref
idx_arr[1] = prxy_scm_idx;
prxy_sent = setAuthHeaders(resp.getHeader("Proxy-Authenticate"),
req, resp, "Proxy-Authorization", true,
idx_arr, prxy_sent);
if (prxy_sent != null)
{
prxy_from_4xx = true;
prxy_lst_idx = idx_arr[0];
prxy_scm_idx = idx_arr[1];
}
else
{
prxy_lst_idx = 0;
prxy_scm_idx = 0;
}
if (prxy_sent != null)
{
HTTPConnection con = req.getConnection();
Util.getList(proxy_cntxt_list, con.getContext())
.put(con.getProxyHost()+":"+con.getProxyPort(),
prxy_sent);
}
// check for headers
if (auth_sent == null && prxy_sent == null &&
resp.getHeader("WWW-Authenticate") == null &&
resp.getHeader("Proxy-Authenticate") == null)
{
if (resp.getStatusCode() != 401)
throw new ProtocolException("Missing Proxy-Authenticate header");
if (SpecificImplementation.SendErrorOn401)
{
if (resp.getStatusCode() == 401)
throw new ProtocolException("Missing WWW-Authenticate header");
}
}
}
/**
* Handles authentication requests and sets the authorization headers.
* It tries to retrieve the neccessary parameters from AuthorizationInfo,
* and failing that calls the AuthHandler. Handles multiple authentication
* headers.
*
* @param auth_str the authentication header field returned by the server.
* @param req the Request used
* @param resp the full Response received
* @param header the header name to use in the new headers array.
* @param idx_arr an array of indicies holding the state of where we
* are when handling multiple authorization headers.
* @param prev the previous auth info sent, or null if none
* @return the new credentials, or null if none found
* @exception ProtocolException if <var>auth_str</var> is null.
* @exception AuthSchemeNotImplException if thrown by the AuthHandler.
* @exception IOException if thrown by the AuthHandler.
*/
private AuthorizationInfo setAuthHeaders(String auth_str, Request req,
RoResponse resp, String header,
boolean proxy_auth, int[] idx_arr,
AuthorizationInfo prev)
throws ProtocolException, AuthSchemeNotImplException, IOException
{
try
{
if(Log.isEnabled(Log.EXTENDED_INFO))
{
Log.write(Log.EXTENDED_INFO, "ExtInfo: AuthStr: " + auth_str);
Log.write(Log.EXTENDED_INFO, "ExtInfo: Header: " + header);
Log.write(Log.EXTENDED_INFO, "ExtInfo: ProxyAuth: " + proxy_auth);
}
if (auth_str == null) return null;
// get the list of challenges the server sent
AuthorizationInfo[] challenges =
AuthorizationInfo.parseAuthString(auth_str, req, resp);
if (Log.isEnabled(Log.AUTH))
{
Log.write(Log.AUTH, "AuthM: parsed " + challenges.length +
" challenges:");
for (int idx=0; idx<challenges.length; idx++)
Log.write(Log.AUTH, "AuthM: Challenge " + challenges[idx]);
}
if (challenges.length == 0)
return null;
/* some servers expect a 401 to invalidate sent credentials.
* However, only do this for Basic scheme (because e.g. digest
* "stale" handling will fail otherwise)
*/
if (prev != null && prev.getScheme().equalsIgnoreCase("Basic"))
{
for (int idx=0; idx<challenges.length; idx++)
if (prev.getRealm().equals(challenges[idx].getRealm()) &&
prev.getScheme().equalsIgnoreCase(challenges[idx].getScheme()))
AuthorizationInfo.removeAuthorization(prev,
req.getConnection().getContext());
}
AuthorizationInfo credentials = null;
AuthorizationHandler auth_handler = AuthorizationInfo.getAuthHandler();
// try next auth challenge in list
while (credentials == null && idx_arr[0] != -1 &&
idx_arr[0] < challenges.length)
{
credentials = AuthorizationInfo.getAuthorization(
challenges[idx_arr[0]], req, resp,
false, proxy_auth);
if (auth_handler != null && credentials != null)
credentials = auth_handler.fixupAuthInfo(credentials, req,
challenges[idx_arr[0]], resp);
if (++idx_arr[0] == challenges.length)
idx_arr[0] = -1;
}
// if we don't have any credentials then prompt the user
if (credentials == null)
{
for (int idx=0; idx<challenges.length; idx++)
{
if (idx_arr[1] >= challenges.length)
idx_arr[1] = 0;
try
{
credentials = AuthorizationInfo.queryAuthHandler(
challenges[idx_arr[1]], req, resp, proxy_auth);
break;
}
catch (AuthSchemeNotImplException asnie)
{
if (idx == challenges.length-1)
throw asnie;
}
finally
{ idx_arr[1]++; }
}
}
if(Log.isEnabled(Log.EXTENDED_INFO))
{
if(credentials == null)
{
Log.write(Log.EXTENDED_INFO, "ExtInfo: No credentials");
}
else
{
Log.write(Log.EXTENDED_INFO, "ExtInfo: Credentials: Scheme=" + credentials.getScheme() + " - Realm=" + credentials.getRealm() + " Host:" + credentials.getHost() + " - Port: " + credentials.getPort());
}
}
// if we still don't have any credentials then give up
if (credentials == null)
return null;
// find auth info
int auth_idx;
NVPair[] hdrs = req.getHeaders();
for (auth_idx=0; auth_idx<hdrs.length; auth_idx++)
{
if (hdrs[auth_idx].getName().equalsIgnoreCase(header))
break;
}
// add credentials to headers
if (auth_idx == hdrs.length)
{
hdrs = Util.resizeArray(hdrs, auth_idx+1);
req.setHeaders(hdrs);
}
hdrs[auth_idx] = new NVPair(header, credentials.toString());
// hack for NTLM
if (credentials.getScheme().equalsIgnoreCase("NTLM") &&
credentials.getCookie().startsWith("TlRMTVNTUAAB"))
{
if (remove_close_token(req))
close_tok_remd = true;
}
// done
return credentials;
}catch(ProtocolException e)
{
if(Log.isEnabled(Log.EXTENDED_INFO))
{
Log.write(Log.EXTENDED_INFO, "ExtInfo: Rethrowing exception ", e);
}
throw e;
}catch(AuthSchemeNotImplException e)
{
if(Log.isEnabled(Log.EXTENDED_INFO))
{
Log.write(Log.EXTENDED_INFO, "ExtInfo: Rethrowing exception ", e);
}
throw e;
}catch(IOException e)
{
if(Log.isEnabled(Log.EXTENDED_INFO))
{
Log.write(Log.EXTENDED_INFO, "ExtInfo: Rethrowing exception ", e);
}
throw e;
}catch(Throwable e)
{
if(Log.isEnabled(Log.EXTENDED_INFO))
{
Log.write(Log.EXTENDED_INFO, "ExtInfo: Rethrowing unhandled exception ", e);
}
throw new IOException(e.toString());
}
}
private void copyFrom(AuthorizationModule other)
{
this.auth_lst_idx = other.auth_lst_idx;
this.prxy_lst_idx = other.prxy_lst_idx;
this.auth_scm_idx = other.auth_scm_idx;
this.prxy_scm_idx = other.prxy_scm_idx;
this.auth_sent = other.auth_sent;
this.prxy_sent = other.prxy_sent;
this.auth_from_4xx = other.auth_from_4xx;
this.prxy_from_4xx = other.prxy_from_4xx;
this.num_tries = other.num_tries;
this.saved_req = other.saved_req;
this.saved_resp = other.saved_resp;
}
private boolean remove_close_token(Request req) throws ProtocolException
{
NVPair[] hdrs = req.getHeaders();
int idx;
for (idx=0; idx<hdrs.length; idx++)
{
if (hdrs[idx].getName().equalsIgnoreCase("Connection"))
break;
}
if (idx >= hdrs.length) return false;
Vector<HttpHeaderElement> pcon;
try
{ pcon = Util.parseHeader(hdrs[idx].getValue()); }
catch (ParseException pe)
{ throw new ProtocolException(pe.toString()); }
HttpHeaderElement cls = new HttpHeaderElement("close");
if (!pcon.removeElement(cls)) return false;
while (pcon.removeElement(cls))
;
if (pcon.size() > 0)
{
hdrs[idx] = new NVPair("Connection", Util.assembleHeader(pcon));
}
else
{
NVPair[] nhdrs = new NVPair[hdrs.length-1];
System.arraycopy(hdrs, 0, nhdrs, 0, idx);
System.arraycopy(hdrs, idx+1, nhdrs, idx, nhdrs.length-idx);
req.setHeaders(nhdrs);
}
return true;
}
private void add_close_token(Request req) throws ProtocolException
{
NVPair[] hdrs = req.getHeaders();
int idx;
for (idx=0; idx<hdrs.length; idx++)
{
if (hdrs[idx].getName().equalsIgnoreCase("Connection"))
break;
}
if (idx >= hdrs.length)
{
hdrs = Util.resizeArray(hdrs, hdrs.length+1);
hdrs[idx] = new NVPair("Connection", "close");
req.setHeaders(hdrs);
}
else
{
Vector<HttpHeaderElement> pcon;
try
{ pcon = Util.parseHeader(hdrs[idx].getValue()); }
catch (ParseException pe)
{ throw new ProtocolException(pe.toString()); }
pcon.addElement(new HttpHeaderElement("close"));
hdrs[idx] = new NVPair("Connection", Util.assembleHeader(pcon));
}
}
}