void soap_paste_result (soap_context_t *ctx) { PASTE_P (soap_xml_start); PASTE_P (soap_xml_envelope); if (ctx->error) PASTE_P (soap_xml_fault); else { uint8_t type = ctx->args[0].type; SOAP_DEBUG ("type = %d\n", type); PASTE_PF (soap_xml_result_start, ctx->rpc.name, pgm_read_word(&soap_type_table[type])); switch (type) { case SOAP_TYPE_INT: PASTE_PF (PSTR("%d"), ctx->args[0].u.d_int); break; case SOAP_TYPE_STRING: strcat (uip_appdata, ctx->args[0].u.d_string); break; case SOAP_TYPE_UINT32: PASTE_PF (PSTR("%lu"), ctx->args[0].u.d_uint32); break; default: SOAP_DEBUG ("invalid soap-type assigned to result.\n"); } PASTE_PF (soap_xml_result_end, ctx->rpc.name); } PASTE_P (soap_xml_end); }
static void httpd_handle_vfs_send_header (void) { PASTE_RESET (); PASTE_P (httpd_header_200); vfs_size_t len = vfs_size (STATE->u.vfs.fd); if (len > 0) { /* send content-length header */ PASTE_P (httpd_header_length); PASTE_LEN (len); } /* Check whether the file is gzip compressed. */ unsigned char buf[READ_AHEAD_LEN]; #ifndef VFS_TEENSY if (VFS_HAVE_FUNC (STATE->u.vfs.fd, fseek)) { #endif /* not VFS_TEENSY, inlined files are always gzip'd */ /* Rewind stream first, might be a rexmit */ vfs_rewind (STATE->u.vfs.fd); vfs_read (STATE->u.vfs.fd, buf, READ_AHEAD_LEN); vfs_rewind (STATE->u.vfs.fd); #ifndef VFS_TEENSY } else goto no_gzip; if (buf[0] == 0x1f && buf[1] == 0x8b) #endif /* not VFS_TEENSY, inlined files are always gzip'd */ PASTE_P (httpd_header_gzip); #ifdef MIME_SUPPORT PASTE_PF (PSTR ("Content-Type: %S\n\n"), httpd_mimetype_detect (buf)); PASTE_SEND (); return; #endif /* MIME_SUPPORT */ #ifndef VFS_TEENSY no_gzip: #endif /* not VFS_TEENSY, inlined files are always gzip'd */ if (STATE->u.vfs.content_type == 'X') PASTE_P (httpd_header_ct_xhtml); else if (STATE->u.vfs.content_type == 'S') PASTE_P (httpd_header_ct_css); else PASTE_P (httpd_header_ct_html); PASTE_SEND (); }