mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 01:32:18 +02:00
Use lowercase HTTP header field names so we are compatible with HTTP/2 (#7006)
This commit is contained in:
parent
57d4f5697e
commit
d74f64a2e1
@ -217,7 +217,7 @@ public class TrafficSentinelResource implements ServerResource {
|
||||
String postData = "script="+URLEncoder.encode(getScript(cmd.getPublicIps(), cmd.getStart(), cmd.getEnd()), "UTF-8")+"&authenticate=basic&resultFormat=txt";
|
||||
HttpURLConnection con = (HttpURLConnection) trafficSentinel.openConnection();
|
||||
con.setRequestMethod("POST");
|
||||
con.setRequestProperty("Content-Length", String.valueOf(postData.length()));
|
||||
con.setRequestProperty("content-length", String.valueOf(postData.length()));
|
||||
con.setDoOutput(true);
|
||||
|
||||
//Part 2 - Write Data
|
||||
|
||||
@ -293,7 +293,7 @@ public class HttpTemplateDownloader extends ManagedContextRunnable implements Te
|
||||
}
|
||||
|
||||
private boolean tryAndGetRemoteSize() {
|
||||
Header contentLengthHeader = request.getResponseHeader("Content-Length");
|
||||
Header contentLengthHeader = request.getResponseHeader("content-length");
|
||||
boolean chunked = false;
|
||||
long reportedRemoteSize = 0;
|
||||
if (contentLengthHeader == null) {
|
||||
|
||||
@ -133,8 +133,8 @@ public class S3TemplateDownloader extends ManagedContextRunnable implements Temp
|
||||
}
|
||||
|
||||
// Headers
|
||||
Header contentLengthHeader = getMethod.getResponseHeader("Content-Length");
|
||||
Header contentTypeHeader = getMethod.getResponseHeader("Content-Type");
|
||||
Header contentLengthHeader = getMethod.getResponseHeader("content-length");
|
||||
Header contentTypeHeader = getMethod.getResponseHeader("content-type");
|
||||
|
||||
// Check the contentLengthHeader and transferEncodingHeader.
|
||||
if (contentLengthHeader == null) {
|
||||
|
||||
@ -48,8 +48,8 @@ public class TestHttp extends AbstractTestNGSpringContextTests {
|
||||
long length = 0;
|
||||
try {
|
||||
HttpResponse response = client.execute(method);
|
||||
length = Long.parseLong(response.getFirstHeader("Content-Length").getValue());
|
||||
System.out.println(response.getFirstHeader("Content-Length").getValue());
|
||||
length = Long.parseLong(response.getFirstHeader("content-length").getValue());
|
||||
System.out.println(response.getFirstHeader("content-length").getValue());
|
||||
final File localFile = new File("/tmp/test");
|
||||
if (!localFile.exists()) {
|
||||
localFile.createNewFile();
|
||||
|
||||
@ -202,7 +202,7 @@ public class VeeamClient {
|
||||
String url = apiURI.toString() + path;
|
||||
final HttpPost request = new HttpPost(url);
|
||||
request.setHeader(SESSION_HEADER, veeamSessionId);
|
||||
request.setHeader("Content-type", "application/xml");
|
||||
request.setHeader("content-type", "application/xml");
|
||||
if (StringUtils.isNotBlank(xml)) {
|
||||
request.setEntity(new StringEntity(xml));
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ public class VeeamClientTest {
|
||||
public void testVeeamJobs() {
|
||||
wireMockRule.stubFor(get(urlMatching(".*/jobs"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/xml")
|
||||
.withHeader("content-type", "application/xml")
|
||||
.withStatus(200)
|
||||
.withBody("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
||||
"<EntityReferences xmlns=\"http://www.veeam.com/ent/v1.0\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
|
||||
|
||||
@ -40,7 +40,7 @@ public class UcsHttpClient {
|
||||
public String call(String xml) {
|
||||
PostMethod post = new PostMethod(url);
|
||||
post.setRequestEntity(new StringRequestEntity(xml));
|
||||
post.setRequestHeader("Content-type", "text/xml");
|
||||
post.setRequestHeader("content-type", "text/xml");
|
||||
//post.setFollowRedirects(true);
|
||||
try {
|
||||
int result = client.executeMethod(post);
|
||||
|
||||
@ -151,7 +151,7 @@ public class CloudianClient {
|
||||
final String json = mapper.writeValueAsString(item);
|
||||
final StringEntity entity = new StringEntity(json);
|
||||
final HttpPost request = new HttpPost(adminApiUrl + path);
|
||||
request.setHeader("Content-type", "application/json");
|
||||
request.setHeader("content-type", "application/json");
|
||||
request.setEntity(entity);
|
||||
final HttpResponse response = httpClient.execute(request, httpContext);
|
||||
checkAuthFailure(response);
|
||||
@ -163,7 +163,7 @@ public class CloudianClient {
|
||||
final String json = mapper.writeValueAsString(item);
|
||||
final StringEntity entity = new StringEntity(json);
|
||||
final HttpPut request = new HttpPut(adminApiUrl + path);
|
||||
request.setHeader("Content-type", "application/json");
|
||||
request.setHeader("content-type", "application/json");
|
||||
request.setEntity(entity);
|
||||
final HttpResponse response = httpClient.execute(request, httpContext);
|
||||
checkAuthFailure(response);
|
||||
|
||||
@ -88,7 +88,7 @@ public class CloudianClientTest {
|
||||
public void testRequestTimeout() {
|
||||
wireMockRule.stubFor(get(urlEqualTo("/group/list"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withHeader("content-type", "application/json")
|
||||
.withStatus(200)
|
||||
.withFixedDelay(2 * timeout * 1000)
|
||||
.withBody("")));
|
||||
@ -131,7 +131,7 @@ public class CloudianClientTest {
|
||||
Assert.assertTrue(result);
|
||||
verify(putRequestedFor(urlEqualTo("/user"))
|
||||
.withRequestBody(containing("userId\":\"" + user.getUserId()))
|
||||
.withHeader("Content-Type", equalTo("application/json")));
|
||||
.withHeader("content-type", equalTo("application/json")));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -152,7 +152,7 @@ public class CloudianClientTest {
|
||||
final String groupId = "someGroup";
|
||||
wireMockRule.stubFor(get(urlPathMatching("/user?.*"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withHeader("content-type", "application/json")
|
||||
.withBody("{\"userId\":\"someUser\",\"userType\":\"User\",\"fullName\":\"John Doe (jdoe)\",\"emailAddr\":\"j@doe.com\",\"address1\":null,\"address2\":null,\"city\":null,\"state\":null,\"zip\":null,\"country\":null,\"phone\":null,\"groupId\":\"someGroup\",\"website\":null,\"active\":\"true\",\"canonicalUserId\":\"b3940886468689d375ebf8747b151c37\",\"ldapEnabled\":false}")));
|
||||
|
||||
final CloudianUser user = client.listUser(userId, groupId);
|
||||
@ -166,7 +166,7 @@ public class CloudianClientTest {
|
||||
public void listUserAccountFail() {
|
||||
wireMockRule.stubFor(get(urlPathMatching("/user?.*"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withHeader("content-type", "application/json")
|
||||
.withBody("")));
|
||||
|
||||
final CloudianUser user = client.listUser("abc", "xyz");
|
||||
@ -178,7 +178,7 @@ public class CloudianClientTest {
|
||||
final String groupId = "someGroup";
|
||||
wireMockRule.stubFor(get(urlPathMatching("/user/list?.*"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withHeader("content-type", "application/json")
|
||||
.withBody("[{\"userId\":\"someUser\",\"userType\":\"User\",\"fullName\":\"John Doe (jdoe)\",\"emailAddr\":\"j@doe.com\",\"address1\":null,\"address2\":null,\"city\":null,\"state\":null,\"zip\":null,\"country\":null,\"phone\":null,\"groupId\":\"someGroup\",\"website\":null,\"active\":\"true\",\"canonicalUserId\":\"b3940886468689d375ebf8747b151c37\",\"ldapEnabled\":false}]")));
|
||||
|
||||
final List<CloudianUser> users = client.listUsers(groupId);
|
||||
@ -191,14 +191,14 @@ public class CloudianClientTest {
|
||||
public void testEmptyListUsersResponse() {
|
||||
wireMockRule.stubFor(get(urlPathMatching("/user/list"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withHeader("content-type", "application/json")
|
||||
.withStatus(204)
|
||||
.withBody("")));
|
||||
Assert.assertTrue(client.listUsers("someGroup").size() == 0);
|
||||
|
||||
wireMockRule.stubFor(get(urlPathMatching("/user"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withHeader("content-type", "application/json")
|
||||
.withStatus(204)
|
||||
.withBody("")));
|
||||
Assert.assertNull(client.listUser("someUserId", "someGroupId"));
|
||||
@ -208,7 +208,7 @@ public class CloudianClientTest {
|
||||
public void listUserAccountsFail() {
|
||||
wireMockRule.stubFor(get(urlPathMatching("/user/list?.*"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withHeader("content-type", "application/json")
|
||||
.withBody("")));
|
||||
|
||||
final List<CloudianUser> users = client.listUsers("xyz");
|
||||
@ -227,7 +227,7 @@ public class CloudianClientTest {
|
||||
Assert.assertTrue(result);
|
||||
verify(postRequestedFor(urlEqualTo("/user"))
|
||||
.withRequestBody(containing("userId\":\"" + user.getUserId()))
|
||||
.withHeader("Content-Type", equalTo("application/json")));
|
||||
.withHeader("content-type", equalTo("application/json")));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -281,7 +281,7 @@ public class CloudianClientTest {
|
||||
Assert.assertTrue(result);
|
||||
verify(putRequestedFor(urlEqualTo("/group"))
|
||||
.withRequestBody(containing("groupId\":\"someGroupId"))
|
||||
.withHeader("Content-Type", equalTo("application/json")));
|
||||
.withHeader("content-type", equalTo("application/json")));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -301,7 +301,7 @@ public class CloudianClientTest {
|
||||
final String groupId = "someGroup";
|
||||
wireMockRule.stubFor(get(urlPathMatching("/group.*"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withHeader("content-type", "application/json")
|
||||
.withBody("{\"groupId\":\"someGroup\",\"groupName\":\"/someDomain\",\"ldapGroup\":null,\"active\":\"true\",\"ldapEnabled\":false,\"ldapServerURL\":null,\"ldapUserDNTemplate\":null,\"ldapSearch\":null,\"ldapSearchUserBase\":null,\"ldapMatchAttribute\":null}")));
|
||||
|
||||
final CloudianGroup group = client.listGroup(groupId);
|
||||
@ -313,7 +313,7 @@ public class CloudianClientTest {
|
||||
public void listGroupFail() {
|
||||
wireMockRule.stubFor(get(urlPathMatching("/group.*"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withHeader("content-type", "application/json")
|
||||
.withBody("")));
|
||||
|
||||
final CloudianGroup group = client.listGroup("xyz");
|
||||
@ -325,7 +325,7 @@ public class CloudianClientTest {
|
||||
final String groupId = "someGroup";
|
||||
wireMockRule.stubFor(get(urlEqualTo("/group/list"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withHeader("content-type", "application/json")
|
||||
.withBody("[{\"groupId\":\"someGroup\",\"groupName\":\"/someDomain\",\"ldapGroup\":null,\"active\":\"true\",\"ldapEnabled\":false,\"ldapServerURL\":null,\"ldapUserDNTemplate\":null,\"ldapSearch\":null,\"ldapSearchUserBase\":null,\"ldapMatchAttribute\":null}]")));
|
||||
|
||||
final List<CloudianGroup> groups = client.listGroups();
|
||||
@ -338,7 +338,7 @@ public class CloudianClientTest {
|
||||
public void listGroupsFail() {
|
||||
wireMockRule.stubFor(get(urlEqualTo("/group/list"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withHeader("content-type", "application/json")
|
||||
.withBody("")));
|
||||
|
||||
final List<CloudianGroup> groups = client.listGroups();
|
||||
@ -349,7 +349,7 @@ public class CloudianClientTest {
|
||||
public void testEmptyListGroupResponse() {
|
||||
wireMockRule.stubFor(get(urlEqualTo("/group/list"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withHeader("content-type", "application/json")
|
||||
.withStatus(204)
|
||||
.withBody("")));
|
||||
|
||||
@ -358,7 +358,7 @@ public class CloudianClientTest {
|
||||
|
||||
wireMockRule.stubFor(get(urlPathMatching("/group"))
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withHeader("content-type", "application/json")
|
||||
.withStatus(204)
|
||||
.withBody("")));
|
||||
Assert.assertNull(client.listGroup("someGroup"));
|
||||
@ -376,7 +376,7 @@ public class CloudianClientTest {
|
||||
Assert.assertTrue(result);
|
||||
verify(postRequestedFor(urlEqualTo("/group"))
|
||||
.withRequestBody(containing("groupId\":\"" + group.getGroupId()))
|
||||
.withHeader("Content-Type", equalTo("application/json")));
|
||||
.withHeader("content-type", equalTo("application/json")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@ -57,7 +57,7 @@ public class PrometheusExporterServerImpl extends ManagerBase implements Prometh
|
||||
response = prometheusExporter.getMetrics();
|
||||
responseCode = 200;
|
||||
}
|
||||
httpExchange.getResponseHeaders().set("Content-Type", "text/plain");
|
||||
httpExchange.getResponseHeaders().set("content-type", "text/plain");
|
||||
httpExchange.sendResponseHeaders(responseCode, response.length());
|
||||
final OutputStream os = httpExchange.getResponseBody();
|
||||
os.write(response.getBytes());
|
||||
|
||||
@ -57,7 +57,7 @@ public class BigSwitchBcfApi {
|
||||
private static final Logger S_LOGGER = Logger.getLogger(BigSwitchBcfApi.class);
|
||||
private final static String S_PROTOCOL = "https";
|
||||
private final static String S_NS_BASE_URL = "/networkService/v1.1";
|
||||
private final static String CONTENT_TYPE = "Content-type";
|
||||
private final static String CONTENT_TYPE = "content-type";
|
||||
private final static String ACCEPT = "Accept";
|
||||
private final static String CONTENT_JSON = "application/json";
|
||||
private final static String HTTP_HEADER_INSTANCE_ID = "Instance-ID";
|
||||
|
||||
@ -270,7 +270,7 @@ public class BigSwitchApiTest {
|
||||
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
||||
Header header = mock(Header.class);
|
||||
when(header.getValue()).thenReturn("text/html");
|
||||
when(_method.getResponseHeader("Content-type")).thenReturn(header);
|
||||
when(_method.getResponseHeader("content-type")).thenReturn(header);
|
||||
when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
|
||||
when(_method.isRequestSent()).thenReturn(true);
|
||||
try {
|
||||
@ -288,7 +288,7 @@ public class BigSwitchApiTest {
|
||||
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
||||
Header header = mock(Header.class);
|
||||
when(header.getValue()).thenReturn("text/html");
|
||||
when(_method.getResponseHeader("Content-type")).thenReturn(header);
|
||||
when(_method.getResponseHeader("content-type")).thenReturn(header);
|
||||
when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
|
||||
try {
|
||||
_api.executeCreateObject(network, "/", Collections.<String, String> emptyMap());
|
||||
@ -335,7 +335,7 @@ public class BigSwitchApiTest {
|
||||
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
||||
Header header = mock(Header.class);
|
||||
when(header.getValue()).thenReturn("text/html");
|
||||
when(_method.getResponseHeader("Content-type")).thenReturn(header);
|
||||
when(_method.getResponseHeader("content-type")).thenReturn(header);
|
||||
when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
|
||||
when(_method.isRequestSent()).thenReturn(true);
|
||||
try {
|
||||
@ -373,7 +373,7 @@ public class BigSwitchApiTest {
|
||||
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
||||
Header header = mock(Header.class);
|
||||
when(header.getValue()).thenReturn("text/html");
|
||||
when(_method.getResponseHeader("Content-type")).thenReturn(header);
|
||||
when(_method.getResponseHeader("content-type")).thenReturn(header);
|
||||
when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
|
||||
when(_method.isRequestSent()).thenReturn(true);
|
||||
try {
|
||||
|
||||
@ -51,7 +51,7 @@ public abstract class Action {
|
||||
|
||||
protected static final String TEXT_HTML_CONTENT_TYPE = "text/html";
|
||||
protected static final String JSON_CONTENT_TYPE = "application/json";
|
||||
protected static final String CONTENT_TYPE = "Content-Type";
|
||||
protected static final String CONTENT_TYPE = "content-type";
|
||||
|
||||
private final URL url;
|
||||
private final String username;
|
||||
|
||||
@ -30,7 +30,7 @@ def login():
|
||||
assert "password" in request.form
|
||||
request.environ["beaker.session"]["login"] = True
|
||||
res = make_response("", 200)
|
||||
res.headers["Content-type"] = "application/json"
|
||||
res.headers["content-type"] = "application/json"
|
||||
return res
|
||||
|
||||
@app.route("/ssp.v1/tenant-networks", methods=["POST",])
|
||||
@ -41,7 +41,7 @@ def create_tenant_network():
|
||||
obj["uuid"] = str(uuid.uuid1())
|
||||
tenant_networks.append(obj)
|
||||
res = make_response(json.dumps(obj), 201)
|
||||
res.headers["Content-type"] = "application/json"
|
||||
res.headers["content-type"] = "application/json"
|
||||
return res
|
||||
|
||||
@app.route("/ssp.v1/tenant-networks/<tenant_net_uuid>", methods=["DELETE",])
|
||||
@ -62,7 +62,7 @@ def create_tenant_port():
|
||||
obj["uuid"] = str(uuid.uuid1())
|
||||
tenant_ports.append(obj)
|
||||
res = make_response(json.dumps(obj), 201)
|
||||
res.headers["Content-type"] = "application/json"
|
||||
res.headers["content-type"] = "application/json"
|
||||
return res
|
||||
|
||||
@app.route("/ssp.v1/tenant-ports/<tenant_port_uuid>", methods=["DELETE",])
|
||||
@ -87,7 +87,7 @@ def update_tenant_port(tenant_port_uuid):
|
||||
tenant_ports.remove(port)
|
||||
tenant_ports.append(obj)
|
||||
res = make_response(json.dumps(obj), 200)
|
||||
res.headers["Content-type"] = "application/json"
|
||||
res.headers["content-type"] = "application/json"
|
||||
return res
|
||||
return make_response("", 404)
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ public class DateraUtil {
|
||||
public static final String DRIVER_VERSION = "4.13.0-v2.0.0";
|
||||
|
||||
private static final String HEADER_AUTH_TOKEN = "auth-token";
|
||||
private static final String HEADER_CONTENT_TYPE = "Content-type";
|
||||
private static final String HEADER_CONTENT_TYPE = "content-type";
|
||||
private static final String HEADER_VALUE_JSON = "application/json";
|
||||
|
||||
public static final String MANAGEMENT_VIP = "mVip";
|
||||
|
||||
@ -317,7 +317,7 @@ public class ScaleIOGatewayClientImpl implements ScaleIOGatewayClient {
|
||||
while (authenticating); // wait for authentication request (if any) to complete (and to pick the new session key)
|
||||
final HttpPost request = new HttpPost(apiURI.toString() + path);
|
||||
request.setHeader(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString((this.username + ":" + this.sessionKey).getBytes()));
|
||||
request.setHeader("Content-type", "application/json");
|
||||
request.setHeader("content-type", "application/json");
|
||||
if (obj != null) {
|
||||
if (obj instanceof String) {
|
||||
request.setEntity(new StringEntity((String) obj));
|
||||
|
||||
@ -67,20 +67,20 @@ public class ScaleIOGatewayClientImplTest {
|
||||
public void setUp() throws Exception {
|
||||
wireMockRule.stubFor(get("/api/login")
|
||||
.willReturn(ok()
|
||||
.withHeader("Content-Type", "application/json;charset=UTF-8")
|
||||
.withHeader("content-type", "application/json;charset=UTF-8")
|
||||
.withBody(sessionKey)));
|
||||
|
||||
client = new ScaleIOGatewayClientImpl("https://localhost/api", username, password, false, timeout, maxConnections);
|
||||
|
||||
wireMockRule.stubFor(post("/api/types/Volume/instances")
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json;charset=UTF-8")
|
||||
.withHeader("content-type", "application/json;charset=UTF-8")
|
||||
.withStatus(200)
|
||||
.withBody("{\"id\":\"c948d0b10000000a\"}")));
|
||||
|
||||
wireMockRule.stubFor(get("/api/instances/Volume::c948d0b10000000a")
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json;charset=UTF-8")
|
||||
.withHeader("content-type", "application/json;charset=UTF-8")
|
||||
.withStatus(200)
|
||||
.withBody("{\"storagePoolId\":\"4daaa55e00000000\",\"dataLayout\":\"MediumGranularity\",\"vtreeId\":\"657e289500000009\","
|
||||
+ "\"sizeInKb\":8388608,\"snplIdOfAutoSnapshot\":null,\"volumeType\":\"ThinProvisioned\",\"consistencyGroupId\":null,"
|
||||
@ -103,7 +103,7 @@ public class ScaleIOGatewayClientImplTest {
|
||||
|
||||
wireMockRule.stubFor(get("/api/types/StoragePool/instances")
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json;charset=UTF-8")
|
||||
.withHeader("content-type", "application/json;charset=UTF-8")
|
||||
.withStatus(200)
|
||||
.withBody("")));
|
||||
|
||||
@ -117,7 +117,7 @@ public class ScaleIOGatewayClientImplTest {
|
||||
public void testClientAuthFailure() throws Exception {
|
||||
wireMockRule.stubFor(get("/api/login")
|
||||
.willReturn(unauthorized()
|
||||
.withHeader("Content-Type", "application/json;charset=UTF-8")
|
||||
.withHeader("content-type", "application/json;charset=UTF-8")
|
||||
.withBody("")));
|
||||
|
||||
new ScaleIOGatewayClientImpl("https://localhost/api", username, password, false, timeout, maxConnections);
|
||||
@ -131,7 +131,7 @@ public class ScaleIOGatewayClientImplTest {
|
||||
|
||||
wireMockRule.stubFor(get("/api/types/StoragePool/instances")
|
||||
.willReturn(aResponse()
|
||||
.withHeader("Content-Type", "application/json;charset=UTF-8")
|
||||
.withHeader("content-type", "application/json;charset=UTF-8")
|
||||
.withStatus(200)
|
||||
.withFixedDelay(2 * timeout * 1000)
|
||||
.withBody("")));
|
||||
@ -153,7 +153,7 @@ public class ScaleIOGatewayClientImplTest {
|
||||
wireMockRule.verify(postRequestedFor(urlEqualTo("/api/types/Volume/instances"))
|
||||
.withBasicAuth(new BasicCredentials(username, sessionKey))
|
||||
.withRequestBody(containing("\"name\":\"" + volumeName + "\""))
|
||||
.withHeader("Content-Type", equalTo("application/json")));
|
||||
.withHeader("content-type", equalTo("application/json")));
|
||||
wireMockRule.verify(getRequestedFor(urlEqualTo("/api/instances/Volume::c948d0b10000000a"))
|
||||
.withBasicAuth(new BasicCredentials(username, sessionKey)));
|
||||
|
||||
@ -190,7 +190,7 @@ public class ScaleIOGatewayClientImplTest {
|
||||
wireMockRule.verify(volumesCount, postRequestedFor(urlEqualTo("/api/types/Volume/instances"))
|
||||
.withBasicAuth(new BasicCredentials(username, sessionKey))
|
||||
.withRequestBody(containing("\"name\":\"" + volumeNamePrefix))
|
||||
.withHeader("Content-Type", equalTo("application/json")));
|
||||
.withHeader("content-type", equalTo("application/json")));
|
||||
wireMockRule.verify(volumesCount, getRequestedFor(urlEqualTo("/api/instances/Volume::c948d0b10000000a"))
|
||||
.withBasicAuth(new BasicCredentials(username, sessionKey)));
|
||||
}
|
||||
|
||||
@ -632,15 +632,15 @@ def put_object(url, token=None, container=None, name=None, contents=None,
|
||||
if etag:
|
||||
headers['ETag'] = etag.strip('"')
|
||||
if content_length is not None:
|
||||
headers['Content-Length'] = str(content_length)
|
||||
headers['content-length'] = str(content_length)
|
||||
else:
|
||||
for n, v in headers.iteritems():
|
||||
if n.lower() == 'content-length':
|
||||
content_length = int(v)
|
||||
if content_type is not None:
|
||||
headers['Content-Type'] = content_type
|
||||
headers['content-type'] = content_type
|
||||
if not contents:
|
||||
headers['Content-Length'] = '0'
|
||||
headers['content-length'] = '0'
|
||||
if hasattr(contents, 'read'):
|
||||
conn.putrequest('PUT', path)
|
||||
for header, value in headers.iteritems():
|
||||
|
||||
@ -167,9 +167,9 @@ class S3Client(object):
|
||||
DEFAULT_SOCKET_TIMEOUT = 50000
|
||||
DEFAULT_MAX_ERROR_RETRY = 3
|
||||
|
||||
HEADER_CONTENT_MD5 = 'Content-MD5'
|
||||
HEADER_CONTENT_TYPE = 'Content-Type'
|
||||
HEADER_CONTENT_LENGTH = 'Content-Length'
|
||||
HEADER_CONTENT_MD5 = 'content-md5'
|
||||
HEADER_CONTENT_TYPE = 'content-type'
|
||||
HEADER_CONTENT_LENGTH = 'content-length'
|
||||
|
||||
def __init__(self, access_key, secret_key, end_point=None,
|
||||
https_flag=None, connection_timeout=None, socket_timeout=None,
|
||||
|
||||
@ -66,7 +66,7 @@ def getTemplateSize(session, args):
|
||||
try:
|
||||
template = urllib2.urlopen(srcUrl)
|
||||
headers = template.info()
|
||||
return str(headers["Content-Length"])
|
||||
return str(headers["content-length"])
|
||||
except:
|
||||
return ""
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -634,15 +634,15 @@ def put_object(url, token=None, container=None, name=None, contents=None,
|
||||
if etag:
|
||||
headers['ETag'] = etag.strip('"')
|
||||
if content_length is not None:
|
||||
headers['Content-Length'] = str(content_length)
|
||||
headers['content-length'] = str(content_length)
|
||||
else:
|
||||
for n, v in headers.iteritems():
|
||||
if n.lower() == 'content-length':
|
||||
content_length = int(v)
|
||||
if content_type is not None:
|
||||
headers['Content-Type'] = content_type
|
||||
headers['content-type'] = content_type
|
||||
if not contents:
|
||||
headers['Content-Length'] = '0'
|
||||
headers['content-length'] = '0'
|
||||
if hasattr(contents, 'read'):
|
||||
conn.putrequest('PUT', path)
|
||||
for header, value in headers.iteritems():
|
||||
|
||||
@ -46,9 +46,9 @@ public class DirectDownloadManagerImplTest {
|
||||
@InjectMocks
|
||||
private DirectDownloadManagerImpl manager = new DirectDownloadManagerImpl();
|
||||
|
||||
private static final String HTTP_HEADER_1 = "Content-Type";
|
||||
private static final String HTTP_HEADER_1 = "content-type";
|
||||
private static final String HTTP_VALUE_1 = "application/x-www-form-urlencoded";
|
||||
private static final String HTTP_HEADER_2 = "Accept-Encoding";
|
||||
private static final String HTTP_HEADER_2 = "accept-encoding";
|
||||
private static final String HTTP_VALUE_2 = "gzip";
|
||||
|
||||
private static final String VALID_CERTIFICATE =
|
||||
|
||||
@ -211,7 +211,7 @@ public class ConsoleProxyAjaxHandler implements HttpHandler {
|
||||
|
||||
private void sendResponse(HttpExchange t, String contentType, String response) throws IOException {
|
||||
Headers hds = t.getResponseHeaders();
|
||||
hds.set("Content-Type", contentType);
|
||||
hds.set("content-type", contentType);
|
||||
|
||||
t.sendResponseHeaders(200, response.length());
|
||||
OutputStream os = t.getResponseBody();
|
||||
@ -383,9 +383,9 @@ public class ConsoleProxyAjaxHandler implements HttpHandler {
|
||||
String response = viewer.onAjaxClientStart(title, languages, guest);
|
||||
|
||||
Headers hds = t.getResponseHeaders();
|
||||
hds.set("Content-Type", "text/html");
|
||||
hds.set("Cache-Control", "no-cache");
|
||||
hds.set("Cache-Control", "no-store");
|
||||
hds.set("content-type", "text/html");
|
||||
hds.set("cache-control", "no-cache");
|
||||
hds.set("cache-control", "no-store");
|
||||
t.sendResponseHeaders(200, response.length());
|
||||
|
||||
OutputStream os = t.getResponseBody();
|
||||
@ -400,7 +400,7 @@ public class ConsoleProxyAjaxHandler implements HttpHandler {
|
||||
String response = viewer.onAjaxClientUpdate();
|
||||
|
||||
Headers hds = t.getResponseHeaders();
|
||||
hds.set("Content-Type", "text/javascript");
|
||||
hds.set("content-type", "text/javascript");
|
||||
t.sendResponseHeaders(200, response.length());
|
||||
|
||||
OutputStream os = t.getResponseBody();
|
||||
|
||||
@ -128,9 +128,9 @@ public class ConsoleProxyAjaxImageHandler implements HttpHandler {
|
||||
javax.imageio.ImageIO.write(bufferedImage, "jpg", bos);
|
||||
byte[] bs = bos.toByteArray();
|
||||
Headers hds = t.getResponseHeaders();
|
||||
hds.set("Content-Type", "image/jpeg");
|
||||
hds.set("Cache-Control", "no-cache");
|
||||
hds.set("Cache-Control", "no-store");
|
||||
hds.set("content-type", "image/jpeg");
|
||||
hds.set("cache-control", "no-cache");
|
||||
hds.set("cache-control", "no-store");
|
||||
t.sendResponseHeaders(200, bs.length);
|
||||
OutputStream os = t.getResponseBody();
|
||||
os.write(bs);
|
||||
@ -141,7 +141,7 @@ public class ConsoleProxyAjaxImageHandler implements HttpHandler {
|
||||
|
||||
if (img != null) {
|
||||
Headers hds = t.getResponseHeaders();
|
||||
hds.set("Content-Type", "image/jpeg");
|
||||
hds.set("content-type", "image/jpeg");
|
||||
t.sendResponseHeaders(200, img.length);
|
||||
|
||||
OutputStream os = t.getResponseBody();
|
||||
|
||||
@ -61,7 +61,7 @@ public class ConsoleProxyCmdHandler implements HttpHandler {
|
||||
ConsoleProxyClientStatsCollector statsCollector = ConsoleProxy.getStatsCollector();
|
||||
|
||||
Headers hds = t.getResponseHeaders();
|
||||
hds.set("Content-Type", "text/plain");
|
||||
hds.set("content-type", "text/plain");
|
||||
t.sendResponseHeaders(200, 0);
|
||||
OutputStreamWriter os = new OutputStreamWriter(t.getResponseBody(),"UTF-8");
|
||||
statsCollector.getStatsReport(os);
|
||||
|
||||
@ -111,7 +111,7 @@ public class ConsoleProxyResourceHandler implements HttpHandler {
|
||||
long d = Date.parse(ifModifiedSince);
|
||||
if (d + 1000 >= lastModified) {
|
||||
Headers hds = t.getResponseHeaders();
|
||||
hds.set("Content-Type", contentType);
|
||||
hds.set("content-type", contentType);
|
||||
t.sendResponseHeaders(304, -1);
|
||||
|
||||
if (s_logger.isInfoEnabled())
|
||||
@ -122,8 +122,8 @@ public class ConsoleProxyResourceHandler implements HttpHandler {
|
||||
|
||||
long length = f.length();
|
||||
Headers hds = t.getResponseHeaders();
|
||||
hds.set("Content-Type", contentType);
|
||||
hds.set("Last-Modified", new Date(lastModified).toGMTString());
|
||||
hds.set("content-type", contentType);
|
||||
hds.set("last-modified", new Date(lastModified).toGMTString());
|
||||
t.sendResponseHeaders(200, length);
|
||||
responseFileContent(t, f);
|
||||
|
||||
|
||||
@ -87,9 +87,9 @@ public class ConsoleProxyThumbnailHandler implements HttpHandler {
|
||||
javax.imageio.ImageIO.write(img, "jpg", bos);
|
||||
byte[] bs = bos.toByteArray();
|
||||
Headers hds = t.getResponseHeaders();
|
||||
hds.set("Content-Type", "image/jpeg");
|
||||
hds.set("Cache-Control", "no-cache");
|
||||
hds.set("Cache-Control", "no-store");
|
||||
hds.set("content-type", "image/jpeg");
|
||||
hds.set("cache-control", "no-cache");
|
||||
hds.set("cache-control", "no-store");
|
||||
t.sendResponseHeaders(200, bs.length);
|
||||
OutputStream os = t.getResponseBody();
|
||||
os.write(bs);
|
||||
@ -149,9 +149,9 @@ public class ConsoleProxyThumbnailHandler implements HttpHandler {
|
||||
javax.imageio.ImageIO.write(img, "jpg", bos);
|
||||
byte[] bs = bos.toByteArray();
|
||||
Headers hds = t.getResponseHeaders();
|
||||
hds.set("Content-Type", "image/jpeg");
|
||||
hds.set("Cache-Control", "no-cache");
|
||||
hds.set("Cache-Control", "no-store");
|
||||
hds.set("content-type", "image/jpeg");
|
||||
hds.set("cache-control", "no-cache");
|
||||
hds.set("cache-control", "no-store");
|
||||
t.sendResponseHeaders(200, bs.length);
|
||||
OutputStream os = t.getResponseBody();
|
||||
os.write(bs);
|
||||
@ -171,9 +171,9 @@ public class ConsoleProxyThumbnailHandler implements HttpHandler {
|
||||
javax.imageio.ImageIO.write(bufferedImage, "jpg", bos);
|
||||
byte[] bs = bos.toByteArray();
|
||||
Headers hds = t.getResponseHeaders();
|
||||
hds.set("Content-Type", "image/jpeg");
|
||||
hds.set("Cache-Control", "no-cache");
|
||||
hds.set("Cache-Control", "no-store");
|
||||
hds.set("content-type", "image/jpeg");
|
||||
hds.set("cache-control", "no-cache");
|
||||
hds.set("cache-control", "no-store");
|
||||
t.sendResponseHeaders(200, bs.length);
|
||||
OutputStream os = t.getResponseBody();
|
||||
os.write(bs);
|
||||
|
||||
@ -79,13 +79,13 @@ public class HttpUploadServerHandler extends SimpleChannelInboundHandler<HttpObj
|
||||
|
||||
private boolean requestProcessed = false;
|
||||
|
||||
private static final String HEADER_SIGNATURE = "X-signature";
|
||||
private static final String HEADER_SIGNATURE = "x-signature";
|
||||
|
||||
private static final String HEADER_METADATA = "X-metadata";
|
||||
private static final String HEADER_METADATA = "x-metadata";
|
||||
|
||||
private static final String HEADER_EXPIRES = "X-expires";
|
||||
private static final String HEADER_EXPIRES = "x-expires";
|
||||
|
||||
private static final String HEADER_HOST = "X-Forwarded-Host";
|
||||
private static final String HEADER_HOST = "x-forwarded-host";
|
||||
|
||||
private static long processTimeout;
|
||||
|
||||
@ -152,7 +152,7 @@ public class HttpUploadServerHandler extends SimpleChannelInboundHandler<HttpObj
|
||||
logger.info("HEADER: metadata=" + metadata);
|
||||
logger.info("HEADER: expires=" + expires);
|
||||
logger.info("HEADER: hostname=" + hostname);
|
||||
logger.info("HEADER: Content-Length=" + contentLength);
|
||||
logger.info("HEADER: content-length=" + contentLength);
|
||||
QueryStringDecoder decoderQuery = new QueryStringDecoder(uri);
|
||||
Map<String, List<String>> uriAttributes = decoderQuery.parameters();
|
||||
uuid = uriAttributes.get("uuid").get(0);
|
||||
@ -279,7 +279,7 @@ public class HttpUploadServerHandler extends SimpleChannelInboundHandler<HttpObj
|
||||
FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, statusCode, buf);
|
||||
response.headers().set(CONTENT_TYPE, "text/plain; charset=UTF-8");
|
||||
if (!close) {
|
||||
// There's no need to add 'Content-Length' header if this is the last response.
|
||||
// There's no need to add 'content-length' header if this is the last response.
|
||||
response.headers().set(CONTENT_LENGTH, buf.readableBytes());
|
||||
}
|
||||
// Write the response.
|
||||
|
||||
@ -106,7 +106,7 @@ class PasswordRequestHandler(BaseHTTPRequestHandler):
|
||||
sys_version = '4.x'
|
||||
def do_GET(self):
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type', 'text/plain')
|
||||
self.send_header('content-type', 'text/plain')
|
||||
self.send_header('Server', 'CloudStack Password Server')
|
||||
self.end_headers()
|
||||
requestType = self.headers.get('DomU_Request')
|
||||
@ -135,7 +135,7 @@ class PasswordRequestHandler(BaseHTTPRequestHandler):
|
||||
fp=self.rfile,
|
||||
headers=self.headers,
|
||||
environ={'REQUEST_METHOD':'POST',
|
||||
'CONTENT_TYPE':self.headers['Content-Type'],
|
||||
'CONTENT_TYPE':self.headers['content-type'],
|
||||
})
|
||||
self.send_response(200)
|
||||
self.end_headers()
|
||||
|
||||
@ -61,7 +61,7 @@ RewriteCond %{REQUEST_METHOD} =POST
|
||||
RewriteRule ^/upload/(.*) http://127.0.0.1:8210/upload?uuid=\$1 [P,L]
|
||||
Header always set Access-Control-Allow-Origin "*"
|
||||
Header always set Access-Control-Allow-Methods "POST, OPTIONS"
|
||||
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token, x-signature, x-metadata, x-expires"
|
||||
Header always set Access-Control-Allow-Headers "x-requested-with, content-type, origin, authorization, accept, client-security-token, x-signature, x-metadata, x-expires"
|
||||
HTTPS
|
||||
else
|
||||
if [ -f /etc/apache2/https.conf ]; then
|
||||
@ -73,7 +73,7 @@ RewriteCond %{REQUEST_METHOD} =POST
|
||||
RewriteRule ^/upload/(.*) http://127.0.0.1:8210/upload?uuid=\$1 [P,L]
|
||||
Header always set Access-Control-Allow-Origin "*"
|
||||
Header always set Access-Control-Allow-Methods "POST, OPTIONS"
|
||||
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token, x-signature, x-metadata, x-expires"
|
||||
Header always set Access-Control-Allow-Headers "x-requested-with, content-type, origin, authorization, accept, client-security-token, x-signature, x-metadata, x-expires"
|
||||
HTTP
|
||||
fi
|
||||
|
||||
|
||||
@ -276,11 +276,11 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
#files={'file':('rajani-thin-volume.vhd',open(uploadfile,'rb'),'application/octet-stream')}
|
||||
|
||||
#headers={'X-signature':signt,'X-metadata':metadata,'X-expires':expiredata}
|
||||
#headers={'x-signature':signt,'x-metadata':metadata,'x-expires':expiredata}
|
||||
|
||||
files={'file':(uploadfile,open(uploadfile,'rb'),'application/octet-stream')}
|
||||
|
||||
headers={'X-signature':signt,'X-metadata':metadata,'X-expires':expiredata}
|
||||
headers={'x-signature':signt,'x-metadata':metadata,'x-expires':expiredata}
|
||||
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
|
||||
@ -373,7 +373,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
files={'file':(uploadfile,open(uploadfile,'rb'),'application/octet-stream')}
|
||||
|
||||
headers={'X-signature':signt,'X-metadata':metadata,'X-expires':expiredata}
|
||||
headers={'x-signature':signt,'x-metadata':metadata,'x-expires':expiredata}
|
||||
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
|
||||
@ -419,11 +419,11 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
#files={'file':('rajani-thin-volume.vhd',open(uploadfile,'rb'),'application/octet-stream')}
|
||||
|
||||
#headers={'X-signature':signt,'X-metadata':metadata,'X-expires':expiredata}
|
||||
#headers={'x-signature':signt,'x-metadata':metadata,'x-expires':expiredata}
|
||||
|
||||
files={'file':(uploadfile,open(uploadfile,'rb'),'application/octet-stream')}
|
||||
|
||||
headers={'X-signature':signt,'X-metadata':metadata,'X-expires':expiredata}
|
||||
headers={'x-signature':signt,'x-metadata':metadata,'x-expires':expiredata}
|
||||
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
|
||||
@ -468,11 +468,11 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
#files={'file':('rajani-thin-volume.vhd',open(uploadfile,'rb'),'application/octet-stream')}
|
||||
|
||||
#headers={'X-signature':signt,'X-metadata':metadata,'X-expires':expiredata}
|
||||
#headers={'x-signature':signt,'x-metadata':metadata,'x-expires':expiredata}
|
||||
|
||||
files={'file':(uploadfile,open(uploadfile,'rb'),'application/octet-stream')}
|
||||
|
||||
headers={'X-signature':signt,'X-metadata':metadata,'X-expires':expiredata}
|
||||
headers={'x-signature':signt,'x-metadata':metadata,'x-expires':expiredata}
|
||||
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
time.sleep(60)
|
||||
|
||||
@ -198,7 +198,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
files = {'file': (uploadfile, open(uploadfile, 'rb'), 'application/octet-stream')}
|
||||
|
||||
headers = {'X-signature': signt, 'X-metadata': metadata, 'X-expires': expiredata}
|
||||
headers = {'x-signature': signt, 'x-metadata': metadata, 'x-expires': expiredata}
|
||||
|
||||
results = requests.post(posturl, files=files, headers=headers, verify=False)
|
||||
|
||||
@ -280,7 +280,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
files = {'file': (uploadfile, open(uploadfile, 'rb'), 'application/octet-stream')}
|
||||
|
||||
headers = {'X-signature': signt, 'X-metadata': metadata, 'X-expires': expiredata}
|
||||
headers = {'x-signature': signt, 'x-metadata': metadata, 'x-expires': expiredata}
|
||||
|
||||
results = requests.post(posturl, files=files, headers=headers, verify=False)
|
||||
|
||||
@ -353,7 +353,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
files = {'file': (uploadfile, open(uploadfile, 'rb'), 'application/octet-stream')}
|
||||
|
||||
headers = {'X-signature': signt, 'X-metadata': metadata, 'X-expires': expiredata}
|
||||
headers = {'x-signature': signt, 'x-metadata': metadata, 'x-expires': expiredata}
|
||||
|
||||
results = requests.post(posturl, files=files, headers=headers, verify=False)
|
||||
|
||||
@ -400,7 +400,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
files = {'file': (uploadfile, open(uploadfile, 'rb'), 'application/octet-stream')}
|
||||
|
||||
headers = {'X-signature': signt, 'X-metadata': metadata, 'X-expires': expiredata}
|
||||
headers = {'x-signature': signt, 'x-metadata': metadata, 'x-expires': expiredata}
|
||||
|
||||
results = requests.post(posturl, files=files, headers=headers, verify=False)
|
||||
time.sleep(60)
|
||||
@ -514,11 +514,11 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
# files={'file':('rajani-thin-volume.vhd',open(uploadfile,'rb'),'application/octet-stream')}
|
||||
|
||||
# headers={'X-signature':signt,'X-metadata':metadata,'X-expires':expiredata}
|
||||
# headers={'x-signature':signt,'x-metadata':metadata,'x-expires':expiredata}
|
||||
|
||||
files = {'file': (uploadfile, open(uploadfile, 'rb'), 'application/octet-stream')}
|
||||
|
||||
headers = {'X-signature': signt, 'X-metadata': metadata, 'X-expires': expiredata}
|
||||
headers = {'x-signature': signt, 'x-metadata': metadata, 'x-expires': expiredata}
|
||||
|
||||
results = requests.post(posturl, files=files, headers=headers, verify=False)
|
||||
time.sleep(60)
|
||||
@ -559,11 +559,11 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
# files={'file':('rajani-thin-volume.vhd',open(uploadfile,'rb'),'application/octet-stream')}
|
||||
|
||||
# headers={'X-signature':signt,'X-metadata':metadata,'X-expires':expiredata}
|
||||
# headers={'x-signature':signt,'x-metadata':metadata,'x-expires':expiredata}
|
||||
|
||||
files = {'file': (uploadfile, open(uploadfile, 'rb'), 'application/octet-stream')}
|
||||
|
||||
headers = {'X-signature': signt, 'X-metadata': metadata, 'X-expires': expiredata}
|
||||
headers = {'x-signature': signt, 'x-metadata': metadata, 'x-expires': expiredata}
|
||||
|
||||
results = requests.post(posturl, files=files, headers=headers, verify=False)
|
||||
time.sleep(60)
|
||||
@ -1622,7 +1622,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
files = {'file': (uploadfile, open(uploadfile, 'rb'), 'application/octet-stream')}
|
||||
|
||||
headers = {'X-signature': signt, 'X-metadata': metadata, 'X-expires': expiredata}
|
||||
headers = {'x-signature': signt, 'x-metadata': metadata, 'x-expires': expiredata}
|
||||
|
||||
results = requests.post(posturl, files=files, headers=headers, verify=False)
|
||||
list_volume_response = Volume.list(
|
||||
@ -1675,7 +1675,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
files = {'file': (uploadfile, open(uploadfile, 'rb'), 'application/octet-stream')}
|
||||
|
||||
headers = {'X-signature': signt, 'X-metadata': metadata, 'X-expires': expiredata}
|
||||
headers = {'x-signature': signt, 'x-metadata': metadata, 'x-expires': expiredata}
|
||||
|
||||
results = requests.post(posturl, files=files, headers=headers, verify=False)
|
||||
list_volume_response = Volume.list(
|
||||
@ -1719,7 +1719,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
files = {'file': (uploadfile, open(uploadfile, 'rb'), 'application/octet-stream')}
|
||||
|
||||
headers = {'X-signature': signt, 'X-metadata': metadata, 'X-expires': expiredata}
|
||||
headers = {'x-signature': signt, 'x-metadata': metadata, 'x-expires': expiredata}
|
||||
|
||||
results = requests.post(posturl, files=files, headers=headers, verify=False)
|
||||
|
||||
@ -1762,7 +1762,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
files = {'file': (uploadfile, open(uploadfile, 'rb'), 'application/octet-stream')}
|
||||
|
||||
headers = {'X-signature': signt, 'X-metadata': metadata, 'X-expires': expiredata}
|
||||
headers = {'x-signature': signt, 'x-metadata': metadata, 'x-expires': expiredata}
|
||||
|
||||
results = requests.post(posturl, files=files, headers=headers, verify=False)
|
||||
|
||||
@ -1869,7 +1869,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
files = {'file': (uploadfile, open(uploadfile, 'rb'), 'application/octet-stream')}
|
||||
|
||||
headers = {'X-signature': signt, 'X-metadata': metadata, 'X-expires': expiredata}
|
||||
headers = {'x-signature': signt, 'x-metadata': metadata, 'x-expires': expiredata}
|
||||
|
||||
results = requests.post(posturl, files=files, headers=headers, verify=False)
|
||||
|
||||
@ -1906,7 +1906,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
files = {'file': (uploadfile, open(uploadfile, 'rb'), 'application/octet-stream')}
|
||||
|
||||
headers = {'X-signature': signt, 'X-metadata': metadata, 'X-expires': expiredata}
|
||||
headers = {'x-signature': signt, 'x-metadata': metadata, 'x-expires': expiredata}
|
||||
|
||||
results = requests.post(posturl, files=files, headers=headers, verify=False)
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ class MockedCloudStackServer(BaseHTTPRequestHandler):
|
||||
apiRequests.append(command)
|
||||
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type','application/json')
|
||||
self.send_header('content-type','application/json')
|
||||
self.end_headers()
|
||||
|
||||
json = "{\"listvirtualmachinesresponse\":{\"count\":1,\"virtualmachine\":[{\"id\":\"some-uuid\",\"name\":\"test-vm\",\"state\":\"%s\"}]}}" % state
|
||||
|
||||
@ -136,7 +136,7 @@ runner = xmlrunner.XMLTestRunner(output='test-reports')
|
||||
|
||||
#header is required for displaying the website
|
||||
#Comment following line for XML and uncomment for HTML
|
||||
#print "Content-Type: text/html\n"
|
||||
#print "content-type: text/html\n"
|
||||
|
||||
# Leave following as is for either XML or HTML
|
||||
runner.run(suite)
|
||||
|
||||
@ -22,7 +22,7 @@ version="1.0">
|
||||
<xsl:output method="html" doctype-public="-//W3C//DTD HTML 1.0 Transitional//EN"/>
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<link rel= "stylesheet" href="../includes/main.css" type="text/css" />
|
||||
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ version="1.0">
|
||||
<xsl:output method="html" doctype-public="-//W3C//DTD HTML 1.0 Transitional//EN"/>
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<link rel= "stylesheet" href="../includes/main.css" type="text/css" />
|
||||
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ version="1.0">
|
||||
<xsl:output method="html" doctype-public="-//W3C//DTD HTML 1.0 Transitional//EN"/>
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<link rel= "stylesheet" href="includes/main.css" type="text/css" />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ class NCC:
|
||||
url = "http://"+self.nccip+"/nitro/v1/config/managed_device/"
|
||||
payload = 'object={"params":{"action":"add_device"}, "managed_device":{"ip_address":"%s",\
|
||||
"profile_name":"ns_nsroot_profile", "sync_operation":"false"}}' % self.nsip
|
||||
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
|
||||
headers = {'content-type': 'application/x-www-form-urlencoded'}
|
||||
cmd_response = self.sendCmdToNS(url, payload, header=headers)
|
||||
if cmd_response == FAILED:
|
||||
raise Exception("Error: %s" % self.__lastError)
|
||||
@ -74,7 +74,7 @@ class NCC:
|
||||
url = "http://"+self.nccip+"/nitro/v1/config/tag/"
|
||||
payload = 'object={"tag": {"entity_type": "managed_device", "entity_id": "%s",\
|
||||
"tag_key": "zone", "tag_value": "%s"}}' % (self.nsip, cs_zone)
|
||||
header = {'Content-Type':'application/x-www-form-urlencoded'}
|
||||
header = {'content-type':'application/x-www-form-urlencoded'}
|
||||
cmd_response = self.sendCmdToNS(url, payload, header=header)
|
||||
if cmd_response == FAILED:
|
||||
raise Exception("Error: %s" % self.__lastError)
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<title>Apache CloudStack</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
2
ui/public/error.html
vendored
2
ui/public/error.html
vendored
@ -20,7 +20,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<title>Apache CloudStack</title>
|
||||
<link rel="shortcut icon" href="images/cloud.ico" />
|
||||
</head>
|
||||
|
||||
@ -59,7 +59,7 @@ export function login (arg) {
|
||||
method: 'post',
|
||||
data: params,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -360,10 +360,10 @@ export default {
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'X-signature': this.uploadParams.signature,
|
||||
'X-expires': this.uploadParams.expires,
|
||||
'X-metadata': this.uploadParams.metadata
|
||||
'content-type': 'multipart/form-data',
|
||||
'x-signature': this.uploadParams.signature,
|
||||
'x-expires': this.uploadParams.expires,
|
||||
'x-metadata': this.uploadParams.metadata
|
||||
},
|
||||
onUploadProgress: (progressEvent) => {
|
||||
this.uploadPercentage = Number(parseFloat(100 * progressEvent.loaded / progressEvent.total).toFixed(1))
|
||||
|
||||
@ -486,10 +486,10 @@ export default {
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'X-signature': this.uploadParams.signature,
|
||||
'X-expires': this.uploadParams.expires,
|
||||
'X-metadata': this.uploadParams.metadata
|
||||
'content-type': 'multipart/form-data',
|
||||
'x-signature': this.uploadParams.signature,
|
||||
'x-expires': this.uploadParams.expires,
|
||||
'x-metadata': this.uploadParams.metadata
|
||||
},
|
||||
onUploadProgress: (progressEvent) => {
|
||||
this.uploadPercentage = Number(parseFloat(100 * progressEvent.loaded / progressEvent.total).toFixed(1))
|
||||
|
||||
@ -347,10 +347,10 @@ export default {
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'X-signature': this.uploadParams.signature,
|
||||
'X-expires': this.uploadParams.expires,
|
||||
'X-metadata': this.uploadParams.metadata
|
||||
'content-type': 'multipart/form-data',
|
||||
'x-signature': this.uploadParams.signature,
|
||||
'x-expires': this.uploadParams.expires,
|
||||
'x-metadata': this.uploadParams.metadata
|
||||
},
|
||||
onUploadProgress: (progressEvent) => {
|
||||
this.uploadPercentage = Number(parseFloat(100 * progressEvent.loaded / progressEvent.total).toFixed(1))
|
||||
|
||||
@ -230,7 +230,7 @@ public class UriUtils {
|
||||
httpConn.setRequestMethod(method);
|
||||
httpConn.setConnectTimeout(2000);
|
||||
httpConn.setReadTimeout(5000);
|
||||
String contentLength = httpConn.getHeaderField("Content-Length");
|
||||
String contentLength = httpConn.getHeaderField("content-length");
|
||||
if (contentLength != null) {
|
||||
remoteSize = Long.parseLong(contentLength);
|
||||
} else if (method.equals("GET") && httpConn.getResponseCode() < 300) {
|
||||
|
||||
@ -29,6 +29,6 @@ public class HttpConstants {
|
||||
public static final String POST_METHOD_TYPE = "post";
|
||||
public static final String TEXT_HTML_CONTENT_TYPE = "text/html";
|
||||
public static final String JSON_CONTENT_TYPE = "application/json";
|
||||
public static final String CONTENT_TYPE = "Content-Type";
|
||||
public static final String CONTENT_TYPE = "content-type";
|
||||
|
||||
}
|
||||
|
||||
@ -379,8 +379,8 @@ public class VmwareContext {
|
||||
conn.setRequestMethod(httpMethod);
|
||||
conn.setRequestProperty("Connection", "Keep-Alive");
|
||||
String contentType = "application/octet-stream";
|
||||
conn.setRequestProperty("Content-Type", contentType);
|
||||
conn.setRequestProperty("Content-Length", Long.toString(new File(localFileName).length()));
|
||||
conn.setRequestProperty("content-type", contentType);
|
||||
conn.setRequestProperty("content-length", Long.toString(new File(localFileName).length()));
|
||||
connectWithRetry(conn);
|
||||
OutputStream out = null;
|
||||
InputStream in = null;
|
||||
@ -436,8 +436,8 @@ public class VmwareContext {
|
||||
String contentType = urlString.endsWith(".iso") ?
|
||||
"application/octet-stream" :
|
||||
"application/x-vnd.vmware-streamVmdk";
|
||||
conn.setRequestProperty("Content-Type", contentType);
|
||||
conn.setRequestProperty("Content-Length", Long.toString(new File(localFileName).length()));
|
||||
conn.setRequestProperty("content-type", contentType);
|
||||
conn.setRequestProperty("content-length", Long.toString(new File(localFileName).length()));
|
||||
connectWithRetry(conn);
|
||||
|
||||
BufferedOutputStream bos = null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user