@@ -148,14 +148,13 @@ static int print_each_header(void *userdata,
148
148
return HYPER_ITER_CONTINUE ;
149
149
}
150
150
151
- static void print_informational (void * userdata , hyper_response * resp ) {
151
+ static void print_informational (void * userdata , const hyper_response * resp ) {
152
152
uint16_t http_status = hyper_response_status (resp );
153
153
154
154
printf ("\nInformational (1xx): %d\n" , http_status );
155
155
156
- hyper_headers * headers = hyper_response_headers (resp );
157
- hyper_headers_foreach (headers , print_each_header , NULL );
158
- printf ("\n" );
156
+ const hyper_buf * headers = hyper_response_headers_raw (resp );
157
+ write (1 , hyper_buf_bytes (headers ), hyper_buf_len (headers ));
159
158
}
160
159
161
160
typedef enum {
@@ -218,14 +217,15 @@ int main(int argc, char *argv[]) {
218
217
hyper_io_set_read (io , read_cb );
219
218
hyper_io_set_write (io , write_cb );
220
219
221
- printf ("http handshake ...\n" );
220
+ printf ("http handshake (hyper v%s) ...\n" , hyper_version () );
222
221
223
222
// We need an executor generally to poll futures
224
223
const hyper_executor * exec = hyper_executor_new ();
225
224
226
225
// Prepare client options
227
226
hyper_clientconn_options * opts = hyper_clientconn_options_new ();
228
227
hyper_clientconn_options_exec (opts , exec );
228
+ hyper_clientconn_options_headers_raw (opts , 1 );
229
229
230
230
hyper_task * handshake = hyper_clientconn_handshake (io , opts );
231
231
hyper_task_set_userdata (handshake , (void * )EXAMPLE_HANDSHAKE );
@@ -275,6 +275,10 @@ int main(int argc, char *argv[]) {
275
275
hyper_headers_set (req_headers , STR_ARG ("host" ), STR_ARG (host ));
276
276
hyper_headers_set (req_headers , STR_ARG ("expect" ), STR_ARG ("100-continue" ));
277
277
278
+ // NOTE: We aren't handling *waiting* for the 100 Continue,
279
+ // the body is sent immediately. This will just print if any
280
+ // informational headers are received.
281
+ printf (" with expect-continue ...\n" );
278
282
hyper_request_on_informational (req , print_informational , NULL );
279
283
280
284
// Prepare the req body
0 commit comments