• R/O
  • HTTP
  • SSH
  • HTTPS

ultramonkey-l7-v2: コミット

UltraMonkey-L7 V2(single-thread implementation)


コミットメタ情報

リビジョン30c86a2d57fb7ee3d05f92e871b78aa94fc160cd (tree)
日時2009-05-13 09:49:50
作者Shinya TAKEBAYASHI <makoto@kano...>
コミッターShinya TAKEBAYASHI

ログメッセージ

Deleted HTTP header modifires

変更サマリ

差分

--- a/module/protocol/module_http.c
+++ b/module/protocol/module_http.c
@@ -31,22 +31,6 @@
3131 #include <time.h>
3232 #include "module_http.h"
3333
34-char* _http_search_header_cookie_value(char*, char*, char*);
35-
36-/*!
37- * create a expire string of HTTP cookie header field.
38- * @param expire_t expire time
39- * @param expire_c return expire string
40- * @return void
41- */
42-extern void
43-http_cookie_expire(time_t expire_t, char* expire_c)
44-{
45- struct tm *date;
46-
47- date = gmtime(&expire_t);
48- strftime(expire_c, EXPIRE_MAXSIZE, "%a, %d-%b-%Y %H:%M:%S GMT", date);
49-}
5034
5135 /*!
5236 * check the HTTP status that is included in a HTTP Response header.
@@ -336,131 +320,8 @@ http_check_request_method(char *req, size_t *length)
336320 return uri;
337321 }
338322
339-/*!
340- * Encode IP address and port number.
341- * @param encoded encoded strings
342- * @param s_addr IP address (cf. inet_addr("xxx.xxx.xxx.xxx") => s_addr)
343- * @param sin_port port number
344- * @return void
345- */
346-extern void
347-http_encode_address(char *encoded, const u_long s_addr, const u_short sin_port)
348-{
349- /* check null */
350- if (encoded != NULL) {
351- /* encoded address formed XXXXXXXXXXPPPPP */
352- /* XXXXXXXXXX : IP address(10 bytes, number with left zero pad) */
353- /* PPPPP : port number(5 bytes, number with left zero pad) */
354-
355- sprintf(encoded, "%010lu%05u", s_addr, sin_port);
356- }
357-}
358-
359-/*!
360- * Decode encoded strings of IP address and port number.
361- * @param encoded encoded strings
362- * @param s_addr decoded IP address (cf. inet_addr("xxx.xxx.xxx.xxx") => s_addr)
363- * @param sin_port decoded port number
364- * @return void
365- */
366-extern void
367-http_decode_address(char *encoded, u_long *s_addr, u_short *sin_port)
368-{
369- char decode_buf[11];
370-
371- if (encoded != NULL && s_addr != NULL && sin_port != NULL) {
372- /* get encoded ip address strings */
373- memcpy(decode_buf, encoded, 10);
374- decode_buf[10] = '\0';
375- *s_addr = strtoul(decode_buf, NULL, 10);
376-
377- /* get encoded port number strings */
378- memcpy(decode_buf, encoded + 10, 5);
379- decode_buf[5] = '\0';
380- *sin_port = atoi(decode_buf);
381- }
382-}
383323
384324 /*!
385- * Search a HTTP cookie field and check the existence of the cookie name.
386- * @param http_header HTTP request header
387- * @param cookie_name HTTP cookie name
388- * @return char points to cookie value of found cookie name, or NULL.
389- */
390-extern char*
391-http_search_header_cookie_value(char *http_header, char *cookie_name)
392-{
393- return _http_search_header_cookie_value(http_header, "Cookie", cookie_name);
394-}
395-
396-/*!
397- * Search a set HTTP cookie field and check the existence of the cookie name.
398- * @param http_header HTTP request header
399- * @param cookie_name HTTP cookie name
400- * @return char points to cookie value of found cookie name, or NULL.
401- */
402-extern char*
403-http_search_header_set_cookie_value(char *http_header, char *cookie_name)
404-{
405- return _http_search_header_cookie_value(http_header, "Set-Cookie", cookie_name);
406-}
407-
408-char*
409-_http_search_header_cookie_value(char *http_header, char *field, char *cookie_name)
410-{
411- int check;
412- char *field_ptr;
413-
414- /* check NULL */
415- if (http_header == NULL || field == NULL || cookie_name == NULL) {
416- return NULL;
417- }
418-
419- /* search cookie header field from HTTP request header */
420- field_ptr = http_search_header_field(http_header, field);
421- if (field_ptr == NULL) {
422- return NULL;
423- }
424-
425- while (1) {
426- /* compare cookie field and cookie name */
427- for (check = 0;
428- field_ptr[check] == cookie_name[check] && cookie_name[check] != '\0';
429- ++check);
430-
431- /* when header match the cookie name, next word of cookie name must be '=' */
432- /* cf. CookieName'=' and CookieName'V'alue= */
433- if (cookie_name[check] == '\0' && field_ptr[check] == '=') {
434- /* matched cookie name completely! */
435- ++check;
436- /* return pointer of searched cookie name's value */
437- return &field_ptr[check];
438- }
439-
440- /* skip until next cookie's value */
441- for ( ;
442- field_ptr[check] != ';' && field_ptr[check] != ',';
443- ++check) {
444- if (field_ptr[check] == '\r' || field_ptr[check] == '\0') {
445- return NULL;
446- }
447- }
448-
449- /* skip a space, tab, etc. */
450- for ( ++check;
451- !isgraph(field_ptr[check]) && field_ptr[check] != '\r' && field_ptr[check] != '\0';
452- ++check );
453-
454- /* cookie name was not found */
455- if (field_ptr[check] == '\r' || field_ptr[check] == '\0') {
456- return NULL;
457- }
458-
459- field_ptr += check;
460- }
461-}
462-
463-/*!
464325 * Search a HTTP header field.
465326 * @param http_header HTTP request/response header
466327 * @param field_name HTTP header field name
--- a/module/protocol/module_http.h
+++ b/module/protocol/module_http.h
@@ -29,13 +29,8 @@
2929 // functions
3030 //
3131
32-extern void http_cookie_expire(time_t expire_t, char* expire_c);
3332 extern int http_check_response_status(char *res);
3433 extern char* http_check_request_method(char *req, size_t *length);
35-extern void http_encode_address(char *encoded, const u_long s_addr, const u_short sin_port);
36-extern void http_decode_address(char *encoded, u_long *s_addr, u_short *sin_port);
37-extern char* http_search_header_cookie_value(char *http_header, char *cookie_name);
38-extern char* http_search_header_set_cookie_value(char *http_header, char *cookie_name);
3934 extern char* http_search_header_field(char *http_header, char *search_name);
4035 extern int http_insert_field(char *header, int offset_length, char *insert_field, int header_length);
4136 extern char* http_skip_header_line(char *top_ptr);
旧リポジトリブラウザで表示