/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 6393710
* @summary Non authenticated call followed by authenticated call never returns
*/
/*
* Test checks for following bug(s) when a POST containing a request body
* needs to be authenticated
*
* 1) we were not reading the request body
*
* 2) we were not re-enabling the interestops for the socket channel
*/
public class B6393710 {
/* Two post requests containing data. The second one
* has the expected authorization credentials
*/
"Content-Length: 22"+CRLF+
"Pragma: no-cache"+CRLF+
"<item desc=\"excuse\" />"+
"Content-Length: 22"+CRLF+
"Pragma: no-cache"+CRLF+
"Authorization: Basic ZnJlZDpmcmVkcGFzc3dvcmQ="+CRLF+
"<item desc=\"excuse\" />";
}
});
s.setSoTimeout (5000);
try {
} catch (SocketTimeoutException e) {
ok = false;
} finally {
s.close();
}
if (requests != 1) {
throw new RuntimeException ("server handler did not receive the request");
}
if (!ok) {
throw new RuntimeException ("did not get 200 OK");
}
}
/* check for expected string and return true if found in stream */
int c;
int count = 0;
c = Character.toLowerCase (c);
count ++;
return true;
}
} else {
count = 0;
}
}
return false;
}
public static boolean ok = false;
throws IOException
{
int count = 0;
count ++;
}
if (count != 22) {
ok = false;
}
t.close();
requests ++;
}
}
}