@@ -1512,8 +1512,8 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
1512
1512
}
1513
1513
}
1514
1514
1515
- //if not a gRPC response - evaluate entire http status and process close stream / response
1516
- //for 200 -> Unknown, else decode the error
1515
+ // If a non gRPC response is received, then evaluate entire http status and process close stream / response.
1516
+ // In case http status doesn't provide any error information (status : 200), evalute response code to be Unknown.
1517
1517
if ! isGRPC {
1518
1518
var grpcErrorCode = codes .Internal // when header does not include HTTP status, return INTERNAL
1519
1519
var errs []string
@@ -1533,8 +1533,12 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
1533
1533
}
1534
1534
statusCode := int (c )
1535
1535
if statusCode >= 100 && statusCode < 200 {
1536
+ if endStream {
1537
+ se := status .New (codes .Internal , fmt .Sprintf (
1538
+ "protocol error: informational header with status code %d must not have END_STREAM set" , statusCode ))
1539
+ t .closeStream (s , se .Err (), true , http2 .ErrCodeProtocol , se , nil , endStream )
1540
+ }
1536
1541
//In case of informational headers return
1537
- //For trailers, since we are already in gRPC mode, we will ignore all http statuses and not enter this block
1538
1542
return
1539
1543
}
1540
1544
httpStatusErr = fmt .Sprintf (
@@ -1557,7 +1561,7 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
1557
1561
if contentTypeErr != "" {
1558
1562
errs = append (errs , contentTypeErr )
1559
1563
}
1560
- // Verify the HTTP response is a 200.
1564
+
1561
1565
se := status .New (grpcErrorCode , strings .Join (errs , "; " ))
1562
1566
t .closeStream (s , se .Err (), true , http2 .ErrCodeProtocol , se , nil , endStream )
1563
1567
return
0 commit comments