11/*
22 This file is part of libhttpserver
3- Copyright (C) 2011 Sebastiano Merlino
3+ Copyright (C) 2011, 2012, 2013, 2014 Sebastiano Merlino
44
55 This library is free software; you can redistribute it and/or
66 modify it under the terms of the GNU Lesser General Public
1414
1515 You should have received a copy of the GNU Lesser General Public
1616 License along with this library; if not, write to the Free Software
17- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
17+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
1818 USA
1919*/
2020
@@ -47,7 +47,7 @@ const int http_utils::http_processing = MHD_HTTP_PROCESSING;
4747const int http_utils::http_ok = MHD_HTTP_OK ;
4848const int http_utils::http_created = MHD_HTTP_CREATED ;
4949const int http_utils::http_accepted = MHD_HTTP_ACCEPTED ;
50- const int http_utils::http_non_authoritative_information =
50+ const int http_utils::http_non_authoritative_information =
5151 MHD_HTTP_NON_AUTHORITATIVE_INFORMATION ;
5252const int http_utils::http_no_content = MHD_HTTP_NO_CONTENT ;
5353const int http_utils::http_reset_content = MHD_HTTP_RESET_CONTENT ;
@@ -69,21 +69,21 @@ const int http_utils::http_payment_required = MHD_HTTP_PAYMENT_REQUIRED;
6969const int http_utils::http_forbidden = MHD_HTTP_FORBIDDEN ;
7070const int http_utils::http_not_found = MHD_HTTP_NOT_FOUND ;
7171const int http_utils::http_method_not_allowed = MHD_HTTP_METHOD_NOT_ALLOWED ;
72- const int http_utils::http_method_not_acceptable =
72+ const int http_utils::http_method_not_acceptable =
7373 MHD_HTTP_METHOD_NOT_ACCEPTABLE ;
74- const int http_utils::http_proxy_authentication_required =
74+ const int http_utils::http_proxy_authentication_required =
7575 MHD_HTTP_PROXY_AUTHENTICATION_REQUIRED ;
7676const int http_utils::http_request_timeout = MHD_HTTP_REQUEST_TIMEOUT ;
7777const int http_utils::http_conflict = MHD_HTTP_CONFLICT ;
7878const int http_utils::http_gone = MHD_HTTP_GONE ;
7979const int http_utils::http_length_required = MHD_HTTP_LENGTH_REQUIRED ;
8080const int http_utils::http_precondition_failed = MHD_HTTP_PRECONDITION_FAILED ;
81- const int http_utils::http_request_entity_too_large =
81+ const int http_utils::http_request_entity_too_large =
8282 MHD_HTTP_REQUEST_ENTITY_TOO_LARGE ;
8383const int http_utils::http_request_uri_too_long = MHD_HTTP_REQUEST_URI_TOO_LONG ;
84- const int http_utils::http_unsupported_media_type =
84+ const int http_utils::http_unsupported_media_type =
8585 MHD_HTTP_UNSUPPORTED_MEDIA_TYPE ;
86- const int http_utils::http_requested_range_not_satisfiable =
86+ const int http_utils::http_requested_range_not_satisfiable =
8787 MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE ;
8888const int http_utils::http_expectation_failed = MHD_HTTP_EXPECTATION_FAILED ;
8989const int http_utils::http_unprocessable_entity = MHD_HTTP_UNPROCESSABLE_ENTITY ;
@@ -93,53 +93,53 @@ const int http_utils::http_unordered_collection = MHD_HTTP_UNORDERED_COLLECTION;
9393const int http_utils::http_upgrade_required = MHD_HTTP_UPGRADE_REQUIRED ;
9494const int http_utils::http_retry_with = MHD_HTTP_RETRY_WITH ;
9595
96- const int http_utils::http_internal_server_error =
96+ const int http_utils::http_internal_server_error =
9797 MHD_HTTP_INTERNAL_SERVER_ERROR ;
9898const int http_utils::http_not_implemented = MHD_HTTP_NOT_IMPLEMENTED ;
9999const int http_utils::http_bad_gateway = MHD_HTTP_BAD_GATEWAY ;
100100const int http_utils::http_service_unavailable = MHD_HTTP_SERVICE_UNAVAILABLE ;
101101const int http_utils::http_gateway_timeout = MHD_HTTP_GATEWAY_TIMEOUT ;
102- const int http_utils::http_version_not_supported =
102+ const int http_utils::http_version_not_supported =
103103 MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED ;
104- const int http_utils::http_variant_also_negotiated =
104+ const int http_utils::http_variant_also_negotiated =
105105 MHD_HTTP_VARIANT_ALSO_NEGOTIATES ;
106106const int http_utils::http_insufficient_storage = MHD_HTTP_INSUFFICIENT_STORAGE ;
107- const int http_utils::http_bandwidth_limit_exceeded =
107+ const int http_utils::http_bandwidth_limit_exceeded =
108108 MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED ;
109109const int http_utils::http_not_extended = MHD_HTTP_NOT_EXTENDED ;
110110
111111const int http_utils::shoutcast_response = MHD_ICY_FLAG ;
112112
113113const std::string http_utils::http_header_accept = MHD_HTTP_HEADER_ACCEPT ;
114- const std::string http_utils::http_header_accept_charset =
114+ const std::string http_utils::http_header_accept_charset =
115115 MHD_HTTP_HEADER_ACCEPT_CHARSET ;
116- const std::string http_utils::http_header_accept_encoding =
116+ const std::string http_utils::http_header_accept_encoding =
117117 MHD_HTTP_HEADER_ACCEPT_ENCODING ;
118- const std::string http_utils::http_header_accept_language =
118+ const std::string http_utils::http_header_accept_language =
119119 MHD_HTTP_HEADER_ACCEPT_LANGUAGE ;
120- const std::string http_utils::http_header_accept_ranges =
120+ const std::string http_utils::http_header_accept_ranges =
121121 MHD_HTTP_HEADER_ACCEPT_RANGES ;
122122const std::string http_utils::http_header_age = MHD_HTTP_HEADER_AGE ;
123123const std::string http_utils::http_header_allow = MHD_HTTP_HEADER_ALLOW ;
124- const std::string http_utils::http_header_authorization =
124+ const std::string http_utils::http_header_authorization =
125125 MHD_HTTP_HEADER_AUTHORIZATION ;
126- const std::string http_utils::http_header_cache_control =
126+ const std::string http_utils::http_header_cache_control =
127127 MHD_HTTP_HEADER_CACHE_CONTROL ;
128- const std::string http_utils::http_header_connection =
128+ const std::string http_utils::http_header_connection =
129129 MHD_HTTP_HEADER_CONNECTION ;
130- const std::string http_utils::http_header_content_encoding =
130+ const std::string http_utils::http_header_content_encoding =
131131 MHD_HTTP_HEADER_CONTENT_ENCODING ;
132- const std::string http_utils::http_header_content_language =
132+ const std::string http_utils::http_header_content_language =
133133 MHD_HTTP_HEADER_CONTENT_LANGUAGE ;
134- const std::string http_utils::http_header_content_length =
134+ const std::string http_utils::http_header_content_length =
135135 MHD_HTTP_HEADER_CONTENT_LENGTH ;
136- const std::string http_utils::http_header_content_location =
136+ const std::string http_utils::http_header_content_location =
137137 MHD_HTTP_HEADER_CONTENT_LOCATION ;
138- const std::string http_utils::http_header_content_md5 =
138+ const std::string http_utils::http_header_content_md5 =
139139 MHD_HTTP_HEADER_CONTENT_MD5 ;
140- const std::string http_utils::http_header_content_range =
140+ const std::string http_utils::http_header_content_range =
141141 MHD_HTTP_HEADER_CONTENT_RANGE ;
142- const std::string http_utils::http_header_content_type =
142+ const std::string http_utils::http_header_content_type =
143143 MHD_HTTP_HEADER_CONTENT_TYPE ;
144144const std::string http_utils::http_header_date = MHD_HTTP_HEADER_DATE ;
145145const std::string http_utils::http_header_etag = MHD_HTTP_HEADER_ETAG ;
@@ -148,39 +148,39 @@ const std::string http_utils::http_header_expires = MHD_HTTP_HEADER_EXPIRES;
148148const std::string http_utils::http_header_from = MHD_HTTP_HEADER_FROM ;
149149const std::string http_utils::http_header_host = MHD_HTTP_HEADER_HOST ;
150150const std::string http_utils::http_header_if_match = MHD_HTTP_HEADER_IF_MATCH ;
151- const std::string http_utils::http_header_if_modified_since =
151+ const std::string http_utils::http_header_if_modified_since =
152152 MHD_HTTP_HEADER_IF_MODIFIED_SINCE ;
153- const std::string http_utils::http_header_if_none_match =
153+ const std::string http_utils::http_header_if_none_match =
154154 MHD_HTTP_HEADER_IF_NONE_MATCH ;
155155const std::string http_utils::http_header_if_range = MHD_HTTP_HEADER_IF_RANGE ;
156- const std::string http_utils::http_header_if_unmodified_since =
156+ const std::string http_utils::http_header_if_unmodified_since =
157157 MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE ;
158- const std::string http_utils::http_header_last_modified =
158+ const std::string http_utils::http_header_last_modified =
159159 MHD_HTTP_HEADER_LAST_MODIFIED ;
160160const std::string http_utils::http_header_location = MHD_HTTP_HEADER_LOCATION ;
161- const std::string http_utils::http_header_max_forwards =
161+ const std::string http_utils::http_header_max_forwards =
162162 MHD_HTTP_HEADER_MAX_FORWARDS ;
163163const std::string http_utils::http_header_pragma = MHD_HTTP_HEADER_PRAGMA ;
164- const std::string http_utils::http_header_proxy_authenticate =
164+ const std::string http_utils::http_header_proxy_authenticate =
165165 MHD_HTTP_HEADER_PROXY_AUTHENTICATE ;
166- const std::string http_utils::http_header_proxy_authentication =
166+ const std::string http_utils::http_header_proxy_authentication =
167167 MHD_HTTP_HEADER_PROXY_AUTHORIZATION ;
168168const std::string http_utils::http_header_range = MHD_HTTP_HEADER_RANGE ;
169169const std::string http_utils::http_header_referer = MHD_HTTP_HEADER_REFERER ;
170- const std::string http_utils::http_header_retry_after =
170+ const std::string http_utils::http_header_retry_after =
171171 MHD_HTTP_HEADER_RETRY_AFTER ;
172172const std::string http_utils::http_header_server = MHD_HTTP_HEADER_SERVER ;
173173const std::string http_utils::http_header_te = MHD_HTTP_HEADER_TE ;
174174const std::string http_utils::http_header_trailer = MHD_HTTP_HEADER_TRAILER ;
175- const std::string http_utils::http_header_transfer_encoding =
175+ const std::string http_utils::http_header_transfer_encoding =
176176 MHD_HTTP_HEADER_TRANSFER_ENCODING ;
177177const std::string http_utils::http_header_upgrade = MHD_HTTP_HEADER_UPGRADE ;
178- const std::string http_utils::http_header_user_agent =
178+ const std::string http_utils::http_header_user_agent =
179179 MHD_HTTP_HEADER_USER_AGENT ;
180180const std::string http_utils::http_header_vary = MHD_HTTP_HEADER_VARY ;
181181const std::string http_utils::http_header_via = MHD_HTTP_HEADER_VIA ;
182182const std::string http_utils::http_header_warning = MHD_HTTP_HEADER_WARNING ;
183- const std::string http_utils::http_header_www_authenticate =
183+ const std::string http_utils::http_header_www_authenticate =
184184 MHD_HTTP_HEADER_WWW_AUTHENTICATE ;
185185
186186const std::string http_utils::http_version_1_0 = MHD_HTTP_VERSION_1_0 ;
@@ -195,9 +195,9 @@ const std::string http_utils::http_method_post = MHD_HTTP_METHOD_POST;
195195const std::string http_utils::http_method_put = MHD_HTTP_METHOD_PUT ;
196196const std::string http_utils::http_method_trace = MHD_HTTP_METHOD_TRACE ;
197197
198- const std::string http_utils::http_post_encoding_form_urlencoded =
198+ const std::string http_utils::http_post_encoding_form_urlencoded =
199199 MHD_HTTP_POST_ENCODING_FORM_URLENCODED ;
200- const std::string http_utils::http_post_encoding_multipart_formdata =
200+ const std::string http_utils::http_post_encoding_multipart_formdata =
201201 MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA ;
202202
203203
@@ -234,7 +234,7 @@ void get_ip_str(
234234 if (sa)
235235 {
236236 char to_ret[INET6_ADDRSTRLEN ] = { ' \0 ' };
237- switch (sa->sa_family )
237+ switch (sa->sa_family )
238238 {
239239 case AF_INET :
240240 if (maxlen == 0 )
@@ -315,9 +315,9 @@ size_t http_unescape (char *val)
315315 unsigned int num;
316316
317317 while (' \0 ' != *rpos)
318- {
318+ {
319319 switch (*rpos)
320- {
320+ {
321321 case ' +' :
322322 *wpos = ' ' ;
323323 wpos++;
@@ -327,20 +327,20 @@ size_t http_unescape (char *val)
327327 if ( (1 == sscanf (&rpos[1 ],
328328 " %2x" , &num)) ||
329329 (1 == sscanf (&rpos[1 ],
330- " %2X" , &num))
330+ " %2X" , &num))
331331 )
332- {
332+ {
333333 *wpos = (unsigned char ) num;
334334 wpos++;
335335 rpos += 3 ;
336336 break ;
337- }
337+ }
338338 /* intentional fall through! */
339339 default :
340340 *wpos = *rpos;
341341 wpos++;
342342 rpos++;
343- }
343+ }
344344 }
345345 *wpos = ' \0 ' ; /* add 0-terminator */
346346 return wpos - val; /* = strlen(val) */
@@ -362,8 +362,8 @@ ip_representation::ip_representation(const struct sockaddr* ip)
362362 ip_version = http_utils::IPV6 ;
363363 for (int i=0 ;i<32 ;i+=2 )
364364 {
365- pieces[i/2 ] =
366- ((u_char*)&(((struct sockaddr_in6 *)ip)->sin6_addr ))[i] +
365+ pieces[i/2 ] =
366+ ((u_char*)&(((struct sockaddr_in6 *)ip)->sin6_addr ))[i] +
367367 16 * ((u_char*)&(((struct sockaddr_in6 *)ip)->sin6_addr ))[i+1 ];
368368 }
369369 }
0 commit comments