| 626 | } |
| 627 | |
| 628 | void |
| 629 | FetchSM::ext_init(Continuation *cont, const char *method, const char *url, const char *version, const sockaddr *client_addr, |
| 630 | int flags) |
| 631 | { |
| 632 | init_comm(); |
| 633 | |
| 634 | if (flags & TS_FETCH_FLAGS_NEWLOCK) { |
| 635 | mutex = new_ProxyMutex(); |
| 636 | cont_mutex = cont->mutex; |
| 637 | } else { |
| 638 | mutex = cont->mutex; |
| 639 | } |
| 640 | |
| 641 | contp = cont; |
| 642 | _addr.assign(client_addr); |
| 643 | |
| 644 | // |
| 645 | // Enable stream IO automatically. |
| 646 | // |
| 647 | fetch_flags = (TS_FETCH_FLAGS_STREAM | flags); |
| 648 | if (fetch_flags & TS_FETCH_FLAGS_NOT_INTERNAL_REQUEST) { |
| 649 | set_internal_request(false); |
| 650 | } |
| 651 | |
| 652 | // |
| 653 | // These options are not used when enable |
| 654 | // stream IO. |
| 655 | // |
| 656 | memset(&callback_options, 0, sizeof(callback_options)); |
| 657 | memset(&callback_events, 0, sizeof(callback_events)); |
| 658 | |
| 659 | int method_len = strlen(method); |
| 660 | req_buffer->write(method, method_len); |
| 661 | req_buffer->write(" ", 1); |
| 662 | req_buffer->write(url, strlen(url)); |
| 663 | req_buffer->write(" ", 1); |
| 664 | req_buffer->write(version, strlen(version)); |
| 665 | req_buffer->write("\r\n", 2); |
| 666 | |
| 667 | if ((method_len == HTTP_LEN_HEAD) && !memcmp(method, HTTP_METHOD_HEAD, HTTP_LEN_HEAD)) { |
| 668 | is_method_head = true; |
| 669 | } |
| 670 | } |
| 671 | |
| 672 | void |
| 673 | FetchSM::ext_add_header(const char *name, int name_len, const char *value, int value_len) |
no test coverage detected