Define new http status PRECONDITION_REQUIRED

Trivial addition to the Status enum

Octopus REST API makes use of a newly proposed http code
http://datatracker.ietf.org/doc/draft-nottingham-http-new-status/?include_text=1

For context of how this is used:
https://reviewboard.eng.vmware.com/r/323825

Change-Id: I0effebe8c9c5dd70b00a1267b15428f6624c18e0
Reviewed-on: https://gerrit.dechocorp.com/31566
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Jeremy Stanley <jeremy@mozy.com>
refs #77997, raise exception upon bad confvar name

Change-Id: If39667f05605ec5682a77b4d4eb4489727740a37
Signed-off-by: Kefu Chai <chaik@mozy.com>
Reviewed-on: https://gerrit.dechocorp.com/30900
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Kevin Cai <kcai@vmware.com>
fix ragel parser not finish issue

* need explicitly call run(NULL, 0, false) inside Buffer and Stream
  version of RagelParser::run in order to trigger the last actions in
  ragel state machine.

Change-Id: Iac9bba5443332e61a004b6a09f3ca5dad8a25e49
Signed-off-by: Kevin Cai <kcai@vmware.com>
Reviewed-on: https://gerrit.dechocorp.com/31657
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Wen Zhao <wenz@mozy.com>
For multiple ranges, should return 206 instead of 200

Change-Id: Id3bb741673763f60d6ca58f6e926fdb879b2aceb
Signed-off-by: Xiangdong Lin <xiangdongl@mozy.com>
Reviewed-on: https://gerrit.dechocorp.com/31742
Reviewed-by: Kevin Cai <kcai@vmware.com>
Update unit test to cope with to multiple range bugfix

Change-Id: I600d37400730acabbe8708452b200d51f33817ad
Signed-off-by: Xiangdong Lin <xiangdongl@mozy.com>
Reviewed-on: https://gerrit.dechocorp.com/31744
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Kevin Cai <kcai@vmware.com>
refactory MockConnectionBrkoer

* extract common timeout attr to ConnectionBroker

Change-Id: I2881d8098819d2ccf4b957bc2d00ec61035c386d
Signed-off-by: Eric Wang <leiw@mozy.com>
Reviewed-on: https://gerrit.dechocorp.com/30966
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Kevin Cai <kcai@vmware.com>
refs #78323, enable connections per host option

Change-Id: Ifbe62508a24e911b92a70aab7e86579993eb40d2
Signed-off-by: Eric Wang <leiw@mozy.com>
Reviewed-on: https://gerrit.dechocorp.com/31826
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Kevin Cai <kcai@vmware.com>
Reviewed-by: Wen Zhao <wenz@mozy.com>
add SHA224Stream and SHA256Stream into HashStream

* add SHA224 and SHA256 stream
* refactor SHAStream, SHA0Stream, SHA1Stream, MD5Stream, all specialized
  from the same template class.
* add dumpContext() interface to HashStream to allow restore the hash
  calculation with the dump

Change-Id: Ifc71ba8020ade1953a2f1d825f1743ab62451bed
Signed-off-by: Kevin Cai <kcai@vmware.com>
Reviewed-on: https://gerrit.dechocorp.com/31388
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Andrew Skowronski <andrews@mozy.com>
optional include path variable for Mordor (windows)

Porting change implemented by mreed@vmware.com back
into official tree.

For Deep Sea client we cannot use the same
3rd party libraries as are hardcoded in the build machine
config.

We needed a way to inject project specific instructions
for where to find boost, openssl and zlib without
introducing project specific information into the
mordor shared code.  So we introduce support for an generic
env variable called MORDOR_INCLUDE which can be filled in with project
specific include directives as part of the compilation script.

This is optional - existing clients who do not define MORDOR_INCLUDE
will not be influenced.

Patch 2 - fix error in 64bit configs noticed by Russ

Change-Id: I0fe668c489ac8fd4eadc388145dc7b0b0899125b
Reviewed-on: https://gerrit.dechocorp.com/31811
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Kevin Cai <kcai@vmware.com>
Reviewed-by: Russ Simons <russs@mozy.com>
refs #78323, fix HTTPStream close issue

* HTTPStream should always close parent stream, otherwise
  upstream will die with incomplete status.

Change-Id: If0b3f1af982d5d37e2ed2e9c3746fb54ac2d7b52
Signed-off-by: Eric Wang <leiw@mozy.com>
Reviewed-on: https://gerrit.dechocorp.com/31366
Reviewed-by: Kevin Cai <kcai@vmware.com>
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Wen Zhao <wenz@mozy.com>
correct wrong logic in HTTPStream

Change-Id: Ic0bfc4d47896f299983ed1ae323a6f83f47fbd81
Signed-off-by: Eric Wang <leiw@mozy.com>
Reviewed-on: https://gerrit.dechocorp.com/32697
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Wen Zhao <wenz@mozy.com>
add hashfwd.h, remove anonymous namespace in hash.h

* anonymous namespace in header file might cause unexpected compile/link
  problem, remove it
* add hashfwd.h to allow easy forward declaration of those hash streams

Change-Id: I633aed664b735f47b0c9c41f02f69baf016f9cca
Signed-off-by: Kevin Cai <kcai@vmware.com>
Reviewed-on: https://gerrit.dechocorp.com/32791
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Andrew Skowronski <andrews@mozy.com>
make a json object's keys unique

* since RFC-4627 states that an object `SHOULD' contain unique keys. and seems
  we always use the first found value in an json object.
* use the last value if multiple of <key,val> pairs found in the same object.
* JSON::Value now accept other integer/float types as well as long long and
  double

Change-Id: Ica2ff43d244e7ccd2ddb9b76b7475b1e8ed5de3c
Signed-off-by: Kefu Chai <chaik@mozy.com>
Reviewed-on: https://gerrit.dechocorp.com/32984
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Andrew Skowronski <andrews@mozy.com>
Reviewed-by: Jeff Tulley <jefft@mozy.com>
Add sha0sum string helpers

Change-Id: I82ec022ef798c885709420dbb2708fe34b0b74ad
Reviewed-on: https://gerrit.dechocorp.com/33206
Reviewed-by: Kevin Cai <kcai@vmware.com>
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Andrew Skowronski <andrews@mozy.com>
fix Fiber setjmp coredump after xcode 4.2+

* after xcode 4.2+ upgrade, with gcc+llvm+`-O0' build, there are
  additional write instructions after _setjmp() call before next
  C++ statment which still refer to the `rbp'(`ebp') register.
* work around the issue by not cleaning the `rbp'(`ebp') register, set
  it to Fiber's `rsp' so that the `rbp' is still valid in order to
  avoid writting data to original invalid `rbp' stack.

Change-Id: I2659df2996524ba4ae445d7badf1376cc45a0bcf
Signed-off-by: Kevin Cai <kcai@vmware.com>
Reviewed-on: https://gerrit.dechocorp.com/33359
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Kefu Chai <chaik@mozy.com>
Reviewed-by: Andrew Skowronski <andrews@mozy.com>
Reviewed-by: Grady Player <gradyp@mozy.com>
Reviewed-by: David Brown <davidb@mozy.com>
let HTTPStream close parent stream gracefully

* it's the best practise for FilterStream to popup close event to
its parent stream explicitly, which gives other Streams the chance
to do their own cleanup.

Change-Id: I657b018abd86944475d561ef328885a89f819370
Signed-off-by: Eric Wang <leiw@mozy.com>
Reviewed-on: https://gerrit.dechocorp.com/33369
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Kevin Cai <kcai@vmware.com>
Reviewed-by: Andrew Skowronski <andrews@mozy.com>
make IOManager::idle more exception safe

* any exception happens in IOManager::idle() event loop, the remaining
  event will be thrown even though the exception is caught on
  high level. The lost events from the same batch can cause related
  Fiber hanging forever waiting for the event.
* fix it by catching the exception and save it to boost::exception_ptr
  and rethrow after all the events are handled.

Change-Id: I7338cd61885cdf40e0fad4a7c20e573e74657503
Signed-off-by: Kevin Cai <kcai@vmware.com>
Reviewed-on: https://gerrit.dechocorp.com/33606
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Andrew Skowronski <andrews@mozy.com>
Config supports loading arbitrary config var from json object

Change-Id: Ibe899bdb695b40adc4036171c5c35f5de1b96e42
Signed-off-by: Bert Yuan <berty@mozy.com>
Reviewed-on: https://gerrit.dechocorp.com/33603
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Kevin Cai <kcai@vmware.com>
Reviewed-by: Kefu Chai <kchai@vmware.com>
Add an interface cancel() to HTTP::ServerConnection

Change-Id: I42ec0aa7625963a9796a2bc3cca7532a8a1b4286
Signed-off-by: Xiangdong Lin <xiangdongl@mozy.com>
Reviewed-on: https://gerrit.dechocorp.com/33695
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Kevin Cai <kcai@vmware.com>
Fix proxy bypass list parsing.

Fix how we parse the proxy and bypass lists. This fixes the case where the
bypass list entry has a wildcard in the middle or at the end of the hostname
(e.g. "www.*.example.com" or "10.17.*"). I've also changed the code so that
the automatic settings override the local settings; this is how IE behaves.
This change doesn't fix the unsafe string comparisons in this code (comparing
Unicode strings using strcmp is not safe); which I will address in a
subsequent change.

I've also cleaned up the "detection cache" code somewhat, by adding some
additional comments and logging to try and make it clear what the code is
trying to accomplish.

This change also updates the mordor Xcode project so that it is possible
to build and run the mordor unit tests from the GUI on mac; the new target
is named 'run_tests'.

Finally, I've added a number of tests for the proxyFromList function in
mordor/tests/http_proxy.cpp.

Change-Id: Id69008c1bb6970bf0ac8c36809f9e663eba075e7
Signed-off-by: Jason Carreiro <jcarreiro@mozy.com>
Reviewed-on: https://gerrit.dechocorp.com/33588
Reviewed-by: Jenkins <hudsonbuild@mozy.com>
Reviewed-by: Andrew Skowronski <andrews@mozy.com>