Print this page


Split Close
Expand all
Collapse all
          --- old/test/sun/net/www/http/HttpClient/B6726695.java
          +++ new/test/sun/net/www/http/HttpClient/B6726695.java
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * 2 along with this work; if not, write to the Free Software Foundation,
  17   17   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18   18   *
  19   19   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20   20   * or visit www.oracle.com if you need additional information or have any
  21   21   * questions.
  22   22   */
  23   23  
  24   24  /*
  25   25   * @test
  26      - * @bug 6726695
       26 + * @bug 6726695 6993490
  27   27   * @summary HttpURLConnection shoul support 'Expect: 100-contimue' headers for PUT
  28   28  */
  29   29  
  30   30  import java.net.*;
  31   31  import java.io.*;
  32   32  
  33   33  public class B6726695 extends Thread {
  34   34      private ServerSocket server = null;
  35   35      private int port = 0;
  36   36      private byte[] data = new byte[512];
↓ open down ↓ 140 lines elided ↑ open up ↑
 177  177          do {
 178  178              line = in.readLine();
 179  179          } while (line != null && line.length() != 0);
 180  180  
 181  181          // Send 100-Continue
 182  182          out.print("HTTP/1.1 100 Continue\r\n");
 183  183          out.print("\r\n");
 184  184          out.flush();
 185  185          // Then read the body
 186  186          char[] cbuf = new char[512];
 187      -        int l = in.read(cbuf);
      187 +        in.read(cbuf);
      188 +
      189 +        /* Force the server to not respond for more that the expect 100-Continue
      190 +         * timeout set by the HTTP handler (5000 millis). This ensures the
      191 +         * timeout is correctly resets the default read timeout, infinity.
      192 +         * See 6993490. */
      193 +        System.out.println("server sleeping...");
      194 +        try {Thread.sleep(6000); } catch (InterruptedException e) {}
      195 +
 188  196          // finally send the 200 OK
 189  197          out.print("HTTP/1.1 200 OK");
 190  198          out.print("Server: Sun-Java-System-Web-Server/7.0\r\n");
 191  199          out.print("Connection: close\r\n");
 192  200          out.print("Content-Length: 0\r\n");
 193  201          out.print("\r\n");
 194  202          out.flush();
 195  203          out.close();
 196  204          in.close();
 197  205      }
↓ open down ↓ 23 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX