Juan Hernandez has uploaded a new change for review.

Change subject: sdk: Add X-Ovirt-Expect and Expect
......................................................................

sdk: Add X-Ovirt-Expect and Expect

The HTTP Expect header is rejected by the Apache web server if its
values is anythiong other than 100-continue. To avoid problems the
engine explicitly removes it, and it accepts an alternative
X-Ovirt-Except header, with the same values and semantics. This patch
changes the SDK so that it will automatically add the alternative header
when the user adds the original one.

Change-Id: I7af6ffa51c9e5b04e6f57d749e130424e10b7eaf
Related: https://bugzilla.redhat.com/1093784
Signed-off-by: Juan Hernandez <[email protected]>
(cherry picked from commit e09c01e685f2f1a0ca3f85ff75dbd32bbdfdc0e5)
---
M ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/web/HttpProxy.java
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk-java 
refs/changes/65/28365/1

diff --git 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/web/HttpProxy.java 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/web/HttpProxy.java
index 483a9d1..a70448a 100644
--- 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/web/HttpProxy.java
+++ 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/web/HttpProxy.java
@@ -45,6 +45,8 @@
     private static final String PERSISTENT_AUTH_HEADER_CONTENT = 
"persistent-auth";
     private static final String PERSISTENT_AUTH_HEADER = "Prefer";
     private static final String FILTER_HEADER = "Filter";
+    private static final String EXPECT_HEADER = "Expect";
+    private static final String ALTERNATIVE_EXPECT_HEADER = "X-Ovirt-Expect";
     private static final String STATIC_HEADERS[] = new String[] { 
"Content-type:application/xml" };
     private static final int BAD_REQUEST = 400;
 
@@ -163,6 +165,14 @@
             request.setHeaders(updated.toArray(new Header[updated.size()]));
         }
 
+        // The Apache web server ignores the "Expect" header, so if this 
header was explicitly added by the user, then
+        // we need to add the alternative "X-Ovirt-Expect" as well:
+        for (Header header : headers) {
+            if (EXPECT_HEADER.equalsIgnoreCase(header.getName())) {
+                request.setHeader(ALTERNATIVE_EXPECT_HEADER, 
header.getValue());
+            }
+        }
+
         // inject .ctr defined static parameters
         for (Header header : this.staticHeaders) {
             if (header.getName().equals(CONTENT_TYPE_HEADER)) {


-- 
To view, visit http://gerrit.ovirt.org/28365
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7af6ffa51c9e5b04e6f57d749e130424e10b7eaf
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk-java
Gerrit-Branch: sdk_3.5
Gerrit-Owner: Juan Hernandez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to