[jscover] 61/69: Drop Proxy-Connection, Connection and Accept-Encoding headers when proxying GET requests.

Sylvestre Ledru sylvestre at moszumanska.debian.org
Fri Aug 22 05:54:09 UTC 2014


This is an automated email from the git hooks/post-receive script.

sylvestre pushed a commit to branch master
in repository jscover.

commit 45a88001554b860efa62ae9a2b0bb7e5e4c4123c
Author: Jake Cobb <jcobb at us.fujitsu.com>
Date:   Wed Aug 13 15:38:02 2014 -0700

    Drop Proxy-Connection, Connection and Accept-Encoding headers when
    proxying GET requests.
---
 src/main/java/jscover/server/ProxyService.java | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/main/java/jscover/server/ProxyService.java b/src/main/java/jscover/server/ProxyService.java
index 577ba9d..e9b0bea 100644
--- a/src/main/java/jscover/server/ProxyService.java
+++ b/src/main/java/jscover/server/ProxyService.java
@@ -445,6 +445,8 @@ public class ProxyService {
     private void sendHeaders(HttpRequest request, PrintWriter remotePrintWriter) {
         Map<String, List<String>> clientHeaders = request.getHeaders();
         for (String header : clientHeaders.keySet()) {
+            if (!shouldSendHeader(header))
+                continue;
             List<String> values = clientHeaders.get(header);
             for (String value : values) {
                 remotePrintWriter.print(format("%s: %s\n", header, value));
@@ -453,6 +455,13 @@ public class ProxyService {
         remotePrintWriter.print("\n");
         remotePrintWriter.flush();
     }
+    
+    protected boolean shouldSendHeader(String header) {
+        header = header.toLowerCase();
+        if ("proxy-connection".equals(header) || "accept-encoding".equals(header) || "connection".equals(header))
+            return false;
+        return true;
+    }
 
     public String getUrl(HttpRequest request) throws IOException {
         URL url = request.getUrl();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jscover.git



More information about the pkg-java-commits mailing list