Correctly serialize provisioning addresses.

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2015-03-24 12:10:59 -07:00
parent a58f3f0fe3
commit 843b16c1f0
3 changed files with 18 additions and 11 deletions

View File

@@ -52,10 +52,16 @@ public class ProvisioningConnection implements DispatchChannel {
@Override
public void onDispatchSubscribed(String channel) {
this.client.sendRequest("PUT", "/v1/address", Optional.of(ProvisioningUuid.newBuilder()
.setUuid(channel)
.build()
.toByteArray()));
try {
ProvisioningAddress address = new ProvisioningAddress(channel);
this.client.sendRequest("PUT", "/v1/address", Optional.of(ProvisioningUuid.newBuilder()
.setUuid(address.getAddress())
.build()
.toByteArray()));
} catch (InvalidWebsocketAddressException e) {
logger.warn("Badly formatted address", e);
this.client.close(1001, "Server Error");
}
}
@Override