MCPcopy Create free account
hub / github.com/acl-dev/acl / check_range

Method check_range

lib_acl_cpp/src/http/http_request.cpp:649–697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

647}
648
649void http_request::check_range()
650{
651 http_off_t range_from, range_to;
652 acl_int64 length;
653
654 // ��ȡ���û�������ʱ���õ� range �ֶΣ����û������ֱ�ӷ���
655 header_.get_range(&range_from, &range_to);
656 if (range_from < 0) {
657 return;
658 }
659
660 if (client_ == NULL) {
661 logger_error("connection not opened yet!");
662 return;
663 }
664
665 const HTTP_HDR_RES* hdr_res = client_->get_respond_head(NULL);
666
667 // �� HTTP ��������Ӧ�л�� range ��Ӧ�ֶΣ����û����˵��
668 // ��������֧�� range ����
669 if (http_hdr_res_range((HTTP_HDR_RES*) hdr_res, &range_from_,
670 &range_to_, &range_max_) < 0) {
671
672 RESET_RANGE();
673 }
674
675 // ������������ص� range ����������IJ�һ�£���˵���д�
676 else if (range_from_ != range_from) {
677 logger_error("range_from(%lld) != %lld",
678 range_from_, range_from);
679 RESET_RANGE();
680 }
681 //else if (range_to >= range_from && range_to_ != range_to)
682 else if (range_to >= range_from && range_to_ > range_to) {
683 logger_error("range_to(%lld) > %lld", range_to_, range_to);
684 RESET_RANGE();
685 }
686
687 // ��Ȼ�û������� range ���󣬵����͵��������������������壬
688 // ����Ҫ��������峤�ȵ�һ����
689 else if (range_from == 0 && range_to < 0
690 && (length = client_->body_length()) > 0
691 && range_max_ != length) {
692
693 logger_error("range_total_length: %lld != content_length: %lld",
694 range_max_, length);
695 RESET_RANGE();
696 }
697}
698
699bool http_request::support_range() const
700{

Callers

nothing calls this directly

Calls 4

http_hdr_res_rangeFunction · 0.85
get_respond_headMethod · 0.80
get_rangeMethod · 0.45
body_lengthMethod · 0.45

Tested by

no test coverage detected