aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/http/misc
diff options
context:
space:
mode:
authorsergey <sergey@yandex-team.ru>2022-02-10 16:47:29 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:29 +0300
commit05f59b2581f074c756adaee6b260014ac3a0c3ec (patch)
tree9814fbd1c3effac9b8377c5d604b367b14e2db55 /library/cpp/http/misc
parent5d8d1af4df7f9cd4acc021f069546c30677e7979 (diff)
downloadydb-05f59b2581f074c756adaee6b260014ac3a0c3ec.tar.gz
Restoring authorship annotation for <sergey@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/http/misc')
-rw-r--r--library/cpp/http/misc/httpcodes.cpp4
-rw-r--r--library/cpp/http/misc/httpcodes.h18
-rw-r--r--library/cpp/http/misc/httpdate.cpp90
-rw-r--r--library/cpp/http/misc/httpdate.h2
4 files changed, 57 insertions, 57 deletions
diff --git a/library/cpp/http/misc/httpcodes.cpp b/library/cpp/http/misc/httpcodes.cpp
index 7823c64f5f..ad8c80ac1e 100644
--- a/library/cpp/http/misc/httpcodes.cpp
+++ b/library/cpp/http/misc/httpcodes.cpp
@@ -1,5 +1,5 @@
-#include "httpcodes.h"
-
+#include "httpcodes.h"
+
TStringBuf HttpCodeStrEx(int code) noexcept {
switch (code) {
case HTTP_CONTINUE:
diff --git a/library/cpp/http/misc/httpcodes.h b/library/cpp/http/misc/httpcodes.h
index fb04a322ea..cbfbaa1188 100644
--- a/library/cpp/http/misc/httpcodes.h
+++ b/library/cpp/http/misc/httpcodes.h
@@ -1,12 +1,12 @@
#pragma once
-
+
#include <util/generic/strbuf.h>
-enum HttpCodes {
+enum HttpCodes {
HTTP_CONTINUE = 100,
HTTP_SWITCHING_PROTOCOLS = 101,
HTTP_PROCESSING = 102,
-
+
HTTP_OK = 200,
HTTP_CREATED = 201,
HTTP_ACCEPTED = 202,
@@ -17,7 +17,7 @@ enum HttpCodes {
HTTP_MULTI_STATUS = 207,
HTTP_ALREADY_REPORTED = 208,
HTTP_IM_USED = 226,
-
+
HTTP_MULTIPLE_CHOICES = 300,
HTTP_MOVED_PERMANENTLY = 301,
HTTP_FOUND = 302,
@@ -26,7 +26,7 @@ enum HttpCodes {
HTTP_USE_PROXY = 305,
HTTP_TEMPORARY_REDIRECT = 307,
HTTP_PERMANENT_REDIRECT = 308,
-
+
HTTP_BAD_REQUEST = 400,
HTTP_UNAUTHORIZED = 401,
HTTP_PAYMENT_REQUIRED = 402,
@@ -57,7 +57,7 @@ enum HttpCodes {
HTTP_TOO_MANY_REQUESTS = 429,
HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451,
-
+
HTTP_INTERNAL_SERVER_ERROR = 500,
HTTP_NOT_IMPLEMENTED = 501,
HTTP_BAD_GATEWAY = 502,
@@ -71,10 +71,10 @@ enum HttpCodes {
HTTP_NOT_EXTENDED = 510,
HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511,
HTTP_UNASSIGNED_512 = 512,
-
+
HTTP_CODE_MAX
-};
-
+};
+
TStringBuf HttpCodeStrEx(int code) noexcept;
inline TStringBuf HttpCodeStr(int code) noexcept {
diff --git a/library/cpp/http/misc/httpdate.cpp b/library/cpp/http/misc/httpdate.cpp
index 1af93b3064..4a3031bbf4 100644
--- a/library/cpp/http/misc/httpdate.cpp
+++ b/library/cpp/http/misc/httpdate.cpp
@@ -1,69 +1,69 @@
-/*-
-* Copyright 1997 Massachusetts Institute of Technology
-*
-* Permission to use, copy, modify, and distribute this software and
-* its documentation for any purpose and without fee is hereby
-* granted, provided that both the above copyright notice and this
-* permission notice appear in all copies, that both the above
-* copyright notice and this permission notice appear in all
-* supporting documentation, and that the name of M.I.T. not be used
-* in advertising or publicity pertaining to distribution of the
-* software without specific, written prior permission. M.I.T. makes
-* no representations about the suitability of this software for any
-* purpose. It is provided "as is" without express or implied
-* warranty.
+/*-
+* Copyright 1997 Massachusetts Institute of Technology
*
-* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
-* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
-* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
-* SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-* SUCH DAMAGE.
-*/
+* Permission to use, copy, modify, and distribute this software and
+* its documentation for any purpose and without fee is hereby
+* granted, provided that both the above copyright notice and this
+* permission notice appear in all copies, that both the above
+* copyright notice and this permission notice appear in all
+* supporting documentation, and that the name of M.I.T. not be used
+* in advertising or publicity pertaining to distribution of the
+* software without specific, written prior permission. M.I.T. makes
+* no representations about the suitability of this software for any
+* purpose. It is provided "as is" without express or implied
+* warranty.
+*
+* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+* SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+* SUCH DAMAGE.
+*/
#include <util/system/defaults.h>
-
-#include <sys/types.h>
+
+#include <sys/types.h>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
-
+
#include <util/system/compat.h> /* stricmp */
#include <util/system/yassert.h>
#include "httpdate.h"
#include <util/datetime/base.h>
-
+
static const char *wkdays[] = {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-};
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+};
+
+static const char *months[] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
+ "Nov", "Dec"
+};
-static const char *months[] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
- "Nov", "Dec"
-};
-
int format_http_date(char buf[], size_t size, time_t when) {
- struct tm tms;
+ struct tm tms;
GmTimeR(&when, &tms);
-
-#ifndef HTTP_DATE_ISO_8601
+
+#ifndef HTTP_DATE_ISO_8601
return snprintf(buf, size, "%s, %02d %s %04d %02d:%02d:%02d GMT",
wkdays[tms.tm_wday], tms.tm_mday, months[tms.tm_mon],
tms.tm_year + 1900, tms.tm_hour, tms.tm_min, tms.tm_sec);
-#else /* ISO 8601 */
+#else /* ISO 8601 */
return snprintf(buf, size, "%04d%02d%02dT%02d%02d%02d+0000",
tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday,
tms.tm_hour, tms.tm_min, tms.tm_sec);
-#endif
-}
-
+#endif
+}
+
char* format_http_date(time_t when, char* buf, size_t buflen) {
const int len = format_http_date(buf, buflen, when);
diff --git a/library/cpp/http/misc/httpdate.h b/library/cpp/http/misc/httpdate.h
index f292b6a5cb..04876f38fe 100644
--- a/library/cpp/http/misc/httpdate.h
+++ b/library/cpp/http/misc/httpdate.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <util/datetime/base.h>
#include <util/generic/string.h>