Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] RST_STREAM Sending

Hi,
Actually it is my bad. I used the wrong way of callback. So the client may close the websocket(you've told me before). Sorry to be so stupid.
And I have also noticed a very interesting thing. In the onPush function. I find that frame.getPromisedStreamId() & stream.getId() is the same. I don't think they should be the same, do you think this is a bug or it may be my mistake. I observed the detail push_frame by using chrome://net-internal
t=879106 [st=    1]    HTTP2_SESSION_RECV_PUSH_PROMISE
                       --> :authority: 127.0.0.1:8081
                           :method: GET
                           :path: /img/res/main-text.png
                           :scheme: https
                           accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
                           accept-encoding: gzip, deflate, sdch
                           accept-language: zh-CN,zh;q=0.8,en;q=0.6
                           user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36
                       --> id = 1
                       --> promised_stream_id = 2

It's easy to see they are not the same.
Best Regards
Muhui Jiang

2015-09-23 0:45 GMT+08:00 Simone Bordet <sbordet@xxxxxxxxxxx>:
Hi,

On Tue, Sep 22, 2015 at 6:25 PM, Muhui Jiang <jiangmuhui@xxxxxxxxx> wrote:
> Thanks Simone. Here is a code I want to reject to the pushed resource. But
> if I use stream.reset(). I cannot get frames of the index.html only result
> is :

How do you know you cannot get the frames for index.html ?
Is index.html pushed ? Did you return a Stream.Listener for index.html
to the implementation (typically the return value of
Session.onNewStream()) ?

> PushPromiseFrame@36e05d20#1/#2https://127.0.0.1:8081/
>
> GET{u=https://127.0.0.1:8081/img/res/main-text.png,HTTP/2.0,h=1}
>
> 1
>
> 2
>
> I think I just refused to receive the pushed resource and I should get the
> data I made request to. Do you know why?
>
> @Override
>
>             public Stream.Listener onPush(Stream stream, PushPromiseFrame
> frame)
>
>             {
>
>                 System.err.println(frame+"https://"+host+":"+port+"/");
>
>                 System.out.println(frame.getMetaData());
>
>                 System.out.println(frame.getStreamId());
>
>                 System.out.println(frame.getPromisedStreamId());
>
>                 stream.reset(new ResetFrame(frame.getPromisedStreamId(), 1),
> null);
>
>                 return this;

There is not point in returning a Stream.Listener for a stream that
you just reset.

It's better to reset in this way:

ResetFrame resetFrame = new ResetFrame(stream.getId(),
ErrorCode.REFUSED_STREAM_ERROR.code);
stream.reset(resetFrame, Callback.NOOP);

See https://github.com/eclipse/jetty.project/blob/master/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/PushCacheFilterTest.java#L293

--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top