tsenart / vegeta

HTTP load testing tool and library. It's over 9000!
http://godoc.org/github.com/tsenart/vegeta/lib
MIT License
23.5k stars 1.36k forks source link

1st pkt sends out never follow the targets file HTTP headers... #179

Closed noname5551010 closed 8 years ago

noname5551010 commented 8 years ago

1st pkt sends out never follow the targets file HTTP headers... it takes a while for vegata to use the HTTP headers in the targets file... any chance to fix it?

Thanks -Peter

tsenart commented 8 years ago

Hi @pngai1,

Would you please follow the contribution guidelines for bug reports? I'll do my best to help you after that.

https://github.com/tsenart/vegeta/blob/master/CONTRIBUTING.md#issues

Thank you, Tomás

noname5551010 commented 8 years ago

Here you go :) Thanks for your help -Peter

  1. What version of the project are you using? version 6.0 & version 6.1.0
  2. What operating system and processor architecture are you using? version 6.0 was used on Mac OSX 10.11.4; version 6.1.0 was used on Debian 3.14.5
  3. What did you do? vegeta attack -targets=targets.txt -duration=600s -rate=10 -insecure | vegeta report

targets.txt = GET http://60.0.0.1/ HTTP/1.1 Host: 60.0.0.1 User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36 Acccept-Encoding: gzip, deflate Accept: / Accept-Language: en-US;q=0.6,en;q=0.4 Connection: keep-alive Content-Type: application/x-www-form-urlencoded

4- What did you expect to see? I expect vegeta should always use the specified HTTP headers in the targets file all the time. However, it uses default HTTP header in the 1st few HTTP packets.

5- What did you see instead? Default vegeta HTTP header was seen. Just like I didn't specify any headers in the command line.

tsenart commented 8 years ago

Hello there,

I can't reproduce your issue. Which exact header isn't being sent correctly? Also, just a note, you have a typo in "Acccept-Encoding". One "c" too much.

Why don't you try to build the following server which outputs headers on every request and see if this still happens.

package main

import (
    "crypto/tls"
    "log"
    "net/http"
    "sync/atomic"
    "time"
)

func main() {
    count := uint64(0)

    go func() {
        for range time.Tick(time.Second) {
            log.Printf("Rate: %d", atomic.SwapUint64(&count, 0))
        }
    }()

    srv := http.Server{
        Addr: ":6060",
        Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
            log.Printf("Headers: %+v", r.Header)
            atomic.AddUint64(&count, 1)
        }),
    }
    log.Fatal(srv.ListenAndServe())
}
noname5551010 commented 8 years ago

thanks pointing that out. i will check it. much thanks :)

tsenart commented 8 years ago

Any news?

noname5551010 commented 8 years ago

Hi Tomas,

Looks like it was my bad. It works fine after I made the headers with correction-> deleted the "c".

Much thanks you point it out for me.

Cheers, -Peter

tsenart commented 8 years ago

No problem!