int rest_set_header_content_type(RESPONSE* response, content_type_t content_type) { #ifdef WITH_COAP return coap_set_header_content_type(response, content_type); #else return http_set_res_header(response, HTTP_HEADER_NAME_CONTENT_TYPE, http_get_content_type_string(content_type), 1); #endif /*WITH_COAP*/ }
int rest_set_header_etag(RESPONSE* response, uint8_t* etag, uint8_t size) { #ifdef WITH_COAP return coap_set_header_etag(response, etag, size); #else /*FIXME for now etag should be a "/0" ending string for http part*/ char temp_etag[10]; memcpy(temp_etag, etag, size); temp_etag[size] = 0; return http_set_res_header(response, HTTP_HEADER_NAME_ETAG, temp_etag, 1); #endif /*WITH_COAP*/ }
static PT_THREAD(handle_response(connection_state_t* conn_state)) { PT_BEGIN(&(conn_state->outputpt)); PRINTF("handle_response ->\n"); http_set_res_header(&conn_state->response, HTTP_HEADER_NAME_CONNECTION, close, 0); http_set_res_header(&conn_state->response, HTTP_HEADER_NAME_SERVER, contiki, 0); if (!(conn_state->response.status_string)) { conn_state->response.status_string = get_default_status_string(conn_state->response.status_code); } PT_WAIT_THREAD(&(conn_state->outputpt), send_data(conn_state)); PRINTF("<-- handle_response\n\n\n"); PSOCK_CLOSE(&(conn_state->sout)); PT_END(&(conn_state->outputpt)); }