Changeset 70f9c00 in mod_gnutls
- Timestamp:
- Sep 28, 2020, 8:56:23 AM (2 years ago)
- Branches:
- asyncio, master
- Children:
- c9e720f
- Parents:
- ae4325e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gnutls_io.c
rae4325e r70f9c00 37 37 */ 38 38 39 #define HTTP_ON_HTTPS_PORT \40 "GET /" CRLF41 42 #define HTTP_ON_HTTPS_PORT_BUCKET(alloc) \43 apr_bucket_immortal_create(HTTP_ON_HTTPS_PORT, \44 sizeof(HTTP_ON_HTTPS_PORT) - 1, \45 alloc)46 47 39 #define IS_PROXY_STR(c) \ 48 40 ((c->is_proxy == GNUTLS_ENABLED_TRUE) ? "proxy " : "") … … 56 48 57 49 58 static apr_status_t gnutls_io_filter_error(ap_filter_t * f, 59 apr_bucket_brigade * bb, 60 apr_status_t status) { 61 mgs_handle_t *ctxt = (mgs_handle_t *) f->ctx; 62 apr_bucket *bucket; 63 64 switch (status) { 65 case HTTP_BAD_REQUEST: 66 /* log the situation */ 67 ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, f->c, 68 "GnuTLS handshake failed: HTTP spoken on HTTPS port; " 69 "trying to send HTML error page"); 70 ctxt->status = -1; 71 72 /* fake the request line */ 73 bucket = HTTP_ON_HTTPS_PORT_BUCKET(f->c->bucket_alloc); 74 break; 75 76 default: 77 return status; 78 } 79 50 /** 51 * Helper function, used mostly for error conditions: Insert an EOS (end 52 * of stream) bucket into the bucket brigade. 53 */ 54 static inline void gnutls_io_filter_eos(ap_filter_t *f, 55 apr_bucket_brigade *bb) 56 { 57 apr_bucket *bucket = apr_bucket_eos_create(f->c->bucket_alloc); 80 58 APR_BRIGADE_INSERT_TAIL(bb, bucket); 81 bucket = apr_bucket_eos_create(f->c->bucket_alloc); 82 APR_BRIGADE_INSERT_TAIL(bb, bucket); 83 84 return APR_SUCCESS; 85 } 59 } 60 61 86 62 87 63 static int char_buffer_read(mgs_char_buffer_t * buffer, char *in, int inl) { … … 560 536 561 537 if (f->c->aborted) { 562 apr_bucket *bucket = 563 apr_bucket_eos_create(f->c->bucket_alloc); 564 APR_BRIGADE_INSERT_TAIL(bb, bucket); 538 gnutls_io_filter_eos(f, bb); 565 539 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, ctxt->c, 566 540 "%s: %sconnection aborted", … … 582 556 "%s: %sconnection failed, cannot provide data!", 583 557 __func__, IS_PROXY_STR(ctxt)); 584 apr_bucket *bucket = 585 apr_bucket_eos_create(f->c->bucket_alloc); 586 APR_BRIGADE_INSERT_TAIL(bb, bucket); 558 gnutls_io_filter_eos(f, bb); 587 559 return APR_ECONNABORTED; 588 560 } … … 649 621 650 622 /* Close TLS session and free resources on EOF, 651 * gnutls_io_filter_e rrorwill add an EOS bucket */623 * gnutls_io_filter_eos will add an EOS bucket */ 652 624 if (APR_STATUS_IS_EOF(status)) 653 625 mgs_bye(ctxt); 654 626 655 return gnutls_io_filter_error(f, bb, status); 627 gnutls_io_filter_eos(f, bb); 628 return status; 656 629 } 657 630 … … 730 703 * mod_proxy continues its processing and sends a proper 731 704 * "proxy error" message when there's no response to read. */ 732 apr_bucket *bucket = apr_bucket_eos_create(f->c->bucket_alloc); 733 APR_BRIGADE_INSERT_TAIL(bb, bucket); 705 gnutls_io_filter_eos(f, bb); 734 706 return APR_SUCCESS; 735 707 }
Note: See TracChangeset
for help on using the changeset viewer.