@@ -339,6 +339,22 @@ static int send_http2_404(struct http_client_ctx *client,
339
339
return ret ;
340
340
}
341
341
342
+ static int send_http2_405 (struct http_client_ctx * client ,
343
+ struct http2_frame * frame )
344
+ {
345
+ int ret ;
346
+
347
+ ret = send_headers_frame (client , HTTP_405_METHOD_NOT_ALLOWED ,
348
+ frame -> stream_identifier , NULL ,
349
+ HTTP2_FLAG_END_STREAM , NULL , 0 );
350
+ if (ret < 0 ) {
351
+ LOG_DBG ("Cannot write to socket (%d)" , ret );
352
+ return ret ;
353
+ }
354
+
355
+ return ret ;
356
+ }
357
+
342
358
static int send_http2_409 (struct http_client_ctx * client ,
343
359
struct http2_frame * frame )
344
360
{
@@ -361,8 +377,8 @@ static int handle_http2_static_resource(
361
377
size_t content_len ;
362
378
int ret ;
363
379
364
- if (!( static_detail -> common . bitmask_of_supported_http_methods & BIT ( HTTP_GET )) ) {
365
- return - ENOTSUP ;
380
+ if (client -> method != HTTP_GET ) {
381
+ return send_http2_405 ( client , frame ) ;
366
382
}
367
383
368
384
if (client -> current_stream == NULL ) {
@@ -413,8 +429,8 @@ static int handle_http2_static_fs_resource(struct http_resource_detail_static_fs
413
429
int remaining ;
414
430
char tmp [64 ];
415
431
416
- if (!( static_fs_detail -> common . bitmask_of_supported_http_methods & BIT ( HTTP_GET )) ) {
417
- return - ENOTSUP ;
432
+ if (client -> method != HTTP_GET ) {
433
+ return send_http2_405 ( client , frame ) ;
418
434
}
419
435
420
436
if (client -> current_stream == NULL ) {
@@ -715,7 +731,7 @@ static int handle_http2_dynamic_resource(
715
731
user_method = dynamic_detail -> common .bitmask_of_supported_http_methods ;
716
732
717
733
if (!(BIT (client -> method ) & user_method )) {
718
- return - ENOPROTOOPT ;
734
+ return send_http2_405 ( client , frame ) ;
719
735
}
720
736
721
737
if (dynamic_detail -> holder != NULL && dynamic_detail -> holder != client ) {
0 commit comments