Skip to content

Commit

Permalink
Merge pull request #8 from seomoz/dan/case-insensitive-user
Browse files Browse the repository at this point in the history
Case-insensitive user
  • Loading branch information
Dan Lecocq authored Nov 16, 2016
2 parents 268b79f + b829e56 commit e13fbe2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/robots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ namespace Rep
{
if (key.compare("user-agent") == 0)
{
// Store the user agent string as lowercased
std::transform(value.begin(), value.end(), value.begin(), ::tolower);

if (last_agent)
{
group.push_back(value);
Expand Down
2 changes: 1 addition & 1 deletion test/test-robots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ TEST(RobotsTest, ExposesSitemaps)
TEST(RobotsTest, CaseInsensitivity)
{
std::string content =
"User-agent: agent\n"
"User-agent: Agent\n"
"Disallow: /path\n";
Rep::Robots robot(content);
EXPECT_FALSE(robot.allowed("/path", "agent"));
Expand Down

0 comments on commit e13fbe2

Please sign in to comment.