mirror of
https://github.com/projectdiscovery/httpx.git
synced 2024-11-28 22:01:28 +03:00
adding partial header extraction
This commit is contained in:
parent
0817f3168e
commit
7f4a17b06b
@ -308,7 +308,7 @@ retry:
|
||||
if scanopts.OutputContentType {
|
||||
builder.WriteString(" [")
|
||||
if !scanopts.OutputWithNoColor {
|
||||
builder.WriteString(aurora.Magenta(resp.GetHeader("Content-Type")).String())
|
||||
builder.WriteString(aurora.Magenta(resp.GetHeaderPart("Content-Type", 0)).String())
|
||||
} else {
|
||||
builder.WriteString(resp.GetHeader("content-type"))
|
||||
}
|
||||
@ -365,7 +365,7 @@ retry:
|
||||
URL: fullURL,
|
||||
ContentLength: resp.ContentLength,
|
||||
StatusCode: resp.StatusCode,
|
||||
ContentType: resp.GetHeader("Content-Type"),
|
||||
ContentType: resp.GetHeaderPart("Content-Type", 0),
|
||||
Title: title,
|
||||
str: builder.String(),
|
||||
VHost: isvhost,
|
||||
|
@ -25,3 +25,13 @@ func (r *Response) GetHeader(name string) string {
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetHeaderPart with offset
|
||||
func (r *Response) GetHeaderPart(name string, at int) string {
|
||||
v, ok := r.Headers[name]
|
||||
if ok && at < len(v) {
|
||||
return v[at]
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user