Changeset 13391 in project


Ignore:
Timestamp:
02/23/09 19:54:08 (11 years ago)
Author:
sjamaan
Message:

Make http-client only send the port number in the Host header when it's not the default port for the given protocol type [suggested by Drew Hess]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/http/trunk/http-client.scm

    r11355 r13391  
    195195       (display (car fragments))
    196196       (loop (cdr fragments) #t)))))
     197
     198(define (default-port? serv port)
     199  (or (and (string=? serv "http") (= port 80))
     200      (and (string=? serv "https") (= port 443))))
    197201
    198202(define (http:send-request req . more)
     
    225229                                           path " " proto "\r\n"))
    226230                   (set! result (string-append method " " path " " proto
    227                                            "\r\nHost: " host ":"
    228                                            (->string port) "\r\n")))
     231                                           "\r\nHost: " host
     232                                           (if (default-port? serv port)
     233                                               ""
     234                                               (conc ":" port))
     235                                           "\r\n")))
    229236             (for-each
    230237              (lambda (a)
Note: See TracChangeset for help on using the changeset viewer.