Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify proxy protocol #19

Open
zobo opened this issue Nov 21, 2019 · 4 comments
Open

Clarify proxy protocol #19

zobo opened this issue Nov 21, 2019 · 4 comments

Comments

@zobo
Copy link

zobo commented Nov 21, 2019

The proxy protocol is not well defined. One could speculate, that it follows the same line protocol as dbgp (client to server: one line, null terminated / server to client: decimal length, NULL, xml, NULL) however the implementations out there vary in implementation. This makes it hard to implement proxy support into IDEs. Some examples that I was able to find:

pydbgpproxy (Komodo, PhpStorm...) (copy https://github.com/agroszer/komodo-python-dbgp)

  • request: reads up to 1024 bytes, trims/strips white space (so sending NULL or newline works)
  • response: sends xml, no length or NULLs, then closes connection

https://github.com/MadridianFox/xdebug-proxy

  • request: reads until NULL
  • response: sends xml, no length or NULLs, then closes connection

https://github.com/mougrim/php-xdebug-proxy

  • request: reads until NULL
  • response: sends xml, no length or NULLs, then closes connection

https://github.com/eelf/smdbgpproxy/

  • request: reads until NULL
  • response: sends length NULL xml NULL, then closes connection

I believe more or less everybody uses pydbgpproxy and it's regarded as a defacto standard. The following lines should probably be changed:

The proxy should respond with a simple XML statement alerting the IDE to an error, or the success of the initialization (see section 6.5 for more details on the error element).

to

The proxy should respond with a simple XML statement alerting the IDE to an error, or the success of the initialization and disconnect to indicate all data has been transmitted (see section 6.5 for more details on the error element).

and

Once the IDE has sent this command, and received a confirmation, it disconnects from the proxy.

to

Once the IDE has sent this command, and received a confirmation, the proxy drops the connection.

I can open a PR.

Best,
Damjan

@derickr
Copy link
Owner

derickr commented Dec 10, 2019

The proxy protocol is not well defined. One could speculate, that it follows the same line protocol as dbgp (client to server: one line, null terminated / server to client: decimal length, NULL, xml, NULL) however the implementations out there vary in implementation.

That's certainly how I think it should work.

It's unfortunate that the section on proxies is done before section 6 (Message Packets). To be fair, the whole draft document should have some proper attention as it's kludgy and not always easy to understand.

I am intending to write a proxy tool myself soon (gives me an excuse to learn Go), and that would certainly use the same protocol as normal DBGp packages — as the proxy things should do too.

@zobo
Copy link
Author

zobo commented Dec 10, 2019

Great to hear! There are probably a bunch of implementations in Go already on github, but always great way to learn something new this way. I just worry we'll end up with a split in two worlds, the current py implementation and however you decide to implement it now. I guess it will be up to clients/IDEs to decide what protocol to talk...

@derickr
Copy link
Owner

derickr commented Jan 10, 2020

FWIW, I found https://github.com/real420og/dbgp-proxy

@zobo
Copy link
Author

zobo commented Jan 10, 2020

Ah, a new one.. Shows that all computer problems are already solved, you just need to put it together :)
On a serious note, had a quick look:

Again using the de-facto standard for IDE protocol...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants