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

Make access to the HTTP Request Headers easier #15

Open
soapdog opened this issue May 7, 2022 · 3 comments
Open

Make access to the HTTP Request Headers easier #15

soapdog opened this issue May 7, 2022 · 3 comments

Comments

@soapdog
Copy link

soapdog commented May 7, 2022

At the moment, the callback executed when a XML-RPC Server receives a request exposes the original request object as its last argument. That is very useful, but it adds a bit of friction when attempting to access HTTP Request Headers. It would be great if the headers could be added to that callback as another argument before the original final HTTP Request argument. Ideally the headers could be exposed as a simple object.

My reasoning for wanting easy access to them is because they help with developing authentication workflows.

@scripting
Copy link
Owner

Thanks for these reports. It would be helpful if when reporting something like this you provided a pointer to the code you're writing about. It would save me some time, and would help me be sure I'm looking at the right part of the code.

@soapdog
Copy link
Author

soapdog commented May 9, 2022

oh sorry, I should've added some references. What meant is that it would be great if this object here also included the request HTTP headers:

xml-rpc/xmlrpc.js

Lines 507 to 513 in 965c38a

var xmlRpcRequest = {
verb: verb,
params: params,
returnVal: httpReturnXml, //function that returns the result of the xml-rpc call
httpRequest: theRequest //include a copy of the low-level request
};
return (callback (xmlRpcRequest)); //returns true if handled, false if not

The low-level request included has headers, but using them has some friction. Adding them as an extra property would make it easier. My use-case is to use authentications similar to OAuth and other tokens that are passed via headers instead of arguments to the RPC call.

@scripting
Copy link
Owner

Thanks for the pointer to the code in question.

Two more questions --

  1. What does "has some friction" mean?

  2. You were going to submit a pull request for this -- what code were you proposing to change/add?

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