Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
2fa28e79
Commit
2fa28e79
authored
Mar 04, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asio: Separate client API to asio_http2_client.h
parent
76eab3fa
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
149 additions
and
119 deletions
+149
-119
examples/asio-cl.cc
examples/asio-cl.cc
+1
-4
src/asio_client_request.cc
src/asio_client_request.cc
+3
-1
src/asio_client_request_impl.h
src/asio_client_request_impl.h
+1
-1
src/asio_client_response.cc
src/asio_client_response.cc
+3
-1
src/asio_client_response_impl.h
src/asio_client_response_impl.h
+1
-1
src/asio_client_session.cc
src/asio_client_session.cc
+1
-1
src/asio_client_session_impl.h
src/asio_client_session_impl.h
+1
-7
src/asio_client_session_tcp_impl.h
src/asio_client_session_tcp_impl.h
+1
-3
src/asio_client_session_tls_impl.h
src/asio_client_session_tls_impl.h
+1
-3
src/asio_client_stream.h
src/asio_client_stream.h
+1
-1
src/asio_client_tls_context.h
src/asio_client_tls_context.h
+1
-1
src/includes/Makefile.am
src/includes/Makefile.am
+1
-1
src/includes/nghttp2/asio_http2.h
src/includes/nghttp2/asio_http2.h
+0
-94
src/includes/nghttp2/asio_http2_client.h
src/includes/nghttp2/asio_http2_client.h
+133
-0
No files found.
examples/asio-cl.cc
View file @
2fa28e79
...
...
@@ -26,10 +26,7 @@
#include <iostream>
#include <string>
#include <boost/asio.hpp>
#include <nghttp2/nghttp2.h>
#include <nghttp2/asio_http2.h>
#include <nghttp2/asio_http2_client.h>
using
boost
::
asio
::
ip
::
tcp
;
...
...
src/asio_client_request.cc
View file @
2fa28e79
...
...
@@ -22,7 +22,9 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <nghttp2/asio_http2.h>
#include "nghttp2_config.h"
#include <nghttp2/asio_http2_client.h>
#include "asio_client_request_impl.h"
...
...
src/asio_client_request_impl.h
View file @
2fa28e79
...
...
@@ -27,7 +27,7 @@
#include "nghttp2_config.h"
#include <nghttp2/asio_http2.h>
#include <nghttp2/asio_http2
_client
.h>
namespace
nghttp2
{
namespace
asio_http2
{
...
...
src/asio_client_response.cc
View file @
2fa28e79
...
...
@@ -22,7 +22,9 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <nghttp2/asio_http2.h>
#include "nghttp2_config.h"
#include <nghttp2/asio_http2_client.h>
#include "asio_client_response_impl.h"
...
...
src/asio_client_response_impl.h
View file @
2fa28e79
...
...
@@ -27,7 +27,7 @@
#include "nghttp2_config.h"
#include <nghttp2/asio_http2.h>
#include <nghttp2/asio_http2
_client
.h>
namespace
nghttp2
{
namespace
asio_http2
{
...
...
src/asio_client_session.cc
View file @
2fa28e79
...
...
@@ -24,7 +24,7 @@
*/
#include "nghttp2_config.h"
#include <nghttp2/asio_http2.h>
#include <nghttp2/asio_http2
_client
.h>
#include "asio_client_session_tcp_impl.h"
#include "asio_client_session_tls_impl.h"
...
...
src/asio_client_session_impl.h
View file @
2fa28e79
...
...
@@ -27,13 +27,7 @@
#include "nghttp2_config.h"
#include <map>
#include <boost/asio.hpp>
#include <nghttp2/nghttp2.h>
#include <nghttp2/asio_http2.h>
#include <nghttp2/asio_http2_client.h>
namespace
nghttp2
{
namespace
asio_http2
{
...
...
src/asio_client_session_tcp_impl.h
View file @
2fa28e79
...
...
@@ -27,9 +27,7 @@
#include "asio_client_session_impl.h"
#include <boost/asio.hpp>
#include <nghttp2/asio_http2.h>
#include <nghttp2/asio_http2_client.h>
namespace
nghttp2
{
namespace
asio_http2
{
...
...
src/asio_client_session_tls_impl.h
View file @
2fa28e79
...
...
@@ -27,9 +27,7 @@
#include "asio_client_session_impl.h"
#include <boost/asio.hpp>
#include <nghttp2/asio_http2.h>
#include <nghttp2/asio_http2_client.h>
namespace
nghttp2
{
namespace
asio_http2
{
...
...
src/asio_client_stream.h
View file @
2fa28e79
...
...
@@ -27,7 +27,7 @@
#include "nghttp2_config.h"
#include <nghttp2/asio_http2.h>
#include <nghttp2/asio_http2
_client
.h>
namespace
nghttp2
{
namespace
asio_http2
{
...
...
src/asio_client_tls_context.h
View file @
2fa28e79
...
...
@@ -27,6 +27,6 @@
#include "nghttp2_config.h"
#include <nghttp2/asio_http2.h>
#include <nghttp2/asio_http2
_client
.h>
#endif // ASIO_CLIENT_TLS_CONTEXT_H
src/includes/Makefile.am
View file @
2fa28e79
...
...
@@ -20,4 +20,4 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
nobase_include_HEADERS
=
nghttp2/asio_http2.h
nobase_include_HEADERS
=
nghttp2/asio_http2.h
nghttp2/asio_http2_client.h
src/includes/nghttp2/asio_http2.h
View file @
2fa28e79
...
...
@@ -34,7 +34,6 @@
#include <boost/system/error_code.hpp>
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
#include <nghttp2/nghttp2.h>
...
...
@@ -287,99 +286,6 @@ std::string percent_decode(const std::string &s);
// Returns HTTP date representation of current posix time |t|.
std
::
string
http_date
(
int64_t
t
);
namespace
client
{
class
response_impl
;
class
response
{
public:
response
();
~
response
();
void
on_data
(
data_cb
cb
)
const
;
int
status_code
()
const
;
int64_t
content_length
()
const
;
const
header_map
&
header
()
const
;
response_impl
&
impl
();
private:
std
::
unique_ptr
<
response_impl
>
impl_
;
};
class
request
;
using
response_cb
=
std
::
function
<
void
(
const
response
&
)
>
;
using
request_cb
=
std
::
function
<
void
(
const
request
&
)
>
;
using
connect_cb
=
std
::
function
<
void
(
boost
::
asio
::
ip
::
tcp
::
resolver
::
iterator
)
>
;
class
request_impl
;
class
request
{
public:
request
();
~
request
();
void
on_response
(
response_cb
cb
)
const
;
void
on_push
(
request_cb
cb
)
const
;
void
on_close
(
close_cb
cb
)
const
;
void
cancel
()
const
;
const
std
::
string
&
method
()
const
;
const
uri_ref
&
uri
()
const
;
const
header_map
&
header
()
const
;
request_impl
&
impl
();
private:
std
::
unique_ptr
<
request_impl
>
impl_
;
};
class
session_impl
;
class
session
{
public:
session
(
boost
::
asio
::
io_service
&
io_service
,
const
std
::
string
&
host
,
const
std
::
string
&
service
);
session
(
boost
::
asio
::
io_service
&
io_service
,
boost
::
asio
::
ssl
::
context
&
tls_context
,
const
std
::
string
&
host
,
const
std
::
string
&
service
);
~
session
();
void
on_connect
(
connect_cb
cb
);
void
on_error
(
error_cb
cb
);
void
shutdown
();
boost
::
asio
::
io_service
&
io_service
();
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
header_map
h
=
{});
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
std
::
string
data
,
header_map
h
=
{});
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
read_cb
cb
,
header_map
h
=
{});
private:
std
::
unique_ptr
<
session_impl
>
impl_
;
};
// configure |tls_ctx| for client use. Currently, we just set NPN
// callback for HTTP/2.
void
configure_tls_context
(
boost
::
asio
::
ssl
::
context
&
tls_ctx
);
}
// namespace client
}
// namespace asio_http2
}
// namespace nghttp2
...
...
src/includes/nghttp2/asio_http2_client.h
0 → 100644
View file @
2fa28e79
/*
* nghttp2 - HTTP/2 C Library
*
* Copyright (c) 2015 Tatsuhiro Tsujikawa
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ASIO_HTTP2_CLIENT_H
#define ASIO_HTTP2_CLIENT_H
#include <nghttp2/asio_http2.h>
#include <boost/asio/ssl.hpp>
namespace
nghttp2
{
namespace
asio_http2
{
namespace
client
{
class
response_impl
;
class
response
{
public:
response
();
~
response
();
void
on_data
(
data_cb
cb
)
const
;
int
status_code
()
const
;
int64_t
content_length
()
const
;
const
header_map
&
header
()
const
;
response_impl
&
impl
();
private:
std
::
unique_ptr
<
response_impl
>
impl_
;
};
class
request
;
using
response_cb
=
std
::
function
<
void
(
const
response
&
)
>
;
using
request_cb
=
std
::
function
<
void
(
const
request
&
)
>
;
using
connect_cb
=
std
::
function
<
void
(
boost
::
asio
::
ip
::
tcp
::
resolver
::
iterator
)
>
;
class
request_impl
;
class
request
{
public:
request
();
~
request
();
void
on_response
(
response_cb
cb
)
const
;
void
on_push
(
request_cb
cb
)
const
;
void
on_close
(
close_cb
cb
)
const
;
void
cancel
()
const
;
const
std
::
string
&
method
()
const
;
const
uri_ref
&
uri
()
const
;
const
header_map
&
header
()
const
;
request_impl
&
impl
();
private:
std
::
unique_ptr
<
request_impl
>
impl_
;
};
class
session_impl
;
class
session
{
public:
session
(
boost
::
asio
::
io_service
&
io_service
,
const
std
::
string
&
host
,
const
std
::
string
&
service
);
session
(
boost
::
asio
::
io_service
&
io_service
,
boost
::
asio
::
ssl
::
context
&
tls_context
,
const
std
::
string
&
host
,
const
std
::
string
&
service
);
~
session
();
void
on_connect
(
connect_cb
cb
);
void
on_error
(
error_cb
cb
);
void
shutdown
();
boost
::
asio
::
io_service
&
io_service
();
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
header_map
h
=
{});
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
std
::
string
data
,
header_map
h
=
{});
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
read_cb
cb
,
header_map
h
=
{});
private:
std
::
unique_ptr
<
session_impl
>
impl_
;
};
// configure |tls_ctx| for client use. Currently, we just set NPN
// callback for HTTP/2.
void
configure_tls_context
(
boost
::
asio
::
ssl
::
context
&
tls_ctx
);
}
// namespace client
}
// namespace asio_http2
}
// namespace nghttp2
#endif // ASIO_HTTP2_CLIENT_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment