Class: DS9::Server
Instance Method Summary
collapse
Methods inherited from Session
#initialize, #mem_receive, #mem_send, #outbound_queue_size, #receive, #send, #stream_local_closed?, #stream_remote_closed?, #submit_goaway, #submit_ping, #submit_request, #submit_settings, #terminate_session, #want_read?, #want_write?
Constructor Details
This class inherits a constructor from DS9::Session
Instance Method Details
#submit_push_promise(stream_id, headers) ⇒ Object
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
|
# File 'ext/ds9/ds9.c', line 701
static VALUE server_submit_push_promise(VALUE self, VALUE stream_id, VALUE headers)
{
nghttp2_session *session;
nghttp2_nv *nva, *head;
size_t niv, i;
int rv;
TypedData_Get_Struct(self, nghttp2_session, &ds9_session_type, session);
CheckSelf(session);
Check_Type(headers, T_ARRAY);
niv = RARRAY_LEN(headers);
nva = xcalloc(niv, sizeof(nghttp2_nv));
head = nva;
for(i = 0; i < niv; i++, head++) {
VALUE tuple = rb_ary_entry(headers, (long)i);
VALUE name = rb_ary_entry(tuple, 0);
VALUE value = rb_ary_entry(tuple, 1);
head->name = (uint8_t *)StringValuePtr(name);
head->namelen = RSTRING_LEN(name);
head->value = (uint8_t *)StringValuePtr(value);
head->valuelen = RSTRING_LEN(value);
head->flags = NGHTTP2_NV_FLAG_NONE;
}
rv = nghttp2_submit_push_promise(session, 0, NUM2INT(stream_id), nva, niv, NULL);
xfree(nva);
switch(rv) {
case NGHTTP2_ERR_NOMEM:
case NGHTTP2_ERR_PROTO:
case NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE:
case NGHTTP2_ERR_INVALID_ARGUMENT:
return explode(rv);
break;
default:
return INT2NUM(rv);
}
}
|
#submit_response(stream_id, headers) ⇒ Object
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
|
# File 'ext/ds9/ds9.c', line 628
static VALUE server_submit_response(VALUE self, VALUE stream_id, VALUE headers)
{
nghttp2_session *session;
size_t niv;
nghttp2_nv *nva, *head;
nghttp2_data_provider provider;
int rv;
TypedData_Get_Struct(self, nghttp2_session, &ds9_session_type, session);
CheckSelf(session);
niv = RARRAY_LEN(headers);
nva = xcalloc(niv, sizeof(nghttp2_nv));
copy_list_to_nv(headers, nva, niv);
provider.read_callback = rb_data_read_callback;
rv = nghttp2_submit_response(session, NUM2INT(stream_id), nva, niv, &provider);
xfree(nva);
if (0 != rv) {
explode(rv);
}
return self;
}
|
#submit_shutdown ⇒ Object
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
|
# File 'ext/ds9/ds9.c', line 528
static VALUE session_submit_shutdown(VALUE self)
{
int rv;
nghttp2_session *session;
TypedData_Get_Struct(self, nghttp2_session, &ds9_session_type, session);
CheckSelf(session);
rv = nghttp2_submit_shutdown_notice(session);
if (rv == 0)
return Qtrue;
return explode(rv);
}
|