Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ead9716

Browse files
committed
astyle format
1 parent 4ec6e71 commit ead9716

17 files changed

+438
-438
lines changed

bin/server.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Default vhost
2-
vhost=192.168.1.5,mydomain.com
2+
vhost=asdf
33
port=8080
44
diskpath=./htdocs

src/Client.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
#include "Client.h"
2020

2121
Client::Client(int fd, sockaddr_in addr) {
22-
socketDesc = fd;
23-
clientAddr = addr;
22+
socketDesc = fd;
23+
clientAddr = addr;
2424
}
2525

2626
Client::~Client() {
27-
clearSendQueue();
27+
clearSendQueue();
2828
}
2929

3030
/**
@@ -52,7 +52,7 @@ unsigned int Client::sendQueueSize() {
5252
* @return SendQueueItem object containing the data to send and current offset
5353
*/
5454
SendQueueItem* Client::nextInSendQueue() {
55-
if(sendQueue.empty())
55+
if (sendQueue.empty())
5656
return NULL;
5757

5858
return sendQueue.front();
@@ -64,7 +64,7 @@ SendQueueItem* Client::nextInSendQueue() {
6464
*/
6565
void Client::dequeueFromSendQueue() {
6666
SendQueueItem* item = nextInSendQueue();
67-
if(item != NULL) {
67+
if (item != NULL) {
6868
sendQueue.pop();
6969
delete item;
7070
}
@@ -75,7 +75,7 @@ void Client::dequeueFromSendQueue() {
7575
* Clears out the send queue for the client, deleting all internal SendQueueItem objects
7676
*/
7777
void Client::clearSendQueue() {
78-
while(!sendQueue.empty()) {
78+
while (!sendQueue.empty()) {
7979
delete sendQueue.front();
8080
sendQueue.pop();
8181
}

src/Client.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
/**
2-
httpserver
3-
Client.h
4-
Copyright 2011-2014 Ramsey Kant
2+
httpserver
3+
Client.h
4+
Copyright 2011-2014 Ramsey Kant
55
6-
Licensed under the Apache License, Version 2.0 (the "License");
7-
you may not use this file except in compliance with the License.
8-
You may obtain a copy of the License at
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
99
10-
http://www.apache.org/licenses/LICENSE-2.0
10+
http://www.apache.org/licenses/LICENSE-2.0
1111
12-
Unless required by applicable law or agreed to in writing, software
13-
distributed under the License is distributed on an "AS IS" BASIS,
14-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
See the License for the specific language governing permissions and
16-
limitations under the License.
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
1717
*/
1818

1919
#ifndef _CLIENT_H_
@@ -32,19 +32,19 @@ class Client {
3232
sockaddr_in clientAddr;
3333

3434
std::queue<SendQueueItem*> sendQueue;
35-
35+
3636
public:
3737
Client(int fd, sockaddr_in addr);
3838
~Client();
39-
39+
4040
sockaddr_in getClientAddr() {
4141
return clientAddr;
4242
}
4343

4444
int getSocket() {
4545
return socketDesc;
4646
}
47-
47+
4848
char* getClientIP() {
4949
return inet_ntoa(clientAddr.sin_addr);
5050
}

src/HTTPMessage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ void HTTPMessage::addHeader(std::string line) {
248248
int i = 0;
249249
kpos = line.find(':');
250250
if(kpos == std::string::npos) {
251-
printf("Could not addHeader: %s\n", line.c_str());
251+
std::cout << "Could not addHeader: " << line.c_str() << std::endl;
252252
return;
253253
}
254254
key = line.substr(0, kpos);

src/HTTPMessage.h

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -60,81 +60,81 @@ const static char* const requestMethodStr[NUM_METHODS] = {
6060

6161
// HTTP Response Status codes
6262
enum Status {
63-
// 1xx Informational
64-
CONTINUE = 100,
65-
66-
// 2xx Success
67-
OK = 200,
68-
69-
// 3xx Redirection
70-
71-
// 4xx Client Error
72-
BAD_REQUEST = 400,
73-
NOT_FOUND = 404,
74-
75-
// 5xx Server Error
76-
SERVER_ERROR = 500,
77-
NOT_IMPLEMENTED = 501
63+
// 1xx Informational
64+
CONTINUE = 100,
65+
66+
// 2xx Success
67+
OK = 200,
68+
69+
// 3xx Redirection
70+
71+
// 4xx Client Error
72+
BAD_REQUEST = 400,
73+
NOT_FOUND = 404,
74+
75+
// 5xx Server Error
76+
SERVER_ERROR = 500,
77+
NOT_IMPLEMENTED = 501
7878
};
7979

8080
class HTTPMessage : public ByteBuffer {
8181
private:
82-
std::map<std::string, std::string> *headers;
82+
std::map<std::string, std::string> *headers;
8383

8484
protected:
8585
std::string parseErrorStr;
86-
86+
8787
std::string version;
88-
88+
8989
// Message Body Data (Resource in the case of a response, extra parameters in the case of a request)
9090
byte* data;
9191
unsigned int dataLen;
9292

9393
protected:
94-
virtual void init();
95-
94+
virtual void init();
95+
9696
public:
97-
HTTPMessage();
98-
HTTPMessage(std::string sData);
99-
HTTPMessage(byte *pData, unsigned int len);
100-
virtual ~HTTPMessage();
101-
97+
HTTPMessage();
98+
HTTPMessage(std::string sData);
99+
HTTPMessage(byte *pData, unsigned int len);
100+
virtual ~HTTPMessage();
101+
102102
virtual byte* create() = 0;
103103
virtual bool parse() = 0;
104-
105-
// Create helpers
106-
void putLine(std::string str = "", bool crlf_end=true);
107-
void putHeaders();
108-
109-
// Parse helpers
104+
105+
// Create helpers
106+
void putLine(std::string str = "", bool crlf_end = true);
107+
void putHeaders();
108+
109+
// Parse helpers
110110
std::string getLine();
111-
std::string getStrElement(char delim = 0x20); // 0x20 = "space"
112-
void parseHeaders();
113-
bool parseBody();
114-
115-
// Header Map manipulation
111+
std::string getStrElement(char delim = 0x20); // 0x20 = "space"
112+
void parseHeaders();
113+
bool parseBody();
114+
115+
// Header Map manipulation
116116
void addHeader(std::string line);
117-
void addHeader(std::string key, std::string value);
117+
void addHeader(std::string key, std::string value);
118118
void addHeader(std::string key, int value);
119-
std::string getHeaderValue(std::string key);
119+
std::string getHeaderValue(std::string key);
120120
std::string getHeaderStr(int index);
121121
int getNumHeaders();
122-
void clearHeaders();
123-
124-
// Getters & Setters
122+
void clearHeaders();
123+
124+
// Getters & Setters
125125

126126
std::string getParseError() {
127127
return parseErrorStr;
128128
}
129-
130-
void setVersion(std::string v) {
131-
version = v;
132-
}
133-
134-
std::string getVersion() {
135-
return version;
136-
}
137-
129+
130+
void setVersion(std::string v) {
131+
version = v;
132+
}
133+
134+
std::string getVersion() {
135+
return version;
136+
}
137+
138138
void setData(byte* d, unsigned int len) {
139139
data = d;
140140
dataLen = len;

0 commit comments

Comments
 (0)