Function: spam-report-url-ping-plain

spam-report-url-ping-plain is a byte-compiled function defined in spam-report.el.gz.

Signature

(spam-report-url-ping-plain HOST REPORT)

Documentation

Ping a host through HTTP, addressing a specific GET resource.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/spam-report.el.gz
(defun spam-report-url-ping-plain (host report)
  "Ping a host through HTTP, addressing a specific GET resource."
  (let ((tcp-connection))
    (with-temp-buffer
      (or (setq tcp-connection
		(open-network-stream
		 "URL ping"
		 (buffer-name)
		 host
		 80))
	  (error "Could not open connection to %s" host))
      (set-marker (process-mark tcp-connection) (point-min))
      (set-process-query-on-exit-flag tcp-connection nil)
      (process-send-string
       tcp-connection
       (format "GET %s HTTP/1.1\nUser-Agent: %s\nHost: %s\n\n"
	       report spam-report-user-agent host))
      ;; Wait until we get something so we don't DOS the host, if
      ;; `spam-report-gmane-wait' is let-bound to t.
      (when spam-report-gmane-wait
	(gnus-message 7 "Waiting for response from %s..." host)
	(while (and (memq (process-status tcp-connection) '(open run))
		    (zerop (buffer-size)))
	  (accept-process-output tcp-connection 1))
	(gnus-message 7 "Waiting for response from %s... done" host)))))