| 788 | } |
| 789 | |
| 790 | bool http_request::get_body(xml& out, const char* to_charset /* = NULL */) |
| 791 | { |
| 792 | if (client_ == NULL) { |
| 793 | logger_error("connection not opened yet"); |
| 794 | return false; |
| 795 | } |
| 796 | |
| 797 | http_pipe* hp = get_pipe(to_charset); |
| 798 | if (hp) { |
| 799 | hp->append(&out); |
| 800 | } |
| 801 | |
| 802 | string buf(4096); |
| 803 | int ret; |
| 804 | |
| 805 | // �� HTTP ��Ӧ�壬���� xml ��ʽ���з��� |
| 806 | while (true) { |
| 807 | // ���ÿ����Զ���ѹ���Ķ����� |
| 808 | ret = client_->read_body(buf); |
| 809 | if (ret < 0) { |
| 810 | break; |
| 811 | } else if (ret == 0) { |
| 812 | break; |
| 813 | } |
| 814 | if (hp) { |
| 815 | hp->update(buf.c_str(), ret); |
| 816 | } else { |
| 817 | out.update(buf.c_str()); |
| 818 | } |
| 819 | } |
| 820 | |
| 821 | if (hp) { |
| 822 | hp->update_end(); |
| 823 | delete hp; |
| 824 | } |
| 825 | return true; |
| 826 | } |
| 827 | |
| 828 | bool http_request::get_body(json& out, const char* to_charset /* = NULL */) |
| 829 | { |