# Guidance on implementing server-first-message protocols?

**URL:** <https://discourse.mitmproxy.org/t/guidance-on-implementing-server-first-message-protocols/634>\
**Category:** Uncategorized\
**Created:** [September 11, 2017, 9:13pm UTC](https://discourse.mitmproxy.org/t/guidance-on-implementing-server-first-message-protocols/634 "2017-09-11T21:13:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smanzer](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@smanzer](https://discourse.mitmproxy.org/u/smanzer)\
**Post date:** [September 11, 2017, 9:13pm UTC](https://discourse.mitmproxy.org/t/guidance-on-implementing-server-first-message-protocols/634/1 "2017-09-11T21:13:47Z")

</div>

I have seen [this issue](https://github.com/mitmproxy/mitmproxy/issues/910) indicating that handling protocols in which the server sends the first message (like MySQL) was not possible as of Feb. 2016.

I would be interested in coding this feature so that I can snoop MySQL traffic using the `--tcp` option. I have a few questions:

1. Would the owners/maintainers welcome such an addition?
2. Has anything changed in the last year that would make this easier to implement than it was when that issue was filed?

---

<div class="post-metadata">

**Author:** ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)\
**Post date:** [September 12, 2017, 1:45am UTC](https://discourse.mitmproxy.org/t/guidance-on-implementing-server-first-message-protocols/634/2 "2017-09-12T01:45:07Z")

</div>

Hi @smanzer,

You’re stumbling upon mitmproxy’s pain points it seems - sorry about that 😉

> Would the owners/maintainers welcome such an addition?

Definitely yes. The sans-io branch in fact already has this working ([Sans-IO Proxy Implementation · Issue #1775 · mitmproxy/mitmproxy · GitHub](https://github.com/mitmproxy/mitmproxy/issues/1775) / [https://github.com/mitmproxy/mitmproxy/tree/sans-io](https://github.com/mitmproxy/mitmproxy/tree/sans-io)), but there’s just a lot of work left before that can replace our current protocol implementation. If you have a decent workaround that works with the current protocol stack, I’d of course be happy to merge that, but see below.

> Has anything changed in the last year that would make this easier to implement than it was when that issue was filed?

Not really, but I do have a workaround addon for exactly that problem: [server\_side\_tcp.py · GitHub](https://gist.github.com/mhils/3a1ebb56479fc7c660942c57cb37312d). That may actually be the most pragmatic approach for now.

---

<div class="post-metadata">

**Author:** ![smanzer](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@smanzer](https://discourse.mitmproxy.org/u/smanzer)\
**Post date:** [September 14, 2017, 6:48pm UTC](https://discourse.mitmproxy.org/t/guidance-on-implementing-server-first-message-protocols/634/3 "2017-09-14T18:48:50Z")

</div>

Thank you very much 🙂

Your workaround was quite easy to deploy for me, so I’m good for now. sans-io branch looks very cool I will keep an eye on that.
