< prev index next >

src/java.base/share/classes/sun/net/www/http/HttpClient.java

Print this page

 718          */
 719 
 720         try {
 721             serverInput = serverSocket.getInputStream();
 722             if (capture != null) {
 723                 serverInput = new HttpCaptureInputStream(serverInput, capture);
 724             }
 725             serverInput = new BufferedInputStream(serverInput);
 726             return (parseHTTPHeader(responses, pi, httpuc));
 727         } catch (SocketTimeoutException stex) {
 728             // We don't want to retry the request when the app. sets a timeout
 729             // but don't close the server if timeout while waiting for 100-continue
 730             if (ignoreContinue) {
 731                 closeServer();
 732             }
 733             throw stex;
 734         } catch (IOException e) {
 735             closeServer();
 736             cachedHttpClient = false;
 737             if (!failedOnce && requests != null) {


 738                 failedOnce = true;
 739                 if (getRequestMethod().equals("CONNECT")
 740                     || streaming

 741                     || (httpuc.getRequestMethod().equals("POST")
 742                         && !retryPostProp)) {
 743                     // do not retry the request
 744                 }  else {
 745                     // try once more
 746                     openServer();
 747                     checkTunneling(httpuc);
 748                     afterConnect();
 749                     writeRequests(requests, poster);
 750                     return parseHTTP(responses, pi, httpuc);
 751                 }
 752             }
 753             throw e;
 754         }
 755 
 756     }
 757 
 758     // Check whether tunnel must be open and open it if necessary
 759     // (in the case of HTTPS with proxy)
 760     private void checkTunneling(HttpURLConnection httpuc) throws IOException {

 718          */
 719 
 720         try {
 721             serverInput = serverSocket.getInputStream();
 722             if (capture != null) {
 723                 serverInput = new HttpCaptureInputStream(serverInput, capture);
 724             }
 725             serverInput = new BufferedInputStream(serverInput);
 726             return (parseHTTPHeader(responses, pi, httpuc));
 727         } catch (SocketTimeoutException stex) {
 728             // We don't want to retry the request when the app. sets a timeout
 729             // but don't close the server if timeout while waiting for 100-continue
 730             if (ignoreContinue) {
 731                 closeServer();
 732             }
 733             throw stex;
 734         } catch (IOException e) {
 735             closeServer();
 736             cachedHttpClient = false;
 737             if (!failedOnce && requests != null) {
 738                 Thread thread = Thread.currentThread();
 739                 boolean doNotRetry = thread.isVirtual() && thread.isInterrupted();
 740                 failedOnce = true;
 741                 if (getRequestMethod().equals("CONNECT")
 742                     || streaming
 743                     || doNotRetry
 744                     || (httpuc.getRequestMethod().equals("POST")
 745                         && !retryPostProp)) {
 746                     // do not retry the request
 747                 }  else {
 748                     // try once more
 749                     openServer();
 750                     checkTunneling(httpuc);
 751                     afterConnect();
 752                     writeRequests(requests, poster);
 753                     return parseHTTP(responses, pi, httpuc);
 754                 }
 755             }
 756             throw e;
 757         }
 758 
 759     }
 760 
 761     // Check whether tunnel must be open and open it if necessary
 762     // (in the case of HTTPS with proxy)
 763     private void checkTunneling(HttpURLConnection httpuc) throws IOException {
< prev index next >