Details

Description

I have created and done some testing of a HttpTransport for the C# library. I started with the Java implementation and ported/created a C# version of it based on the WebHttpRequest object in the .NET BCLs.

Michael Greene
added a comment - 07/Oct/08 22:13 This agent should identify itself as something other than "Java/THttpClient"
The coding style is a little different than other Thrift C# code.
For example, see the empty method and simple property styles on Open and IsOpen in TStreamTransport.cs versus in the attached file.
Tabs/spaces are different as well – I'm not sure how important that is.
The checks for null streams could pass TTransportException.ExceptionType.NotOpen as the first parameter of the constructed TTransportException.
The header should probably reference the Apache site as opposed to the Facebook one

Is there a reason for doing the conversion to System.Uri internal to the object on construction? It seems more in keeping with .NET, and ever so slightly more performant, to just accept the Uri itself.

Additionally, this would remove the need for a try/catch block (if there was a need to begin with) in the constructor.

Michael Greene
added a comment - 08/Oct/08 00:02 Is there a reason for doing the conversion to System.Uri internal to the object on construction? It seems more in keeping with .NET, and ever so slightly more performant, to just accept the Uri itself.
Additionally, this would remove the need for a try/catch block (if there was a need to begin with) in the constructor.

Brian O'Neil
added a comment - 08/Oct/08 01:57 Sorry, I did a quick port of the Java THttpClient class because I needed it to be able to do something and thought that the work would be useful.
Most of the comment relate to things that are put together from the Java one. I will try to come back and make some updates to it as soon as I get a chance.

I recently had need of the same thing, so I adjusted the patch above with the suggestions, as well as some general cleanup. I also tried to override the Peek method, but it looks like it isn't virtual in TTransport.cs, which differs from the c++ version (not sure which one is correct).

I've also included a patch for the client, such that when the URL parameter is passed on the command line it uses THTTPClient.cs. The URL parameter didn't do anything before, as far as I could tell.

Todd Gardner
added a comment - 07/Oct/09 21:08 I recently had need of the same thing, so I adjusted the patch above with the suggestions, as well as some general cleanup. I also tried to override the Peek method, but it looks like it isn't virtual in TTransport.cs, which differs from the c++ version (not sure which one is correct).
I've also included a patch for the client, such that when the URL parameter is passed on the command line it uses THTTPClient.cs. The URL parameter didn't do anything before, as far as I could tell.

I have been using this patch for some time now without any problems. Are there any outstanding fixes that need to be made before the patch is integrated into the codebase? If there are, I would be happy to complete any work that is required for getting this integrated.

Anatoly Fayngelerin
added a comment - 24/Jun/10 13:34 I have been using this patch for some time now without any problems. Are there any outstanding fixes that need to be made before the patch is integrated into the codebase? If there are, I would be happy to complete any work that is required for getting this integrated.

Bryan Duxbury
added a comment - 24/Jun/10 15:29 Unless one of the CSharp committers wants to take care of this, I'm happy to commit it. Just to be clear, you want the latest version of the patch committed with no modifications?

This patch makes spaces/tabs conform with the rest of the Thrift C# code, removes the author attribution, fixes some CRLF inconsistency, and adds the THttpClient to both the Makefile and the csproj file.

Michael Greene
added a comment - 24/Jun/10 16:28 This patch makes spaces/tabs conform with the rest of the Thrift C# code, removes the author attribution, fixes some CRLF inconsistency, and adds the THttpClient to both the Makefile and the csproj file.
It replaces the previous .cs file and .patch