Re: Help: memory leak of kannel1.2.0
"Guanghua Hou" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Dear sir,
The attached is the log file, test_ppg.c and two xml files.
The envoirment is: Solaris8.
I have modified the test_ppg.c. Running like:
"test_ppg -i 2 -r 999999 -t 4 -a sia http://172.16.104.67:8080/cgi-bin/wap-push.cgi
ppg_content.xml ppg_control.xml"
The memory leak of 'wapbox' is almost 8k bytes per minutes. The 'TOP" tool is used to monitor the memory of process.
Best Regards,
Guanghua Hou
----- Original Message -----
From: "Stipe Tolj" <[email protected]>
To: "Guanghua Hou" <[email protected]>
Sent: Wednesday, August 28, 2002 4:37 PM
Subject: Re: Help: memory leak of kannel1.2.0
> > When I test PPG (kannel1.2.0) using 'test_ppg' tools, I find that memory leak is serious.
> > Would you pls tell me how to solve it? or When will you overcome it?
>
> I guess you will tell us a bit more about the szenario where it's used
> and maybe some log snips would help too.
>
> Stipe
>
> [email protected]
> -------------------------------------------------------------------
> Wapme Systems AG
>
> Vogelsanger Weg 80
> 40470 Düsseldorf
>
> Tel: +49-211-74845-0
> Fax: +49-211-74845-299
>
> E-Mail: [email protected]
> Internet: http://www.wapme-systems.de
> -------------------------------------------------------------------
> wapme.net - wherever you are
wapbox.log
(application/octet-stream, 17.5 KB)
2002-08-29 10:02:32 [0] INFO: Added logfile `/tmp/wapbox.log' with level `0'. 2002-08-29 10:02:32 [0] INFO: Starting to log to file /tmp/wapbox.log level 0 2002-08-29 10:02:32 [0] DEBUG: syslog parameter is none 2002-08-29 10:02:32 [0] DEBUG: map_url_max = -1 2002-08-29 10:02:32 [0] DEBUG: Kannel wapbox version `1.2.0'. System SunOS, release 5.8, version Generic_108528-11, machine sun4u. Hostname wapgw, IP 172.16.104.67. Libxml version 20310. Using native malloc. 2002-08-29 10:02:32 [0] INFO: ------------------------------------------------------------ 2002-08-29 10:02:32 [0] INFO: Kannel wapbox version 1.2.0 starting up. 2002-08-29 10:02:32 [0] DEBUG: Started thread 1 (wap/wsp_session.c:main_thread) 2002-08-29 10:02:32 [0] DEBUG: Started thread 2 (wap/wsp_unit.c:main_thread) 2002-08-29 10:02:32 [0] DEBUG: Started thread 3 (wap/wsp_push_client.c:main_thread) 2002-08-29 10:02:32 [0] DEBUG: Started thread 4 (wap/timers.c:watch_timers) 2002-08-29 10:02:32 [0] DEBUG: Started thread 5 (wap/wtp_init.c:main_thread) 2002-08-29 10:02:32 [0] DEBUG: Started thread 6 (wap/wtp_resp.c:main_thread) 2002-08-29 10:02:32 [0] DEBUG: Started thread 7 (gw/wap-appl.c:main_thread) 2002-08-29 10:02:32 [0] DEBUG: Started thread 8 (gw/wap-appl.c:return_replies_thread) 2002-08-29 10:02:32 [0] DEBUG: Started thread 9 (gw/wap_push_ota.c:main_thread) 2002-08-29 10:02:32 [0] DEBUG: Started thread 10 (gwlib/fdset.c:poller) 2002-08-29 10:02:32 [0] DEBUG: Started thread 11 (gwlib/http.c:write_request_thread) 2002-08-29 10:02:32 [11] ERROR: connect failed 2002-08-29 10:02:32 [11] ERROR: System error 146: Connection refused 2002-08-29 10:02:32 [11] ERROR: error connecting to server `localhost' at port `8082' 2002-08-29 10:02:32 [11] DEBUG: HTTP: Opening connection to `localhost:8082' (fd=0). 2002-08-29 10:02:32 [11] ERROR: Couldn't send request to <http://localhost:8082/whitelist> 2002-08-29 10:02:32 [0] ERROR: Cannot load numhash! 2002-08-29 10:02:32 [11] ERROR: connect failed 2002-08-29 10:02:32 [11] ERROR: System error 146: Connection refused 2002-08-29 10:02:32 [11] ERROR: error connecting to server `localhost' at port `8082' 2002-08-29 10:02:32 [11] DEBUG: HTTP: Opening connection to `localhost:8082' (fd=0). 2002-08-29 10:02:32 [11] ERROR: Couldn't send request to <http://localhost:8082/blacklist> 2002-08-29 10:02:32 [0] ERROR: Cannot load numhash! 2002-08-29 10:02:32 [0] DEBUG: HTTP: Opening server at port 8080. 2002-08-29 10:02:32 [0] DEBUG: Started thread 12 (gwlib/fdset.c:poller) 2002-08-29 10:02:32 [0] DEBUG: Started thread 13 (gwlib/http.c:server_thread) 2002-08-29 10:02:32 [0] DEBUG: Started thread 14 (gw/wap_push_ppg.c:ota_read_thread) 2002-08-29 10:02:32 [0] DEBUG: Started thread 15 (gw/wap_push_ppg.c:http_read_thread) 2002-08-29 10:02:32 [0] DEBUG: Started thread 16 (gw/wap_push_ppg.c:pap_request_thread) 2002-08-29 10:02:32 [0] INFO: Connected to bearerbox at localhost port 13002. 2002-08-29 10:02:32 [0] DEBUG: Started thread 17 (gw/heartbeat.c:heartbeat_thread) 2002-08-29 10:02:39 [13] DEBUG: HTTP: Creating HTTPClient for `172.16.104.67'. 2002-08-29 10:02:45 [13] DEBUG: HTTP: Creating HTTPClient for `172.16.104.67'. 2002-08-29 10:02:45 [16] INFO: PPG: Accept request </cgi-bin/wap-push.cgi> from <172.16.104.67> 2002-08-29 10:02:45 [16] DEBUG: PPG: http_read_thread: pap multipart accepted 2002-08-29 10:02:45 [16] INFO: client address was <+057122222>, accepted 2002-08-29 10:02:45 [16] DEBUG: PAP COMPILER: doing semantic analysis for address type a phone number 2002-08-29 10:02:45 [16] DEBUG: using defaults instead of anys 2002-08-29 10:02:45 [16] DEBUG: PPG: http_read_thread: pap control entity compiled ok 2002-08-29 10:02:45 [16] DEBUG: PPG: transform_message: push message content and headers valid 2002-08-29 10:02:45 [16] DEBUG: PPG: push machine 0 created 2002-08-29 10:02:45 [16] DEBUG: PPG: store_push_data: push machine 0 appended to unit push list 2002-08-29 10:02:45 [16] DEBUG: PPG: send_push_response: telling pi 2002-08-29 10:02:45 [16] DEBUG: HTTP: Resetting HTTPClient for `172.16.104.67'. 2002-08-29 10:02:45 [16] INFO: PPG: handle_push_message: push message accepted for processing 2002-08-29 10:02:45 [16] DEBUG: PPG: OTA request for unit push 2002-08-29 10:02:45 [16] INFO: PPG: unconfirmed push delivered to OTA 2002-08-29 10:02:45 [16] DEBUG: PPG: destroying push machine 0 2002-08-29 10:02:45 [9] DEBUG: OTA: event arrived 2002-08-29 10:02:45 [9] DEBUG: OTA: made connectionless session service request 2002-08-29 10:02:45 [2] DEBUG: WSP_UNIT: Connectionless push accepted 2002-08-29 10:02:45 [2] DEBUG: WSP_UNIT: delivering to wdp 2002-08-29 10:02:51 [16] INFO: PPG: Accept request </cgi-bin/wap-push.cgi> from <172.16.104.67> 2002-08-29 10:02:51 [16] DEBUG: PPG: http_read_thread: pap multipart accepted 2002-08-29 10:02:51 [16] INFO: client address was <+057122222>, accepted 2002-08-29 10:02:51 [16] DEBUG: PAP COMPILER: doing semantic analysis for address type a phone number 2002-08-29 10:02:51 [16] DEBUG: using defaults instead of anys 2002-08-29 10:02:51 [16] DEBUG: PPG: http_read_thread: pap control entity compiled ok 2002-08-29 10:02:51 [16] DEBUG: PPG: transform_message: push message content and headers valid 2002-08-29 10:02:51 [16] DEBUG: PPG: push machine 1 created 2002-08-29 10:02:51 [16] DEBUG: PPG: store_push_data: push machine 1 appended to unit push list 2002-08-29 10:02:51 [16] DEBUG: PPG: send_push_response: telling pi 2002-08-29 10:02:51 [16] DEBUG: HTTP: Resetting HTTPClient for `172.16.104.67'. 2002-08-29 10:02:51 [16] INFO: PPG: handle_push_message: push message accepted for processing 2002-08-29 10:02:51 [16] DEBUG: PPG: OTA request for unit push 2002-08-29 10:02:51 [16] INFO: PPG: unconfirmed push delivered to OTA 2002-08-29 10:02:51 [16] DEBUG: PPG: destroying push machine 1 2002-08-29 10:02:51 [9] DEBUG: OTA: event arrived 2002-08-29 10:02:51 [9] DEBUG: OTA: made connectionless session service request 2002-08-29 10:02:51 [2] DEBUG: WSP_UNIT: Connectionless push accepted 2002-08-29 10:02:51 [2] DEBUG: WSP_UNIT: delivering to wdp 2002-08-29 10:02:53 [16] INFO: PPG: Accept request </cgi-bin/wap-push.cgi> from <172.16.104.67> 2002-08-29 10:02:53 [16] DEBUG: PPG: http_read_thread: pap multipart accepted 2002-08-29 10:02:53 [16] INFO: client address was <+057122222>, accepted 2002-08-29 10:02:53 [16] DEBUG: PAP COMPILER: doing semantic analysis for address type a phone number 2002-08-29 10:02:53 [16] DEBUG: using defaults instead of anys 2002-08-29 10:02:53 [16] DEBUG: PPG: http_read_thread: pap control entity compiled ok 2002-08-29 10:02:53 [16] DEBUG: PPG: transform_message: push message content and headers valid 2002-08-29 10:02:53 [16] DEBUG: PPG: push machine 2 created 2002-08-29 10:02:53 [16] DEBUG: PPG: store_push_data: push machine 2 appended to unit push list 2002-08-29 10:02:53 [13] DEBUG: HTTP: Creating HTTPClient for `172.16.104.67'. 2002-08-29 10:02:53 [16] DEBUG: PPG: send_push_response: telling pi 2002-08-29 10:02:53 [16] DEBUG: HTTP: Resetting HTTPClient for `172.16.104.67'. 2002-08-29 10:02:53 [16] INFO: PPG: handle_push_message: push message accepted for processing 2002-08-29 10:02:53 [9] DEBUG: OTA: event arrived 2002-08-29 10:02:53 [9] DEBUG: OTA: made connectionless session service request 2002-08-29 10:02:53 [2] DEBUG: WSP_UNIT: Connectionless push accepted 2002-08-29 10:02:53 [2] DEBUG: WSP_UNIT: delivering to wdp 2002-08-29 10:02:53 [16] DEBUG: PPG: OTA request for unit push 2002-08-29 10:02:53 [16] INFO: PPG: unconfirmed push delivered to OTA 2002-08-29 10:02:53 [16] DEBUG: PPG: destroying push machine 2 2002-08-29 10:02:58 [16] INFO: PPG: Accept request </cgi-bin/wap-push.cgi> from <172.16.104.67> 2002-08-29 10:02:58 [16] DEBUG: PPG: http_read_thread: pap multipart accepted 2002-08-29 10:02:58 [16] INFO: client address was <+057122222>, accepted 2002-08-29 10:02:58 [16] DEBUG: PAP COMPILER: doing semantic analysis for address type a phone number 2002-08-29 10:02:58 [16] DEBUG: using defaults instead of anys 2002-08-29 10:02:58 [16] DEBUG: PPG: http_read_thread: pap control entity compiled ok 2002-08-29 10:02:58 [16] DEBUG: PPG: transform_message: push message content and headers valid 2002-08-29 10:02:58 [16] DEBUG: PPG: push machine 3 created 2002-08-29 10:02:58 [16] DEBUG: PPG: store_push_data: push machine 3 appended to unit push list 2002-08-29 10:02:58 [16] DEBUG: PPG: send_push_response: telling pi 2002-08-29 10:02:58 [16] DEBUG: HTTP: Resetting HTTPClient for `172.16.104.67'. 2002-08-29 10:02:58 [16] INFO: PPG: handle_push_message: push message accepted for processing 2002-08-29 10:02:58 [9] DEBUG: OTA: event arrived 2002-08-29 10:02:58 [9] DEBUG: OTA: made connectionless session service request 2002-08-29 10:02:58 [2] DEBUG: WSP_UNIT: Connectionless push accepted 2002-08-29 10:02:58 [2] DEBUG: WSP_UNIT: delivering to wdp 2002-08-29 10:02:58 [16] DEBUG: PPG: OTA request for unit push 2002-08-29 10:02:58 [16] INFO: PPG: unconfirmed push delivered to OTA 2002-08-29 10:02:58 [16] DEBUG: PPG: destroying push machine 3 2002-08-29 10:03:01 [16] INFO: PPG: Accept request </cgi-bin/wap-push.cgi> from <172.16.104.67> 2002-08-29 10:03:01 [16] DEBUG: PPG: http_read_thread: pap multipart accepted 2002-08-29 10:03:01 [16] INFO: client address was <+057122222>, accepted 2002-08-29 10:03:01 [16] DEBUG: PAP COMPILER: doing semantic analysis for address type a phone number 2002-08-29 10:03:01 [16] DEBUG: using defaults instead of anys 2002-08-29 10:03:01 [16] DEBUG: PPG: http_read_thread: pap control entity compiled ok 2002-08-29 10:03:01 [16] DEBUG: PPG: transform_message: push message content and headers valid 2002-08-29 10:03:01 [16] DEBUG: PPG: push machine 4 created 2002-08-29 10:03:01 [16] DEBUG: PPG: store_push_data: push machine 4 appended to unit push list 2002-08-29 10:03:01 [16] DEBUG: PPG: send_push_response: telling pi 2002-08-29 10:03:01 [16] DEBUG: HTTP: Resetting HTTPClient for `172.16.104.67'. 2002-08-29 10:03:01 [16] INFO: PPG: handle_push_message: push message accepted for processing 2002-08-29 10:03:01 [9] DEBUG: OTA: event arrived 2002-08-29 10:03:01 [9] DEBUG: OTA: made connectionless session service request 2002-08-29 10:03:01 [2] DEBUG: WSP_UNIT: Connectionless push accepted 2002-08-29 10:03:01 [2] DEBUG: WSP_UNIT: delivering to wdp 2002-08-29 10:03:01 [16] DEBUG: PPG: OTA request for unit push 2002-08-29 10:03:01 [16] INFO: PPG: unconfirmed push delivered to OTA 2002-08-29 10:03:01 [16] DEBUG: PPG: destroying push machine 4 2002-08-29 10:03:05 [16] INFO: PPG: Accept request </cgi-bin/wap-push.cgi> from <172.16.104.67> 2002-08-29 10:03:05 [16] DEBUG: PPG: http_read_thread: pap multipart accepted 2002-08-29 10:03:05 [16] INFO: client address was <+057122222>, accepted 2002-08-29 10:03:05 [16] DEBUG: PAP COMPILER: doing semantic analysis for address type a phone number 2002-08-29 10:03:05 [16] DEBUG: using defaults instead of anys 2002-08-29 10:03:05 [16] DEBUG: PPG: http_read_thread: pap control entity compiled ok 2002-08-29 10:03:05 [16] DEBUG: PPG: transform_message: push message content and headers valid 2002-08-29 10:03:05 [16] DEBUG: PPG: push machine 5 created 2002-08-29 10:03:05 [16] DEBUG: PPG: store_push_data: push machine 5 appended to unit push list 2002-08-29 10:03:05 [16] DEBUG: PPG: send_push_response: telling pi 2002-08-29 10:03:05 [16] DEBUG: HTTP: Resetting HTTPClient for `172.16.104.67'. 2002-08-29 10:03:05 [16] INFO: PPG: handle_push_message: push message accepted for processing 2002-08-29 10:03:05 [9] DEBUG: OTA: event arrived 2002-08-29 10:03:05 [9] DEBUG: OTA: made connectionless session service request 2002-08-29 10:03:05 [2] DEBUG: WSP_UNIT: Connectionless push accepted 2002-08-29 10:03:05 [2] DEBUG: WSP_UNIT: delivering to wdp 2002-08-29 10:03:05 [16] DEBUG: PPG: OTA request for unit push 2002-08-29 10:03:05 [16] INFO: PPG: unconfirmed push delivered to OTA 2002-08-29 10:03:05 [16] DEBUG: PPG: destroying push machine 5 2002-08-29 10:03:12 [16] INFO: PPG: Accept request </cgi-bin/wap-push.cgi> from <172.16.104.67> 2002-08-29 10:03:12 [16] DEBUG: PPG: http_read_thread: pap multipart accepted 2002-08-29 10:03:12 [16] INFO: client address was <+057122222>, accepted 2002-08-29 10:03:12 [16] DEBUG: PAP COMPILER: doing semantic analysis for address type a phone number 2002-08-29 10:03:12 [16] DEBUG: using defaults instead of anys 2002-08-29 10:03:12 [16] DEBUG: PPG: http_read_thread: pap control entity compiled ok 2002-08-29 10:03:12 [16] DEBUG: PPG: transform_message: push message content and headers valid 2002-08-29 10:03:12 [16] DEBUG: PPG: push machine 6 created 2002-08-29 10:03:12 [16] DEBUG: PPG: store_push_data: push machine 6 appended to unit push list 2002-08-29 10:03:12 [16] DEBUG: PPG: send_push_response: telling pi 2002-08-29 10:03:12 [16] DEBUG: HTTP: Resetting HTTPClient for `172.16.104.67'. 2002-08-29 10:03:12 [16] INFO: PPG: handle_push_message: push message accepted for processing 2002-08-29 10:03:12 [9] DEBUG: OTA: event arrived 2002-08-29 10:03:12 [9] DEBUG: OTA: made connectionless session service request 2002-08-29 10:03:12 [2] DEBUG: WSP_UNIT: Connectionless push accepted 2002-08-29 10:03:12 [2] DEBUG: WSP_UNIT: delivering to wdp 2002-08-29 10:03:12 [16] DEBUG: PPG: OTA request for unit push 2002-08-29 10:03:12 [16] INFO: PPG: unconfirmed push delivered to OTA 2002-08-29 10:03:12 [16] DEBUG: PPG: destroying push machine 6 2002-08-29 10:03:15 [16] INFO: PPG: Accept request </cgi-bin/wap-push.cgi> from <172.16.104.67> 2002-08-29 10:03:15 [16] DEBUG: PPG: http_read_thread: pap multipart accepted 2002-08-29 10:03:15 [16] INFO: client address was <+057122222>, accepted 2002-08-29 10:03:15 [16] DEBUG: PAP COMPILER: doing semantic analysis for address type a phone number 2002-08-29 10:03:15 [16] DEBUG: using defaults instead of anys 2002-08-29 10:03:15 [16] DEBUG: PPG: http_read_thread: pap control entity compiled ok 2002-08-29 10:03:15 [16] DEBUG: PPG: transform_message: push message content and headers valid 2002-08-29 10:03:15 [16] DEBUG: PPG: push machine 7 created 2002-08-29 10:03:15 [16] DEBUG: PPG: store_push_data: push machine 7 appended to unit push list 2002-08-29 10:03:15 [16] DEBUG: PPG: send_push_response: telling pi 2002-08-29 10:03:15 [16] DEBUG: HTTP: Resetting HTTPClient for `172.16.104.67'. 2002-08-29 10:03:15 [16] INFO: PPG: handle_push_message: push message accepted for processing 2002-08-29 10:03:15 [9] DEBUG: OTA: event arrived 2002-08-29 10:03:15 [9] DEBUG: OTA: made connectionless session service request 2002-08-29 10:03:15 [2] DEBUG: WSP_UNIT: Connectionless push accepted 2002-08-29 10:03:15 [2] DEBUG: WSP_UNIT: delivering to wdp 2002-08-29 10:03:15 [16] DEBUG: PPG: OTA request for unit push 2002-08-29 10:03:15 [16] INFO: PPG: unconfirmed push delivered to OTA 2002-08-29 10:03:15 [16] DEBUG: PPG: destroying push machine 7 2002-08-29 10:03:18 [0] ERROR: SIGINT received, let's die. 2002-08-29 10:03:18 [0] INFO: Kannel wapbox terminating. 2002-08-29 10:03:18 [17] DEBUG: Thread 17 (gw/heartbeat.c:heartbeat_thread) terminates. 2002-08-29 10:03:18 [0] DEBUG: Waiting for 5 (wap/wtp_init.c:main_thread) to terminate 2002-08-29 10:03:18 [5] DEBUG: Thread 5 (wap/wtp_init.c:main_thread) terminates. 2002-08-29 10:03:18 [0] DEBUG: wtp_initiator_shutdown: 0 init_machines left 2002-08-29 10:03:18 [0] DEBUG: Waiting for 6 (wap/wtp_resp.c:main_thread) to terminate 2002-08-29 10:03:18 [6] DEBUG: Thread 6 (wap/wtp_resp.c:main_thread) terminates. 2002-08-29 10:03:18 [0] DEBUG: wtp_resp_shutdown: 0 resp_machines left 2002-08-29 10:03:18 [0] DEBUG: 0 items left in the tid cache 2002-08-29 10:03:18 [4] DEBUG: Thread 4 (wap/timers.c:watch_timers) terminates. 2002-08-29 10:03:18 [0] DEBUG: Waiting for 3 (wap/wsp_push_client.c:main_thread) to terminate 2002-08-29 10:03:18 [3] DEBUG: Thread 3 (wap/wsp_push_client.c:main_thread) terminates. 2002-08-29 10:03:18 [0] DEBUG: wsp_push_client_shutdown: 0 push client machinesleft 2002-08-29 10:03:18 [0] DEBUG: Waiting for 2 (wap/wsp_unit.c:main_thread) to terminate 2002-08-29 10:03:18 [2] DEBUG: Thread 2 (wap/wsp_unit.c:main_thread) terminates. 2002-08-29 10:03:18 [0] DEBUG: Waiting for 1 (wap/wsp_session.c:main_thread) to terminate 2002-08-29 10:03:18 [1] DEBUG: Thread 1 (wap/wsp_session.c:main_thread) terminates. 2002-08-29 10:03:18 [0] DEBUG: WSP: 0 session machines left. 2002-08-29 10:03:18 [0] DEBUG: Waiting for 7 (gw/wap-appl.c:main_thread) to terminate 2002-08-29 10:03:18 [7] DEBUG: Thread 7 (gw/wap-appl.c:main_thread) terminates. 2002-08-29 10:03:18 [0] DEBUG: Waiting for 8 (gw/wap-appl.c:return_replies_thread) to terminate 2002-08-29 10:03:18 [8] DEBUG: Thread 8 (gw/wap-appl.c:return_replies_thread) terminates. 2002-08-29 10:03:18 [0] DEBUG: Waiting for 9 (gw/wap_push_ota.c:main_thread) to terminate 2002-08-29 10:03:18 [9] DEBUG: Thread 9 (gw/wap_push_ota.c:main_thread) terminates. 2002-08-29 10:03:18 [0] DEBUG: Waiting for 13 (gwlib/http.c:server_thread) to terminate 2002-08-29 10:03:18 [14] DEBUG: Thread 14 (gw/wap_push_ppg.c:ota_read_thread) terminates. 2002-08-29 10:03:18 [16] DEBUG: Thread 16 (gw/wap_push_ppg.c:pap_request_thread) terminates. 2002-08-29 10:03:18 [15] DEBUG: HTTP: No clients with requests, quitting. 2002-08-29 10:03:18 [15] DEBUG: Thread 15 (gw/wap_push_ppg.c:http_read_thread) terminates. 2002-08-29 10:03:18 [13] DEBUG: Thread 13 (gwlib/http.c:server_thread) terminates. 2002-08-29 10:03:18 [12] WARNING: Destroying fdset with 3 active entries. 2002-08-29 10:03:18 [12] DEBUG: Thread 12 (gwlib/fdset.c:poller) terminates. 2002-08-29 10:03:18 [0] DEBUG: PPG: 0 push session machines left. 2002-08-29 10:03:18 [0] DEBUG: PPG: 0 unit pushes left 2002-08-29 10:03:18 [0] DEBUG: Waiting for 11 (gwlib/http.c:write_request_thread) to terminate 2002-08-29 10:03:18 [11] DEBUG: Thread 11 (gwlib/http.c:write_request_thread) terminates. 2002-08-29 10:03:18 [10] DEBUG: Thread 10 (gwlib/fdset.c:poller) terminates. 2002-08-29 10:03:18 [0] DEBUG: Immutable octet strings: 586.
test_ppg.c
(application/octet-stream, 26.9 KB)
/*
* A very simple push initiator for testing a push proxy gateway
*
* Read pap control content and push content from files, pack them into a PAP
* protocol MIME message and invoke push services specified by an url. Use a
* hardcoded message boundary (asdlfkjiurwgasf), for simpler command line
* interface.
* Repetitions and use of multiple threads can be requested, in addition of
* setting of some headers.
*
* By Aarno Syvänen for Wiral Ltd
*/
#define MAX_THREADS 1024
#define MAX_IN_QUEUE 128
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "gwlib/gwlib.h"
#include "gw/wap_push_pap_compiler.h"
static long max_pushes = 1;
static int verbose = 1,
use_hardcoded = 0,
num_urls = 0,
wait = 0,
use_headers = 0,
use_config = 0;
static double wait_seconds = 0.0;
static Counter *counter = NULL;
static char **push_data = NULL;
static char *boundary = NULL;
static Octstr *content_flag = NULL;
static Octstr *appid_flag = NULL;
static Octstr *content_transfer_encoding = NULL;
static Octstr *connection = NULL;
enum { SSL_CONNECTION_OFF = 0,
DEFAULT_NUMBER_OF_RELOGS = 2};
/*
* Configuration variables
*/
static int pi_ssl = SSL_CONNECTION_OFF;
static long retries = DEFAULT_NUMBER_OF_RELOGS;
static Octstr *ssl_client_certkey_file = NULL;
static Octstr *push_url = NULL;
static Octstr *pap_file = NULL;
static Octstr *content_file = NULL;
static Octstr *username = NULL;
static Octstr *password = NULL;
static void read_test_ppg_config(Octstr *name)
{
Cfg *cfg;
CfgGroup *grp;
cfg = cfg_create(name);
if (cfg_read(cfg) == -1)
panic(0, "Cannot read a configuration file %s, exiting",
octstr_get_cstr(name));
cfg_dump(cfg);
grp = cfg_get_single_group(cfg, octstr_imm("test-ppg"));
cfg_get_integer(&retries, grp, octstr_imm("retries"));
cfg_get_bool(&pi_ssl, grp, octstr_imm("pi-ssl"));
#ifdef HAVE_LIBSSL
if (pi_ssl) {
ssl_client_certkey_file = cfg_get(grp,
octstr_imm("ssl-client-certkey-file"));
if (ssl_client_certkey_file != NULL) {
use_global_client_certkey_file(ssl_client_certkey_file);
} else {
error(0, "cannot set up SSL without client certkey file");
exit(1);
}
}
#endif
grp = cfg_get_single_group(cfg, octstr_imm("configuration"));
push_url = cfg_get(grp, octstr_imm("push-url"));
pap_file = cfg_get(grp, octstr_imm("pap-file"));
content_file = cfg_get(grp, octstr_imm("content-file"));
if (!use_hardcoded) {
username = cfg_get(grp, octstr_imm("username"));
password = cfg_get(grp, octstr_imm("password"));
}
cfg_destroy(cfg);
}
static void add_push_application_id(List **push_headers, Octstr *appid_flag)
{
if (octstr_compare(appid_flag, octstr_imm("any")) == 0)
http_header_add(*push_headers, "X-WAP-Application-Id",
"http://www.wiral.com:*");
else if (octstr_compare(appid_flag, octstr_imm("sia")) == 0)
http_header_add(*push_headers, "X-WAP-Application-Id",
"http://www.wiral.com:push.sia");
else if (octstr_compare(appid_flag, octstr_imm("ua")) == 0)
http_header_add(*push_headers, "X-WAP-Application-Id",
"http://www.wiral.com:wml.ua");
else if (octstr_compare(appid_flag, octstr_imm("mms")) == 0)
http_header_add(*push_headers, "X-WAP-Application-Id",
"http://www.wiral.com:mms.ua");
else if (octstr_compare(appid_flag, octstr_imm("scrap")) == 0)
http_header_add(*push_headers, "X-WAP-Application-Id",
"no appid at all");
}
static void add_content_type(Octstr *content_flag, Octstr **wap_content)
{
if (octstr_compare(content_flag, octstr_imm("wml")) == 0)
*wap_content = octstr_format("%s",
"Content-Type: text/vnd.wap.wml\r\n");
else if (octstr_compare(content_flag, octstr_imm("si")) == 0)
*wap_content = octstr_format("%s",
"Content-Type: text/vnd.wap.si\r\n");
else if (octstr_compare(content_flag, octstr_imm("sl")) == 0)
*wap_content = octstr_format("%s",
"Content-Type: text/vnd.wap.sl\r\n");
else if (octstr_compare(content_flag, octstr_imm("multipart")) == 0)
*wap_content = octstr_format("%s",
"Content-Type: multipart/related; boundary=fsahgwruijkfldsa\r\n");
else if (octstr_compare(content_flag, octstr_imm("sia")) == 0)
*wap_content = octstr_format("%s",
"Content-Type: application/vnd.wap.sia\r\n");
else if (octstr_compare(content_flag, octstr_imm("mms")) == 0)
*wap_content = octstr_format("%s",
"Content-Type: application/vnd.wap.mms-message\r\n");
else if (octstr_compare(content_flag, octstr_imm("scrap")) == 0)
*wap_content = octstr_format("%s", "no type at all\r\n");
else if (octstr_compare(content_flag, octstr_imm("nil")) == 0)
*wap_content = octstr_create("");
}
static void add_content_transfer_encoding_type(Octstr *content_flag,
Octstr *wap_content)
{
if (!content_flag)
return;
if (octstr_compare(content_flag, octstr_imm("base64")) == 0)
octstr_append_cstr(wap_content, "Content-transfer-encoding: base64\r\n");
}
static void add_connection_header(Octstr *connection, Octstr *wap_content)
{
if (!connection)
return;
if (octstr_compare(connection, octstr_imm("close")) == 0)
octstr_format_append(wap_content, "%s", "Connection: close\r\n");
else if (octstr_compare(connection, octstr_imm("keep-alive")) == 0)
octstr_format_append(wap_content, "%s", "Connection: keep-alive\r\n");
}
static void transfer_encode (Octstr *cte, Octstr *content)
{
if (!cte)
return;
if (octstr_compare(cte, octstr_imm("base64")) == 0) {
octstr_binary_to_base64(content);
}
}
/*
* Add boundary value to the multipart header.
*/
static Octstr *make_multipart_value(const char *boundary)
{
Octstr *hos;
hos = octstr_format("%s", "multipart/related; boundary=");
octstr_append(hos, octstr_imm(boundary));
octstr_append(hos, octstr_imm("; type=\"application/xml\""));
return hos;
}
static Octstr *make_part_delimiter(Octstr *boundary)
{
Octstr *part_delimiter;
part_delimiter = octstr_create("");
octstr_format_append(part_delimiter, "%c", '\r');
octstr_format_append(part_delimiter, "%c", '\n');
octstr_format_append(part_delimiter, "%s", "--");
octstr_append(part_delimiter, boundary);
octstr_format_append(part_delimiter, "%c", '\r');
octstr_format_append(part_delimiter, "%c", '\n');
return part_delimiter;
}
static Octstr *make_close_delimiter(Octstr *boundary)
{
Octstr *close_delimiter;
close_delimiter = octstr_create("");
octstr_format_append(close_delimiter, "%c", '\r');
octstr_format_append(close_delimiter, "%c", '\n');
octstr_format_append(close_delimiter, "%s", "--");
octstr_append(close_delimiter, boundary);
octstr_format_append(close_delimiter, "%s", "--");
octstr_format_append(close_delimiter, "%c", '\r');
octstr_format_append(close_delimiter, "%c", '\n');
return close_delimiter;
}
static List *push_headers_create(size_t content_len)
{
List *push_headers;
Octstr *cos,
*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);
http_header_add(push_headers, "Content-Length: ",
octstr_get_cstr(cos = octstr_format("%d", content_len)));
octstr_destroy(cos);
octstr_destroy(mos);
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;
/**zhl add*********************/
int pos;
int tempi;
char ctemp;
/*****************/
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-06-30T00:00:00Z\">"
"Want to test a fetch?"
"</indication>"
"</si>\r\n\r\n"
"--asdlfkjiurwgasf--\r\n\r\n"
"");
}
else
{
add_content_type(content_flag, &wap_content);
add_content_transfer_encoding_type(content_transfer_encoding,
wap_content);
add_connection_header(connection, wap_content);
if ((wap_file_content =
octstr_read_file(octstr_get_cstr(content_file))) == NULL)
panic(0, "Stopping");
transfer_encode (content_transfer_encoding, wap_file_content);
octstr_append(wap_content, wap_file_content);
octstr_destroy(wap_file_content);
pap_content = octstr_format("%s", "Content-Type: application/xml\r\n");
if ((pap_file_content =
octstr_read_file(octstr_get_cstr(pap_file))) == NULL)
panic(0, "Stopping");
/****zhl add*************/
pos=octstr_search(pap_file_content, octstr_imm("@pi.com"), 0);
for(tempi=0;tempi<4;tempi++)
{
ctemp=random()%9+49;
octstr_set_char(pap_file_content,pos-tempi,ctemp);
}
printf("****pushidpos =%d********\r\n",pos);
/***************/
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("");
octstr_append(push_content,
bpos = make_part_delimiter(octstr_imm(boundary)));
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)));
octstr_destroy(bcos);
octstr_destroy(pap_content);
octstr_destroy(wap_content);
}
return push_content;
}
static void make_url(Octstr **url)
{
if (use_config && !use_headers) {
octstr_append(*url, octstr_imm("?username="));
octstr_append(*url, username ? username : octstr_imm("default"));
octstr_append(*url, octstr_imm("&password="));
octstr_append(*url, password ? password: octstr_imm("default"));
}
}
static void start_push(HTTPCaller *caller, long i)
{
List *push_headers;
Octstr *push_content;
long *id;
printf("zhl:stat_push will push_content_create\r\n");
printf("zhl:^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n");
push_content = push_content_create();
push_headers = push_headers_create(octstr_len(push_content));
if (verbose) {
debug("test.ppg", 0, "we have push content");
octstr_dump(push_content, 0);
debug("test.ppg", 0, "and headers");
http_header_dump(push_headers);
}
id = gw_malloc(sizeof(long));
*id = i;
make_url(&push_url);
http_start_request(caller, push_url, push_headers, push_content, 0, id,
ssl_client_certkey_file);
debug("test.ppg", 0, "TEST_PPG: started pushing job %ld", i);
octstr_destroy(push_content);
http_destroy_headers(push_headers);
}
/*
* Try log in defined number of times, when got response 401 and authentica-
* tion info is in headers.
*/
static int receive_push_reply(HTTPCaller *caller)
{
void *id;
long *trid;
int http_status,
tries;
List *reply_headers;
Octstr *final_url,
*auth_url,
*reply_body,
*os,
*push_content,
*auth_reply_body;
WAPEvent *e;
List *retry_headers;
http_status = HTTP_UNAUTHORIZED;
tries = 0;
id = http_receive_result(caller, &http_status, &final_url, &reply_headers,
&reply_body);
if (id == NULL || http_status == -1 || final_url == NULL) {
error(0, "push failed, no reason found");
goto push_failed;
}
while (use_headers && http_status == HTTP_UNAUTHORIZED && tries < retries) {
debug("test.ppg", 0, "try number %d", tries);
debug("test.ppg", 0, "authentication failure, get a challenge");
http_destroy_headers(reply_headers);
push_content = push_content_create();
retry_headers = push_headers_create(octstr_len(push_content));
http_add_basic_auth(retry_headers, username, password);
trid = gw_malloc(sizeof(long));
*trid = tries;
http_start_request(caller, final_url, retry_headers,
push_content, 0, trid, NULL);
debug("test.ppg ", 0, "TEST_PPG: doing response to %s",
octstr_get_cstr(final_url));
octstr_destroy(push_content);
http_destroy_headers(retry_headers);
trid = http_receive_result(caller, &http_status, &auth_url,
&reply_headers, &auth_reply_body);
if (trid == NULL || http_status == -1 || auth_url == NULL) {
error(0, "unable to send authorisation, no reason found");
goto push_failed;
}
debug("test.ppg", 0, "TEST_PPG: send authentication to %s, retry %ld",
octstr_get_cstr(auth_url), *(long *) trid);
gw_free(trid);
octstr_destroy(auth_reply_body);
octstr_destroy(auth_url);
++tries;
}
if (http_status == HTTP_NOT_FOUND) {
error(0, "push failed, service not found");
goto push_failed;
}
if (http_status == HTTP_FORBIDDEN) {
error(0, "push failed, service forbidden");
goto push_failed;
}
if (http_status == HTTP_UNAUTHORIZED) {
if (use_headers)
error(0, "tried %ld times, stopping", retries);
else
error(0, "push failed, authorisation failure");
goto push_failed;
}
debug("test.ppg", 0, "TEST_PPG: push %ld done: reply from, %s",
*(long *) id, octstr_get_cstr(final_url));
gw_free(id);
octstr_destroy(final_url);
if (verbose)
debug("test.ppg", 0, "TEST_PPG: reply headers were");
while ((os = list_extract_first(reply_headers)) != NULL) {
if (verbose)
octstr_dump(os, 0);
octstr_destroy(os);
}
if (verbose) {
debug("test.ppg", 0, "TEST_PPG: reply body was");
octstr_dump(reply_body, 0);
}
e = NULL;
if (pap_compile(reply_body, &e) < 0) {
warning(0, "TEST_PPG: receive_push_reply: cannot compile pap message");
goto parse_error;
}
switch (e->type) {
case Push_Response:
debug("test.ppg", 0, "TEST_PPG: and type push response");
break;
case Bad_Message_Response:
debug("test.ppg", 0, "TEST_PPG: and type bad message response");
break;
default:
warning(0, "TEST_PPG: unknown event received from %s",
octstr_get_cstr(final_url));
break;
}
octstr_destroy(reply_body);
wap_event_destroy(e);
http_destroy_headers(reply_headers);
return 0;
push_failed:
gw_free(id);
octstr_destroy(final_url);
octstr_destroy(reply_body);
http_destroy_headers(reply_headers);
return -1;
parse_error:
octstr_destroy(reply_body);
http_destroy_headers(reply_headers);
wap_event_destroy(e);
return -1;
}
static void push_thread(void *arg)
{
HTTPCaller *caller;
long succeeded, failed, in_queue;
unsigned long i;
caller = arg;
succeeded = 0;
failed = 0;
in_queue = 0;
i = 0;
for (;;) {
while (in_queue < MAX_IN_QUEUE) {
i = counter_increase(counter);
if (i >= max_pushes)
goto receive_rest;
start_push(caller, i);
if (wait)
gwthread_sleep(wait_seconds);
++in_queue;
}
while (in_queue >= MAX_IN_QUEUE) {
if (receive_push_reply(caller) == -1)
++failed;
else
++succeeded;
--in_queue;
}
}
receive_rest:
while (in_queue > 0) {
if (receive_push_reply(caller) == -1)
++failed;
else
++succeeded;
--in_queue;
}
http_caller_destroy(caller);
info(0, "TEST_PPG: In thread %ld %ld succeeded, %ld failed",
(long) gwthread_self(), succeeded, failed);
}
static void help(void)
{
info(0, "Usage: test_ppg [options] push_url [content_file pap_file]");
info(0, " or");
info(0, "Usage: test_ppg [options] [conf_file]");
info(0, "Implements push initiator for wap push. Push services are ");
info(0, "located in push_url, push content in the file content file.");
info(0, "File pap_file contains pap control document that controls");
info(0, "pushing");
info(0, "If option -H is not used, command line has either three or one");
info(0, "arguments:");
info(0, " a) the url of the push proxy gateway");
info(0, " b) a file containing the content to be pushed");
info(0, " c) a pap document controlling pushing");
info(0, " or");
info(0, " a) a test configuration file, containing all these");
info(0, "Option -H cannot be used with a configuration file. If it is");
info(0, "used, the push url is the only argument.");
info(0, "Options are:");
info(0, "-h");
info(0, "print this info");
info(0, "-c content qualifier");
info(0, "Define content type of the push content. Wml, multipart, nil,");
info(0, "scrap, sl, sia and si accepted. Si is default, nil (no content");
info(0, " type at all) and scrap (random string) are used for debugging");
info(0, "-a application id");
info(0, "Define the client application that will handle the push. Any,");
info(0, "sia, ua, mms, nil and scrap accepted, default any.");
info(0, "-b");
info(0, "If true, send username/password in headers. Default false");
info(0, "-v number");
info(0, " Set log level for stderr logging. Default 0 (debug)");
info(0, "-q");
info(0, " Do not print debugging information");
info(0, "Default: print it");
info(0, "-r number");
info(0, " Make `number' requests. Default one request");
info(0, "-i seconds");
info(0, " Wait 'seconds' seconds between pushes. Default: do not wait");
info(0, "-e transfer encoding");
info(0, " use transfer encoding to send push contents.");
info(0, " Currently supported is base64.");
info(0, "-k connection header");
info(0, "Use the connection header. Keep-alive and close accepted,");
info(0, "default close");
info(0, "-H");
info(0, "Use hardcoded MIME message, containing a pap control document.");
info(0, "In addition, use hardcoded username/password in headers (if ");
info(0, "flag -b is set, too");
info(0, "Default: read components from files");
info(0, "-t");
info(0, "number of threads, maximum 1024, default 1");
}
int main(int argc, char **argv)
{
int opt,
num_threads;
time_t start,
end;
double run_time;
long threads[MAX_THREADS];
long i;
Octstr *fos;
/***********************/
int pos;
int tempi;
char ctemp;
/*****************/
gwlib_init();
num_threads = 1;
while ((opt = getopt(argc, argv, "Hhbv:qr:t:c:a:i:e:k:")) != EOF) {
switch(opt) {
case 'v':
log_set_output_level(atoi(optarg));
break;
case 'q':
verbose = 0;
break;
case 'r':
max_pushes = atoi(optarg);
break;
case 'i':
wait = 1;
wait_seconds = atof(optarg);
break;
case 't':
num_threads = atoi(optarg);
if (num_threads > MAX_THREADS)
num_threads = MAX_THREADS;
break;
case 'H':
use_hardcoded = 1;
break;
case 'c':
content_flag = octstr_create(optarg);
if (octstr_compare(content_flag, octstr_imm("wml")) != 0 &&
octstr_compare(content_flag, octstr_imm("si")) != 0 &&
octstr_compare(content_flag, octstr_imm("sia")) != 0 &&
octstr_compare(content_flag, octstr_imm("sl")) != 0 &&
octstr_compare(content_flag, octstr_imm("nil")) != 0 &&
octstr_compare(content_flag, octstr_imm("mms")) != 0 &&
octstr_compare(content_flag, octstr_imm("scrap")) != 0 &&
octstr_compare(content_flag,
octstr_imm("multipart")) != 0){
octstr_destroy(content_flag);
error(0, "TEST_PPG: Content type not known");
help();
exit(1);
}
break;
case 'a':
appid_flag = octstr_create(optarg);
if (octstr_compare(appid_flag, octstr_imm("any")) != 0 &&
octstr_compare(appid_flag, octstr_imm("sia")) != 0 &&
octstr_compare(appid_flag, octstr_imm("ua")) != 0 &&
octstr_compare(appid_flag, octstr_imm("mms")) != 0 &&
octstr_compare(appid_flag, octstr_imm("nil")) != 0 &&
octstr_compare(appid_flag, octstr_imm("scrap")) != 0) {
octstr_destroy(appid_flag);
error(0, "TEST_PPG: Push application id not known");
help();
exit(1);
}
break;
case 'e':
content_transfer_encoding = octstr_create(optarg);
if (octstr_compare(content_transfer_encoding,
octstr_imm("base64")) != 0) {
octstr_destroy(content_transfer_encoding);
error(0, "TEST_PPG: unknown content transfer"
" encoding \"%s\"",
octstr_get_cstr(content_transfer_encoding));
help();
exit(1);
}
break;
case 'k':
connection = octstr_create(optarg);
if (octstr_compare(connection, octstr_imm("close")) != 0 &&
octstr_compare(connection,
octstr_imm("keep-alive")) != 0) {
octstr_destroy(connection);
error(0, "TEST_PPG: Connection-header unacceptable");
help();
exit(1);
}
break;
case 'h':
help();
exit(1);
case 'b':
use_headers = 1;
break;
case '?':
default:
error(0, "TEST_PPG: Invalid option %c", opt);
help();
error(0, "Stopping");
exit(1);
}
}
if (optind == argc) {
help();
exit(1);
}
push_data = argv + optind;
num_urls = argc - optind;
if (content_flag == NULL)
content_flag = octstr_imm("si");
if (appid_flag == NULL)
appid_flag = octstr_imm("any");
if (use_hardcoded) {
username = octstr_imm("troo");
password = octstr_imm("far");
}
if (push_data[0] == NULL) {
error(0, "No ppg address or config file, stopping");
exit(1);
}
use_config = 0;
if (!use_hardcoded) {
if (push_data[1] == NULL) {
info(0, "a configuration file input assumed");
read_test_ppg_config(fos = octstr_format("%s", push_data[0]));
octstr_destroy(fos);
use_config = 1;
}
}
if (!use_config)
push_url = octstr_format("%s", push_data[0]);
if (!use_hardcoded && !use_config && push_data[1] != NULL) {
if (push_data[2] == NULL) {
error(0, "no pap control document, stopping");
exit(1);
} else {
info(0, "an input without a configuration file assumed");
content_file = octstr_create(push_data[1]);
pap_file = octstr_create(push_data[2]);
debug("test.ppg", 0, "using %s as a content file", push_data[1]);
debug("test.ppg", 0, "using %s as a control file", push_data[2]);
}
}
boundary = "asdlfkjiurwghasf";
counter = counter_create();
time(&start);
if (num_threads == 0)
push_thread(http_caller_create());
else {
for (i = 0; i < num_threads; ++i)
threads[i] = gwthread_create(push_thread, http_caller_create());
for (i = 0; i < num_threads; ++i)
gwthread_join(threads[i]);
}
time(&end);
run_time = difftime(end, start);
info(0, "TEST_PPG: %ld requests in %f seconds, %f requests per second",
max_pushes, run_time, max_pushes / run_time);
octstr_destroy(content_flag);
octstr_destroy(appid_flag);
octstr_destroy(content_file);
octstr_destroy(pap_file);
octstr_destroy(ssl_client_certkey_file);
octstr_destroy(username);
octstr_destroy(password);
octstr_destroy(push_url);
octstr_destroy(connection);
counter_destroy(counter);
gwlib_shutdown();
exit(0);
}
ppg_control.xml
(text/xml, 670 B)
<?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-09-25T20:35:00Z" deliver-after-timestamp="2002-04-25T15:45:00Z" source-reference="hi,you have a picture" ppg-notify-requested-to="http://localhost:8400/cgi-bin/wap-push.cgi" progress-notes-requested="false"> <address address-value="WAPPUSH=+057122222/[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>
ppg_content.xml
(text/xml, 306 B)
<?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-medium" created="2002-03-25T15:23:15Z" si-expires="2002-08-30T00:00:00Z"> Want to test a fetch? </indication> </si>