kvic-z / pixelserv-tls

A tiny bespoke HTTP/1.1 server for adblock and accelerating web browsing.
GNU Lesser General Public License v3.0
203 stars 23 forks source link

Crash on Tapatalk launch #7

Closed kvic-z closed 6 years ago

kvic-z commented 6 years ago

Client

Tapatalk Android client.

Symptom

On launch, Tapatalk sends a big chunk ~16KB of data using POST. Captured request looks like below. pixelserv-tls v2.0.1-rc2 crashes.

POST /v2.9/469687153111700/activities?access_token=&format=json&sdk=android HTTP/1.1
User-Agent: FBAndroidSDK.4.23.0
Accept-Language: es_ES
Content-Type: multipart/form-data; boundary=3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f
Transfer-Encoding: chunked
Host: graph.facebook.com
Connection: Keep-Alive
Accept-Encoding: gzip

7056
--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f
Content-Disposition: form-data; name="format"

json
--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f
Content-Disposition: form-data; name="sdk"

android
--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f
Content-Disposition: form-data; name="custom_events_file"; filename="custom_events_file"
Content-Type: content/unknown

[{"_eventName":"Start_Session","_logTime":1512749547,"_ui":"null","_session_id":"5d35bdf4-4862-492e-b8fc-f80c574721c2","Channel":"Push_Conv"},{"_eventName":"fb_mobile_activate_app","_logTime":1512749256,"_ui":"CreateMessageActivity","_session_id":"5d35bdf4-4862-492e-b8fc-f80c574721c2","fb_mobile_launch_source":"Unclassified"},
kvic-z commented 6 years ago

Analysis

Tapatalk uses multi-part POST to upload contents to pixelserv-tls (i.e. ad servers) with Transport-Encoding: chunked. pixelserv-tls cannot parse this mechanism and hence crashes.

kvic-z commented 6 years ago

Fixed crash with 0063f766

Full support of Transport-Encoding: chunked need more work and has to wait in a future release.