@@ -633,8 +633,7 @@ tfw_h2_prep_resp(TfwHttpResp *resp, unsigned short status, TfwStr *msg,
633
633
__TFW_STR_CH (& hdr , 1 )-> len ;
634
634
hdr .hpack_idx = name -> hpack_idx ;
635
635
636
- if ((r = tfw_hpack_encode (resp , & hdr ,
637
- false, true)))
636
+ if ((r = tfw_hpack_encode (resp , & hdr , false, true)))
638
637
return r ;
639
638
}
640
639
}
@@ -4699,162 +4698,6 @@ tfw_h2_hpack_encode_headers(TfwHttpResp *resp, const TfwHdrMods *h_mods)
4699
4698
return 0 ;
4700
4699
}
4701
4700
4702
- /*
4703
- * Get next header from the @mit->map. Procedure designed to be called from the
4704
- * outer cycle with changing of @mit iterator (including @mit->curr index of
4705
- * current header in the indirection map). Note, for optimization purposes, on
4706
- * each iteration function produces the boundary pointer @mit->bnd for current
4707
- * iteration and the operation instance @mit->next - for the next iteration
4708
- * (including source header @mit->next.s_hdr).
4709
- *
4710
- * TODO #1103: This function should be treated as a foundation for #1103 issue.
4711
- */
4712
- static int
4713
- tfw_h2_resp_next_hdr (TfwHttpResp * resp , const TfwHdrMods * h_mods )
4714
- {
4715
- int r ;
4716
- unsigned int i ;
4717
- TfwHttpTransIter * mit = & resp -> mit ;
4718
- TfwHttpHdrMap * map = mit -> map ;
4719
- TfwNextHdrOp * next = & mit -> next ;
4720
- TfwHttpHdrTbl * ht = resp -> h_tbl ;
4721
-
4722
- mit -> bnd = NULL ;
4723
-
4724
- for (i = mit -> curr ; i < map -> count ; ++ i ) {
4725
- int k ;
4726
- TfwStr * first ;
4727
- unsigned short hid = map -> index [i ].idx ;
4728
- unsigned short d_num = map -> index [i ].d_idx ;
4729
- TfwStr * tgt = & ht -> tbl [hid ];
4730
- TfwHdrModsDesc * f_desc = NULL ;
4731
- const TfwStr * val ;
4732
-
4733
- if (TFW_STR_DUP (tgt ))
4734
- tgt = TFW_STR_CHUNK (tgt , d_num );
4735
-
4736
- first = TFW_STR_CHUNK (tgt , 0 );
4737
-
4738
- if (WARN_ON_ONCE (!tgt
4739
- || TFW_STR_EMPTY (tgt )
4740
- || TFW_STR_DUP (tgt )))
4741
- return - EINVAL ;
4742
-
4743
- T_DBG3 ("%s: hid=%hu, d_num=%hu, nchunks=%u, h_mods->sz=%lu\n" ,
4744
- __func__ , hid , d_num , ht -> tbl [hid ].nchunks ,
4745
- h_mods ? h_mods -> sz : 0 );
4746
-
4747
- if (!h_mods )
4748
- goto def ;
4749
-
4750
- for (k = 0 ; k < h_mods -> sz ; ++ k ) {
4751
- TfwHdrModsDesc * desc = & h_mods -> hdrs [k ];
4752
-
4753
- if ((hid < TFW_HTTP_HDR_RAW && hid == desc -> hid )
4754
- || (hid >= TFW_HTTP_HDR_RAW
4755
- && !__hdr_name_cmp (tgt , desc -> hdr )))
4756
- {
4757
- f_desc = desc ;
4758
- break ;
4759
- }
4760
- }
4761
- if (!f_desc )
4762
- goto def ;
4763
-
4764
- val = TFW_STR_CHUNK (f_desc -> hdr , 2 );
4765
- /*
4766
- * If this is a duplicate of already processed header,
4767
- * leave this duplicate as is (for transformation
4768
- * in-place) in case of appending operation, and remove
4769
- * it (by skipping) in case of substitution or deletion
4770
- * operations.
4771
- */
4772
- if (test_bit (k , mit -> found )) {
4773
- if (!val || !f_desc -> append )
4774
- continue ;
4775
-
4776
- mit -> bnd = first -> data ;
4777
- next -> s_hdr = * tgt ;
4778
- next -> op = TFW_H2_TRANS_INPLACE ;
4779
-
4780
- break ;
4781
- }
4782
-
4783
- __set_bit (k , mit -> found );
4784
-
4785
- /*
4786
- * If header configured with empty value, it should be
4787
- * removed from the response; so, just skip such header.
4788
- */
4789
- if (!val )
4790
- continue ;
4791
-
4792
- mit -> bnd = first -> data ;
4793
-
4794
- /*
4795
- * If the header configured for value appending,
4796
- * concatenate it with the target header in skb for
4797
- * subsequent in-place rewriting.
4798
- */
4799
- if (f_desc -> append ) {
4800
- TfwStr h_app = {
4801
- .chunks = (TfwStr []){
4802
- { .data = ", " , .len = 2 },
4803
- { .data = val -> data ,
4804
- .len = val -> len }
4805
- },
4806
- .len = val -> len + 2 ,
4807
- .nchunks = 2
4808
- };
4809
-
4810
- r = tfw_strcat (resp -> pool , tgt , & h_app );
4811
- if (unlikely (r ))
4812
- return r ;
4813
-
4814
- next -> s_hdr = * tgt ;
4815
- next -> op = TFW_H2_TRANS_INPLACE ;
4816
- break ;
4817
- }
4818
-
4819
- next -> s_hdr = * f_desc -> hdr ;
4820
- //next->op = TFW_H2_TRANS_SUB;
4821
- break ;
4822
-
4823
- def :
4824
- /*
4825
- * Remove 'Connection', 'Keep-Alive' headers and all hop-by-hop
4826
- * headers from the HTTP/2 response.
4827
- */
4828
- if (hid == TFW_HTTP_HDR_KEEP_ALIVE
4829
- || hid == TFW_HTTP_HDR_CONNECTION
4830
- || tgt -> flags & TFW_STR_HBH_HDR )
4831
- continue ;
4832
-
4833
- /*
4834
- * 'Server' header must be replaced; thus, remove the original
4835
- * header (and all its duplicates) skipping it here; the new
4836
- * header will be written later, during new headers' addition
4837
- * stage.
4838
- */
4839
- if (hid == TFW_HTTP_HDR_SERVER )
4840
- continue ;
4841
-
4842
- /*
4843
- * In general case the header should be transformed in-place
4844
- * from its original HTTP/1.1-representation in skb.
4845
- */
4846
- mit -> bnd = first -> data ;
4847
- next -> s_hdr = * tgt ;
4848
- next -> op = TFW_H2_TRANS_INPLACE ;
4849
-
4850
- break ;
4851
- }
4852
-
4853
- mit -> curr = i + 1 ;
4854
-
4855
- return 0 ;
4856
- }
4857
-
4858
4701
static int
4859
4702
__tfw_h2_make_frames (unsigned long len , char * data , u8 buf_sz ,
4860
4703
TfwMsgIter * iter , unsigned long skew ,
@@ -5496,7 +5339,7 @@ tfw_h2_resp_adjust_fwd(TfwHttpResp *resp)
5496
5339
* Transform HTTP/1.1 headers into HTTP/2 form, in parallel with
5497
5340
* adjusting of particular headers.
5498
5341
*/
5499
- WARN_ON_ONCE (mit -> acc_len || mit -> curr );
5342
+ WARN_ON_ONCE (mit -> acc_len );
5500
5343
tfw_h2_msg_transform_setup (mit , resp -> msg .skb_head , true);
5501
5344
5502
5345
tfw_h2_msg_cutoff_headers (resp , & cleanup );
@@ -5513,9 +5356,6 @@ tfw_h2_resp_adjust_fwd(TfwHttpResp *resp)
5513
5356
if (unlikely (r ))
5514
5357
goto clean ;
5515
5358
5516
- if (0 )
5517
- r = tfw_h2_resp_next_hdr (resp , h_mods );
5518
-
5519
5359
r = tfw_h2_hpack_encode_headers (resp , h_mods );
5520
5360
if (unlikely (r ))
5521
5361
goto clean ;
0 commit comments