[ 
https://issues.apache.org/jira/browse/THRIFT-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16266159#comment-16266159
 ] 

Chet Murthy edited comment on THRIFT-3877 at 11/26/17 7:59 PM:
---------------------------------------------------------------

[being tentative b/c I sure can't claim to fully-understand this code yet]

Yeah, it looks like the problem was with the logic of HTTP read-buffering in 
"httpBuf_" and the
 various http{BufLen,BufSize,Pos} indexes into it.  This patch seems to make 
the problem 
disappear, but geez, I sure would like a unit-test that demonstrates the 
problem is gone.  I'll work
 on that ....
{code:java}
@@ -84,8 +93,10 @@ uint32_t THttpTransport::readEnd() {
 uint32_t THttpTransport::readMoreData() {
   uint32_t size;
 
-  // Get more data!
-  refill();
+  if (httpPos_ == httpBufLen_) {
+    // Get more data!
+    refill();
+  }
 
   if (readHeaders_) {
     readHeaders();
{code}



was (Author: chetmurthy):
[being tentative b/c I sure can't claim to fully-understand this code yet]

Yeah, it looks like the problem was with the logic of HTTP read-buffering in 
"httpBuf_" and the various http{BufLen,BufSize,Pos} indexes into it.  This 
patch seems to make the problem disappear, but geez, I sure would like a 
unit-test that demonstrates the problem is gone.  I'll work on that ....
{code:java}
@@ -84,8 +93,10 @@ uint32_t THttpTransport::readEnd() {
 uint32_t THttpTransport::readMoreData() {
   uint32_t size;
 
-  // Get more data!
-  refill();
+  if (httpPos_ == httpBufLen_) {
+    // Get more data!
+    refill();
+  }
 
   if (readHeaders_) {
     readHeaders();
{code}


> C++: library don't work with HTTP.
> ----------------------------------
>
>                 Key: THRIFT-3877
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3877
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9.3, 0.10.0
>         Environment: Windows 7, Visual Studio 2013 (C#), Qt 5.7 (MSVC 12).
> Thrift from git repo, SHA-1: 5a3f855b4e6882184f13c698855c877241144a12 (master)
>            Reporter: Sergey Fasman
>            Priority: Critical
>
> Client on C++.
> Tested on C# HTTP server and client — work ideal.
> Then create client on C++. Client after request starts infinitly wait for 
> data.
> For example, JSON protocol read data symbol by symbol, when trying read: it 
> always try to call recv function (even all data already received).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to