17 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
26 #ifndef GLOBUS_L_GASS_TRANSFER_HTTP_H
27 #define GLOBUS_L_GASS_TRANSFER_HTTP_H
38 GLOBUS_L_DEFAULT_HTTP_PORT = 80,
39 GLOBUS_L_DEFAULT_HTTPS_PORT = 443,
40 GLOBUS_L_GASS_RESPONSE_LEN = 256
45 GLOBUS_L_LINE_MODE_UNKNOWN,
46 GLOBUS_L_LINE_MODE_CR,
47 GLOBUS_L_LINE_MODE_LF,
48 GLOBUS_L_LINE_MODE_CRLF
49 } globus_gass_transfer_http_line_mode_t;
56 const globus_gass_transfer_http_line_mode_t
57 globus_l_gass_transfer_http_line_mode =
58 #ifndef TARGET_ARCH_WIN32
59 GLOBUS_L_LINE_MODE_LF;
61 GLOBUS_L_LINE_MODE_CRLF;
67 #define GLOBUS_L_TEXT_BYTE(text) (text & 0x7f)
72 #define globus_l_gass_transfer_http_lock() \
73 globus_mutex_lock(&globus_l_gass_transfer_http_mutex) \
75 #define globus_l_gass_transfer_http_unlock() \
77 globus_mutex_unlock(&globus_l_gass_transfer_http_mutex)
78 #define globus_l_gass_transfer_http_wait() \
79 globus_cond_wait(&globus_l_gass_transfer_http_cond, \
80 &globus_l_gass_transfer_http_mutex)
81 #define globus_l_gass_transfer_http_signal() \
82 globus_cond_signal(&globus_l_gass_transfer_http_cond)
84 static char * globus_l_gass_transfer_http_subject_name;
89 #define CRLF "\015\012"
90 #define CR_STRING "\015"
91 #define LF_STRING "\012"
94 #define GLOBUS_GASS_HTTP_VERSION "Globus-GASS-HTTP/1.1.0"
96 #define GLOBUS_L_APPEND_URI "/globus-bins/GASSappend?"
98 #define GLOBUS_L_GET_COMMAND "GET %s HTTP/1.1" CRLF \
100 "Connection: close" CRLF \
101 "User-Agent: " GLOBUS_GASS_HTTP_VERSION CRLF
103 #define GLOBUS_L_PUT_COMMAND "PUT %s HTTP/1.1" CRLF \
105 "Connection: close" CRLF \
106 "User-Agent: " GLOBUS_GASS_HTTP_VERSION CRLF
108 #define GLOBUS_L_APPEND_COMMAND "POST " GLOBUS_L_APPEND_URI "%s " \
111 "Connection: close" CRLF \
112 "User-Agent: " GLOBUS_GASS_HTTP_VERSION CRLF
114 #define GLOBUS_L_REFER_RESPONSE "HTTP/1.1 302 Moved Temporarily" CRLF \
115 "Connection: close" CRLF \
116 "Server: " GLOBUS_GASS_HTTP_VERSION CRLF
118 #define GLOBUS_L_CONTINUE_RESPONSE "HTTP/1.1 100 Continue" CRLF
120 #define GLOBUS_L_GENERIC_RESPONSE "HTTP/1.%d %d %s" CRLF \
121 "Connection: close" CRLF \
122 "Server: " GLOBUS_GASS_HTTP_VERSION CRLF
123 #define GLOBUS_L_OK "Ok"
125 #define GLOBUS_L_DENIAL_RESPONSE "HTTP/1.1 %d %s" CRLF \
126 "Connection: close" CRLF \
127 "Server: " GLOBUS_GASS_HTTP_VERSION CRLF
129 #define GLOBUS_L_DEFAULT_DENIAL_MESSAGE "Internal Server Error"
131 #define GLOBUS_L_CONTENT_LENGTH_HEADER "Content-Length: %ld" CRLF
132 #define GLOBUS_L_CHUNKED_HEADER "Transfer-Encoding: chunked" CRLF
133 #define GLOBUS_L_BINARY_HEADER "Content-Type: " \
134 "application/octet-stream" CRLF
135 #define GLOBUS_L_TEXT_HEADER "Content-Type: text/plain" CRLF
136 #define GLOBUS_L_HTML_HEADER "Content-Type: text/html" CRLF
137 #define GLOBUS_L_HTML_REFERRAL_BODY_HEAD \
138 "<html><head><title>Document Moved</title></head><body>"
139 #define GLOBUS_L_HTML_REFERRAL_BODY_TAIL \
141 #define GLOBUS_L_HTML_DENIAL_BODY "<html><head><title>%d %s</title></head><body>" CRLF \
142 "<h1>%d %s</h1></body></html>" CRLF
143 #define GLOBUS_L_HTML_HREF "<a href=\"%s\">%s</a><br>"
144 #define GLOBUS_L_LOCATION_HEADER "Location: %s" CRLF
146 #define GLOBUS_L_DEFAULT_FAILURE_CODE 400
147 #define GLOBUS_L_DEFAULT_FAILURE_REASON "Bad Request"
150 #define GLOBUS_L_PROTOCOL_FAILURE_CODE 416
151 #define GLOBUS_L_PROTOCOL_FAILURE_REASON "Protocol Error"
153 #define GLOBUS_L_MALLOC_FAILURE_CODE 417
154 #define GLOBUS_L_MALLOC_FAILURE_REASON "Malloc Error"
162 GLOBUS_GASS_TRANSFER_HTTP_STATE_CONNECTING,
163 GLOBUS_GASS_TRANSFER_HTTP_STATE_REQUESTING,
164 GLOBUS_GASS_TRANSFER_HTTP_STATE_CLOSING,
165 GLOBUS_GASS_TRANSFER_HTTP_STATE_REFERRED,
166 GLOBUS_GASS_TRANSFER_HTTP_STATE_DENIED,
167 GLOBUS_GASS_TRANSFER_HTTP_STATE_RESPONDING,
169 GLOBUS_GASS_TRANSFER_HTTP_STATE_IDLE,
170 GLOBUS_GASS_TRANSFER_HTTP_STATE_DONE,
171 GLOBUS_GASS_TRANSFER_HTTP_STATE_PENDING
172 } globus_gass_transfer_http_state_t;
177 GLOBUS_GASS_TRANSFER_HTTP_LISTENER_STARTING,
178 GLOBUS_GASS_TRANSFER_HTTP_LISTENER_LISTENING,
179 GLOBUS_GASS_TRANSFER_HTTP_LISTENER_READY,
180 GLOBUS_GASS_TRANSFER_HTTP_LISTENER_ACCEPTING,
181 GLOBUS_GASS_TRANSFER_HTTP_LISTENER_CLOSING1,
182 GLOBUS_GASS_TRANSFER_HTTP_LISTENER_CLOSING2,
183 GLOBUS_GASS_TRANSFER_HTTP_LISTENER_CLOSED
184 } globus_gass_transfer_listener_state_t;
187 GLOBUS_GASS_TRANSFER_HTTP_RECV_STATE_CHUNK_SIZE,
188 GLOBUS_GASS_TRANSFER_HTTP_RECV_STATE_CHUNK_EXT,
189 GLOBUS_GASS_TRANSFER_HTTP_RECV_STATE_CHUNK_END_HEADER_CR,
190 GLOBUS_GASS_TRANSFER_HTTP_RECV_STATE_CHUNK_END_HEADER_LF,
191 GLOBUS_GASS_TRANSFER_HTTP_RECV_STATE_CHUNK_BODY,
192 GLOBUS_GASS_TRANSFER_HTTP_RECV_STATE_CHUNK_END_BODY_CR,
193 GLOBUS_GASS_TRANSFER_HTTP_RECV_STATE_CHUNK_END_BODY_LF,
194 GLOBUS_GASS_TRANSFER_HTTP_RECV_STATE_CHUNK_FOOTER,
195 GLOBUS_GASS_TRANSFER_HTTP_RECV_STATE_UNTIL_LENGTH,
196 GLOBUS_GASS_TRANSFER_HTTP_RECV_STATE_UNTIL_EOF,
197 GLOBUS_GASS_TRANSFER_HTTP_RECV_STATE_EOF,
198 GLOBUS_GASS_TRANSFER_HTTP_RECV_STATE_ERROR
199 } globus_l_gass_transfer_http_recv_state_t;
210 globus_gass_transfer_listener_t listener;
211 globus_io_handle_t handle;
214 globus_gass_transfer_listener_state_t state;
217 struct globus_gass_transfer_http_request_proto_s * request;
218 } globus_gass_transfer_http_listener_proto_t;
220 typedef struct globus_gass_transfer_http_request_proto_s
235 globus_io_handle_t handle;
241 volatile globus_gass_transfer_http_state_t state;
275 globus_l_gass_transfer_http_recv_state_t recv_state;
294 globus_gass_transfer_http_line_mode_t line_mode;
304 globus_gass_transfer_authorization_t authorization_mode;
305 char * authorized_subject;
306 char * connected_subject;
314 } globus_gass_transfer_http_request_proto_t;
319 #if !defined(GLOBUS_GASS_TRANSFER_HTTP_PARSER_TEST)
322 globus_l_gass_transfer_http_send(
331 globus_l_gass_transfer_http_receive(
340 globus_l_gass_transfer_http_writev_callback(
342 globus_io_handle_t * handle,
350 globus_l_gass_transfer_http_write_callback(
352 globus_io_handle_t * handle,
359 globus_l_gass_transfer_http_write_response(
361 globus_io_handle_t * handle,
368 globus_l_gass_transfer_http_proto_destroy(
369 globus_gass_transfer_http_request_proto_t * proto);
373 globus_l_gass_transfer_http_read_callback(
375 globus_io_handle_t * handle,
382 globus_l_gass_transfer_http_read_buffered_callback(
384 globus_io_handle_t * handle,
391 globus_l_gass_transfer_http_callback_read_buffered_callback(
396 globus_l_gass_transfer_http_callback_ready_callback(
399 globus_l_gass_transfer_http_copy_text_buffer(
402 globus_gass_transfer_http_line_mode_t * line_mode,
410 globus_l_gass_transfer_http_fail(
416 globus_l_gass_transfer_http_close_callback(
418 globus_io_handle_t * handle,
423 globus_l_gass_transfer_http_accept_callback(
425 globus_io_handle_t * handle,
431 globus_l_gass_transfer_http_destroy(
437 globus_l_gass_transfer_http_new_request(
439 globus_gass_transfer_requestattr_t * attr);
443 globus_l_gass_transfer_http_new_requestattr(
448 globus_l_gass_transfer_http_new_listenerattr(
453 globus_l_gass_transfer_http_close_listener(
455 globus_gass_transfer_listener_t listener);
459 globus_l_gass_transfer_http_listen(
461 globus_gass_transfer_listener_t listener);
465 globus_l_gass_transfer_http_accept(
467 globus_gass_transfer_listener_t listener,
469 globus_gass_transfer_requestattr_t * attr);
473 globus_l_gass_transfer_http_authorization_callback(
475 globus_io_handle_t * handle,
478 gss_ctx_id_t context_handle);
482 globus_l_gass_transfer_http_listener_destroy(
484 globus_gass_transfer_listener_t listener);
488 globus_l_gass_transfer_http_new_listener(
489 globus_gass_transfer_listener_t listener,
490 globus_gass_transfer_listenerattr_t * attr,
497 globus_l_gass_transfer_http_connect_callback(
499 globus_io_handle_t * handle,
504 globus_l_gass_transfer_http_command_callback(
506 globus_io_handle_t * handle,
513 globus_l_gass_transfer_http_response_callback(
515 globus_io_handle_t * handle,
522 globus_l_gass_transfer_http_listener_proto_destroy(
523 globus_gass_transfer_http_listener_proto_t *
527 globus_l_gass_transfer_http_callback_listen_callback(
532 globus_l_gass_transfer_http_listen_callback(
534 globus_io_handle_t * handle,
540 globus_l_gass_transfer_http_find_crlf(
547 globus_l_gass_transfer_http_parse_headers(
548 globus_gass_transfer_http_request_proto_t * proto);
552 globus_l_gass_transfer_http_parse_one_header(
553 globus_gass_transfer_http_request_proto_t * proto,
558 globus_l_gass_transfer_http_parse_status_line(
559 globus_gass_transfer_http_request_proto_t * proto);
578 globus_l_gass_transfer_http_callback_send_callback(
583 globus_l_gass_transfer_http_request_callback(
585 globus_io_handle_t * handle,
592 globus_l_gass_transfer_http_register_read(
593 globus_gass_transfer_http_request_proto_t * proto);
597 globus_l_gass_transfer_http_construct_request(
598 globus_gass_transfer_http_request_proto_t * proto);
602 globus_l_gass_transfer_http_handle_chunk(
603 globus_gass_transfer_http_request_proto_t * proto);
607 globus_l_gass_transfer_http_parse_response(
608 globus_gass_transfer_http_request_proto_t * proto);
612 globus_l_gass_transfer_http_parse_request(
613 globus_gass_transfer_http_request_proto_t * proto);
617 globus_l_gass_transfer_http_parse_request_line(
618 globus_gass_transfer_http_request_proto_t * proto);
622 globus_l_gass_transfer_http_extract_referral(
623 globus_gass_transfer_http_request_proto_t * proto,
629 globus_l_gass_transfer_http_callback_denied(
634 globus_l_gass_transfer_http_close(
635 globus_gass_transfer_http_request_proto_t * proto);
639 globus_l_gass_transfer_http_register_close(
640 globus_gass_transfer_http_request_proto_t * proto);
644 globus_l_gass_transfer_http_listener_close(
645 globus_gass_transfer_http_listener_proto_t * proto);
Parsed URLs.This structure contains the fields which were parsed from an string representation of an ...
Definition: globus_url.h:88
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
globus_gass_transfer_request_type_t
Definition: globus_gass_transfer.h:145
void(* globus_gass_transfer_proto_accept_t)(globus_gass_transfer_listener_proto_t *proto, globus_gass_transfer_listener_t listener, globus_gass_transfer_request_t request, globus_gass_transfer_requestattr_t *attr)
Definition: globus_gass_transfer_proto.h:358
List data type.
Definition: globus_list.h:44
void(* globus_gass_transfer_proto_receive_t)(globus_gass_transfer_request_proto_t *proto, globus_gass_transfer_request_t request, globus_byte_t *bytes, globus_size_t bytes_length, globus_size_t wait_for_length)
Definition: globus_gass_transfer_proto.h:163
globus_gass_transfer_proto_listener_t listen
Definition: globus_gass_transfer_proto.h:437
Mutex.
Definition: globus_thread.h:107
Condition variable.
Definition: globus_thread.h:124
void(* globus_gass_transfer_proto_listener_t)(globus_gass_transfer_listener_proto_t *proto, globus_gass_transfer_listener_t listener)
Definition: globus_gass_transfer_proto.h:290
size_t globus_size_t
Standard size of memory objectThe globus_size_t is the size of a memory object. It is identical to si...
Definition: globus_types.h:48
void(* globus_gass_transfer_proto_send_t)(globus_gass_transfer_request_proto_t *proto, globus_gass_transfer_request_t request, globus_byte_t *bytes, globus_size_t send_length, globus_bool_t last_data)
Definition: globus_gass_transfer_proto.h:123
unsigned char globus_byte_t
Unsigned byte datatypeThis is used for byte-addressable arrays of arbitrary data which is not subject...
Definition: globus_types.h:85
Protocol module listener handling structure.
Definition: globus_gass_transfer_proto.h:432
void(* globus_gass_transfer_proto_func_t)(globus_gass_transfer_request_proto_t *proto, globus_gass_transfer_request_t request)
Definition: globus_gass_transfer_proto.h:190
uint32_t globus_result_t
Definition: globus_types.h:99
globus_url_scheme_t
URL Schemes.The Globus URL library supports a set of URL schemes (protocols). This enumeration can be...
Definition: globus_url.h:50
globus_gass_transfer_proto_listener_t close_listener
Definition: globus_gass_transfer_proto.h:435
Protocol module request handling structure.
Definition: globus_gass_transfer_proto.h:386
globus_gass_transfer_proto_listener_t destroy
Definition: globus_gass_transfer_proto.h:441
globus_gass_transfer_proto_accept_t accept
Definition: globus_gass_transfer_proto.h:439