-
Notifications
You must be signed in to change notification settings - Fork 408
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
Add custom headers with websocket request #296
Add custom headers with websocket request #296
Conversation
Hey @xiaotianrandom. Nice job! :) One remark regarding the XML configuration. I would suggest, we keep it similar to HTTP headers:
So basicially this would translate to:
Since the initial handshake is plain HTTP, this would also be better, if things like What do you think? |
@tisba , thanks for your response. I agree with you that it's better to use
And tsung complains:
Is there an easy way to fix this? |
Custom headers can be added with a websocket connect request using http_header elements, similar to HTTP requests.
8aab18f
to
85973c1
Compare
@tisba I figured out how to accept both PCDATA and children in an element in DTD. Now the patch reads user custom headers from
I squashed all commits in this PR into one, and pushed |
I like the configuration part, this is much better! I currently have very little time to test the changes thoroughly, but maybe @nniclausse can take a look? What do you think about this change? |
Hi. it seems fine. |
Is there anything I can do to make this PR merged? |
I've taken your branch for a little test and it seems to work just fine, thanks! Could you maybe add a little remark to the documentation that we now can pass HTTP headers when connecting? Maybe under https://github.com/processone/tsung/blob/develop/docs/conf-sessions.rst (http://tsung.erlang-projects.org/user_manual/conf-sessions.html?highlight=websocket#websocket). |
I added a paragraph in the doc for this patch. Do I need to add a "New in x.x.x" mark? I use 1.7.1, since the latest version is 1.7.0 now. |
Good question about the documentation of Tsung version :) @nniclausse: How do we want to handle hints for features in future Tsung versions? I'll merge this now as is and I'm happy to change the version remark in a follow up. As for the code itself: 😎! Thank you for your contribution, @xiaotianrandom! |
Hi @tisba and @xiaotianrandom, thanks for this awesome enhancement! I tried to use it though and noticed that it was merged into the develop branch and wasn't included in the latest 1.7.0 release. I was just wondering if that was intended or not. Is there a plan to get this included in the next release? Also, what is the purpose of the develop branch? |
@jesseshieh the 1.7.0 release is quite old already (last year). I started an issue for releasing 1.8.0 but I cannot really find time currently to drive this forward :-/ |
Oh I'm so sorry, I misread the year! Sorry about that :) |
Thanks @xiaotianrandom I hope this gets released soon 🙏 |
I'm guessing that a new "official" release will take some time. But tsung is actually quite simple to build from source. |
This is a patch to resolve #116 . It parses custom headers from content of a
websocket
tag with typeconnect
, and send them with the handshake request. For example, we can send custom cookie using the following config:I'm new to Erlang. Could any maintainer give me some feedback? If the design is acceptable, I'd like to complete the document.