File tree 1 file changed +7
-5
lines changed
src/java.base/share/classes/sun/net/www/protocol/http
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -626,10 +626,13 @@ private void writeRequests() throws IOException {
626
626
* to last and last, respectively, in the case of a POST
627
627
* request.
628
628
*/
629
- if (!failedOnce ) {
629
+ final String requestLine = method + " " + getRequestURI ()+ " " + httpVersion ;
630
+ final int requestLineIndex = requests .getKey (requestLine );
631
+ if (requestLineIndex != 0 ) {
632
+ // we expect the request line to be at index 0. we set it here
633
+ // if we don't find the request line at that index.
630
634
checkURLFile ();
631
- requests .prepend (method + " " + getRequestURI ()+" " +
632
- httpVersion , null );
635
+ requests .prepend (requestLine , null );
633
636
}
634
637
if (!getUseCaches ()) {
635
638
requests .setIfNotSet ("Cache-Control" , "no-cache" );
@@ -656,8 +659,7 @@ private void writeRequests() throws IOException {
656
659
* or if keep alive is disabled via a system property
657
660
*/
658
661
659
- // Try keep-alive only on first attempt
660
- if (!failedOnce && http .getHttpKeepAliveSet ()) {
662
+ if (http .getHttpKeepAliveSet ()) {
661
663
if (http .usingProxy && tunnelState () != TunnelState .TUNNELING ) {
662
664
requests .setIfNotSet ("Proxy-Connection" , "keep-alive" );
663
665
} else {
You can’t perform that action at this time.
0 commit comments