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

support for variables in 'param-value' from properties file without depending on any 3rd party libs #106

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

MadhbhavikaR
Copy link

Support for properties file
Fix for possible memory leak in formatter
Support for properties file
Documentation updated
version bumped to 1.9.1

Reference : Previous pull request

@@ -6,7 +6,7 @@ This is an HTTP Proxy (aka gateway) in the form of a Java servlet. An HTTP prox
This is hardly the first proxy, so why did I write it and thus why might you use it?

* It's simple -- a single source file implementation
* It's tested -- have confidence it works [![Build Status](https://travis-ci.org/mitre/HTTP-Proxy-Servlet.png)](https://travis-ci.org/mitre/HTTP-Proxy-Servlet)
* It's tested -- have confidence it works [![Build Status](https://travis-ci.org/madhbhavikar/HTTP-Proxy-Servlet.svg?branch=master)](https://travis-ci.org/madhbhavikar/HTTP-Proxy-Servlet)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was local change, for my company, will revert. and repush

</developers>

<scm>
<url>https://github.com/dsmiley/HTTP-Proxy-Servlet</url>
<connection>scm:git:https://[email protected]/dsmiley/HTTP-Proxy-Servlet.git</connection>
<developerConnection>scm:git:[email protected]:dsmiley/HTTP-Proxy-Servlet.git</developerConnection>
<tag>HEAD</tag>
<tag>smiley-http-proxy-servlet-1.9</tag>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm; I'm not sure what the implication of this change is... but I see it's something to maintain between versions :-/

@@ -29,13 +29,25 @@
<!-- I used to work for MITRE for many years but I don't anymore. -->
<!--<organization>MITRE</organization>-->
</developer>
<developer>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a <role>contributor</role> or something like that which is supported. Is the presence of your name here a big deal here for you? I can think of a contributor or two that contributed substantially more than this PR (which doesn't mean I'm not grateful for all contributions!). Maybe me finally creating a CHANGES.txt would be a good thing to appease the desire to get credit beyond git history. It'd list names.

@@ -131,7 +137,44 @@ protected HttpHost getTargetHost(HttpServletRequest servletRequest) {
* it can be overridden.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these javadocs are now missing info about the ${} syntax you added and properties files.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Java docs added to the method

@@ -55,7 +57,7 @@
* But that's not how the spec works. So for now we will require a proxy arg to be present
* if defined for this proxy URL.
*/
protected static final Pattern TEMPLATE_PATTERN = Pattern.compile("\\{([a-zA-Z0-9_%.]+)\\}");
protected static final Pattern TEMPLATE_PATTERN = Pattern.compile("\\{([a-zA-Z0-9_%-.]+)\\}");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just looking at the RFC spec. It turns out most characters are supported except a small number. To keep this simple excepting all the characters we should (yet some we shouldn't admittedly), lets simplify this: Pattern.compile("\\{(.+?)\\}")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pattern has been corrected

@@ -100,14 +102,19 @@ protected void service(HttpServletRequest servletRequest, HttpServletResponse se
params.put(pair.getName(), pair.getValue());
}

LinkedHashMap<String, String> specialHeaders = getVariablesFromRequestHeaders(servletRequest);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the headers pulled in advanced to a map here? Instead, why not simply resolve via request.getHeader(headerName)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented

@MadhbhavikaR
Copy link
Author

All changes have been incorporated, let me know if any changes are required.

@dsmiley
Copy link
Collaborator

dsmiley commented Nov 23, 2016

Ok; perhaps this weekend I'll take a look. I'm ridiculously behind in my day job work.

@MadhbhavikaR
Copy link
Author

That would be Great!, My company needs the official fix ;)

@dsmiley
Copy link
Collaborator

dsmiley commented Dec 1, 2016

The only thing missing is a test.

@dsmiley
Copy link
Collaborator

dsmiley commented Sep 27, 2020

Sorry to have neglected this. If you're still around and address what's missing, I can give it another look. Seems I last asked for a test. At least some test; needn't be comprehensive.

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

Successfully merging this pull request may close these issues.

2 participants