codexia icon indicating copy to clipboard operation
codexia copied to clipboard

Wrong http response code during review creation error

Open iakunin opened this issue 5 years ago • 4 comments
trafficstars

In the scope of issue https://github.com/yegor256/codexia/issues/96 there were no any changes (see comment https://github.com/yegor256/codexia/issues/96#issuecomment-601236637). Therefore I opened this issue.

Steps to reproduce

  1. Using iakunin-codexia-bot api-token
  2. Already created 100 reviews
  3. Trying to create one more review
curl --location --request POST 'https://www.codexia.org/p/96/post?text=This%20project%20is%20found%20on%20Reddit:%20[web%20link](https://www.reddit.com/comments/fgmyjg),%20[api%20link](https://www.reddit.com/api/info.json?id%3Dt3_fgmyjg),%20&hash=89bc46e1-36e6-467e-91cf-052b5e0db3ee' \
--header 'X-Codexia-Token: <token>'

Expected result

Error with http response code differs from 200.

Actual result

Http response code == 200 with message You are reviewing too fast in html-body.

HTTP/1.1 200 OK
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html;charset=utf-8
Date: Mon, 16 Mar 2020 19:47:16 GMT
Server: nginx
Set-Cookie: flash_msg=; domain=www.codexia.org; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000; secure; HttpOnly
Set-Cookie: flash_color=; domain=www.codexia.org; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000; secure; HttpOnly
Strict-Transport-Security: max-age=31536000
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block

<!DOCTYPE html>
<html>
<head>
<title>/recent</title>
<meta charset='UTF-8'>
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
<meta content='investment, open source, incubator' name='keywords'>
<meta content='Open Source Incubator' name='description'>
<link href='https://cdn.jsdelivr.net/gh/yegor256/tacit@gh-pages/tacit-css.min.css' rel='stylesheet'>
<link href='https://cdn.jsdelivr.net/gh/yegor256/drops@gh-pages/drops.min.css' rel='stylesheet'>
<link href='https://www.yegor256.com/css/icons.css' rel='stylesheet'>
<link href='https://www.codexia.org/logo-64.png' rel='shortcut icon'>
<script src='https://code.jquery.com/jquery-3.3.1.min.js'></script>
<style>
  body { padding: 1em; }
  section { width: 700px; }
  article { border: 0 }
  header, article, footer { padding: 1em; }
  nav ul { margin-bottom: 0.1em; }
  .item { margin-right: 1em; }
  .logo { width: 32px; height: 32px; vertical-align: middle; }
</style>
</head>
<body>
<section>
<header>
<nav>
<ul>
<li>
<a href='https://www.codexia.org/'>
<img alt='Logo' class='logo' src='https://www.codexia.org/logo.svg'>
</a>
</li>
</ul>
<ul>
<li>
<span title='Author ID: #7974'>
@iakunin-codexia-bot
<span title='You are a supervised bot'>⚙️</span>
</span>
</li>
<li title='Your karma'>
<a href='https://www.codexia.org/karma'>
+191
</a>
</li>
</ul>
<ul>
<li>
<li>
<a href='https://www.codexia.org/submit' title='Submit a new project'>
/submit
</a>
</li>
<li>
<a href='https://www.codexia.org/terms'>
/terms
</a>
</li>
<li>
<a href='https://www.codexia.org/api'>
/api
</a>
</li>
<li>
<a href='https://www.codexia.org/logout'>
/logout
</a>
</li>
</li>
</ul>
</nav>
</header>
<article>
<p style='background-color:darkred; color:white; border-radius:2px; padding:0.2em 0.4em;'>
You are reviewing too fast
</p>
<p>
<a href='https://www.codexia.org/p/156' style=''>
wilsonzlin/hyperbuild
</a>
<br>
<kbd>
newbie
</kbd>
<br>
<span class='smaller gray'>
<span class='item' title='Author ID: #7974'>
<a href='https://github.com//iakunin-codexia-bot' style='vertical-align:middle;'><img src='https://socatar.com/github/iakunin-codexia-bot/192-192' style='height:1em;width:1em;'></a>
@iakunin-codexia-bot
</span>

.......

</article>
<footer class='smaller gray'>
<nav>
<ul>
<li>
&copy; 2020
<a href='/welcome'>Codexia</a>
</li>
<li class='monospace' title='Release version and currently deployed version'>
8d537e5/0.0.34
</li>
<li title='PostgreSQL version'>
pg:12.0
</li>
<li title='Your IP address visible to the server'>
<a href='https://iplocation.com/?ip=91.77.139.243'>
91.77.139.243
</a>
</li>
<li title='This request processing time'>
57ms
</li>
</ul>
</nav>
<nav>
<ul>
<li>
<a href='https://github.com/yegor256/codexia/stargazers'><img alt='GitHub' src='https://img.shields.io/github/stars/yegor256/codexia.svg?style=flat-square'></a>
</li>
<li>
<a href='https://www.sixnines.io/h/8754'><img alt='SixNines' src='https://www.sixnines.io/b/8754?style=flat'></a>
</li>
</ul>
</nav>
</footer>
</section>
</body>
</html>

iakunin avatar Mar 19 '20 16:03 iakunin

@yegor256/z please, pay attention to this issue

0crat avatar Mar 19 '20 16:03 0crat

@iakunin I can't reproduce this problem in a test: b7e7429 Something is wrong on your side, maybe?

yegor256 avatar Mar 24 '20 19:03 yegor256

@yegor256 I'll try to reproduce it when it'd be possible.

By the way, as I can see test https://github.com/yegor256/codexia/commit/b7e7429429921b056a2d28f742d89c7a29fc1a68 is not about submitting review - it's about submitting project.

The original problem of this issue occurs when I'm trying to submit new review to an existing project, but I already submitted over 100 reviews during this day.

iakunin avatar Mar 25 '20 08:03 iakunin

@yegor256 I've reproduced this bug again. It's important to note, that this bug occurs only after 100 reviews have already been created by my bot.

As I suppose this check occurs here.

Example of an curl-request to reproduce bug:

curl --location --request POST 'https://www.codexia.org/p/345/post?text=This%20project%20is%20found%20on%20Reddit:%20[web%20link](https://www.reddit.com/comments/9dmlpo),%20[api%20link](https://www.reddit.com/api/info.json?id%3Dt3_9dmlpo)&hash=2bae98f6-b101-46ab-ac60-436958d49bc5' \
--header 'X-Codexia-Token: <BOT-TOKEN-HERE>'

Same request in raw http:

POST /p/345/post?text=This project is found on Reddit: [web link](https://www.reddit.com/comments/9dmlpo), [api link](https://www.reddit.com/api/info.json?id=t3_9dmlpo)&hash=2bae98f6-b101-46ab-ac60-436958d49bc5 HTTP/1.1
Host: www.codexia.org
X-Codexia-Token: <BOT-TOKEN-HERE>

Corresponding http-response (pay attention to You are reviewing too fast text in response):

HTTP/1.1 200 OK
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html;charset=utf-8
Date: Sat, 11 Apr 2020 08:38:38 GMT
Server: nginx
Set-Cookie: flash_msg=; domain=www.codexia.org; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000; secure; HttpOnly
Set-Cookie: flash_color=; domain=www.codexia.org; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000; secure; HttpOnly
Strict-Transport-Security: max-age=31536000
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block

<!DOCTYPE html>
<html>
<head>
<title>/recent</title>
<meta charset='UTF-8'>
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
<meta content='investment, open source, incubator' name='keywords'>
<meta content='Open Source Incubator' name='description'>
<link href='https://cdn.jsdelivr.net/gh/yegor256/tacit@gh-pages/tacit-css.min.css' rel='stylesheet'>
<link href='https://cdn.jsdelivr.net/gh/yegor256/drops@gh-pages/drops.min.css' rel='stylesheet'>
<link href='https://www.yegor256.com/css/icons.css' rel='stylesheet'>
<link href='https://www.codexia.org/logo-64.png' rel='shortcut icon'>
<script src='https://code.jquery.com/jquery-3.3.1.min.js'></script>
<style>
  body { padding: 1em; }
  section { width: 700px; }
  article { border: 0 }
  header, article, footer { padding: 1em; }
  nav ul { margin-bottom: 0.1em; }
  .item { margin-right: 1em; }
  .logo { width: 32px; height: 32px; vertical-align: middle; }
  .block { margin-top: 4em; margin-bottom: 4em; }
</style>
</head>
<body>
<section>
<header>
<nav>
<ul>
<li>
<a href='https://www.codexia.org/'>
<img alt='Logo' class='logo' src='https://www.codexia.org/logo.svg'>
</a>
</li>
</ul>
<ul>
<li>
<span title='Author ID: #7974'>
@iakunin-codexia-bot
<span title='You are a supervised bot'>⚙️</span>
</span>
</li>
<li title='Your karma'>
<a href='https://www.codexia.org/karma'>
+316
</a>
</li>
</ul>
<ul>
<li>
<li>
<a href='https://www.codexia.org/submit' title='Submit a new project'>
/submit
</a>
</li>
<li>
<a href='https://www.codexia.org/terms'>
/terms
</a>
</li>
<li>
<a href='https://www.codexia.org/api'>
/api
</a>
</li>
<li>
<a href='https://www.codexia.org/logout'>
/logout
</a>
</li>
</li>
</ul>
<ul>
<li>
<a href='https://www.codexia.org/recent?badges=newbie'>
<kbd style='background-color: darkseagreen;'>
newbie
</kbd>

</a>
</li>
<li>
<a href='https://www.codexia.org/recent?badges=L1'>
<kbd style='background-color: steelblue;'>
L1
</kbd>

</a>
</li>
<li>
<a href='https://www.codexia.org/recent?badges=L2'>
<kbd style='background-color: darkorange;'>
L2
</kbd>

</a>
</li>
<li>
<a href='https://www.codexia.org/recent?badges=L3'>
<kbd style='background-color: maroon;'>
L3
</kbd>

</a>
</li>
</ul>
</nav>
</header>
<article>
<p style='background-color:darkred; color:white; border-radius:2px; padding:0.2em 0.4em;'>
You are reviewing too fast
</p>
<p>
<a href='https://www.codexia.org/p/377' style=''>
s0md3v/Photon
</a>
<br>
<kbd style='background-color: darkseagreen;'>
newbie
</kbd>

.....

</article>
<footer class='smaller gray'>
<nav>
<ul>
<li>
&copy; 2020
<a href='/welcome'>Codexia</a>
</li>
<li class='monospace' title='Release version and currently deployed version'>
241df23/0.0.38
</li>
<li title='PostgreSQL version'>
pg:12.0
</li>
<li title='Your IP address visible to the server'>
<a href='https://iplocation.com/?ip=91.77.139.243'>
91.77.139.243
</a>
</li>
<li title='This request processing time'>
75ms
</li>
</ul>
</nav>
<nav>
<ul>
<li>
<a href='https://github.com/yegor256/codexia/stargazers'><img alt='GitHub' src='https://img.shields.io/github/stars/yegor256/codexia.svg?style=flat-square'></a>
</li>
<li>
<a href='https://www.sixnines.io/h/8754'><img alt='SixNines' src='https://www.sixnines.io/b/8754?style=flat'></a>
</li>
</ul>
</nav>
</footer>
</section>
</body>
</html>

iakunin avatar Apr 11 '20 08:04 iakunin