static void enumeration_test(void) { char *enumContext = NULL; static int i = 0; char *selectors = NULL; wsmc_reinit_conn(cl); options = wsmc_options_init(); options->flags = tests[i].flags; if (tests[i].selectors) { selectors = u_strdup_printf(tests[i].selectors, host, host, host); wsmc_add_selectors_from_str(options, selectors); } options->max_elements = tests[i].max_elements; WsXmlDocH enum_response = wsmc_action_enumerate(cl, (char *)tests[i].resource_uri, options, NULL); CU_ASSERT_TRUE(wsmc_get_response_code(cl) == tests[i].final_status); if (wsmc_get_response_code(cl) != tests[i].final_status) { if (verbose) { printf("\nExpected = %d\nReturned = %ld ", tests[i].final_status, wsmc_get_response_code(cl)); } goto RETURN; } CU_ASSERT_PTR_NOT_NULL(enum_response); if (enum_response) { enumContext = wsmc_get_enum_context(enum_response); } else { goto RETURN; } check_response_header(enum_response, wsmc_get_response_code(cl), ENUM_ACTION_ENUMERATERESPONSE); //if (i==11) ws_xml_dump_node_tree(stdout, ws_xml_get_doc_root(enum_response)); handle_filters(enum_response, filters); handle_filters(enum_response, tests[i].common_filters); handle_filters(enum_response, tests[i].filters); RETURN: u_free(selectors); if (enumContext) { wsmc_action_release(cl, (char *)tests[i].resource_uri, options, enumContext); } if (enum_response) { ws_xml_destroy_doc(enum_response); } wsmc_options_destroy(options); i++; // decrease executed test number }
static void stream_http_response_data(liStreamHttpResponse* shr) { if (NULL == shr->stream.source) return; if (!shr->response_headers_finished) { switch (li_http_response_parse(shr->vr, &shr->parse_response_ctx)) { case LI_HANDLER_GO_ON: check_response_header(shr); if (NULL == shr->stream.source) return; break; case LI_HANDLER_ERROR: VR_ERROR(shr->vr, "%s", "Parsing response header failed"); li_vrequest_error(shr->vr); return; case LI_HANDLER_WAIT_FOR_EVENT: if (shr->stream.source->out->is_closed) { VR_ERROR(shr->vr, "%s", "Parsing response header failed (eos)"); li_vrequest_error(shr->vr); } return; default: return; } } if (shr->transfer_encoding_chunked) { if (!li_filter_chunked_decode(shr->vr, shr->stream.out, shr->stream.source->out, &shr->chunked_decode_state)) { if (NULL != shr->vr) { VR_ERROR(shr->vr, "%s", "Decoding chunks failed"); li_vrequest_error(shr->vr); } else { li_stream_reset(&shr->stream); } } if (shr->stream.source->out->is_closed) { li_stream_disconnect(&shr->stream); } } else { li_chunkqueue_steal_all(shr->stream.out, shr->stream.source->out); if (shr->stream.source->out->is_closed) { shr->stream.out->is_closed = TRUE; li_stream_disconnect(&shr->stream); } } li_stream_notify(&shr->stream); }