jrialland / ajp-client

Java implementation of an AJP13 protocol client (aka Apache JServ), allowing to send requests to a servlet container using this protocol.
Apache License 2.0
30 stars 7 forks source link

Malformed Packet: AJP13 in wireshark #8

Closed ehdvudee closed 4 years ago

ehdvudee commented 4 years ago

Hello there. first, thanks to provide AJP client source. very helpful for study AJP.

writeString method in ForwadImpl.class encode String format in AJP. But, If Input the null to writeString method, it encode just "0xff". I input the null to "REMOTE_HOST" and below is packet dump. it does not work for me.

image

I add 0xff like below code.

    protected static void writeString(final String s, final DataOutputStream d) throws IOException {
        if (s == null) {
            d.writeByte(0xff);
            d.writeByte(0xff);
        } else {
            d.writeShort(s.length());
            d.write(s.getBytes());
            d.writeByte(0);
        }
    }

it is works for me.

image

also tomcat document mention following message "Note a size of -1 (65535) indicates a null string and no data follow the length in this case."

My Test Tomcat version is 6.0.48

I look forward to your reply. thanks!!!

jrialland commented 4 years ago

Thank you very much for your input - I'm going to correct this asap

jrialland commented 4 years ago

Closing, as travis build https://travis-ci.org/jrialland/ajp-client/builds/602699871 is ok