{"action":"created","comment":{"url":"https://api.github.com/repos/netty/netty/pulls/comments/44296037","id":44296037,"diff_hunk":"@@ -0,0 +1,138 @@\n+/*\n+ * Copyright 2015 The Netty Project\n+ *\n+ * The Netty Project licenses this file to you under the Apache License,\n+ * version 2.0 (the \"License\"); you may not use this file except in compliance\n+ * with the License. You may obtain a copy of the License at:\n+ *\n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+ * License for the specific language governing permissions and limitations\n+ * under the License.\n+ */\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one or more\n+ * contributor license agreements.  See the NOTICE file distributed with\n+ * this work for additional information regarding copyright ownership.\n+ * The ASF licenses this file to You under the Apache License, Version 2.0\n+ * (the \"License\"); you may not use this file except in compliance with\n+ * the License.  You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package io.netty.util.internal;\n+\n+/**\n+ * Methods of this class taken from {@link org.apache.commons.lang3.StringUtils} and\n+ * {@link org.apache.commons.lang3.CharSequenceUtils} classes of org.apache.commons:commons-lang3 project\n+ */\n+public final class StringUtils {\n+    public static final int INDEX_NOT_FOUND = -1;\n+\n+    /**\n+     * <p>Case in-sensitive find of the first index within a CharSequence\n+     * from the specified position.</p>\n+     *\n+     * <p>A {@code null} CharSequence will return {@code -1}.\n+     * A negative start position is treated as zero.\n+     * An empty (\"\") search CharSequence always matches.\n+     * A start position greater than the string length only matches\n+     * an empty search CharSequence.</p>\n+     *\n+     * <pre>\n+     * StringUtils.indexOfIgnoreCase(null, *, *)          = -1\n+     * StringUtils.indexOfIgnoreCase(*, null, *)          = -1\n+     * StringUtils.indexOfIgnoreCase(\"\", \"\", 0)           = 0\n+     * StringUtils.indexOfIgnoreCase(\"aabaabaa\", \"A\", 0)  = 0\n+     * StringUtils.indexOfIgnoreCase(\"aabaabaa\", \"B\", 0)  = 2\n+     * StringUtils.indexOfIgnoreCase(\"aabaabaa\", \"AB\", 0) = 1\n+     * StringUtils.indexOfIgnoreCase(\"aabaabaa\", \"B\", 3)  = 5\n+     * StringUtils.indexOfIgnoreCase(\"aabaabaa\", \"B\", 9)  = -1\n+     * StringUtils.indexOfIgnoreCase(\"aabaabaa\", \"B\", -1) = 2\n+     * StringUtils.indexOfIgnoreCase(\"aabaabaa\", \"\", 2)   = 2\n+     * StringUtils.indexOfIgnoreCase(\"abc\", \"\", 9)        = 3\n+     * </pre>\n+     *\n+     * @param str  the CharSequence to check, may be null\n+     * @param searchStr  the CharSequence to find, may be null\n+     * @param startPos  the start position, negative treated as zero\n+     * @return the first index of the search CharSequence (always &ge; startPos),\n+     *  -1 if no match or {@code null} string input\n+     */\n+    public static int indexOfIgnoreCase(final CharSequence str, final CharSequence searchStr, int startPos) {","path":"common/src/main/java/io/netty/util/internal/StringUtils.java","position":71,"original_position":71,"commit_id":"c36f1edc2693075681fac9d4f3b28920d7765cec","original_commit_id":"c36f1edc2693075681fac9d4f3b28920d7765cec","user":{"login":"Scottmitch","id":7562868,"avatar_url":"https://avatars.githubusercontent.com/u/7562868?v=3","gravatar_id":"","url":"https://api.github.com/users/Scottmitch","html_url":"https://github.com/Scottmitch","followers_url":"https://api.github.com/users/Scottmitch/followers","following_url":"https://api.github.com/users/Scottmitch/following{/other_user}","gists_url":"https://api.github.com/users/Scottmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Scottmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scottmitch/subscriptions","organizations_url":"https://api.github.com/users/Scottmitch/orgs","repos_url":"https://api.github.com/users/Scottmitch/repos","events_url":"https://api.github.com/users/Scottmitch/events{/privacy}","received_events_url":"https://api.github.com/users/Scottmitch/received_events","type":"User","site_admin":false},"body":"`AsciiString` already has `containsIgnoreCase`. Can we share code and add `indexOfIgnoreCase` there?","created_at":"2015-11-09T16:34:17Z","updated_at":"2015-11-09T16:34:17Z","html_url":"https://github.com/netty/netty/pull/4456#discussion_r44296037","pull_request_url":"https://api.github.com/repos/netty/netty/pulls/4456","_links":{"self":{"href":"https://api.github.com/repos/netty/netty/pulls/comments/44296037"},"html":{"href":"https://github.com/netty/netty/pull/4456#discussion_r44296037"},"pull_request":{"href":"https://api.github.com/repos/netty/netty/pulls/4456"}}},"pull_request":{"url":"https://api.github.com/repos/netty/netty/pulls/4456","id":50064832,"html_url":"https://github.com/netty/netty/pull/4456","diff_url":"https://github.com/netty/netty/pull/4456.diff","patch_url":"https://github.com/netty/netty/pull/4456.patch","issue_url":"https://api.github.com/repos/netty/netty/issues/4456","number":4456,"state":"open","locked":false,"title":"Helper methods to get charset from Content-Type header of HttpMessage","user":{"login":"Spikhalskiy","id":532108,"avatar_url":"https://avatars.githubusercontent.com/u/532108?v=3","gravatar_id":"","url":"https://api.github.com/users/Spikhalskiy","html_url":"https://github.com/Spikhalskiy","followers_url":"https://api.github.com/users/Spikhalskiy/followers","following_url":"https://api.github.com/users/Spikhalskiy/following{/other_user}","gists_url":"https://api.github.com/users/Spikhalskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/Spikhalskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Spikhalskiy/subscriptions","organizations_url":"https://api.github.com/users/Spikhalskiy/orgs","repos_url":"https://api.github.com/users/Spikhalskiy/repos","events_url":"https://api.github.com/users/Spikhalskiy/events{/privacy}","received_events_url":"https://api.github.com/users/Spikhalskiy/received_events","type":"User","site_admin":false},"body":"Motivation:\r\n\r\nIssue #4331:\r\nHttpHeaders already has specific methods for such popular and simple headers like \"Host\", but if I need to convert POST raw body to string I need to parse complex ContentType header in my code.\r\n\r\nModifications:\r\n\r\nAdd getCharset and getCharsetAsString methods to parse charset from Content-Length header.","created_at":"2015-11-08T17:23:06Z","updated_at":"2015-11-09T16:34:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fa81054f0cc0d8a8b526214a3f6ae1c85382ab05","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/netty/netty/pulls/4456/commits","review_comments_url":"https://api.github.com/repos/netty/netty/pulls/4456/comments","review_comment_url":"https://api.github.com/repos/netty/netty/pulls/comments{/number}","comments_url":"https://api.github.com/repos/netty/netty/issues/4456/comments","statuses_url":"https://api.github.com/repos/netty/netty/statuses/c36f1edc2693075681fac9d4f3b28920d7765cec","head":{"label":"Spikhalskiy:get-charset","ref":"get-charset","sha":"c36f1edc2693075681fac9d4f3b28920d7765cec","user":{"login":"Spikhalskiy","id":532108,"avatar_url":"https://avatars.githubusercontent.com/u/532108?v=3","gravatar_id":"","url":"https://api.github.com/users/Spikhalskiy","html_url":"https://github.com/Spikhalskiy","followers_url":"https://api.github.com/users/Spikhalskiy/followers","following_url":"https://api.github.com/users/Spikhalskiy/following{/other_user}","gists_url":"https://api.github.com/users/Spikhalskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/Spikhalskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Spikhalskiy/subscriptions","organizations_url":"https://api.github.com/users/Spikhalskiy/orgs","repos_url":"https://api.github.com/users/Spikhalskiy/repos","events_url":"https://api.github.com/users/Spikhalskiy/events{/privacy}","received_events_url":"https://api.github.com/users/Spikhalskiy/received_events","type":"User","site_admin":false},"repo":{"id":44059965,"name":"netty","full_name":"Spikhalskiy/netty","owner":{"login":"Spikhalskiy","id":532108,"avatar_url":"https://avatars.githubusercontent.com/u/532108?v=3","gravatar_id":"","url":"https://api.github.com/users/Spikhalskiy","html_url":"https://github.com/Spikhalskiy","followers_url":"https://api.github.com/users/Spikhalskiy/followers","following_url":"https://api.github.com/users/Spikhalskiy/following{/other_user}","gists_url":"https://api.github.com/users/Spikhalskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/Spikhalskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Spikhalskiy/subscriptions","organizations_url":"https://api.github.com/users/Spikhalskiy/orgs","repos_url":"https://api.github.com/users/Spikhalskiy/repos","events_url":"https://api.github.com/users/Spikhalskiy/events{/privacy}","received_events_url":"https://api.github.com/users/Spikhalskiy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Spikhalskiy/netty","description":"Netty project - an event-driven asynchronous network application framework","fork":true,"url":"https://api.github.com/repos/Spikhalskiy/netty","forks_url":"https://api.github.com/repos/Spikhalskiy/netty/forks","keys_url":"https://api.github.com/repos/Spikhalskiy/netty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Spikhalskiy/netty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Spikhalskiy/netty/teams","hooks_url":"https://api.github.com/repos/Spikhalskiy/netty/hooks","issue_events_url":"https://api.github.com/repos/Spikhalskiy/netty/issues/events{/number}","events_url":"https://api.github.com/repos/Spikhalskiy/netty/events","assignees_url":"https://api.github.com/repos/Spikhalskiy/netty/assignees{/user}","branches_url":"https://api.github.com/repos/Spikhalskiy/netty/branches{/branch}","tags_url":"https://api.github.com/repos/Spikhalskiy/netty/tags","blobs_url":"https://api.github.com/repos/Spikhalskiy/netty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Spikhalskiy/netty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Spikhalskiy/netty/git/refs{/sha}","trees_url":"https://api.github.com/repos/Spikhalskiy/netty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Spikhalskiy/netty/statuses/{sha}","languages_url":"https://api.github.com/repos/Spikhalskiy/netty/languages","stargazers_url":"https://api.github.com/repos/Spikhalskiy/netty/stargazers","contributors_url":"https://api.github.com/repos/Spikhalskiy/netty/contributors","subscribers_url":"https://api.github.com/repos/Spikhalskiy/netty/subscribers","subscription_url":"https://api.github.com/repos/Spikhalskiy/netty/subscription","commits_url":"https://api.github.com/repos/Spikhalskiy/netty/commits{/sha}","git_commits_url":"https://api.github.com/repos/Spikhalskiy/netty/git/commits{/sha}","comments_url":"https://api.github.com/repos/Spikhalskiy/netty/comments{/number}","issue_comment_url":"https://api.github.com/repos/Spikhalskiy/netty/issues/comments{/number}","contents_url":"https://api.github.com/repos/Spikhalskiy/netty/contents/{+path}","compare_url":"https://api.github.com/repos/Spikhalskiy/netty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Spikhalskiy/netty/merges","archive_url":"https://api.github.com/repos/Spikhalskiy/netty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Spikhalskiy/netty/downloads","issues_url":"https://api.github.com/repos/Spikhalskiy/netty/issues{/number}","pulls_url":"https://api.github.com/repos/Spikhalskiy/netty/pulls{/number}","milestones_url":"https://api.github.com/repos/Spikhalskiy/netty/milestones{/number}","notifications_url":"https://api.github.com/repos/Spikhalskiy/netty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Spikhalskiy/netty/labels{/name}","releases_url":"https://api.github.com/repos/Spikhalskiy/netty/releases{/id}","created_at":"2015-10-11T16:32:06Z","updated_at":"2015-10-11T16:32:18Z","pushed_at":"2015-11-08T17:04:43Z","git_url":"git://github.com/Spikhalskiy/netty.git","ssh_url":"git@github.com:Spikhalskiy/netty.git","clone_url":"https://github.com/Spikhalskiy/netty.git","svn_url":"https://github.com/Spikhalskiy/netty","homepage":"http://netty.io/","size":45575,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"netty:master","ref":"master","sha":"a6816bd59ef2923d82af5b7a7f3b722507a56a3a","user":{"login":"netty","id":473791,"avatar_url":"https://avatars.githubusercontent.com/u/473791?v=3","gravatar_id":"","url":"https://api.github.com/users/netty","html_url":"https://github.com/netty","followers_url":"https://api.github.com/users/netty/followers","following_url":"https://api.github.com/users/netty/following{/other_user}","gists_url":"https://api.github.com/users/netty/gists{/gist_id}","starred_url":"https://api.github.com/users/netty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netty/subscriptions","organizations_url":"https://api.github.com/users/netty/orgs","repos_url":"https://api.github.com/users/netty/repos","events_url":"https://api.github.com/users/netty/events{/privacy}","received_events_url":"https://api.github.com/users/netty/received_events","type":"Organization","site_admin":false},"repo":{"id":1064563,"name":"netty","full_name":"netty/netty","owner":{"login":"netty","id":473791,"avatar_url":"https://avatars.githubusercontent.com/u/473791?v=3","gravatar_id":"","url":"https://api.github.com/users/netty","html_url":"https://github.com/netty","followers_url":"https://api.github.com/users/netty/followers","following_url":"https://api.github.com/users/netty/following{/other_user}","gists_url":"https://api.github.com/users/netty/gists{/gist_id}","starred_url":"https://api.github.com/users/netty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netty/subscriptions","organizations_url":"https://api.github.com/users/netty/orgs","repos_url":"https://api.github.com/users/netty/repos","events_url":"https://api.github.com/users/netty/events{/privacy}","received_events_url":"https://api.github.com/users/netty/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/netty/netty","description":"Netty project - an event-driven asynchronous network application framework","fork":false,"url":"https://api.github.com/repos/netty/netty","forks_url":"https://api.github.com/repos/netty/netty/forks","keys_url":"https://api.github.com/repos/netty/netty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/netty/netty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/netty/netty/teams","hooks_url":"https://api.github.com/repos/netty/netty/hooks","issue_events_url":"https://api.github.com/repos/netty/netty/issues/events{/number}","events_url":"https://api.github.com/repos/netty/netty/events","assignees_url":"https://api.github.com/repos/netty/netty/assignees{/user}","branches_url":"https://api.github.com/repos/netty/netty/branches{/branch}","tags_url":"https://api.github.com/repos/netty/netty/tags","blobs_url":"https://api.github.com/repos/netty/netty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/netty/netty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/netty/netty/git/refs{/sha}","trees_url":"https://api.github.com/repos/netty/netty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/netty/netty/statuses/{sha}","languages_url":"https://api.github.com/repos/netty/netty/languages","stargazers_url":"https://api.github.com/repos/netty/netty/stargazers","contributors_url":"https://api.github.com/repos/netty/netty/contributors","subscribers_url":"https://api.github.com/repos/netty/netty/subscribers","subscription_url":"https://api.github.com/repos/netty/netty/subscription","commits_url":"https://api.github.com/repos/netty/netty/commits{/sha}","git_commits_url":"https://api.github.com/repos/netty/netty/git/commits{/sha}","comments_url":"https://api.github.com/repos/netty/netty/comments{/number}","issue_comment_url":"https://api.github.com/repos/netty/netty/issues/comments{/number}","contents_url":"https://api.github.com/repos/netty/netty/contents/{+path}","compare_url":"https://api.github.com/repos/netty/netty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/netty/netty/merges","archive_url":"https://api.github.com/repos/netty/netty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/netty/netty/downloads","issues_url":"https://api.github.com/repos/netty/netty/issues{/number}","pulls_url":"https://api.github.com/repos/netty/netty/pulls{/number}","milestones_url":"https://api.github.com/repos/netty/netty/milestones{/number}","notifications_url":"https://api.github.com/repos/netty/netty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/netty/netty/labels{/name}","releases_url":"https://api.github.com/repos/netty/netty/releases{/id}","created_at":"2010-11-09T09:22:21Z","updated_at":"2015-11-09T13:48:17Z","pushed_at":"2015-11-08T19:14:01Z","git_url":"git://github.com/netty/netty.git","ssh_url":"git@github.com:netty/netty.git","clone_url":"https://github.com/netty/netty.git","svn_url":"https://github.com/netty/netty","homepage":"http://netty.io/","size":136896,"stargazers_count":5539,"watchers_count":5539,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2807,"mirror_url":null,"open_issues_count":325,"forks":2807,"open_issues":325,"watchers":5539,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/netty/netty/pulls/4456"},"html":{"href":"https://github.com/netty/netty/pull/4456"},"issue":{"href":"https://api.github.com/repos/netty/netty/issues/4456"},"comments":{"href":"https://api.github.com/repos/netty/netty/issues/4456/comments"},"review_comments":{"href":"https://api.github.com/repos/netty/netty/pulls/4456/comments"},"review_comment":{"href":"https://api.github.com/repos/netty/netty/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/netty/netty/pulls/4456/commits"},"statuses":{"href":"https://api.github.com/repos/netty/netty/statuses/c36f1edc2693075681fac9d4f3b28920d7765cec"}}}}