chore: fix inconsistent function name in comment#6338
chore: fix inconsistent function name in comment#6338dogancanbakir merged 1 commit intoprojectdiscovery:devfrom
Conversation
Signed-off-by: jishudashen <jishudashen@foxmail.com>
WalkthroughThis update makes minor corrections to comments in three files, aligning function and method names in the comments with their actual code declarations. No logic, implementation, or interface changes are present. Changes
Estimated code review effort1 (<30 minutes) Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
pkg/protocols/protocols.go (1)
160-168:totalRequestsis unused – the code will not compile.Go rejects unused parameters; this slipped CI because the build must already be broken or the file is excluded. Either utilise the argument or rename it to
_.Quick, minimal fix:
-func (e *ExecutorOptions) GetThreadsForNPayloadRequests(totalRequests int, currentThreads int) int { +func (e *ExecutorOptions) GetThreadsForNPayloadRequests(_ int, currentThreads int) int {Preferably, incorporate the value to avoid oversubscription:
func (e *ExecutorOptions) GetThreadsForNPayloadRequests(totalRequests, currentThreads int) int { if currentThreads > 0 { return currentThreads } if totalRequests > 0 && totalRequests < e.Options.PayloadConcurrency { return totalRequests } return e.Options.PayloadConcurrency }
🧹 Nitpick comments (2)
pkg/protocols/utils/http/requtils.go (1)
38-46: Header lookup is case-sensitive – consider canonicalising the key.
http.Headernormalises keys when they are added, but direct map access (req.Header[name]) is case-sensitive.
A caller passing"content-type"instead of"Content-Type"will bypass this guard and duplicate the header.-func SetHeader(req *retryablehttp.Request, name, value string) { - if _, ok := req.Header[name]; !ok { - req.Header.Set(name, value) +func SetHeader(req *retryablehttp.Request, name, value string) { + cName := http.CanonicalHeaderKey(name) + if _, ok := req.Header[cName]; !ok { + req.Header.Set(cName, value) } - if name == "Host" { + if cName == "Host" { req.Host = value } }pkg/templates/signer/handler.go (1)
50-62: Surface I/O errors when loading certificate from disk.If
os.ReadFilefails for reasons other than “file not found” (e.g., permission denied, I/O error), the current implementation silently returnsErrNoCertificate, hiding the root cause.- if cert, err := os.ReadFile(filepath.Join(dir, CertFilename)); err == nil { - k.UserCert = cert - return nil - } - return ErrNoCertificate + if cert, err := os.ReadFile(filepath.Join(dir, CertFilename)); err == nil { + k.UserCert = cert + return nil + } else if !errors.Is(err, os.ErrNotExist) { + return err + } + return ErrNoCertificate(import
"errors")Same pattern applies to
ReadPrivateKey.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
pkg/protocols/protocols.go(1 hunks)pkg/protocols/utils/http/requtils.go(1 hunks)pkg/templates/signer/handler.go(1 hunks)
🔇 Additional comments (2)
pkg/protocols/utils/http/requtils.go (1)
38-38: Comment capitalization fix is correct.
No functional impact – good catch.pkg/templates/signer/handler.go (1)
49-49: Comment now matches the method – looks good.
Proposed changes
fix inconsistent function name in comment
Checklist
Summary by CodeRabbit