marwensaid / eid-applet

Automatically exported from code.google.com/p/eid-applet
Other
1 stars 1 forks source link

ASP.NET service returns status code 411 on IIS 6 and 7 #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Make a regular aspx page with the applet on it, while the ASP.NET service
is running on IIS 6 or 7

What is the expected output? What do you see instead?
The test page worked fine on localhost (IIS 5.1), ut when I put the service
on our live server (which has IIS 6) I started receiving 411 status codes
when speaking to the server.

What version of the product are you using? On what operating system?
1.0.0 beta 2 version
windows server 2003
.net framework 3.5

Please provide any additional information below.
After some research I found out that IIS 6 and 7 require httprequests to
have a Content-Length header.
Managed to get the example working when adding some code at the bottom of
the be.fedict.eid.applet.shared.protocol.transport class:

/*
 * Add HTTP body.
 */
if (null != bodyField) {
        Object bodyValue;
        try {
                bodyValue = bodyField.get(dataObject);
        } catch (Exception e) {
                throw new RuntimeException("error reading field: "
                                + bodyField.getName());
        }
        byte[] body;
        if (bodyValue instanceof List) {
                List<String> bodyList = (List<String>) bodyValue;
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                PrintStream printStream = new PrintStream(baos);
                for (String bodyStr : bodyList) {
                        printStream.println(bodyStr);
                }
                body = baos.toByteArray();
        } else {
                body = (byte[]) bodyValue;
        }

httpTransmitter.addHeader("Content-Length",Integer.toString(body.length));

        httpTransmitter.setBody(body);
}
else httpTransmitter.addHeader("Content-Length", "0");

Original issue reported on code.google.com by tijl.cot...@gmail.com on 14 Jul 2009 at 1:52

GoogleCodeExporter commented 9 years ago
Thanks for reporting this issue. I'll have a look at it.

Original comment by frank.co...@gmail.com on 15 Jul 2009 at 10:22

GoogleCodeExporter commented 9 years ago
Fixed in subversion revision r91.

Original comment by frank.co...@gmail.com on 15 Jul 2009 at 1:07