You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2013/12/30 22:06:37 UTC
git commit: THRIFT-2297: TJsonProtocol implementation for Delphi does
not allow for both possible slash (solidus) encodings, including a test case
Updated Branches:
refs/heads/master ad0141aea -> 2136694a2
THRIFT-2297: TJsonProtocol implementation for Delphi does not allow for both possible slash (solidus) encodings, including a test case
Patch: Jens Geyer
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/2136694a
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/2136694a
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/2136694a
Branch: refs/heads/master
Commit: 2136694a2045120af80fb7064f600a75f793720c
Parents: ad0141a
Author: Jens Geyer <je...@apache.org>
Authored: Mon Dec 30 22:04:51 2013 +0100
Committer: Jens Geyer <je...@apache.org>
Committed: Mon Dec 30 22:06:08 2013 +0100
----------------------------------------------------------------------
lib/delphi/src/Thrift.Protocol.JSON.pas | 4 ++--
lib/delphi/test/TestClient.pas | 14 ++++++++++++++
2 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/2136694a/lib/delphi/src/Thrift.Protocol.JSON.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/src/Thrift.Protocol.JSON.pas b/lib/delphi/src/Thrift.Protocol.JSON.pas
index 2cc4bbd..cce6c3c 100644
--- a/lib/delphi/src/Thrift.Protocol.JSON.pas
+++ b/lib/delphi/src/Thrift.Protocol.JSON.pas
@@ -264,8 +264,8 @@ const
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
1,1,Byte('"'),1, 1,1,1,1, 1,1,1,1, 1,1,1,1);
- ESCAPE_CHARS = '"\btnfr';
- ESCAPE_CHAR_VALS = '"\'#8#9#10#12#13;
+ ESCAPE_CHARS = '"\/btnfr';
+ ESCAPE_CHAR_VALS = '"\/'#8#9#10#12#13;
DEF_STRING_SIZE = 16;
http://git-wip-us.apache.org/repos/asf/thrift/blob/2136694a/lib/delphi/test/TestClient.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/test/TestClient.pas b/lib/delphi/test/TestClient.pas
index e63bd4c..0f09489 100644
--- a/lib/delphi/test/TestClient.pas
+++ b/lib/delphi/test/TestClient.pas
@@ -898,6 +898,9 @@ const
TEST_DOUBLE = -1.234e-56;
DELTA_DOUBLE = TEST_DOUBLE * 1e-14;
TEST_STRING = 'abc-'#$00E4#$00f6#$00fc; // german umlauts (en-us: "funny chars")
+ // test both possible solidus encodings
+ SOLIDUS_JSON_DATA = '"one/two\/three"';
+ SOLIDUS_EXCPECTED = 'one/two/three';
begin
stm := TStringStream.Create;
try
@@ -962,6 +965,17 @@ begin
Expect( stm.Position = stm.Size, 'Stream position after read');
+ // Solidus can be encoded in two ways. Make sure we can read both
+ stm.Position := 0;
+ stm.Size := 0;
+ stm.WriteString(SOLIDUS_JSON_DATA);
+ stm.Position := 0;
+ prot := TJSONProtocolImpl.Create(
+ TStreamTransportImpl.Create(
+ TThriftStreamAdapterDelphi.Create( stm, FALSE), nil));
+ Expect( prot.ReadString = SOLIDUS_EXCPECTED, 'Solidus encoding');
+
+
finally
stm.Free;
prot := nil; //-> Release