Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong http response code during review creation error #98

Open
iakunin opened this issue Mar 19, 2020 · 4 comments
Open

Wrong http response code during review creation error #98

iakunin opened this issue Mar 19, 2020 · 4 comments

Comments

@iakunin
Copy link
Contributor

iakunin commented Mar 19, 2020

In the scope of issue #96 there were no any changes (see comment #96 (comment)).
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>
@0crat
Copy link
Collaborator

0crat commented Mar 19, 2020

@yegor256/z please, pay attention to this issue

yegor256 added a commit that referenced this issue Mar 24, 2020
@yegor256
Copy link
Owner

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

@iakunin
Copy link
Contributor Author

iakunin commented Mar 25, 2020

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

By the way, as I can see test b7e7429 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
Copy link
Contributor Author

iakunin commented Apr 11, 2020

@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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants