@@ -102,37 +102,6 @@ ngx_module_t ngx_rtmp_control_module = {
102
102
};
103
103
104
104
105
- static ngx_int_t
106
- ngx_rtmp_control_output_error (ngx_http_request_t * r , const char * msg )
107
- {
108
- size_t len ;
109
- ngx_buf_t * b ;
110
- ngx_chain_t cl ;
111
-
112
- len = ngx_strlen (msg );
113
-
114
- r -> headers_out .status = NGX_HTTP_BAD_REQUEST ;
115
- r -> headers_out .content_length_n = len ;
116
-
117
- b = ngx_calloc_buf (r -> pool );
118
- if (b == NULL ) {
119
- return NGX_ERROR ;
120
- }
121
-
122
- ngx_memzero (& cl , sizeof (cl ));
123
- cl .buf = b ;
124
-
125
- b -> start = b -> pos = (u_char * ) msg ;
126
- b -> end = b -> last = (u_char * ) msg + len ;
127
- b -> memory = 1 ;
128
- b -> last_buf = 1 ;
129
-
130
- ngx_http_send_header (r );
131
-
132
- return ngx_http_output_filter (r , & cl );
133
- }
134
-
135
-
136
105
static const char *
137
106
ngx_rtmp_control_record_handler (ngx_http_request_t * r , ngx_rtmp_session_t * s )
138
107
{
@@ -475,14 +444,18 @@ ngx_rtmp_control_record(ngx_http_request_t *r, ngx_str_t *method)
475
444
goto error ;
476
445
}
477
446
447
+ if (ctx -> path .len == 0 ) {
448
+ return NGX_HTTP_NO_CONTENT ;
449
+ }
450
+
478
451
/* output record path */
479
452
480
453
r -> headers_out .status = NGX_HTTP_OK ;
481
454
r -> headers_out .content_length_n = ctx -> path .len ;
482
455
483
456
b = ngx_create_temp_buf (r -> pool , ctx -> path .len );
484
457
if (b == NULL ) {
485
- return NGX_ERROR ;
458
+ goto error ;
486
459
}
487
460
488
461
ngx_memzero (& cl , sizeof (cl ));
@@ -496,7 +469,7 @@ ngx_rtmp_control_record(ngx_http_request_t *r, ngx_str_t *method)
496
469
return ngx_http_output_filter (r , & cl );
497
470
498
471
error :
499
- return ngx_rtmp_control_output_error ( r , msg ) ;
472
+ return NGX_HTTP_INTERNAL_SERVER_ERROR ;
500
473
}
501
474
502
475
@@ -554,7 +527,7 @@ ngx_rtmp_control_drop(ngx_http_request_t *r, ngx_str_t *method)
554
527
555
528
b = ngx_calloc_buf (r -> pool );
556
529
if (b == NULL ) {
557
- return NGX_ERROR ;
530
+ goto error ;
558
531
}
559
532
560
533
b -> start = b -> pos = p ;
@@ -570,7 +543,7 @@ ngx_rtmp_control_drop(ngx_http_request_t *r, ngx_str_t *method)
570
543
return ngx_http_output_filter (r , & cl );
571
544
572
545
error :
573
- return ngx_rtmp_control_output_error ( r , msg ) ;
546
+ return NGX_HTTP_INTERNAL_SERVER_ERROR ;
574
547
}
575
548
576
549
@@ -618,7 +591,7 @@ ngx_rtmp_control_redirect(ngx_http_request_t *r, ngx_str_t *method)
618
591
619
592
p = ngx_palloc (r -> connection -> pool , len );
620
593
if (p == NULL ) {
621
- return NGX_ERROR ;
594
+ goto error ;
622
595
}
623
596
624
597
len = (size_t ) (ngx_snprintf (p , len , "%ui" , ctx -> count ) - p );
@@ -628,7 +601,7 @@ ngx_rtmp_control_redirect(ngx_http_request_t *r, ngx_str_t *method)
628
601
629
602
b = ngx_calloc_buf (r -> pool );
630
603
if (b == NULL ) {
631
- return NGX_ERROR ;
604
+ goto error ;
632
605
}
633
606
634
607
b -> start = b -> pos = p ;
@@ -644,7 +617,7 @@ ngx_rtmp_control_redirect(ngx_http_request_t *r, ngx_str_t *method)
644
617
return ngx_http_output_filter (r , & cl );
645
618
646
619
error :
647
- return ngx_rtmp_control_output_error ( r , msg ) ;
620
+ return NGX_HTTP_INTERNAL_SERVER_ERROR ;
648
621
}
649
622
650
623
0 commit comments