Skip to content

Commit

Permalink
Fix const correctness of the API.
Browse files Browse the repository at this point in the history
Make the API more straightforward for external users by getting the
const correctness ... correct.
  • Loading branch information
bbockelm committed Dec 21, 2017
1 parent d4cf0c0 commit d7880bc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/XrdHttp/XrdHttpExtHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@
#include "XrdHttpProtocol.hh"

/// Sends a basic response. If the length is < 0 then it is calculated internally
int XrdHttpExtReq::SendSimpleResp(int code, char* desc, char* header_to_add, char* body, long long int bodylen)
int XrdHttpExtReq::SendSimpleResp(int code, const char* desc, const char* header_to_add, const char* body, long long int bodylen)
{
if (!prot) return -1;

return prot->SendSimpleResp(code, desc, header_to_add, body, bodylen);
}

int XrdHttpExtReq::StartChunkedResp(int code, char *desc, char *header_to_add)
int XrdHttpExtReq::StartChunkedResp(int code, const char *desc, const char *header_to_add)
{
if (!prot) return -1;

return prot->StartChunkedResp(code, desc, header_to_add);
}

int XrdHttpExtReq::ChunkResp(char *body, long long bodylen)
int XrdHttpExtReq::ChunkResp(const char *body, long long bodylen)
{
if (!prot) return -1;

Expand Down
6 changes: 3 additions & 3 deletions src/XrdHttp/XrdHttpExtHandler.hh
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ public:
int BuffgetData(int blen, char **data, bool wait);

/// Sends a basic response. If the length is < 0 then it is calculated internally
int SendSimpleResp(int code, char *desc, char *header_to_add, char *body, long long bodylen);
int SendSimpleResp(int code, const char *desc, const char *header_to_add, const char *body, long long bodylen);

/// Starts a chunked response; body of request is sent over multiple parts using the SendChunkResp
// API.
int StartChunkedResp(int code, char *desc, char *header_to_add);
int StartChunkedResp(int code, const char *desc, const char *header_to_add);

/// Send a (potentially partial) body in a chunked response; invoking with NULL body
// indicates that this is the last chunk in the response.
int ChunkResp(char *body, long long bodylen);
int ChunkResp(const char *body, long long bodylen);
};


Expand Down
4 changes: 2 additions & 2 deletions src/XrdHttp/XrdHttpProtocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ int XrdHttpProtocol::StartSimpleResp(int code, const char *desc, const char *hea
return 0;
}

int XrdHttpProtocol::StartChunkedResp(int code, char *desc, char *header_to_add) {
int XrdHttpProtocol::StartChunkedResp(int code, const char *desc, const char *header_to_add) {
const std::string crlf = "\r\n";

std::stringstream ss;
Expand All @@ -1234,7 +1234,7 @@ int XrdHttpProtocol::StartChunkedResp(int code, char *desc, char *header_to_add)
return StartSimpleResp(code, desc, ss.str().c_str(), -1);
}

int XrdHttpProtocol::ChunkResp(char *body, long long bodylen) {
int XrdHttpProtocol::ChunkResp(const char *body, long long bodylen) {
const std::string crlf = "\r\n";
long long chunk_length = bodylen;
if (bodylen <= 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/XrdHttp/XrdHttpProtocol.hh
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ private:

/// Starts a chunked response; body of request is sent over multiple parts using the SendChunkResp
// API.
int StartChunkedResp(int code, char *desc, char *header_to_add);
int StartChunkedResp(int code, const char *desc, const char *header_to_add);

/// Send a (potentially partial) body in a chunked response; invoking with NULL body
// indicates that this is the last chunk in the response.
int ChunkResp(char *body, long long bodylen);
int ChunkResp(const char *body, long long bodylen);

/// Gets a string that represents the IP address of the client. Must be freed
char *GetClientIPStr();
Expand Down

0 comments on commit d7880bc

Please sign in to comment.