Hello community,
here is the log from the commit of package golang-github-fitstar-falcore for openSUSE:Factory checked in at 2017-03-24 02:15:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/golang-github-fitstar-falcore (Old)
and /work/SRC/openSUSE:Factory/.golang-github-fitstar-falcore.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "golang-github-fitstar-falcore"
Fri Mar 24 02:15:29 2017 rev:2 rq:477167 version:0.0.0+git20161013.63e3547
Changes:
--------
--- /work/SRC/openSUSE:Factory/golang-github-fitstar-falcore/golang-github-fitstar-falcore.changes 2015-08-01 11:36:25.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.golang-github-fitstar-falcore.new/golang-github-fitstar-falcore.changes 2017-03-24 02:15:31.084160450 +0100
@@ -1,0 +2,20 @@
+Thu Dec 08 08:30:39 UTC 2016 - tboerger@suse.com
+
+- Update to version 0.0.0+git20161013.63e3547:
+ * gofmt
+ * - Checkout fixed example from ngmoco
+ * - Update github reference and change Simpe to StringResponse
+ * body on http.Response should never be nil. leave the zero-length strings.NewReader intact
+ * fixing the percentages on the trace
+ * make sure to drop transfer encoding since we dropped the body
+ * don't allocate headers when they're already provided
+ * removed debug etag test error
+ * don't crash if the upstream pool is empty
+ * make content length behavior match
+
+-------------------------------------------------------------------
+Thu Dec 8 08:27:07 UTC 2016 - tboerger@suse.com
+
+- Refactoring based on new packaging proposal
+
+-------------------------------------------------------------------
Old:
----
falcore-0.0.0+git20150708.286078d.tar.xz
New:
----
falcore-0.0.0+git20161013.63e3547.tar.xz
rpmlintrc
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ golang-github-fitstar-falcore.spec ++++++
--- /var/tmp/diff_new_pack.cISKRk/_old 2017-03-24 02:15:31.660078962 +0100
+++ /var/tmp/diff_new_pack.cISKRk/_new 2017-03-24 02:15:31.664078397 +0100
@@ -1,8 +1,7 @@
#
-# spec file for package golang-github-fitstar-falcore
+# spec file for package golang
#
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
-# Copyright (c) 2012 Graham Anderson
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,47 +16,55 @@
#
-Name: golang-github-fitstar-falcore
-Version: 0.0.0+git20150708.286078d
+%global provider github
+%global provider_tld com
+%global project fitstar
+%global repo falcore
+%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
+%global import_path %{provider_prefix}
+
+Name: golang-%{provider}-%{project}-%{repo}
+Version: 0.0.0+git20161013.63e3547
Release: 0
Summary: Falcore is a filter pipiline based HTTP server library
License: MIT
-Group: Development/Languages/Other
-Url: http://github.com/fitstar/falcore
-Source0: falcore-%{version}.tar.xz
+Group: Development/Languages/Golang
+Url: https://%{provider_prefix}
+Source0: %{repo}-%{version}.tar.xz
+Source1: rpmlintrc
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
BuildRequires: golang-packaging
BuildRequires: xz
-Provides: go-falcore = %{version}
-Obsoletes: go-falcore < %{version}
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
-%{go_provides}
+%{go_nostrip}
+%{go_provides}
%description
Falcore is a framework for constructing high performance, modular HTTP servers in Golang.
Falcore is a filter pipeline based HTTP server library. You can build arbitrarily
complicated HTTP services by chaining just a few simple components
-%gosrc_package
-
%prep
-%setup -q -n falcore-%{version}
+%setup -q -n %{repo}-%{version}
+
+# do not build these examples
+rm -rf examples
%build
-%goprep github.com/fitstar/falcore
-%gobuild router filter
+%goprep %{import_path}
+%gobuild ...
%install
-%goinstall github.com/fitstar/falcore
+%goinstall
%gosrc
+%gofilelist
-%files
-%defattr(-,root,root,-)
-%doc README.md LICENSE.md examples
-%{go_contribdir}/*
+%check
+%gotest %{import_path}...
-%files source
+%files -f file.lst
%defattr(-,root,root,-)
-%{go_contribsrcdir}/*
+%doc README.md LICENSE.md
%changelog
++++++ _service ++++++
--- /var/tmp/diff_new_pack.cISKRk/_old 2017-03-24 02:15:31.696073870 +0100
+++ /var/tmp/diff_new_pack.cISKRk/_new 2017-03-24 02:15:31.696073870 +0100
@@ -1,16 +1,17 @@
<services>
- <service name="tar_scm" mode="localonly">
- <param name="url">https://github.com/fitstar/falcore.git</param>
+ <service name="tar_scm" mode="disabled">
+ <param name="url">https://github.com/fitstar/falcore</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="versionformat">0.0.0+git%cd.%h</param>
<param name="revision">master</param>
+ <param name="changesgenerate">enable</param>
</service>
- <service name="recompress" mode="localonly">
+ <service name="recompress" mode="disabled">
<param name="file">falcore-*.tar</param>
<param name="compression">xz</param>
</service>
- <service name="set_version" mode="localonly">
+ <service name="set_version" mode="disabled">
<param name="basename">falcore</param>
</service>
</services>
++++++ falcore-0.0.0+git20150708.286078d.tar.xz -> falcore-0.0.0+git20161013.63e3547.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/falcore-0.0.0+git20150708.286078d/content_length_test.go new/falcore-0.0.0+git20161013.63e3547/content_length_test.go
--- old/falcore-0.0.0+git20150708.286078d/content_length_test.go 2015-07-25 17:37:37.000000000 +0200
+++ new/falcore-0.0.0+git20161013.63e3547/content_length_test.go 2016-10-14 02:13:16.000000000 +0200
@@ -4,10 +4,18 @@
"bytes"
"fmt"
"io"
+ "net"
"net/http"
+ "strconv"
"testing"
)
+var (
+ // Go HTTP server uses a buffer to auto-un-chunk small responses.
+ // Use large enough response body to overflow that so tests behave as expected
+ testContent1MB = make([]byte, 1024*1024)
+)
+
var contentLengthTestData = []struct {
method string
path string
@@ -17,13 +25,13 @@
chunked bool
}{
{"GET", "/basic", []byte("ABC"), 3, 3, false},
- {"GET", "/chunked", []byte("ABC"), -1, -1, true},
+ {"GET", "/chunked", testContent1MB, -1, -1, true},
{"GET", "/zero", []byte(""), 0, 0, false},
- {"GET", "/unset", []byte("ABC"), 0, -1, true},
+ {"GET", "/unset", testContent1MB, 0, -1, true},
{"GET", "/nil_body", nil, 0, 0, false},
{"HEAD", "/basic", []byte("ABC"), 3, 3, false},
- {"HEAD", "/chunked", []byte("ABC"), -1, -1, false},
- {"HEAD", "/unset", []byte("ABC"), 0, -1, false},
+ {"HEAD", "/chunked", testContent1MB, -1, -1, false},
+ {"HEAD", "/unset", testContent1MB, 0, -1, false},
{"HEAD", "/zero", []byte(""), 0, 0, false},
{"HEAD", "/nil_body", nil, 0, 0, false},
{"HEAD", "/unset_nil", nil, -1, -1, false},
@@ -32,6 +40,50 @@
func TestContentLength(t *testing.T) {
// Startup a basic server and get the port
+ srv := serverForContentLengthTest()
+ go func() {
+ srv.ListenAndServe()
+ }()
+ <-srv.AcceptReady
+ serverPort := srv.Port()
+
+ // Run Tests
+ testContentLengthWithPort(t, serverPort)
+
+ // Clean up
+ srv.StopAccepting()
+}
+
+func TestContentLength_GoHttpServer(t *testing.T) {
+ // Startup a basic server and get the port
+ srv := &http.Server{
+ Addr: ":0",
+ Handler: serverForContentLengthTest(),
+ }
+ portChan := make(chan int)
+ // Create listner
+ l, _ := net.Listen("tcp", ":0")
+ go func() {
+ // Get port
+ a := l.Addr()
+ if _, p, e := net.SplitHostPort(a.String()); e == nil && p != "" {
+ portInt, _ := strconv.Atoi(p)
+ portChan <- portInt
+ }
+
+ // Serve via net/http Server
+ srv.Serve(l)
+ }()
+ serverPort := <-portChan
+
+ // Run Tests
+ testContentLengthWithPort(t, serverPort)
+
+ // Clean up
+ l.Close()
+}
+
+func serverForContentLengthTest() *Server {
pipeline := NewPipeline()
srv := NewServer(0, pipeline)
pipeline.Upstream.PushBack(NewRequestFilter(func(req *Request) *http.Response {
@@ -46,12 +98,10 @@
}
panic("Thing not found")
}))
- go func() {
- srv.ListenAndServe()
- }()
- <-srv.AcceptReady
- serverPort := srv.Port()
+ return srv
+}
+func testContentLengthWithPort(t *testing.T, serverPort int) {
// Connect and make some requests
c := new(http.Client)
for _, test := range contentLengthTestData {
@@ -91,7 +141,4 @@
res.Body.Close()
}
-
- // Clean up
- srv.StopAccepting()
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/falcore-0.0.0+git20150708.286078d/filter/upstream_pool.go new/falcore-0.0.0+git20161013.63e3547/filter/upstream_pool.go
--- old/falcore-0.0.0+git20150708.286078d/filter/upstream_pool.go 2015-07-25 17:37:37.000000000 +0200
+++ new/falcore-0.0.0+git20161013.63e3547/filter/upstream_pool.go 2016-10-14 02:13:16.000000000 +0200
@@ -64,6 +64,10 @@
}
func (up UpstreamPool) FilterRequest(req *falcore.Request) (res *http.Response) {
+ if len(up.pool) < 1 {
+ return falcore.StringResponse(req.HttpRequest, 503, nil, "Service Unavailable\n")
+ }
+
ue := up.Next()
res = ue.Upstream.FilterRequest(req)
if req.CurrentStage.Status == 2 {
@@ -91,6 +95,11 @@
}
func (up UpstreamPool) nextServer() {
+ // Don't start up if there are no entries
+ if len(up.pool) < 1 {
+ return
+ }
+
loopCount := 0
for {
next := up.rr_count % len(up.pool)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/falcore-0.0.0+git20150708.286078d/server.go new/falcore-0.0.0+git20161013.63e3547/server.go
--- old/falcore-0.0.0+git20150708.286078d/server.go 2015-07-25 17:37:37.000000000 +0200
+++ new/falcore-0.0.0+git20161013.63e3547/server.go 2016-10-14 02:13:16.000000000 +0200
@@ -218,6 +218,11 @@
theHeader[key] = header
}
+ // Handle Content-Length
+ if res.ContentLength >= 0 {
+ theHeader.Set("Content-Length", strconv.FormatInt(res.ContentLength, 10))
+ }
+
// Write headers
wr.WriteHeader(res.StatusCode)
++++++ rpmlintrc ++++++
# We are preventing the stripping to keep backtraces intact
addFilter("unstripped-binary-or-object")
# Golang doesn't support dynamic linking yet in a proper way
addFilter("statically-linked-binary")
# We are aware of that but shorter names are not possible
addFilter("filename-too-long-for-joliet")