fix h2 curl error

This commit is contained in:
icodening 2023-09-01 17:16:41 +08:00
parent cfd0be3a3a
commit fe2af7e354
2 changed files with 49 additions and 3 deletions

View File

@ -0,0 +1,46 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.remoting.http12.message;
import org.apache.dubbo.remoting.http12.exception.DecodeException;
import java.io.InputStream;
public class NoOpStreamingDecoder implements StreamingDecoder {
private FragmentListener listener;
@Override
public void request(int numMessages) {
// do nothing
}
@Override
public void decode(InputStream inputStream) throws DecodeException {
listener.onFragmentMessage(inputStream);
}
@Override
public void close() {
this.listener.onClose();
}
@Override
public void setFragmentListener(FragmentListener listener) {
this.listener = listener;
}
}

View File

@ -28,9 +28,9 @@ import org.apache.dubbo.remoting.http12.h2.Http2ServerChannelObserver;
import org.apache.dubbo.remoting.http12.h2.Http2TransportListener;
import org.apache.dubbo.remoting.http12.message.DefaultListeningDecoder;
import org.apache.dubbo.remoting.http12.message.JsonCodec;
import org.apache.dubbo.remoting.http12.message.LengthFieldStreamingDecoder;
import org.apache.dubbo.remoting.http12.message.ListeningDecoder;
import org.apache.dubbo.remoting.http12.message.MethodMetadata;
import org.apache.dubbo.remoting.http12.message.NoOpStreamingDecoder;
import org.apache.dubbo.remoting.http12.message.StreamingDecoder;
import org.apache.dubbo.rpc.CancellationContext;
import org.apache.dubbo.rpc.Invoker;
@ -116,8 +116,8 @@ public class GenericHttp2ServerTransportListener extends AbstractServerTransport
}
protected StreamingDecoder newStreamingDecoder() {
//default lengthFieldLength = 4
return new LengthFieldStreamingDecoder();
//default no op
return new NoOpStreamingDecoder();
}
protected void doOnMetadata(Http2Header metadata) {