Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-Agent is static #1

Open
GoogleCodeExporter opened this issue Mar 14, 2015 · 10 comments
Open

User-Agent is static #1

GoogleCodeExporter opened this issue Mar 14, 2015 · 10 comments

Comments

@GoogleCodeExporter
Copy link

httperf will always emit the httperf user-agent, even when set explicitly
in arguments. This makes it difficult to test when UA is important to the
server.

Two possible fixes;

1) make it possible to explicitly override the UA on the command line. It
would probably also be necessary to allow logs (e.g., wlog) to override it.

2) omit the UA, unless it's specified.

#2 is probably easier, but may cause problems if people don't remember to
set a UA.

Original issue reported on code.google.com by tedbullo...@gmail.com on 16 Dec 2009 at 7:02

@GoogleCodeExporter
Copy link
Author

Here's a patch that actually solves this problem, as it relates to the use of 
wlog files.  I added a new command-line option, called --embedded-http-headers. 
 Invoking httperf with this option allows you to create slightly different wlog 
files for invoking lots of urls.  In 0.9.0, the wlog file format is a 
null-delimited list of URLs to request.  If you invoke with 
--embedded-http-headers, you can specify per-URL http headers in the file.  The 
format of the file is still null-delimited.  However, within each URL, you may 
(optionally) add HTTP headers, separated from the URL by a control-A character. 
 So, the line format looks like:

    custom-header-1: foo\ncustom-header-2: bar\n^A/index.html\0
    custom-header-3: baz\ncustom-header-4: quux\n^A/someother/page.html\0

The HTTP headers are specific to each URL requested (they are not additive).

This patch solves the user-agent problem when using a custom log file to replay 
large numbers of requests.  


Original comment by davevi...@gmail.com on 27 Sep 2010 at 5:49

Attachments:

@GoogleCodeExporter
Copy link
Author

Slightly improved patch.  strnstr is not portable, but rather it's FreeBSD 
specific.  So here's a simple version that checks to see if strnstr is 
available.  If not, we use a basic implementation.

Original comment by davevi...@gmail.com on 27 Sep 2010 at 8:35

Attachments:

@GoogleCodeExporter
Copy link
Author

Sorry.. forgot to update the man page to include a note about 
embedded-http-headers

Original comment by davevi...@gmail.com on 27 Sep 2010 at 10:11

Attachments:

@GoogleCodeExporter
Copy link
Author

I have httperf-0.9.0 anb try to apply the patch like this 

patch -p0 <enable_custom_http_headers-v3.patch

but I'v got the following:

patching file configure.ac
Hunk #1 succeeded at 10 with fuzz 2 (offset -73 lines).
patching file src/httperf.c
Hunk #1 FAILED at 114.
Hunk #2 FAILED at 176.
Hunk #3 FAILED at 1063.
3 out of 3 hunks FAILED -- saving rejects to file src/httperf.c.rej
patching file src/call.h
Hunk #1 succeeded at 42 with fuzz 1 (offset 5 lines).
patching file src/httperf.h
Hunk #1 succeeded at 136 with fuzz 1 (offset 14 lines).
patching file src/gen/uri_wlog.c
Hunk #2 succeeded at 91 (offset -5 lines).
Hunk #3 succeeded at 172 (offset -5 lines).
patching file src/core.c
Hunk #1 succeeded at 118 with fuzz 2 (offset 27 lines).
Hunk #2 FAILED at 146.
Hunk #3 FAILED at 980.
Hunk #4 FAILED at 997.
Hunk #5 FAILED at 1004.
4 out of 5 hunks FAILED -- saving rejects to file src/core.c.rej
patching file man/httperf.1
Hunk #1 FAILED at 13.
Hunk #2 FAILED at 196.
2 out of 2 hunks FAILED -- saving rejects to file man/httperf.1.rej

What do I do wrong?

Original comment by chekhyn on 11 Nov 2011 at 10:55

@GoogleCodeExporter
Copy link
Author

I got the same errors as chekhyn above.  Not sure what I've done wrong?

patching file configure.ac
Hunk #1 succeeded at 10 with fuzz 2 (offset -73 lines).
patching file src/httperf.c
Hunk #1 FAILED at 114.
Hunk #2 FAILED at 176.
Hunk #3 FAILED at 1063.
3 out of 3 hunks FAILED -- saving rejects to file src/httperf.c.rej
patching file src/call.h
Hunk #1 succeeded at 42 with fuzz 1 (offset 5 lines).
patching file src/httperf.h
Hunk #1 succeeded at 136 with fuzz 1 (offset 14 lines).
patching file src/gen/uri_wlog.c
Hunk #2 succeeded at 91 (offset -5 lines).
Hunk #3 succeeded at 172 (offset -5 lines).
patching file src/core.c
Hunk #1 succeeded at 118 with fuzz 2 (offset 27 lines).
Hunk #2 FAILED at 146.
Hunk #3 FAILED at 980.
Hunk #4 FAILED at 997.
Hunk #5 FAILED at 1004.
4 out of 5 hunks FAILED -- saving rejects to file src/core.c.rej
patching file man/httperf.1
Hunk #1 FAILED at 13.
Hunk #2 FAILED at 196.
2 out of 2 hunks FAILED -- saving rejects to file man/httperf.1.rej

Help please?

Original comment by agemm...@gmail.com on 1 Feb 2013 at 10:41

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

~/Downloads/httperf-0.9.0 $ gpatch -p1 < ../enable_custom_http_headers_v4.patch
patching file configure.ac
patching file man/httperf.1
patching file src/call.h
patching file src/core.c
patching file src/httperf.c
patching file src/httperf.h
patching file src/gen/uri_wlog.c

Original comment by testd...@gmail.com on 1 Aug 2013 at 8:21

Attachments:

@GoogleCodeExporter
Copy link
Author

httperf --client=0/1 --server=192.168.1.1 --port=80 --uri=/ok --rate=1 
--send-buffer=4096 --recv-buffer=16384 --add-header='User-Agent: hpzda\n' 
--num-conns=1 --num-calls=1
write(1, " h t t p e r f   - - c l".., 173)     = 173
schedctl()                                      = 0xFFFFFFFF7F706000
sigaction(SIGPIPE, 0xFFFFFFFF7FFFF370, 0xFFFFFFFF7FFFF460) = 0
getrlimit(RLIMIT_NOFILE, 0xFFFFFFFF7FFFF550)    = 0
setrlimit(RLIMIT_NOFILE, 0xFFFFFFFF7FFFF550)    = 0
brk(0x1001A3180)                                = 0
brk(0x1001A7180)                                = 0
open("/etc/netconfig", O_RDONLY|O_LARGEFILE)    = 3
time()                                          = 1375389800
brk(0x1001A7180)                                = 0
brk(0x1001AB180)                                = 0
rctlsys(0, "process.max-file-descriptor", 0x00000000, 0x1001A5860, 0, 0) = 0
fcntl(3, F_DUPFD, 0x00000100)                   = 256
close(3)                                        = 0
read(256, " # p r a g m a   i d e n".., 1024)   = 1024
read(256, " t s           t p i _ c".., 1024)   = 215
read(256, 0x1001A5434, 1024)                    = 0
lseek(256, 0, SEEK_SET)                         = 0
read(256, " # p r a g m a   i d e n".., 1024)   = 1024
read(256, " t s           t p i _ c".., 1024)   = 215
read(256, 0x1001A5434, 1024)                    = 0
close(256)                                      = 0
open("/dev/udp", O_RDONLY)                      = 3
ioctl(3, SIOCGLIFNUM, 0xFFFFFFFF7FFFF174)       = 0
close(3)                                        = 0
sigaction(SIGINT, 0xFFFFFFFF7FFFF440, 0xFFFFFFFF7FFFF530) = 0
so_socket(PF_INET, SOCK_STREAM, IPPROTO_IP, "", SOV_DEFAULT) = 3
fcntl(3, F_SETFL, FNONBLOCK)                    = 0
setsockopt(3, tcp, TCP_NODELAY, 0xFFFFFFFF7FFFF3BC, 4, SOV_DEFAULT) = 0
setsockopt(3, SOL_SOCKET, SO_SNDBUF, 0xFFFFFFFF7FFFF3BC, 4, SOV_DEFAULT) = 0
setsockopt(3, SOL_SOCKET, SO_RCVBUF, 0xFFFFFFFF7FFFF3BC, 4, SOV_DEFAULT) = 0
brk(0x1001AB180)                                = 0
brk(0x1001AF180)                                = 0
connect(3, 0x1001A11A4, 16, SOV_DEFAULT)        = 0
getrusage(0x10019B0E8)                          = 0
pollsys(0xFFFFFFFF7FFF9270, 1, 0xFFFFFFFF7FFF9350, 0x00000000) = 1
writev(3, 0x1001A5488, 19)                      Err#22 EINVAL
getsockopt(3, SOL_SOCKET, SO_ERROR, 0xFFFFFFFF7FFF953C, 0xFFFFFFFF7FFF9538, 
SOV_DEFAULT) = 0
fstat(2, 0xFFFFFFFF7FFF7EF0)                    = 0
httperfwrite(2, " h t t p e r f", 7)                    = 7
: connection failed with unexpected error write(2, " :   c o n n e c t i o 
n".., 42)    = 42
22
write(2, " 2 2\n", 3)                           = 3
close(3)                                        = 0

To reproduce: apply patch enable_custom_http_headers_v4.patch compile and run 
(as result will see message: connection failed with unexpected error 22)

Original comment by testd...@gmail.com on 1 Aug 2013 at 8:47

jazd added a commit to jazd/httperf that referenced this issue Dec 22, 2015
Including a bug fix in uri_wlog.c
@jazd
Copy link
Contributor

jazd commented Dec 22, 2015

Even though I do not support this patch as a fix for this issue. If I had the time, I may have done it differently. I have attached a updated version of above enable_custom_http_headers_v4.patch file that works with the current head of this project.

0001-Patch-4-from-https-github.com-httperf-httperf-issues.patch.txt

It may not work without also including the one-line fix from #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants