   "Hook run before post wandbox.
 Return value will be merged into the old profile.")
 
-(defun wandbox-fetch-url (url)
-  (declare (special url-http-end-of-headers))
-  (with-current-buffer (url-retrieve-synchronously url)
-    (unwind-protect
-        (buffer-substring (1+ url-http-end-of-headers) (point-max))
-      (kill-buffer (current-buffer)))))
+(defvar wandbox-permalink-action #'browse-url
+  "Specify function to execute when you run `wandbox-compile' with permalink option (:save).")
 
 (defun wandbox-fetch (src)
-  (if (string-match "http[s]?://" src)
-      (wandbox-fetch-url src)
-      (with-temp-buffer
-        (insert-file-contents src)
-        (buffer-string))))
+  (with-temp-buffer
+    (if (string-match "http[s]?://" src)
+        (url-insert-file-contents src)
+        (insert-file-contents src))
+    (buffer-string)))
 
 (defun wandbox-merge-plist (&rest args)
   (let ((result (car args)))

         (progn
           (when (equal (car status) :error)
             (error "return error: %s" (cdr status)))
           (let* ((http-body (buffer-substring (1+ url-http-end-of-headers) (point-max)))
                  (alist (let ((json-key-type 'string))
                           (json-read-from-string
                            (decode-coding-string http-body 'utf-8-unix))))
                  (url (cdr (assoc "url" alist))))
             (message "Wandbox recieve message: %s" http-body)
             (if url (browse-url url))  ; or (wandbox-tweet url)
             (with-output-to-temp-buffer "*Wandbox Output*"
               (dolist (res wandbox-response-keywords)
                 (when (assoc res alist)

  (let ((url-request-method "POST")
        (url-request-extra-headers '(("Content-Type" . "application/json")))
        (url-request-data json))
    (url-retrieve "http://melpon.org/wandbox/api/compile.json" 
                  'wandbox-format-url-buffer)
    t))

(defun* wandbox-compile (&rest profile
                         &key
