Skip to content

Commit dc792fe

Browse files
committed
'user-agent:' is meant to be treated case insensitively per issue #8
1 parent e0e96c2 commit dc792fe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

norbert/src/java/org/osjava/norbert/NoRobotClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ private RulesEngine parseTextForUserAgent(String txt, String userAgent) throws N
129129
continue;
130130
}
131131

132-
// if User-agent == userAgent
133-
// record the rest up until end or next User-agent
132+
// if user-agent == userAgent
133+
// record the rest up until end or next user-agent
134134
// then quit (? check spec)
135-
if(line.startsWith("User-agent:")) {
135+
if(line.toLowerCase().startsWith("user-agent:")) {
136136

137137
if(parsingAllowBlock) {
138138
// we've just finished reading allows/disallows
@@ -145,7 +145,7 @@ private RulesEngine parseTextForUserAgent(String txt, String userAgent) throws N
145145
}
146146
}
147147

148-
value = line.substring("User-agent:".length()).trim();
148+
value = line.substring("user-agent:".length()).trim();
149149
if(value.equalsIgnoreCase(userAgent)) {
150150
parsingAllowBlock = true;
151151
continue;

0 commit comments

Comments
 (0)