static List *push_headers_create(size_t content_len) { List *push_headers; Octstr *mos; mos = NULL; push_headers = http_create_empty_headers(); if (use_hardcoded) http_header_add(push_headers, "Content-Type", "multipart/related;" " boundary=asdlfkjiurwgasf; type=\"application/xml\""); else http_header_add(push_headers, "Content-Type", octstr_get_cstr(mos = make_multipart_value(boundary))); if (use_headers) http_add_basic_auth(push_headers, username, password); add_push_application_id(&push_headers, appid_flag, use_string); add_connection_header(&push_headers, connection); if (use_dlr_mask) add_dlr_mask(&push_headers, dlr_mask); if (use_dlr_url) add_dlr_url(&push_headers, dlr_url); octstr_destroy(mos); /* add initiator... */ if (initiator_uri) http_header_add(push_headers, "X-Wap-Initiator-URI", octstr_get_cstr(initiator_uri)); return push_headers; }
static Octstr *push_content_create(void) { Octstr *push_content, *wap_content; Octstr *wap_file_content, *pap_content, *pap_file_content, *bpos, *bcos; wap_content = NULL; push_content = NULL; if (use_hardcoded) { push_content = octstr_create("\r\n\r\n" "--asdlfkjiurwgasf\r\n" "Content-Type: application/xml\r\n\r\n" "<?xml version=\"1.0\"?>" "<!DOCTYPE pap PUBLIC \"-//WAPFORUM//DTD PAP//EN\"" " \"http://www.wapforum.org/DTD/pap_1.0.dtd\">" "<pap>" "<push-message push-id=\"[email protected]\"" " deliver-before-timestamp=\"2002-11-01T06:45:00Z\"" " deliver-after-timestamp=\"2000-02-27T06:45:00Z\"" " progress-notes-requested=\"false\">" "<address address-value=\"WAPPUSH=+358408676001/" "[email protected]\">" "</address>" "<quality-of-service" " priority=\"low\"" " delivery-method=\"unconfirmed\"" " network-required=\"true\"" " network=\"GSM\"" " bearer-required=\"true\"" " bearer=\"SMS\">" "</quality-of-service>" "</push-message>" "</pap>\r\n\r\n" "--asdlfkjiurwgasf\r\n" "Content-Type: text/vnd.wap.si\r\n\r\n" "<?xml version=\"1.0\"?>" "<!DOCTYPE si PUBLIC \"-//WAPFORUM//DTD SI 1.0//EN\" " " \"http://www.wapforum.org/DTD/si.dtd\">" "<si>" "<indication href=\"http://wap.iobox.fi\"" " si-id=\"[email protected]\"" " action=\"signal-high\"" " created=\"1999-06-25T15:23:15Z\"" " si-expires=\"2002-12-30T00:00:00Z\">" "Want to test a fetch?" "</indication>" "</si>\r\n\r\n" "--asdlfkjiurwgasf--\r\n\r\n" ""); } else { add_push_application_id(appid_flag, &wap_content, use_string); add_content_type(content_flag, &wap_content); add_content_transfer_encoding_type(content_transfer_encoding, wap_content); add_part_header(content_header, &wap_content); /* Read the content file. (To be pushed)*/ if ((wap_file_content = octstr_read_file(octstr_get_cstr(content_file))) == NULL) panic(0, "Stopping"); if (accept_binary) { octstr_delete_matching(wap_file_content, octstr_imm(" ")); octstr_delete_matching(wap_file_content, octstr_imm("\n")); octstr_delete_matching(wap_file_content, octstr_imm("\r")); if (!octstr_is_all_hex(wap_file_content)) panic(0, "non-hex chars in the content file, cannot continue"); octstr_hex_to_binary(wap_file_content); } transfer_encode(content_transfer_encoding, wap_file_content); octstr_append(wap_content, wap_file_content); octstr_destroy(wap_file_content); /* Read the control file. (To control pushing)*/ pap_content = octstr_format("%s", "Content-Type: application/xml"); add_delimiter(&pap_content); add_delimiter(&pap_content); if ((pap_file_content = octstr_read_file(octstr_get_cstr(pap_file))) == NULL) panic(0, "Stopping"); octstr_append(pap_content, pap_file_content); octstr_destroy(pap_file_content); if (wap_content == NULL || pap_content == NULL) panic(0, "Cannot open the push content files"); push_content = octstr_create(""); if (add_preamble) octstr_append(push_content, octstr_imm("the parser should discard this")); octstr_append(push_content, bpos = make_part_delimiter(octstr_imm(boundary))); /*octstr_append(push_content, octstr_imm("\r\n"));*/ /* Do we accept an additional * clrf ? */ octstr_append(push_content, pap_content); octstr_append(push_content, bpos); octstr_destroy(bpos); octstr_append(push_content, wap_content); octstr_append(push_content, bcos = make_close_delimiter(octstr_imm(boundary))); if (add_epilogue) { octstr_append(push_content, octstr_imm("\r\n")); octstr_append(push_content, octstr_imm("the parser should discard this")); } octstr_destroy(bcos); octstr_destroy(pap_content); octstr_destroy(wap_content); } return push_content; }